j-Rules
The component can create a simple rules which you can transform to some engines like Total.js Flow. The component uses j-Directory component.
Configuration:
dirsearc {String}hA placeholder for search input inj-Directory, default:search
Data declaration:
var form = [];
form.push({ enabled: true, label: 'CPU', name: 'cpu', type: 'number', comparer: '==', value: 0, note: 'Value in mega bytes' });
form.push({ enabled: false, label: 'Memory', name: 'memory', type: 'number', comparer: '>', value: 0 });
form.push({ enabled: true, label: 'Error', name: 'error', type: 'string', comparer: '==', items: [{ name: 'Error', id: 'error' }, { name: 'Obsolete', id: 'obsolete' }] });
form.push({ enabled: false, label: 'Offline', name: 'offline', type: 'boolean', comparer: '==', value: 0 });Data properties in data declaration:
name {String}an item identifier (required)label {String}a label (required)note {String}a small note under controltype {String}a type, lower-case (required)items {Object Array}items forstringtype only in the form[{ id: String, name: String }]enabled {Boolean}enables itemcomparer {String}can be==,!=,>,>=,<=,<(required)value {Number/Boolean/String}a value
Allowed types in data:
stringbooleannumber
Use it with <ui-component name="rules">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.
<ui-component name="LAZY directory"></ui-component>
<div style="width:600px;padding:20px">
<ui-component name="rules" path="form"></ui-component>
</div>
<script>
var form = [];
form.push({ enabled: true, label: 'CPU', name: 'cpu', type: 'number', comparer: '==', placeholder: '', value: 0, note: 'Value in mega bytes' });
form.push({ enabled: false, label: 'Memory', name: 'memory', type: 'number', comparer: '>', placeholder: '', value: 0 });
form.push({ enabled: true, label: 'Error', name: 'error', type: 'string', comparer: '==', items: [{ name: 'Error', id: 'error' }, { name: 'Obsolete', id: 'obsolete' }] });
form.push({ enabled: false, label: 'Offline', name: 'offline', type: 'boolean', comparer: '==', value: 0 });
</script>