@aemforms/af-core 0.22.94 → 0.22.96
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/esm/{Events-a66f7a2c.js → Events-f062426b.js} +15 -4
- package/esm/afb-events.js +1 -1
- package/esm/afb-runtime.js +21 -13
- package/esm/types/src/Field.d.ts +2 -1
- package/esm/types/src/controller/Events.d.ts +7 -0
- package/esm/types/src/data/DataValue.d.ts +1 -0
- package/esm/types/src/types/Json.d.ts +6 -0
- package/lib/Field.d.ts +2 -1
- package/lib/Field.js +13 -1
- package/lib/controller/Events.d.ts +7 -0
- package/lib/controller/Events.js +7 -1
- package/lib/data/DataGroup.js +3 -7
- package/lib/data/DataValue.d.ts +1 -0
- package/lib/data/DataValue.js +4 -4
- package/lib/types/Json.d.ts +6 -0
- package/lib/types/Json.js +9 -3
- package/package.json +2 -2
|
@@ -13,7 +13,9 @@ const ConstraintType = Object.freeze({
|
|
|
13
13
|
UNIQUE_ITEMS_MISMATCH: 'uniqueItemsMismatch',
|
|
14
14
|
MIN_ITEMS_MISMATCH: 'minItemsMismatch',
|
|
15
15
|
MAX_ITEMS_MISMATCH: 'maxItemsMismatch',
|
|
16
|
-
EXPRESSION_MISMATCH: 'expressionMismatch'
|
|
16
|
+
EXPRESSION_MISMATCH: 'expressionMismatch',
|
|
17
|
+
EXCLUSIVE_MAXIMUM_MISMATCH: 'exclusiveMaximumMismatch',
|
|
18
|
+
EXCLUSIVE_MINIMUM_MISMATCH: 'exclusiveMinimumMismatch'
|
|
17
19
|
});
|
|
18
20
|
const constraintKeys = Object.freeze({
|
|
19
21
|
pattern: ConstraintType.PATTERN_MISMATCH,
|
|
@@ -30,7 +32,9 @@ const constraintKeys = Object.freeze({
|
|
|
30
32
|
uniqueItems: ConstraintType.UNIQUE_ITEMS_MISMATCH,
|
|
31
33
|
minItems: ConstraintType.MIN_ITEMS_MISMATCH,
|
|
32
34
|
maxItems: ConstraintType.MAX_ITEMS_MISMATCH,
|
|
33
|
-
validationExpression: ConstraintType.EXPRESSION_MISMATCH
|
|
35
|
+
validationExpression: ConstraintType.EXPRESSION_MISMATCH,
|
|
36
|
+
exclusiveMinimum: ConstraintType.EXCLUSIVE_MINIMUM_MISMATCH,
|
|
37
|
+
exclusiveMaximum: ConstraintType.EXCLUSIVE_MAXIMUM_MISMATCH
|
|
34
38
|
});
|
|
35
39
|
const defaultConstraintTypeMessages = Object.freeze({
|
|
36
40
|
[ConstraintType.PATTERN_MISMATCH]: 'Please match the format requested.',
|
|
@@ -47,7 +51,9 @@ const defaultConstraintTypeMessages = Object.freeze({
|
|
|
47
51
|
[ConstraintType.UNIQUE_ITEMS_MISMATCH]: 'All the items must be unique.',
|
|
48
52
|
[ConstraintType.MIN_ITEMS_MISMATCH]: 'Specify a number of items equal to or greater than ${0}.',
|
|
49
53
|
[ConstraintType.MAX_ITEMS_MISMATCH]: 'Specify a number of items equal to or less than ${0}.',
|
|
50
|
-
[ConstraintType.EXPRESSION_MISMATCH]: 'Please enter a valid value.'
|
|
54
|
+
[ConstraintType.EXPRESSION_MISMATCH]: 'Please enter a valid value.',
|
|
55
|
+
[ConstraintType.EXCLUSIVE_MINIMUM_MISMATCH]: 'Value must be greater than ${0}.',
|
|
56
|
+
[ConstraintType.EXCLUSIVE_MAXIMUM_MISMATCH]: 'Value must be less than ${0}.'
|
|
51
57
|
});
|
|
52
58
|
let customConstraintTypeMessages = {};
|
|
53
59
|
const getConstraintTypeMessages = () => {
|
|
@@ -132,6 +138,11 @@ class Change extends ActionImpl {
|
|
|
132
138
|
return new Change(this.payload.changes.concat(change.payload.changes), this.metadata);
|
|
133
139
|
}
|
|
134
140
|
}
|
|
141
|
+
class UIChange extends ActionImpl {
|
|
142
|
+
constructor(payload, dispatch = false) {
|
|
143
|
+
super(payload, 'uiChange', { dispatch });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
135
146
|
class Invalid extends ActionImpl {
|
|
136
147
|
constructor(payload = {}) {
|
|
137
148
|
super(payload, 'invalid', {});
|
|
@@ -256,4 +267,4 @@ class RemoveInstance extends ActionImpl {
|
|
|
256
267
|
}
|
|
257
268
|
}
|
|
258
269
|
|
|
259
|
-
export { AddInstance as A, Blur as B, CustomEvent as C, EventSource as E, FormLoad as F, Initialize as I, RemoveItem as R, SubmitSuccess as S, ValidationComplete as V, ExecuteRule as a, SubmitError as b, SubmitFailure as c, CaptchaDisplayMode as d, Submit as e, Save as f, RemoveInstance as g, Reset as h, AddItem as i, Click as j, Change as k, FocusOption as l, FieldChanged as m, constraintKeys as n, getConstraintTypeMessages as o, propertyChange as p, Valid as q, Invalid as r, ValidationError as s, Focus as t };
|
|
270
|
+
export { AddInstance as A, Blur as B, CustomEvent as C, EventSource as E, FormLoad as F, Initialize as I, RemoveItem as R, SubmitSuccess as S, UIChange as U, ValidationComplete as V, ExecuteRule as a, SubmitError as b, SubmitFailure as c, CaptchaDisplayMode as d, Submit as e, Save as f, RemoveInstance as g, Reset as h, AddItem as i, Click as j, Change as k, FocusOption as l, FieldChanged as m, constraintKeys as n, getConstraintTypeMessages as o, propertyChange as p, Valid as q, Invalid as r, ValidationError as s, Focus as t };
|
package/esm/afb-events.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AddInstance, i as AddItem, B as Blur, k as Change, j as Click, C as CustomEvent, a as ExecuteRule, m as FieldChanged, t as Focus, F as FormLoad, I as Initialize, r as Invalid, g as RemoveInstance, R as RemoveItem, h as Reset, f as Save, e as Submit, b as SubmitError, c as SubmitFailure, S as SubmitSuccess, q as Valid, V as ValidationComplete, p as propertyChange } from './Events-
|
|
1
|
+
export { A as AddInstance, i as AddItem, B as Blur, k as Change, j as Click, C as CustomEvent, a as ExecuteRule, m as FieldChanged, t as Focus, F as FormLoad, I as Initialize, r as Invalid, g as RemoveInstance, R as RemoveItem, h as Reset, f as Save, e as Submit, b as SubmitError, c as SubmitFailure, S as SubmitSuccess, U as UIChange, q as Valid, V as ValidationComplete, p as propertyChange } from './Events-f062426b.js';
|
package/esm/afb-runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EventSource, p as propertyChange, a as ExecuteRule, I as Initialize, R as RemoveItem, S as SubmitSuccess, C as CustomEvent, b as SubmitError, c as SubmitFailure, d as CaptchaDisplayMode, e as Submit, f as Save, g as RemoveInstance, A as AddInstance, h as Reset, i as AddItem, j as Click, k as Change, F as FormLoad, l as FocusOption, m as FieldChanged, V as ValidationComplete, n as constraintKeys, o as getConstraintTypeMessages, q as Valid, r as Invalid, s as ValidationError } from './Events-
|
|
1
|
+
import { E as EventSource, p as propertyChange, a as ExecuteRule, I as Initialize, R as RemoveItem, S as SubmitSuccess, C as CustomEvent, b as SubmitError, c as SubmitFailure, d as CaptchaDisplayMode, e as Submit, f as Save, g as RemoveInstance, A as AddInstance, h as Reset, i as AddItem, j as Click, k as Change, F as FormLoad, l as FocusOption, m as FieldChanged, V as ValidationComplete, n as constraintKeys, o as getConstraintTypeMessages, q as Valid, r as Invalid, s as ValidationError } from './Events-f062426b.js';
|
|
2
2
|
import Formula from '@adobe/json-formula';
|
|
3
3
|
import { parseDefaultDate, datetimeToNumber, format, parseDateSkeleton, formatDate, numberToDatetime, parseDate } from '@aemforms/af-formatters';
|
|
4
4
|
|
|
@@ -125,11 +125,11 @@ class DataValue {
|
|
|
125
125
|
get $name() {
|
|
126
126
|
return this.$_name;
|
|
127
127
|
}
|
|
128
|
-
get
|
|
128
|
+
get disabled() {
|
|
129
129
|
const enabled = this.$_fields.find(x => x.enabled !== false);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
return (!enabled && this.$_fields.length);
|
|
131
|
+
}
|
|
132
|
+
get $value() {
|
|
133
133
|
return this.$_value;
|
|
134
134
|
}
|
|
135
135
|
setValue(typedValue, originalValue, fromField) {
|
|
@@ -209,15 +209,11 @@ class DataGroup extends DataValue {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
get $value() {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
return this.$type === 'array' ? [] : {};
|
|
215
|
-
}
|
|
216
|
-
else if (this.$type === 'array') {
|
|
217
|
-
return Object.values(this.$_items).filter(x => typeof x !== 'undefined').map(x => x.$value);
|
|
212
|
+
if (this.$type === 'array') {
|
|
213
|
+
return Object.values(this.$_items).filter(x => typeof x !== 'undefined' && !x.disabled).map(x => x.$value);
|
|
218
214
|
}
|
|
219
215
|
else {
|
|
220
|
-
return Object.fromEntries(Object.values(this.$_items).filter(x => typeof x !== 'undefined').map(x => {
|
|
216
|
+
return Object.fromEntries(Object.values(this.$_items).filter(x => typeof x !== 'undefined' && !x.disabled).map(x => {
|
|
221
217
|
return [x.$name, x.$value];
|
|
222
218
|
}));
|
|
223
219
|
}
|
|
@@ -3791,6 +3787,16 @@ class Field extends Scriptable {
|
|
|
3791
3787
|
this.dispatch(changeAction);
|
|
3792
3788
|
}
|
|
3793
3789
|
}
|
|
3790
|
+
uiChange(action) {
|
|
3791
|
+
this._eventSource = EventSource.UI;
|
|
3792
|
+
if ('value' in action.payload) {
|
|
3793
|
+
this.value = action.payload.value;
|
|
3794
|
+
}
|
|
3795
|
+
else if ('checked' in action.payload) {
|
|
3796
|
+
this.checked = action.payload.checked;
|
|
3797
|
+
}
|
|
3798
|
+
this._eventSource = EventSource.CODE;
|
|
3799
|
+
}
|
|
3794
3800
|
reset() {
|
|
3795
3801
|
const changes = this.updateDataNodeAndTypedValue(this.default);
|
|
3796
3802
|
if (!changes) {
|
|
@@ -3843,7 +3849,9 @@ class Field extends Scriptable {
|
|
|
3843
3849
|
const afConstraintKey = constraint;
|
|
3844
3850
|
const html5ConstraintType = constraintKeys[afConstraintKey];
|
|
3845
3851
|
const constraintTypeMessages = getConstraintTypeMessages();
|
|
3846
|
-
return this._jsonModel.constraintMessages?.[afConstraintKey
|
|
3852
|
+
return this._jsonModel.constraintMessages?.[afConstraintKey === 'exclusiveMaximum' ? 'maximum' :
|
|
3853
|
+
afConstraintKey === 'exclusiveMinimum' ? 'minimum' :
|
|
3854
|
+
afConstraintKey]
|
|
3847
3855
|
|| replaceTemplatePlaceholders(constraintTypeMessages[html5ConstraintType], [this._jsonModel[afConstraintKey]]);
|
|
3848
3856
|
}
|
|
3849
3857
|
get errorMessage() {
|
package/esm/types/src/Field.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
|
|
1
|
+
import { Action, ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
|
|
2
2
|
import Scriptable from './Scriptable';
|
|
3
3
|
import DataValue from './data/DataValue';
|
|
4
4
|
import DataGroup from './data/DataGroup';
|
|
@@ -56,6 +56,7 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
56
56
|
protected updateDataNodeAndTypedValue(val: any): any;
|
|
57
57
|
get value(): any;
|
|
58
58
|
set value(v: any);
|
|
59
|
+
uiChange(action: Action): void;
|
|
59
60
|
reset(): void;
|
|
60
61
|
protected _updateRuleNodeReference(value: any): void;
|
|
61
62
|
protected getInternalType(): string | undefined;
|
|
@@ -28,10 +28,17 @@ export type ChangePayload = {
|
|
|
28
28
|
}>;
|
|
29
29
|
eventSource?: EventSource;
|
|
30
30
|
};
|
|
31
|
+
export type UIChangePayload = {
|
|
32
|
+
value?: any;
|
|
33
|
+
checked?: boolean;
|
|
34
|
+
};
|
|
31
35
|
export declare class Change extends ActionImpl {
|
|
32
36
|
constructor(payload: ChangePayload, dispatch?: boolean);
|
|
33
37
|
withAdditionalChange(change: Change): Change;
|
|
34
38
|
}
|
|
39
|
+
export declare class UIChange extends ActionImpl {
|
|
40
|
+
constructor(payload: UIChangePayload, dispatch?: boolean);
|
|
41
|
+
}
|
|
35
42
|
export declare class Invalid extends ActionImpl {
|
|
36
43
|
constructor(payload?: any);
|
|
37
44
|
}
|
|
@@ -7,6 +7,7 @@ export default class DataValue {
|
|
|
7
7
|
constructor($_name: string | number, $_value: any, $_type?: string);
|
|
8
8
|
valueOf(): any;
|
|
9
9
|
get $name(): string | number;
|
|
10
|
+
get disabled(): number | false;
|
|
10
11
|
get $value(): any;
|
|
11
12
|
setValue(typedValue: any, originalValue: any, fromField: FieldModel): void;
|
|
12
13
|
get $type(): string;
|
|
@@ -146,6 +146,8 @@ export declare const ConstraintType: Readonly<{
|
|
|
146
146
|
MIN_ITEMS_MISMATCH: "minItemsMismatch";
|
|
147
147
|
MAX_ITEMS_MISMATCH: "maxItemsMismatch";
|
|
148
148
|
EXPRESSION_MISMATCH: "expressionMismatch";
|
|
149
|
+
EXCLUSIVE_MAXIMUM_MISMATCH: "exclusiveMaximumMismatch";
|
|
150
|
+
EXCLUSIVE_MINIMUM_MISMATCH: "exclusiveMinimumMismatch";
|
|
149
151
|
}>;
|
|
150
152
|
export declare const constraintKeys: Readonly<{
|
|
151
153
|
pattern: "patternMismatch";
|
|
@@ -163,6 +165,8 @@ export declare const constraintKeys: Readonly<{
|
|
|
163
165
|
minItems: "minItemsMismatch";
|
|
164
166
|
maxItems: "maxItemsMismatch";
|
|
165
167
|
validationExpression: "expressionMismatch";
|
|
168
|
+
exclusiveMinimum: "exclusiveMinimumMismatch";
|
|
169
|
+
exclusiveMaximum: "exclusiveMaximumMismatch";
|
|
166
170
|
}>;
|
|
167
171
|
export declare const setCustomDefaultConstraintTypeMessages: (messages: Record<string, string>) => void;
|
|
168
172
|
export declare const getConstraintTypeMessages: () => {
|
|
@@ -181,5 +185,7 @@ export declare const getConstraintTypeMessages: () => {
|
|
|
181
185
|
minItemsMismatch: "Specify a number of items equal to or greater than ${0}.";
|
|
182
186
|
maxItemsMismatch: "Specify a number of items equal to or less than ${0}.";
|
|
183
187
|
expressionMismatch: "Please enter a valid value.";
|
|
188
|
+
exclusiveMinimumMismatch: "Value must be greater than ${0}.";
|
|
189
|
+
exclusiveMaximumMismatch: "Value must be less than ${0}.";
|
|
184
190
|
};
|
|
185
191
|
export {};
|
package/lib/Field.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
|
|
1
|
+
import { Action, ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
|
|
2
2
|
import Scriptable from './Scriptable';
|
|
3
3
|
import DataValue from './data/DataValue';
|
|
4
4
|
import DataGroup from './data/DataGroup';
|
|
@@ -56,6 +56,7 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
56
56
|
protected updateDataNodeAndTypedValue(val: any): any;
|
|
57
57
|
get value(): any;
|
|
58
58
|
set value(v: any);
|
|
59
|
+
uiChange(action: Action): void;
|
|
59
60
|
reset(): void;
|
|
60
61
|
protected _updateRuleNodeReference(value: any): void;
|
|
61
62
|
protected getInternalType(): string | undefined;
|
package/lib/Field.js
CHANGED
|
@@ -386,6 +386,16 @@ class Field extends Scriptable_1.default {
|
|
|
386
386
|
this.dispatch(changeAction);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
+
uiChange(action) {
|
|
390
|
+
this._eventSource = types_1.EventSource.UI;
|
|
391
|
+
if ('value' in action.payload) {
|
|
392
|
+
this.value = action.payload.value;
|
|
393
|
+
}
|
|
394
|
+
else if ('checked' in action.payload) {
|
|
395
|
+
this.checked = action.payload.checked;
|
|
396
|
+
}
|
|
397
|
+
this._eventSource = types_1.EventSource.CODE;
|
|
398
|
+
}
|
|
389
399
|
reset() {
|
|
390
400
|
const changes = this.updateDataNodeAndTypedValue(this.default);
|
|
391
401
|
if (!changes) {
|
|
@@ -441,7 +451,9 @@ class Field extends Scriptable_1.default {
|
|
|
441
451
|
const afConstraintKey = constraint;
|
|
442
452
|
const html5ConstraintType = types_1.constraintKeys[afConstraintKey];
|
|
443
453
|
const constraintTypeMessages = (0, types_1.getConstraintTypeMessages)();
|
|
444
|
-
return ((_a = this._jsonModel.constraintMessages) === null || _a === void 0 ? void 0 : _a[afConstraintKey
|
|
454
|
+
return ((_a = this._jsonModel.constraintMessages) === null || _a === void 0 ? void 0 : _a[afConstraintKey === 'exclusiveMaximum' ? 'maximum' :
|
|
455
|
+
afConstraintKey === 'exclusiveMinimum' ? 'minimum' :
|
|
456
|
+
afConstraintKey])
|
|
445
457
|
|| (0, FormUtils_1.replaceTemplatePlaceholders)(constraintTypeMessages[html5ConstraintType], [this._jsonModel[afConstraintKey]]);
|
|
446
458
|
}
|
|
447
459
|
get errorMessage() {
|
|
@@ -28,10 +28,17 @@ export declare type ChangePayload = {
|
|
|
28
28
|
}>;
|
|
29
29
|
eventSource?: EventSource;
|
|
30
30
|
};
|
|
31
|
+
export declare type UIChangePayload = {
|
|
32
|
+
value?: any;
|
|
33
|
+
checked?: boolean;
|
|
34
|
+
};
|
|
31
35
|
export declare class Change extends ActionImpl {
|
|
32
36
|
constructor(payload: ChangePayload, dispatch?: boolean);
|
|
33
37
|
withAdditionalChange(change: Change): Change;
|
|
34
38
|
}
|
|
39
|
+
export declare class UIChange extends ActionImpl {
|
|
40
|
+
constructor(payload: UIChangePayload, dispatch?: boolean);
|
|
41
|
+
}
|
|
35
42
|
export declare class Invalid extends ActionImpl {
|
|
36
43
|
constructor(payload?: any);
|
|
37
44
|
}
|
package/lib/controller/Events.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RemoveInstance = exports.AddInstance = exports.RemoveItem = exports.AddItem = exports.CustomEvent = exports.FieldChanged = exports.Reset = exports.SubmitError = exports.SubmitFailure = exports.SubmitSuccess = exports.Save = exports.Submit = exports.Focus = exports.ValidationComplete = exports.Blur = exports.Click = exports.FormLoad = exports.Initialize = exports.propertyChange = exports.ExecuteRule = exports.Valid = exports.Invalid = exports.Change = void 0;
|
|
3
|
+
exports.RemoveInstance = exports.AddInstance = exports.RemoveItem = exports.AddItem = exports.CustomEvent = exports.FieldChanged = exports.Reset = exports.SubmitError = exports.SubmitFailure = exports.SubmitSuccess = exports.Save = exports.Submit = exports.Focus = exports.ValidationComplete = exports.Blur = exports.Click = exports.FormLoad = exports.Initialize = exports.propertyChange = exports.ExecuteRule = exports.Valid = exports.Invalid = exports.UIChange = exports.Change = void 0;
|
|
4
4
|
const index_1 = require("../types/index");
|
|
5
5
|
class ActionImpl {
|
|
6
6
|
constructor(payload, type, _metadata) {
|
|
@@ -49,6 +49,12 @@ class Change extends ActionImpl {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
exports.Change = Change;
|
|
52
|
+
class UIChange extends ActionImpl {
|
|
53
|
+
constructor(payload, dispatch = false) {
|
|
54
|
+
super(payload, 'uiChange', { dispatch });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.UIChange = UIChange;
|
|
52
58
|
class Invalid extends ActionImpl {
|
|
53
59
|
constructor(payload = {}) {
|
|
54
60
|
super(payload, 'invalid', {});
|
package/lib/data/DataGroup.js
CHANGED
|
@@ -29,15 +29,11 @@ class DataGroup extends DataValue_1.default {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
get $value() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return this.$type === 'array' ? [] : {};
|
|
35
|
-
}
|
|
36
|
-
else if (this.$type === 'array') {
|
|
37
|
-
return Object.values(this.$_items).filter(x => typeof x !== 'undefined').map(x => x.$value);
|
|
32
|
+
if (this.$type === 'array') {
|
|
33
|
+
return Object.values(this.$_items).filter(x => typeof x !== 'undefined' && !x.disabled).map(x => x.$value);
|
|
38
34
|
}
|
|
39
35
|
else {
|
|
40
|
-
return Object.fromEntries(Object.values(this.$_items).filter(x => typeof x !== 'undefined').map(x => {
|
|
36
|
+
return Object.fromEntries(Object.values(this.$_items).filter(x => typeof x !== 'undefined' && !x.disabled).map(x => {
|
|
41
37
|
return [x.$name, x.$value];
|
|
42
38
|
}));
|
|
43
39
|
}
|
package/lib/data/DataValue.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export default class DataValue {
|
|
|
7
7
|
constructor($_name: string | number, $_value: any, $_type?: string);
|
|
8
8
|
valueOf(): any;
|
|
9
9
|
get $name(): string | number;
|
|
10
|
+
get disabled(): number | false;
|
|
10
11
|
get $value(): any;
|
|
11
12
|
setValue(typedValue: any, originalValue: any, fromField: FieldModel): void;
|
|
12
13
|
get $type(): string;
|
package/lib/data/DataValue.js
CHANGED
|
@@ -13,11 +13,11 @@ class DataValue {
|
|
|
13
13
|
get $name() {
|
|
14
14
|
return this.$_name;
|
|
15
15
|
}
|
|
16
|
-
get
|
|
16
|
+
get disabled() {
|
|
17
17
|
const enabled = this.$_fields.find(x => x.enabled !== false);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
return (!enabled && this.$_fields.length);
|
|
19
|
+
}
|
|
20
|
+
get $value() {
|
|
21
21
|
return this.$_value;
|
|
22
22
|
}
|
|
23
23
|
setValue(typedValue, originalValue, fromField) {
|
package/lib/types/Json.d.ts
CHANGED
|
@@ -146,6 +146,8 @@ export declare const ConstraintType: Readonly<{
|
|
|
146
146
|
MIN_ITEMS_MISMATCH: "minItemsMismatch";
|
|
147
147
|
MAX_ITEMS_MISMATCH: "maxItemsMismatch";
|
|
148
148
|
EXPRESSION_MISMATCH: "expressionMismatch";
|
|
149
|
+
EXCLUSIVE_MAXIMUM_MISMATCH: "exclusiveMaximumMismatch";
|
|
150
|
+
EXCLUSIVE_MINIMUM_MISMATCH: "exclusiveMinimumMismatch";
|
|
149
151
|
}>;
|
|
150
152
|
export declare const constraintKeys: Readonly<{
|
|
151
153
|
pattern: "patternMismatch";
|
|
@@ -163,6 +165,8 @@ export declare const constraintKeys: Readonly<{
|
|
|
163
165
|
minItems: "minItemsMismatch";
|
|
164
166
|
maxItems: "maxItemsMismatch";
|
|
165
167
|
validationExpression: "expressionMismatch";
|
|
168
|
+
exclusiveMinimum: "exclusiveMinimumMismatch";
|
|
169
|
+
exclusiveMaximum: "exclusiveMaximumMismatch";
|
|
166
170
|
}>;
|
|
167
171
|
export declare const setCustomDefaultConstraintTypeMessages: (messages: Record<string, string>) => void;
|
|
168
172
|
export declare const getConstraintTypeMessages: () => {
|
|
@@ -181,5 +185,7 @@ export declare const getConstraintTypeMessages: () => {
|
|
|
181
185
|
minItemsMismatch: "Specify a number of items equal to or greater than ${0}.";
|
|
182
186
|
maxItemsMismatch: "Specify a number of items equal to or less than ${0}.";
|
|
183
187
|
expressionMismatch: "Please enter a valid value.";
|
|
188
|
+
exclusiveMinimumMismatch: "Value must be greater than ${0}.";
|
|
189
|
+
exclusiveMaximumMismatch: "Value must be less than ${0}.";
|
|
184
190
|
};
|
|
185
191
|
export {};
|
package/lib/types/Json.js
CHANGED
|
@@ -23,7 +23,9 @@ exports.ConstraintType = Object.freeze({
|
|
|
23
23
|
UNIQUE_ITEMS_MISMATCH: 'uniqueItemsMismatch',
|
|
24
24
|
MIN_ITEMS_MISMATCH: 'minItemsMismatch',
|
|
25
25
|
MAX_ITEMS_MISMATCH: 'maxItemsMismatch',
|
|
26
|
-
EXPRESSION_MISMATCH: 'expressionMismatch'
|
|
26
|
+
EXPRESSION_MISMATCH: 'expressionMismatch',
|
|
27
|
+
EXCLUSIVE_MAXIMUM_MISMATCH: 'exclusiveMaximumMismatch',
|
|
28
|
+
EXCLUSIVE_MINIMUM_MISMATCH: 'exclusiveMinimumMismatch'
|
|
27
29
|
});
|
|
28
30
|
exports.constraintKeys = Object.freeze({
|
|
29
31
|
pattern: exports.ConstraintType.PATTERN_MISMATCH,
|
|
@@ -40,7 +42,9 @@ exports.constraintKeys = Object.freeze({
|
|
|
40
42
|
uniqueItems: exports.ConstraintType.UNIQUE_ITEMS_MISMATCH,
|
|
41
43
|
minItems: exports.ConstraintType.MIN_ITEMS_MISMATCH,
|
|
42
44
|
maxItems: exports.ConstraintType.MAX_ITEMS_MISMATCH,
|
|
43
|
-
validationExpression: exports.ConstraintType.EXPRESSION_MISMATCH
|
|
45
|
+
validationExpression: exports.ConstraintType.EXPRESSION_MISMATCH,
|
|
46
|
+
exclusiveMinimum: exports.ConstraintType.EXCLUSIVE_MINIMUM_MISMATCH,
|
|
47
|
+
exclusiveMaximum: exports.ConstraintType.EXCLUSIVE_MAXIMUM_MISMATCH
|
|
44
48
|
});
|
|
45
49
|
const defaultConstraintTypeMessages = Object.freeze({
|
|
46
50
|
[exports.ConstraintType.PATTERN_MISMATCH]: 'Please match the format requested.',
|
|
@@ -57,7 +61,9 @@ const defaultConstraintTypeMessages = Object.freeze({
|
|
|
57
61
|
[exports.ConstraintType.UNIQUE_ITEMS_MISMATCH]: 'All the items must be unique.',
|
|
58
62
|
[exports.ConstraintType.MIN_ITEMS_MISMATCH]: 'Specify a number of items equal to or greater than ${0}.',
|
|
59
63
|
[exports.ConstraintType.MAX_ITEMS_MISMATCH]: 'Specify a number of items equal to or less than ${0}.',
|
|
60
|
-
[exports.ConstraintType.EXPRESSION_MISMATCH]: 'Please enter a valid value.'
|
|
64
|
+
[exports.ConstraintType.EXPRESSION_MISMATCH]: 'Please enter a valid value.',
|
|
65
|
+
[exports.ConstraintType.EXCLUSIVE_MINIMUM_MISMATCH]: 'Value must be greater than ${0}.',
|
|
66
|
+
[exports.ConstraintType.EXCLUSIVE_MAXIMUM_MISMATCH]: 'Value must be less than ${0}.'
|
|
61
67
|
});
|
|
62
68
|
const transformObjectKeys = (obj, transformer) => {
|
|
63
69
|
if (typeof obj !== 'object' || obj === null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.96",
|
|
4
4
|
"description": "Core Module for Forms Runtime",
|
|
5
5
|
"author": "Adobe Systems",
|
|
6
6
|
"license": "Adobe Proprietary",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@adobe/json-formula": "0.1.50",
|
|
40
|
-
"@aemforms/af-formatters": "^0.22.
|
|
40
|
+
"@aemforms/af-formatters": "^0.22.96"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|