Loader

Simplicite.UI. Loader

new Loader()

Description:
  • UI Loader tool

Members

FILE_ICONS

Description:
  • Common file extension icon

Common file extension icon

KEYS

Description:
  • Common key codes

    • BACKSPACE
    • TAB
    • ENTER
    • SHIFT
    • CTRL
    • ALT
    • PAUSE
    • CAPS_LOCK
    • ESCAPE
    • PAGE_UP
    • PAGE_DOWN
    • END
    • HOME
    • LEFT_ARROW
    • UP_ARROW
    • RIGHT_ARROW
    • DOWN_ARROW
    • INSERT
    • DELETE

Common key codes

  • BACKSPACE
  • TAB
  • ENTER
  • SHIFT
  • CTRL
  • ALT
  • PAUSE
  • CAPS_LOCK
  • ESCAPE
  • PAGE_UP
  • PAGE_DOWN
  • END
  • HOME
  • LEFT_ARROW
  • UP_ARROW
  • RIGHT_ARROW
  • DOWN_ARROW
  • INSERT
  • DELETE

MIME_EXT

Description:
  • Mime type to file extension

Mime type to file extension

editors

Description:
  • Loaded editors

Loaded editors

Methods

addShortcuts(keys)

Description:
  • Add keys shortcuts to document

Parameters:
Name Type Description
keys Object

Pair of ('ctrl' | 'shift' | 'alt') + letter or char-code = callback or shortcut definition

clearCache(action)

Description:
  • System clear cache

Parameters:
Name Type Description
action string

Action cc|dc|gc for server, all sessions or granted user

clientId()

Description:
  • Return the local client Id from local storage

compat(w)

Description:
  • Complete globals in window.Simplicite

Parameters:
Name Type Description
w Object

Optional window to init

detachURL(url, options)

Description:
  • Open the url in a separate window with the UI engine

Parameters:
Name Type Description
url string

URL to load in a new window

options Object

Detach options

Properties
Name Type Attributes Default Description
name string <optional>
detachurl

Optional window name

width number <optional>
1200

Optional window width in px

height number <optional>
700

Optional window height in px

top number <optional>
0

Optional window top in px

left number <optional>
0

Optional window left in px (default 0)

full boolean

True to load the main parts (menu, header... default load the URL in div.main without parts)

Returns:

new window

firebase(data)

Description:
  • Firebase service wrapper

Parameters:
Name Type Description
data Object

Service data

Properties
Name Type Description
config Object

Init web browser to receive notifiction

token Object

Add the device token to FIREBASE_TOKENS on server side

tap Object

Incoming notification has been tapped by user?

body Object

Optional received message

title Object

Optional message title

from Object

Optional message origin

message Object

Message to send on server-side

to Object

Recipients { users:[], groups:[] } or 'all' users

getNavInstanceName(c, obj, inst)

Description:
  • Generate the instance name within the component navigator. Returns the common instance name on main navigation, otherwise add a suffix ex: the_ajax_(name)_nav(id)

Parameters:
Name Type Description
c string | jQuery

Component

obj string | Simplicite.Ajax.BusinessObject

Object name or BusinessObject

inst string

Optional instance name, default = the_ajax_(name)

getNavObject(ctn, obj, inst, cbk, params)

Description:
  • Get a business object extended with UI abilities per container navigator

    • obj.metadata: object metadata with extended ObjectField
    • obj.ui: this UI engine shorthand
    • obj.locals.ui: copy of global UI options, to be changed per instance
    • optional editors: load Ace and/or Tinymce
    • optional web resources: STYLES and SCRIPT
    • optional UI constraints script
Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Object name or BusinessObject

inst string

Optional instance name, default is the_ajax_name to be managed as a Main and Ajax object on server side

cbk function

Callback function(obj) when loaded

params Object

Optional parameters to load metadata { container, context, contextParam, parent, error }

getTop()

Description:
  • Top Simplicite window

getUIObject(obj, inst, cbk, params)

Description:
  • Get a business object extended with UI abilities:

    • obj.metadata: object metadata with extended ObjectField
    • obj.ui: this UI engine shorthand
    • obj.locals.ui: copy of global UI options, to be changed per instance
    • optional editors: load Ace and/or Tinymce
    • optional web resources: STYLES and SCRIPT
    • optional UI constraints script
Parameters:
Name Type Description
obj string | Simplicite.Ajax.BusinessObject

Object name or BusinessObject

inst string

Optional instance name, default is the_ajax_name to be managed as a Main and Ajax object on server side

cbk function

Callback function(obj) when loaded

params Object

Optional parameters to load metadata { container, context, contextParam, parent, error }

load(p)

Description:
  • Load a HTML/JS/CSS resource(s) in the target selector

Parameters:
Name Type Description
p Object | Array

Parameters or array of parameters

Properties
Name Type Description
name string

resource name

url string

or resource URL

type string

"HTML", "CSS" or "JS" (or URL extension)

