@formio/js 5.1.0-dev.6152.95f2394 → 5.1.0-dev.6155.8178240
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 +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +4 -4
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/PDFBuilder.d.ts +1 -0
- package/lib/cjs/PDFBuilder.js +8 -8
- package/lib/cjs/WebformBuilder.d.ts +1 -1
- package/lib/cjs/WebformBuilder.js +20 -8
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/button/Button.js +4 -4
- package/lib/cjs/utils/utils.js +4 -0
- package/lib/mjs/PDFBuilder.d.ts +1 -0
- package/lib/mjs/PDFBuilder.js +8 -8
- package/lib/mjs/WebformBuilder.d.ts +1 -1
- package/lib/mjs/WebformBuilder.js +19 -8
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/button/Button.js +1 -1
- package/lib/mjs/utils/utils.js +4 -0
- package/package.json +1 -1
package/lib/cjs/PDFBuilder.d.ts
CHANGED
package/lib/cjs/PDFBuilder.js
CHANGED
@@ -451,21 +451,21 @@ class PDFBuilder extends WebformBuilder_1.default {
|
|
451
451
|
e.target.style.cursor = 'default';
|
452
452
|
}
|
453
453
|
highlightInvalidComponents() {
|
454
|
-
const
|
454
|
+
const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
|
455
455
|
// update elements which path was duplicated if any pathes have been changed
|
456
|
-
if (!lodash_1.default.isEqual(this.
|
457
|
-
(0, utils_1.eachComponent)(this.webform.getComponents(), (comp
|
458
|
-
if (this.
|
456
|
+
if (!lodash_1.default.isEqual(this.repeatablePathsComps, repeatablePathsComps)) {
|
457
|
+
(0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
|
458
|
+
if (this.repeatablePathsComps.includes(comp.component)) {
|
459
459
|
this.webform.postMessage({ name: 'updateElement', data: comp.component });
|
460
460
|
}
|
461
461
|
});
|
462
|
-
this.
|
462
|
+
this.repeatablePathsComps = repeatablePathsComps;
|
463
463
|
}
|
464
|
-
if (!
|
464
|
+
if (!repeatablePathsComps.length) {
|
465
465
|
return;
|
466
466
|
}
|
467
|
-
(0, utils_1.eachComponent)(this.webform.getComponents(), (comp
|
468
|
-
if (this.
|
467
|
+
(0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
|
468
|
+
if (this.repeatablePathsComps.includes(comp)) {
|
469
469
|
this.webform.postMessage({
|
470
470
|
name: 'showBuilderErrors',
|
471
471
|
data: {
|
@@ -78,7 +78,7 @@ export default class WebformBuilder extends Component {
|
|
78
78
|
replaceDoubleQuotes(data: any, fieldsToRemoveDoubleQuotes?: any[]): any;
|
79
79
|
updateComponent(component: any, changed: any): void;
|
80
80
|
originalDefaultValue: any;
|
81
|
-
|
81
|
+
findComponentsWithRepeatablePaths(): any[];
|
82
82
|
highlightInvalidComponents(): void;
|
83
83
|
/**
|
84
84
|
* Called when a new component is saved.
|
@@ -1125,25 +1125,37 @@ class WebformBuilder extends Component_1.default {
|
|
1125
1125
|
// Called when we update a component.
|
1126
1126
|
this.emit('updateComponent', component);
|
1127
1127
|
}
|
1128
|
-
|
1129
|
-
const repeatablePaths =
|
1128
|
+
findComponentsWithRepeatablePaths() {
|
1129
|
+
const repeatablePaths = {};
|
1130
1130
|
const keys = new Map();
|
1131
1131
|
(0, utils_1.eachComponent)(this.form.components, (comp, path, components, parent, paths) => {
|
1132
|
+
var _a, _b;
|
1133
|
+
const isRadioCheckbox = comp.type === 'checkbox' && comp.inputType === 'radio';
|
1132
1134
|
if (keys.has(paths.dataPath)) {
|
1133
|
-
repeatablePaths
|
1135
|
+
const onlyRadioCheckboxes = ((_a = repeatablePaths[paths.dataPath]) === null || _a === void 0 ? void 0 : _a.onlyRadioCheckboxes) === false ? false : isRadioCheckbox;
|
1136
|
+
repeatablePaths[paths.dataPath] = {
|
1137
|
+
comps: [...(((_b = repeatablePaths[paths.dataPath]) === null || _b === void 0 ? void 0 : _b.comps) || []), keys.get(paths.dataPath), comp],
|
1138
|
+
onlyRadioCheckboxes,
|
1139
|
+
};
|
1134
1140
|
}
|
1135
1141
|
else {
|
1136
|
-
keys.set(paths.dataPath,
|
1142
|
+
keys.set(paths.dataPath, comp);
|
1137
1143
|
}
|
1138
1144
|
}, true);
|
1139
|
-
|
1145
|
+
const componentsWithRepeatablePaths = [];
|
1146
|
+
Object.keys(repeatablePaths).forEach((path) => {
|
1147
|
+
const { comps, onlyRadioCheckboxes } = repeatablePaths[path];
|
1148
|
+
if (!onlyRadioCheckboxes) {
|
1149
|
+
componentsWithRepeatablePaths.push(...comps);
|
1150
|
+
}
|
1151
|
+
});
|
1152
|
+
return componentsWithRepeatablePaths;
|
1140
1153
|
}
|
1141
1154
|
highlightInvalidComponents() {
|
1142
|
-
const
|
1155
|
+
const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
|
1143
1156
|
let hasInvalidComponents = false;
|
1144
1157
|
this.webform.everyComponent((comp) => {
|
1145
|
-
|
1146
|
-
if (repeatablePaths.includes(path)) {
|
1158
|
+
if (repeatablePathsComps.includes(comp.component)) {
|
1147
1159
|
comp.setCustomValidity(this.t('apiKey', { key: comp.key }));
|
1148
1160
|
hasInvalidComponents = true;
|
1149
1161
|
}
|
@@ -7,7 +7,7 @@ export default class ButtonComponent extends Field {
|
|
7
7
|
weight: number;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
-
static savedValueTypes(schema: any):
|
10
|
+
static savedValueTypes(schema: any): string[];
|
11
11
|
constructor(component: any, options: any, data: any);
|
12
12
|
filesUploading: number;
|
13
13
|
get inputInfo(): any;
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
8
8
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
9
|
-
const
|
9
|
+
const utils_1 = require("../../utils");
|
10
10
|
class ButtonComponent extends Field_1.default {
|
11
11
|
static schema(...extend) {
|
12
12
|
return Input_1.default.schema({
|
@@ -35,7 +35,7 @@ class ButtonComponent extends Field_1.default {
|
|
35
35
|
};
|
36
36
|
}
|
37
37
|
static savedValueTypes(schema) {
|
38
|
-
return (0,
|
38
|
+
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.boolean];
|
39
39
|
}
|
40
40
|
constructor(component, options, data) {
|
41
41
|
super(component, options, data);
|
@@ -306,7 +306,7 @@ class ButtonComponent extends Field_1.default {
|
|
306
306
|
const form = this.getRoot();
|
307
307
|
const flattened = {};
|
308
308
|
const components = {};
|
309
|
-
(0,
|
309
|
+
(0, utils_1.eachComponent)(form.components, (componentWrapper, path) => {
|
310
310
|
const component = componentWrapper.component || componentWrapper;
|
311
311
|
flattened[path] = component;
|
312
312
|
components[component.key] = component;
|
@@ -447,7 +447,7 @@ class ButtonComponent extends Field_1.default {
|
|
447
447
|
}, 100);
|
448
448
|
}
|
449
449
|
get oauthComponentPath() {
|
450
|
-
const pathArray = (0,
|
450
|
+
const pathArray = (0, utils_1.getArrayFromComponentPath)(this.path);
|
451
451
|
return lodash_1.default.chain(pathArray).filter(pathPart => !lodash_1.default.isNumber(pathPart)).join('.').value();
|
452
452
|
}
|
453
453
|
focus() {
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -5,6 +5,7 @@ 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 */
|
8
9
|
const lodash_1 = __importDefault(require("lodash"));
|
9
10
|
const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
|
10
11
|
const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
|
@@ -1056,6 +1057,9 @@ function bootstrapVersion(options) {
|
|
1056
1057
|
if (options.bootstrap) {
|
1057
1058
|
return options.bootstrap;
|
1058
1059
|
}
|
1060
|
+
if ((typeof jQuery === 'function') && (typeof jQuery().collapse === 'function')) {
|
1061
|
+
return parseInt(jQuery.fn.collapse.Constructor.VERSION.split('.')[0], 10);
|
1062
|
+
}
|
1059
1063
|
if (window.bootstrap && window.bootstrap.Collapse) {
|
1060
1064
|
return parseInt(window.bootstrap.Collapse.VERSION.split('.')[0], 10);
|
1061
1065
|
}
|
package/lib/mjs/PDFBuilder.d.ts
CHANGED
package/lib/mjs/PDFBuilder.js
CHANGED
@@ -444,21 +444,21 @@ export default class PDFBuilder extends WebformBuilder {
|
|
444
444
|
e.target.style.cursor = 'default';
|
445
445
|
}
|
446
446
|
highlightInvalidComponents() {
|
447
|
-
const
|
447
|
+
const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
|
448
448
|
// update elements which path was duplicated if any pathes have been changed
|
449
|
-
if (!_.isEqual(this.
|
450
|
-
eachComponent(this.webform.getComponents(), (comp
|
451
|
-
if (this.
|
449
|
+
if (!_.isEqual(this.repeatablePathsComps, repeatablePathsComps)) {
|
450
|
+
eachComponent(this.webform.getComponents(), (comp) => {
|
451
|
+
if (this.repeatablePathsComps.includes(comp.component)) {
|
452
452
|
this.webform.postMessage({ name: 'updateElement', data: comp.component });
|
453
453
|
}
|
454
454
|
});
|
455
|
-
this.
|
455
|
+
this.repeatablePathsComps = repeatablePathsComps;
|
456
456
|
}
|
457
|
-
if (!
|
457
|
+
if (!repeatablePathsComps.length) {
|
458
458
|
return;
|
459
459
|
}
|
460
|
-
eachComponent(this.webform.getComponents(), (comp
|
461
|
-
if (this.
|
460
|
+
eachComponent(this.webform.getComponents(), (comp) => {
|
461
|
+
if (this.repeatablePathsComps.includes(comp)) {
|
462
462
|
this.webform.postMessage({
|
463
463
|
name: 'showBuilderErrors',
|
464
464
|
data: {
|
@@ -78,7 +78,7 @@ export default class WebformBuilder extends Component {
|
|
78
78
|
replaceDoubleQuotes(data: any, fieldsToRemoveDoubleQuotes?: any[]): any;
|
79
79
|
updateComponent(component: any, changed: any): void;
|
80
80
|
originalDefaultValue: any;
|
81
|
-
|
81
|
+
findComponentsWithRepeatablePaths(): any[];
|
82
82
|
highlightInvalidComponents(): void;
|
83
83
|
/**
|
84
84
|
* Called when a new component is saved.
|
@@ -1108,25 +1108,36 @@ export default class WebformBuilder extends Component {
|
|
1108
1108
|
// Called when we update a component.
|
1109
1109
|
this.emit('updateComponent', component);
|
1110
1110
|
}
|
1111
|
-
|
1112
|
-
const repeatablePaths =
|
1111
|
+
findComponentsWithRepeatablePaths() {
|
1112
|
+
const repeatablePaths = {};
|
1113
1113
|
const keys = new Map();
|
1114
1114
|
eachComponent(this.form.components, (comp, path, components, parent, paths) => {
|
1115
|
+
const isRadioCheckbox = comp.type === 'checkbox' && comp.inputType === 'radio';
|
1115
1116
|
if (keys.has(paths.dataPath)) {
|
1116
|
-
repeatablePaths
|
1117
|
+
const onlyRadioCheckboxes = repeatablePaths[paths.dataPath]?.onlyRadioCheckboxes === false ? false : isRadioCheckbox;
|
1118
|
+
repeatablePaths[paths.dataPath] = {
|
1119
|
+
comps: [...(repeatablePaths[paths.dataPath]?.comps || []), keys.get(paths.dataPath), comp],
|
1120
|
+
onlyRadioCheckboxes,
|
1121
|
+
};
|
1117
1122
|
}
|
1118
1123
|
else {
|
1119
|
-
keys.set(paths.dataPath,
|
1124
|
+
keys.set(paths.dataPath, comp);
|
1120
1125
|
}
|
1121
1126
|
}, true);
|
1122
|
-
|
1127
|
+
const componentsWithRepeatablePaths = [];
|
1128
|
+
Object.keys(repeatablePaths).forEach((path) => {
|
1129
|
+
const { comps, onlyRadioCheckboxes } = repeatablePaths[path];
|
1130
|
+
if (!onlyRadioCheckboxes) {
|
1131
|
+
componentsWithRepeatablePaths.push(...comps);
|
1132
|
+
}
|
1133
|
+
});
|
1134
|
+
return componentsWithRepeatablePaths;
|
1123
1135
|
}
|
1124
1136
|
highlightInvalidComponents() {
|
1125
|
-
const
|
1137
|
+
const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
|
1126
1138
|
let hasInvalidComponents = false;
|
1127
1139
|
this.webform.everyComponent((comp) => {
|
1128
|
-
|
1129
|
-
if (repeatablePaths.includes(path)) {
|
1140
|
+
if (repeatablePathsComps.includes(comp.component)) {
|
1130
1141
|
comp.setCustomValidity(this.t('apiKey', { key: comp.key }));
|
1131
1142
|
hasInvalidComponents = true;
|
1132
1143
|
}
|
@@ -7,7 +7,7 @@ export default class ButtonComponent extends Field {
|
|
7
7
|
weight: number;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
-
static savedValueTypes(schema: any):
|
10
|
+
static savedValueTypes(schema: any): string[];
|
11
11
|
constructor(component: any, options: any, data: any);
|
12
12
|
filesUploading: number;
|
13
13
|
get inputInfo(): any;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import Field from '../_classes/field/Field';
|
3
3
|
import Input from '../_classes/input/Input';
|
4
|
-
import { componentValueTypes, eachComponent, getArrayFromComponentPath, getComponentSavedTypes } from '../../utils
|
4
|
+
import { componentValueTypes, eachComponent, getArrayFromComponentPath, getComponentSavedTypes } from '../../utils';
|
5
5
|
export default class ButtonComponent extends Field {
|
6
6
|
static schema(...extend) {
|
7
7
|
return Input.schema({
|
package/lib/mjs/utils/utils.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
/* global jQuery */
|
1
2
|
import _ from 'lodash';
|
2
3
|
import moment from 'moment-timezone/moment-timezone';
|
3
4
|
import jtz from 'jstimezonedetect';
|
@@ -1005,6 +1006,9 @@ export function bootstrapVersion(options) {
|
|
1005
1006
|
if (options.bootstrap) {
|
1006
1007
|
return options.bootstrap;
|
1007
1008
|
}
|
1009
|
+
if ((typeof jQuery === 'function') && (typeof jQuery().collapse === 'function')) {
|
1010
|
+
return parseInt(jQuery.fn.collapse.Constructor.VERSION.split('.')[0], 10);
|
1011
|
+
}
|
1008
1012
|
if (window.bootstrap && window.bootstrap.Collapse) {
|
1009
1013
|
return parseInt(window.bootstrap.Collapse.VERSION.split('.')[0], 10);
|
1010
1014
|
}
|