@aemforms/af-core 0.22.19 → 0.22.22

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 (124) hide show
  1. package/LICENSE +18 -4
  2. package/lib/cjs/index.cjs +7277 -0
  3. package/lib/{BaseNode.js → esm/BaseNode-dc59ab07.js} +108 -184
  4. package/lib/{BaseNode.d.ts → esm/BaseNode.d.ts} +10 -69
  5. package/lib/esm/BaseNode.js +26 -0
  6. package/lib/esm/Checkbox.d.ts +79 -0
  7. package/lib/esm/Checkbox.js +63 -0
  8. package/lib/{CheckboxGroup.d.ts → esm/CheckboxGroup.d.ts} +2 -14
  9. package/lib/esm/CheckboxGroup.js +60 -0
  10. package/lib/{Container.d.ts → esm/Container.d.ts} +12 -59
  11. package/lib/{Container.js → esm/Container.js} +81 -122
  12. package/lib/{DateField.d.ts → esm/DateField.d.ts} +1 -1
  13. package/lib/esm/DateField.js +57 -0
  14. package/lib/{Field.d.ts → esm/Field.d.ts} +41 -106
  15. package/lib/{Field.js → esm/Field.js} +186 -216
  16. package/lib/esm/Fieldset.d.ts +16 -0
  17. package/lib/esm/Fieldset.js +78 -0
  18. package/lib/{FileObject.d.ts → esm/FileObject.d.ts} +1 -4
  19. package/lib/esm/FileObject.js +48 -0
  20. package/lib/{FileUpload.d.ts → esm/FileUpload.d.ts} +3 -18
  21. package/lib/esm/FileUpload.js +141 -0
  22. package/lib/{Form.d.ts → esm/Form.d.ts} +20 -86
  23. package/lib/esm/Form.js +208 -0
  24. package/lib/esm/FormInstance.d.ts +13 -0
  25. package/lib/esm/FormInstance.js +129 -0
  26. package/lib/esm/FormMetaData.d.ts +7 -0
  27. package/lib/esm/FormMetaData.js +35 -0
  28. package/lib/esm/InstanceManager.d.ts +9 -0
  29. package/lib/esm/InstanceManager.js +58 -0
  30. package/lib/esm/Node.d.ts +7 -0
  31. package/lib/esm/Node.js +40 -0
  32. package/lib/esm/Scriptable.d.ts +17 -0
  33. package/lib/{Scriptable.js → esm/Scriptable.js} +38 -54
  34. package/lib/{controller → esm/controller}/EventQueue.d.ts +3 -11
  35. package/lib/{controller → esm/controller}/EventQueue.js +32 -26
  36. package/lib/esm/controller/Events.d.ts +85 -0
  37. package/lib/esm/controller/Events.js +171 -0
  38. package/lib/{controller → esm/controller}/Logger.d.ts +2 -8
  39. package/lib/esm/controller/Logger.js +52 -0
  40. package/lib/{data → esm/data}/DataGroup.d.ts +1 -7
  41. package/lib/{data → esm/data}/DataGroup.js +38 -34
  42. package/lib/{data → esm/data}/DataValue.d.ts +1 -7
  43. package/lib/esm/data/DataValue.js +68 -0
  44. package/lib/{data → esm/data}/EmptyDataValue.d.ts +1 -1
  45. package/lib/esm/data/EmptyDataValue.js +51 -0
  46. package/lib/esm/index.d.ts +21 -0
  47. package/lib/esm/index.js +55 -0
  48. package/lib/{rules → esm/rules}/FunctionRuntime.d.ts +3 -25
  49. package/lib/{rules → esm/rules}/FunctionRuntime.js +66 -117
  50. package/lib/esm/rules/RuleEngine.d.ts +12 -0
  51. package/lib/esm/rules/RuleEngine.js +76 -0
  52. package/lib/esm/types/Json.d.ts +119 -0
  53. package/lib/esm/types/Json.js +29 -0
  54. package/lib/esm/types/Model.d.ts +131 -0
  55. package/lib/esm/types/Model.js +30 -0
  56. package/lib/esm/types/index.d.ts +2 -0
  57. package/lib/esm/types/index.js +22 -0
  58. package/lib/{utils → esm/utils}/DataRefParser.d.ts +4 -7
  59. package/lib/{utils → esm/utils}/DataRefParser.js +42 -44
  60. package/lib/{utils → esm/utils}/Fetch.d.ts +1 -7
  61. package/lib/esm/utils/Fetch.js +83 -0
  62. package/lib/esm/utils/FormCreationUtils.d.ts +9 -0
  63. package/lib/esm/utils/FormCreationUtils.js +112 -0
  64. package/lib/esm/utils/FormUtils.d.ts +12 -0
  65. package/lib/esm/utils/FormUtils.js +212 -0
  66. package/lib/esm/utils/JsonUtils.d.ts +11 -0
  67. package/lib/esm/utils/JsonUtils.js +99 -0
  68. package/lib/{utils → esm/utils}/LogUtils.d.ts +1 -4
  69. package/lib/esm/utils/LogUtils.js +28 -0
  70. package/lib/esm/utils/SchemaUtils.d.ts +3 -0
  71. package/lib/esm/utils/SchemaUtils.js +93 -0
  72. package/lib/esm/utils/TranslationUtils.d.ts +11 -0
  73. package/lib/esm/utils/TranslationUtils.js +138 -0
  74. package/lib/esm/utils/ValidationUtils.d.ts +19 -0
  75. package/lib/{utils → esm/utils}/ValidationUtils.js +55 -187
  76. package/package.json +18 -10
  77. package/lib/Checkbox.d.ts +0 -88
  78. package/lib/Checkbox.js +0 -49
  79. package/lib/CheckboxGroup.js +0 -43
  80. package/lib/DateField.js +0 -35
  81. package/lib/Fieldset.d.ts +0 -24
  82. package/lib/Fieldset.js +0 -74
  83. package/lib/FileObject.js +0 -39
  84. package/lib/FileUpload.js +0 -155
  85. package/lib/Form.js +0 -252
  86. package/lib/FormInstance.d.ts +0 -38
  87. package/lib/FormInstance.js +0 -127
  88. package/lib/FormMetaData.d.ts +0 -11
  89. package/lib/FormMetaData.js +0 -28
  90. package/lib/InstanceManager.d.ts +0 -16
  91. package/lib/InstanceManager.js +0 -53
  92. package/lib/Node.d.ts +0 -12
  93. package/lib/Node.js +0 -27
  94. package/lib/Scriptable.d.ts +0 -31
  95. package/lib/controller/Controller.d.ts +0 -255
  96. package/lib/controller/Controller.js +0 -328
  97. package/lib/controller/Logger.js +0 -36
  98. package/lib/controller/index.d.ts +0 -1
  99. package/lib/controller/index.js +0 -24
  100. package/lib/data/DataValue.js +0 -56
  101. package/lib/data/EmptyDataValue.js +0 -46
  102. package/lib/index.d.ts +0 -28
  103. package/lib/index.js +0 -63
  104. package/lib/rules/RuleEngine.d.ts +0 -23
  105. package/lib/rules/RuleEngine.js +0 -62
  106. package/lib/types/Json.d.ts +0 -138
  107. package/lib/types/Json.js +0 -19
  108. package/lib/types/Model.d.ts +0 -393
  109. package/lib/types/Model.js +0 -20
  110. package/lib/types/index.d.ts +0 -2
  111. package/lib/types/index.js +0 -25
  112. package/lib/utils/Fetch.js +0 -87
  113. package/lib/utils/FormCreationUtils.d.ts +0 -11
  114. package/lib/utils/FormCreationUtils.js +0 -83
  115. package/lib/utils/FormUtils.d.ts +0 -47
  116. package/lib/utils/FormUtils.js +0 -257
  117. package/lib/utils/JsonUtils.d.ts +0 -63
  118. package/lib/utils/JsonUtils.js +0 -157
  119. package/lib/utils/LogUtils.js +0 -17
  120. package/lib/utils/SchemaUtils.d.ts +0 -16
  121. package/lib/utils/SchemaUtils.js +0 -92
  122. package/lib/utils/TranslationUtils.d.ts +0 -41
  123. package/lib/utils/TranslationUtils.js +0 -185
  124. package/lib/utils/ValidationUtils.d.ts +0 -170
