ForgeComponents
en

Components

j-Rules

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

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}h A placeholder for search input in j-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 control
  • type {String} a type, lower-case (required)
  • items {Object Array} items for string type only in the form [{ id: String, name: String }]
  • enabled {Boolean} enables item
  • comparer {String} can be ==, !=, >, >=, <=, < (required)
  • value {Number/Boolean/String} a value

Allowed types in data:

  • string
  • boolean
  • number

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.

example.html
<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>