@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.
Files changed (237) hide show
  1. package/dist/browser/components/component-types.js +201 -219
  2. package/dist/browser/components/component-types.js.map +1 -1
  3. package/dist/browser/components/conditional-component-types.js +9 -27
  4. package/dist/browser/components/conditional-component-types.js.map +1 -1
  5. package/dist/browser/components/enums.js +27 -45
  6. package/dist/browser/components/enums.js.map +1 -1
  7. package/dist/browser/components/index.js +3 -35
  8. package/dist/browser/components/index.js.map +1 -1
  9. package/dist/browser/components/types.js +1 -15
  10. package/dist/browser/conditions/condition-abstract.js +42 -60
  11. package/dist/browser/conditions/condition-abstract.js.map +1 -1
  12. package/dist/browser/conditions/condition-field.js +23 -41
  13. package/dist/browser/conditions/condition-field.js.map +1 -1
  14. package/dist/browser/conditions/condition-group-def.js +23 -42
  15. package/dist/browser/conditions/condition-group-def.js.map +1 -1
  16. package/dist/browser/conditions/condition-group.js +43 -61
  17. package/dist/browser/conditions/condition-group.js.map +1 -1
  18. package/dist/browser/conditions/condition-model.js +185 -196
  19. package/dist/browser/conditions/condition-model.js.map +1 -1
  20. package/dist/browser/conditions/condition-operators.js +103 -124
  21. package/dist/browser/conditions/condition-operators.js.map +1 -1
  22. package/dist/browser/conditions/condition-ref.js +29 -47
  23. package/dist/browser/conditions/condition-ref.js.map +1 -1
  24. package/dist/browser/conditions/condition-value-abstract.js +19 -37
  25. package/dist/browser/conditions/condition-value-abstract.js.map +1 -1
  26. package/dist/browser/conditions/condition-value-registration.js +15 -34
  27. package/dist/browser/conditions/condition-value-registration.js.map +1 -1
  28. package/dist/browser/conditions/condition-values.js +98 -118
  29. package/dist/browser/conditions/condition-values.js.map +1 -1
  30. package/dist/browser/conditions/condition.js +36 -51
  31. package/dist/browser/conditions/condition.js.map +1 -1
  32. package/dist/browser/conditions/enums.js +5 -23
  33. package/dist/browser/conditions/enums.js.map +1 -1
  34. package/dist/browser/conditions/helpers.js +6 -25
  35. package/dist/browser/conditions/helpers.js.map +1 -1
  36. package/dist/browser/conditions/index.js +10 -143
  37. package/dist/browser/conditions/index.js.map +1 -1
  38. package/dist/browser/conditions/inline-condition-model.js +372 -394
  39. package/dist/browser/conditions/inline-condition-model.js.map +1 -1
  40. package/dist/browser/conditions/inline-condition-operators.js +103 -124
  41. package/dist/browser/conditions/inline-condition-operators.js.map +1 -1
  42. package/dist/browser/conditions/inline-condition-values.js +123 -145
  43. package/dist/browser/conditions/inline-condition-values.js.map +1 -1
  44. package/dist/browser/conditions/types.js +1 -15
  45. package/dist/browser/conditions/types.js.map +1 -1
  46. package/dist/browser/data-model/conditions-wrapper.js +27 -45
  47. package/dist/browser/data-model/conditions-wrapper.js.map +1 -1
  48. package/dist/browser/data-model/enums.js +6 -24
  49. package/dist/browser/data-model/enums.js.map +1 -1
  50. package/dist/browser/data-model/index.js +3 -35
  51. package/dist/browser/data-model/index.js.map +1 -1
  52. package/dist/browser/data-model/input-wrapper.js +28 -46
  53. package/dist/browser/data-model/input-wrapper.js.map +1 -1
  54. package/dist/browser/data-model/types.js +7 -25
  55. package/dist/browser/data-model/types.js.map +1 -1
  56. package/dist/browser/form/form-configuration.js +16 -35
  57. package/dist/browser/form/form-configuration.js.map +1 -1
  58. package/dist/browser/form/index.js +1 -23
  59. package/dist/browser/form/index.js.map +1 -1
  60. package/dist/browser/index.js +8 -97
  61. package/dist/browser/index.js.map +1 -1
  62. package/dist/browser/migration/index.js +1 -23
  63. package/dist/browser/migration/index.js.map +1 -1
  64. package/dist/browser/migration/migration.0-2.js +42 -60
  65. package/dist/browser/migration/migration.0-2.js.map +1 -1
  66. package/dist/browser/migration/migration.1-2.js +83 -99
  67. package/dist/browser/migration/migration.1-2.js.map +1 -1
  68. package/dist/browser/migration/types.js +1 -15
  69. package/dist/browser/migration/whichMigrations.js +20 -36
  70. package/dist/browser/migration/whichMigrations.js.map +1 -1
  71. package/dist/browser/schema/index.js +1 -29
  72. package/dist/browser/schema/index.js.map +1 -1
  73. package/dist/browser/schema/schema.js +231 -249
  74. package/dist/browser/schema/schema.js.map +1 -1
  75. package/dist/browser/utils/helpers.js +22 -43
  76. package/dist/browser/utils/helpers.js.map +1 -1
  77. package/dist/browser/utils/logger.js +24 -43
  78. package/dist/browser/utils/logger.js.map +1 -1
  79. package/dist/module/components/component-types.js +1 -5
  80. package/dist/module/components/component-types.js.map +1 -1
  81. package/dist/module/components/conditional-component-types.js +1 -5
  82. package/dist/module/components/conditional-component-types.js.map +1 -1
  83. package/dist/module/components/enums.js +1 -5
  84. package/dist/module/components/enums.js.map +1 -1
  85. package/dist/module/components/index.js +3 -24
  86. package/dist/module/components/index.js.map +1 -1
  87. package/dist/module/components/types.js +2 -1
  88. package/dist/module/conditions/condition-abstract.js +3 -8
  89. package/dist/module/conditions/condition-abstract.js.map +1 -1
  90. package/dist/module/conditions/condition-field.js +3 -8
  91. package/dist/module/conditions/condition-field.js.map +1 -1
  92. package/dist/module/conditions/condition-group-def.js +1 -6
  93. package/dist/module/conditions/condition-group-def.js.map +1 -1
  94. package/dist/module/conditions/condition-group.js +4 -9
  95. package/dist/module/conditions/condition-group.js.map +1 -1
  96. package/dist/module/conditions/condition-model.js +20 -25
  97. package/dist/module/conditions/condition-model.js.map +1 -1
  98. package/dist/module/conditions/condition-operators.js +15 -23
  99. package/dist/module/conditions/condition-operators.js.map +1 -1
  100. package/dist/module/conditions/condition-ref.js +2 -7
  101. package/dist/module/conditions/condition-ref.js.map +1 -1
  102. package/dist/module/conditions/condition-value-abstract.js +3 -8
  103. package/dist/module/conditions/condition-value-abstract.js.map +1 -1
  104. package/dist/module/conditions/condition-value-registration.js +1 -6
  105. package/dist/module/conditions/condition-value-registration.js.map +1 -1
  106. package/dist/module/conditions/condition-values.js +12 -20
  107. package/dist/module/conditions/condition-values.js.map +1 -1
  108. package/dist/module/conditions/condition.js +9 -14
  109. package/dist/module/conditions/condition.js.map +1 -1
  110. package/dist/module/conditions/enums.js +1 -5
  111. package/dist/module/conditions/enums.js.map +1 -1
  112. package/dist/module/conditions/helpers.js +2 -7
  113. package/dist/module/conditions/helpers.js.map +1 -1
  114. package/dist/module/conditions/index.js +10 -139
  115. package/dist/module/conditions/index.js.map +1 -1
  116. package/dist/module/conditions/inline-condition-model.js +15 -26
  117. package/dist/module/conditions/inline-condition-model.js.map +1 -1
  118. package/dist/module/conditions/inline-condition-operators.js +15 -23
  119. package/dist/module/conditions/inline-condition-operators.js.map +1 -1
  120. package/dist/module/conditions/inline-condition-values.js +9 -17
  121. package/dist/module/conditions/inline-condition-values.js.map +1 -1
  122. package/dist/module/conditions/types.js +2 -1
  123. package/dist/module/conditions/types.js.map +1 -1
  124. package/dist/module/data-model/conditions-wrapper.js +3 -8
  125. package/dist/module/data-model/conditions-wrapper.js.map +1 -1
  126. package/dist/module/data-model/enums.js +1 -5
  127. package/dist/module/data-model/enums.js.map +1 -1
  128. package/dist/module/data-model/index.js +3 -24
  129. package/dist/module/data-model/index.js.map +1 -1
  130. package/dist/module/data-model/input-wrapper.js +3 -8
  131. package/dist/module/data-model/input-wrapper.js.map +1 -1
  132. package/dist/module/data-model/types.js +1 -5
  133. package/dist/module/data-model/types.js.map +1 -1
  134. package/dist/module/form/form-configuration.js +1 -6
  135. package/dist/module/form/form-configuration.js.map +1 -1
  136. package/dist/module/form/index.js +1 -10
  137. package/dist/module/form/index.js.map +1 -1
  138. package/dist/module/index.js +8 -91
  139. package/dist/module/index.js.map +1 -1
  140. package/dist/module/migration/index.js +1 -10
  141. package/dist/module/migration/index.js.map +1 -1
  142. package/dist/module/migration/migration.0-2.js +1 -5
  143. package/dist/module/migration/migration.0-2.js.map +1 -1
  144. package/dist/module/migration/migration.1-2.js +3 -6
  145. package/dist/module/migration/migration.1-2.js.map +1 -1
  146. package/dist/module/migration/types.js +2 -1
  147. package/dist/module/migration/whichMigrations.js +5 -9
  148. package/dist/module/migration/whichMigrations.js.map +1 -1
  149. package/dist/module/schema/index.js +1 -16
  150. package/dist/module/schema/index.js.map +1 -1
  151. package/dist/module/schema/schema.js +163 -167
  152. package/dist/module/schema/schema.js.map +1 -1
  153. package/dist/module/utils/helpers.js +5 -13
  154. package/dist/module/utils/helpers.js.map +1 -1
  155. package/dist/module/utils/logger.js +1 -6
  156. package/dist/module/utils/logger.js.map +1 -1
  157. package/dist/types/components/component-types.d.ts +1 -1
  158. package/dist/types/components/component-types.d.ts.map +1 -1
  159. package/dist/types/components/conditional-component-types.d.ts +1 -1
  160. package/dist/types/components/conditional-component-types.d.ts.map +1 -1
  161. package/dist/types/components/index.d.ts +3 -3
  162. package/dist/types/components/index.d.ts.map +1 -1
  163. package/dist/types/conditions/condition-abstract.d.ts +1 -1
  164. package/dist/types/conditions/condition-abstract.d.ts.map +1 -1
  165. package/dist/types/conditions/condition-field.d.ts +1 -1
  166. package/dist/types/conditions/condition-field.d.ts.map +1 -1
  167. package/dist/types/conditions/condition-group-def.d.ts +2 -2
  168. package/dist/types/conditions/condition-group-def.d.ts.map +1 -1
  169. package/dist/types/conditions/condition-group.d.ts +2 -2
  170. package/dist/types/conditions/condition-group.d.ts.map +1 -1
  171. package/dist/types/conditions/condition-model.d.ts +5 -5
  172. package/dist/types/conditions/condition-model.d.ts.map +1 -1
  173. package/dist/types/conditions/condition-operators.d.ts +2 -2
  174. package/dist/types/conditions/condition-operators.d.ts.map +1 -1
  175. package/dist/types/conditions/condition-ref.d.ts +2 -2
  176. package/dist/types/conditions/condition-ref.d.ts.map +1 -1
  177. package/dist/types/conditions/condition-value-abstract.d.ts +1 -1
  178. package/dist/types/conditions/condition-value-abstract.d.ts.map +1 -1
  179. package/dist/types/conditions/condition-values.d.ts +3 -3
  180. package/dist/types/conditions/condition-values.d.ts.map +1 -1
  181. package/dist/types/conditions/condition.d.ts +4 -4
  182. package/dist/types/conditions/condition.d.ts.map +1 -1
  183. package/dist/types/conditions/index.d.ts +10 -10
  184. package/dist/types/conditions/index.d.ts.map +1 -1
  185. package/dist/types/conditions/types.d.ts +3 -3
  186. package/dist/types/conditions/types.d.ts.map +1 -1
  187. package/dist/types/data-model/conditions-wrapper.d.ts +1 -1
  188. package/dist/types/data-model/conditions-wrapper.d.ts.map +1 -1
  189. package/dist/types/data-model/index.d.ts +3 -3
  190. package/dist/types/data-model/index.d.ts.map +1 -1
  191. package/dist/types/data-model/input-wrapper.d.ts +2 -2
  192. package/dist/types/data-model/input-wrapper.d.ts.map +1 -1
  193. package/dist/types/data-model/types.d.ts +3 -3
  194. package/dist/types/data-model/types.d.ts.map +1 -1
  195. package/dist/types/form/index.d.ts +1 -1
  196. package/dist/types/form/index.d.ts.map +1 -1
  197. package/dist/types/index.d.ts +11 -11
  198. package/dist/types/index.d.ts.map +1 -1
  199. package/dist/types/migration/index.d.ts +1 -1
  200. package/dist/types/migration/index.d.ts.map +1 -1
  201. package/dist/types/migration/migration.0-2.d.ts +1 -1
  202. package/dist/types/migration/migration.0-2.d.ts.map +1 -1
  203. package/dist/types/migration/migration.1-2.d.ts +1 -1
  204. package/dist/types/migration/migration.1-2.d.ts.map +1 -1
  205. package/dist/types/migration/whichMigrations.d.ts +1 -1
  206. package/dist/types/migration/whichMigrations.d.ts.map +1 -1
  207. package/dist/types/schema/index.d.ts +1 -1
  208. package/dist/types/schema/index.d.ts.map +1 -1
  209. package/package.json +4 -3
  210. package/src/components/component-types.ts +1 -1
  211. package/src/components/conditional-component-types.ts +1 -1
  212. package/src/components/index.ts +3 -3
  213. package/src/conditions/condition-abstract.ts +1 -1
  214. package/src/conditions/condition-field.ts +2 -2
  215. package/src/conditions/condition-group-def.ts +1 -1
  216. package/src/conditions/condition-group.ts +3 -3
  217. package/src/conditions/condition-model.ts +9 -9
  218. package/src/conditions/condition-operators.ts +6 -3
  219. package/src/conditions/condition-ref.ts +2 -2
  220. package/src/conditions/condition-value-abstract.ts +1 -1
  221. package/src/conditions/condition-values.ts +3 -3
  222. package/src/conditions/condition.ts +6 -6
  223. package/src/conditions/index.ts +10 -10
  224. package/src/conditions/inline-condition-model.ts +3 -3
  225. package/src/conditions/inline-condition-operators.ts +1 -1
  226. package/src/conditions/types.ts +3 -3
  227. package/src/data-model/conditions-wrapper.ts +2 -2
  228. package/src/data-model/index.ts +3 -3
  229. package/src/data-model/input-wrapper.ts +3 -3
  230. package/src/data-model/types.ts +3 -3
  231. package/src/form/index.ts +1 -1
  232. package/src/index.ts +11 -11
  233. package/src/migration/index.ts +1 -1
  234. package/src/migration/migration.0-2.ts +1 -1
  235. package/src/migration/migration.1-2.ts +2 -2
  236. package/src/migration/whichMigrations.ts +3 -3
  237. package/src/schema/index.ts +1 -1
