@defra/forms-model 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENCE +8 -0
- package/README.md +22 -0
- package/dist/browser/components/component-types.d.ts +3 -0
- package/dist/browser/components/component-types.d.ts.map +1 -0
- package/dist/browser/components/component-types.js +220 -0
- package/dist/browser/components/component-types.js.map +1 -0
- package/dist/browser/components/conditional-component-types.d.ts +3 -0
- package/dist/browser/components/conditional-component-types.d.ts.map +1 -0
- package/dist/browser/components/conditional-component-types.js +28 -0
- package/dist/browser/components/conditional-component-types.js.map +1 -0
- package/dist/browser/components/index.d.ts +4 -0
- package/dist/browser/components/index.d.ts.map +1 -0
- package/dist/browser/components/index.js +45 -0
- package/dist/browser/components/index.js.map +1 -0
- package/dist/browser/components/types.d.ts +244 -0
- package/dist/browser/components/types.d.ts.map +1 -0
- package/dist/browser/components/types.js +56 -0
- package/dist/browser/components/types.js.map +1 -0
- package/dist/browser/conditions/condition-abstract.d.ts +16 -0
- package/dist/browser/conditions/condition-abstract.d.ts.map +1 -0
- package/dist/browser/conditions/condition-abstract.js +62 -0
- package/dist/browser/conditions/condition-abstract.js.map +1 -0
- package/dist/browser/conditions/condition-field.d.ts +13 -0
- package/dist/browser/conditions/condition-field.d.ts.map +1 -0
- package/dist/browser/conditions/condition-field.js +45 -0
- package/dist/browser/conditions/condition-field.js.map +1 -0
- package/dist/browser/conditions/condition-group-def.d.ts +10 -0
- package/dist/browser/conditions/condition-group-def.d.ts.map +1 -0
- package/dist/browser/conditions/condition-group-def.js +45 -0
- package/dist/browser/conditions/condition-group-def.js.map +1 -0
- package/dist/browser/conditions/condition-group.d.ts +15 -0
- package/dist/browser/conditions/condition-group.d.ts.map +1 -0
- package/dist/browser/conditions/condition-group.js +64 -0
- package/dist/browser/conditions/condition-group.js.map +1 -0
- package/dist/browser/conditions/condition-model.d.ts +41 -0
- package/dist/browser/conditions/condition-model.d.ts.map +1 -0
- package/dist/browser/conditions/condition-model.js +214 -0
- package/dist/browser/conditions/condition-model.js.map +1 -0
- package/dist/browser/conditions/condition-operators.d.ts +248 -0
- package/dist/browser/conditions/condition-operators.d.ts.map +1 -0
- package/dist/browser/conditions/condition-operators.js +132 -0
- package/dist/browser/conditions/condition-operators.js.map +1 -0
- package/dist/browser/conditions/condition-ref.d.ts +12 -0
- package/dist/browser/conditions/condition-ref.d.ts.map +1 -0
- package/dist/browser/conditions/condition-ref.js +51 -0
- package/dist/browser/conditions/condition-ref.js.map +1 -0
- package/dist/browser/conditions/condition-value-abstract.d.ts +8 -0
- package/dist/browser/conditions/condition-value-abstract.d.ts.map +1 -0
- package/dist/browser/conditions/condition-value-abstract.js +41 -0
- package/dist/browser/conditions/condition-value-abstract.js.map +1 -0
- package/dist/browser/conditions/condition-value-registration.d.ts +10 -0
- package/dist/browser/conditions/condition-value-registration.d.ts.map +1 -0
- package/dist/browser/conditions/condition-value-registration.js +37 -0
- package/dist/browser/conditions/condition-value-registration.js.map +1 -0
- package/dist/browser/conditions/condition-values.d.ts +38 -0
- package/dist/browser/conditions/condition-values.d.ts.map +1 -0
- package/dist/browser/conditions/condition-values.js +127 -0
- package/dist/browser/conditions/condition-values.js.map +1 -0
- package/dist/browser/conditions/condition.d.ts +15 -0
- package/dist/browser/conditions/condition.d.ts.map +1 -0
- package/dist/browser/conditions/condition.js +56 -0
- package/dist/browser/conditions/condition.js.map +1 -0
- package/dist/browser/conditions/helpers.d.ts +3 -0
- package/dist/browser/conditions/helpers.d.ts.map +1 -0
- package/dist/browser/conditions/helpers.js +26 -0
- package/dist/browser/conditions/helpers.js.map +1 -0
- package/dist/browser/conditions/index.d.ts +11 -0
- package/dist/browser/conditions/index.d.ts.map +1 -0
- package/dist/browser/conditions/index.js +144 -0
- package/dist/browser/conditions/index.js.map +1 -0
- package/dist/browser/conditions/inline-condition-model.d.ts +86 -0
- package/dist/browser/conditions/inline-condition-model.d.ts.map +1 -0
- package/dist/browser/conditions/inline-condition-model.js +418 -0
- package/dist/browser/conditions/inline-condition-model.js.map +1 -0
- package/dist/browser/conditions/inline-condition-operators.d.ts +175 -0
- package/dist/browser/conditions/inline-condition-operators.d.ts.map +1 -0
- package/dist/browser/conditions/inline-condition-operators.js +132 -0
- package/dist/browser/conditions/inline-condition-operators.js.map +1 -0
- package/dist/browser/conditions/inline-condition-values.d.ts +93 -0
- package/dist/browser/conditions/inline-condition-values.d.ts.map +1 -0
- package/dist/browser/conditions/inline-condition-values.js +159 -0
- package/dist/browser/conditions/inline-condition-values.js.map +1 -0
- package/dist/browser/conditions/types.d.ts +38 -0
- package/dist/browser/conditions/types.d.ts.map +1 -0
- package/dist/browser/conditions/types.js +24 -0
- package/dist/browser/conditions/types.js.map +1 -0
- package/dist/browser/data-model/conditions-wrapper.d.ts +19 -0
- package/dist/browser/data-model/conditions-wrapper.d.ts.map +1 -0
- package/dist/browser/data-model/conditions-wrapper.js +49 -0
- package/dist/browser/data-model/conditions-wrapper.js.map +1 -0
- package/dist/browser/data-model/index.d.ts +4 -0
- package/dist/browser/data-model/index.d.ts.map +1 -0
- package/dist/browser/data-model/index.js +66 -0
- package/dist/browser/data-model/index.js.map +1 -0
- package/dist/browser/data-model/input-wrapper.d.ts +16 -0
- package/dist/browser/data-model/input-wrapper.d.ts.map +1 -0
- package/dist/browser/data-model/input-wrapper.js +49 -0
- package/dist/browser/data-model/input-wrapper.js.map +1 -0
- package/dist/browser/data-model/types.d.ts +153 -0
- package/dist/browser/data-model/types.d.ts.map +1 -0
- package/dist/browser/data-model/types.js +34 -0
- package/dist/browser/data-model/types.js.map +1 -0
- package/dist/browser/form/form-configuration.d.ts +8 -0
- package/dist/browser/form/form-configuration.d.ts.map +1 -0
- package/dist/browser/form/form-configuration.js +38 -0
- package/dist/browser/form/form-configuration.js.map +1 -0
- package/dist/browser/form/index.d.ts +2 -0
- package/dist/browser/form/index.d.ts.map +1 -0
- package/dist/browser/form/index.js +24 -0
- package/dist/browser/form/index.js.map +1 -0
- package/dist/browser/index.d.ts +12 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +138 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/migration/index.d.ts +2 -0
- package/dist/browser/migration/index.d.ts.map +1 -0
- package/dist/browser/migration/index.js +24 -0
- package/dist/browser/migration/index.js.map +1 -0
- package/dist/browser/migration/migration.0-2.d.ts +3 -0
- package/dist/browser/migration/migration.0-2.d.ts.map +1 -0
- package/dist/browser/migration/migration.0-2.js +65 -0
- package/dist/browser/migration/migration.0-2.js.map +1 -0
- package/dist/browser/migration/migration.1-2.d.ts +3 -0
- package/dist/browser/migration/migration.1-2.d.ts.map +1 -0
- package/dist/browser/migration/migration.1-2.js +108 -0
- package/dist/browser/migration/migration.1-2.js.map +1 -0
- package/dist/browser/migration/types.d.ts +2 -0
- package/dist/browser/migration/types.d.ts.map +1 -0
- package/dist/browser/migration/types.js +16 -0
- package/dist/browser/migration/types.js.map +1 -0
- package/dist/browser/migration/whichMigrations.d.ts +7 -0
- package/dist/browser/migration/whichMigrations.d.ts.map +1 -0
- package/dist/browser/migration/whichMigrations.js +38 -0
- package/dist/browser/migration/whichMigrations.js.map +1 -0
- package/dist/browser/schema/index.d.ts +2 -0
- package/dist/browser/schema/index.d.ts.map +1 -0
- package/dist/browser/schema/index.js +30 -0
- package/dist/browser/schema/index.js.map +1 -0
- package/dist/browser/schema/schema.d.ts +20 -0
- package/dist/browser/schema/schema.d.ts.map +1 -0
- package/dist/browser/schema/schema.js +255 -0
- package/dist/browser/schema/schema.js.map +1 -0
- package/dist/browser/utils/helpers.d.ts +9 -0
- package/dist/browser/utils/helpers.d.ts.map +1 -0
- package/dist/browser/utils/helpers.js +48 -0
- package/dist/browser/utils/helpers.js.map +1 -0
- package/dist/browser/utils/logger.d.ts +11 -0
- package/dist/browser/utils/logger.d.ts.map +1 -0
- package/dist/browser/utils/logger.js +46 -0
- package/dist/browser/utils/logger.js.map +1 -0
- package/dist/module/components/component-types.d.ts +3 -0
- package/dist/module/components/component-types.d.ts.map +1 -0
- package/dist/module/components/component-types.js +206 -0
- package/dist/module/components/component-types.js.map +1 -0
- package/dist/module/components/conditional-component-types.d.ts +3 -0
- package/dist/module/components/conditional-component-types.d.ts.map +1 -0
- package/dist/module/components/conditional-component-types.js +14 -0
- package/dist/module/components/conditional-component-types.js.map +1 -0
- package/dist/module/components/index.d.ts +4 -0
- package/dist/module/components/index.d.ts.map +1 -0
- package/dist/module/components/index.js +34 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/components/types.d.ts +244 -0
- package/dist/module/components/types.d.ts.map +1 -0
- package/dist/module/components/types.js +42 -0
- package/dist/module/components/types.js.map +1 -0
- package/dist/module/conditions/condition-abstract.d.ts +16 -0
- package/dist/module/conditions/condition-abstract.d.ts.map +1 -0
- package/dist/module/conditions/condition-abstract.js +45 -0
- package/dist/module/conditions/condition-abstract.js.map +1 -0
- package/dist/module/conditions/condition-field.d.ts +13 -0
- package/dist/module/conditions/condition-field.d.ts.map +1 -0
- package/dist/module/conditions/condition-field.js +26 -0
- package/dist/module/conditions/condition-field.js.map +1 -0
- package/dist/module/conditions/condition-group-def.d.ts +10 -0
- package/dist/module/conditions/condition-group-def.d.ts.map +1 -0
- package/dist/module/conditions/condition-group-def.js +26 -0
- package/dist/module/conditions/condition-group-def.js.map +1 -0
- package/dist/module/conditions/condition-group.d.ts +15 -0
- package/dist/module/conditions/condition-group.d.ts.map +1 -0
- package/dist/module/conditions/condition-group.js +47 -0
- package/dist/module/conditions/condition-group.js.map +1 -0
- package/dist/module/conditions/condition-model.d.ts +41 -0
- package/dist/module/conditions/condition-model.d.ts.map +1 -0
- package/dist/module/conditions/condition-model.js +199 -0
- package/dist/module/conditions/condition-model.js.map +1 -0
- package/dist/module/conditions/condition-operators.d.ts +248 -0
- package/dist/module/conditions/condition-operators.d.ts.map +1 -0
- package/dist/module/conditions/condition-operators.js +119 -0
- package/dist/module/conditions/condition-operators.js.map +1 -0
- package/dist/module/conditions/condition-ref.d.ts +12 -0
- package/dist/module/conditions/condition-ref.d.ts.map +1 -0
- package/dist/module/conditions/condition-ref.js +33 -0
- package/dist/module/conditions/condition-ref.js.map +1 -0
- package/dist/module/conditions/condition-value-abstract.d.ts +8 -0
- package/dist/module/conditions/condition-value-abstract.d.ts.map +1 -0
- package/dist/module/conditions/condition-value-abstract.js +24 -0
- package/dist/module/conditions/condition-value-abstract.js.map +1 -0
- package/dist/module/conditions/condition-value-registration.d.ts +10 -0
- package/dist/module/conditions/condition-value-registration.d.ts.map +1 -0
- package/dist/module/conditions/condition-value-registration.js +19 -0
- package/dist/module/conditions/condition-value-registration.js.map +1 -0
- package/dist/module/conditions/condition-values.d.ts +38 -0
- package/dist/module/conditions/condition-values.d.ts.map +1 -0
- package/dist/module/conditions/condition-values.js +106 -0
- package/dist/module/conditions/condition-values.js.map +1 -0
- package/dist/module/conditions/condition.d.ts +15 -0
- package/dist/module/conditions/condition.d.ts.map +1 -0
- package/dist/module/conditions/condition.js +40 -0
- package/dist/module/conditions/condition.js.map +1 -0
- package/dist/module/conditions/helpers.d.ts +3 -0
- package/dist/module/conditions/helpers.d.ts.map +1 -0
- package/dist/module/conditions/helpers.js +12 -0
- package/dist/module/conditions/helpers.js.map +1 -0
- package/dist/module/conditions/index.d.ts +11 -0
- package/dist/module/conditions/index.d.ts.map +1 -0
- package/dist/module/conditions/index.js +140 -0
- package/dist/module/conditions/index.js.map +1 -0
- package/dist/module/conditions/inline-condition-model.d.ts +86 -0
- package/dist/module/conditions/inline-condition-model.d.ts.map +1 -0
- package/dist/module/conditions/inline-condition-model.js +384 -0
- package/dist/module/conditions/inline-condition-model.js.map +1 -0
- package/dist/module/conditions/inline-condition-operators.d.ts +175 -0
- package/dist/module/conditions/inline-condition-operators.d.ts.map +1 -0
- package/dist/module/conditions/inline-condition-operators.js +119 -0
- package/dist/module/conditions/inline-condition-operators.js.map +1 -0
- package/dist/module/conditions/inline-condition-values.d.ts +93 -0
- package/dist/module/conditions/inline-condition-values.d.ts.map +1 -0
- package/dist/module/conditions/inline-condition-values.js +134 -0
- package/dist/module/conditions/inline-condition-values.js.map +1 -0
- package/dist/module/conditions/types.d.ts +38 -0
- package/dist/module/conditions/types.d.ts.map +1 -0
- package/dist/module/conditions/types.js +10 -0
- package/dist/module/conditions/types.js.map +1 -0
- package/dist/module/data-model/conditions-wrapper.d.ts +19 -0
- package/dist/module/data-model/conditions-wrapper.d.ts.map +1 -0
- package/dist/module/data-model/conditions-wrapper.js +30 -0
- package/dist/module/data-model/conditions-wrapper.js.map +1 -0
- package/dist/module/data-model/index.d.ts +4 -0
- package/dist/module/data-model/index.d.ts.map +1 -0
- package/dist/module/data-model/index.js +55 -0
- package/dist/module/data-model/index.js.map +1 -0
- package/dist/module/data-model/input-wrapper.d.ts +16 -0
- package/dist/module/data-model/input-wrapper.d.ts.map +1 -0
- package/dist/module/data-model/input-wrapper.js +25 -0
- package/dist/module/data-model/input-wrapper.js.map +1 -0
- package/dist/module/data-model/types.d.ts +153 -0
- package/dist/module/data-model/types.d.ts.map +1 -0
- package/dist/module/data-model/types.js +20 -0
- package/dist/module/data-model/types.js.map +1 -0
- package/dist/module/form/form-configuration.d.ts +8 -0
- package/dist/module/form/form-configuration.d.ts.map +1 -0
- package/dist/module/form/form-configuration.js +17 -0
- package/dist/module/form/form-configuration.js.map +1 -0
- package/dist/module/form/index.d.ts +2 -0
- package/dist/module/form/index.d.ts.map +1 -0
- package/dist/module/form/index.js +11 -0
- package/dist/module/form/index.js.map +1 -0
- package/dist/module/index.d.ts +12 -0
- package/dist/module/index.d.ts.map +1 -0
- package/dist/module/index.js +135 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/migration/index.d.ts +2 -0
- package/dist/module/migration/index.d.ts.map +1 -0
- package/dist/module/migration/index.js +11 -0
- package/dist/module/migration/index.js.map +1 -0
- package/dist/module/migration/migration.0-2.d.ts +3 -0
- package/dist/module/migration/migration.0-2.d.ts.map +1 -0
- package/dist/module/migration/migration.0-2.js +42 -0
- package/dist/module/migration/migration.0-2.js.map +1 -0
- package/dist/module/migration/migration.1-2.d.ts +3 -0
- package/dist/module/migration/migration.1-2.d.ts.map +1 -0
- package/dist/module/migration/migration.1-2.js +90 -0
- package/dist/module/migration/migration.1-2.js.map +1 -0
- package/dist/module/migration/types.d.ts +2 -0
- package/dist/module/migration/types.d.ts.map +1 -0
- package/dist/module/migration/types.js +1 -0
- package/dist/module/migration/types.js.map +1 -0
- package/dist/module/migration/whichMigrations.d.ts +7 -0
- package/dist/module/migration/whichMigrations.d.ts.map +1 -0
- package/dist/module/migration/whichMigrations.js +26 -0
- package/dist/module/migration/whichMigrations.js.map +1 -0
- package/dist/module/schema/index.d.ts +2 -0
- package/dist/module/schema/index.d.ts.map +1 -0
- package/dist/module/schema/index.js +17 -0
- package/dist/module/schema/index.js.map +1 -0
- package/dist/module/schema/schema.d.ts +20 -0
- package/dist/module/schema/schema.d.ts.map +1 -0
- package/dist/module/schema/schema.js +239 -0
- package/dist/module/schema/schema.js.map +1 -0
- package/dist/module/utils/helpers.d.ts +9 -0
- package/dist/module/utils/helpers.d.ts.map +1 -0
- package/dist/module/utils/helpers.js +35 -0
- package/dist/module/utils/helpers.js.map +1 -0
- package/dist/module/utils/logger.d.ts +11 -0
- package/dist/module/utils/logger.d.ts.map +1 -0
- package/dist/module/utils/logger.js +27 -0
- package/dist/module/utils/logger.js.map +1 -0
- package/package.json +35 -0
- package/src/components/component-types.ts +229 -0
- package/src/components/conditional-component-types.ts +14 -0
- package/src/components/index.ts +3 -0
- package/src/components/types.ts +362 -0
- package/src/conditions/condition-abstract.ts +59 -0
- package/src/conditions/condition-field.ts +29 -0
- package/src/conditions/condition-group-def.ts +29 -0
- package/src/conditions/condition-group.ts +61 -0
- package/src/conditions/condition-model.ts +314 -0
- package/src/conditions/condition-operators.ts +176 -0
- package/src/conditions/condition-ref.ts +47 -0
- package/src/conditions/condition-value-abstract.ts +31 -0
- package/src/conditions/condition-value-registration.ts +18 -0
- package/src/conditions/condition-values.ts +146 -0
- package/src/conditions/condition.ts +64 -0
- package/src/conditions/helpers.ts +7 -0
- package/src/conditions/index.ts +27 -0
- package/src/conditions/inline-condition-model.ts +550 -0
- package/src/conditions/inline-condition-operators.ts +166 -0
- package/src/conditions/inline-condition-values.ts +153 -0
- package/src/conditions/types.ts +30 -0
- package/src/data-model/conditions-wrapper.ts +42 -0
- package/src/data-model/index.ts +3 -0
- package/src/data-model/input-wrapper.ts +40 -0
- package/src/data-model/types.ts +179 -0
- package/src/form/form-configuration.ts +21 -0
- package/src/form/index.ts +1 -0
- package/src/index.ts +11 -0
- package/src/migration/index.ts +1 -0
- package/src/migration/migration.0-2.ts +29 -0
- package/src/migration/migration.1-2.ts +105 -0
- package/src/migration/types.ts +1 -0
- package/src/migration/whichMigrations.ts +23 -0
- package/src/schema/index.ts +1 -0
- package/src/schema/schema.ts +300 -0
- package/src/utils/helpers.ts +37 -0
- package/src/utils/logger.ts +29 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.ConditionGroup = void 0;
|
5
|
+
var _helpers = require("./helpers");
|
6
|
+
class ConditionGroup {
|
7
|
+
constructor(conditions = []) {
|
8
|
+
if (!Array.isArray(conditions) || conditions.length < 2) {
|
9
|
+
throw Error('Cannot construct a condition group from a single condition');
|
10
|
+
}
|
11
|
+
this.conditions = conditions;
|
12
|
+
}
|
13
|
+
coordinatorString() {
|
14
|
+
return this.conditions[0].coordinatorString();
|
15
|
+
}
|
16
|
+
conditionString() {
|
17
|
+
const copy = [...this.conditions];
|
18
|
+
copy.splice(0, 1);
|
19
|
+
return `(${this.conditions[0].conditionString()} ${copy.map(condition => (0, _helpers.toPresentationString)(condition)).join(' ')})`;
|
20
|
+
}
|
21
|
+
conditionExpression() {
|
22
|
+
const copy = [...this.conditions];
|
23
|
+
copy.splice(0, 1);
|
24
|
+
return `(${this.conditions[0].conditionExpression()} ${copy.map(condition => (0, _helpers.toExpression)(condition)).join(' ')})`;
|
25
|
+
}
|
26
|
+
asFirstCondition() {
|
27
|
+
this.conditions[0].asFirstCondition();
|
28
|
+
return this;
|
29
|
+
}
|
30
|
+
getCoordinator() {
|
31
|
+
return this.conditions[0].getCoordinator();
|
32
|
+
}
|
33
|
+
setCoordinator(coordinator) {
|
34
|
+
this.conditions[0].setCoordinator(coordinator);
|
35
|
+
}
|
36
|
+
isGroup() {
|
37
|
+
return true;
|
38
|
+
}
|
39
|
+
getGroupedConditions() {
|
40
|
+
return this.conditions.map(condition => condition.clone());
|
41
|
+
}
|
42
|
+
clone() {
|
43
|
+
return new ConditionGroup(this.conditions.map(condition => condition.clone()));
|
44
|
+
}
|
45
|
+
}
|
46
|
+
exports.ConditionGroup = ConditionGroup;
|
47
|
+
//# sourceMappingURL=condition-group.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"condition-group.js","names":["_helpers","require","ConditionGroup","constructor","conditions","Array","isArray","length","Error","coordinatorString","conditionString","copy","splice","map","condition","toPresentationString","join","conditionExpression","toExpression","asFirstCondition","getCoordinator","setCoordinator","coordinator","isGroup","getGroupedConditions","clone","exports"],"sources":["../../../src/conditions/condition-group.ts"],"sourcesContent":["import { toPresentationString, toExpression } from './helpers'\nimport { Coordinator, ConditionsArray } from './types'\n\nexport class ConditionGroup {\n conditions: ConditionsArray\n\n constructor(conditions: ConditionsArray = []) {\n if (!Array.isArray(conditions) || conditions.length < 2) {\n throw Error('Cannot construct a condition group from a single condition')\n }\n\n this.conditions = conditions\n }\n\n coordinatorString() {\n return this.conditions[0].coordinatorString()\n }\n\n conditionString() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionString()} ${copy\n .map((condition) => toPresentationString(condition))\n .join(' ')})`\n }\n\n conditionExpression() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionExpression()} ${copy\n .map((condition) => toExpression(condition))\n .join(' ')})`\n }\n\n asFirstCondition() {\n this.conditions[0].asFirstCondition()\n return this\n }\n\n getCoordinator() {\n return this.conditions[0].getCoordinator()\n }\n\n setCoordinator(coordinator: Coordinator | undefined) {\n this.conditions[0].setCoordinator(coordinator)\n }\n\n isGroup() {\n return true\n }\n\n getGroupedConditions() {\n return this.conditions.map((condition) => condition.clone())\n }\n\n clone() {\n return new ConditionGroup(\n this.conditions.map((condition) => condition.clone())\n )\n }\n}\n"],"mappings":";;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGO,MAAMC,cAAc,CAAC;EAG1BC,WAAWA,CAACC,UAA2B,GAAG,EAAE,EAAE;IAC5C,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,UAAU,CAAC,IAAIA,UAAU,CAACG,MAAM,GAAG,CAAC,EAAE;MACvD,MAAMC,KAAK,CAAC,4DAA4D,CAAC;IAC3E;IAEA,IAAI,CAACJ,UAAU,GAAGA,UAAU;EAC9B;EAEAK,iBAAiBA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACL,UAAU,CAAC,CAAC,CAAC,CAACK,iBAAiB,CAAC,CAAC;EAC/C;EAEAC,eAAeA,CAAA,EAAG;IAChB,MAAMC,IAAI,GAAG,CAAC,GAAG,IAAI,CAACP,UAAU,CAAC;IACjCO,IAAI,CAACC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IACjB,OAAQ,IAAG,IAAI,CAACR,UAAU,CAAC,CAAC,CAAC,CAACM,eAAe,CAAC,CAAE,IAAGC,IAAI,CACpDE,GAAG,CAAEC,SAAS,IAAK,IAAAC,6BAAoB,EAACD,SAAS,CAAC,CAAC,CACnDE,IAAI,CAAC,GAAG,CAAE,GAAE;EACjB;EAEAC,mBAAmBA,CAAA,EAAG;IACpB,MAAMN,IAAI,GAAG,CAAC,GAAG,IAAI,CAACP,UAAU,CAAC;IACjCO,IAAI,CAACC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IACjB,OAAQ,IAAG,IAAI,CAACR,UAAU,CAAC,CAAC,CAAC,CAACa,mBAAmB,CAAC,CAAE,IAAGN,IAAI,CACxDE,GAAG,CAAEC,SAAS,IAAK,IAAAI,qBAAY,EAACJ,SAAS,CAAC,CAAC,CAC3CE,IAAI,CAAC,GAAG,CAAE,GAAE;EACjB;EAEAG,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAACf,UAAU,CAAC,CAAC,CAAC,CAACe,gBAAgB,CAAC,CAAC;IACrC,OAAO,IAAI;EACb;EAEAC,cAAcA,CAAA,EAAG;IACf,OAAO,IAAI,CAAChB,UAAU,CAAC,CAAC,CAAC,CAACgB,cAAc,CAAC,CAAC;EAC5C;EAEAC,cAAcA,CAACC,WAAoC,EAAE;IACnD,IAAI,CAAClB,UAAU,CAAC,CAAC,CAAC,CAACiB,cAAc,CAACC,WAAW,CAAC;EAChD;EAEAC,OAAOA,CAAA,EAAG;IACR,OAAO,IAAI;EACb;EAEAC,oBAAoBA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACpB,UAAU,CAACS,GAAG,CAAEC,SAAS,IAAKA,SAAS,CAACW,KAAK,CAAC,CAAC,CAAC;EAC9D;EAEAA,KAAKA,CAAA,EAAG;IACN,OAAO,IAAIvB,cAAc,CACvB,IAAI,CAACE,UAAU,CAACS,GAAG,CAAEC,SAAS,IAAKA,SAAS,CAACW,KAAK,CAAC,CAAC,CACtD,CAAC;EACH;AACF;AAACC,OAAA,CAAAxB,cAAA,GAAAA,cAAA"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { ConditionGroupDef } from './condition-group-def';
|
2
|
+
import { Condition } from './condition';
|
3
|
+
import { ConditionRef } from './condition-ref';
|
4
|
+
import { ConditionGroup } from './condition-group';
|
5
|
+
import { ConditionsArray } from './types';
|
6
|
+
type ConditionRawObject = ConditionsModel | {
|
7
|
+
name: string;
|
8
|
+
conditions: Condition[];
|
9
|
+
};
|
10
|
+
export declare class ConditionsModel {
|
11
|
+
#private;
|
12
|
+
constructor(_conditionsObject?: ConditionRawObject);
|
13
|
+
clone(): ConditionsModel;
|
14
|
+
clear(): this;
|
15
|
+
set name(name: string | undefined);
|
16
|
+
get name(): string | undefined;
|
17
|
+
add(condition: Condition): this;
|
18
|
+
replace(index: number, condition: Condition): this;
|
19
|
+
remove(indexes: number[]): this;
|
20
|
+
addGroups(groupDefs: ConditionGroupDef[]): this;
|
21
|
+
splitGroup(index: number): this;
|
22
|
+
moveEarlier(index: number): this;
|
23
|
+
moveLater(index: number): this;
|
24
|
+
switchCoordinators(): void;
|
25
|
+
get asPerUserGroupings(): (ConditionRef | ConditionGroup | Condition)[];
|
26
|
+
get hasConditions(): boolean;
|
27
|
+
get lastIndex(): number;
|
28
|
+
toPresentationString(): string;
|
29
|
+
toExpression(): string;
|
30
|
+
_applyGroups(userGroupedConditions: (Condition | ConditionGroup | ConditionRef)[]): ConditionsArray;
|
31
|
+
_group(conditions: ConditionsArray, groupDefs: ConditionGroupDef[]): ConditionsArray;
|
32
|
+
_ungroup(conditions: ConditionsArray, splitIndex: number): ConditionsArray;
|
33
|
+
_autoGroupDefs(conditions: ConditionsArray): ConditionGroupDef[];
|
34
|
+
toJSON(): {
|
35
|
+
name: string | undefined;
|
36
|
+
conditions: any[];
|
37
|
+
};
|
38
|
+
static from(obj: ConditionRawObject | ConditionsModel): ConditionsModel;
|
39
|
+
}
|
40
|
+
export {};
|
41
|
+
//# sourceMappingURL=condition-model.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"condition-model.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAGlD,OAAO,EAAe,eAAe,EAAE,MAAM,SAAS,CAAA;AAEtD,KAAK,kBAAkB,GACnB,eAAe,GACf;IACE,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,SAAS,EAAE,CAAA;CACxB,CAAA;AAEL,qBAAa,eAAe;;gBAKd,iBAAiB,CAAC,EAAE,kBAAkB;IAElD,KAAK;IAYL,KAAK;IAOL,IAAI,IAAI,CAAC,IAAI,oBAAA,EAEZ;IAED,IAAI,IAAI,uBAEP;IAED,GAAG,CAAC,SAAS,EAAE,SAAS;IAexB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS;IAmB3C,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE;IAWxB,SAAS,CAAC,SAAS,EAAE,iBAAiB,EAAE;IASxC,UAAU,CAAC,KAAK,EAAE,MAAM;IASxB,WAAW,CAAC,KAAK,EAAE,MAAM;IAezB,SAAS,CAAC,KAAK,EAAE,MAAM;IAevB,kBAAkB;IAOlB,IAAI,kBAAkB,kDAErB;IAED,IAAI,aAAa,YAEhB;IAED,IAAI,SAAS,WAEZ;IAED,oBAAoB;IAMpB,YAAY;IAMZ,YAAY,CACV,qBAAqB,EAAE,CAAC,SAAS,GAAG,cAAc,GAAG,YAAY,CAAC,EAAE;IAmBtE,MAAM,CAAC,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,iBAAiB,EAAE;IAiBlE,QAAQ,CAAC,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM;IAaxD,cAAc,CAAC,UAAU,EAAE,eAAe;IAkC1C,MAAM;;;;IAUN,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,GAAG,eAAe;CActD"}
|
@@ -0,0 +1,199 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.ConditionsModel = void 0;
|
5
|
+
var _conditionField = require("./condition-field");
|
6
|
+
var _conditionGroupDef = require("./condition-group-def");
|
7
|
+
var _condition2 = require("./condition");
|
8
|
+
var _conditionRef = require("./condition-ref");
|
9
|
+
var _conditionGroup = require("./condition-group");
|
10
|
+
var _conditionValues = require("./condition-values");
|
11
|
+
var _helpers = require("./helpers");
|
12
|
+
var _types = require("./types");
|
13
|
+
class ConditionsModel {
|
14
|
+
#groupedConditions = [];
|
15
|
+
#userGroupedConditions = [];
|
16
|
+
#conditionName = undefined;
|
17
|
+
constructor(_conditionsObject) {}
|
18
|
+
clone() {
|
19
|
+
const toReturn = new ConditionsModel();
|
20
|
+
toReturn.#groupedConditions = this.#groupedConditions.map(it => it.clone());
|
21
|
+
toReturn.#userGroupedConditions = this.#userGroupedConditions.map(it => it.clone());
|
22
|
+
toReturn.#conditionName = this.#conditionName;
|
23
|
+
return toReturn;
|
24
|
+
}
|
25
|
+
clear() {
|
26
|
+
this.#userGroupedConditions = [];
|
27
|
+
this.#groupedConditions = [];
|
28
|
+
this.#conditionName = undefined;
|
29
|
+
return this;
|
30
|
+
}
|
31
|
+
set name(name) {
|
32
|
+
this.#conditionName = name;
|
33
|
+
}
|
34
|
+
get name() {
|
35
|
+
return this.#conditionName;
|
36
|
+
}
|
37
|
+
add(condition) {
|
38
|
+
const coordinatorExpected = this.#userGroupedConditions.length !== 0;
|
39
|
+
if (condition.getCoordinator() && !coordinatorExpected) {
|
40
|
+
throw Error('No coordinator allowed on the first condition');
|
41
|
+
} else if (!condition.getCoordinator() && coordinatorExpected) {
|
42
|
+
throw Error('Coordinator must be present on subsequent conditions');
|
43
|
+
}
|
44
|
+
this.#userGroupedConditions.push(condition);
|
45
|
+
this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
|
46
|
+
return this;
|
47
|
+
}
|
48
|
+
replace(index, condition) {
|
49
|
+
const coordinatorExpected = index !== 0;
|
50
|
+
if (condition.getCoordinator() && !coordinatorExpected) {
|
51
|
+
throw Error('No coordinator allowed on the first condition');
|
52
|
+
} else if (!condition.getCoordinator() && coordinatorExpected) {
|
53
|
+
throw Error('Coordinator must be present on subsequent conditions');
|
54
|
+
} else if (index >= this.#userGroupedConditions.length) {
|
55
|
+
throw Error(`Cannot replace condition ${index} as no such condition exists`);
|
56
|
+
}
|
57
|
+
this.#userGroupedConditions.splice(index, 1, condition);
|
58
|
+
this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
|
59
|
+
return this;
|
60
|
+
}
|
61
|
+
remove(indexes) {
|
62
|
+
this.#userGroupedConditions = this.#userGroupedConditions.filter((_condition, index) => !indexes.includes(index)).map((condition, index) => index === 0 ? condition.asFirstCondition() : condition);
|
63
|
+
this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
|
64
|
+
return this;
|
65
|
+
}
|
66
|
+
addGroups(groupDefs) {
|
67
|
+
this.#userGroupedConditions = this._group(this.#userGroupedConditions, groupDefs);
|
68
|
+
this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
|
69
|
+
return this;
|
70
|
+
}
|
71
|
+
splitGroup(index) {
|
72
|
+
this.#userGroupedConditions = this._ungroup(this.#userGroupedConditions, index);
|
73
|
+
this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
|
74
|
+
return this;
|
75
|
+
}
|
76
|
+
moveEarlier(index) {
|
77
|
+
if (index > 0 && index < this.#userGroupedConditions.length) {
|
78
|
+
this.#userGroupedConditions.splice(index - 1, 0, this.#userGroupedConditions.splice(index, 1)[0]);
|
79
|
+
if (index === 1) {
|
80
|
+
this.switchCoordinators();
|
81
|
+
}
|
82
|
+
this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
|
83
|
+
}
|
84
|
+
return this;
|
85
|
+
}
|
86
|
+
moveLater(index) {
|
87
|
+
if (index >= 0 && index < this.#userGroupedConditions.length - 1) {
|
88
|
+
this.#userGroupedConditions.splice(index + 1, 0, this.#userGroupedConditions.splice(index, 1)[0]);
|
89
|
+
if (index === 0) {
|
90
|
+
this.switchCoordinators();
|
91
|
+
}
|
92
|
+
this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
|
93
|
+
}
|
94
|
+
return this;
|
95
|
+
}
|
96
|
+
switchCoordinators() {
|
97
|
+
this.#userGroupedConditions[1].setCoordinator(this.#userGroupedConditions[0].getCoordinator());
|
98
|
+
this.#userGroupedConditions[0].setCoordinator(undefined);
|
99
|
+
}
|
100
|
+
get asPerUserGroupings() {
|
101
|
+
return [...this.#userGroupedConditions];
|
102
|
+
}
|
103
|
+
get hasConditions() {
|
104
|
+
return this.#userGroupedConditions.length > 0;
|
105
|
+
}
|
106
|
+
get lastIndex() {
|
107
|
+
return this.#userGroupedConditions.length - 1;
|
108
|
+
}
|
109
|
+
toPresentationString() {
|
110
|
+
return this.#groupedConditions.map(condition => (0, _helpers.toPresentationString)(condition)).join(' ');
|
111
|
+
}
|
112
|
+
toExpression() {
|
113
|
+
return this.#groupedConditions.map(condition => (0, _helpers.toExpression)(condition)).join(' ');
|
114
|
+
}
|
115
|
+
_applyGroups(userGroupedConditions) {
|
116
|
+
const correctedUserGroups = userGroupedConditions.map(condition => condition instanceof _conditionGroup.ConditionGroup && condition.conditions.length > 2 ? new _conditionGroup.ConditionGroup(this._group(condition.conditions, this._autoGroupDefs(condition.conditions))) : condition);
|
117
|
+
return this._group(correctedUserGroups, this._autoGroupDefs(correctedUserGroups));
|
118
|
+
}
|
119
|
+
_group(conditions, groupDefs) {
|
120
|
+
return conditions.reduce((groups, condition, index, conditions) => {
|
121
|
+
const groupDef = groupDefs.find(groupDef => groupDef.contains(index));
|
122
|
+
if (groupDef) {
|
123
|
+
if (groupDef.startsWith(index)) {
|
124
|
+
const groupConditions = groupDef.applyTo(conditions);
|
125
|
+
groups.push(new _conditionGroup.ConditionGroup(groupConditions));
|
126
|
+
}
|
127
|
+
} else {
|
128
|
+
groups.push(condition);
|
129
|
+
}
|
130
|
+
return groups;
|
131
|
+
}, []);
|
132
|
+
}
|
133
|
+
_ungroup(conditions, splitIndex) {
|
134
|
+
if (conditions[splitIndex].isGroup()) {
|
135
|
+
const copy = [...conditions];
|
136
|
+
copy.splice(splitIndex, 1, ...conditions[splitIndex].getGroupedConditions());
|
137
|
+
return copy;
|
138
|
+
}
|
139
|
+
return conditions;
|
140
|
+
}
|
141
|
+
_autoGroupDefs(conditions) {
|
142
|
+
const orPositions = [];
|
143
|
+
conditions.forEach((condition, index) => {
|
144
|
+
if (condition.getCoordinator() === _types.Coordinator.OR) {
|
145
|
+
orPositions.push(index);
|
146
|
+
}
|
147
|
+
});
|
148
|
+
const hasOr = orPositions.length > 0;
|
149
|
+
const hasAnd = !!conditions.find(condition => condition.getCoordinator() === _types.Coordinator.AND);
|
150
|
+
if (hasAnd && hasOr) {
|
151
|
+
let start = 0;
|
152
|
+
const groupDefs = [];
|
153
|
+
orPositions.forEach((position, index) => {
|
154
|
+
if (start < position - 1) {
|
155
|
+
groupDefs.push(new _conditionGroupDef.ConditionGroupDef(start, position - 1));
|
156
|
+
}
|
157
|
+
const thisIsTheLastOr = orPositions.length === index + 1;
|
158
|
+
const thereAreMoreConditions = conditions.length - 1 > position;
|
159
|
+
if (thisIsTheLastOr && thereAreMoreConditions) {
|
160
|
+
groupDefs.push(new _conditionGroupDef.ConditionGroupDef(position, conditions.length - 1));
|
161
|
+
}
|
162
|
+
start = position;
|
163
|
+
});
|
164
|
+
return groupDefs;
|
165
|
+
}
|
166
|
+
return [];
|
167
|
+
}
|
168
|
+
toJSON() {
|
169
|
+
const name = this.#conditionName;
|
170
|
+
const conditions = this.#userGroupedConditions;
|
171
|
+
return {
|
172
|
+
name,
|
173
|
+
conditions: conditions.map(it => it.clone())
|
174
|
+
};
|
175
|
+
}
|
176
|
+
|
177
|
+
// TODO:- why is this not a constructor?
|
178
|
+
static from(obj) {
|
179
|
+
if (obj instanceof ConditionsModel) {
|
180
|
+
return obj;
|
181
|
+
}
|
182
|
+
const toReturn = new ConditionsModel();
|
183
|
+
toReturn.#conditionName = obj.name;
|
184
|
+
toReturn.#userGroupedConditions = obj.conditions.map(condition => conditionFrom(condition));
|
185
|
+
toReturn.#groupedConditions = toReturn._applyGroups(toReturn.#userGroupedConditions);
|
186
|
+
return toReturn;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
exports.ConditionsModel = ConditionsModel;
|
190
|
+
const conditionFrom = function (it) {
|
191
|
+
if ('conditions' in it) {
|
192
|
+
return new _conditionGroup.ConditionGroup(it.conditions.map(condition => conditionFrom(condition)));
|
193
|
+
}
|
194
|
+
if ('conditionName' in it) {
|
195
|
+
return new _conditionRef.ConditionRef(it.conditionName, it.conditionDisplayName, it.coordinator);
|
196
|
+
}
|
197
|
+
return new _condition2.Condition(_conditionField.ConditionField.from(it.field), it.operator, (0, _conditionValues.conditionValueFrom)(it.value), it.coordinator);
|
198
|
+
};
|
199
|
+
//# sourceMappingURL=condition-model.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"condition-model.js","names":["_conditionField","require","_conditionGroupDef","_condition2","_conditionRef","_conditionGroup","_conditionValues","_helpers","_types","ConditionsModel","groupedConditions","userGroupedConditions","conditionName","undefined","constructor","_conditionsObject","clone","toReturn","map","it","clear","name","add","condition","coordinatorExpected","length","getCoordinator","Error","push","_applyGroups","replace","index","splice","remove","indexes","filter","_condition","includes","asFirstCondition","addGroups","groupDefs","_group","splitGroup","_ungroup","moveEarlier","switchCoordinators","moveLater","setCoordinator","asPerUserGroupings","hasConditions","lastIndex","toPresentationString","join","toExpression","correctedUserGroups","ConditionGroup","conditions","_autoGroupDefs","reduce","groups","groupDef","find","contains","startsWith","groupConditions","applyTo","splitIndex","isGroup","copy","getGroupedConditions","orPositions","forEach","Coordinator","OR","hasOr","hasAnd","AND","start","position","ConditionGroupDef","thisIsTheLastOr","thereAreMoreConditions","toJSON","from","obj","conditionFrom","exports","ConditionRef","conditionDisplayName","coordinator","Condition","ConditionField","field","operator","conditionValueFrom","value"],"sources":["../../../src/conditions/condition-model.ts"],"sourcesContent":["import { ConditionField } from './condition-field'\nimport { ConditionGroupDef } from './condition-group-def'\nimport { Condition } from './condition'\nimport { ConditionRef } from './condition-ref'\nimport { ConditionGroup } from './condition-group'\nimport { conditionValueFrom } from './condition-values'\nimport { toPresentationString, toExpression } from './helpers'\nimport { Coordinator, ConditionsArray } from './types'\n\ntype ConditionRawObject =\n | ConditionsModel\n | {\n name: string\n conditions: Condition[]\n }\n\nexport class ConditionsModel {\n #groupedConditions: ConditionsArray = []\n #userGroupedConditions: ConditionsArray = []\n #conditionName: string | undefined = undefined\n\n constructor(_conditionsObject?: ConditionRawObject) {}\n\n clone() {\n const toReturn = new ConditionsModel()\n toReturn.#groupedConditions = this.#groupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#userGroupedConditions = this.#userGroupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#conditionName = this.#conditionName\n return toReturn\n }\n\n clear() {\n this.#userGroupedConditions = []\n this.#groupedConditions = []\n this.#conditionName = undefined\n return this\n }\n\n set name(name) {\n this.#conditionName = name\n }\n\n get name() {\n return this.#conditionName\n }\n\n add(condition: Condition) {\n const coordinatorExpected = this.#userGroupedConditions.length !== 0\n\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n }\n\n this.#userGroupedConditions.push(condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n\n return this\n }\n\n replace(index: number, condition: Condition) {\n const coordinatorExpected = index !== 0\n\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n } else if (index >= this.#userGroupedConditions.length) {\n throw Error(\n `Cannot replace condition ${index} as no such condition exists`\n )\n }\n\n this.#userGroupedConditions.splice(index, 1, condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n\n return this\n }\n\n remove(indexes: number[]) {\n this.#userGroupedConditions = this.#userGroupedConditions\n .filter((_condition, index) => !indexes.includes(index))\n .map((condition, index) =>\n index === 0 ? condition.asFirstCondition() : condition\n )\n\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n addGroups(groupDefs: ConditionGroupDef[]) {\n this.#userGroupedConditions = this._group(\n this.#userGroupedConditions,\n groupDefs\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n splitGroup(index: number) {\n this.#userGroupedConditions = this._ungroup(\n this.#userGroupedConditions,\n index\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n moveEarlier(index: number) {\n if (index > 0 && index < this.#userGroupedConditions.length) {\n this.#userGroupedConditions.splice(\n index - 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 1) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n moveLater(index: number) {\n if (index >= 0 && index < this.#userGroupedConditions.length - 1) {\n this.#userGroupedConditions.splice(\n index + 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 0) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n switchCoordinators() {\n this.#userGroupedConditions[1].setCoordinator(\n this.#userGroupedConditions[0].getCoordinator()\n )\n this.#userGroupedConditions[0].setCoordinator(undefined)\n }\n\n get asPerUserGroupings() {\n return [...this.#userGroupedConditions]\n }\n\n get hasConditions() {\n return this.#userGroupedConditions.length > 0\n }\n\n get lastIndex() {\n return this.#userGroupedConditions.length - 1\n }\n\n toPresentationString() {\n return this.#groupedConditions\n .map((condition) => toPresentationString(condition))\n .join(' ')\n }\n\n toExpression() {\n return this.#groupedConditions\n .map((condition) => toExpression(condition))\n .join(' ')\n }\n\n _applyGroups(\n userGroupedConditions: (Condition | ConditionGroup | ConditionRef)[]\n ) {\n const correctedUserGroups = userGroupedConditions.map((condition) =>\n condition instanceof ConditionGroup && condition.conditions.length > 2\n ? new ConditionGroup(\n this._group(\n condition.conditions,\n this._autoGroupDefs(condition.conditions)\n )\n )\n : condition\n )\n\n return this._group(\n correctedUserGroups,\n this._autoGroupDefs(correctedUserGroups)\n )\n }\n\n _group(conditions: ConditionsArray, groupDefs: ConditionGroupDef[]) {\n return conditions.reduce((groups, condition, index, conditions) => {\n const groupDef = groupDefs.find((groupDef) => groupDef.contains(index))\n\n if (groupDef) {\n if (groupDef.startsWith(index)) {\n const groupConditions = groupDef.applyTo(conditions)\n groups.push(new ConditionGroup(groupConditions))\n }\n } else {\n groups.push(condition)\n }\n\n return groups\n }, [] as ConditionsArray)\n }\n\n _ungroup(conditions: ConditionsArray, splitIndex: number) {\n if (conditions[splitIndex].isGroup()) {\n const copy = [...conditions]\n copy.splice(\n splitIndex,\n 1,\n ...conditions[splitIndex].getGroupedConditions()\n )\n return copy\n }\n return conditions\n }\n\n _autoGroupDefs(conditions: ConditionsArray) {\n const orPositions: number[] = []\n\n conditions.forEach((condition, index) => {\n if (condition.getCoordinator() === Coordinator.OR) {\n orPositions.push(index)\n }\n })\n\n const hasOr = orPositions.length > 0\n const hasAnd = !!conditions.find(\n (condition) => condition.getCoordinator() === Coordinator.AND\n )\n\n if (hasAnd && hasOr) {\n let start = 0\n const groupDefs: ConditionGroupDef[] = []\n orPositions.forEach((position, index) => {\n if (start < position - 1) {\n groupDefs.push(new ConditionGroupDef(start, position - 1))\n }\n const thisIsTheLastOr = orPositions.length === index + 1\n const thereAreMoreConditions = conditions.length - 1 > position\n if (thisIsTheLastOr && thereAreMoreConditions) {\n groupDefs.push(new ConditionGroupDef(position, conditions.length - 1))\n }\n start = position\n })\n return groupDefs\n }\n\n return []\n }\n\n toJSON() {\n const name = this.#conditionName\n const conditions = this.#userGroupedConditions\n return {\n name,\n conditions: conditions.map((it) => it.clone())\n }\n }\n\n // TODO:- why is this not a constructor?\n static from(obj: ConditionRawObject | ConditionsModel) {\n if (obj instanceof ConditionsModel) {\n return obj\n }\n const toReturn = new ConditionsModel()\n toReturn.#conditionName = obj.name\n toReturn.#userGroupedConditions = obj.conditions.map((condition) =>\n conditionFrom(condition)\n )\n toReturn.#groupedConditions = toReturn._applyGroups(\n toReturn.#userGroupedConditions\n )\n return toReturn\n }\n}\n\ninterface ConditionFrom {\n (\n it: Condition | ConditionRef | ConditionGroup\n ): Condition | ConditionRef | ConditionGroup\n}\n\nconst conditionFrom: ConditionFrom = function (it) {\n if ('conditions' in it) {\n return new ConditionGroup(\n (it as ConditionGroup).conditions.map((condition) =>\n conditionFrom(condition)\n )\n )\n }\n\n if ('conditionName' in it) {\n return new ConditionRef(\n it.conditionName,\n it.conditionDisplayName,\n it.coordinator\n )\n }\n\n return new Condition(\n ConditionField.from(it.field),\n it.operator,\n conditionValueFrom(it.value),\n it.coordinator\n )\n}\n"],"mappings":";;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AASO,MAAMQ,eAAe,CAAC;EAC3B,CAACC,iBAAiB,GAAoB,EAAE;EACxC,CAACC,qBAAqB,GAAoB,EAAE;EAC5C,CAACC,aAAa,GAAuBC,SAAS;EAE9CC,WAAWA,CAACC,iBAAsC,EAAE,CAAC;EAErDC,KAAKA,CAAA,EAAG;IACN,MAAMC,QAAQ,GAAG,IAAIR,eAAe,CAAC,CAAC;IACtCQ,QAAQ,CAAC,CAACP,iBAAiB,GAAG,IAAI,CAAC,CAACA,iBAAiB,CAACQ,GAAG,CAAEC,EAAE,IAC3DA,EAAE,CAACH,KAAK,CAAC,CACX,CAAC;IACDC,QAAQ,CAAC,CAACN,qBAAqB,GAAG,IAAI,CAAC,CAACA,qBAAqB,CAACO,GAAG,CAAEC,EAAE,IACnEA,EAAE,CAACH,KAAK,CAAC,CACX,CAAC;IACDC,QAAQ,CAAC,CAACL,aA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;AACH,CAAC"}
|
@@ -0,0 +1,248 @@
|
|
1
|
+
import { ComponentType, ComponentDef } from '../components';
|
2
|
+
import { ConditionValueAbstract } from './condition-value-abstract';
|
3
|
+
export declare const customOperators: {
|
4
|
+
CheckboxesField: {
|
5
|
+
contains: {
|
6
|
+
expression: (field: ComponentDef, value: any) => string;
|
7
|
+
};
|
8
|
+
'does not contain': {
|
9
|
+
expression: (field: ComponentDef, value: any) => string;
|
10
|
+
};
|
11
|
+
};
|
12
|
+
NumberField: {
|
13
|
+
'is at least': {
|
14
|
+
expression: (field: ComponentDef, value: any) => string;
|
15
|
+
};
|
16
|
+
'is at most': {
|
17
|
+
expression: (field: ComponentDef, value: any) => string;
|
18
|
+
};
|
19
|
+
'is less than': {
|
20
|
+
expression: (field: ComponentDef, value: any) => string;
|
21
|
+
};
|
22
|
+
'is more than': {
|
23
|
+
expression: (field: ComponentDef, value: any) => string;
|
24
|
+
};
|
25
|
+
} & {
|
26
|
+
is: {
|
27
|
+
expression: (field: ComponentDef, value: any) => string;
|
28
|
+
};
|
29
|
+
'is not': {
|
30
|
+
expression: (field: ComponentDef, value: any) => string;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
DateField: {
|
34
|
+
is: {
|
35
|
+
expression: (field: ComponentDef, value: any) => string;
|
36
|
+
};
|
37
|
+
'is not': {
|
38
|
+
expression: (field: ComponentDef, value: any) => string;
|
39
|
+
};
|
40
|
+
'is before': {
|
41
|
+
expression: (field: ComponentDef, value: any) => string;
|
42
|
+
};
|
43
|
+
'is after': {
|
44
|
+
expression: (field: ComponentDef, value: any) => string;
|
45
|
+
};
|
46
|
+
} & {
|
47
|
+
'is at least': {
|
48
|
+
units: any;
|
49
|
+
expression: (field: ComponentDef, value: any) => string;
|
50
|
+
};
|
51
|
+
'is at most': {
|
52
|
+
units: any;
|
53
|
+
expression: (field: ComponentDef, value: any) => string;
|
54
|
+
};
|
55
|
+
'is less than': {
|
56
|
+
units: any;
|
57
|
+
expression: (field: ComponentDef, value: any) => string;
|
58
|
+
};
|
59
|
+
'is more than': {
|
60
|
+
units: any;
|
61
|
+
expression: (field: ComponentDef, value: any) => string;
|
62
|
+
};
|
63
|
+
};
|
64
|
+
TimeField: {
|
65
|
+
is: {
|
66
|
+
expression: (field: ComponentDef, value: any) => string;
|
67
|
+
};
|
68
|
+
'is not': {
|
69
|
+
expression: (field: ComponentDef, value: any) => string;
|
70
|
+
};
|
71
|
+
'is before': {
|
72
|
+
expression: (field: ComponentDef, value: any) => string;
|
73
|
+
};
|
74
|
+
'is after': {
|
75
|
+
expression: (field: ComponentDef, value: any) => string;
|
76
|
+
};
|
77
|
+
} & {
|
78
|
+
'is at least': {
|
79
|
+
units: any;
|
80
|
+
expression: (field: ComponentDef, value: any) => string;
|
81
|
+
};
|
82
|
+
'is at most': {
|
83
|
+
units: any;
|
84
|
+
expression: (field: ComponentDef, value: any) => string;
|
85
|
+
};
|
86
|
+
'is less than': {
|
87
|
+
units: any;
|
88
|
+
expression: (field: ComponentDef, value: any) => string;
|
89
|
+
};
|
90
|
+
'is more than': {
|
91
|
+
units: any;
|
92
|
+
expression: (field: ComponentDef, value: any) => string;
|
93
|
+
};
|
94
|
+
};
|
95
|
+
DatePartsField: {
|
96
|
+
is: {
|
97
|
+
expression: (field: ComponentDef, value: any) => string;
|
98
|
+
};
|
99
|
+
'is not': {
|
100
|
+
expression: (field: ComponentDef, value: any) => string;
|
101
|
+
};
|
102
|
+
'is before': {
|
103
|
+
expression: (field: ComponentDef, value: any) => string;
|
104
|
+
};
|
105
|
+
'is after': {
|
106
|
+
expression: (field: ComponentDef, value: any) => string;
|
107
|
+
};
|
108
|
+
} & {
|
109
|
+
'is at least': {
|
110
|
+
units: any;
|
111
|
+
expression: (field: ComponentDef, value: any) => string;
|
112
|
+
};
|
113
|
+
'is at most': {
|
114
|
+
units: any;
|
115
|
+
expression: (field: ComponentDef, value: any) => string;
|
116
|
+
};
|
117
|
+
'is less than': {
|
118
|
+
units: any;
|
119
|
+
expression: (field: ComponentDef, value: any) => string;
|
120
|
+
};
|
121
|
+
'is more than': {
|
122
|
+
units: any;
|
123
|
+
expression: (field: ComponentDef, value: any) => string;
|
124
|
+
};
|
125
|
+
};
|
126
|
+
DateTimeField: {
|
127
|
+
is: {
|
128
|
+
expression: (field: ComponentDef, value: any) => string;
|
129
|
+
};
|
130
|
+
'is not': {
|
131
|
+
expression: (field: ComponentDef, value: any) => string;
|
132
|
+
};
|
133
|
+
'is before': {
|
134
|
+
expression: (field: ComponentDef, value: any) => string;
|
135
|
+
};
|
136
|
+
'is after': {
|
137
|
+
expression: (field: ComponentDef, value: any) => string;
|
138
|
+
};
|
139
|
+
} & {
|
140
|
+
'is at least': {
|
141
|
+
units: any;
|
142
|
+
expression: (field: ComponentDef, value: any) => string;
|
143
|
+
};
|
144
|
+
'is at most': {
|
145
|
+
units: any;
|
146
|
+
expression: (field: ComponentDef, value: any) => string;
|
147
|
+
};
|
148
|
+
'is less than': {
|
149
|
+
units: any;
|
150
|
+
expression: (field: ComponentDef, value: any) => string;
|
151
|
+
};
|
152
|
+
'is more than': {
|
153
|
+
units: any;
|
154
|
+
expression: (field: ComponentDef, value: any) => string;
|
155
|
+
};
|
156
|
+
};
|
157
|
+
DateTimePartsField: {
|
158
|
+
is: {
|
159
|
+
expression: (field: ComponentDef, value: any) => string;
|
160
|
+
};
|
161
|
+
'is not': {
|
162
|
+
expression: (field: ComponentDef, value: any) => string;
|
163
|
+
};
|
164
|
+
'is before': {
|
165
|
+
expression: (field: ComponentDef, value: any) => string;
|
166
|
+
};
|
167
|
+
'is after': {
|
168
|
+
expression: (field: ComponentDef, value: any) => string;
|
169
|
+
};
|
170
|
+
} & {
|
171
|
+
'is at least': {
|
172
|
+
units: any;
|
173
|
+
expression: (field: ComponentDef, value: any) => string;
|
174
|
+
};
|
175
|
+
'is at most': {
|
176
|
+
units: any;
|
177
|
+
expression: (field: ComponentDef, value: any) => string;
|
178
|
+
};
|
179
|
+
'is less than': {
|
180
|
+
units: any;
|
181
|
+
expression: (field: ComponentDef, value: any) => string;
|
182
|
+
};
|
183
|
+
'is more than': {
|
184
|
+
units: any;
|
185
|
+
expression: (field: ComponentDef, value: any) => string;
|
186
|
+
};
|
187
|
+
};
|
188
|
+
TextField: {
|
189
|
+
'is longer than': {
|
190
|
+
expression: (field: ComponentDef, value: any) => string;
|
191
|
+
};
|
192
|
+
'is shorter than': {
|
193
|
+
expression: (field: ComponentDef, value: any) => string;
|
194
|
+
};
|
195
|
+
'has length': {
|
196
|
+
expression: (field: ComponentDef, value: any) => string;
|
197
|
+
};
|
198
|
+
} & {
|
199
|
+
is: {
|
200
|
+
expression: (field: ComponentDef, value: any) => string;
|
201
|
+
};
|
202
|
+
'is not': {
|
203
|
+
expression: (field: ComponentDef, value: any) => string;
|
204
|
+
};
|
205
|
+
};
|
206
|
+
MultilineTextField: {
|
207
|
+
'is longer than': {
|
208
|
+
expression: (field: ComponentDef, value: any) => string;
|
209
|
+
};
|
210
|
+
'is shorter than': {
|
211
|
+
expression: (field: ComponentDef, value: any) => string;
|
212
|
+
};
|
213
|
+
'has length': {
|
214
|
+
expression: (field: ComponentDef, value: any) => string;
|
215
|
+
};
|
216
|
+
} & {
|
217
|
+
is: {
|
218
|
+
expression: (field: ComponentDef, value: any) => string;
|
219
|
+
};
|
220
|
+
'is not': {
|
221
|
+
expression: (field: ComponentDef, value: any) => string;
|
222
|
+
};
|
223
|
+
};
|
224
|
+
EmailAddressField: {
|
225
|
+
'is longer than': {
|
226
|
+
expression: (field: ComponentDef, value: any) => string;
|
227
|
+
};
|
228
|
+
'is shorter than': {
|
229
|
+
expression: (field: ComponentDef, value: any) => string;
|
230
|
+
};
|
231
|
+
'has length': {
|
232
|
+
expression: (field: ComponentDef, value: any) => string;
|
233
|
+
};
|
234
|
+
} & {
|
235
|
+
is: {
|
236
|
+
expression: (field: ComponentDef, value: any) => string;
|
237
|
+
};
|
238
|
+
'is not': {
|
239
|
+
expression: (field: ComponentDef, value: any) => string;
|
240
|
+
};
|
241
|
+
};
|
242
|
+
};
|
243
|
+
export declare function getOperatorNames(fieldType: any): string[];
|
244
|
+
export declare function getExpression(fieldType: ComponentType, fieldName: string, operator: string, value: ConditionValueAbstract): any;
|
245
|
+
export declare function getOperatorConfig(fieldType: ComponentType, operator: any): any;
|
246
|
+
export declare const absoluteDateOrTimeOperatorNames: string[];
|
247
|
+
export declare const relativeDateOrTimeOperatorNames: string[];
|
248
|
+
//# sourceMappingURL=condition-operators.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"condition-operators.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AA0CnE,eAAO,MAAM,eAAe;;;gCAiFJ,YAAY;;;gCAOZ,YAAY;;;;;gCArBZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;;;gCA0CZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;;;gCAYZ,YAAY;;;;gCAAZ,YAAY;;;;gCAAZ,YAAY;;;;gCAAZ,YAAY;;;;;gCAZZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;;;gCAYZ,YAAY;;;;gCAAZ,YAAY;;;;gCAAZ,YAAY;;;;gCAAZ,YAAY;;;;;gCAZZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;;;gCAYZ,YAAY;;;;gCAAZ,YAAY;;;;gCAAZ,YAAY;;;;gCAAZ,YAAY;;;;;gCAZZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;gCAAZ,YAAY;;;;;gCAYZ,YAAY;;;;gCAAZ,YAAY;;;;gCAA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