@formio/js 5.0.0-dev.5889.5851e22 → 5.0.0-dev.5890.76714be
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/Changelog.md +1 -0
- package/dist/formio.form.js +37 -16
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +37 -16
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.js +204 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -0
- package/dist/formio.utils.js +31 -10
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/Webform.js +2 -1
- package/lib/cjs/components/_classes/component/Component.js +28 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +3 -0
- package/lib/cjs/components/radio/Radio.js +6 -6
- package/lib/cjs/components/select/Select.js +1 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +12 -0
- package/lib/mjs/Webform.js +1 -1
- package/lib/mjs/components/_classes/component/Component.js +28 -2
- package/lib/mjs/components/_classes/nested/NestedComponent.js +3 -0
- package/lib/mjs/components/radio/Radio.js +6 -6
- package/lib/mjs/components/select/Select.js +1 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +13 -1
- package/package.json +2 -2
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
|
|
22
22
|
|
|
23
|
+
/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */
|
|
24
|
+
|
|
23
25
|
/*! formiojs v5.0.0-rc.59 | https://unpkg.com/formiojs@5.0.0-rc.59/LICENSE.txt */
|
|
24
26
|
|
|
25
27
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -738,7 +738,8 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
738
738
|
this.emit(restoreDraft ? "restoreDraftError" : "saveDraftError", errDetails || errorMessage);
|
|
739
739
|
}
|
|
740
740
|
saveDraft() {
|
|
741
|
-
|
|
741
|
+
var _a;
|
|
742
|
+
if (!this.draftEnabled || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.component.reference) === false) {
|
|
742
743
|
return;
|
|
743
744
|
}
|
|
744
745
|
if (!this.formio) {
|
|
@@ -1893,14 +1893,41 @@ class Component extends Element_1.default {
|
|
|
1893
1893
|
* @returns {boolean} - TRUE if the component is visible.
|
|
1894
1894
|
*/
|
|
1895
1895
|
checkComponentConditions(data, flags, row) {
|
|
1896
|
+
var _a, _b, _c;
|
|
1896
1897
|
data = data || this.rootValue;
|
|
1897
1898
|
flags = flags || {};
|
|
1898
1899
|
row = row || this.data;
|
|
1899
1900
|
if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) {
|
|
1900
1901
|
this.redraw();
|
|
1901
1902
|
}
|
|
1903
|
+
let pathCorrect = this.path;
|
|
1904
|
+
if (((_a = this.parent) === null || _a === void 0 ? void 0 : _a.type) !== 'datagrid') {
|
|
1905
|
+
pathCorrect = this.path.replace(/\[[0-9]+\]/g, '');
|
|
1906
|
+
}
|
|
1902
1907
|
// Check advanced conditions
|
|
1903
|
-
const
|
|
1908
|
+
const processContext = {
|
|
1909
|
+
component: this.component,
|
|
1910
|
+
data,
|
|
1911
|
+
row,
|
|
1912
|
+
value: this.validationValue,
|
|
1913
|
+
path: pathCorrect || this.component.key,
|
|
1914
|
+
instance: this,
|
|
1915
|
+
scope: { errors: [] },
|
|
1916
|
+
form: this.root,
|
|
1917
|
+
processors: [
|
|
1918
|
+
process_1.conditionProcessInfo
|
|
1919
|
+
]
|
|
1920
|
+
};
|
|
1921
|
+
let visible = true;
|
|
1922
|
+
if (this.builderMode || this.previewMode || !this.hasCondition()) {
|
|
1923
|
+
visible = !this.component.hidden;
|
|
1924
|
+
}
|
|
1925
|
+
else {
|
|
1926
|
+
(0, process_1.processOneSync)(processContext);
|
|
1927
|
+
const componentPath = pathCorrect || this.component.key;
|
|
1928
|
+
const componentCondition = (_c = (_b = processContext.scope) === null || _b === void 0 ? void 0 : _b.conditionals) === null || _c === void 0 ? void 0 : _c.find(x => x.path === componentPath);
|
|
1929
|
+
visible = !(componentCondition === null || componentCondition === void 0 ? void 0 : componentCondition.conditionallyHidden);
|
|
1930
|
+
}
|
|
1904
1931
|
if (this.visible !== visible) {
|
|
1905
1932
|
this.visible = visible;
|
|
1906
1933
|
}
|
|
@@ -693,6 +693,9 @@ class NestedComponent extends Field_1.default {
|
|
|
693
693
|
if (!instance) {
|
|
694
694
|
return;
|
|
695
695
|
}
|
|
696
|
+
if (!instance.component.path) {
|
|
697
|
+
instance.component.path = component.path;
|
|
698
|
+
}
|
|
696
699
|
instance.checkComponentValidity(data, dirty, row, flags, scope.errors);
|
|
697
700
|
if (instance.processOwnValidation) {
|
|
698
701
|
scope.noRecurse = true;
|
|
@@ -312,12 +312,13 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
312
312
|
.then((response) => {
|
|
313
313
|
this.loading = false;
|
|
314
314
|
this.setItems(response);
|
|
315
|
-
this.optionsLoaded = true;
|
|
316
|
-
this.redraw();
|
|
317
315
|
})
|
|
318
316
|
.catch((err) => {
|
|
319
|
-
this.optionsLoaded = true;
|
|
320
317
|
this.handleLoadingError(err);
|
|
318
|
+
})
|
|
319
|
+
.finally(() => {
|
|
320
|
+
this.optionsLoaded = true;
|
|
321
|
+
this.redraw();
|
|
321
322
|
});
|
|
322
323
|
}
|
|
323
324
|
loadItemsFromMetadata() {
|
|
@@ -341,9 +342,8 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
341
342
|
label: this.component.valueProperty ? this.itemTemplate(item, valueAtProperty) : this.itemTemplate(item, item, i)
|
|
342
343
|
};
|
|
343
344
|
listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
(!this.isRadio && lodash_1.default.isBoolean(valueAtProperty)))) {
|
|
345
|
+
const value = this.loadedOptions[i].value;
|
|
346
|
+
if (!this.isRadio && (lodash_1.default.isObject(value) || lodash_1.default.isBoolean(value) || lodash_1.default.isUndefined(value))) {
|
|
347
347
|
this.loadedOptions[i].invalid = true;
|
|
348
348
|
}
|
|
349
349
|
});
|
|
@@ -1239,7 +1239,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
lodash_1.default.set(submission.metadata.selectData, this.path, templateData);
|
|
1241
1241
|
}
|
|
1242
|
-
if (flags.resetValue && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submission)) {
|
|
1242
|
+
if (flags.resetValue && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submission) && !this.options.readOnly) {
|
|
1243
1243
|
const submission = this.root.submission;
|
|
1244
1244
|
if (!submission.metadata) {
|
|
1245
1245
|
submission.metadata = {};
|
|
@@ -257,6 +257,18 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
|
257
257
|
}
|
|
258
258
|
return super.checkComponentValidity(data, dirty, rowData, options, errors);
|
|
259
259
|
}
|
|
260
|
+
setCustomValidity(messages, dirty, external) {
|
|
261
|
+
if (this.options.building && lodash_1.default.find(messages, { ruleName: 'invalidValueProperty' })) {
|
|
262
|
+
setTimeout(() => {
|
|
263
|
+
this.root && (0, utils_1.getComponent)(this.root.components, 'valueProperty').setCustomValidity(messages, dirty);
|
|
264
|
+
}, 0);
|
|
265
|
+
return super.setCustomValidity(lodash_1.default.filter(messages, (message) => message.ruleName !== 'invalidValueProperty'), dirty, external);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
return super.setCustomValidity(messages, dirty, external);
|
|
269
|
+
}
|
|
270
|
+
;
|
|
271
|
+
}
|
|
260
272
|
validateValueAvailability(setting, value) {
|
|
261
273
|
if (!(0, utils_1.boolValue)(setting) || !value) {
|
|
262
274
|
return true;
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -742,7 +742,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
742
742
|
this.emit(restoreDraft ? "restoreDraftError" : "saveDraftError", errDetails || errorMessage);
|
|
743
743
|
}
|
|
744
744
|
saveDraft() {
|
|
745
|
-
if (!this.draftEnabled) {
|
|
745
|
+
if (!this.draftEnabled || this.parent?.component.reference === false) {
|
|
746
746
|
return;
|
|
747
747
|
}
|
|
748
748
|
if (!this.formio) {
|
|
@@ -3,7 +3,7 @@ import { conformToMask } from '@formio/vanilla-text-mask';
|
|
|
3
3
|
import tippy from 'tippy.js';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import isMobile from 'ismobilejs';
|
|
6
|
-
import { processOne, processOneSync, validateProcessInfo } from '@formio/core/process';
|
|
6
|
+
import { processOne, processOneSync, validateProcessInfo, conditionProcessInfo } from '@formio/core/process';
|
|
7
7
|
import { Formio } from '../../../Formio';
|
|
8
8
|
import * as FormioUtils from '../../../utils/utils';
|
|
9
9
|
import { fastCloneDeep, boolValue, getComponentPath, isInsideScopingComponent, currentTimezone, getScriptPlugin } from '../../../utils/utils';
|
|
@@ -1862,8 +1862,34 @@ export default class Component extends Element {
|
|
|
1862
1862
|
if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) {
|
|
1863
1863
|
this.redraw();
|
|
1864
1864
|
}
|
|
1865
|
+
let pathCorrect = this.path;
|
|
1866
|
+
if (this.parent?.type !== 'datagrid') {
|
|
1867
|
+
pathCorrect = this.path.replace(/\[[0-9]+\]/g, '');
|
|
1868
|
+
}
|
|
1865
1869
|
// Check advanced conditions
|
|
1866
|
-
const
|
|
1870
|
+
const processContext = {
|
|
1871
|
+
component: this.component,
|
|
1872
|
+
data,
|
|
1873
|
+
row,
|
|
1874
|
+
value: this.validationValue,
|
|
1875
|
+
path: pathCorrect || this.component.key,
|
|
1876
|
+
instance: this,
|
|
1877
|
+
scope: { errors: [] },
|
|
1878
|
+
form: this.root,
|
|
1879
|
+
processors: [
|
|
1880
|
+
conditionProcessInfo
|
|
1881
|
+
]
|
|
1882
|
+
};
|
|
1883
|
+
let visible = true;
|
|
1884
|
+
if (this.builderMode || this.previewMode || !this.hasCondition()) {
|
|
1885
|
+
visible = !this.component.hidden;
|
|
1886
|
+
}
|
|
1887
|
+
else {
|
|
1888
|
+
processOneSync(processContext);
|
|
1889
|
+
const componentPath = pathCorrect || this.component.key;
|
|
1890
|
+
const componentCondition = processContext.scope?.conditionals?.find(x => x.path === componentPath);
|
|
1891
|
+
visible = !componentCondition?.conditionallyHidden;
|
|
1892
|
+
}
|
|
1867
1893
|
if (this.visible !== visible) {
|
|
1868
1894
|
this.visible = visible;
|
|
1869
1895
|
}
|
|
@@ -688,6 +688,9 @@ export default class NestedComponent extends Field {
|
|
|
688
688
|
if (!instance) {
|
|
689
689
|
return;
|
|
690
690
|
}
|
|
691
|
+
if (!instance.component.path) {
|
|
692
|
+
instance.component.path = component.path;
|
|
693
|
+
}
|
|
691
694
|
instance.checkComponentValidity(data, dirty, row, flags, scope.errors);
|
|
692
695
|
if (instance.processOwnValidation) {
|
|
693
696
|
scope.noRecurse = true;
|
|
@@ -312,12 +312,13 @@ export default class RadioComponent extends ListComponent {
|
|
|
312
312
|
.then((response) => {
|
|
313
313
|
this.loading = false;
|
|
314
314
|
this.setItems(response);
|
|
315
|
-
this.optionsLoaded = true;
|
|
316
|
-
this.redraw();
|
|
317
315
|
})
|
|
318
316
|
.catch((err) => {
|
|
319
|
-
this.optionsLoaded = true;
|
|
320
317
|
this.handleLoadingError(err);
|
|
318
|
+
})
|
|
319
|
+
.finally(() => {
|
|
320
|
+
this.optionsLoaded = true;
|
|
321
|
+
this.redraw();
|
|
321
322
|
});
|
|
322
323
|
}
|
|
323
324
|
loadItemsFromMetadata() {
|
|
@@ -341,9 +342,8 @@ export default class RadioComponent extends ListComponent {
|
|
|
341
342
|
label: this.component.valueProperty ? this.itemTemplate(item, valueAtProperty) : this.itemTemplate(item, item, i)
|
|
342
343
|
};
|
|
343
344
|
listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
(!this.isRadio && _.isBoolean(valueAtProperty)))) {
|
|
345
|
+
const value = this.loadedOptions[i].value;
|
|
346
|
+
if (!this.isRadio && (_.isObject(value) || _.isBoolean(value) || _.isUndefined(value))) {
|
|
347
347
|
this.loadedOptions[i].invalid = true;
|
|
348
348
|
}
|
|
349
349
|
});
|
|
@@ -1267,7 +1267,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
_.set(submission.metadata.selectData, this.path, templateData);
|
|
1269
1269
|
}
|
|
1270
|
-
if (flags.resetValue && this.root?.submission) {
|
|
1270
|
+
if (flags.resetValue && this.root?.submission && !this.options.readOnly) {
|
|
1271
1271
|
const submission = this.root.submission;
|
|
1272
1272
|
if (!submission.metadata) {
|
|
1273
1273
|
submission.metadata = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import { componentValueTypes, getComponentSavedTypes, boolValue } from '../../utils/utils';
|
|
2
|
+
import { componentValueTypes, getComponentSavedTypes, boolValue, getComponent } from '../../utils/utils';
|
|
3
3
|
import RadioComponent from '../radio/Radio';
|
|
4
4
|
export default class SelectBoxesComponent extends RadioComponent {
|
|
5
5
|
static schema(...extend) {
|
|
@@ -258,6 +258,18 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
|
258
258
|
}
|
|
259
259
|
return super.checkComponentValidity(data, dirty, rowData, options, errors);
|
|
260
260
|
}
|
|
261
|
+
setCustomValidity(messages, dirty, external) {
|
|
262
|
+
if (this.options.building && _.find(messages, { ruleName: 'invalidValueProperty' })) {
|
|
263
|
+
setTimeout(() => {
|
|
264
|
+
this.root && getComponent(this.root.components, 'valueProperty').setCustomValidity(messages, dirty);
|
|
265
|
+
}, 0);
|
|
266
|
+
return super.setCustomValidity(_.filter(messages, (message) => message.ruleName !== 'invalidValueProperty'), dirty, external);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
return super.setCustomValidity(messages, dirty, external);
|
|
270
|
+
}
|
|
271
|
+
;
|
|
272
|
+
}
|
|
261
273
|
validateValueAvailability(setting, value) {
|
|
262
274
|
if (!boolValue(setting) || !value) {
|
|
263
275
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/js",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.5890.76714be",
|
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
|
|
84
84
|
"@formio/choices.js": "^10.2.1",
|
|
85
|
-
"@formio/core": "
|
|
85
|
+
"@formio/core": "2.1.0-dev.183.b3387fc",
|
|
86
86
|
"@formio/text-mask-addons": "^3.8.0-formio.3",
|
|
87
87
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
|
88
88
|
"abortcontroller-polyfill": "^1.7.5",
|