Skip to content

Component Action engine

Vadym edited this page Aug 13, 2021 · 7 revisions

Components also should allow describing handlers to control events, e.g. click on button or change on the input field. Actions should be described inside the "action" property at the root of component declaration:

Component Action properties:

  • name - action name to be executed when field action occurs
  • confirmation - confirmation message to be shown before action executing. User should allow or decline to execute
  • dynamic - dynamic configuration to change element properties, including automatic action execution by condition (used action.execute property in dynamic).

Component Action example:

{
  name: 'saveButton',
  ui: {label: 'Save form'},
  action: {name: 'save'}
}

Component action dynamic execution

{
  name: 'saveButton',
  ui: {label: 'Save form'},
  action: {name: 'save'},
  dynamic: {
    prop: 'action.execute',    // reserved property name to describe automatic action execution
    val: true                  // boolean indicator to trigger action or not
    when: [{
      binding: 'someBinding',
      fn: 'comparator',
      val: 'valueToCompare'
    }]
  }
}