MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

mmo-workflow

1 symbole · générée le 27 Oct 2026

element

mmo-workflow

mmo-workflow.jhs:1

Workflow element to display a workflow

<mmo-workflow readonly step></mmo-workflow>
Étend
CustomElement
1. Config explanation: the configuration is an array of elements the type of the elements is defined by the `type` property: - title: - type: 'title' - id: {string} the element's id - class: {string} (css class) - icon: {string} - level: {int} header's level (default 2) - text: {string} - html: - type: 'html' - id: {string} the element's id - class: {string} (css class) - text: {string} html - step: - type: 'step' - id: {string} the element's id - label: {string} (step label) - readonly: {boolean} (true if the step is read only, false if it's not) is current step in readonly mode ? - view: {string} view id to load - completed: {?boolean} if null, step has not begun - error: {boolean} - path: {string} the basepath for the given view - info - type: 'info' - id: {string} the element's id - label: {string} (step label) - view: {string} view id to load - path: {string} the basepath for the given view - validation: - type: 'validation' - id: {string} - label: {string} - view: {string} view id to load - path: {string} the basepath for the given view View MUST declare a function validate(): bool telling if the validation process is done: <script>this.validate = function() {return false;}</ script>

Index

readonlyif true, the workflow is readonly
stepthe current step of the workflow
ViewDefault static readonly accessor
data accessorGet the data of the workflow
config accessorGet the config of the workflow
readonly accessorGet the readonly of the workflow
entity readonly accessorGet the entity of the workflow
step accessorGet the step of the workflow
constructor()
init()
block()Freeze the workflow while something is running: the buttons refuse clicks and the shell shows it.
unblock()Give the workflow back to the user (block).
save(explicit)Save the workflow's entities.
loadEntityFromUrl(path, collection, entityClass)Load an entity from the parameters in the url
setValidated()Set the validated of the workflow
getContentById(id)Get the content by id
next()Go to the next step, whatever the current one holds: every step can be reached at any time.
reportStep(step)Show the messages of a step's fields that fail, and colour its entry in the stepper.
previous()Go to the previous step
goto(index)Go to a step clicked in the stepper: unlike next/previous, a validation already passed is shown rather than skipped, so that its state can be read.
loadStep(value, show)Show one step: its view is rendered the first time it is reached, then kept.
updateValidity(step)Update the validity of the workflow
isShown(node, step)Whether a node of a step is displayed, or would be if its step were the one shown: the display the hidden step's nodes had is the one they keep (MMO.core.Template#hide).
stepOf(node)The step whose view holds a node.
isValid()Whether the workflow can be validated as it stands.
renderTimeline(root, content)Render the timeline of the workflow
renderTitle(root, content)Render one title entry of the stepper: a heading between two steps.
renderHtml(root, content)Render one html entry of the stepper: a free block, for a note or a summary.
renderStep(root, content)Render a step/info item in the stepper
renderValidation(root, content, valid)Render a validation item in the stepper

Attributs2

Propriétés6

config

accessormmo-workflow.jhs:204

Get the config of the workflow

get config() set config(value)
Type
array

readonly

accessormmo-workflow.jhs:226

Get the readonly of the workflow

get readonly() set readonly(value)
Type
boolean

Méthodes22

block()

mmo-workflow.jhs:252

Freeze the workflow while something is running: the buttons refuse clicks and the shell shows it.

block()
retournevoid

save(explicit)

mmo-workflow.jhs:279

Save the workflow's entities. One not created yet (no id) is created only once the page's canCreate predicate is true: until then nothing is sent for it and what it misses is said -- a notice, not a block: every step can still be reached. A page that gives no canCreate creates its entity at the first save.

save(explicit = true)`canCreate(entity)` returns true to create it, else false or a message saying what it misses.
explicit = true
retournePromise | undefinedundefined when a save is running or the workflow is read only
workflow.canCreate = entity => entity.get('contrat')? true : MMO.i18n.$('Choose the employee first.');

loadEntityFromUrl(path, collection, entityClass)

mmo-workflow.jhs:332

Load an entity from the parameters in the url

loadEntityFromUrl(path, collection, entityClass)
pathstring- The path to store the entity in data
collectionstring- The entity's collection
entityClassstring- The entity's class

getContentById(id)

mmo-workflow.jhs:410

Get the content by id

getContentById(id)
idstring- The id of the content
retourneElementThe content

next()

mmo-workflow.jhs:426

Go to the next step, whatever the current one holds: every step can be reached at any time. A step left incomplete says what it misses (its messages, its colour in the stepper) when it is shown again.

next()
retournebooleantrue when the workflow went on
workflow.next();

reportStep(step)

mmo-workflow.jhs:437

Show the messages of a step's fields that fail, and colour its entry in the stepper.

reportStep(step)
stepnumber- the step's index in the config
retourneElement[]the <mmo-validity> that fail, in the order of the page
if (workflow.reportStep(workflow.step).length) {...}

goto(index)

mmo-workflow.jhs:572

Go to a step clicked in the stepper: unlike next/previous, a validation already passed is shown rather than skipped, so that its state can be read.

goto(index)
indexnumber- the step's index in the config
retournevoid
workflow.goto(6);

loadStep(value, show)

mmo-workflow.jhs:584

Show one step: its view is rendered the first time it is reached, then kept.

loadStep(value, show = true)
valuestring- the step's id
show = trueboolean- false to prepare the view without showing it
retournevoid

updateValidity(step)

mmo-workflow.jhs:622

Update the validity of the workflow

updateValidity(step = null)
step = nullnumber- The step
retournebooleanThe validity

isShown(node, step)

mmo-workflow.jhs:708

Whether a node of a step is displayed, or would be if its step were the one shown: the display the hidden step's nodes had is the one they keep (MMO.core.Template#hide).

isShown(node, step)
nodeElement
stepnumber- the step's index in the config
retourneboolean
workflow.isShown(validity, 3)

stepOf(node)

mmo-workflow.jhs:730

The step whose view holds a node.

stepOf(node)
nodeNode
retourne?numbernull when no step's view holds it
workflow.stepOf(event.target)

isValid()

mmo-workflow.jhs:741

Whether the workflow can be validated as it stands.

isValid()
retournebooleantrue when every step the workflow has been through is valid

renderTimeline(root, content)

mmo-workflow.jhs:752

Render the timeline of the workflow

renderTimeline(root, content)
rootHTMLUListElement- The stepper <ul> element
contentarray- The content of the workflow

renderTitle(root, content)

mmo-workflow.jhs:793

Render one title entry of the stepper: a heading between two steps.

renderTitle(root, content)
rootHTMLElement- the stepper
contentobject- the entry: text, icon, level
retourneHTMLElement

renderHtml(root, content)

mmo-workflow.jhs:813

Render one html entry of the stepper: a free block, for a note or a summary.

renderHtml(root, content)
rootHTMLElement- the stepper
contentobject- the entry: text, id, and a tone class
retourneHTMLElement

renderStep(root, content)

mmo-workflow.jhs:832

Render a step/info item in the stepper

renderStep(root, content)
rootHTMLUListElement- The stepper <ul> element
contentobject- The content config
retourneHTMLLIElementThe created <li>

renderValidation(root, content, valid)

mmo-workflow.jhs:866

Render a validation item in the stepper

renderValidation(root, content, valid)
rootHTMLUListElement- The stepper <ul> element
contentobject- The content config
validboolean- The validity
retourneHTMLLIElementThe created <li>