@defra/forms-model 3.0.9 → 3.0.11
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/dist/browser/components/component-types.js +201 -219
- package/dist/browser/components/component-types.js.map +1 -1
- package/dist/browser/components/conditional-component-types.js +9 -27
- package/dist/browser/components/conditional-component-types.js.map +1 -1
- package/dist/browser/components/enums.js +27 -45
- package/dist/browser/components/enums.js.map +1 -1
- package/dist/browser/components/index.js +3 -35
- package/dist/browser/components/index.js.map +1 -1
- package/dist/browser/components/types.js +1 -15
- package/dist/browser/conditions/condition-abstract.js +42 -60
- package/dist/browser/conditions/condition-abstract.js.map +1 -1
- package/dist/browser/conditions/condition-field.js +23 -41
- package/dist/browser/conditions/condition-field.js.map +1 -1
- package/dist/browser/conditions/condition-group-def.js +23 -42
- package/dist/browser/conditions/condition-group-def.js.map +1 -1
- package/dist/browser/conditions/condition-group.js +43 -61
- package/dist/browser/conditions/condition-group.js.map +1 -1
- package/dist/browser/conditions/condition-model.js +185 -196
- package/dist/browser/conditions/condition-model.js.map +1 -1
- package/dist/browser/conditions/condition-operators.js +103 -124
- package/dist/browser/conditions/condition-operators.js.map +1 -1
- package/dist/browser/conditions/condition-ref.js +29 -47
- package/dist/browser/conditions/condition-ref.js.map +1 -1
- package/dist/browser/conditions/condition-value-abstract.js +19 -37
- package/dist/browser/conditions/condition-value-abstract.js.map +1 -1
- package/dist/browser/conditions/condition-value-registration.js +15 -34
- package/dist/browser/conditions/condition-value-registration.js.map +1 -1
- package/dist/browser/conditions/condition-values.js +98 -118
- package/dist/browser/conditions/condition-values.js.map +1 -1
- package/dist/browser/conditions/condition.js +36 -51
- package/dist/browser/conditions/condition.js.map +1 -1
- package/dist/browser/conditions/enums.js +5 -23
- package/dist/browser/conditions/enums.js.map +1 -1
- package/dist/browser/conditions/helpers.js +6 -25
- package/dist/browser/conditions/helpers.js.map +1 -1
- package/dist/browser/conditions/index.js +10 -143
- package/dist/browser/conditions/index.js.map +1 -1
- package/dist/browser/conditions/inline-condition-model.js +372 -394
- package/dist/browser/conditions/inline-condition-model.js.map +1 -1
- package/dist/browser/conditions/inline-condition-operators.js +103 -124
- package/dist/browser/conditions/inline-condition-operators.js.map +1 -1
- package/dist/browser/conditions/inline-condition-values.js +123 -145
- package/dist/browser/conditions/inline-condition-values.js.map +1 -1
- package/dist/browser/conditions/types.js +1 -15
- package/dist/browser/conditions/types.js.map +1 -1
- package/dist/browser/data-model/conditions-wrapper.js +27 -45
- package/dist/browser/data-model/conditions-wrapper.js.map +1 -1
- package/dist/browser/data-model/enums.js +6 -24
- package/dist/browser/data-model/enums.js.map +1 -1
- package/dist/browser/data-model/index.js +3 -35
- package/dist/browser/data-model/index.js.map +1 -1
- package/dist/browser/data-model/input-wrapper.js +28 -46
- package/dist/browser/data-model/input-wrapper.js.map +1 -1
- package/dist/browser/data-model/types.js +7 -25
- package/dist/browser/data-model/types.js.map +1 -1
- package/dist/browser/form/form-configuration.js +16 -35
- package/dist/browser/form/form-configuration.js.map +1 -1
- package/dist/browser/form/index.js +1 -23
- package/dist/browser/form/index.js.map +1 -1
- package/dist/browser/index.js +8 -97
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/migration/index.js +1 -23
- package/dist/browser/migration/index.js.map +1 -1
- package/dist/browser/migration/migration.0-2.js +42 -60
- package/dist/browser/migration/migration.0-2.js.map +1 -1
- package/dist/browser/migration/migration.1-2.js +83 -99
- package/dist/browser/migration/migration.1-2.js.map +1 -1
- package/dist/browser/migration/types.js +1 -15
- package/dist/browser/migration/whichMigrations.js +20 -36
- package/dist/browser/migration/whichMigrations.js.map +1 -1
- package/dist/browser/schema/index.js +1 -29
- package/dist/browser/schema/index.js.map +1 -1
- package/dist/browser/schema/schema.js +231 -249
- package/dist/browser/schema/schema.js.map +1 -1
- package/dist/browser/utils/helpers.js +22 -43
- package/dist/browser/utils/helpers.js.map +1 -1
- package/dist/browser/utils/logger.js +24 -43
- package/dist/browser/utils/logger.js.map +1 -1
- package/dist/module/components/component-types.js +1 -5
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/components/conditional-component-types.js +1 -5
- package/dist/module/components/conditional-component-types.js.map +1 -1
- package/dist/module/components/enums.js +1 -5
- package/dist/module/components/enums.js.map +1 -1
- package/dist/module/components/index.js +3 -24
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/types.js +2 -1
- package/dist/module/conditions/condition-abstract.js +3 -8
- package/dist/module/conditions/condition-abstract.js.map +1 -1
- package/dist/module/conditions/condition-field.js +3 -8
- package/dist/module/conditions/condition-field.js.map +1 -1
- package/dist/module/conditions/condition-group-def.js +1 -6
- package/dist/module/conditions/condition-group-def.js.map +1 -1
- package/dist/module/conditions/condition-group.js +4 -9
- package/dist/module/conditions/condition-group.js.map +1 -1
- package/dist/module/conditions/condition-model.js +20 -25
- package/dist/module/conditions/condition-model.js.map +1 -1
- package/dist/module/conditions/condition-operators.js +15 -23
- package/dist/module/conditions/condition-operators.js.map +1 -1
- package/dist/module/conditions/condition-ref.js +2 -7
- package/dist/module/conditions/condition-ref.js.map +1 -1
- package/dist/module/conditions/condition-value-abstract.js +3 -8
- package/dist/module/conditions/condition-value-abstract.js.map +1 -1
- package/dist/module/conditions/condition-value-registration.js +1 -6
- package/dist/module/conditions/condition-value-registration.js.map +1 -1
- package/dist/module/conditions/condition-values.js +12 -20
- package/dist/module/conditions/condition-values.js.map +1 -1
- package/dist/module/conditions/condition.js +9 -14
- package/dist/module/conditions/condition.js.map +1 -1
- package/dist/module/conditions/enums.js +1 -5
- package/dist/module/conditions/enums.js.map +1 -1
- package/dist/module/conditions/helpers.js +2 -7
- package/dist/module/conditions/helpers.js.map +1 -1
- package/dist/module/conditions/index.js +10 -139
- package/dist/module/conditions/index.js.map +1 -1
- package/dist/module/conditions/inline-condition-model.js +15 -26
- package/dist/module/conditions/inline-condition-model.js.map +1 -1
- package/dist/module/conditions/inline-condition-operators.js +15 -23
- package/dist/module/conditions/inline-condition-operators.js.map +1 -1
- package/dist/module/conditions/inline-condition-values.js +9 -17
- package/dist/module/conditions/inline-condition-values.js.map +1 -1
- package/dist/module/conditions/types.js +2 -1
- package/dist/module/conditions/types.js.map +1 -1
- package/dist/module/data-model/conditions-wrapper.js +3 -8
- package/dist/module/data-model/conditions-wrapper.js.map +1 -1
- package/dist/module/data-model/enums.js +1 -5
- package/dist/module/data-model/enums.js.map +1 -1
- package/dist/module/data-model/index.js +3 -24
- package/dist/module/data-model/index.js.map +1 -1
- package/dist/module/data-model/input-wrapper.js +3 -8
- package/dist/module/data-model/input-wrapper.js.map +1 -1
- package/dist/module/data-model/types.js +1 -5
- package/dist/module/data-model/types.js.map +1 -1
- package/dist/module/form/form-configuration.js +1 -6
- package/dist/module/form/form-configuration.js.map +1 -1
- package/dist/module/form/index.js +1 -10
- package/dist/module/form/index.js.map +1 -1
- package/dist/module/index.js +8 -91
- package/dist/module/index.js.map +1 -1
- package/dist/module/migration/index.js +1 -10
- package/dist/module/migration/index.js.map +1 -1
- package/dist/module/migration/migration.0-2.js +1 -5
- package/dist/module/migration/migration.0-2.js.map +1 -1
- package/dist/module/migration/migration.1-2.js +3 -6
- package/dist/module/migration/migration.1-2.js.map +1 -1
- package/dist/module/migration/types.js +2 -1
- package/dist/module/migration/whichMigrations.js +5 -9
- package/dist/module/migration/whichMigrations.js.map +1 -1
- package/dist/module/schema/index.js +1 -16
- package/dist/module/schema/index.js.map +1 -1
- package/dist/module/schema/schema.js +163 -167
- package/dist/module/schema/schema.js.map +1 -1
- package/dist/module/utils/helpers.js +5 -13
- package/dist/module/utils/helpers.js.map +1 -1
- package/dist/module/utils/logger.js +1 -6
- package/dist/module/utils/logger.js.map +1 -1
- package/dist/types/components/component-types.d.ts +1 -1
- package/dist/types/components/component-types.d.ts.map +1 -1
- package/dist/types/components/conditional-component-types.d.ts +1 -1
- package/dist/types/components/conditional-component-types.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +3 -3
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/conditions/condition-abstract.d.ts +1 -1
- package/dist/types/conditions/condition-abstract.d.ts.map +1 -1
- package/dist/types/conditions/condition-field.d.ts +1 -1
- package/dist/types/conditions/condition-field.d.ts.map +1 -1
- package/dist/types/conditions/condition-group-def.d.ts +2 -2
- package/dist/types/conditions/condition-group-def.d.ts.map +1 -1
- package/dist/types/conditions/condition-group.d.ts +2 -2
- package/dist/types/conditions/condition-group.d.ts.map +1 -1
- package/dist/types/conditions/condition-model.d.ts +5 -5
- package/dist/types/conditions/condition-model.d.ts.map +1 -1
- package/dist/types/conditions/condition-operators.d.ts +2 -2
- package/dist/types/conditions/condition-operators.d.ts.map +1 -1
- package/dist/types/conditions/condition-ref.d.ts +2 -2
- package/dist/types/conditions/condition-ref.d.ts.map +1 -1
- package/dist/types/conditions/condition-value-abstract.d.ts +1 -1
- package/dist/types/conditions/condition-value-abstract.d.ts.map +1 -1
- package/dist/types/conditions/condition-values.d.ts +3 -3
- package/dist/types/conditions/condition-values.d.ts.map +1 -1
- package/dist/types/conditions/condition.d.ts +4 -4
- package/dist/types/conditions/condition.d.ts.map +1 -1
- package/dist/types/conditions/index.d.ts +10 -10
- package/dist/types/conditions/index.d.ts.map +1 -1
- package/dist/types/conditions/types.d.ts +3 -3
- package/dist/types/conditions/types.d.ts.map +1 -1
- package/dist/types/data-model/conditions-wrapper.d.ts +1 -1
- package/dist/types/data-model/conditions-wrapper.d.ts.map +1 -1
- package/dist/types/data-model/index.d.ts +3 -3
- package/dist/types/data-model/index.d.ts.map +1 -1
- package/dist/types/data-model/input-wrapper.d.ts +2 -2
- package/dist/types/data-model/input-wrapper.d.ts.map +1 -1
- package/dist/types/data-model/types.d.ts +3 -3
- package/dist/types/data-model/types.d.ts.map +1 -1
- package/dist/types/form/index.d.ts +1 -1
- package/dist/types/form/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +11 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/migration/index.d.ts +1 -1
- package/dist/types/migration/index.d.ts.map +1 -1
- package/dist/types/migration/migration.0-2.d.ts +1 -1
- package/dist/types/migration/migration.0-2.d.ts.map +1 -1
- package/dist/types/migration/migration.1-2.d.ts +1 -1
- package/dist/types/migration/migration.1-2.d.ts.map +1 -1
- package/dist/types/migration/whichMigrations.d.ts +1 -1
- package/dist/types/migration/whichMigrations.d.ts.map +1 -1
- package/dist/types/schema/index.d.ts +1 -1
- package/dist/types/schema/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/components/component-types.ts +1 -1
- package/src/components/conditional-component-types.ts +1 -1
- package/src/components/index.ts +3 -3
- package/src/conditions/condition-abstract.ts +1 -1
- package/src/conditions/condition-field.ts +2 -2
- package/src/conditions/condition-group-def.ts +1 -1
- package/src/conditions/condition-group.ts +3 -3
- package/src/conditions/condition-model.ts +9 -9
- package/src/conditions/condition-operators.ts +6 -3
- package/src/conditions/condition-ref.ts +2 -2
- package/src/conditions/condition-value-abstract.ts +1 -1
- package/src/conditions/condition-values.ts +3 -3
- package/src/conditions/condition.ts +6 -6
- package/src/conditions/index.ts +10 -10
- package/src/conditions/inline-condition-model.ts +3 -3
- package/src/conditions/inline-condition-operators.ts +1 -1
- package/src/conditions/types.ts +3 -3
- package/src/data-model/conditions-wrapper.ts +2 -2
- package/src/data-model/index.ts +3 -3
- package/src/data-model/input-wrapper.ts +3 -3
- package/src/data-model/types.ts +3 -3
- package/src/form/index.ts +1 -1
- package/src/index.ts +11 -11
- package/src/migration/index.ts +1 -1
- package/src/migration/migration.0-2.ts +1 -1
- package/src/migration/migration.1-2.ts +2 -2
- package/src/migration/whichMigrations.ts +3 -3
- package/src/schema/index.ts +1 -1
@@ -1,159 +1,137 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
factory(mod.exports);
|
11
|
-
global.inlineConditionValues = mod.exports;
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
4
|
+
const conditionValueFactories = {};
|
5
|
+
class Registration {
|
6
|
+
constructor(type, factory) {
|
7
|
+
_defineProperty(this, "type", void 0);
|
8
|
+
conditionValueFactories[type] = factory;
|
9
|
+
this.type = type;
|
12
10
|
}
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
20
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
21
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
22
|
-
const conditionValueFactories = {};
|
23
|
-
class Registration {
|
24
|
-
constructor(type, factory) {
|
25
|
-
_defineProperty(this, "type", void 0);
|
26
|
-
conditionValueFactories[type] = factory;
|
27
|
-
this.type = type;
|
11
|
+
}
|
12
|
+
export class AbstractConditionValue {
|
13
|
+
constructor(registration) {
|
14
|
+
_defineProperty(this, "type", void 0);
|
15
|
+
if (new.target === AbstractConditionValue) {
|
16
|
+
throw new TypeError('Cannot construct ConditionValue instances directly');
|
28
17
|
}
|
29
|
-
|
30
|
-
|
31
|
-
constructor(registration) {
|
32
|
-
_defineProperty(this, "type", void 0);
|
33
|
-
if (new.target === AbstractConditionValue) {
|
34
|
-
throw new TypeError('Cannot construct ConditionValue instances directly');
|
35
|
-
}
|
36
|
-
if (!(registration instanceof Registration)) {
|
37
|
-
throw new TypeError('You must register your value type! Call registerValueType!');
|
38
|
-
}
|
39
|
-
this.type = registration.type;
|
18
|
+
if (!(registration instanceof Registration)) {
|
19
|
+
throw new TypeError('You must register your value type! Call registerValueType!');
|
40
20
|
}
|
41
|
-
|
42
|
-
toExpression() {}
|
21
|
+
this.type = registration.type;
|
43
22
|
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
throw Error(`display ${display} is not valid`);
|
56
|
-
}
|
57
|
-
this.value = value;
|
58
|
-
this.display = display || value;
|
59
|
-
}
|
60
|
-
toPresentationString() {
|
61
|
-
return this.display;
|
62
|
-
}
|
63
|
-
toExpression() {
|
64
|
-
return this.value;
|
65
|
-
}
|
66
|
-
static from(obj) {
|
67
|
-
return new ConditionValue(obj.value, obj.display);
|
23
|
+
toPresentationString() {}
|
24
|
+
toExpression() {}
|
25
|
+
}
|
26
|
+
const valueType = registerValueType('Value', obj => ConditionValue.from(obj));
|
27
|
+
export class ConditionValue extends AbstractConditionValue {
|
28
|
+
constructor(value, display) {
|
29
|
+
super(valueType);
|
30
|
+
_defineProperty(this, "value", void 0);
|
31
|
+
_defineProperty(this, "display", void 0);
|
32
|
+
if (!value || typeof value !== 'string') {
|
33
|
+
throw Error(`value ${value} is not valid`);
|
68
34
|
}
|
69
|
-
|
70
|
-
|
35
|
+
if (display && typeof display !== 'string') {
|
36
|
+
throw Error(`display ${display} is not valid`);
|
71
37
|
}
|
38
|
+
this.value = value;
|
39
|
+
this.display = display || value;
|
72
40
|
}
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
toPresentationString() {
|
130
|
-
return `${this.timePeriod} ${this.timeUnit} ${this.direction}`;
|
131
|
-
}
|
132
|
-
toExpression() {
|
133
|
-
const timePeriod = this.direction === dateDirections.PAST ? 0 - Number(this.timePeriod) : this.timePeriod;
|
134
|
-
return this.timeOnly ? `timeForComparison(${timePeriod}, '${this.timeUnit}')` : `dateForComparison(${timePeriod}, '${this.timeUnit}')`;
|
41
|
+
toPresentationString() {
|
42
|
+
return this.display;
|
43
|
+
}
|
44
|
+
toExpression() {
|
45
|
+
return this.value;
|
46
|
+
}
|
47
|
+
static from(obj) {
|
48
|
+
return new ConditionValue(obj.value, obj.display);
|
49
|
+
}
|
50
|
+
clone() {
|
51
|
+
return ConditionValue.from(this);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
export const dateDirections = {
|
55
|
+
FUTURE: 'in the future',
|
56
|
+
PAST: 'in the past'
|
57
|
+
};
|
58
|
+
export const dateUnits = {
|
59
|
+
YEARS: {
|
60
|
+
display: 'year(s)',
|
61
|
+
value: 'years'
|
62
|
+
},
|
63
|
+
MONTHS: {
|
64
|
+
display: 'month(s)',
|
65
|
+
value: 'months'
|
66
|
+
},
|
67
|
+
DAYS: {
|
68
|
+
display: 'day(s)',
|
69
|
+
value: 'days'
|
70
|
+
}
|
71
|
+
};
|
72
|
+
export const timeUnits = {
|
73
|
+
HOURS: {
|
74
|
+
display: 'hour(s)',
|
75
|
+
value: 'hours'
|
76
|
+
},
|
77
|
+
MINUTES: {
|
78
|
+
display: 'minute(s)',
|
79
|
+
value: 'minutes'
|
80
|
+
},
|
81
|
+
SECONDS: {
|
82
|
+
display: 'second(s)',
|
83
|
+
value: 'seconds'
|
84
|
+
}
|
85
|
+
};
|
86
|
+
export const dateTimeUnits = Object.assign({}, dateUnits, timeUnits);
|
87
|
+
export const relativeTimeValueType = registerValueType('RelativeTime', obj => RelativeTimeValue.from(obj));
|
88
|
+
export class RelativeTimeValue extends AbstractConditionValue {
|
89
|
+
constructor(timePeriod, timeUnit, direction, timeOnly = false) {
|
90
|
+
super(relativeTimeValueType);
|
91
|
+
_defineProperty(this, "timePeriod", void 0);
|
92
|
+
_defineProperty(this, "timeUnit", void 0);
|
93
|
+
_defineProperty(this, "direction", void 0);
|
94
|
+
_defineProperty(this, "timeOnly", void 0);
|
95
|
+
if (typeof timePeriod !== 'string') {
|
96
|
+
throw Error(`time period ${timePeriod} is not valid`);
|
135
97
|
}
|
136
|
-
|
137
|
-
|
98
|
+
if (!Object.values(dateTimeUnits).map(it => it.value).includes(timeUnit)) {
|
99
|
+
throw Error(`time unit ${timeUnit} is not valid`);
|
138
100
|
}
|
139
|
-
|
140
|
-
|
101
|
+
if (!Object.values(dateDirections).includes(direction)) {
|
102
|
+
throw Error(`direction ${direction} is not valid`);
|
141
103
|
}
|
104
|
+
this.timePeriod = timePeriod;
|
105
|
+
this.timeUnit = timeUnit;
|
106
|
+
this.direction = direction;
|
107
|
+
this.timeOnly = timeOnly;
|
142
108
|
}
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
* valueFrom is called
|
150
|
-
*/
|
151
|
-
_exports.RelativeTimeValue = RelativeTimeValue;
|
152
|
-
function registerValueType(type, factory) {
|
153
|
-
return new Registration(type, factory);
|
109
|
+
toPresentationString() {
|
110
|
+
return `${this.timePeriod} ${this.timeUnit} ${this.direction}`;
|
111
|
+
}
|
112
|
+
toExpression() {
|
113
|
+
const timePeriod = this.direction === dateDirections.PAST ? 0 - Number(this.timePeriod) : this.timePeriod;
|
114
|
+
return this.timeOnly ? `timeForComparison(${timePeriod}, '${this.timeUnit}')` : `dateForComparison(${timePeriod}, '${this.timeUnit}')`;
|
154
115
|
}
|
155
|
-
|
156
|
-
return
|
116
|
+
static from(obj) {
|
117
|
+
return new RelativeTimeValue(obj.timePeriod, obj.timeUnit, obj.direction, obj.timeOnly);
|
157
118
|
}
|
158
|
-
|
119
|
+
clone() {
|
120
|
+
return RelativeTimeValue.from(this);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* All value types should call this, and should be located in this file.
|
126
|
+
* Furthermore the types should be registered without the classes needing to be instantiated.
|
127
|
+
*
|
128
|
+
* Otherwise we can't guarantee they've been registered for deserialization before
|
129
|
+
* valueFrom is called
|
130
|
+
*/
|
131
|
+
function registerValueType(type, factory) {
|
132
|
+
return new Registration(type, factory);
|
133
|
+
}
|
134
|
+
export function valueFrom(obj) {
|
135
|
+
return conditionValueFactories[obj.type](obj);
|
136
|
+
}
|
159
137
|
//# sourceMappingURL=inline-condition-values.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"inline-condition-values.js","names":["conditionValueFactories","Registration","constructor","type","factory","_defineProperty","AbstractConditionValue","registration","new","target","TypeError","toPresentationString","toExpression","
|
1
|
+
{"version":3,"file":"inline-condition-values.js","names":["conditionValueFactories","Registration","constructor","type","factory","_defineProperty","AbstractConditionValue","registration","new","target","TypeError","toPresentationString","toExpression","valueType","registerValueType","obj","ConditionValue","from","value","display","Error","clone","dateDirections","FUTURE","PAST","dateUnits","YEARS","MONTHS","DAYS","timeUnits","HOURS","MINUTES","SECONDS","dateTimeUnits","Object","assign","relativeTimeValueType","RelativeTimeValue","timePeriod","timeUnit","direction","timeOnly","values","map","it","includes","Number","valueFrom"],"sources":["../../../src/conditions/inline-condition-values.ts"],"sourcesContent":["const conditionValueFactories = {}\n\nclass Registration {\n type\n\n constructor(type, factory) {\n conditionValueFactories[type] = factory\n this.type = type\n }\n}\n\nexport class AbstractConditionValue {\n type\n\n constructor(registration) {\n if (new.target === AbstractConditionValue) {\n throw new TypeError('Cannot construct ConditionValue instances directly')\n }\n if (!(registration instanceof Registration)) {\n throw new TypeError(\n 'You must register your value type! Call registerValueType!'\n )\n }\n this.type = registration.type\n }\n\n toPresentationString() {}\n toExpression() {}\n}\n\nconst valueType = registerValueType('Value', (obj) => ConditionValue.from(obj))\nexport class ConditionValue extends AbstractConditionValue {\n value\n display\n\n constructor(value, display) {\n super(valueType)\n if (!value || typeof value !== 'string') {\n throw Error(`value ${value} is not valid`)\n }\n if (display && typeof display !== 'string') {\n throw Error(`display ${display} is not valid`)\n }\n this.value = value\n this.display = display || value\n }\n\n toPresentationString() {\n return this.display\n }\n\n toExpression() {\n return this.value\n }\n\n static from(obj) {\n return new ConditionValue(obj.value, obj.display)\n }\n\n clone() {\n return ConditionValue.from(this)\n }\n}\n\nexport const dateDirections = {\n FUTURE: 'in the future',\n PAST: 'in the past'\n}\n\nexport const dateUnits = {\n YEARS: { display: 'year(s)', value: 'years' },\n MONTHS: { display: 'month(s)', value: 'months' },\n DAYS: { display: 'day(s)', value: 'days' }\n}\nexport const timeUnits = {\n HOURS: { display: 'hour(s)', value: 'hours' },\n MINUTES: { display: 'minute(s)', value: 'minutes' },\n SECONDS: { display: 'second(s)', value: 'seconds' }\n}\nexport const dateTimeUnits = Object.assign({}, dateUnits, timeUnits)\n\nexport const relativeTimeValueType = registerValueType('RelativeTime', (obj) =>\n RelativeTimeValue.from(obj)\n)\nexport class RelativeTimeValue extends AbstractConditionValue {\n timePeriod\n timeUnit\n direction\n timeOnly\n\n constructor(timePeriod, timeUnit, direction, timeOnly = false) {\n super(relativeTimeValueType)\n if (typeof timePeriod !== 'string') {\n throw Error(`time period ${timePeriod} is not valid`)\n }\n if (\n !Object.values(dateTimeUnits)\n .map((it) => it.value)\n .includes(timeUnit)\n ) {\n throw Error(`time unit ${timeUnit} is not valid`)\n }\n if (!Object.values(dateDirections).includes(direction)) {\n throw Error(`direction ${direction} is not valid`)\n }\n this.timePeriod = timePeriod\n this.timeUnit = timeUnit\n this.direction = direction\n this.timeOnly = timeOnly\n }\n\n toPresentationString() {\n return `${this.timePeriod} ${this.timeUnit} ${this.direction}`\n }\n\n toExpression() {\n const timePeriod =\n this.direction === dateDirections.PAST\n ? 0 - Number(this.timePeriod)\n : this.timePeriod\n return this.timeOnly\n ? `timeForComparison(${timePeriod}, '${this.timeUnit}')`\n : `dateForComparison(${timePeriod}, '${this.timeUnit}')`\n }\n\n static from(obj) {\n return new RelativeTimeValue(\n obj.timePeriod,\n obj.timeUnit,\n obj.direction,\n obj.timeOnly\n )\n }\n\n clone() {\n return RelativeTimeValue.from(this)\n }\n}\n\n/**\n * All value types should call this, and should be located in this file.\n * Furthermore the types should be registered without the classes needing to be instantiated.\n *\n * Otherwise we can't guarantee they've been registered for deserialization before\n * valueFrom is called\n */\nfunction registerValueType(type, factory) {\n return new Registration(type, factory)\n}\n\nexport function valueFrom(obj) {\n return conditionValueFactories[obj.type](obj)\n}\n"],"mappings":";;;AAAA,MAAMA,uBAAuB,GAAG,CAAC,CAAC;AAElC,MAAMC,YAAY,CAAC;EAGjBC,WAAWA,CAACC,IAAI,EAAEC,OAAO,EAAE;IAAAC,eAAA;IACzBL,uBAAuB,CAACG,IAAI,CAAC,GAAGC,OAAO;IACvC,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;AACF;AAEA,OAAO,MAAMG,sBAAsB,CAAC;EAGlCJ,WAAWA,CAACK,YAAY,EAAE;IAAAF,eAAA;IACxB,IAAIG,GAAG,CAACC,MAAM,KAAKH,sBAAsB,EAAE;MACzC,MAAM,IAAII,SAAS,CAAC,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EACxC,OAAO,IAAIH,YAAY,CAACE,IAAI,EAAEC,OAAO,CAAC;AACxC;AAEA,OAAO,SAAS2C,SAASA,CAAChC,GAAG,EAAE;EAC7B,OAAOf,uBAAuB,CAACe,GAAG,CAACZ,IAAI,CAAC,CAACY,GAAG,CAAC;AAC/C"}
|
@@ -1,16 +1,2 @@
|
|
1
|
-
|
2
|
-
if (typeof define === "function" && define.amd) {
|
3
|
-
define([], factory);
|
4
|
-
} else if (typeof exports !== "undefined") {
|
5
|
-
factory();
|
6
|
-
} else {
|
7
|
-
var mod = {
|
8
|
-
exports: {}
|
9
|
-
};
|
10
|
-
factory();
|
11
|
-
global.types = mod.exports;
|
12
|
-
}
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () {
|
14
|
-
"use strict";
|
15
|
-
});
|
1
|
+
export {};
|
16
2
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/conditions/types.ts"],"sourcesContent":["import { type Condition } from '~/src/conditions/condition'\nimport { type ConditionRef } from '~/src/conditions/condition-ref'\nimport { type ConditionGroup } from '~/src/conditions/condition-group'\n\nexport type ConditionsArray = (Condition | ConditionGroup | ConditionRef)[]\n\nexport type DateTimeUnitValues =\n | 'years'\n | 'months'\n | 'days'\n | 'hours'\n | 'minutes'\n | 'seconds'\n\nexport type DateUnits = {\n YEARS: { display: 'year(s)'; value: 'years' }\n MONTHS: { display: 'month(s)'; value: 'months' }\n DAYS: { display: 'day(s)'; value: 'days' }\n}\n\nexport type TimeUnits = {\n HOURS: { display: 'hour(s)'; value: 'hours' }\n MINUTES: { display: 'minute(s)'; value: 'minutes' }\n SECONDS: { display: 'second(s)'; value: 'seconds' }\n}\n"],"mappings":""}
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/conditions/types.ts"],"sourcesContent":["import { type Condition } from '~/src/conditions/condition.js'\nimport { type ConditionRef } from '~/src/conditions/condition-ref.js'\nimport { type ConditionGroup } from '~/src/conditions/condition-group.js'\n\nexport type ConditionsArray = (Condition | ConditionGroup | ConditionRef)[]\n\nexport type DateTimeUnitValues =\n | 'years'\n | 'months'\n | 'days'\n | 'hours'\n | 'minutes'\n | 'seconds'\n\nexport type DateUnits = {\n YEARS: { display: 'year(s)'; value: 'years' }\n MONTHS: { display: 'month(s)'; value: 'months' }\n DAYS: { display: 'day(s)'; value: 'days' }\n}\n\nexport type TimeUnits = {\n HOURS: { display: 'hour(s)'; value: 'hours' }\n MINUTES: { display: 'minute(s)'; value: 'minutes' }\n SECONDS: { display: 'second(s)'; value: 'seconds' }\n}\n"],"mappings":""}
|
@@ -1,49 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
4
|
+
import { ConditionsModel } from "../conditions/condition-model.js";
|
5
|
+
export class ConditionsWrapper {
|
6
|
+
constructor(rawData) {
|
7
|
+
_defineProperty(this, "name", void 0);
|
8
|
+
_defineProperty(this, "displayName", void 0);
|
9
|
+
_defineProperty(this, "value", void 0);
|
10
|
+
const {
|
11
|
+
name,
|
12
|
+
displayName,
|
13
|
+
value
|
14
|
+
} = rawData;
|
15
|
+
this.displayName = displayName || name;
|
16
|
+
this.value = value;
|
17
|
+
this.name = name;
|
12
18
|
}
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
19
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
20
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
21
|
-
class ConditionsWrapper {
|
22
|
-
constructor(rawData) {
|
23
|
-
_defineProperty(this, "name", void 0);
|
24
|
-
_defineProperty(this, "displayName", void 0);
|
25
|
-
_defineProperty(this, "value", void 0);
|
26
|
-
const {
|
27
|
-
name,
|
28
|
-
displayName,
|
29
|
-
value
|
30
|
-
} = rawData;
|
31
|
-
this.displayName = displayName || name;
|
32
|
-
this.value = value;
|
33
|
-
this.name = name;
|
34
|
-
}
|
35
|
-
get expression() {
|
36
|
-
if (typeof this.value === 'string') {
|
37
|
-
// Previously conditions were defined as strings, e.g: "section.age < 18"
|
38
|
-
// keep this so application can support legacy forms exports.
|
39
|
-
return this.value;
|
40
|
-
}
|
41
|
-
return _conditionModel.ConditionsModel.from(this.value).toExpression();
|
42
|
-
}
|
43
|
-
clone() {
|
44
|
-
return new ConditionsWrapper(this);
|
19
|
+
get expression() {
|
20
|
+
if (typeof this.value === 'string') {
|
21
|
+
// Previously conditions were defined as strings, e.g: "section.age < 18"
|
22
|
+
// keep this so application can support legacy forms exports.
|
23
|
+
return this.value;
|
45
24
|
}
|
25
|
+
return ConditionsModel.from(this.value).toExpression();
|
26
|
+
}
|
27
|
+
clone() {
|
28
|
+
return new ConditionsWrapper(this);
|
46
29
|
}
|
47
|
-
|
48
|
-
});
|
30
|
+
}
|
49
31
|
//# sourceMappingURL=conditions-wrapper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"conditions-wrapper.js","names":["ConditionsWrapper","constructor","rawData","_defineProperty","name","displayName","value","expression","
|
1
|
+
{"version":3,"file":"conditions-wrapper.js","names":["ConditionsModel","ConditionsWrapper","constructor","rawData","_defineProperty","name","displayName","value","expression","from","toExpression","clone"],"sources":["../../../src/data-model/conditions-wrapper.ts"],"sourcesContent":["import { ConditionsModel } from '~/src/conditions/condition-model.js'\nimport {\n type ConditionRawData,\n type ConditionWrapperValue\n} from '~/src/data-model/types.js'\n\nexport class ConditionsWrapper {\n name: string\n displayName: string\n value: ConditionWrapperValue\n\n constructor(rawData: ConditionRawData) {\n const { name, displayName, value } = rawData\n this.displayName = displayName || name\n this.value = value\n this.name = name\n }\n\n get expression() {\n if (typeof this.value === 'string') {\n // Previously conditions were defined as strings, e.g: \"section.age < 18\"\n // keep this so application can support legacy forms exports.\n return this.value\n }\n\n return ConditionsModel.from(this.value).toExpression()\n }\n\n clone(): ConditionsWrapper {\n return new ConditionsWrapper(this)\n }\n}\n"],"mappings":";;;AAAA,SAASA,eAAe;AAMxB,OAAO,MAAMC,iBAAiB,CAAC;EAK7BC,WAAWA,CAACC,OAAyB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACrC,MAAM;MAAEC,IAAI;MAAEC,WAAW;MAAEC;IAAM,CAAC,GAAGJ,OAAO;IAC5C,IAAI,CAACG,WAAW,GAAGA,WAAW,IAAID,IAAI;IACtC,IAAI,CAACE,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACF,IAAI,GAAGA,IAAI;EAClB;EAEA,IAAIG,UAAUA,CAAA,EAAG;IACf,IAAI,OAAO,IAAI,CAACD,KAAK,KAAK,QAAQ,EAAE;MAClC;MACA;MACA,OAAO,IAAI,CAACA,KAAK;IACnB;IAEA,OAAOP,eAAe,CAACS,IAAI,CAAC,IAAI,CAACF,KAAK,CAAC,CAACG,YAAY,CAAC,CAAC;EACxD;EAEAC,KAAKA,CAAA,EAAsB;IACzB,OAAO,IAAIV,iBAAiB,CAAC,IAAI,CAAC;EACpC;AACF"}
|
@@ -1,25 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
var mod = {
|
8
|
-
exports: {}
|
9
|
-
};
|
10
|
-
factory(mod.exports);
|
11
|
-
global.enums = mod.exports;
|
12
|
-
}
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
-
"use strict";
|
15
|
-
|
16
|
-
_exports.__esModule = true;
|
17
|
-
_exports.OutputType = void 0;
|
18
|
-
let OutputType = _exports.OutputType = /*#__PURE__*/function (OutputType) {
|
19
|
-
OutputType["Email"] = "email";
|
20
|
-
OutputType["Notify"] = "notify";
|
21
|
-
OutputType["Webhook"] = "webhook";
|
22
|
-
return OutputType;
|
23
|
-
}({});
|
24
|
-
});
|
1
|
+
export let OutputType = /*#__PURE__*/function (OutputType) {
|
2
|
+
OutputType["Email"] = "email";
|
3
|
+
OutputType["Notify"] = "notify";
|
4
|
+
OutputType["Webhook"] = "webhook";
|
5
|
+
return OutputType;
|
6
|
+
}({});
|
25
7
|
//# sourceMappingURL=enums.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"enums.js","names":["OutputType"
|
1
|
+
{"version":3,"file":"enums.js","names":["OutputType"],"sources":["../../../src/data-model/enums.ts"],"sourcesContent":["export enum OutputType {\n Email = 'email',\n Notify = 'notify',\n Webhook = 'webhook'\n}\n"],"mappings":"AAAA,WAAYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA"}
|
@@ -1,36 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
} else if (typeof exports !== "undefined") {
|
5
|
-
factory(exports, require("./input-wrapper"), require("./conditions-wrapper"), require("./enums"));
|
6
|
-
} else {
|
7
|
-
var mod = {
|
8
|
-
exports: {}
|
9
|
-
};
|
10
|
-
factory(mod.exports, global.inputWrapper, global.conditionsWrapper, global.enums);
|
11
|
-
global.index = mod.exports;
|
12
|
-
}
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _inputWrapper, _conditionsWrapper, _enums) {
|
14
|
-
"use strict";
|
15
|
-
|
16
|
-
_exports.__esModule = true;
|
17
|
-
Object.defineProperty(_exports, "ConditionsWrapper", {
|
18
|
-
enumerable: true,
|
19
|
-
get: function () {
|
20
|
-
return _conditionsWrapper.ConditionsWrapper;
|
21
|
-
}
|
22
|
-
});
|
23
|
-
Object.defineProperty(_exports, "InputWrapper", {
|
24
|
-
enumerable: true,
|
25
|
-
get: function () {
|
26
|
-
return _inputWrapper.InputWrapper;
|
27
|
-
}
|
28
|
-
});
|
29
|
-
Object.defineProperty(_exports, "OutputType", {
|
30
|
-
enumerable: true,
|
31
|
-
get: function () {
|
32
|
-
return _enums.OutputType;
|
33
|
-
}
|
34
|
-
});
|
35
|
-
});
|
1
|
+
export { InputWrapper } from "./input-wrapper.js";
|
2
|
+
export { ConditionsWrapper } from "./conditions-wrapper.js";
|
3
|
+
export { OutputType } from "./enums.js";
|
36
4
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/data-model/index.ts"],"sourcesContent":["export { InputWrapper } from '~/src/data-model/input-wrapper'\nexport { ConditionsWrapper } from '~/src/data-model/conditions-wrapper'\nexport { OutputType } from '~/src/data-model/enums'\n"],"mappings":""}
|
1
|
+
{"version":3,"file":"index.js","names":["InputWrapper","ConditionsWrapper","OutputType"],"sources":["../../../src/data-model/index.ts"],"sourcesContent":["export { InputWrapper } from '~/src/data-model/input-wrapper.js'\nexport { ConditionsWrapper } from '~/src/data-model/conditions-wrapper.js'\nexport { OutputType } from '~/src/data-model/enums.js'\n"],"mappings":"AAAA,SAASA,YAAY;AACrB,SAASC,iBAAiB;AAC1B,SAASC,UAAU"}
|
@@ -1,49 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
2
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
6
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
7
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
8
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
9
|
+
import { clone } from "../utils/helpers.js";
|
10
|
+
var _parentItemName = /*#__PURE__*/new WeakMap();
|
11
|
+
export class InputWrapper {
|
12
|
+
constructor(rawData, page, options) {
|
13
|
+
_defineProperty(this, "name", undefined);
|
14
|
+
_defineProperty(this, "title", undefined);
|
15
|
+
_defineProperty(this, "type", undefined);
|
16
|
+
_defineProperty(this, "propertyPath", void 0);
|
17
|
+
_classPrivateFieldInitSpec(this, _parentItemName, void 0);
|
18
|
+
_defineProperty(this, "page", void 0);
|
19
|
+
Object.assign(this, rawData);
|
20
|
+
const myPage = clone(page);
|
21
|
+
delete myPage.components;
|
22
|
+
this.page = myPage;
|
23
|
+
this.propertyPath = !options.ignoreSection && page.section ? `${page.section}.${this.name}` : this.name;
|
24
|
+
_classPrivateFieldSet(_parentItemName, this, options.parentItemName);
|
12
25
|
}
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
_exports.__esModule = true;
|
17
|
-
_exports.InputWrapper = void 0;
|
18
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
19
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
20
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
21
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
22
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
23
|
-
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
24
|
-
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
25
|
-
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
26
|
-
var _parentItemName = /*#__PURE__*/new WeakMap();
|
27
|
-
class InputWrapper {
|
28
|
-
constructor(rawData, page, options) {
|
29
|
-
_defineProperty(this, "name", undefined);
|
30
|
-
_defineProperty(this, "title", undefined);
|
31
|
-
_defineProperty(this, "type", undefined);
|
32
|
-
_defineProperty(this, "propertyPath", void 0);
|
33
|
-
_classPrivateFieldInitSpec(this, _parentItemName, void 0);
|
34
|
-
_defineProperty(this, "page", void 0);
|
35
|
-
Object.assign(this, rawData);
|
36
|
-
const myPage = (0, _helpers.clone)(page);
|
37
|
-
delete myPage.components;
|
38
|
-
this.page = myPage;
|
39
|
-
this.propertyPath = !options.ignoreSection && page.section ? `${page.section}.${this.name}` : this.name;
|
40
|
-
_classPrivateFieldSet(_parentItemName, this, options.parentItemName);
|
41
|
-
}
|
42
|
-
get displayName() {
|
43
|
-
const titleWithContext = _classPrivateFieldGet(_parentItemName, this) ? `${this.title} under ${_classPrivateFieldGet(_parentItemName, this)}` : this.title;
|
44
|
-
return this.page.section ? `${titleWithContext} in ${this.page.section}` : titleWithContext;
|
45
|
-
}
|
26
|
+
get displayName() {
|
27
|
+
const titleWithContext = _classPrivateFieldGet(_parentItemName, this) ? `${this.title} under ${_classPrivateFieldGet(_parentItemName, this)}` : this.title;
|
28
|
+
return this.page.section ? `${titleWithContext} in ${this.page.section}` : titleWithContext;
|
46
29
|
}
|
47
|
-
|
48
|
-
});
|
30
|
+
}
|
49
31
|
//# sourceMappingURL=input-wrapper.js.map
|