@aemforms/af-core 0.22.31 → 0.22.33
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/{esm/BaseNode.d.ts → BaseNode.d.ts} +6 -6
- package/lib/{esm/BaseNode-f84b22c6.js → BaseNode.js} +58 -94
- package/lib/{esm/Checkbox.d.ts → Checkbox.d.ts} +1 -1
- package/lib/Checkbox.js +29 -0
- package/lib/{esm/CheckboxGroup.d.ts → CheckboxGroup.d.ts} +2 -2
- package/lib/CheckboxGroup.js +24 -0
- package/lib/{esm/Container.d.ts → Container.d.ts} +4 -4
- package/lib/{esm/Container.js → Container.js} +51 -77
- package/lib/{esm/DateField.d.ts → DateField.d.ts} +1 -1
- package/lib/DateField.js +26 -0
- package/lib/{esm/Field.d.ts → Field.d.ts} +7 -7
- package/lib/{esm/Field.js → Field.js} +84 -104
- package/lib/{esm/Fieldset.d.ts → Fieldset.d.ts} +7 -7
- package/lib/{esm/Fieldset.js → Fieldset.js} +14 -43
- package/lib/{esm/FileObject.d.ts → FileObject.d.ts} +1 -1
- package/lib/FileObject.js +29 -0
- package/lib/{esm/FileUpload.d.ts → FileUpload.d.ts} +3 -3
- package/lib/FileUpload.js +124 -0
- package/lib/{esm/Form.d.ts → Form.d.ts} +12 -12
- package/lib/{esm/Form.js → Form.js} +34 -65
- package/lib/{esm/FormInstance.d.ts → FormInstance.d.ts} +3 -3
- package/lib/FormInstance.js +94 -0
- package/lib/{esm/FormMetaData.d.ts → FormMetaData.d.ts} +2 -2
- package/lib/FormMetaData.js +15 -0
- package/lib/{esm/InstanceManager.d.ts → InstanceManager.d.ts} +2 -2
- package/lib/InstanceManager.js +35 -0
- package/lib/Node.js +15 -0
- package/lib/{esm/Scriptable.d.ts → Scriptable.d.ts} +3 -3
- package/lib/{esm/Scriptable.js → Scriptable.js} +17 -38
- package/lib/{esm/controller → controller}/EventQueue.d.ts +3 -3
- package/lib/{esm/controller → controller}/EventQueue.js +8 -32
- package/lib/{esm/controller → controller}/Events.d.ts +2 -2
- package/lib/{esm/controller → controller}/Events.js +22 -26
- package/lib/{esm/controller → controller}/Logger.d.ts +2 -2
- package/lib/controller/Logger.js +33 -0
- package/lib/{esm/data → data}/DataGroup.d.ts +1 -1
- package/lib/{esm/data → data}/DataGroup.js +20 -38
- package/lib/{esm/data → data}/DataValue.d.ts +1 -1
- package/lib/{esm/data → data}/DataValue.js +4 -26
- package/lib/{esm/data → data}/EmptyDataValue.d.ts +1 -1
- package/lib/data/EmptyDataValue.js +34 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +57 -0
- package/lib/{esm/rules → rules}/FunctionRuntime.d.ts +3 -3
- package/lib/{esm/rules → rules}/FunctionRuntime.js +52 -63
- package/lib/{esm/rules → rules}/RuleEngine.d.ts +1 -1
- package/lib/rules/RuleEngine.js +51 -0
- package/lib/{esm/types → types}/Json.d.ts +16 -16
- package/lib/types/Json.js +10 -0
- package/lib/{esm/types → types}/Model.d.ts +9 -9
- package/lib/types/Model.js +10 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +18 -0
- package/lib/{esm/utils → utils}/DataRefParser.d.ts +4 -4
- package/lib/{esm/utils → utils}/DataRefParser.js +30 -45
- package/lib/{esm/utils → utils}/Fetch.d.ts +1 -1
- package/lib/utils/Fetch.js +74 -0
- package/lib/{esm/utils → utils}/FormCreationUtils.d.ts +1 -1
- package/lib/utils/FormCreationUtils.js +67 -0
- package/lib/{esm/utils → utils}/FormUtils.d.ts +2 -1
- package/lib/{esm/utils → utils}/FormUtils.js +62 -46
- package/lib/{esm/utils → utils}/JsonUtils.d.ts +1 -1
- package/lib/utils/JsonUtils.js +89 -0
- package/lib/{esm/utils → utils}/LogUtils.d.ts +1 -1
- package/lib/utils/LogUtils.js +10 -0
- package/lib/{esm/utils → utils}/SchemaUtils.d.ts +1 -1
- package/lib/{esm/utils → utils}/SchemaUtils.js +9 -29
- package/lib/{esm/utils → utils}/TranslationUtils.d.ts +2 -2
- package/lib/utils/TranslationUtils.js +125 -0
- package/lib/{esm/utils → utils}/ValidationUtils.d.ts +4 -4
- package/lib/{esm/utils → utils}/ValidationUtils.js +13 -35
- package/package.json +8 -13
- package/lib/cjs/index.cjs +0 -7426
- package/lib/esm/BaseNode.js +0 -26
- package/lib/esm/Checkbox.js +0 -63
- package/lib/esm/CheckboxGroup.js +0 -60
- package/lib/esm/DateField.js +0 -57
- package/lib/esm/FileObject.js +0 -48
- package/lib/esm/FileUpload.js +0 -141
- package/lib/esm/FormInstance.js +0 -129
- package/lib/esm/FormMetaData.js +0 -35
- package/lib/esm/InstanceManager.js +0 -58
- package/lib/esm/Node.js +0 -40
- package/lib/esm/controller/Logger.js +0 -52
- package/lib/esm/data/EmptyDataValue.js +0 -51
- package/lib/esm/index.d.ts +0 -21
- package/lib/esm/index.js +0 -55
- package/lib/esm/rules/RuleEngine.js +0 -76
- package/lib/esm/types/Json.js +0 -29
- package/lib/esm/types/Model.js +0 -30
- package/lib/esm/types/index.d.ts +0 -2
- package/lib/esm/types/index.js +0 -22
- package/lib/esm/utils/Fetch.js +0 -83
- package/lib/esm/utils/FormCreationUtils.js +0 -112
- package/lib/esm/utils/JsonUtils.js +0 -99
- package/lib/esm/utils/LogUtils.js +0 -28
- package/lib/esm/utils/TranslationUtils.js +0 -138
- /package/lib/{esm/Node.d.ts → Node.d.ts} +0 -0
|
@@ -1,54 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import { _ as __decorate, s as staticFields, t as target, d as dependencyTracked, e as exclude, i as include } from './BaseNode-f84b22c6.js';
|
|
22
|
-
import { ValidationError } from './types/Model.js';
|
|
23
|
-
import { Constraints, coerceType, ValidConstraints } from './utils/ValidationUtils.js';
|
|
24
|
-
import { Initialize, ExecuteRule, Change, Valid, Invalid, propertyChange } from './controller/Events.js';
|
|
25
|
-
import Scriptable from './Scriptable.js';
|
|
26
|
-
import { defaultFieldTypes } from './utils/SchemaUtils.js';
|
|
27
|
-
import DataValue from './data/DataValue.js';
|
|
28
|
-
import NullDataValue from './data/EmptyDataValue.js';
|
|
29
|
-
import { format } from '@aemforms/af-formatters';
|
|
30
|
-
import './utils/DataRefParser.js';
|
|
31
|
-
import './data/DataGroup.js';
|
|
32
|
-
import './utils/FormUtils.js';
|
|
33
|
-
import './utils/JsonUtils.js';
|
|
34
|
-
import './types/Json.js';
|
|
35
|
-
import './FileObject.js';
|
|
36
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const types_1 = require("./types");
|
|
13
|
+
const ValidationUtils_1 = require("./utils/ValidationUtils");
|
|
14
|
+
const Events_1 = require("./controller/Events");
|
|
15
|
+
const Scriptable_1 = __importDefault(require("./Scriptable"));
|
|
16
|
+
const SchemaUtils_1 = require("./utils/SchemaUtils");
|
|
17
|
+
const DataValue_1 = __importDefault(require("./data/DataValue"));
|
|
18
|
+
const BaseNode_1 = require("./BaseNode");
|
|
19
|
+
const EmptyDataValue_1 = __importDefault(require("./data/EmptyDataValue"));
|
|
20
|
+
const af_formatters_1 = require("@aemforms/af-formatters");
|
|
37
21
|
const validTypes = ['string', 'number', 'boolean', 'file', 'string[]', 'number[]', 'boolean[]', 'file[]', 'array', 'object'];
|
|
38
|
-
class Field extends
|
|
22
|
+
class Field extends Scriptable_1.default {
|
|
39
23
|
constructor(params, _options) {
|
|
40
24
|
super(params, _options);
|
|
25
|
+
this._ruleNodeReference = [];
|
|
41
26
|
this._applyDefaults();
|
|
42
|
-
this.queueEvent(new Initialize());
|
|
43
|
-
this.queueEvent(new ExecuteRule());
|
|
27
|
+
this.queueEvent(new Events_1.Initialize());
|
|
28
|
+
this.queueEvent(new Events_1.ExecuteRule());
|
|
44
29
|
}
|
|
45
|
-
_ruleNodeReference = [];
|
|
46
30
|
_initialize() {
|
|
47
31
|
super._initialize();
|
|
48
32
|
this.setupRuleNode();
|
|
49
33
|
}
|
|
50
34
|
ruleNodeReference() {
|
|
51
|
-
|
|
35
|
+
var _a;
|
|
36
|
+
if ((_a = this.type) === null || _a === void 0 ? void 0 : _a.endsWith('[]')) {
|
|
52
37
|
this._ruleNodeReference = [];
|
|
53
38
|
}
|
|
54
39
|
else {
|
|
@@ -69,7 +54,7 @@ class Field extends Scriptable {
|
|
|
69
54
|
let finalType = type;
|
|
70
55
|
if (typeof type !== 'string' || validTypes.indexOf(type) === -1) {
|
|
71
56
|
const _enum = this.enum;
|
|
72
|
-
finalType = typeof (_enum
|
|
57
|
+
finalType = typeof (_enum === null || _enum === void 0 ? void 0 : _enum[0]);
|
|
73
58
|
if (finalType === 'undefined' && typeof this._jsonModel.default !== 'undefined') {
|
|
74
59
|
if (this._jsonModel.default instanceof Array && this._jsonModel.default.length > 0) {
|
|
75
60
|
finalType = `${typeof (this._jsonModel.default[0])}[]`;
|
|
@@ -111,7 +96,7 @@ class Field extends Scriptable {
|
|
|
111
96
|
}
|
|
112
97
|
const value = this._jsonModel.value;
|
|
113
98
|
if (value === undefined) {
|
|
114
|
-
const typedRes = Constraints.type(this.getInternalType() || 'string', this._jsonModel.default);
|
|
99
|
+
const typedRes = ValidationUtils_1.Constraints.type(this.getInternalType() || 'string', this._jsonModel.default);
|
|
115
100
|
this._jsonModel.value = typedRes.value;
|
|
116
101
|
}
|
|
117
102
|
if (this._jsonModel.type !== 'string') {
|
|
@@ -129,7 +114,7 @@ class Field extends Scriptable {
|
|
|
129
114
|
this._jsonModel.fieldType = this._jsonModel.viewType;
|
|
130
115
|
}
|
|
131
116
|
else {
|
|
132
|
-
this._jsonModel.fieldType = defaultFieldTypes(this._jsonModel);
|
|
117
|
+
this._jsonModel.fieldType = (0, SchemaUtils_1.defaultFieldTypes)(this._jsonModel);
|
|
133
118
|
}
|
|
134
119
|
}
|
|
135
120
|
if (this._jsonModel.enum === undefined) {
|
|
@@ -173,7 +158,7 @@ class Field extends Scriptable {
|
|
|
173
158
|
if (typeof val !== 'undefined' && typeof val !== type) {
|
|
174
159
|
this.form.logger.info(`${param} is not of type ${type}. Trying to coerce.`);
|
|
175
160
|
try {
|
|
176
|
-
this._jsonModel[param] = coerceType(val, type);
|
|
161
|
+
this._jsonModel[param] = (0, ValidationUtils_1.coerceType)(val, type);
|
|
177
162
|
}
|
|
178
163
|
catch (e) {
|
|
179
164
|
this.form.logger.warn(e);
|
|
@@ -269,7 +254,7 @@ class Field extends Scriptable {
|
|
|
269
254
|
}
|
|
270
255
|
withCategory(df) {
|
|
271
256
|
if (df) {
|
|
272
|
-
const hasCategory = df
|
|
257
|
+
const hasCategory = df === null || df === void 0 ? void 0 : df.match(/^(?:date|num)\|/);
|
|
273
258
|
if (hasCategory === null) {
|
|
274
259
|
if (this.format === 'date') {
|
|
275
260
|
df = `date|${df}`;
|
|
@@ -286,7 +271,7 @@ class Field extends Scriptable {
|
|
|
286
271
|
const df = this.editFormat;
|
|
287
272
|
if (df && this.isNotEmpty(this.value) && this.valid !== false) {
|
|
288
273
|
try {
|
|
289
|
-
return format(this.value, this.lang, df);
|
|
274
|
+
return (0, af_formatters_1.format)(this.value, this.lang, df);
|
|
290
275
|
}
|
|
291
276
|
catch (e) {
|
|
292
277
|
return this.value;
|
|
@@ -300,7 +285,7 @@ class Field extends Scriptable {
|
|
|
300
285
|
const df = this.displayFormat;
|
|
301
286
|
if (df && this.isNotEmpty(this.value) && this.valid !== false) {
|
|
302
287
|
try {
|
|
303
|
-
return format(this.value, this.lang, df);
|
|
288
|
+
return (0, af_formatters_1.format)(this.value, this.lang, df);
|
|
304
289
|
}
|
|
305
290
|
catch (e) {
|
|
306
291
|
return this.value;
|
|
@@ -315,7 +300,7 @@ class Field extends Scriptable {
|
|
|
315
300
|
}
|
|
316
301
|
updateDataNodeAndTypedValue(val) {
|
|
317
302
|
const dataNode = this.getDataNode();
|
|
318
|
-
if (staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined') {
|
|
303
|
+
if (BaseNode_1.staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined') {
|
|
319
304
|
return;
|
|
320
305
|
}
|
|
321
306
|
const Constraints = this._getConstraintObject();
|
|
@@ -340,11 +325,11 @@ class Field extends Scriptable {
|
|
|
340
325
|
set value(v) {
|
|
341
326
|
const changes = this.updateDataNodeAndTypedValue(v);
|
|
342
327
|
let uniqueRes = { valid: true };
|
|
343
|
-
if (changes
|
|
328
|
+
if ((changes === null || changes === void 0 ? void 0 : changes.length) > 0) {
|
|
344
329
|
let updates = {};
|
|
345
|
-
const typeRes = Constraints.type(this.getInternalType() || 'string', v);
|
|
330
|
+
const typeRes = ValidationUtils_1.Constraints.type(this.getInternalType() || 'string', v);
|
|
346
331
|
if (this.parent.uniqueItems && this.parent.type === 'array') {
|
|
347
|
-
uniqueRes = Constraints.uniqueItems(this.parent.uniqueItems, this.parent.getDataNode().$value);
|
|
332
|
+
uniqueRes = ValidationUtils_1.Constraints.uniqueItems(this.parent.uniqueItems, this.parent.getDataNode().$value);
|
|
348
333
|
}
|
|
349
334
|
if (typeRes.valid && uniqueRes.valid) {
|
|
350
335
|
updates = this.evaluateConstraints();
|
|
@@ -359,7 +344,7 @@ class Field extends Scriptable {
|
|
|
359
344
|
if (updates.valid) {
|
|
360
345
|
this.triggerValidationEvent(updates);
|
|
361
346
|
}
|
|
362
|
-
const changeAction = new Change({ changes: changes.concat(Object.values(updates)) });
|
|
347
|
+
const changeAction = new Events_1.Change({ changes: changes.concat(Object.values(updates)) });
|
|
363
348
|
this.dispatch(changeAction);
|
|
364
349
|
}
|
|
365
350
|
}
|
|
@@ -371,12 +356,13 @@ class Field extends Scriptable {
|
|
|
371
356
|
'errorMessage': ''
|
|
372
357
|
};
|
|
373
358
|
const updates = this._applyUpdates(['valid', 'errorMessage'], validationStateChanges);
|
|
374
|
-
const changeAction = new Change({ changes: changes.concat(Object.values(updates)) });
|
|
359
|
+
const changeAction = new Events_1.Change({ changes: changes.concat(Object.values(updates)) });
|
|
375
360
|
this.dispatch(changeAction);
|
|
376
361
|
}
|
|
377
362
|
}
|
|
378
363
|
_updateRuleNodeReference(value) {
|
|
379
|
-
|
|
364
|
+
var _a;
|
|
365
|
+
if ((_a = this.type) === null || _a === void 0 ? void 0 : _a.endsWith('[]')) {
|
|
380
366
|
if (value != null) {
|
|
381
367
|
value.forEach((val, index) => {
|
|
382
368
|
this._ruleNodeReference[index] = val;
|
|
@@ -396,18 +382,20 @@ class Field extends Scriptable {
|
|
|
396
382
|
return this.type;
|
|
397
383
|
}
|
|
398
384
|
valueOf() {
|
|
399
|
-
const obj = this[target];
|
|
385
|
+
const obj = this[BaseNode_1.target];
|
|
400
386
|
const actualField = obj === undefined ? this : obj;
|
|
401
387
|
actualField.ruleEngine.trackDependency(actualField);
|
|
402
388
|
return actualField._jsonModel.value || null;
|
|
403
389
|
}
|
|
404
390
|
toString() {
|
|
405
|
-
|
|
391
|
+
var _a;
|
|
392
|
+
const obj = this[BaseNode_1.target];
|
|
406
393
|
const actualField = obj === undefined ? this : obj;
|
|
407
|
-
return actualField._jsonModel.value
|
|
394
|
+
return ((_a = actualField._jsonModel.value) === null || _a === void 0 ? void 0 : _a.toString()) || '';
|
|
408
395
|
}
|
|
409
396
|
getErrorMessage(constraint) {
|
|
410
|
-
|
|
397
|
+
var _a;
|
|
398
|
+
return ((_a = this._jsonModel.constraintMessages) === null || _a === void 0 ? void 0 : _a[constraint]) || '';
|
|
411
399
|
}
|
|
412
400
|
get errorMessage() {
|
|
413
401
|
return this._jsonModel.errorMessage;
|
|
@@ -416,7 +404,7 @@ class Field extends Scriptable {
|
|
|
416
404
|
return this._jsonModel.screenReaderText;
|
|
417
405
|
}
|
|
418
406
|
_getConstraintObject() {
|
|
419
|
-
return Constraints;
|
|
407
|
+
return ValidationUtils_1.Constraints;
|
|
420
408
|
}
|
|
421
409
|
isArrayType() {
|
|
422
410
|
return this.type ? this.type.indexOf('[]') > -1 : false;
|
|
@@ -434,10 +422,11 @@ class Field extends Scriptable {
|
|
|
434
422
|
return true;
|
|
435
423
|
}
|
|
436
424
|
checkStep() {
|
|
425
|
+
var _a, _b;
|
|
437
426
|
const value = this._jsonModel.value;
|
|
438
427
|
const step = this._jsonModel.step;
|
|
439
428
|
if (typeof step === 'number') {
|
|
440
|
-
const prec = step.toString().split('.')
|
|
429
|
+
const prec = ((_b = (_a = step.toString().split('.')) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.length) || 0;
|
|
441
430
|
const factor = Math.pow(10, prec);
|
|
442
431
|
const fStep = step * factor;
|
|
443
432
|
const fVal = value * factor;
|
|
@@ -471,22 +460,22 @@ class Field extends Scriptable {
|
|
|
471
460
|
case 'string':
|
|
472
461
|
switch (this.format) {
|
|
473
462
|
case 'date':
|
|
474
|
-
return ValidConstraints.date;
|
|
463
|
+
return ValidationUtils_1.ValidConstraints.date;
|
|
475
464
|
case 'binary':
|
|
476
|
-
return ValidConstraints.file;
|
|
465
|
+
return ValidationUtils_1.ValidConstraints.file;
|
|
477
466
|
case 'data-url':
|
|
478
|
-
return ValidConstraints.file;
|
|
467
|
+
return ValidationUtils_1.ValidConstraints.file;
|
|
479
468
|
default:
|
|
480
|
-
return ValidConstraints.string;
|
|
469
|
+
return ValidationUtils_1.ValidConstraints.string;
|
|
481
470
|
}
|
|
482
471
|
case 'file':
|
|
483
|
-
return ValidConstraints.file;
|
|
472
|
+
return ValidationUtils_1.ValidConstraints.file;
|
|
484
473
|
case 'number':
|
|
485
474
|
case 'integer':
|
|
486
|
-
return ValidConstraints.number;
|
|
475
|
+
return ValidationUtils_1.ValidConstraints.number;
|
|
487
476
|
}
|
|
488
477
|
if (this.isArrayType()) {
|
|
489
|
-
return ValidConstraints.array;
|
|
478
|
+
return ValidationUtils_1.ValidConstraints.array;
|
|
490
479
|
}
|
|
491
480
|
return [];
|
|
492
481
|
}
|
|
@@ -569,7 +558,7 @@ class Field extends Scriptable {
|
|
|
569
558
|
const restriction = elem[key];
|
|
570
559
|
const fn = Constraints[key];
|
|
571
560
|
if (value instanceof Array && this.isArrayType()) {
|
|
572
|
-
if (ValidConstraints.array.indexOf(key) !== -1) {
|
|
561
|
+
if (ValidationUtils_1.ValidConstraints.array.indexOf(key) !== -1) {
|
|
573
562
|
return !fn(restriction, value).valid;
|
|
574
563
|
}
|
|
575
564
|
else {
|
|
@@ -616,10 +605,10 @@ class Field extends Scriptable {
|
|
|
616
605
|
triggerValidationEvent(changes) {
|
|
617
606
|
if (changes.valid) {
|
|
618
607
|
if (this.valid) {
|
|
619
|
-
this.dispatch(new Valid());
|
|
608
|
+
this.dispatch(new Events_1.Valid());
|
|
620
609
|
}
|
|
621
610
|
else {
|
|
622
|
-
this.dispatch(new Invalid());
|
|
611
|
+
this.dispatch(new Events_1.Invalid());
|
|
623
612
|
}
|
|
624
613
|
}
|
|
625
614
|
}
|
|
@@ -627,78 +616,69 @@ class Field extends Scriptable {
|
|
|
627
616
|
const changes = this.evaluateConstraints();
|
|
628
617
|
if (changes.valid) {
|
|
629
618
|
this.triggerValidationEvent(changes);
|
|
630
|
-
this.notifyDependents(new Change({ changes: Object.values(changes) }));
|
|
619
|
+
this.notifyDependents(new Events_1.Change({ changes: Object.values(changes) }));
|
|
631
620
|
}
|
|
632
|
-
return this.valid ? [] : [new ValidationError(this.id, [this._jsonModel.errorMessage])];
|
|
621
|
+
return this.valid ? [] : [new types_1.ValidationError(this.id, [this._jsonModel.errorMessage])];
|
|
633
622
|
}
|
|
634
623
|
importData(contextualDataModel) {
|
|
635
624
|
this._bindToDataModel(contextualDataModel);
|
|
636
625
|
const dataNode = this.getDataNode();
|
|
637
|
-
if (dataNode !== undefined && dataNode !==
|
|
638
|
-
const changeAction = propertyChange('value', dataNode.$value, this._jsonModel.value);
|
|
626
|
+
if (dataNode !== undefined && dataNode !== EmptyDataValue_1.default && dataNode.$value !== this._jsonModel.value) {
|
|
627
|
+
const changeAction = (0, Events_1.propertyChange)('value', dataNode.$value, this._jsonModel.value);
|
|
639
628
|
this._jsonModel.value = dataNode.$value;
|
|
640
629
|
this.queueEvent(changeAction);
|
|
641
630
|
}
|
|
642
631
|
}
|
|
643
632
|
defaultDataModel(name) {
|
|
644
|
-
const value = staticFields.indexOf(this.fieldType) > -1 ? undefined : this.getDataNodeValue(this._jsonModel.value);
|
|
645
|
-
return new
|
|
633
|
+
const value = BaseNode_1.staticFields.indexOf(this.fieldType) > -1 ? undefined : this.getDataNodeValue(this._jsonModel.value);
|
|
634
|
+
return new DataValue_1.default(name, value, this.type || 'string');
|
|
646
635
|
}
|
|
647
636
|
getState() {
|
|
648
|
-
return {
|
|
649
|
-
...super.getState(),
|
|
650
|
-
editFormat: this.editFormat,
|
|
651
|
-
displayFormat: this.displayFormat,
|
|
652
|
-
editValue: this.editValue,
|
|
653
|
-
displayValue: this.displayValue,
|
|
654
|
-
enabled: this.enabled,
|
|
655
|
-
readOnly: this.readOnly
|
|
656
|
-
};
|
|
637
|
+
return Object.assign(Object.assign({}, super.getState()), { editFormat: this.editFormat, displayFormat: this.displayFormat, editValue: this.editValue, displayValue: this.displayValue, enabled: this.enabled, readOnly: this.readOnly });
|
|
657
638
|
}
|
|
658
639
|
}
|
|
659
640
|
__decorate([
|
|
660
|
-
dependencyTracked(),
|
|
661
|
-
exclude('button', 'image', 'plain-text')
|
|
641
|
+
(0, BaseNode_1.dependencyTracked)(),
|
|
642
|
+
(0, BaseNode_1.exclude)('button', 'image', 'plain-text')
|
|
662
643
|
], Field.prototype, "readOnly", null);
|
|
663
644
|
__decorate([
|
|
664
|
-
dependencyTracked(),
|
|
665
|
-
exclude('image', 'plain-text')
|
|
645
|
+
(0, BaseNode_1.dependencyTracked)(),
|
|
646
|
+
(0, BaseNode_1.exclude)('image', 'plain-text')
|
|
666
647
|
], Field.prototype, "enabled", null);
|
|
667
648
|
__decorate([
|
|
668
|
-
dependencyTracked()
|
|
649
|
+
(0, BaseNode_1.dependencyTracked)()
|
|
669
650
|
], Field.prototype, "valid", null);
|
|
670
651
|
__decorate([
|
|
671
|
-
dependencyTracked()
|
|
652
|
+
(0, BaseNode_1.dependencyTracked)()
|
|
672
653
|
], Field.prototype, "enum", null);
|
|
673
654
|
__decorate([
|
|
674
|
-
dependencyTracked()
|
|
655
|
+
(0, BaseNode_1.dependencyTracked)()
|
|
675
656
|
], Field.prototype, "enumNames", null);
|
|
676
657
|
__decorate([
|
|
677
|
-
dependencyTracked()
|
|
658
|
+
(0, BaseNode_1.dependencyTracked)()
|
|
678
659
|
], Field.prototype, "required", null);
|
|
679
660
|
__decorate([
|
|
680
|
-
include('date-input', 'number-input')
|
|
661
|
+
(0, BaseNode_1.include)('date-input', 'number-input')
|
|
681
662
|
], Field.prototype, "editValue", null);
|
|
682
663
|
__decorate([
|
|
683
|
-
dependencyTracked()
|
|
664
|
+
(0, BaseNode_1.dependencyTracked)()
|
|
684
665
|
], Field.prototype, "value", null);
|
|
685
666
|
__decorate([
|
|
686
|
-
include('text-input', 'date-input', 'file-input')
|
|
667
|
+
(0, BaseNode_1.include)('text-input', 'date-input', 'file-input')
|
|
687
668
|
], Field.prototype, "format", null);
|
|
688
669
|
__decorate([
|
|
689
|
-
include('text-input')
|
|
670
|
+
(0, BaseNode_1.include)('text-input')
|
|
690
671
|
], Field.prototype, "maxLength", null);
|
|
691
672
|
__decorate([
|
|
692
|
-
include('text-input')
|
|
673
|
+
(0, BaseNode_1.include)('text-input')
|
|
693
674
|
], Field.prototype, "minLength", null);
|
|
694
675
|
__decorate([
|
|
695
|
-
include('text-input')
|
|
676
|
+
(0, BaseNode_1.include)('text-input')
|
|
696
677
|
], Field.prototype, "pattern", null);
|
|
697
678
|
__decorate([
|
|
698
|
-
dependencyTracked()
|
|
679
|
+
(0, BaseNode_1.dependencyTracked)()
|
|
699
680
|
], Field.prototype, "exclusiveMinimum", null);
|
|
700
681
|
__decorate([
|
|
701
|
-
dependencyTracked()
|
|
682
|
+
(0, BaseNode_1.dependencyTracked)()
|
|
702
683
|
], Field.prototype, "exclusiveMaximum", null);
|
|
703
|
-
|
|
704
|
-
export { Field as default };
|
|
684
|
+
exports.default = Field;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Container from './Container
|
|
2
|
-
import { Action, ContainerModel, FieldModel, FieldsetJson, FieldsetModel, FormModel, IFormFieldFactory } from './types/index
|
|
1
|
+
import Container from './Container';
|
|
2
|
+
import { Action, ContainerModel, FieldModel, FieldsetJson, FieldsetModel, FormModel, IFormFieldFactory } from './types/index';
|
|
3
3
|
export declare class Fieldset extends Container<FieldsetJson> implements FieldsetModel {
|
|
4
4
|
constructor(params: FieldsetJson, _options: {
|
|
5
5
|
form: FormModel;
|
|
@@ -20,8 +20,8 @@ export declare class Fieldset extends Container<FieldsetJson> implements Fieldse
|
|
|
20
20
|
enabled: boolean | undefined;
|
|
21
21
|
readOnly: boolean | undefined;
|
|
22
22
|
description?: string | undefined;
|
|
23
|
-
rules: import("./types/Json
|
|
24
|
-
events: import("./types/Json
|
|
23
|
+
rules: import("./types/Json").Items<string> & {};
|
|
24
|
+
events: import("./types/Json").Items<string | string[] | undefined> & {};
|
|
25
25
|
enumNames?: string[] | undefined;
|
|
26
26
|
enum?: any[] | undefined;
|
|
27
27
|
accept?: string[] | undefined;
|
|
@@ -47,10 +47,10 @@ export declare class Fieldset extends Container<FieldsetJson> implements Fieldse
|
|
|
47
47
|
dataRef?: string | null | undefined;
|
|
48
48
|
lang?: string | undefined;
|
|
49
49
|
':type': string;
|
|
50
|
-
label?: import("./types/Json
|
|
50
|
+
label?: import("./types/Json").Label | undefined;
|
|
51
51
|
visible?: boolean | undefined;
|
|
52
52
|
name?: string | undefined;
|
|
53
|
-
constraintMessages?: import("./types/Json
|
|
53
|
+
constraintMessages?: import("./types/Json").ConstraintsMessages | undefined;
|
|
54
54
|
fieldType?: string | undefined;
|
|
55
55
|
errorMessage?: string | undefined;
|
|
56
56
|
properties: {
|
|
@@ -61,7 +61,7 @@ export declare class Fieldset extends Container<FieldsetJson> implements Fieldse
|
|
|
61
61
|
tooltip?: string | undefined;
|
|
62
62
|
altText?: string | undefined;
|
|
63
63
|
viewType?: string | undefined;
|
|
64
|
-
items: (import("./types/Json
|
|
64
|
+
items: (import("./types/Json").FieldJson | import("./types/Json").ContainerJson)[] & any[];
|
|
65
65
|
initialItems?: number | undefined;
|
|
66
66
|
activeChild?: string | undefined;
|
|
67
67
|
index: number;
|
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 Container from './Container.js';
|
|
22
|
-
import { Initialize, ExecuteRule, propertyChange } from './controller/Events.js';
|
|
23
|
-
import './BaseNode-f84b22c6.js';
|
|
24
|
-
import './utils/DataRefParser.js';
|
|
25
|
-
import './data/DataGroup.js';
|
|
26
|
-
import './data/DataValue.js';
|
|
27
|
-
import './data/EmptyDataValue.js';
|
|
28
|
-
import './utils/JsonUtils.js';
|
|
29
|
-
import './types/Json.js';
|
|
30
|
-
import './utils/SchemaUtils.js';
|
|
31
|
-
import './Scriptable.js';
|
|
32
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Fieldset = void 0;
|
|
7
|
+
const Container_1 = __importDefault(require("./Container"));
|
|
8
|
+
const Events_1 = require("./controller/Events");
|
|
33
9
|
const defaults = {
|
|
34
10
|
visible: true,
|
|
35
11
|
enabled: true
|
|
@@ -37,12 +13,12 @@ const defaults = {
|
|
|
37
13
|
const notifyChildrenAttributes = [
|
|
38
14
|
'readOnly', 'enabled'
|
|
39
15
|
];
|
|
40
|
-
class Fieldset extends
|
|
16
|
+
class Fieldset extends Container_1.default {
|
|
41
17
|
constructor(params, _options) {
|
|
42
18
|
super(params, _options);
|
|
43
19
|
this._applyDefaults();
|
|
44
|
-
this.queueEvent(new Initialize());
|
|
45
|
-
this.queueEvent(new ExecuteRule());
|
|
20
|
+
this.queueEvent(new Events_1.Initialize());
|
|
21
|
+
this.queueEvent(new Events_1.ExecuteRule());
|
|
46
22
|
}
|
|
47
23
|
_applyDefaults() {
|
|
48
24
|
Object.entries(defaults).map(([key, value]) => {
|
|
@@ -97,7 +73,7 @@ class Fieldset extends Container {
|
|
|
97
73
|
for (const change of action.payload.changes) {
|
|
98
74
|
if (change.propertyName !== undefined && notifyChildrenAttributes.includes(change.propertyName)) {
|
|
99
75
|
this.items.forEach((child) => {
|
|
100
|
-
this.notifyDependents.call(child, propertyChange(change.propertyName, child.getState()[change.propertyName], null));
|
|
76
|
+
this.notifyDependents.call(child, (0, Events_1.propertyChange)(change.propertyName, child.getState()[change.propertyName], null));
|
|
101
77
|
if (child.fieldType === 'panel') {
|
|
102
78
|
this.notifyChildren.call(child, action);
|
|
103
79
|
}
|
|
@@ -107,12 +83,7 @@ class Fieldset extends Container {
|
|
|
107
83
|
}
|
|
108
84
|
}
|
|
109
85
|
getState() {
|
|
110
|
-
return {
|
|
111
|
-
...super.getState(),
|
|
112
|
-
enabled: this.enabled,
|
|
113
|
-
readOnly: this.readOnly
|
|
114
|
-
};
|
|
86
|
+
return Object.assign(Object.assign({}, super.getState()), { enabled: this.enabled, readOnly: this.readOnly });
|
|
115
87
|
}
|
|
116
88
|
}
|
|
117
|
-
|
|
118
|
-
export { Fieldset };
|
|
89
|
+
exports.Fieldset = Fieldset;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileObject = void 0;
|
|
4
|
+
class FileObject {
|
|
5
|
+
constructor(init) {
|
|
6
|
+
this.mediaType = 'application/octet-stream';
|
|
7
|
+
this.name = 'unknown';
|
|
8
|
+
this.size = 0;
|
|
9
|
+
Object.assign(this, init);
|
|
10
|
+
}
|
|
11
|
+
get type() {
|
|
12
|
+
return this.mediaType;
|
|
13
|
+
}
|
|
14
|
+
toJSON() {
|
|
15
|
+
return {
|
|
16
|
+
'name': this.name,
|
|
17
|
+
'size': this.size,
|
|
18
|
+
'mediaType': this.mediaType,
|
|
19
|
+
'data': this.data.toString()
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
equals(obj) {
|
|
23
|
+
return (this.data === obj.data &&
|
|
24
|
+
this.mediaType === obj.mediaType &&
|
|
25
|
+
this.name === obj.name &&
|
|
26
|
+
this.size === obj.size);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.FileObject = FileObject;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Field from './Field
|
|
2
|
-
import { FieldModel } from './types/index
|
|
3
|
-
import DataGroup from './data/DataGroup
|
|
1
|
+
import Field from './Field';
|
|
2
|
+
import { FieldModel } from './types/index';
|
|
3
|
+
import DataGroup from './data/DataGroup';
|
|
4
4
|
declare class FileUpload extends Field implements FieldModel {
|
|
5
5
|
protected _getDefaults(): {
|
|
6
6
|
accept: string[];
|