@bolttech/form-engine-core 1.0.0-beta.13 → 1.0.0-beta.14
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/index.esm.js +14 -14
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -72,11 +72,12 @@ function makeRequest(method, url, headers, body, queryParams) {
|
|
|
72
72
|
return new Promise(function (resolve, reject) {
|
|
73
73
|
const xhr = new XMLHttpRequest();
|
|
74
74
|
if (queryParams) {
|
|
75
|
-
const
|
|
75
|
+
const [baseUrl, existingParamsString] = url.split('?');
|
|
76
|
+
const searchParams = new URLSearchParams(existingParamsString);
|
|
76
77
|
Object.keys(queryParams).forEach(param => {
|
|
77
|
-
|
|
78
|
+
searchParams.append(param, queryParams[param]);
|
|
78
79
|
});
|
|
79
|
-
url =
|
|
80
|
+
url = `${baseUrl}?${searchParams.toString()}`;
|
|
80
81
|
}
|
|
81
82
|
xhr.open(method, url, true);
|
|
82
83
|
if (headers) {
|
|
@@ -3234,7 +3235,6 @@ class FormCore {
|
|
|
3234
3235
|
key,
|
|
3235
3236
|
status
|
|
3236
3237
|
}) {
|
|
3237
|
-
var _a;
|
|
3238
3238
|
if (status) {
|
|
3239
3239
|
const field = this.fields.get(key);
|
|
3240
3240
|
if (!field) {
|
|
@@ -3254,15 +3254,9 @@ class FormCore {
|
|
|
3254
3254
|
scope: 'iVars',
|
|
3255
3255
|
event: 'ON_IVARS'
|
|
3256
3256
|
});
|
|
3257
|
-
if (!this.queuedInitialValues.has(key)) {
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
value: typeof propValue === 'string' && !propValue.includes('${') ? propValue : '',
|
|
3261
|
-
event: 'ON_FIELD_MOUNT'
|
|
3262
|
-
}) : field.emitEvents({
|
|
3263
|
-
event: 'ON_FIELD_MOUNT'
|
|
3264
|
-
});
|
|
3265
|
-
}
|
|
3257
|
+
if (!this.queuedInitialValues.has(key)) field.emitEvents({
|
|
3258
|
+
event: 'ON_FIELD_MOUNT'
|
|
3259
|
+
});
|
|
3266
3260
|
this.checkFieldEventQueues(key);
|
|
3267
3261
|
}
|
|
3268
3262
|
}
|
|
@@ -3869,12 +3863,18 @@ class FormCore {
|
|
|
3869
3863
|
fieldSchema,
|
|
3870
3864
|
mapperElement
|
|
3871
3865
|
}) {
|
|
3872
|
-
var _a;
|
|
3866
|
+
var _a, _b, _c, _d;
|
|
3873
3867
|
if (this.fields.has(fieldSchema.name)) {
|
|
3874
3868
|
throw new Error(`field name ${fieldSchema.name} already defined`);
|
|
3875
3869
|
}
|
|
3876
3870
|
const mapper = mapperElement || ((_a = this.mappers) === null || _a === void 0 ? void 0 : _a.get(fieldSchema.component));
|
|
3877
3871
|
if (!mapper) throw new Error(`mapper not found for ${fieldSchema.component}, add it to the mappers configuration`);
|
|
3872
|
+
if ((_b = mapper.events) === null || _b === void 0 ? void 0 : _b.setValue) {
|
|
3873
|
+
const initialValue = (_c = fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.props) === null || _c === void 0 ? void 0 : _c[(_d = mapper === null || mapper === void 0 ? void 0 : mapper.events) === null || _d === void 0 ? void 0 : _d.setValue];
|
|
3874
|
+
if (!(typeof initialValue === 'undefined') && !this.queuedInitialValues.has(fieldSchema.name) && !(typeof initialValue === 'string' && initialValue.includes('${'))) {
|
|
3875
|
+
this.queuedInitialValues.set(fieldSchema.name, cloneDeep(initialValue));
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3878
3878
|
this.fields.set(fieldSchema.name, new FormField({
|
|
3879
3879
|
schemaComponent: fieldSchema,
|
|
3880
3880
|
mapper,
|