Class: Widget

Simplicite.UI.View.Widget

new Widget

Common widgets

Parameters:
Name Type Description
app Simplicite.Ajax Ajax service
engine Simplicite.UI.Engine Main controller
view Simplicite.UI.View.Main View services
Source:
  • widget.js, line 14

Members

PALETTES

Predefined palettes

  • Base
  • Pastel
  • Strong
  • Light
  • Bright
  • Mars
  • Sea
  • Berry
  • Fire
  • Choco

Source:
  • widget.js, line 704

Methods

actionBar

Action bar

Parameters:
Name Type Description
list jQuery[] Array of buttons (plain or plus)
alignRight boolean pull on the right side of container ?
Source:
  • widget.js, line 251
Returns:
div.actions

actionItems

Convert actions to buttons array

Parameters:
Name Type Description
ctn jQuery Container
o Simplicite.Ajax.BusinessObject Business object
rowId string Optional rowId on form/row
list object[] List of actions as plain buttons
plus object[] List of actions as 'plus' button
options object Options
Properties
Name Type Description
alignRight boolean true for right side
minified boolean true to move labels in tooltips
dropUp boolean true to drop up the 'plus' popup
plusFirst boolean true to put the plus button on first position
grouped boolean true to group plain buttons per type (print, crosstab, treeview, placemap, associate)
Source:
  • widget.js, line 165
Returns:
jQuery items

animate

Replace the current content with another one

Parameters:
Name Type Description
ctn jQuery container
div jQuery new content to load in container
type string optional animation: slide 'left, slide 'right' or 'opacity'
cbk function optional callback when the animation is terminated
Source:
  • widget.js, line 280

avatar

Build an avatar image

Parameters:
Name Type Description
grant object User rights or only { userId, image }
Source:
  • widget.js, line 26
Returns:
image or a default span

badge

Create a badge

Parameters:
Name Type Description
p string | object value or { name, value }
Source:
  • widget.js, line 38
Returns:
div.badge

breadcrump

Build a breadcrump 'first / ... / last ones'

Parameters:
Name Type Description
items (string | object)[] list of items : string or { label }
size number size limit
cbk function click handler on item
Source:
  • widget.js, line 333
Returns:
ol.breadcrumb

calculator

Launch a simple calculator on input

Parameters:
Name Type Description
input object form input
cbk function callback(result)
Source:
  • widget.js, line 622
Returns:
input

charCounter

Create a characters counter on input field

Parameters:
Name Type Description
inp string | jQuery input or textarea
options Object Options
Properties
Name Type Description
max number Max length of input (default 100)
position string top or bottom (default bottom)
align string left or right (default left)
toggle boolean true to show/hide on focus/blur
Source:
  • widget.js, line 1369

circularProgressBar

Circular progress bar

Parameters:
Name Type Description
options object { background, color, percent, duration, radius, width }
Properties
Name Type Description
percent string percent value 0..100
background string center background color
color string center text color
color1 string circle color
color2 string circle active color
duration number animation duration in ms (default 2000)
radius number circle radius in px
width number circle line width in px
text string | $ optional center content (""=empty, default='n%')
bar string optional bar selector to update value
Source:
  • widget.js, line 1050

completion

Bind a completion to input

Parameters:
Name Type Description
inp jQuery input or null
limit number max size of results
search function service(cbk)
select function optional callback on ENTER
disp function optional callback to display a result
options Object options
Properties
Name Type Description
autoselect boolean auto-select the single result on blur or enter (default false)
Source:
  • widget.js, line 366
Returns:
input

completionSocial

Bind a completion to textarez (substitute @login)

Parameters:
Name Type Description
textarea jQuery social textarea
Source:
  • widget.js, line 504

getBase64Image

Convert image to base64 (using a canvas)

Parameters:
Name Type Description
img object DOM image
mime string mime type (ex: image/jpeg)
Source:
  • widget.js, line 262
Returns:
string = image BASE64 encoded

iconPicker

Icon picker

Parameters:
Name Type Description
input jquery input to set with selected icon
embedded boolean only content or full dialog
selected string optional selected icon
onSelect function optional callback(icon)
Source:
  • widget.js, line 771

palettePicker

Palette of colors picker

Parameters:
Name Type Description
params object Parameters
Properties
Name Type Description
palette function optional selected palette
pick function optional pick handler(palette)
dropup boolean true to dropup (default dropdown)
inline boolean true to inline the palettes (default display a dropdown button)
Source:
  • widget.js, line 726

pillbox

Pillbox control with completion

Parameters:
Name Type Description
div object container
data object pre-selected data [{id,label}]
limit number max size of search results (0 = read only)
search function optional service(value, cbk) to search data with the input value
disp function to display completion row and add pillbox data {id,label}
lookup function optional service(cbk(id,label)) to display a lookup to add an item
onAdd function optional callback(id,cbk) when item is added, set to null to disable adding
onRemove function optional callback(id,cbk) when item is removed, set to null to disable deletion
onCreate function optional callback(val,cbk(id,label)) when item is created, set to null to disable creation
onOpen function optional callback(id) to open the object form
Source:
  • widget.js, line 600
Returns:
pillbox

postProgress

POST/UPLOAD dialog

Parameters:
Name Type Description
ctn $ container
e object progress event from xhr
params object { id, label, after, background }
Source:
  • widget.js, line 1158

switchButton

Build a switch button on/off

Parameters:
Name Type Description
p object button parameters
Properties
Name Type Description
id string input id
name string input name
value string input initial value (default "1")
onchange function optional 'change' handler
checked boolean on/off ?
disabled boolean false to disable the switch
round boolean round or square ?
Source:
  • widget.js, line 67
Returns:
label with a checkbox and a slider

toast

Toast dialog

Parameters:
Name Type Description
options Object text or { level, content, position, align, duration }
Properties
Name Type Description
level string 'info' (default), 'success', 'warning', 'error'='danger'
content string content message
position string 'top' (default) or 'bottom'
align string 'left' 'center' (default) or 'right'
duration number animation duration in ms (default 3000), -1 = infinity
undo boolean add a UNDO button ?
pinable boolean add a push-pin button ?
Source:
  • widget.js, line 1280

waitdlg

Wait dialog box

Source:
  • widget.js, line 48
Returns:
div.waitdlg

<inner> actionItem

Build an action control

Parameters:
Name Type Description
ctn jQuery container
a object action metadata
o Simplicite.Ajax.BusinessObject object
rowId string optional rowId for form/row action
click function click handler
minified boolean true to move the label in a tooltip
Source:
  • widget.js, line 93
Returns:
button or li for 'Plus' button