@aemforms/af-core 0.22.95 → 0.22.97

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.
@@ -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 = () => {
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, U as UIChange, q as Valid, V as ValidationComplete, p as propertyChange } from './Events-536ca954.js';
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';
@@ -1,6 +1,6 @@
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-536ca954.js';
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
- import { parseDefaultDate, datetimeToNumber, format, parseDateSkeleton, formatDate, numberToDatetime, parseDate } from '@aemforms/af-formatters';
3
+ import { parseDefaultDate, datetimeToNumber, format, parseDateSkeleton, numberToDatetime, formatDate, parseDate } from '@aemforms/af-formatters';
4
4
 
5
5
  function __decorate(decorators, target, key, desc) {
6
6
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -125,11 +125,11 @@ class DataValue {
125
125
  get $name() {
126
126
  return this.$_name;
127
127
  }
128
- get $value() {
128
+ get disabled() {
129
129
  const enabled = this.$_fields.find(x => x.enabled !== false);
130
- if (!enabled && this.$_fields.length) {
131
- return undefined;
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
- const enabled = this.$_fields.find(x => x.enabled !== false);
213
- if (!enabled && this.$_fields.length) {
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
  }
@@ -3853,7 +3849,9 @@ class Field extends Scriptable {
3853
3849
  const afConstraintKey = constraint;
3854
3850
  const html5ConstraintType = constraintKeys[afConstraintKey];
3855
3851
  const constraintTypeMessages = getConstraintTypeMessages();
3856
- return this._jsonModel.constraintMessages?.[afConstraintKey]
3852
+ return this._jsonModel.constraintMessages?.[afConstraintKey === 'exclusiveMaximum' ? 'maximum' :
3853
+ afConstraintKey === 'exclusiveMinimum' ? 'minimum' :
3854
+ afConstraintKey]
3857
3855
  || replaceTemplatePlaceholders(constraintTypeMessages[html5ConstraintType], [this._jsonModel[afConstraintKey]]);
3858
3856
  }
3859
3857
  get errorMessage() {
@@ -4403,9 +4401,6 @@ class DateField extends Field {
4403
4401
  if (!this._jsonModel.placeholder) {
4404
4402
  this._jsonModel.placeholder = parseDateSkeleton(this._jsonModel.editFormat, this.locale);
4405
4403
  }
4406
- if (!this._jsonModel.description) {
4407
- this._jsonModel.description = `To enter today's date use ${formatDate(new Date(), this.locale, this._jsonModel.editFormat)}`;
4408
- }
4409
4404
  }
4410
4405
  get value() {
4411
4406
  return super.value;
@@ -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/DateField.js CHANGED
@@ -22,9 +22,6 @@ class DateField extends Field_1.default {
22
22
  if (!this._jsonModel.placeholder) {
23
23
  this._jsonModel.placeholder = (0, af_formatters_1.parseDateSkeleton)(this._jsonModel.editFormat, this.locale);
24
24
  }
25
- if (!this._jsonModel.description) {
26
- this._jsonModel.description = `To enter today's date use ${(0, af_formatters_1.formatDate)(new Date(), this.locale, this._jsonModel.editFormat)}`;
27
- }
28
25
  }
29
26
  get value() {
30
27
  return super.value;
package/lib/Field.js CHANGED
@@ -451,7 +451,9 @@ class Field extends Scriptable_1.default {
451
451
  const afConstraintKey = constraint;
452
452
  const html5ConstraintType = types_1.constraintKeys[afConstraintKey];
453
453
  const constraintTypeMessages = (0, types_1.getConstraintTypeMessages)();
454
- 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])
455
457
  || (0, FormUtils_1.replaceTemplatePlaceholders)(constraintTypeMessages[html5ConstraintType], [this._jsonModel[afConstraintKey]]);
456
458
  }
457
459
  get errorMessage() {
@@ -29,15 +29,11 @@ class DataGroup extends DataValue_1.default {
29
29
  }
30
30
  }
31
31
  get $value() {
32
- const enabled = this.$_fields.find(x => x.enabled !== false);
33
- if (!enabled && this.$_fields.length) {
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
  }
@@ -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;
@@ -13,11 +13,11 @@ class DataValue {
13
13
  get $name() {
14
14
  return this.$_name;
15
15
  }
16
- get $value() {
16
+ get disabled() {
17
17
  const enabled = this.$_fields.find(x => x.enabled !== false);
18
- if (!enabled && this.$_fields.length) {
19
- return undefined;
20
- }
18
+ return (!enabled && this.$_fields.length);
19
+ }
20
+ get $value() {
21
21
  return this.$_value;
22
22
  }
23
23
  setValue(typedValue, originalValue, fromField) {
@@ -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.95",
3
+ "version": "0.22.97",
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.95"
40
+ "@aemforms/af-formatters": "^0.22.97"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",