@aemforms/af-core 0.22.30 → 0.22.31
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/lib/cjs/index.cjs +97 -16
- package/lib/esm/{BaseNode-d78cc1b0.js → BaseNode-f84b22c6.js} +16 -5
- package/lib/esm/BaseNode.d.ts +2 -2
- package/lib/esm/BaseNode.js +1 -1
- package/lib/esm/Checkbox.js +1 -1
- package/lib/esm/CheckboxGroup.js +1 -1
- package/lib/esm/Container.js +1 -1
- package/lib/esm/DateField.js +1 -1
- package/lib/esm/Field.d.ts +3 -2
- package/lib/esm/Field.js +19 -7
- package/lib/esm/Fieldset.d.ts +58 -2
- package/lib/esm/Fieldset.js +44 -4
- package/lib/esm/FileUpload.js +2 -2
- package/lib/esm/Form.d.ts +1 -1
- package/lib/esm/Form.js +1 -4
- package/lib/esm/FormInstance.js +1 -1
- package/lib/esm/InstanceManager.js +1 -1
- package/lib/esm/Scriptable.js +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/types/Json.d.ts +2 -0
- package/lib/esm/types/Model.d.ts +1 -1
- package/lib/esm/utils/DataRefParser.d.ts +6 -0
- package/lib/esm/utils/DataRefParser.js +22 -1
- package/lib/esm/utils/FormCreationUtils.js +1 -1
- package/package.json +2 -2
package/lib/cjs/index.cjs
CHANGED
|
@@ -324,9 +324,11 @@ class DataGroup extends DataValue {
|
|
|
324
324
|
const TOK_DOT$2 = 'DOT';
|
|
325
325
|
const TOK_IDENTIFIER = 'Identifier';
|
|
326
326
|
const TOK_GLOBAL$3 = 'Global';
|
|
327
|
+
const TOK_REPEATABLE = 'Repeatable';
|
|
327
328
|
const TOK_BRACKET = 'bracket';
|
|
328
329
|
const TOK_NUMBER$2 = 'Number';
|
|
329
330
|
const globalStartToken$1 = '$';
|
|
331
|
+
const repeatableStartToken = '#';
|
|
330
332
|
const identifier = (value, start) => {
|
|
331
333
|
return {
|
|
332
334
|
type: TOK_IDENTIFIER,
|
|
@@ -348,6 +350,13 @@ const global$ = () => {
|
|
|
348
350
|
value: globalStartToken$1
|
|
349
351
|
};
|
|
350
352
|
};
|
|
353
|
+
const repeatable = () => {
|
|
354
|
+
return {
|
|
355
|
+
type: TOK_REPEATABLE,
|
|
356
|
+
start: 0,
|
|
357
|
+
value: repeatableStartToken
|
|
358
|
+
};
|
|
359
|
+
};
|
|
351
360
|
const isAlphaNum$1 = function (ch) {
|
|
352
361
|
return (ch >= 'a' && ch <= 'z')
|
|
353
362
|
|| (ch >= 'A' && ch <= 'Z')
|
|
@@ -357,6 +366,9 @@ const isAlphaNum$1 = function (ch) {
|
|
|
357
366
|
const isGlobal = (prev, stream, pos) => {
|
|
358
367
|
return prev === null && stream[pos] === globalStartToken$1;
|
|
359
368
|
};
|
|
369
|
+
const isRepeatable$1 = (prev, stream, pos) => {
|
|
370
|
+
return prev === null && stream[pos] === repeatableStartToken;
|
|
371
|
+
};
|
|
360
372
|
const isIdentifier$1 = (stream, pos) => {
|
|
361
373
|
const ch = stream[pos];
|
|
362
374
|
if (ch === '$') {
|
|
@@ -382,6 +394,10 @@ class Tokenizer {
|
|
|
382
394
|
this._current += 1;
|
|
383
395
|
return global$();
|
|
384
396
|
}
|
|
397
|
+
_consumeRepeatable() {
|
|
398
|
+
this._current += 1;
|
|
399
|
+
return repeatable();
|
|
400
|
+
}
|
|
385
401
|
_consumeUnquotedIdentifier(stream) {
|
|
386
402
|
const start = this._current;
|
|
387
403
|
this._current += 1;
|
|
@@ -444,6 +460,11 @@ class Tokenizer {
|
|
|
444
460
|
this._tokens.push(token);
|
|
445
461
|
this._result_tokens.push(token);
|
|
446
462
|
}
|
|
463
|
+
else if (isRepeatable$1(prev, stream, this._current)) {
|
|
464
|
+
const token = this._consumeRepeatable();
|
|
465
|
+
this._tokens.push(token);
|
|
466
|
+
this._result_tokens.push(token);
|
|
467
|
+
}
|
|
447
468
|
else if (isIdentifier$1(stream, this._current)) {
|
|
448
469
|
const token = this._consumeUnquotedIdentifier(stream);
|
|
449
470
|
this._tokens.push(token);
|
|
@@ -833,7 +854,7 @@ class BaseNode {
|
|
|
833
854
|
x(new ActionImplWithTarget(action, this));
|
|
834
855
|
});
|
|
835
856
|
}
|
|
836
|
-
_setProperty(prop, newValue, notify = true) {
|
|
857
|
+
_setProperty(prop, newValue, notify = true, notifyChildren = (action) => { }) {
|
|
837
858
|
const oldValue = this._jsonModel[prop];
|
|
838
859
|
let isValueSame = false;
|
|
839
860
|
if (newValue !== null && oldValue !== null &&
|
|
@@ -849,6 +870,7 @@ class BaseNode {
|
|
|
849
870
|
if (notify) {
|
|
850
871
|
this.notifyDependents(changeAction);
|
|
851
872
|
}
|
|
873
|
+
notifyChildren.call(this, changeAction);
|
|
852
874
|
return changeAction.payload.changes;
|
|
853
875
|
}
|
|
854
876
|
return [];
|
|
@@ -863,7 +885,7 @@ class BaseNode {
|
|
|
863
885
|
if (dataRef === null) {
|
|
864
886
|
_data = NullDataValue;
|
|
865
887
|
}
|
|
866
|
-
else if (dataRef !== undefined) {
|
|
888
|
+
else if (dataRef !== undefined && !this.repeatable) {
|
|
867
889
|
if (this._tokens.length === 0) {
|
|
868
890
|
this._tokens = tokenize(dataRef);
|
|
869
891
|
}
|
|
@@ -871,6 +893,13 @@ class BaseNode {
|
|
|
871
893
|
if (this._tokens[0].type === TOK_GLOBAL$3) {
|
|
872
894
|
searchData = this.form.getDataNode();
|
|
873
895
|
}
|
|
896
|
+
else if (this._tokens[0].type === TOK_REPEATABLE) {
|
|
897
|
+
let repeatRoot = this.parent;
|
|
898
|
+
while (!repeatRoot.repeatable && repeatRoot !== this.form) {
|
|
899
|
+
repeatRoot = repeatRoot.parent;
|
|
900
|
+
}
|
|
901
|
+
searchData = repeatRoot.getDataNode();
|
|
902
|
+
}
|
|
874
903
|
if (typeof searchData !== 'undefined') {
|
|
875
904
|
const name = this._tokens[this._tokens.length - 1].value;
|
|
876
905
|
const create = this.defaultDataModel(name);
|
|
@@ -913,10 +942,13 @@ class BaseNode {
|
|
|
913
942
|
getDataNode() {
|
|
914
943
|
return this._data;
|
|
915
944
|
}
|
|
916
|
-
get
|
|
945
|
+
get lang() {
|
|
946
|
+
if (this._jsonModel.lang) {
|
|
947
|
+
this._lang = this._jsonModel.lang;
|
|
948
|
+
}
|
|
917
949
|
if (!this._lang) {
|
|
918
950
|
if (this.parent) {
|
|
919
|
-
this._lang = this.parent.
|
|
951
|
+
this._lang = this.parent.lang;
|
|
920
952
|
}
|
|
921
953
|
else {
|
|
922
954
|
this._lang = Intl.DateTimeFormat().resolvedOptions().locale;
|
|
@@ -2420,9 +2452,6 @@ class Form extends Container {
|
|
|
2420
2452
|
get action() {
|
|
2421
2453
|
return this._jsonModel.action;
|
|
2422
2454
|
}
|
|
2423
|
-
get lang() {
|
|
2424
|
-
return this._jsonModel.lang || 'en';
|
|
2425
|
-
}
|
|
2426
2455
|
importData(dataModel) {
|
|
2427
2456
|
this._bindToDataModel(new DataGroup('$form', dataModel));
|
|
2428
2457
|
this.syncDataAndFormModel(this.getDataNode());
|
|
@@ -5372,6 +5401,9 @@ const defaults = {
|
|
|
5372
5401
|
visible: true,
|
|
5373
5402
|
enabled: true
|
|
5374
5403
|
};
|
|
5404
|
+
const notifyChildrenAttributes = [
|
|
5405
|
+
'readOnly', 'enabled'
|
|
5406
|
+
];
|
|
5375
5407
|
class Fieldset extends Container {
|
|
5376
5408
|
constructor(params, _options) {
|
|
5377
5409
|
super(params, _options);
|
|
@@ -5406,10 +5438,47 @@ class Fieldset extends Container {
|
|
|
5406
5438
|
return 'panel';
|
|
5407
5439
|
}
|
|
5408
5440
|
get enabled() {
|
|
5409
|
-
|
|
5441
|
+
if (this.parent.enabled !== undefined) {
|
|
5442
|
+
return this.parent.enabled === false ? false : this._jsonModel.enabled;
|
|
5443
|
+
}
|
|
5444
|
+
else {
|
|
5445
|
+
return this._jsonModel.enabled;
|
|
5446
|
+
}
|
|
5410
5447
|
}
|
|
5411
5448
|
set enabled(e) {
|
|
5412
|
-
this._setProperty('enabled', e);
|
|
5449
|
+
this._setProperty('enabled', e, true, this.notifyChildren);
|
|
5450
|
+
}
|
|
5451
|
+
get readOnly() {
|
|
5452
|
+
if (this.parent.readOnly !== undefined) {
|
|
5453
|
+
return this.parent.readOnly === true ? true : this._jsonModel.readOnly;
|
|
5454
|
+
}
|
|
5455
|
+
else {
|
|
5456
|
+
return this._jsonModel.readOnly;
|
|
5457
|
+
}
|
|
5458
|
+
}
|
|
5459
|
+
set readOnly(e) {
|
|
5460
|
+
this._setProperty('readOnly', e, true, this.notifyChildren);
|
|
5461
|
+
}
|
|
5462
|
+
notifyChildren(action) {
|
|
5463
|
+
if (action.payload !== undefined && action.payload.changes !== undefined) {
|
|
5464
|
+
for (const change of action.payload.changes) {
|
|
5465
|
+
if (change.propertyName !== undefined && notifyChildrenAttributes.includes(change.propertyName)) {
|
|
5466
|
+
this.items.forEach((child) => {
|
|
5467
|
+
this.notifyDependents.call(child, propertyChange(change.propertyName, child.getState()[change.propertyName], null));
|
|
5468
|
+
if (child.fieldType === 'panel') {
|
|
5469
|
+
this.notifyChildren.call(child, action);
|
|
5470
|
+
}
|
|
5471
|
+
});
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
}
|
|
5475
|
+
}
|
|
5476
|
+
getState() {
|
|
5477
|
+
return {
|
|
5478
|
+
...super.getState(),
|
|
5479
|
+
enabled: this.enabled,
|
|
5480
|
+
readOnly: this.readOnly
|
|
5481
|
+
};
|
|
5413
5482
|
}
|
|
5414
5483
|
}
|
|
5415
5484
|
|
|
@@ -6283,7 +6352,7 @@ class Field extends Scriptable {
|
|
|
6283
6352
|
this.unset('emptyValue');
|
|
6284
6353
|
}
|
|
6285
6354
|
if (this._jsonModel.fieldType === undefined) {
|
|
6286
|
-
this.form.logger.
|
|
6355
|
+
this.form.logger.debug('fieldType property is mandatory. Please ensure all the fields have a fieldType');
|
|
6287
6356
|
if (this._jsonModel.viewType) {
|
|
6288
6357
|
if (this._jsonModel.viewType.startsWith('custom:')) {
|
|
6289
6358
|
this.form.logger.error('viewType property has been removed. For custom types, use :type property');
|
|
@@ -6356,13 +6425,23 @@ class Field extends Scriptable {
|
|
|
6356
6425
|
return this._jsonModel.placeholder;
|
|
6357
6426
|
}
|
|
6358
6427
|
get readOnly() {
|
|
6359
|
-
|
|
6428
|
+
if (this.parent.readOnly !== undefined) {
|
|
6429
|
+
return this.parent.readOnly === true ? true : this._jsonModel.readOnly;
|
|
6430
|
+
}
|
|
6431
|
+
else {
|
|
6432
|
+
return this._jsonModel.readOnly;
|
|
6433
|
+
}
|
|
6360
6434
|
}
|
|
6361
6435
|
set readOnly(e) {
|
|
6362
6436
|
this._setProperty('readOnly', e);
|
|
6363
6437
|
}
|
|
6364
6438
|
get enabled() {
|
|
6365
|
-
|
|
6439
|
+
if (this.parent.enabled !== undefined) {
|
|
6440
|
+
return this.parent.enabled === false ? false : this._jsonModel.enabled;
|
|
6441
|
+
}
|
|
6442
|
+
else {
|
|
6443
|
+
return this._jsonModel.enabled;
|
|
6444
|
+
}
|
|
6366
6445
|
}
|
|
6367
6446
|
set enabled(e) {
|
|
6368
6447
|
this._setProperty('enabled', e);
|
|
@@ -6441,7 +6520,7 @@ class Field extends Scriptable {
|
|
|
6441
6520
|
const df = this.editFormat;
|
|
6442
6521
|
if (df && this.isNotEmpty(this.value) && this.valid !== false) {
|
|
6443
6522
|
try {
|
|
6444
|
-
return format(this.value, this.
|
|
6523
|
+
return format(this.value, this.lang, df);
|
|
6445
6524
|
}
|
|
6446
6525
|
catch (e) {
|
|
6447
6526
|
return this.value;
|
|
@@ -6455,7 +6534,7 @@ class Field extends Scriptable {
|
|
|
6455
6534
|
const df = this.displayFormat;
|
|
6456
6535
|
if (df && this.isNotEmpty(this.value) && this.valid !== false) {
|
|
6457
6536
|
try {
|
|
6458
|
-
return format(this.value, this.
|
|
6537
|
+
return format(this.value, this.lang, df);
|
|
6459
6538
|
}
|
|
6460
6539
|
catch (e) {
|
|
6461
6540
|
return this.value;
|
|
@@ -6805,7 +6884,9 @@ class Field extends Scriptable {
|
|
|
6805
6884
|
editFormat: this.editFormat,
|
|
6806
6885
|
displayFormat: this.displayFormat,
|
|
6807
6886
|
editValue: this.editValue,
|
|
6808
|
-
displayValue: this.displayValue
|
|
6887
|
+
displayValue: this.displayValue,
|
|
6888
|
+
enabled: this.enabled,
|
|
6889
|
+
readOnly: this.readOnly
|
|
6809
6890
|
};
|
|
6810
6891
|
}
|
|
6811
6892
|
}
|
|
@@ -6945,7 +7026,7 @@ class FileUpload extends Field {
|
|
|
6945
7026
|
if (value != null) {
|
|
6946
7027
|
const res = Constraints.type(this.getInternalType(), value);
|
|
6947
7028
|
if (!res.valid) {
|
|
6948
|
-
this.form.logger.
|
|
7029
|
+
this.form.logger.debug(`unable to bind ${this.name} to data`);
|
|
6949
7030
|
}
|
|
6950
7031
|
this.form.getEventQueue().queue(this, propertyChange('value', res.value, this._jsonModel.value));
|
|
6951
7032
|
this._jsonModel.value = res.value;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*************************************************************************/
|
|
20
20
|
|
|
21
21
|
import { propertyChange, ExecuteRule } from './controller/Events.js';
|
|
22
|
-
import { tokenize, TOK_GLOBAL, resolveData } from './utils/DataRefParser.js';
|
|
22
|
+
import { tokenize, TOK_GLOBAL, TOK_REPEATABLE, resolveData } from './utils/DataRefParser.js';
|
|
23
23
|
import NullDataValue from './data/EmptyDataValue.js';
|
|
24
24
|
|
|
25
25
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -313,7 +313,7 @@ class BaseNode {
|
|
|
313
313
|
x(new ActionImplWithTarget(action, this));
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
|
-
_setProperty(prop, newValue, notify = true) {
|
|
316
|
+
_setProperty(prop, newValue, notify = true, notifyChildren = (action) => { }) {
|
|
317
317
|
const oldValue = this._jsonModel[prop];
|
|
318
318
|
let isValueSame = false;
|
|
319
319
|
if (newValue !== null && oldValue !== null &&
|
|
@@ -329,6 +329,7 @@ class BaseNode {
|
|
|
329
329
|
if (notify) {
|
|
330
330
|
this.notifyDependents(changeAction);
|
|
331
331
|
}
|
|
332
|
+
notifyChildren.call(this, changeAction);
|
|
332
333
|
return changeAction.payload.changes;
|
|
333
334
|
}
|
|
334
335
|
return [];
|
|
@@ -343,7 +344,7 @@ class BaseNode {
|
|
|
343
344
|
if (dataRef === null) {
|
|
344
345
|
_data = NullDataValue;
|
|
345
346
|
}
|
|
346
|
-
else if (dataRef !== undefined) {
|
|
347
|
+
else if (dataRef !== undefined && !this.repeatable) {
|
|
347
348
|
if (this._tokens.length === 0) {
|
|
348
349
|
this._tokens = tokenize(dataRef);
|
|
349
350
|
}
|
|
@@ -351,6 +352,13 @@ class BaseNode {
|
|
|
351
352
|
if (this._tokens[0].type === TOK_GLOBAL) {
|
|
352
353
|
searchData = this.form.getDataNode();
|
|
353
354
|
}
|
|
355
|
+
else if (this._tokens[0].type === TOK_REPEATABLE) {
|
|
356
|
+
let repeatRoot = this.parent;
|
|
357
|
+
while (!repeatRoot.repeatable && repeatRoot !== this.form) {
|
|
358
|
+
repeatRoot = repeatRoot.parent;
|
|
359
|
+
}
|
|
360
|
+
searchData = repeatRoot.getDataNode();
|
|
361
|
+
}
|
|
354
362
|
if (typeof searchData !== 'undefined') {
|
|
355
363
|
const name = this._tokens[this._tokens.length - 1].value;
|
|
356
364
|
const create = this.defaultDataModel(name);
|
|
@@ -393,10 +401,13 @@ class BaseNode {
|
|
|
393
401
|
getDataNode() {
|
|
394
402
|
return this._data;
|
|
395
403
|
}
|
|
396
|
-
get
|
|
404
|
+
get lang() {
|
|
405
|
+
if (this._jsonModel.lang) {
|
|
406
|
+
this._lang = this._jsonModel.lang;
|
|
407
|
+
}
|
|
397
408
|
if (!this._lang) {
|
|
398
409
|
if (this.parent) {
|
|
399
|
-
this._lang = this.parent.
|
|
410
|
+
this._lang = this.parent.lang;
|
|
400
411
|
}
|
|
401
412
|
else {
|
|
402
413
|
this._lang = Intl.DateTimeFormat().resolvedOptions().locale;
|
package/lib/esm/BaseNode.d.ts
CHANGED
|
@@ -72,11 +72,11 @@ export declare abstract class BaseNode<T extends BaseJson> implements BaseModel
|
|
|
72
72
|
queueEvent(action: Action): void;
|
|
73
73
|
dispatch(action: Action): void;
|
|
74
74
|
notifyDependents(action: Action): void;
|
|
75
|
-
_setProperty<T>(prop: string, newValue: T, notify?: boolean): any;
|
|
75
|
+
_setProperty<T>(prop: string, newValue: T, notify?: boolean, notifyChildren?: (action: Action) => void): any;
|
|
76
76
|
_bindToDataModel(contextualDataModel: DataGroup): void;
|
|
77
77
|
private _data?;
|
|
78
78
|
getDataNode(): DataValue | undefined;
|
|
79
|
-
get
|
|
79
|
+
get lang(): string | undefined;
|
|
80
80
|
get properties(): {
|
|
81
81
|
[key: string]: any;
|
|
82
82
|
};
|
package/lib/esm/BaseNode.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* the terms of the Adobe license agreement accompanying it.
|
|
19
19
|
*************************************************************************/
|
|
20
20
|
|
|
21
|
-
export { B as BaseNode, d as dependencyTracked, b as dynamicProps, a as editableProperties, e as exclude, i as include, q as qualifiedName, s as staticFields, t as target } from './BaseNode-
|
|
21
|
+
export { B as BaseNode, d as dependencyTracked, b as dynamicProps, a as editableProperties, e as exclude, i as include, q as qualifiedName, s as staticFields, t as target } from './BaseNode-f84b22c6.js';
|
|
22
22
|
import './controller/Events.js';
|
|
23
23
|
import './utils/DataRefParser.js';
|
|
24
24
|
import './data/EmptyDataValue.js';
|
package/lib/esm/Checkbox.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
import Field from './Field.js';
|
|
22
22
|
import { Constraints } from './utils/ValidationUtils.js';
|
|
23
|
-
import './BaseNode-
|
|
23
|
+
import './BaseNode-f84b22c6.js';
|
|
24
24
|
import './controller/Events.js';
|
|
25
25
|
import './utils/DataRefParser.js';
|
|
26
26
|
import './data/DataGroup.js';
|
package/lib/esm/CheckboxGroup.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*************************************************************************/
|
|
20
20
|
|
|
21
21
|
import Field from './Field.js';
|
|
22
|
-
import './BaseNode-
|
|
22
|
+
import './BaseNode-f84b22c6.js';
|
|
23
23
|
import './controller/Events.js';
|
|
24
24
|
import './utils/DataRefParser.js';
|
|
25
25
|
import './data/DataGroup.js';
|
package/lib/esm/Container.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* the terms of the Adobe license agreement accompanying it.
|
|
19
19
|
*************************************************************************/
|
|
20
20
|
|
|
21
|
-
import { _ as __decorate, d as dependencyTracked } from './BaseNode-
|
|
21
|
+
import { _ as __decorate, d as dependencyTracked } from './BaseNode-f84b22c6.js';
|
|
22
22
|
import { isRepeatable, deepClone } from './utils/JsonUtils.js';
|
|
23
23
|
import Scriptable from './Scriptable.js';
|
|
24
24
|
import { propertyChange, Initialize, ExecuteRule, RemoveItem } from './controller/Events.js';
|
package/lib/esm/DateField.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
import Field from './Field.js';
|
|
22
22
|
import { parseDateSkeleton, formatDate } from '@aemforms/af-formatters';
|
|
23
|
-
import './BaseNode-
|
|
23
|
+
import './BaseNode-f84b22c6.js';
|
|
24
24
|
import './controller/Events.js';
|
|
25
25
|
import './utils/DataRefParser.js';
|
|
26
26
|
import './data/DataGroup.js';
|
package/lib/esm/Field.d.ts
CHANGED
|
@@ -149,6 +149,8 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
149
149
|
displayFormat: string | undefined;
|
|
150
150
|
editValue: any;
|
|
151
151
|
displayValue: any;
|
|
152
|
+
enabled: boolean | undefined;
|
|
153
|
+
readOnly: boolean | undefined;
|
|
152
154
|
description?: string | undefined;
|
|
153
155
|
rules: import("./types/Json.js").Items<string> & {};
|
|
154
156
|
events: import("./types/Json.js").Items<string | string[] | undefined> & {};
|
|
@@ -175,9 +177,9 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
175
177
|
validationExpression?: string | undefined;
|
|
176
178
|
uniqueItems?: boolean | undefined;
|
|
177
179
|
dataRef?: string | null | undefined;
|
|
180
|
+
lang?: string | undefined;
|
|
178
181
|
':type': string;
|
|
179
182
|
label?: import("./types/Json.js").Label | undefined;
|
|
180
|
-
enabled?: boolean | undefined;
|
|
181
183
|
visible?: boolean | undefined;
|
|
182
184
|
name?: string | undefined;
|
|
183
185
|
constraintMessages?: ConstraintsMessages | undefined;
|
|
@@ -192,7 +194,6 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
192
194
|
altText?: string | undefined;
|
|
193
195
|
viewType?: string | undefined;
|
|
194
196
|
placeholder?: string | undefined;
|
|
195
|
-
readOnly?: boolean | undefined;
|
|
196
197
|
valid?: boolean | undefined;
|
|
197
198
|
default?: any;
|
|
198
199
|
value?: any;
|
package/lib/esm/Field.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* the terms of the Adobe license agreement accompanying it.
|
|
19
19
|
*************************************************************************/
|
|
20
20
|
|
|
21
|
-
import { _ as __decorate, s as staticFields, t as target, d as dependencyTracked, e as exclude, i as include } from './BaseNode-
|
|
21
|
+
import { _ as __decorate, s as staticFields, t as target, d as dependencyTracked, e as exclude, i as include } from './BaseNode-f84b22c6.js';
|
|
22
22
|
import { ValidationError } from './types/Model.js';
|
|
23
23
|
import { Constraints, coerceType, ValidConstraints } from './utils/ValidationUtils.js';
|
|
24
24
|
import { Initialize, ExecuteRule, Change, Valid, Invalid, propertyChange } from './controller/Events.js';
|
|
@@ -118,7 +118,7 @@ class Field extends Scriptable {
|
|
|
118
118
|
this.unset('emptyValue');
|
|
119
119
|
}
|
|
120
120
|
if (this._jsonModel.fieldType === undefined) {
|
|
121
|
-
this.form.logger.
|
|
121
|
+
this.form.logger.debug('fieldType property is mandatory. Please ensure all the fields have a fieldType');
|
|
122
122
|
if (this._jsonModel.viewType) {
|
|
123
123
|
if (this._jsonModel.viewType.startsWith('custom:')) {
|
|
124
124
|
this.form.logger.error('viewType property has been removed. For custom types, use :type property');
|
|
@@ -191,13 +191,23 @@ class Field extends Scriptable {
|
|
|
191
191
|
return this._jsonModel.placeholder;
|
|
192
192
|
}
|
|
193
193
|
get readOnly() {
|
|
194
|
-
|
|
194
|
+
if (this.parent.readOnly !== undefined) {
|
|
195
|
+
return this.parent.readOnly === true ? true : this._jsonModel.readOnly;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
return this._jsonModel.readOnly;
|
|
199
|
+
}
|
|
195
200
|
}
|
|
196
201
|
set readOnly(e) {
|
|
197
202
|
this._setProperty('readOnly', e);
|
|
198
203
|
}
|
|
199
204
|
get enabled() {
|
|
200
|
-
|
|
205
|
+
if (this.parent.enabled !== undefined) {
|
|
206
|
+
return this.parent.enabled === false ? false : this._jsonModel.enabled;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
return this._jsonModel.enabled;
|
|
210
|
+
}
|
|
201
211
|
}
|
|
202
212
|
set enabled(e) {
|
|
203
213
|
this._setProperty('enabled', e);
|
|
@@ -276,7 +286,7 @@ class Field extends Scriptable {
|
|
|
276
286
|
const df = this.editFormat;
|
|
277
287
|
if (df && this.isNotEmpty(this.value) && this.valid !== false) {
|
|
278
288
|
try {
|
|
279
|
-
return format(this.value, this.
|
|
289
|
+
return format(this.value, this.lang, df);
|
|
280
290
|
}
|
|
281
291
|
catch (e) {
|
|
282
292
|
return this.value;
|
|
@@ -290,7 +300,7 @@ class Field extends Scriptable {
|
|
|
290
300
|
const df = this.displayFormat;
|
|
291
301
|
if (df && this.isNotEmpty(this.value) && this.valid !== false) {
|
|
292
302
|
try {
|
|
293
|
-
return format(this.value, this.
|
|
303
|
+
return format(this.value, this.lang, df);
|
|
294
304
|
}
|
|
295
305
|
catch (e) {
|
|
296
306
|
return this.value;
|
|
@@ -640,7 +650,9 @@ class Field extends Scriptable {
|
|
|
640
650
|
editFormat: this.editFormat,
|
|
641
651
|
displayFormat: this.displayFormat,
|
|
642
652
|
editValue: this.editValue,
|
|
643
|
-
displayValue: this.displayValue
|
|
653
|
+
displayValue: this.displayValue,
|
|
654
|
+
enabled: this.enabled,
|
|
655
|
+
readOnly: this.readOnly
|
|
644
656
|
};
|
|
645
657
|
}
|
|
646
658
|
}
|
package/lib/esm/Fieldset.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Container from './Container.js';
|
|
2
|
-
import { ContainerModel, FieldsetJson, FieldsetModel, FormModel, IFormFieldFactory } from './types/index.js';
|
|
2
|
+
import { Action, ContainerModel, FieldModel, FieldsetJson, FieldsetModel, FormModel, IFormFieldFactory } from './types/index.js';
|
|
3
3
|
export declare class Fieldset extends Container<FieldsetJson> implements FieldsetModel {
|
|
4
4
|
constructor(params: FieldsetJson, _options: {
|
|
5
5
|
form: FormModel;
|
|
@@ -8,9 +8,65 @@ export declare class Fieldset extends Container<FieldsetJson> implements Fieldse
|
|
|
8
8
|
});
|
|
9
9
|
private _applyDefaults;
|
|
10
10
|
get type(): "array" | "object" | undefined;
|
|
11
|
-
get items(): (
|
|
11
|
+
get items(): (FieldModel | FieldsetModel)[];
|
|
12
12
|
get value(): null;
|
|
13
13
|
get fieldType(): string;
|
|
14
14
|
get enabled(): boolean | undefined;
|
|
15
15
|
set enabled(e: boolean | undefined);
|
|
16
|
+
get readOnly(): boolean | undefined;
|
|
17
|
+
set readOnly(e: boolean | undefined);
|
|
18
|
+
notifyChildren(action: Action): void;
|
|
19
|
+
getState(): {
|
|
20
|
+
enabled: boolean | undefined;
|
|
21
|
+
readOnly: boolean | undefined;
|
|
22
|
+
description?: string | undefined;
|
|
23
|
+
rules: import("./types/Json.js").Items<string> & {};
|
|
24
|
+
events: import("./types/Json.js").Items<string | string[] | undefined> & {};
|
|
25
|
+
enumNames?: string[] | undefined;
|
|
26
|
+
enum?: any[] | undefined;
|
|
27
|
+
accept?: string[] | undefined;
|
|
28
|
+
enforceEnum?: boolean | undefined;
|
|
29
|
+
exclusiveMinimum?: number | undefined;
|
|
30
|
+
exclusiveMaximum?: number | undefined;
|
|
31
|
+
format?: string | undefined;
|
|
32
|
+
maxFileSize?: string | number | undefined;
|
|
33
|
+
maxLength?: number | undefined;
|
|
34
|
+
maximum?: number | undefined;
|
|
35
|
+
maxItems?: number | undefined;
|
|
36
|
+
minOccur?: number | undefined;
|
|
37
|
+
maxOccur?: number | undefined;
|
|
38
|
+
minLength?: number | undefined;
|
|
39
|
+
minimum?: number | undefined;
|
|
40
|
+
minItems?: number | undefined;
|
|
41
|
+
pattern?: string | undefined;
|
|
42
|
+
required?: boolean | undefined;
|
|
43
|
+
step?: number | undefined;
|
|
44
|
+
type?: "object" | "array" | undefined;
|
|
45
|
+
validationExpression?: string | undefined;
|
|
46
|
+
uniqueItems?: boolean | undefined;
|
|
47
|
+
dataRef?: string | null | undefined;
|
|
48
|
+
lang?: string | undefined;
|
|
49
|
+
':type': string;
|
|
50
|
+
label?: import("./types/Json.js").Label | undefined;
|
|
51
|
+
visible?: boolean | undefined;
|
|
52
|
+
name?: string | undefined;
|
|
53
|
+
constraintMessages?: import("./types/Json.js").ConstraintsMessages | undefined;
|
|
54
|
+
fieldType?: string | undefined;
|
|
55
|
+
errorMessage?: string | undefined;
|
|
56
|
+
properties: {
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
};
|
|
59
|
+
repeatable: boolean | undefined;
|
|
60
|
+
screenReaderText?: string | undefined;
|
|
61
|
+
tooltip?: string | undefined;
|
|
62
|
+
altText?: string | undefined;
|
|
63
|
+
viewType?: string | undefined;
|
|
64
|
+
items: (import("./types/Json.js").FieldJson | import("./types/Json.js").ContainerJson)[] & any[];
|
|
65
|
+
initialItems?: number | undefined;
|
|
66
|
+
activeChild?: string | undefined;
|
|
67
|
+
index: number;
|
|
68
|
+
parent: undefined;
|
|
69
|
+
qualifiedName: any;
|
|
70
|
+
id: string;
|
|
71
|
+
};
|
|
16
72
|
}
|
package/lib/esm/Fieldset.js
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
*************************************************************************/
|
|
20
20
|
|
|
21
21
|
import Container from './Container.js';
|
|
22
|
-
import { Initialize, ExecuteRule } from './controller/Events.js';
|
|
23
|
-
import './BaseNode-
|
|
22
|
+
import { Initialize, ExecuteRule, propertyChange } from './controller/Events.js';
|
|
23
|
+
import './BaseNode-f84b22c6.js';
|
|
24
24
|
import './utils/DataRefParser.js';
|
|
25
25
|
import './data/DataGroup.js';
|
|
26
26
|
import './data/DataValue.js';
|
|
@@ -34,6 +34,9 @@ const defaults = {
|
|
|
34
34
|
visible: true,
|
|
35
35
|
enabled: true
|
|
36
36
|
};
|
|
37
|
+
const notifyChildrenAttributes = [
|
|
38
|
+
'readOnly', 'enabled'
|
|
39
|
+
];
|
|
37
40
|
class Fieldset extends Container {
|
|
38
41
|
constructor(params, _options) {
|
|
39
42
|
super(params, _options);
|
|
@@ -68,10 +71,47 @@ class Fieldset extends Container {
|
|
|
68
71
|
return 'panel';
|
|
69
72
|
}
|
|
70
73
|
get enabled() {
|
|
71
|
-
|
|
74
|
+
if (this.parent.enabled !== undefined) {
|
|
75
|
+
return this.parent.enabled === false ? false : this._jsonModel.enabled;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return this._jsonModel.enabled;
|
|
79
|
+
}
|
|
72
80
|
}
|
|
73
81
|
set enabled(e) {
|
|
74
|
-
this._setProperty('enabled', e);
|
|
82
|
+
this._setProperty('enabled', e, true, this.notifyChildren);
|
|
83
|
+
}
|
|
84
|
+
get readOnly() {
|
|
85
|
+
if (this.parent.readOnly !== undefined) {
|
|
86
|
+
return this.parent.readOnly === true ? true : this._jsonModel.readOnly;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return this._jsonModel.readOnly;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
set readOnly(e) {
|
|
93
|
+
this._setProperty('readOnly', e, true, this.notifyChildren);
|
|
94
|
+
}
|
|
95
|
+
notifyChildren(action) {
|
|
96
|
+
if (action.payload !== undefined && action.payload.changes !== undefined) {
|
|
97
|
+
for (const change of action.payload.changes) {
|
|
98
|
+
if (change.propertyName !== undefined && notifyChildrenAttributes.includes(change.propertyName)) {
|
|
99
|
+
this.items.forEach((child) => {
|
|
100
|
+
this.notifyDependents.call(child, propertyChange(change.propertyName, child.getState()[change.propertyName], null));
|
|
101
|
+
if (child.fieldType === 'panel') {
|
|
102
|
+
this.notifyChildren.call(child, action);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
getState() {
|
|
110
|
+
return {
|
|
111
|
+
...super.getState(),
|
|
112
|
+
enabled: this.enabled,
|
|
113
|
+
readOnly: this.readOnly
|
|
114
|
+
};
|
|
75
115
|
}
|
|
76
116
|
}
|
|
77
117
|
|
package/lib/esm/FileUpload.js
CHANGED
|
@@ -23,7 +23,7 @@ import Field from './Field.js';
|
|
|
23
23
|
import { getFileSizeInBytes } from './utils/FormUtils.js';
|
|
24
24
|
import { FileObject } from './FileObject.js';
|
|
25
25
|
import { Constraints } from './utils/ValidationUtils.js';
|
|
26
|
-
import './BaseNode-
|
|
26
|
+
import './BaseNode-f84b22c6.js';
|
|
27
27
|
import './utils/DataRefParser.js';
|
|
28
28
|
import './data/DataGroup.js';
|
|
29
29
|
import './data/DataValue.js';
|
|
@@ -126,7 +126,7 @@ class FileUpload extends Field {
|
|
|
126
126
|
if (value != null) {
|
|
127
127
|
const res = Constraints.type(this.getInternalType(), value);
|
|
128
128
|
if (!res.valid) {
|
|
129
|
-
this.form.logger.
|
|
129
|
+
this.form.logger.debug(`unable to bind ${this.name} to data`);
|
|
130
130
|
}
|
|
131
131
|
this.form.getEventQueue().queue(this, propertyChange('value', res.value, this._jsonModel.value));
|
|
132
132
|
this._jsonModel.value = res.value;
|
package/lib/esm/Form.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ declare class Form extends Container<FormJson> implements FormModel {
|
|
|
16
16
|
private dataRefRegex;
|
|
17
17
|
get metaData(): FormMetaData;
|
|
18
18
|
get action(): string | undefined;
|
|
19
|
-
get lang(): string;
|
|
20
19
|
importData(dataModel: any): void;
|
|
21
20
|
exportData(): any;
|
|
22
21
|
setFocus(field: BaseModel): void;
|
|
@@ -48,6 +47,7 @@ declare class Form extends Container<FormJson> implements FormModel {
|
|
|
48
47
|
uniqueItems?: boolean | undefined;
|
|
49
48
|
} & {
|
|
50
49
|
dataRef?: string | null | undefined;
|
|
50
|
+
lang?: string | undefined;
|
|
51
51
|
':type'?: string | undefined;
|
|
52
52
|
label?: import("./types/Json.js").Label | undefined;
|
|
53
53
|
enabled?: boolean | undefined;
|
package/lib/esm/Form.js
CHANGED
|
@@ -26,7 +26,7 @@ import { IdGenerator, getAttachments } from './utils/FormUtils.js';
|
|
|
26
26
|
import DataGroup from './data/DataGroup.js';
|
|
27
27
|
import { submit } from './rules/FunctionRuntime.js';
|
|
28
28
|
import { Initialize, ExecuteRule, FormLoad, FieldChanged, ValidationComplete } from './controller/Events.js';
|
|
29
|
-
import './BaseNode-
|
|
29
|
+
import './BaseNode-f84b22c6.js';
|
|
30
30
|
import './utils/DataRefParser.js';
|
|
31
31
|
import './data/DataValue.js';
|
|
32
32
|
import './data/EmptyDataValue.js';
|
|
@@ -68,9 +68,6 @@ class Form extends Container {
|
|
|
68
68
|
get action() {
|
|
69
69
|
return this._jsonModel.action;
|
|
70
70
|
}
|
|
71
|
-
get lang() {
|
|
72
|
-
return this._jsonModel.lang || 'en';
|
|
73
|
-
}
|
|
74
71
|
importData(dataModel) {
|
|
75
72
|
this._bindToDataModel(new DataGroup('$form', dataModel));
|
|
76
73
|
this.syncDataAndFormModel(this.getDataNode());
|
package/lib/esm/FormInstance.js
CHANGED
|
@@ -27,7 +27,7 @@ import { Logger } from './controller/Logger.js';
|
|
|
27
27
|
import { FormFieldFactory } from './utils/FormCreationUtils.js';
|
|
28
28
|
import { FunctionRuntime } from './rules/FunctionRuntime.js';
|
|
29
29
|
import './Container.js';
|
|
30
|
-
import './BaseNode-
|
|
30
|
+
import './BaseNode-f84b22c6.js';
|
|
31
31
|
import './controller/Events.js';
|
|
32
32
|
import './utils/DataRefParser.js';
|
|
33
33
|
import './data/DataGroup.js';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* the terms of the Adobe license agreement accompanying it.
|
|
19
19
|
*************************************************************************/
|
|
20
20
|
|
|
21
|
-
import { _ as __decorate, d as dependencyTracked } from './BaseNode-
|
|
21
|
+
import { _ as __decorate, d as dependencyTracked } from './BaseNode-f84b22c6.js';
|
|
22
22
|
import { Fieldset } from './Fieldset.js';
|
|
23
23
|
import './controller/Events.js';
|
|
24
24
|
import './utils/DataRefParser.js';
|
package/lib/esm/Scriptable.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* the terms of the Adobe license agreement accompanying it.
|
|
19
19
|
*************************************************************************/
|
|
20
20
|
|
|
21
|
-
import { B as BaseNode, a as editableProperties } from './BaseNode-
|
|
21
|
+
import { B as BaseNode, a as editableProperties } from './BaseNode-f84b22c6.js';
|
|
22
22
|
import './controller/Events.js';
|
|
23
23
|
import './utils/DataRefParser.js';
|
|
24
24
|
import './data/DataGroup.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export { CUSTOM_PROPS_KEY, TRANSLATION_ID, TRANSLATION_TOKEN, addTranslationId,
|
|
|
26
26
|
export { checkIfConstraintsArePresent, checkIfKeyAdded, deepClone, getProperty, isCheckbox, isCheckboxGroup, isDateField, isFile, isRepeatable, jsonString } from './utils/JsonUtils.js';
|
|
27
27
|
export { defaultFieldTypes, exportDataSchema } from './utils/SchemaUtils.js';
|
|
28
28
|
export { extractFileInfo, getFileSizeInBytes, isEmpty } from './utils/FormUtils.js';
|
|
29
|
-
export { B as BaseNode } from './BaseNode-
|
|
29
|
+
export { B as BaseNode } from './BaseNode-f84b22c6.js';
|
|
30
30
|
export { default as Checkbox } from './Checkbox.js';
|
|
31
31
|
export { default as CheckboxGroup } from './CheckboxGroup.js';
|
|
32
32
|
export { default as Container } from './Container.js';
|
package/lib/esm/types/Json.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ type TranslationBaseJson = {
|
|
|
62
62
|
};
|
|
63
63
|
export type BaseJson = TranslationBaseJson & RulesJson & ConstraintsJson & {
|
|
64
64
|
dataRef?: string | null;
|
|
65
|
+
lang?: string;
|
|
65
66
|
':type'?: string;
|
|
66
67
|
label?: Label;
|
|
67
68
|
enabled?: boolean;
|
|
@@ -104,6 +105,7 @@ export type MetaDataJson = {
|
|
|
104
105
|
};
|
|
105
106
|
export type FieldsetJson = ContainerJson & {
|
|
106
107
|
'type'?: 'array' | 'object';
|
|
108
|
+
readOnly?: boolean;
|
|
107
109
|
};
|
|
108
110
|
export type FormJson = ContainerJson & {
|
|
109
111
|
metadata?: MetaDataJson;
|
package/lib/esm/types/Model.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface WithController {
|
|
|
40
40
|
dispatch(action: Action): void;
|
|
41
41
|
}
|
|
42
42
|
export interface BaseModel extends ConstraintsJson, WithController {
|
|
43
|
+
readonly lang?: string;
|
|
43
44
|
readonly name?: string;
|
|
44
45
|
readonly dataRef?: string | null;
|
|
45
46
|
readonly id: string;
|
|
@@ -63,7 +64,6 @@ export interface BaseModel extends ConstraintsJson, WithController {
|
|
|
63
64
|
value: any;
|
|
64
65
|
readonly default?: any;
|
|
65
66
|
readonly repeatable?: boolean;
|
|
66
|
-
readonly language?: string;
|
|
67
67
|
validate(): Array<ValidationError>;
|
|
68
68
|
reset(): any;
|
|
69
69
|
importData(a?: DataGroup): any;
|
|
@@ -2,6 +2,7 @@ import DataGroup from '../data/DataGroup.js';
|
|
|
2
2
|
import DataValue from '../data/DataValue.js';
|
|
3
3
|
type TokenType = string;
|
|
4
4
|
export declare const TOK_GLOBAL: TokenType;
|
|
5
|
+
export declare const TOK_REPEATABLE: TokenType;
|
|
5
6
|
export type Token = {
|
|
6
7
|
type: TokenType;
|
|
7
8
|
value: string | number;
|
|
@@ -22,6 +23,11 @@ export declare const global$: () => {
|
|
|
22
23
|
start: number;
|
|
23
24
|
value: string;
|
|
24
25
|
};
|
|
26
|
+
export declare const repeatable: () => {
|
|
27
|
+
type: string;
|
|
28
|
+
start: number;
|
|
29
|
+
value: string;
|
|
30
|
+
};
|
|
25
31
|
export declare const tokenize: (stream: string) => Token[];
|
|
26
32
|
export declare const resolveData: <T extends DataValue>(data: DataGroup, input: Token[] | string, create?: T | undefined) => DataGroup | DataValue | undefined;
|
|
27
33
|
export {};
|
|
@@ -25,9 +25,11 @@ import '../data/EmptyDataValue.js';
|
|
|
25
25
|
const TOK_DOT = 'DOT';
|
|
26
26
|
const TOK_IDENTIFIER = 'Identifier';
|
|
27
27
|
const TOK_GLOBAL = 'Global';
|
|
28
|
+
const TOK_REPEATABLE = 'Repeatable';
|
|
28
29
|
const TOK_BRACKET = 'bracket';
|
|
29
30
|
const TOK_NUMBER = 'Number';
|
|
30
31
|
const globalStartToken = '$';
|
|
32
|
+
const repeatableStartToken = '#';
|
|
31
33
|
const identifier = (value, start) => {
|
|
32
34
|
return {
|
|
33
35
|
type: TOK_IDENTIFIER,
|
|
@@ -49,6 +51,13 @@ const global$ = () => {
|
|
|
49
51
|
value: globalStartToken
|
|
50
52
|
};
|
|
51
53
|
};
|
|
54
|
+
const repeatable = () => {
|
|
55
|
+
return {
|
|
56
|
+
type: TOK_REPEATABLE,
|
|
57
|
+
start: 0,
|
|
58
|
+
value: repeatableStartToken
|
|
59
|
+
};
|
|
60
|
+
};
|
|
52
61
|
const isAlphaNum = function (ch) {
|
|
53
62
|
return (ch >= 'a' && ch <= 'z')
|
|
54
63
|
|| (ch >= 'A' && ch <= 'Z')
|
|
@@ -58,6 +67,9 @@ const isAlphaNum = function (ch) {
|
|
|
58
67
|
const isGlobal = (prev, stream, pos) => {
|
|
59
68
|
return prev === null && stream[pos] === globalStartToken;
|
|
60
69
|
};
|
|
70
|
+
const isRepeatable = (prev, stream, pos) => {
|
|
71
|
+
return prev === null && stream[pos] === repeatableStartToken;
|
|
72
|
+
};
|
|
61
73
|
const isIdentifier = (stream, pos) => {
|
|
62
74
|
const ch = stream[pos];
|
|
63
75
|
if (ch === '$') {
|
|
@@ -83,6 +95,10 @@ class Tokenizer {
|
|
|
83
95
|
this._current += 1;
|
|
84
96
|
return global$();
|
|
85
97
|
}
|
|
98
|
+
_consumeRepeatable() {
|
|
99
|
+
this._current += 1;
|
|
100
|
+
return repeatable();
|
|
101
|
+
}
|
|
86
102
|
_consumeUnquotedIdentifier(stream) {
|
|
87
103
|
const start = this._current;
|
|
88
104
|
this._current += 1;
|
|
@@ -145,6 +161,11 @@ class Tokenizer {
|
|
|
145
161
|
this._tokens.push(token);
|
|
146
162
|
this._result_tokens.push(token);
|
|
147
163
|
}
|
|
164
|
+
else if (isRepeatable(prev, stream, this._current)) {
|
|
165
|
+
const token = this._consumeRepeatable();
|
|
166
|
+
this._tokens.push(token);
|
|
167
|
+
this._result_tokens.push(token);
|
|
168
|
+
}
|
|
148
169
|
else if (isIdentifier(stream, this._current)) {
|
|
149
170
|
const token = this._consumeUnquotedIdentifier(stream);
|
|
150
171
|
this._tokens.push(token);
|
|
@@ -244,4 +265,4 @@ const resolveData = (data, input, create) => {
|
|
|
244
265
|
return result;
|
|
245
266
|
};
|
|
246
267
|
|
|
247
|
-
export { TOK_GLOBAL, bracket, global$, identifier, resolveData, tokenize };
|
|
268
|
+
export { TOK_GLOBAL, TOK_REPEATABLE, bracket, global$, identifier, repeatable, resolveData, tokenize };
|
|
@@ -26,7 +26,7 @@ import Checkbox from '../Checkbox.js';
|
|
|
26
26
|
import CheckboxGroup from '../CheckboxGroup.js';
|
|
27
27
|
import DateField from '../DateField.js';
|
|
28
28
|
import Field from '../Field.js';
|
|
29
|
-
import '../BaseNode-
|
|
29
|
+
import '../BaseNode-f84b22c6.js';
|
|
30
30
|
import '../controller/Events.js';
|
|
31
31
|
import './DataRefParser.js';
|
|
32
32
|
import '../data/DataGroup.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.31",
|
|
4
4
|
"description": "Core Module for Forms Runtime",
|
|
5
5
|
"author": "Adobe Systems",
|
|
6
6
|
"license": "Adobe Proprietary",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@adobe/json-formula": "0.1.50",
|
|
45
|
-
"@aemforms/af-formatters": "^0.22.
|
|
45
|
+
"@aemforms/af-formatters": "^0.22.31"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/jest": "29.2.4",
|