@@ -1,159 +1,137 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports);
6
- } else {
7
- var mod = {
8
- exports: {}
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
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
14
- "use strict";
15
-
16
- _exports.__esModule = true;
17
- _exports.timeUnits = _exports.relativeTimeValueType = _exports.dateUnits = _exports.dateTimeUnits = _exports.dateDirections = _exports.RelativeTimeValue = _exports.ConditionValue = _exports.AbstractConditionValue = void 0;
18
- _exports.valueFrom = valueFrom;
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
- class AbstractConditionValue {
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
- toPresentationString() {}
42
- toExpression() {}
21
+ this.type = registration.type;
43
22
  }
44
- _exports.AbstractConditionValue = AbstractConditionValue;
45
- const valueType = registerValueType('Value', obj => ConditionValue.from(obj));
46
- class ConditionValue extends AbstractConditionValue {
47
- constructor(value, display) {
48
- super(valueType);
49
- _defineProperty(this, "value", void 0);
50
- _defineProperty(this, "display", void 0);
51
- if (!value || typeof value !== 'string') {
52
- throw Error(`value ${value} is not valid`);
53
- }
54
- if (display && typeof display !== 'string') {
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
- clone() {
70
- return ConditionValue.from(this);
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
- _exports.ConditionValue = ConditionValue;
74
- const dateDirections = _exports.dateDirections = {
75
- FUTURE: 'in the future',
76
- PAST: 'in the past'
77
- };
78
- const dateUnits = _exports.dateUnits = {
79
- YEARS: {
80
- display: 'year(s)',
81
- value: 'years'
82
- },
83
- MONTHS: {
84
- display: 'month(s)',
85
- value: 'months'
86
- },
87
- DAYS: {
88
- display: 'day(s)',
89
- value: 'days'
90
- }
91
- };
92
- const timeUnits = _exports.timeUnits = {
93
- HOURS: {
94
- display: 'hour(s)',
95
- value: 'hours'
96
- },
97
- MINUTES: {
98
- display: 'minute(s)',
99
- value: 'minutes'
100
- },
101
- SECONDS: {
102
- display: 'second(s)',
103
- value: 'seconds'
104
- }
105
- };
106
- const dateTimeUnits = _exports.dateTimeUnits = Object.assign({}, dateUnits, timeUnits);
107
- const relativeTimeValueType = _exports.relativeTimeValueType = registerValueType('RelativeTime', obj => RelativeTimeValue.from(obj));
108
- class RelativeTimeValue extends AbstractConditionValue {
109
- constructor(timePeriod, timeUnit, direction, timeOnly = false) {
110
- super(relativeTimeValueType);
111
- _defineProperty(this, "timePeriod", void 0);
112
- _defineProperty(this, "timeUnit", void 0);
113
- _defineProperty(this, "direction", void 0);
114
- _defineProperty(this, "timeOnly", void 0);
115
- if (typeof timePeriod !== 'string') {
116
- throw Error(`time period ${timePeriod} is not valid`);
117
- }
118
- if (!Object.values(dateTimeUnits).map(it => it.value).includes(timeUnit)) {
119
- throw Error(`time unit ${timeUnit} is not valid`);
120
- }
121
- if (!Object.values(dateDirections).includes(direction)) {
122
- throw Error(`direction ${direction} is not valid`);
123
- }
124
- this.timePeriod = timePeriod;
125
- this.timeUnit = timeUnit;
126
- this.direction = direction;
127
- this.timeOnly = timeOnly;
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
- static from(obj) {
137
- return new RelativeTimeValue(obj.timePeriod, obj.timeUnit, obj.direction, obj.timeOnly);
98
+ if (!Object.values(dateTimeUnits).map(it => it.value).includes(timeUnit)) {
99
+ throw Error(`time unit ${timeUnit} is not valid`);
138
100
  }
139
- clone() {
140
- return RelativeTimeValue.from(this);
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
- * All value types should call this, and should be located in this file.
146
- * Furthermore the types should be registered without the classes needing to be instantiated.
147
- *
148
- * Otherwise we can't guarantee they've been registered for deserialization before
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
- function valueFrom(obj) {
156
- return conditionValueFactories[obj.type](obj);
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","_exports","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":";;;;;;;;;;;;;;;;;;;;;EAAA,MAAMA,uBAAuB,GAAG,CAAC,CAAC;EAElC,MAAMC,YAAY,CAAC;IAGjBC,WAAWA,CAACC,IAAI,EAAEC,OAAO,EAAE;MAAAC,eAAA;MACzBL,uBAAuB,CAACG,IAAI,CAAC,GAAGC,OAAO;MACvC,IAAI,CAACD,IAAI,GAAGA,IAAI;IAClB;EACF;EAEO,MAAMG,sBAAsB,CAAC;IAGlCJ,WAAWA,CAACK,YAAY,EAAE;MAAAF,eAAA;MACxB,IAAIG,GAAG,CAACC,MAAM,KAAKH,sBAAsB,EAAE;QACzC,MAAM,IAAII,SAAS,CAAC,oDAAoD,CAAC;MAC3E;MACA,IAAI,EAAEH,YAAY,YAAYN,YAAY,CAAC,EAAE;QAC3C,MAAM,IAAIS,SAAS,CACjB,4DACF,CAAC;MACH;MACA,IAAI,CAACP,IAAI,GAAGI,YAAY,CAACJ,IAAI;IAC/B;IAEAQ,oBAAoBA,CAAA,EAAG,CAAC;IACxBC,YAAYA,CAAA,EAAG,CAAC;EAClB;EAACC,QAAA,CAAAP,sBAAA,GAAAA,sBAAA;EAED,MAAMQ,SAAS,GAAGC,iBAAiB,CAAC,OAAO,EAAGC,GAAG,IAAKC,cAAc,CAACC,IAAI,CAACF,GAAG,CAAC,CAAC;EACxE,MAAMC,cAAc,SAASX,sBAAsB,CAAC;IAIzDJ,WAAWA,CAACiB,KAAK,EAAEC,OAAO,EAAE;MAC1B,KAAK,CAACN,SAAS,CAAC;MAAAT,eAAA;MAAAA,eAAA;MAChB,IAAI,CAACc,KAAK,IAAI,OAAOA,KAAK,KAAK,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B,oBAAoBA,CAAA,EAAG;MACrB,OAAQ,GAAE,IAAI,CAAC4B,UAAW,IAAG,IAAI,CAACC,QAAS,IAAG,IAAI,CAACC,SAAU,EAAC;IAChE;IAEA7B,YAAYA,CAAA,EAAG;MACb,MAAM2B,UAAU,GACd,IAAI,CAACE,SAAS,KAAKlB,cAAc,CAACE,IAAI,GAClC,CAAC,GAAGsB,MAAM,CAAC,IAAI,CAACR,UAAU,CAAC,GAC3B,IAAI,CAACA,UAAU;MACrB,OAAO,IAAI,CAACG,QAAQ,GACf,qBAAoBH,UAAW,MAAK,IAAI,CAACC,QAAS,IAAG,GACrD,qBAAoBD,UAAW,MAAK,IAAI,CAACC,QAAS,IAAG;IAC5D;IAEA,OAAOtB,IAAIA,CAACF,GAAG,EAAE;MACf,OAAO,IAAIsB,iBAAiB,CAC1BtB,GAAG,CAACuB,UAAU,EACdvB,GAAG,CAACwB,QAAQ,EACZxB,GAAG,CAACyB,SAAS,EACbzB,GAAG,CAAC0B,QACN,CAAC;IACH;IAEApB,KAAKA,CAAA,EAAG;MACN,OAAOgB,iBAAiB,CAACpB,IAAI,CAAC,IAAI,CAAC;IACrC;EACF;;EAEA;AACA;AACA;AACA;AACA;AACA;AACA;EANAL,QAAA,CAAAyB,iBAAA,GAAAA,iBAAA;EAOA,SAASvB,iBAAiBA,CAACZ,IAAI,EAAEC,OAAO,EAAE;IACxC,OAAO,IAAIH,YAAY,CAACE,IAAI,EAAEC,OAAO,CAAC;EACxC;EAEO,SAAS4C,SAASA,CAAChC,GAAG,EAAE;IAC7B,OAAOhB,uBAAuB,CAACgB,GAAG,CAACb,IAAI,CAAC,CAACa,GAAG,CAAC;EAC/C;AAAC"}
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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A;AACA;AACA,SAASH,iBAAiBA,CAACX,IAAI,EAAEC,OAAO,EAAE;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
- (function (global, factory) {
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
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "../conditions/condition-model"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("../conditions/condition-model"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.conditionModel);
11
- global.conditionsWrapper = 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
+ 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
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _conditionModel) {
14
- "use strict";
15
-
16
- _exports.__esModule = true;
17
- _exports.ConditionsWrapper = void 0;
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
- _exports.ConditionsWrapper = ConditionsWrapper;
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","ConditionsModel","from","toExpression","clone","_exports"],"sources":["../../../src/data-model/conditions-wrapper.ts"],"sourcesContent":["import { ConditionsModel } from '~/src/conditions/condition-model'\nimport {\n type ConditionRawData,\n type ConditionWrapperValue\n} from '~/src/data-model/types'\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":";;;;;;;;;;;;;;;;;;;;EAMO,MAAMA,iBAAiB,CAAC;IAK7BC,WAAWA,CAACC,OAAyB,EAAE;MAAAC,eAAA;MAAAA,eAAA;MAAAA,eAAA;MACrC,MAAM;QAAEC,IAAI;QAAEC,WAAW;QAAEC;MAAM,CAAC,GAAGJ,OAAO;MAC5C,IAAI,CAACG,WAAW,GAAGA,WAAW,IAAID,IAAI;MACtC,IAAI,CAACE,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACF,IAAI,GAAGA,IAAI;IAClB;IAEA,IAAIG,UAAUA,CAAA,EAAG;MACf,IAAI,OAAO,IAAI,CAACD,KAAK,KAAK,QAAQ,EAAE;QAClC;QACA;QACA,OAAO,IAAI,CAACA,KAAK;MACnB;MAEA,OAAOE,+BAAe,CAACC,IAAI,CAAC,IAAI,CAACH,KAAK,CAAC,CAACI,YAAY,CAAC,CAAC;IACxD;IAEAC,KAAKA,CAAA,EAAsB;MACzB,OAAO,IAAIX,iBAAiB,CAAC,IAAI,CAAC;IACpC;EACF;EAACY,QAAA,CAAAZ,iBAAA,GAAAA,iBAAA;AAAA"}
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
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports);
6
- } else {
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","_exports"],"sources":["../../../src/data-model/enums.ts"],"sourcesContent":["export enum OutputType {\n Email = 'email',\n Notify = 'notify',\n Webhook = 'webhook'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;MAAYA,UAAU,GAAAC,QAAA,CAAAD,UAAA,0BAAVA,UAAU;IAAVA,UAAU;IAAVA,UAAU;IAAVA,UAAU;IAAA,OAAVA,UAAU;EAAA;AAAA"}
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
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "./input-wrapper", "./conditions-wrapper", "./enums"], factory);
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
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "../utils/helpers"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("../utils/helpers"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.helpers);
11
- global.inputWrapper = mod.exports;
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
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _helpers) {
14
- "use strict";
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
- _exports.InputWrapper = InputWrapper;
48
- });
30
+ }
49
31
  //# sourceMappingURL=input-wrapper.js.map