- Source:
ui-predicate core public API
Members
(static) getUIComponent
- Source:
Get core UI component (e.g. target selector)
(static) root
- Source:
Get root CompoundPredicate
Methods
(static) add(option) → {Promise.<dataclasses.Predicate>}
- Source:
- Since:
- 1.0.0
Add a ComparisonPredicate or CompoundPredicate
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
option |
Object | option object | ||
options.type |
string | what type of Predicate to add | ||
options.how |
string |
<optional> |
after
|
should we insert it before, after or instead of? (currently only after is supported) |
options.where |
dataclasses.Predicate | current element |
Returns:
inserted predicate
- Type
- Promise.<dataclasses.Predicate>
(static) getArgumentTypeComponentById(argumentType_id) → {*}
- Source:
- Since:
- 1.0.0
Get a UI Component (e.g. Vue Component) based on the argumentType_id
Parameters:
Name | Type | Description |
---|---|---|
argumentType_id |
string | the argumentType id to find |
Returns:
it will either yield the argumentType id associated component or fallback on core.defaults.getArgumentTypeComponentById to yield the default component
- Type
- *
(static) getUIComponent(name) → {any}
- Source:
- Since:
- 1.0.0
Get default or overrided ui component
Parameters:
Name | Type | Description |
---|---|---|
name |
ui | the UIType key to get the right component |
Returns:
component
- Type
- any
(static) off(eventNamenullable, listenernullable) → {undefined}
- Source:
- Since:
- 1.0.0
Remove listener(s)
If off() will remove every listeners
If off(eventName) will only remove listeners to this specific eventName
If off(eventName, listener) will remove the `listener` to the `eventName`
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventName |
string |
<nullable> |
see core.api.on for available event names |
listener |
function |
<nullable> |
listener |
Returns:
- Type
- undefined
(static) on(eventName, listener) → {undefined}
- Source:
- Since:
- 1.0.0
Adds the `listener` function to the end of the listeners array for the event named `eventName`.
No checks are made to see if the `listener` has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
string | available event names are : (`changed`, api) |
listener |
function | listener |
Returns:
- Type
- undefined
(static) once(eventName, listener) → {undefined}
- Source:
- Since:
- 1.0.0
- See:
Adds a *one-time* `listener` function for the event named `eventName`. The next time `eventName` is triggered, this `listener` is removed and then invoked.
Parameters:
Name | Type | Description |
---|---|---|
eventName |
string | see core.api.on for available event names |
listener |
function | listener |
Returns:
- Type
- undefined
(static) remove(predicate) → {Promise.<dataclasses.Predicate>}
- Source:
- Since:
- 1.0.0
Remove a ComparisonPredicate or CompoundPredicate
Parameters:
Name | Type | Description |
---|---|---|
predicate |
dataclasses.ComparisonPredicate | dataclasses.CompoundPredicate | predicate |
Returns:
yield the removed predicate, will reject the promise if remove was called with the root CompoundPredicate or the last ComparisonPredicate of the root CompoundPredicate
- Type
- Promise.<dataclasses.Predicate>
(static) setArgumentValue(predicate, newValue) → {Promise.<undefined>}
- Source:
- Since:
- 1.0.0
Change a predicate's operator value
Parameters:
Name | Type | Description |
---|---|---|
predicate |
dataclasses.ComparisonPredicate | predicate |
newValue |
* | newValue |
Returns:
yield nothing if everything went right, currently everything always go right ;)
- Type
- Promise.<undefined>
(static) setData(root) → {Promise.<undefined, errors.RootPredicateMustBeACompoundPredicate>}
- Source:
- Since:
- 1.0.0
Set PredicateCore data
Parameters:
Name | Type | Description |
---|---|---|
root |
dataclasses.CompoundPredicate | CompoundPredicate |
Returns:
resolved promise yield nothing, rejected promise yield RootPredicateMustBeACompoundPredicate error
- Type
- Promise.<undefined, errors.RootPredicateMustBeACompoundPredicate>
(static) setPredicateLogicalType_id(predicate, newLogicalType_id) → {Promise.<undefined, errors.PredicateMustBeACompoundPredicate>}
- Source:
- Since:
- 1.0.0
Change a CompoundPredicate logical
Parameters:
Name | Type | Description |
---|---|---|
predicate |
dataclasses.CompoundPredicate | predicate |
newLogicalType_id |
string | newLogicalType_id |
Returns:
yield nothing if everything went right, otherwise yield a reject promise with the PredicateMustBeACompoundPredicate error
- Type
- Promise.<undefined, errors.PredicateMustBeACompoundPredicate>
(static) setPredicateOperator_id(predicate, newOperator_id) → {Promise.<undefined, errors.Operator_idMustReferToADefinedOperator>}
- Source:
- Since:
- 1.0.0
Change a predicate's operator
Parameters:
Name | Type | Description |
---|---|---|
predicate |
dataclasses.ComparisonPredicate | predicate |
newOperator_id |
string | newOperator_id |
Returns:
yield nothing if everything went right, otherwise yield a reject promise with the PredicateMustBeAComparisonPredicate error
- Type
- Promise.<undefined, errors.Operator_idMustReferToADefinedOperator>
(static) setPredicateTarget_id(predicate, newTarget_id) → {Promise.<undefined, errors.PredicateMustBeAComparisonPredicate>}
- Source:
- Since:
- 1.0.0
Change a predicate's target
Parameters:
Name | Type | Description |
---|---|---|
predicate |
dataclasses.ComparisonPredicate | predicate |
newTarget_id |
string | newTarget_id |
Returns:
yield nothing if everything went right, otherwise yield a reject promise with the PredicateMustBeAComparisonPredicate error
- Type
- Promise.<undefined, errors.PredicateMustBeAComparisonPredicate>
(static) toJSON() → {Object}
- Source:
- Since:
- 1.0.0
Yield a serializable object without internal flags ($xxx properties)
Example
console.log(JSON.stringify(ctrl, null, 2)); // will call ctrl.toJSON() underneath
Returns:
a serializable object
- Type
- Object