@@ -1,30 +1,35 @@
1
- "use strict";
2
- /*
3
- * Copyright 2022 Adobe, Inc.
4
- *
5
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
- */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ import { propertyChange, ExecuteRule } from './controller/Events.js';
22
+ import { tokenize, TOK_GLOBAL, resolveData } from './utils/DataRefParser.js';
23
+ import NullDataValue from './data/EmptyDataValue.js';
24
+
25
+ function __decorate(decorators, target, key, desc) {
10
26
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
27
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
28
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
29
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
- };
15
- var __importDefault = (this && this.__importDefault) || function (mod) {
16
- return (mod && mod.__esModule) ? mod : { "default": mod };
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.BaseNode = exports.exclude = exports.include = exports.dependencyTracked = exports.qualifiedName = exports.target = exports.staticFields = exports.dynamicProps = exports.editableProperties = void 0;
20
- const controller_1 = require("./controller");
21
- const DataRefParser_1 = require("./utils/DataRefParser");
22
- const EmptyDataValue_1 = __importDefault(require("./data/EmptyDataValue"));
23
- const JsonUtils_1 = require("./utils/JsonUtils");
24
- /**
25
- * Defines the properties that are editable. These properties can be modified during rule execution.
26
- */
27
- exports.editableProperties = [
30
+ }
31
+
32
+ const editableProperties = [
28
33
  'value',
29
34
  'label',
30
35
  'description',
@@ -35,39 +40,23 @@ exports.editableProperties = [
35
40
  'enumNames',
36
41
  'required',
37
42
  'properties',
38
- // 'enforceEnum', // not exposed for now
39
43
  'exclusiveMinimum',
40
44
  'exclusiveMaximum',
41
- // 'maxLength',
42
45
  'maximum',
43
46
  'maxItems',
44
- // 'minLength',
45
47
  'minimum',
46
48
  'minItems'
47
- // 'step'
48
- // 'placeholder' // not exposed for now.
49
49
  ];
50
- /**
51
- * Defines props that are dynamic and can be changed at runtime.
52
- */
53
- exports.dynamicProps = [
54
- ...exports.editableProperties,
50
+ const dynamicProps = [
51
+ ...editableProperties,
55
52
  'valid',
56
53
  'index',
57
54
  'activeChild'
58
55
  ];
59
- exports.staticFields = ['plain-text', 'image'];
60
- /**
61
- * Implementation of action with target
62
- * @private
63
- */
56
+ const staticFields = ['plain-text', 'image'];
64
57
  class ActionImplWithTarget {
65
- /**
66
- * @constructor
67
- * @param _action
68
- * @param _target
69
- * @private
70
- */
58
+ _action;
59
+ _target;
71
60
  constructor(_action, _target) {
72
61
  this._action = _action;
73
62
  this._target = _target;
@@ -94,26 +83,23 @@ class ActionImplWithTarget {
94
83
  return this._action.toString();
95
84
  }
96
85
  }
97
- exports.target = Symbol('target');
98
- exports.qualifiedName = Symbol('qualifiedName');
86
+ const target = Symbol('target');
87
+ const qualifiedName = Symbol('qualifiedName');
99
88
  function dependencyTracked() {
100
89
  return function (target, propertyKey, descriptor) {
101
90
  const get = descriptor.get;
102
91
  if (get != undefined) {
103
92
  descriptor.get = function () {
104
- // @ts-ignore
105
93
  this.ruleEngine.trackDependency(this);
106
94
  return get.call(this);
107
95
  };
108
96
  }
109
97
  };
110
98
  }
111
- exports.dependencyTracked = dependencyTracked;
112
99
  const addOnly = (includeOrExclude) => (...fieldTypes) => (target, propertyKey, descriptor) => {
113
100
  const get = descriptor.get;
114
101
  if (get != undefined) {
115
102
  descriptor.get = function () {
116
- // @ts-ignore
117
103
  if (fieldTypes.indexOf(this.fieldType) > -1 === includeOrExclude) {
118
104
  return get.call(this);
119
105
  }
@@ -123,44 +109,34 @@ const addOnly = (includeOrExclude) => (...fieldTypes) => (target, propertyKey, d
123
109
  const set = descriptor.set;
124
110
  if (set != undefined) {
125
111
  descriptor.set = function (value) {
126
- // @ts-ignore
127
112
  if (fieldTypes.indexOf(this.fieldType) > -1 === includeOrExclude) {
128
113
  set.call(this, value);
129
114
  }
130
115
  };
131
116
  }
132
117
  };
133
- exports.include = addOnly(true);
134
- exports.exclude = addOnly(false);
135
- /**
136
- * Defines a generic base class which all objects of form runtime model should extend from.
137
- * @typeparam T type of the form object which extends from {@link BaseJson | base type}
138
- */
118
+ const include = addOnly(true);
119
+ const exclude = addOnly(false);
139
120
  class BaseNode {
140
- /**
141
- * @constructor
142
- * @param params
143
- * @param _options
144
- * @private
145
- */
146
- constructor(params,
147
- //@ts_ignore
148
- _options) {
149
- this._options = _options;
150
- this._callbacks = {};
151
- this._dependents = [];
152
- this._tokens = [];
153
- //@ts-ignore
154
- this[exports.qualifiedName] = null;
155
- this._jsonModel = Object.assign(Object.assign({}, params), {
156
- //@ts-ignore
157
- id: 'id' in params ? params.id : this.form.getUniqueId() });
158
- }
121
+ _options;
122
+ _ruleNode;
123
+ _lang = '';
124
+ _callbacks = {};
125
+ _dependents = [];
126
+ _jsonModel;
127
+ _tokens = [];
159
128
  get isContainer() {
160
129
  return false;
161
130
  }
131
+ constructor(params, _options) {
132
+ this._options = _options;
133
+ this[qualifiedName] = null;
134
+ this._jsonModel = {
135
+ ...params,
136
+ id: 'id' in params ? params.id : this.form.getUniqueId()
137
+ };
138
+ }
162
139
  setupRuleNode() {
163
- // eslint-disable-next-line @typescript-eslint/no-this-alias
164
140
  const self = this;
165
141
  this._ruleNode = new Proxy(this.ruleNodeReference(), {
166
142
  get: (ruleNodeReference, prop) => {
@@ -168,15 +144,9 @@ class BaseNode {
168
144
  }
169
145
  });
170
146
  }
171
- /**
172
- * @private
173
- */
174
147
  ruleNodeReference() {
175
148
  return this;
176
149
  }
177
- /**
178
- * @private
179
- */
180
150
  getRuleNode() {
181
151
  return this._ruleNode;
182
152
  }
@@ -184,26 +154,18 @@ class BaseNode {
184
154
  if (prop === Symbol.toPrimitive || (prop === 'valueOf' && !ruleNodeReference.hasOwnProperty('valueOf'))) {
185
155
  return this.valueOf;
186
156
  }
187
- else if (prop === exports.target) {
157
+ else if (prop === target) {
188
158
  return this;
189
159
  }
190
160
  else if (typeof (prop) === 'string') {
191
- //look for property
192
161
  if (prop.startsWith('$')) {
193
162
  prop = prop.substr(1);
194
- //@ts-ignore
195
- //@todo: create a list of properties that are allowed
196
- //@ts-ignore
197
- // return only non functional properties in this object
198
163
  if (typeof this[prop] !== 'function') {
199
- //@ts-ignore
200
164
  const retValue = this[prop];
201
165
  if (retValue instanceof BaseNode) {
202
- //$parent
203
166
  return retValue.getRuleNode();
204
167
  }
205
168
  else if (retValue instanceof Array) {
206
- //$items
207
169
  return retValue.map(r => r instanceof BaseNode ? r.getRuleNode() : r);
208
170
  }
209
171
  else {
@@ -212,12 +174,10 @@ class BaseNode {
212
174
  }
213
175
  }
214
176
  else {
215
- //look in the items
216
177
  if (ruleNodeReference.hasOwnProperty(prop)) {
217
178
  return ruleNodeReference[prop];
218
179
  }
219
- else if (typeof ruleNodeReference[prop] === 'function') { //todo : create allow list of functions
220
- //to support panel instanceof Array panel1.map(..)
180
+ else if (typeof ruleNodeReference[prop] === 'function') {
221
181
  return ruleNodeReference[prop];
222
182
  }
223
183
  }
@@ -239,7 +199,7 @@ class BaseNode {
239
199
  return this._jsonModel.type;
240
200
  }
241
201
  get repeatable() {
242
- return (0, JsonUtils_1.isRepeatable)(this._jsonModel);
202
+ return this.parent?.hasDynamicItems();
243
203
  }
244
204
  get fieldType() {
245
205
  return this._jsonModel.fieldType || 'text-input';
@@ -264,7 +224,7 @@ class BaseNode {
264
224
  }
265
225
  set visible(v) {
266
226
  if (v !== this._jsonModel.visible) {
267
- const changeAction = (0, controller_1.propertyChange)('visible', v, this._jsonModel.visible);
227
+ const changeAction = propertyChange('visible', v, this._jsonModel.visible);
268
228
  this._jsonModel.visible = v;
269
229
  this.notifyDependents(changeAction);
270
230
  }
@@ -280,64 +240,58 @@ class BaseNode {
280
240
  }
281
241
  set label(l) {
282
242
  if (l !== this._jsonModel.label) {
283
- const changeAction = (0, controller_1.propertyChange)('label', l, this._jsonModel.label);
284
- this._jsonModel = Object.assign(Object.assign({}, this._jsonModel), { label: l });
243
+ const changeAction = propertyChange('label', l, this._jsonModel.label);
244
+ this._jsonModel = {
245
+ ...this._jsonModel,
246
+ label: l
247
+ };
285
248
  this.notifyDependents(changeAction);
286
249
  }
287
250
  }
288
251
  get uniqueItems() {
289
252
  return this._jsonModel.uniqueItems;
290
253
  }
291
- /**
292
- * Transparent form fields are meant only for creation of view. They are also not part of data
293
- */
294
254
  isTransparent() {
295
- var _a;
296
- // named form fields are not transparent
297
- // @ts-ignore
298
- // handling array use-case as items of array can be unnamed
299
- const isNonTransparent = ((_a = this.parent) === null || _a === void 0 ? void 0 : _a._jsonModel.type) === 'array';
255
+ const isNonTransparent = this.parent?._jsonModel.type === 'array';
300
256
  return !this._jsonModel.name && !isNonTransparent;
301
257
  }
302
258
  getState() {
303
- return Object.assign(Object.assign({}, this._jsonModel), { properties: this.properties, index: this.index, parent: undefined, qualifiedName: this.qualifiedName, events: {}, rules: {}, ':type': this[':type'] });
259
+ return {
260
+ ...this._jsonModel,
261
+ properties: this.properties,
262
+ index: this.index,
263
+ parent: undefined,
264
+ qualifiedName: this.qualifiedName,
265
+ events: {},
266
+ rules: {},
267
+ repeatable: this.repeatable === true ? true : undefined,
268
+ ':type': this[':type']
269
+ };
304
270
  }
305
- /**
306
- * @private
307
- */
308
271
  subscribe(callback, eventName = 'change') {
309
272
  this._callbacks[eventName] = this._callbacks[eventName] || [];
310
273
  this._callbacks[eventName].push(callback);
311
- //console.log(`subscription added : ${this._elem.id}, count : ${this._callbacks[eventName].length}`);
312
274
  return {
313
275
  unsubscribe: () => {
314
276
  this._callbacks[eventName] = this._callbacks[eventName].filter(x => x !== callback);
315
- //console.log(`subscription removed : ${this._elem.id}, count : ${this._callbacks[eventName].length}`);
316
277
  }
317
278
  };
318
279
  }
319
- /**
320
- * @private
321
- */
322
280
  _addDependent(dependent) {
323
281
  if (this._dependents.find(({ node }) => node === dependent) === undefined) {
324
282
  const subscription = this.subscribe((change) => {
325
283
  const changes = change.payload.changes;
326
- const propsToLook = [...exports.dynamicProps, 'items'];
327
- // @ts-ignore
284
+ const propsToLook = [...dynamicProps, 'items'];
328
285
  const isPropChanged = changes.findIndex(x => {
329
286
  return propsToLook.indexOf(x.propertyName) > -1;
330
287
  }) > -1;
331
288
  if (isPropChanged) {
332
- dependent.dispatch(new controller_1.ExecuteRule());
289
+ dependent.dispatch(new ExecuteRule());
333
290
  }
334
291
  });
335
292
  this._dependents.push({ node: dependent, subscription });
336
293
  }
337
294
  }
338
- /**
339
- * @private
340
- */
341
295
  removeDependent(dependent) {
342
296
  const index = this._dependents.findIndex(({ node }) => node === dependent);
343
297
  if (index > -1) {
@@ -345,9 +299,6 @@ class BaseNode {
345
299
  this._dependents.splice(index, 1);
346
300
  }
347
301
  }
348
- /**
349
- * @private
350
- */
351
302
  queueEvent(action) {
352
303
  const actionWithTarget = new ActionImplWithTarget(action, this);
353
304
  this.form.getEventQueue().queue(this, actionWithTarget, ['valid', 'invalid'].indexOf(actionWithTarget.type) > -1);
@@ -356,22 +307,13 @@ class BaseNode {
356
307
  this.queueEvent(action);
357
308
  this.form.getEventQueue().runPendingQueue();
358
309
  }
359
- /**
360
- * @private
361
- */
362
310
  notifyDependents(action) {
363
311
  const handlers = this._callbacks[action.type] || [];
364
312
  handlers.forEach(x => {
365
313
  x(new ActionImplWithTarget(action, this));
366
314
  });
367
315
  }
368
- /**
369
- * @param prop
370
- * @param newValue
371
- * @private
372
- */
373
316
  _setProperty(prop, newValue, notify = true) {
374
- //@ts-ignore
375
317
  const oldValue = this._jsonModel[prop];
376
318
  let isValueSame = false;
377
319
  if (newValue !== null && oldValue !== null &&
@@ -379,13 +321,11 @@ class BaseNode {
379
321
  isValueSame = JSON.stringify(newValue) === JSON.stringify(oldValue);
380
322
  }
381
323
  else {
382
- // @ts-ignore
383
324
  isValueSame = oldValue === newValue;
384
325
  }
385
326
  if (!isValueSame) {
386
- //@ts-ignore
387
327
  this._jsonModel[prop] = newValue;
388
- const changeAction = (0, controller_1.propertyChange)(prop, newValue, oldValue);
328
+ const changeAction = propertyChange(prop, newValue, oldValue);
389
329
  if (notify) {
390
330
  this.notifyDependents(changeAction);
391
331
  }
@@ -393,9 +333,6 @@ class BaseNode {
393
333
  }
394
334
  return [];
395
335
  }
396
- /**
397
- * @private
398
- */
399
336
  _bindToDataModel(contextualDataModel) {
400
337
  if (this.id === '$form') {
401
338
  this._data = contextualDataModel;
@@ -403,30 +340,27 @@ class BaseNode {
403
340
  }
404
341
  const dataRef = this._jsonModel.dataRef;
405
342
  let _data, _parent = contextualDataModel, _key = '';
406
- if (dataRef === null) { // null data binding
407
- _data = EmptyDataValue_1.default;
343
+ if (dataRef === null) {
344
+ _data = NullDataValue;
408
345
  }
409
- else if (dataRef !== undefined) { // explicit data binding
346
+ else if (dataRef !== undefined) {
410
347
  if (this._tokens.length === 0) {
411
- this._tokens = (0, DataRefParser_1.tokenize)(dataRef);
348
+ this._tokens = tokenize(dataRef);
412
349
  }
413
350
  let searchData = contextualDataModel;
414
- if (this._tokens[0].type === DataRefParser_1.TOK_GLOBAL) {
351
+ if (this._tokens[0].type === TOK_GLOBAL) {
415
352
  searchData = this.form.getDataNode();
416
353
  }
417
354
  if (typeof searchData !== 'undefined') {
418
355
  const name = this._tokens[this._tokens.length - 1].value;
419
356
  const create = this.defaultDataModel(name);
420
- _data = (0, DataRefParser_1.resolveData)(searchData, this._tokens, create);
421
- // @ts-ignore
422
- _parent = (0, DataRefParser_1.resolveData)(searchData, this._tokens.slice(0, -1));
357
+ _data = resolveData(searchData, this._tokens, create);
358
+ _parent = resolveData(searchData, this._tokens.slice(0, -1));
423
359
  _key = name;
424
360
  }
425
361
  }
426
- else { // name data binding
427
- // static fields do not have name bindings
428
- if ( //@ts-ignore
429
- contextualDataModel !== EmptyDataValue_1.default && exports.staticFields.indexOf(this.fieldType) === -1) {
362
+ else {
363
+ if (contextualDataModel !== NullDataValue && staticFields.indexOf(this.fieldType) === -1) {
430
364
  _parent = contextualDataModel;
431
365
  const name = this._jsonModel.name || '';
432
366
  const key = contextualDataModel.$type === 'array' ? this.index : name;
@@ -447,26 +381,34 @@ class BaseNode {
447
381
  }
448
382
  }
449
383
  if (_data) {
450
- //@ts-ignore
451
- if (!this.isContainer && _parent !== EmptyDataValue_1.default && _data !== EmptyDataValue_1.default) {
452
- _data = _data === null || _data === void 0 ? void 0 : _data.$convertToDataValue();
384
+ if (!this.isContainer && _parent !== NullDataValue && _data !== NullDataValue) {
385
+ _data = _data?.$convertToDataValue();
453
386
  _parent.$addDataNode(_key, _data, true);
454
387
  }
455
- _data === null || _data === void 0 ? void 0 : _data.$bindToField(this);
388
+ _data?.$bindToField(this);
456
389
  this._data = _data;
457
390
  }
458
391
  }
459
- /**
460
- * @private
461
- */
392
+ _data;
462
393
  getDataNode() {
463
394
  return this._data;
464
395
  }
396
+ get language() {
397
+ if (!this._lang) {
398
+ if (this.parent) {
399
+ this._lang = this.parent.language;
400
+ }
401
+ else {
402
+ this._lang = Intl.DateTimeFormat().resolvedOptions().locale;
403
+ }
404
+ }
405
+ return this._lang;
406
+ }
465
407
  get properties() {
466
408
  return this._jsonModel.properties || {};
467
409
  }
468
410
  set properties(p) {
469
- this._setProperty('properties', Object.assign({}, p));
411
+ this._setProperty('properties', { ...p });
470
412
  }
471
413
  getNonTransparentParent() {
472
414
  let nonTransparentParent = this.parent;
@@ -475,31 +417,18 @@ class BaseNode {
475
417
  }
476
418
  return nonTransparentParent;
477
419
  }
478
- /**
479
- * called after the node is inserted in the parent
480
- * @private
481
- */
482
420
  _initialize() {
483
421
  if (typeof this._data === 'undefined') {
484
422
  let dataNode, parent = this.parent;
485
423
  do {
486
- //@ts-ignore
487
424
  dataNode = parent.getDataNode();
488
425
  parent = parent.parent;
489
426
  } while (dataNode === undefined);
490
427
  this._bindToDataModel(dataNode);
491
428
  }
492
429
  }
493
- /**
494
- * Checks whether there are any updates in the properties. If there are applies them to the
495
- * json model as well.
496
- * @param propNames
497
- * @param updates
498
- * @private
499
- */
500
430
  _applyUpdates(propNames, updates) {
501
431
  return propNames.reduce((acc, propertyName) => {
502
- //@ts-ignore
503
432
  const currentValue = updates[propertyName];
504
433
  const changes = this._setProperty(propertyName, currentValue, false);
505
434
  if (changes.length > 0) {
@@ -512,23 +441,17 @@ class BaseNode {
512
441
  if (this.isTransparent()) {
513
442
  return null;
514
443
  }
515
- // @ts-ignore
516
- if (this[exports.qualifiedName] !== null) {
517
- // @ts-ignore
518
- return this[exports.qualifiedName];
444
+ if (this[qualifiedName] !== null) {
445
+ return this[qualifiedName];
519
446
  }
520
- // use qualified name
521
447
  const parent = this.getNonTransparentParent();
522
448
  if (parent && parent.type === 'array') {
523
- //@ts-ignore
524
- this[exports.qualifiedName] = `${parent.qualifiedName}[${this.index}]`;
449
+ this[qualifiedName] = `${parent.qualifiedName}[${this.index}]`;
525
450
  }
526
451
  else {
527
- //@ts-ignore
528
- this[exports.qualifiedName] = `${parent.qualifiedName}.${this.name}`;
452
+ this[qualifiedName] = `${parent.qualifiedName}.${this.name}`;
529
453
  }
530
- //@ts-ignore
531
- return this[exports.qualifiedName];
454
+ return this[qualifiedName];
532
455
  }
533
456
  focus() {
534
457
  if (this.parent) {
@@ -551,4 +474,5 @@ __decorate([
551
474
  __decorate([
552
475
  dependencyTracked()
553
476
  ], BaseNode.prototype, "properties", null);
554
- exports.BaseNode = BaseNode;
477
+
478
+ export { BaseNode as B, __decorate as _, editableProperties as a, dynamicProps as b, dependencyTracked as d, exclude as e, include as i, qualifiedName as q, staticFields as s, target as t };