target string

optional selector to append the "HTML" part

silent string

true for no logging (not found 404)

force string

ignore the local cache

Returns:

Promise

loadAceEditor(cbk)

Description:
  • Load ACE editor

Parameters:
Name Type Description
cbk function

optional callback

loadCSS(p)

Description:
  • Load a server CSS

Parameters:
Name Type Description
p Object | string

Parameters or URL

Properties
Name Type Description
url string

script location

inline boolean

true to inline the styles in header (default add a link to the stylesheet)

async boolean

asynchronous ? true by default

onload function

optional callback when loaded

silent string

true for no logging (not found 404)

force string

ignore the local cache

id string

optional link id

loadCalendar(cbk)

Description:
  • Calendar loading from FULLCALENDAR_LIBS or /scripts/fullcalendar. Needs sysparam FULLCALENDAR_VERSION = "3" or "4" or "5" (default 5)

Parameters:
Name Type Description
cbk function

Optional callback

loadCharts(cbk, version)

Description:
  • Load chart.js libs

Parameters:
Name Type Description
cbk function

Optional callback

version string

Optional version (2 or 3), default CHARTJS_VERSION or 3.

loadDiagramEngine(svg, cbk)

Description:
  • Load the diagram engine

Parameters:
Name Type Description
svg boolean

Load only SVG engine?

cbk function

Optional callback

loadEditor(editor, cbk)

Description:
  • External editor loading

Parameters:
Name Type Description
editor Object

editor parameters

Properties
Name Type Description
name string

unique name

url string

URL of editor script

onload function

optional handler to init the editor

cbk function

callback when loaded

loadEngine(name, cbk)

Description:
  • Load the Rendering engine

Parameters:
Name Type Description
name string

extended engine name (bootstrap5 by default)

cbk function

onload callback

loadFontsMeta(cbk)

Description:
  • Load metadata of font icons

Parameters:
Name Type Description
cbk function

optional callback(meta)

loadGridJson(cbk)

Description:
  • Grid tool for JSON in a table

Parameters:
Name Type Description
cbk function

optional callback

loadHighlight(cbk)

Description:
  • Load highlight tool

Parameters:
Name Type Description
cbk function

optional callback

loadImport()

Description:
  • load import view

loadJqPlot(cbk)

Description:
  • Load jqPlot

Parameters:
Name Type Description
cbk function

optional callback

loadLocalEditor(cbk)

Description:
  • Load local code editor

Parameters:
Name Type Description
cbk function

callback

loadMarked(cbk)

Description:
  • Load Marked parser (Markdown to HTML)

Parameters:
Name Type Description
cbk function

optional callback

loadMustache(cbk)

Description:
  • Load Mustache template parser

Parameters:
Name Type Description
cbk function

optional callback

loadPart(p)

Description:
  • Load a HTML/JS/CSS resource in the target selector

Parameters:
Name Type Description
p Object

Parameters

Properties
Name Type Description
name string

resource name

url string

or resource URL

type string

"HTML", "CSS" or "JS" (or URL extension)

target string

optional selector to append the "HTML" part

onload function

optional callback when loaded

silent string

true for no logging (not found 404)

force string

ignore the local cache

loadParts(list, cbk)

Description:
  • Load HTML/JS/CSS resources

Parameters:
Name Type Description
list Array

list of parts [{ name, url, type, target }]

cbk function

callback when loaded

loadResource(p)

Description:
  • Load a disposition resource and replace [ROOT] tokens

Parameters:
Name Type Description
p Object

Parameters

Properties
Name Type Description
url string

script location

async boolean

asynchronous ? true by default

onload function

optional callback when loaded

silent string

true for no logging (not found 404)

loadScript(p)

Description:
  • Load a server JavaScript

Parameters:
Name Type Description
p Object | string

minimal parameter { url } or URL

Properties
Name Type Description
url string

script location

encoding string

optional, default 'UTF-8'

async string

asynchronous call, true by default

onload string

optional callback when loaded

silent string

true for no logging (not found 404)

force string

ignore the local cache

loadScripts(list, onload)

Description:
  • Load a list of JS/CSS scripts (preserve ordering)

Parameters:
Name Type Description
list Array.<Object> | Array.<string>

list of scripts URL (js or css)

onload function

callback

loadSelectBox(cbk)

