@aemforms/af-core 0.22.121 → 0.22.122
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/afb-events.js +11 -1
- package/esm/afb-runtime.js +38 -8
- package/esm/types/src/DateField.d.ts +1 -1
- package/esm/types/src/DateTimeField.d.ts +8 -0
- package/esm/types/src/controller/Events.d.ts +6 -0
- package/esm/types/src/utils/JsonUtils.d.ts +1 -0
- package/esm/types/src/utils/ValidationUtils.d.ts +1 -0
- package/lib/DateField.d.ts +1 -1
- package/lib/DateTimeField.d.ts +8 -0
- package/lib/DateTimeField.js +22 -0
- package/lib/Field.js +12 -6
- package/lib/Scriptable.js +1 -0
- package/lib/controller/Events.d.ts +6 -0
- package/lib/controller/Events.js +13 -1
- package/lib/rules/FunctionRuntime.js +2 -0
- package/lib/utils/FormCreationUtils.js +4 -0
- package/lib/utils/JsonUtils.d.ts +1 -0
- package/lib/utils/JsonUtils.js +6 -1
- package/lib/utils/ValidationUtils.d.ts +1 -0
- package/lib/utils/ValidationUtils.js +2 -1
- package/package.json +2 -2
package/esm/afb-events.js
CHANGED
|
@@ -182,5 +182,15 @@ class RemoveInstance extends ActionImpl {
|
|
|
182
182
|
super(payload, 'removeInstance');
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
+
class RequestSuccess extends ActionImpl {
|
|
186
|
+
constructor(payload, dispatch = false) {
|
|
187
|
+
super(payload, 'requestSuccess', { dispatch });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
class RequestFailure extends ActionImpl {
|
|
191
|
+
constructor(payload, dispatch = false) {
|
|
192
|
+
super(payload, 'requestFailure', { dispatch });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
185
195
|
|
|
186
|
-
export { AddInstance, AddItem, Blur, Change, Click, CustomEvent, ExecuteRule, FieldChanged, Focus, FormLoad, Initialize, Invalid, RemoveInstance, RemoveItem, Reset, Save, Submit, SubmitError, SubmitFailure, SubmitSuccess, UIChange, Valid, ValidationComplete, propertyChange };
|
|
196
|
+
export { AddInstance, AddItem, Blur, Change, Click, CustomEvent, ExecuteRule, FieldChanged, Focus, FormLoad, Initialize, Invalid, RemoveInstance, RemoveItem, RequestFailure, RequestSuccess, Reset, Save, Submit, SubmitError, SubmitFailure, SubmitSuccess, UIChange, Valid, ValidationComplete, propertyChange };
|
package/esm/afb-runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { propertyChange, ExecuteRule, Initialize, RemoveItem, SubmitSuccess, CustomEvent, SubmitError, SubmitFailure, Submit, Save, Focus, Valid, Invalid, RemoveInstance, AddInstance, Reset, AddItem, Click, Change, FormLoad, FieldChanged, ValidationComplete } from './afb-events.js';
|
|
1
|
+
import { propertyChange, ExecuteRule, Initialize, RemoveItem, SubmitSuccess, CustomEvent, RequestSuccess, SubmitError, SubmitFailure, RequestFailure, Submit, Save, Focus, Valid, Invalid, RemoveInstance, AddInstance, Reset, AddItem, Click, Change, FormLoad, FieldChanged, ValidationComplete } from './afb-events.js';
|
|
2
2
|
import Formula from '@adobe/json-formula';
|
|
3
3
|
import { parseDefaultDate, datetimeToNumber, format, parseDateSkeleton, numberToDatetime, formatDate, parseDate } from '@aemforms/af-formatters';
|
|
4
4
|
|
|
@@ -156,6 +156,10 @@ const isEmailInput = function (item) {
|
|
|
156
156
|
const fieldType = item?.fieldType || defaultFieldTypes(item);
|
|
157
157
|
return (fieldType === 'text-input' && item?.format === 'email') || fieldType === 'email';
|
|
158
158
|
};
|
|
159
|
+
const isDateTimeField = function (item) {
|
|
160
|
+
const fieldType = item?.fieldType || defaultFieldTypes(item);
|
|
161
|
+
return (fieldType === 'text-input' && item?.format === 'date-time') || fieldType === 'datetime-input';
|
|
162
|
+
};
|
|
159
163
|
const isDateField = function (item) {
|
|
160
164
|
const fieldType = item?.fieldType || defaultFieldTypes(item);
|
|
161
165
|
return (fieldType === 'text-input' && item?.format === 'date') || fieldType === 'date-input';
|
|
@@ -1030,7 +1034,8 @@ const ValidConstraints = {
|
|
|
1030
1034
|
number: ['minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum'],
|
|
1031
1035
|
array: ['minItems', 'maxItems', 'uniqueItems'],
|
|
1032
1036
|
file: ['accept', 'maxFileSize'],
|
|
1033
|
-
email: ['minLength', 'maxLength', 'format', 'pattern']
|
|
1037
|
+
email: ['minLength', 'maxLength', 'format', 'pattern'],
|
|
1038
|
+
datetime: ['minimum', 'maximum']
|
|
1034
1039
|
};
|
|
1035
1040
|
const validationConstraintsList = ['type', 'format', 'minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum', 'minItems',
|
|
1036
1041
|
'maxItems', 'uniqueItems', 'minLength', 'maxLength', 'pattern', 'required', 'enum', 'accept', 'maxFileSize'];
|
|
@@ -1914,6 +1919,7 @@ class Scriptable extends BaseNode {
|
|
|
1914
1919
|
target: this.getRuleNode()
|
|
1915
1920
|
}
|
|
1916
1921
|
};
|
|
1922
|
+
this.ruleEngine.setDependencyTracking(['change', 'executeRule'].includes(action.type));
|
|
1917
1923
|
const eventName = action.isCustomEvent ? `custom:${action.type}` : action.type;
|
|
1918
1924
|
const funcName = action.isCustomEvent ? `custom_${action.type}` : action.type;
|
|
1919
1925
|
const node = this.getCompiledEvent(eventName);
|
|
@@ -2724,6 +2730,7 @@ const request = async (context, uri, httpVerb, payload, success, error, headers)
|
|
|
2724
2730
|
else {
|
|
2725
2731
|
context.form.dispatch(new CustomEvent(eName, response, true));
|
|
2726
2732
|
}
|
|
2733
|
+
context.form.dispatch(new RequestSuccess(response, true));
|
|
2727
2734
|
}
|
|
2728
2735
|
else {
|
|
2729
2736
|
context.form.logger.error('Error invoking a rest API');
|
|
@@ -2735,6 +2742,7 @@ const request = async (context, uri, httpVerb, payload, success, error, headers)
|
|
|
2735
2742
|
else {
|
|
2736
2743
|
context.form.dispatch(new CustomEvent(eName, response, true));
|
|
2737
2744
|
}
|
|
2745
|
+
context.form.dispatch(new RequestFailure(response, true));
|
|
2738
2746
|
}
|
|
2739
2747
|
};
|
|
2740
2748
|
const urlEncoded = (data) => {
|
|
@@ -3870,6 +3878,7 @@ class Field extends Scriptable {
|
|
|
3870
3878
|
'multiline-input': 'string',
|
|
3871
3879
|
'number-input': 'number',
|
|
3872
3880
|
'date-input': 'string',
|
|
3881
|
+
'date-time': 'string',
|
|
3873
3882
|
'email': 'string',
|
|
3874
3883
|
'plain-text': 'string',
|
|
3875
3884
|
'image': 'string',
|
|
@@ -3944,7 +3953,7 @@ class Field extends Scriptable {
|
|
|
3944
3953
|
}
|
|
3945
3954
|
this.coerceParam('minLength', 'number');
|
|
3946
3955
|
this.coerceParam('maxLength', 'number');
|
|
3947
|
-
if (this._jsonModel.type !== 'number' && this._jsonModel.format !== 'date' && this._jsonModel.type !== 'integer') {
|
|
3956
|
+
if (this._jsonModel.type !== 'number' && this._jsonModel.format !== 'date' && this._jsonModel.format !== 'date-time' && this._jsonModel.type !== 'integer') {
|
|
3948
3957
|
this.unset('step', ...props);
|
|
3949
3958
|
}
|
|
3950
3959
|
props.forEach(c => {
|
|
@@ -4047,22 +4056,22 @@ class Field extends Scriptable {
|
|
|
4047
4056
|
this._setProperty('required', r);
|
|
4048
4057
|
}
|
|
4049
4058
|
get maximum() {
|
|
4050
|
-
if (this.type === 'number' || this.format === 'date' || this.type === 'integer') {
|
|
4059
|
+
if (this.type === 'number' || this.format === 'date' || this.format === 'date-time' || this.type === 'integer') {
|
|
4051
4060
|
return this._jsonModel.maximum;
|
|
4052
4061
|
}
|
|
4053
4062
|
}
|
|
4054
4063
|
set maximum(m) {
|
|
4055
|
-
if (this.type === 'number' || this.format === 'date' || this.type === 'integer') {
|
|
4064
|
+
if (this.type === 'number' || this.format === 'date' || this.format === 'date-time' || this.type === 'integer') {
|
|
4056
4065
|
this._setProperty('maximum', m);
|
|
4057
4066
|
}
|
|
4058
4067
|
}
|
|
4059
4068
|
get minimum() {
|
|
4060
|
-
if (this.type === 'number' || this.format === 'date' || this.type === 'integer') {
|
|
4069
|
+
if (this.type === 'number' || this.format === 'date' || this.format === 'date-time' || this.type === 'integer') {
|
|
4061
4070
|
return this._jsonModel.minimum;
|
|
4062
4071
|
}
|
|
4063
4072
|
}
|
|
4064
4073
|
set minimum(m) {
|
|
4065
|
-
if (this.type === 'number' || this.format === 'date' || this.type === 'integer') {
|
|
4074
|
+
if (this.type === 'number' || this.format === 'date' || this.format === 'date-time' || this.type === 'integer') {
|
|
4066
4075
|
this._setProperty('minimum', m);
|
|
4067
4076
|
}
|
|
4068
4077
|
}
|
|
@@ -4307,6 +4316,8 @@ class Field extends Scriptable {
|
|
|
4307
4316
|
switch (this.format) {
|
|
4308
4317
|
case 'date':
|
|
4309
4318
|
return ValidConstraints.date;
|
|
4319
|
+
case 'date-time':
|
|
4320
|
+
return ValidConstraints.datetime;
|
|
4310
4321
|
case 'email':
|
|
4311
4322
|
return ValidConstraints.email;
|
|
4312
4323
|
case 'binary':
|
|
@@ -4337,6 +4348,9 @@ class Field extends Scriptable {
|
|
|
4337
4348
|
case 'file-input':
|
|
4338
4349
|
this._jsonModel.format = 'data-url';
|
|
4339
4350
|
break;
|
|
4351
|
+
case 'date-time':
|
|
4352
|
+
this._jsonModel.format = 'date-time';
|
|
4353
|
+
break;
|
|
4340
4354
|
}
|
|
4341
4355
|
}
|
|
4342
4356
|
}
|
|
@@ -4557,7 +4571,7 @@ __decorate([
|
|
|
4557
4571
|
dependencyTracked()
|
|
4558
4572
|
], Field.prototype, "errorMessage", null);
|
|
4559
4573
|
__decorate([
|
|
4560
|
-
include('text-input', 'date-input', 'file-input', 'email')
|
|
4574
|
+
include('text-input', 'date-input', 'file-input', 'email', 'datetime-input')
|
|
4561
4575
|
], Field.prototype, "format", null);
|
|
4562
4576
|
__decorate([
|
|
4563
4577
|
include('text-input')
|
|
@@ -4848,6 +4862,19 @@ class DateField extends Field {
|
|
|
4848
4862
|
}
|
|
4849
4863
|
}
|
|
4850
4864
|
|
|
4865
|
+
class DateTimeField extends DateField {
|
|
4866
|
+
_dataFormat = 'yyyy-MM-ddTHH:mm';
|
|
4867
|
+
_applyDefaults() {
|
|
4868
|
+
super._applyDefaults();
|
|
4869
|
+
}
|
|
4870
|
+
get value() {
|
|
4871
|
+
return super.value;
|
|
4872
|
+
}
|
|
4873
|
+
set value(value) {
|
|
4874
|
+
super.value = value;
|
|
4875
|
+
}
|
|
4876
|
+
}
|
|
4877
|
+
|
|
4851
4878
|
class EmailInput extends Field {
|
|
4852
4879
|
_getDefaults() {
|
|
4853
4880
|
return {
|
|
@@ -4962,6 +4989,9 @@ class FormFieldFactoryImpl {
|
|
|
4962
4989
|
else if (isDateField(child)) {
|
|
4963
4990
|
retVal = new DateField(child, options);
|
|
4964
4991
|
}
|
|
4992
|
+
else if (isDateTimeField(child)) {
|
|
4993
|
+
retVal = new DateTimeField(child, options);
|
|
4994
|
+
}
|
|
4965
4995
|
else if (isCaptcha(child)) {
|
|
4966
4996
|
retVal = new Captcha(child, options);
|
|
4967
4997
|
}
|
|
@@ -108,4 +108,10 @@ export declare class AddInstance extends ActionImpl {
|
|
|
108
108
|
export declare class RemoveInstance extends ActionImpl {
|
|
109
109
|
constructor(payload?: number);
|
|
110
110
|
}
|
|
111
|
+
export declare class RequestSuccess extends ActionImpl {
|
|
112
|
+
constructor(payload?: any, dispatch?: boolean);
|
|
113
|
+
}
|
|
114
|
+
export declare class RequestFailure extends ActionImpl {
|
|
115
|
+
constructor(payload?: any, dispatch?: boolean);
|
|
116
|
+
}
|
|
111
117
|
export {};
|
|
@@ -5,6 +5,7 @@ export declare const checkIfConstraintsArePresent: (item: FieldsetJson | FieldJs
|
|
|
5
5
|
export declare const isCheckbox: (item: FieldsetJson | FieldJson) => boolean;
|
|
6
6
|
export declare const isCheckboxGroup: (item: FieldsetJson | FieldJson) => boolean;
|
|
7
7
|
export declare const isEmailInput: (item: FieldsetJson | FieldJson) => boolean;
|
|
8
|
+
export declare const isDateTimeField: (item: FieldsetJson | FieldJson) => boolean;
|
|
8
9
|
export declare const isDateField: (item: FieldsetJson | FieldJson) => boolean;
|
|
9
10
|
export declare const isCaptcha: (item: FieldsetJson | FieldJson) => boolean;
|
|
10
11
|
export declare const isButton: (item: FieldsetJson | FieldJson) => boolean;
|
|
@@ -10,6 +10,7 @@ type ValidConstraintsType = {
|
|
|
10
10
|
array: ValidationConstraints[];
|
|
11
11
|
file: ValidationConstraints[];
|
|
12
12
|
email: ValidationConstraints[];
|
|
13
|
+
datetime: ValidationConstraints[];
|
|
13
14
|
};
|
|
14
15
|
export declare const ValidConstraints: ValidConstraintsType;
|
|
15
16
|
export declare const validationConstraintsList: readonly ["type", "format", "minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "minItems", "maxItems", "uniqueItems", "minLength", "maxLength", "pattern", "required", "enum", "accept", "maxFileSize"];
|
package/lib/DateField.d.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
const DateField_1 = __importDefault(require("./DateField"));
|
|
7
|
+
class DateTimeField extends DateField_1.default {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this._dataFormat = 'yyyy-MM-ddTHH:mm';
|
|
11
|
+
}
|
|
12
|
+
_applyDefaults() {
|
|
13
|
+
super._applyDefaults();
|
|
14
|
+
}
|
|
15
|
+
get value() {
|
|
16
|
+
return super.value;
|
|
17
|
+
}
|
|
18
|
+
set value(value) {
|
|
19
|
+
super.value = value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = DateTimeField;
|
package/lib/Field.js
CHANGED
|
@@ -89,6 +89,7 @@ class Field extends Scriptable_1.default {
|
|
|
89
89
|
'multiline-input': 'string',
|
|
90
90
|
'number-input': 'number',
|
|
91
91
|
'date-input': 'string',
|
|
92
|
+
'date-time': 'string',
|
|
92
93
|
'email': 'string',
|
|
93
94
|
'plain-text': 'string',
|
|
94
95
|
'image': 'string',
|
|
@@ -164,7 +165,7 @@ class Field extends Scriptable_1.default {
|
|
|
164
165
|
}
|
|
165
166
|
this.coerceParam('minLength', 'number');
|
|
166
167
|
this.coerceParam('maxLength', 'number');
|
|
167
|
-
if (this._jsonModel.type !== 'number' && this._jsonModel.format !== 'date' && this._jsonModel.type !== 'integer') {
|
|
168
|
+
if (this._jsonModel.type !== 'number' && this._jsonModel.format !== 'date' && this._jsonModel.format !== 'date-time' && this._jsonModel.type !== 'integer') {
|
|
168
169
|
this.unset('step', ...props);
|
|
169
170
|
}
|
|
170
171
|
props.forEach(c => {
|
|
@@ -266,22 +267,22 @@ class Field extends Scriptable_1.default {
|
|
|
266
267
|
this._setProperty('required', r);
|
|
267
268
|
}
|
|
268
269
|
get maximum() {
|
|
269
|
-
if (this.type === 'number' || this.format === 'date' || this.type === 'integer') {
|
|
270
|
+
if (this.type === 'number' || this.format === 'date' || this.format === 'date-time' || this.type === 'integer') {
|
|
270
271
|
return this._jsonModel.maximum;
|
|
271
272
|
}
|
|
272
273
|
}
|
|
273
274
|
set maximum(m) {
|
|
274
|
-
if (this.type === 'number' || this.format === 'date' || this.type === 'integer') {
|
|
275
|
+
if (this.type === 'number' || this.format === 'date' || this.format === 'date-time' || this.type === 'integer') {
|
|
275
276
|
this._setProperty('maximum', m);
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
279
|
get minimum() {
|
|
279
|
-
if (this.type === 'number' || this.format === 'date' || this.type === 'integer') {
|
|
280
|
+
if (this.type === 'number' || this.format === 'date' || this.format === 'date-time' || this.type === 'integer') {
|
|
280
281
|
return this._jsonModel.minimum;
|
|
281
282
|
}
|
|
282
283
|
}
|
|
283
284
|
set minimum(m) {
|
|
284
|
-
if (this.type === 'number' || this.format === 'date' || this.type === 'integer') {
|
|
285
|
+
if (this.type === 'number' || this.format === 'date' || this.format === 'date-time' || this.type === 'integer') {
|
|
285
286
|
this._setProperty('minimum', m);
|
|
286
287
|
}
|
|
287
288
|
}
|
|
@@ -527,6 +528,8 @@ class Field extends Scriptable_1.default {
|
|
|
527
528
|
switch (this.format) {
|
|
528
529
|
case 'date':
|
|
529
530
|
return ValidationUtils_1.ValidConstraints.date;
|
|
531
|
+
case 'date-time':
|
|
532
|
+
return ValidationUtils_1.ValidConstraints.datetime;
|
|
530
533
|
case 'email':
|
|
531
534
|
return ValidationUtils_1.ValidConstraints.email;
|
|
532
535
|
case 'binary':
|
|
@@ -557,6 +560,9 @@ class Field extends Scriptable_1.default {
|
|
|
557
560
|
case 'file-input':
|
|
558
561
|
this._jsonModel.format = 'data-url';
|
|
559
562
|
break;
|
|
563
|
+
case 'date-time':
|
|
564
|
+
this._jsonModel.format = 'date-time';
|
|
565
|
+
break;
|
|
560
566
|
}
|
|
561
567
|
}
|
|
562
568
|
}
|
|
@@ -760,7 +766,7 @@ __decorate([
|
|
|
760
766
|
(0, BaseNode_1.dependencyTracked)()
|
|
761
767
|
], Field.prototype, "errorMessage", null);
|
|
762
768
|
__decorate([
|
|
763
|
-
(0, BaseNode_1.include)('text-input', 'date-input', 'file-input', 'email')
|
|
769
|
+
(0, BaseNode_1.include)('text-input', 'date-input', 'file-input', 'email', 'datetime-input')
|
|
764
770
|
], Field.prototype, "format", null);
|
|
765
771
|
__decorate([
|
|
766
772
|
(0, BaseNode_1.include)('text-input')
|
package/lib/Scriptable.js
CHANGED
|
@@ -182,6 +182,7 @@ class Scriptable extends BaseNode_1.BaseNode {
|
|
|
182
182
|
target: this.getRuleNode()
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
|
+
this.ruleEngine.setDependencyTracking(['change', 'executeRule'].includes(action.type));
|
|
185
186
|
const eventName = action.isCustomEvent ? `custom:${action.type}` : action.type;
|
|
186
187
|
const funcName = action.isCustomEvent ? `custom_${action.type}` : action.type;
|
|
187
188
|
const node = this.getCompiledEvent(eventName);
|
|
@@ -108,4 +108,10 @@ export declare class AddInstance extends ActionImpl {
|
|
|
108
108
|
export declare class RemoveInstance extends ActionImpl {
|
|
109
109
|
constructor(payload?: number);
|
|
110
110
|
}
|
|
111
|
+
export declare class RequestSuccess extends ActionImpl {
|
|
112
|
+
constructor(payload?: any, dispatch?: boolean);
|
|
113
|
+
}
|
|
114
|
+
export declare class RequestFailure extends ActionImpl {
|
|
115
|
+
constructor(payload?: any, dispatch?: boolean);
|
|
116
|
+
}
|
|
111
117
|
export {};
|
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.UIChange = exports.Change = void 0;
|
|
3
|
+
exports.RequestFailure = exports.RequestSuccess = 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
|
var EventSource;
|
|
5
5
|
(function (EventSource) {
|
|
6
6
|
EventSource["CODE"] = "code";
|
|
@@ -204,3 +204,15 @@ class RemoveInstance extends ActionImpl {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
exports.RemoveInstance = RemoveInstance;
|
|
207
|
+
class RequestSuccess extends ActionImpl {
|
|
208
|
+
constructor(payload, dispatch = false) {
|
|
209
|
+
super(payload, 'requestSuccess', { dispatch });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.RequestSuccess = RequestSuccess;
|
|
213
|
+
class RequestFailure extends ActionImpl {
|
|
214
|
+
constructor(payload, dispatch = false) {
|
|
215
|
+
super(payload, 'requestFailure', { dispatch });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
exports.RequestFailure = RequestFailure;
|
|
@@ -88,6 +88,7 @@ const request = (context, uri, httpVerb, payload, success, error, headers) => __
|
|
|
88
88
|
else {
|
|
89
89
|
context.form.dispatch(new Events_1.CustomEvent(eName, response, true));
|
|
90
90
|
}
|
|
91
|
+
context.form.dispatch(new Events_1.RequestSuccess(response, true));
|
|
91
92
|
}
|
|
92
93
|
else {
|
|
93
94
|
context.form.logger.error('Error invoking a rest API');
|
|
@@ -99,6 +100,7 @@ const request = (context, uri, httpVerb, payload, success, error, headers) => __
|
|
|
99
100
|
else {
|
|
100
101
|
context.form.dispatch(new Events_1.CustomEvent(eName, response, true));
|
|
101
102
|
}
|
|
103
|
+
context.form.dispatch(new Events_1.RequestFailure(response, true));
|
|
102
104
|
}
|
|
103
105
|
});
|
|
104
106
|
exports.request = request;
|
|
@@ -11,6 +11,7 @@ const FileUpload_1 = __importDefault(require("../FileUpload"));
|
|
|
11
11
|
const Checkbox_1 = __importDefault(require("../Checkbox"));
|
|
12
12
|
const CheckboxGroup_1 = __importDefault(require("../CheckboxGroup"));
|
|
13
13
|
const DateField_1 = __importDefault(require("../DateField"));
|
|
14
|
+
const DateTimeField_1 = __importDefault(require("../DateTimeField"));
|
|
14
15
|
const Field_1 = __importDefault(require("../Field"));
|
|
15
16
|
const EmailInput_1 = __importDefault(require("../EmailInput"));
|
|
16
17
|
const Captcha_1 = __importDefault(require("../Captcha"));
|
|
@@ -66,6 +67,9 @@ class FormFieldFactoryImpl {
|
|
|
66
67
|
else if ((0, JsonUtils_1.isDateField)(child)) {
|
|
67
68
|
retVal = new DateField_1.default(child, options);
|
|
68
69
|
}
|
|
70
|
+
else if ((0, JsonUtils_1.isDateTimeField)(child)) {
|
|
71
|
+
retVal = new DateTimeField_1.default(child, options);
|
|
72
|
+
}
|
|
69
73
|
else if ((0, JsonUtils_1.isCaptcha)(child)) {
|
|
70
74
|
retVal = new Captcha_1.default(child, options);
|
|
71
75
|
}
|
package/lib/utils/JsonUtils.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const checkIfConstraintsArePresent: (item: FieldsetJson | FieldJs
|
|
|
5
5
|
export declare const isCheckbox: (item: FieldsetJson | FieldJson) => boolean;
|
|
6
6
|
export declare const isCheckboxGroup: (item: FieldsetJson | FieldJson) => boolean;
|
|
7
7
|
export declare const isEmailInput: (item: FieldsetJson | FieldJson) => boolean;
|
|
8
|
+
export declare const isDateTimeField: (item: FieldsetJson | FieldJson) => boolean;
|
|
8
9
|
export declare const isDateField: (item: FieldsetJson | FieldJson) => boolean;
|
|
9
10
|
export declare const isCaptcha: (item: FieldsetJson | FieldJson) => boolean;
|
|
10
11
|
export declare const isButton: (item: FieldsetJson | FieldJson) => boolean;
|
package/lib/utils/JsonUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isRepeatable = exports.jsonString = exports.checkIfKeyAdded = exports.deepClone = exports.isButton = exports.isCaptcha = exports.isDateField = exports.isEmailInput = exports.isCheckboxGroup = exports.isCheckbox = exports.checkIfConstraintsArePresent = exports.isFile = exports.getProperty = void 0;
|
|
3
|
+
exports.isRepeatable = exports.jsonString = exports.checkIfKeyAdded = exports.deepClone = exports.isButton = exports.isCaptcha = exports.isDateField = exports.isDateTimeField = exports.isEmailInput = exports.isCheckboxGroup = exports.isCheckbox = exports.checkIfConstraintsArePresent = exports.isFile = exports.getProperty = void 0;
|
|
4
4
|
const index_1 = require("../types/index");
|
|
5
5
|
const SchemaUtils_1 = require("./SchemaUtils");
|
|
6
6
|
const getProperty = (data, key, def) => {
|
|
@@ -42,6 +42,11 @@ const isEmailInput = function (item) {
|
|
|
42
42
|
return (fieldType === 'text-input' && (item === null || item === void 0 ? void 0 : item.format) === 'email') || fieldType === 'email';
|
|
43
43
|
};
|
|
44
44
|
exports.isEmailInput = isEmailInput;
|
|
45
|
+
const isDateTimeField = function (item) {
|
|
46
|
+
const fieldType = (item === null || item === void 0 ? void 0 : item.fieldType) || (0, SchemaUtils_1.defaultFieldTypes)(item);
|
|
47
|
+
return (fieldType === 'text-input' && (item === null || item === void 0 ? void 0 : item.format) === 'date-time') || fieldType === 'datetime-input';
|
|
48
|
+
};
|
|
49
|
+
exports.isDateTimeField = isDateTimeField;
|
|
45
50
|
const isDateField = function (item) {
|
|
46
51
|
const fieldType = (item === null || item === void 0 ? void 0 : item.fieldType) || (0, SchemaUtils_1.defaultFieldTypes)(item);
|
|
47
52
|
return (fieldType === 'text-input' && (item === null || item === void 0 ? void 0 : item.format) === 'date') || fieldType === 'date-input';
|
|
@@ -10,6 +10,7 @@ declare type ValidConstraintsType = {
|
|
|
10
10
|
array: ValidationConstraints[];
|
|
11
11
|
file: ValidationConstraints[];
|
|
12
12
|
email: ValidationConstraints[];
|
|
13
|
+
datetime: ValidationConstraints[];
|
|
13
14
|
};
|
|
14
15
|
export declare const ValidConstraints: ValidConstraintsType;
|
|
15
16
|
export declare const validationConstraintsList: readonly ["type", "format", "minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "minItems", "maxItems", "uniqueItems", "minLength", "maxLength", "pattern", "required", "enum", "accept", "maxFileSize"];
|
|
@@ -116,7 +116,8 @@ exports.ValidConstraints = {
|
|
|
116
116
|
number: ['minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum'],
|
|
117
117
|
array: ['minItems', 'maxItems', 'uniqueItems'],
|
|
118
118
|
file: ['accept', 'maxFileSize'],
|
|
119
|
-
email: ['minLength', 'maxLength', 'format', 'pattern']
|
|
119
|
+
email: ['minLength', 'maxLength', 'format', 'pattern'],
|
|
120
|
+
datetime: ['minimum', 'maximum']
|
|
120
121
|
};
|
|
121
122
|
exports.validationConstraintsList = ['type', 'format', 'minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum', 'minItems',
|
|
122
123
|
'maxItems', 'uniqueItems', 'minLength', 'maxLength', 'pattern', 'required', 'enum', 'accept', 'maxFileSize'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.122",
|
|
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.122"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|