@formio/js 5.1.0-dev.6166.dce1c56 → 5.1.0-dev.6181.dd734d1
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/dist/formio.form.js +6 -6
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +6 -6
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Webform.js +1 -1
- package/lib/cjs/components/_classes/component/Component.js +8 -2
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
- package/lib/cjs/components/datagrid/DataGrid.js +4 -0
- package/lib/cjs/providers/storage/url.js +7 -3
- package/lib/cjs/utils/utils.js +0 -4
- package/lib/mjs/Webform.js +1 -1
- package/lib/mjs/components/_classes/component/Component.js +7 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
- package/lib/mjs/components/datagrid/DataGrid.js +4 -0
- package/lib/mjs/providers/storage/url.js +7 -3
- package/lib/mjs/utils/utils.js +0 -4
- package/package.json +1 -1
package/lib/cjs/Webform.js
CHANGED
@@ -1119,7 +1119,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
1119
1119
|
const componentErrors = {};
|
1120
1120
|
errors.forEach((err) => {
|
1121
1121
|
var _a, _b;
|
1122
|
-
const path = err.path || ((_a = err.context) === null || _a === void 0 ? void 0 : _a.path) || ((_b = err.component) === null || _b === void 0 ? void 0 : _b.key);
|
1122
|
+
const path = (0, utils_1.getStringFromComponentPath)(err.path) || ((_a = err.context) === null || _a === void 0 ? void 0 : _a.path) || ((_b = err.component) === null || _b === void 0 ? void 0 : _b.key);
|
1123
1123
|
if (!componentErrors[path]) {
|
1124
1124
|
componentErrors[path] = [];
|
1125
1125
|
}
|
@@ -1170,15 +1170,21 @@ class Component extends Element_1.default {
|
|
1170
1170
|
* @returns {string} - The modal preview template.
|
1171
1171
|
*/
|
1172
1172
|
getModalPreviewTemplate() {
|
1173
|
-
var _a;
|
1173
|
+
var _a, _b;
|
1174
1174
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
1175
1175
|
let modalLabel;
|
1176
1176
|
if (this.hasInput && ((_a = this.component.validate) === null || _a === void 0 ? void 0 : _a.required) && !this.isPDFReadOnlyMode) {
|
1177
1177
|
modalLabel = { className: 'field-required' };
|
1178
1178
|
}
|
1179
|
+
let messages = '';
|
1180
|
+
if ((_b = this.errors) === null || _b === void 0 ? void 0 : _b.length) {
|
1181
|
+
messages = this.errors.map((err) => {
|
1182
|
+
return err.level === 'error' ? this.renderTemplate('message', Object.assign({}, err)) : '';
|
1183
|
+
}).join('');
|
1184
|
+
}
|
1179
1185
|
return this.renderModalPreview({
|
1180
1186
|
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('clickToSetValue'),
|
1181
|
-
messages
|
1187
|
+
messages,
|
1182
1188
|
labelInfo: modalLabel,
|
1183
1189
|
});
|
1184
1190
|
}
|
@@ -82,6 +82,7 @@ declare const _default: ({
|
|
82
82
|
inline?: undefined;
|
83
83
|
defaultValue?: undefined;
|
84
84
|
values?: undefined;
|
85
|
+
customConditional?: undefined;
|
85
86
|
logic?: undefined;
|
86
87
|
dataSrc?: undefined;
|
87
88
|
valueProperty?: undefined;
|
@@ -101,6 +102,7 @@ declare const _default: ({
|
|
101
102
|
inline?: undefined;
|
102
103
|
defaultValue?: undefined;
|
103
104
|
values?: undefined;
|
105
|
+
customConditional?: undefined;
|
104
106
|
logic?: undefined;
|
105
107
|
dataSrc?: undefined;
|
106
108
|
valueProperty?: undefined;
|
@@ -126,6 +128,7 @@ declare const _default: ({
|
|
126
128
|
value: string;
|
127
129
|
})[];
|
128
130
|
placeholder?: undefined;
|
131
|
+
customConditional?: undefined;
|
129
132
|
logic?: undefined;
|
130
133
|
dataSrc?: undefined;
|
131
134
|
valueProperty?: undefined;
|
@@ -141,6 +144,7 @@ declare const _default: ({
|
|
141
144
|
tooltip: string;
|
142
145
|
key: string;
|
143
146
|
input: boolean;
|
147
|
+
customConditional: string;
|
144
148
|
logic: ({
|
145
149
|
name: string;
|
146
150
|
trigger: {
|
@@ -211,6 +215,7 @@ declare const _default: ({
|
|
211
215
|
inline?: undefined;
|
212
216
|
defaultValue?: undefined;
|
213
217
|
values?: undefined;
|
218
|
+
customConditional?: undefined;
|
214
219
|
logic?: undefined;
|
215
220
|
as?: undefined;
|
216
221
|
editor?: undefined;
|
@@ -226,6 +231,7 @@ declare const _default: ({
|
|
226
231
|
placeholder?: undefined;
|
227
232
|
inline?: undefined;
|
228
233
|
values?: undefined;
|
234
|
+
customConditional?: undefined;
|
229
235
|
logic?: undefined;
|
230
236
|
dataSrc?: undefined;
|
231
237
|
valueProperty?: undefined;
|
@@ -248,6 +254,7 @@ declare const _default: ({
|
|
248
254
|
placeholder?: undefined;
|
249
255
|
inline?: undefined;
|
250
256
|
values?: undefined;
|
257
|
+
customConditional?: undefined;
|
251
258
|
logic?: undefined;
|
252
259
|
dataSrc?: undefined;
|
253
260
|
valueProperty?: undefined;
|
@@ -419,12 +419,16 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
419
419
|
updateComponentsRowIndex(components, rowIndex) {
|
420
420
|
components.forEach((component, colIndex) => {
|
421
421
|
var _a;
|
422
|
+
if (this.componentsMap[component.paths.dataPath]) {
|
423
|
+
delete this.componentsMap[component.paths.dataPath];
|
424
|
+
}
|
422
425
|
if ((_a = component.options) === null || _a === void 0 ? void 0 : _a.name) {
|
423
426
|
const newName = `[${this.key}][${rowIndex}]`;
|
424
427
|
component.options.name = component.options.name.replace(`[${this.key}][${component.rowIndex}]`, newName);
|
425
428
|
}
|
426
429
|
component.rowIndex = rowIndex;
|
427
430
|
component.row = `${rowIndex}-${colIndex}`;
|
431
|
+
this.componentsMap[component.paths.dataPath] = component;
|
428
432
|
});
|
429
433
|
}
|
430
434
|
updateRowsComponents(rowIndex) {
|
@@ -127,13 +127,17 @@ function url(formio) {
|
|
127
127
|
deleteFile(fileInfo, options) {
|
128
128
|
return new Promise((resolve, reject) => {
|
129
129
|
const xhr = new XMLHttpRequest();
|
130
|
-
xhr.open(
|
130
|
+
xhr.open("DELETE", fileInfo.url, true);
|
131
|
+
const token = formio.getToken();
|
132
|
+
if (token) {
|
133
|
+
xhr.setRequestHeader("x-jwt-token", token);
|
134
|
+
}
|
131
135
|
xhr.onload = () => {
|
132
136
|
if (xhr.status >= 200 && xhr.status < 300) {
|
133
|
-
resolve(
|
137
|
+
resolve("File deleted");
|
134
138
|
}
|
135
139
|
else {
|
136
|
-
reject(xhr.response ||
|
140
|
+
reject(xhr.response || "Unable to delete file");
|
137
141
|
}
|
138
142
|
};
|
139
143
|
if (options) {
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToDayjs = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.dayjsDate = exports.shouldHandleTimezone = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.removeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = void 0;
|
7
7
|
exports.hasEncodedTimezone = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports.getFocusableElements = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.fastCloneDeep = exports.sanitize = void 0;
|
8
|
-
/* global jQuery */
|
9
8
|
const lodash_1 = __importDefault(require("lodash"));
|
10
9
|
const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
|
11
10
|
const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
|
@@ -1064,9 +1063,6 @@ function bootstrapVersion(options) {
|
|
1064
1063
|
if (options.bootstrap) {
|
1065
1064
|
return options.bootstrap;
|
1066
1065
|
}
|
1067
|
-
if ((typeof jQuery === 'function') && (typeof jQuery().collapse === 'function')) {
|
1068
|
-
return parseInt(jQuery.fn.collapse.Constructor.VERSION.split('.')[0], 10);
|
1069
|
-
}
|
1070
1066
|
if (window.bootstrap && window.bootstrap.Collapse) {
|
1071
1067
|
return parseInt(window.bootstrap.Collapse.VERSION.split('.')[0], 10);
|
1072
1068
|
}
|
package/lib/mjs/Webform.js
CHANGED
@@ -1121,7 +1121,7 @@ export default class Webform extends NestedDataComponent {
|
|
1121
1121
|
// Mark any components as invalid if in a custom message.
|
1122
1122
|
const componentErrors = {};
|
1123
1123
|
errors.forEach((err) => {
|
1124
|
-
const path = err.path || err.context?.path || err.component?.key;
|
1124
|
+
const path = getStringFromComponentPath(err.path) || err.context?.path || err.component?.key;
|
1125
1125
|
if (!componentErrors[path]) {
|
1126
1126
|
componentErrors[path] = [];
|
1127
1127
|
}
|
@@ -1160,9 +1160,15 @@ export default class Component extends Element {
|
|
1160
1160
|
if (this.hasInput && this.component.validate?.required && !this.isPDFReadOnlyMode) {
|
1161
1161
|
modalLabel = { className: 'field-required' };
|
1162
1162
|
}
|
1163
|
+
let messages = '';
|
1164
|
+
if (this.errors?.length) {
|
1165
|
+
messages = this.errors.map((err) => {
|
1166
|
+
return err.level === 'error' ? this.renderTemplate('message', { ...err }) : '';
|
1167
|
+
}).join('');
|
1168
|
+
}
|
1163
1169
|
return this.renderModalPreview({
|
1164
1170
|
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('clickToSetValue'),
|
1165
|
-
messages
|
1171
|
+
messages,
|
1166
1172
|
labelInfo: modalLabel,
|
1167
1173
|
});
|
1168
1174
|
}
|
@@ -82,6 +82,7 @@ declare const _default: ({
|
|
82
82
|
inline?: undefined;
|
83
83
|
defaultValue?: undefined;
|
84
84
|
values?: undefined;
|
85
|
+
customConditional?: undefined;
|
85
86
|
logic?: undefined;
|
86
87
|
dataSrc?: undefined;
|
87
88
|
valueProperty?: undefined;
|
@@ -101,6 +102,7 @@ declare const _default: ({
|
|
101
102
|
inline?: undefined;
|
102
103
|
defaultValue?: undefined;
|
103
104
|
values?: undefined;
|
105
|
+
customConditional?: undefined;
|
104
106
|
logic?: undefined;
|
105
107
|
dataSrc?: undefined;
|
106
108
|
valueProperty?: undefined;
|
@@ -126,6 +128,7 @@ declare const _default: ({
|
|
126
128
|
value: string;
|
127
129
|
})[];
|
128
130
|
placeholder?: undefined;
|
131
|
+
customConditional?: undefined;
|
129
132
|
logic?: undefined;
|
130
133
|
dataSrc?: undefined;
|
131
134
|
valueProperty?: undefined;
|
@@ -141,6 +144,7 @@ declare const _default: ({
|
|
141
144
|
tooltip: string;
|
142
145
|
key: string;
|
143
146
|
input: boolean;
|
147
|
+
customConditional: string;
|
144
148
|
logic: ({
|
145
149
|
name: string;
|
146
150
|
trigger: {
|
@@ -211,6 +215,7 @@ declare const _default: ({
|
|
211
215
|
inline?: undefined;
|
212
216
|
defaultValue?: undefined;
|
213
217
|
values?: undefined;
|
218
|
+
customConditional?: undefined;
|
214
219
|
logic?: undefined;
|
215
220
|
as?: undefined;
|
216
221
|
editor?: undefined;
|
@@ -226,6 +231,7 @@ declare const _default: ({
|
|
226
231
|
placeholder?: undefined;
|
227
232
|
inline?: undefined;
|
228
233
|
values?: undefined;
|
234
|
+
customConditional?: undefined;
|
229
235
|
logic?: undefined;
|
230
236
|
dataSrc?: undefined;
|
231
237
|
valueProperty?: undefined;
|
@@ -248,6 +254,7 @@ declare const _default: ({
|
|
248
254
|
placeholder?: undefined;
|
249
255
|
inline?: undefined;
|
250
256
|
values?: undefined;
|
257
|
+
customConditional?: undefined;
|
251
258
|
logic?: undefined;
|
252
259
|
dataSrc?: undefined;
|
253
260
|
valueProperty?: undefined;
|
@@ -415,12 +415,16 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
415
415
|
}
|
416
416
|
updateComponentsRowIndex(components, rowIndex) {
|
417
417
|
components.forEach((component, colIndex) => {
|
418
|
+
if (this.componentsMap[component.paths.dataPath]) {
|
419
|
+
delete this.componentsMap[component.paths.dataPath];
|
420
|
+
}
|
418
421
|
if (component.options?.name) {
|
419
422
|
const newName = `[${this.key}][${rowIndex}]`;
|
420
423
|
component.options.name = component.options.name.replace(`[${this.key}][${component.rowIndex}]`, newName);
|
421
424
|
}
|
422
425
|
component.rowIndex = rowIndex;
|
423
426
|
component.row = `${rowIndex}-${colIndex}`;
|
427
|
+
this.componentsMap[component.paths.dataPath] = component;
|
424
428
|
});
|
425
429
|
}
|
426
430
|
updateRowsComponents(rowIndex) {
|
@@ -125,13 +125,17 @@ function url(formio) {
|
|
125
125
|
deleteFile(fileInfo, options) {
|
126
126
|
return new Promise((resolve, reject) => {
|
127
127
|
const xhr = new XMLHttpRequest();
|
128
|
-
xhr.open(
|
128
|
+
xhr.open("DELETE", fileInfo.url, true);
|
129
|
+
const token = formio.getToken();
|
130
|
+
if (token) {
|
131
|
+
xhr.setRequestHeader("x-jwt-token", token);
|
132
|
+
}
|
129
133
|
xhr.onload = () => {
|
130
134
|
if (xhr.status >= 200 && xhr.status < 300) {
|
131
|
-
resolve(
|
135
|
+
resolve("File deleted");
|
132
136
|
}
|
133
137
|
else {
|
134
|
-
reject(xhr.response ||
|
138
|
+
reject(xhr.response || "Unable to delete file");
|
135
139
|
}
|
136
140
|
};
|
137
141
|
if (options) {
|
package/lib/mjs/utils/utils.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/* global jQuery */
|
2
1
|
import _ from 'lodash';
|
3
2
|
import moment from 'moment-timezone/moment-timezone';
|
4
3
|
import jtz from 'jstimezonedetect';
|
@@ -1014,9 +1013,6 @@ export function bootstrapVersion(options) {
|
|
1014
1013
|
if (options.bootstrap) {
|
1015
1014
|
return options.bootstrap;
|
1016
1015
|
}
|
1017
|
-
if ((typeof jQuery === 'function') && (typeof jQuery().collapse === 'function')) {
|
1018
|
-
return parseInt(jQuery.fn.collapse.Constructor.VERSION.split('.')[0], 10);
|
1019
|
-
}
|
1020
1016
|
if (window.bootstrap && window.bootstrap.Collapse) {
|
1021
1017
|
return parseInt(window.bootstrap.Collapse.VERSION.split('.')[0], 10);
|
1022
1018
|
}
|