Description:
  • Load the select box component (see https://select2.org)

Parameters:
Name Type Description
cbk function

optional callback

loadSimpliciteClient(cbk)

Description:
  • Load Simplicite standalone client lib

Parameters:
Name Type Description
cbk function

optional callback

loadSpeech()

Description:
  • Load the speech engine

loadTerminal(cbk)

Description:
  • Load Terminal (XTerm.js)

Parameters:
Name Type Description
cbk function

optional callback

loadTinyMCE(cbk)

Description:
  • Load TinyMCE editor

Parameters:
Name Type Description
cbk function

optional callback

loadURL(ctn, url, options, cbk)

Description:
  • Load URL in a container: wrap the URL to specific controllers (list, form...) or call the back-end thru ajax

Parameters:
Name Type Description
ctn string | jQuery

Container to load the URL (default is #work)

url string

URL to load

options Object

Contextual parameters

Properties
Name Type Description
label string

Optional label to display in nav/dialog/download

target string

Optional target _blank, _top or _popup

nav string

Optional navigation add or new

showNav boolean

Show or hide the navigation

object Object

Optional object of action

rowId Object

Optional object row ID (form/row action)

item Object

Optional object item (form/row action)

noiframe boolean

Optional flag to inline content

reader function

Optional reader(content-type, attach, filename, blob, defaultReader, cbk) to override default download into container

cbk function

Optional callback when loaded

logout(params)

Description:
  • Default logout: confirm (with text CONFIRM_LOGOUT) and save session before quit

Parameters:
Name Type Description
params Object

logout parameters

Properties
Name Type Description
confirm boolean

true to confirm the logout

url string

optional new location URL

login string

optional user login to switch session

token string

optional user token to switch session

main(cbk)

Description:
  • Displays all site parts:

    • Create main div
    • load only options.resources if specified
    • load part MAIN/HEADER/FOOTER/MENU/WORK when options.useMainParts=true
    • load STYLES + SCRIPT resources of disposition or object
Parameters:
Name Type Description
cbk function

Final callback when displayed

monitor(ctn, params)

Description:
  • UI monitoring

Parameters:
Name Type Description
ctn jQuery

Container to monitor

params Object

Parameters or action

Properties
Name Type Description
ui boolean

Front or Ajax call

onMessageReceived(m)

Description:
  • Firebase default handler when a message is received thru FCM or worker.

Parameters:
Name Type Description
m Object

Message or notification

Properties
Name Type Description
notification string

Optional embedded message with title and body

body string

Message body

title string

Optional title

priority string

Optional priority 'high'|'normal'|'low'

data Object

Optional pairs of key-value (may be present on top of message)

Properties
Name Type Description
object string

Optional object name

rowId string

Optional object rowId

tap string

Foreground or background

icon string

Optional icon

color string

Optional color

openURL(url, target)

Description:
  • Open the URL in a new window

Parameters:
Name Type Description
url string

URL to open

target string

Optional, default '_blank'

quit(params)

Description:
  • Default quit is a session logout

Parameters:
Name Type Description
params Object

logout parameters

Properties
Name Type Description
url string

optional new location URL to change scope

login string

optional user login to change user

ready(app, engine, options, cbk)

Description:
  • When page is loaded: load user rights, menu, texts and engine.
    Then call the main page service.

Parameters:
Name Type Description
app Simplicite.Ajax

Optional Ajax API to access to data

engine string

extension name (default 'bootstrap5')

options Simplicite.UI.Globals

some globals options to override

cbk function

Optional callback(err) when loaded

saveSession(cbk)

Description:
  • Save the session (by default the recent activity in HISTORY)

Parameters:
Name Type Description
cbk function

optional callback

session(cbk, params)

Description:
  • Open the user session with authtoken

Parameters:
Name Type Description
cbk function

callback(err) when the session is opened or not

params Object

options

Properties
Name Type Description
scope string

optional user scope or home view

setAjax(ajax)

Description:
  • Set the Ajax APIs

Parameters:
Name Type Description
ajax Simplicite.Ajax

Simplicite.Ajax instance

setEngineView(name, cbk)

Description:
  • Set the view engine

Parameters:
Name Type Description
name string

extension name (ex: bootstrap)

cbk function

onload callback

setTheme(theme, cbk)

Description:
  • Change the current CSS theme (stored in local storage)

Parameters:
Name Type Description
theme string

theme name (ex: 'default', 'light', 'dark', 'simplicite')

cbk function

optional callback

splash()

Description:
  • Loading page with status

waitForURL(ctn, url, params, pgs)

Description:
  • Call periodically to check if the response is completed

Parameters:
Name Type Description
ctn jQuery

Container to load the URL

url string

URL to launch the asynchronous task on server side, and be polled with a check parameter periodically, must respond 202 while the task is not completed

params Object

Optional parameters for loadURL

pgs function

Optional progress callback(message)

Returns:

Promise when loaded, or catch when stopped

(inner) keydown(e)

Description:
  • Default keydown handler
    CTRL-S : trigger "ui.key.ctrls" to all "js-ctrl-s" elements
    ESCAPE : in order of priority close dialog, blur field (remove focus), or back in navigation
    SHIFT-LEFT/RIGHT : navigation between list items
    ALT-H : back to the home page
    ALT-M : focus last visited menu item
    ALT-W : wide screeen = toggle menu
    ALT-B : open the bookmarks dialog
    ALT-F : focus the global searchbox
    ALT-L : focus the first list row
    ALT-N : focus the next area/panel

Parameters:
Name Type Description
e Object

Key event