@formio/js 5.1.0-dev.6094.c49181e → 5.1.0-dev.6100.6a7b450
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/README.md +7 -0
- package/dist/formio.form.js +125 -125
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +132 -132
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.js +74 -63
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +86 -75
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/Element.js +13 -36
- package/lib/cjs/EventEmitter.js +2 -25
- package/lib/cjs/Form.js +2 -25
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -5
- package/lib/cjs/Webform.js +3 -4
- package/lib/cjs/WebformBuilder.d.ts +1 -0
- package/lib/cjs/WebformBuilder.js +33 -14
- package/lib/cjs/Wizard.d.ts +1 -2
- package/lib/cjs/Wizard.js +18 -24
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/cjs/components/_classes/component/Component.js +36 -57
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/cjs/components/_classes/input/Input.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +7 -7
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/cjs/components/address/Address.js +1 -1
- package/lib/cjs/components/alert/Alert.js +1 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/button/Button.js +7 -11
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/container/Container.js +1 -1
- package/lib/cjs/components/currency/Currency.js +1 -1
- package/lib/cjs/components/datagrid/DataGrid.js +5 -1
- package/lib/cjs/components/datetime/DateTime.js +1 -1
- package/lib/cjs/components/day/Day.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.js +1 -1
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/cjs/components/file/File.js +5 -6
- package/lib/cjs/components/form/Form.js +14 -2
- package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/panel/Panel.js +1 -1
- package/lib/cjs/components/radio/Radio.js +1 -1
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/cjs/components/select/Select.js +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/cjs/components/survey/Survey.js +1 -1
- package/lib/cjs/components/tags/Tags.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +3 -3
- package/lib/cjs/components/textfield/TextField.js +7 -30
- package/lib/cjs/components/time/Time.js +1 -1
- package/lib/cjs/formio.form.js +3 -3
- package/lib/cjs/i18n.js +1 -1
- package/lib/cjs/providers/storage/uploadAdapter.js +3 -3
- package/lib/cjs/utils/Evaluator.d.ts +20 -6
- package/lib/cjs/utils/Evaluator.js +38 -15
- package/lib/cjs/utils/builder.js +5 -5
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- package/lib/cjs/utils/i18n.js +3 -3
- package/lib/cjs/utils/index.d.ts +169 -2
- package/lib/cjs/utils/index.js +22 -2
- package/lib/cjs/utils/utils.d.ts +4 -9
- package/lib/cjs/utils/utils.js +20 -51
- package/lib/cjs/widgets/CalendarWidget.d.ts +1 -1
- package/lib/cjs/widgets/CalendarWidget.js +5 -7
- package/lib/mjs/Element.js +6 -6
- package/lib/mjs/EventEmitter.js +2 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.js +1 -2
- package/lib/mjs/Webform.js +1 -2
- package/lib/mjs/WebformBuilder.d.ts +1 -0
- package/lib/mjs/WebformBuilder.js +25 -7
- package/lib/mjs/Wizard.d.ts +1 -2
- package/lib/mjs/Wizard.js +17 -23
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/mjs/components/_classes/component/Component.js +9 -7
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/mjs/components/_classes/input/Input.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +7 -7
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/mjs/components/address/Address.js +1 -1
- package/lib/mjs/components/alert/Alert.js +1 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/button/Button.js +7 -10
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/container/Container.js +1 -1
- package/lib/mjs/components/currency/Currency.js +1 -1
- package/lib/mjs/components/datagrid/DataGrid.js +5 -1
- package/lib/mjs/components/datetime/DateTime.js +1 -1
- package/lib/mjs/components/day/Day.js +2 -2
- package/lib/mjs/components/editgrid/EditGrid.js +1 -1
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/file/File.js +5 -6
- package/lib/mjs/components/form/Form.js +13 -2
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/panel/Panel.js +1 -1
- package/lib/mjs/components/radio/Radio.js +1 -1
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/mjs/components/select/Select.js +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/survey/Survey.js +1 -1
- package/lib/mjs/components/tags/Tags.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +3 -3
- package/lib/mjs/components/textfield/TextField.js +1 -1
- package/lib/mjs/components/time/Time.js +1 -1
- package/lib/mjs/formio.form.js +2 -2
- package/lib/mjs/i18n.js +1 -1
- package/lib/mjs/providers/storage/uploadAdapter.js +3 -3
- package/lib/mjs/utils/Evaluator.d.ts +20 -6
- package/lib/mjs/utils/Evaluator.js +31 -13
- package/lib/mjs/utils/builder.js +1 -1
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/i18n.js +1 -1
- package/lib/mjs/utils/index.d.ts +169 -2
- package/lib/mjs/utils/index.js +18 -1
- package/lib/mjs/utils/utils.d.ts +4 -9
- package/lib/mjs/utils/utils.js +16 -30
- package/lib/mjs/widgets/CalendarWidget.d.ts +1 -1
- package/lib/mjs/widgets/CalendarWidget.js +5 -7
- package/package.json +6 -5
package/lib/cjs/utils/index.d.ts
CHANGED
@@ -1,3 +1,170 @@
|
|
1
|
-
export
|
1
|
+
export * from "./utils";
|
2
|
+
export * from "./formUtils";
|
2
3
|
export default FormioUtils;
|
3
|
-
|
4
|
+
declare const FormioUtils: {
|
5
|
+
Evaluator: import("./Evaluator").DefaultEvaluator;
|
6
|
+
interpolate: typeof interpolate;
|
7
|
+
ConditionOperators: {
|
8
|
+
[x: string]: typeof import("./conditionOperators/IsEqualTo").default | typeof import("./conditionOperators/DateGreaterThan").default;
|
9
|
+
};
|
10
|
+
_: any;
|
11
|
+
moment: typeof moment;
|
12
|
+
flattenComponents: typeof import("@formio/core/lib/utils/formUtil").flattenComponents;
|
13
|
+
guid: typeof import("@formio/core/lib/utils/formUtil").guid;
|
14
|
+
uniqueName: typeof import("@formio/core/lib/utils/formUtil").uniqueName;
|
15
|
+
MODEL_TYPES_OF_KNOWN_COMPONENTS: {
|
16
|
+
nestedArray: string[];
|
17
|
+
nestedDataArray: string[];
|
18
|
+
dataObject: string[];
|
19
|
+
object: string[];
|
20
|
+
map: string[];
|
21
|
+
content: string[];
|
22
|
+
string: string[];
|
23
|
+
number: string[];
|
24
|
+
boolean: string[];
|
25
|
+
none: string[];
|
26
|
+
any: string[];
|
27
|
+
};
|
28
|
+
getModelType: typeof import("@formio/core/lib/utils/formUtil").getModelType;
|
29
|
+
getComponentPath: any;
|
30
|
+
setComponentScope: typeof import("@formio/core/lib/utils/formUtil").setComponentScope;
|
31
|
+
resetComponentScope: typeof import("@formio/core/lib/utils/formUtil").resetComponentScope;
|
32
|
+
isComponentNestedDataType: typeof import("@formio/core/lib/utils/formUtil").isComponentNestedDataType;
|
33
|
+
componentPath: typeof import("@formio/core/lib/utils/formUtil").componentPath;
|
34
|
+
getComponentPaths: typeof import("@formio/core/lib/utils/formUtil").getComponentPaths;
|
35
|
+
componentMatches: typeof import("@formio/core/lib/utils/formUtil").componentMatches;
|
36
|
+
getBestMatch: typeof import("@formio/core/lib/utils/formUtil").getBestMatch;
|
37
|
+
getComponentFromPath: typeof import("@formio/core/lib/utils/formUtil").getComponentFromPath;
|
38
|
+
getComponentValue: typeof import("@formio/core/lib/utils/formUtil").getComponentValue;
|
39
|
+
findComponents: typeof import("@formio/core/lib/utils/formUtil").findComponents;
|
40
|
+
eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => Promise<void>;
|
41
|
+
eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => void;
|
42
|
+
getComponentKey: typeof import("@formio/core/lib/utils/formUtil").getComponentKey;
|
43
|
+
getContextualRowPath: typeof import("@formio/core/lib/utils/formUtil").getContextualRowPath;
|
44
|
+
getContextualRowData: typeof import("@formio/core/lib/utils/formUtil").getContextualRowData;
|
45
|
+
componentInfo: typeof import("@formio/core/lib/utils/formUtil").componentInfo;
|
46
|
+
eachComponent: typeof import("@formio/core/lib/utils/formUtil").eachComponent;
|
47
|
+
eachComponentAsync: typeof import("@formio/core/lib/utils/formUtil").eachComponentAsync;
|
48
|
+
getComponentData: typeof import("@formio/core/lib/utils/formUtil").getComponentData;
|
49
|
+
getComponentActualValue: any;
|
50
|
+
isLayoutComponent: typeof import("@formio/core/lib/utils/formUtil").isLayoutComponent;
|
51
|
+
matchComponent: typeof import("@formio/core/lib/utils/formUtil").matchComponent;
|
52
|
+
getComponent: typeof import("@formio/core/lib/utils/formUtil").getComponent;
|
53
|
+
searchComponents: typeof import("@formio/core/lib/utils/formUtil").searchComponents;
|
54
|
+
removeComponent: typeof import("@formio/core/lib/utils/formUtil").removeComponent;
|
55
|
+
hasCondition: typeof import("@formio/core/lib/utils/formUtil").hasCondition;
|
56
|
+
parseFloatExt: typeof import("@formio/core/lib/utils/formUtil").parseFloatExt;
|
57
|
+
formatAsCurrency: typeof import("@formio/core/lib/utils/formUtil").formatAsCurrency;
|
58
|
+
escapeRegExCharacters: typeof import("@formio/core/lib/utils/formUtil").escapeRegExCharacters;
|
59
|
+
getValue: typeof import("@formio/core/lib/utils/formUtil").getValue;
|
60
|
+
getStrings: typeof import("@formio/core/lib/utils/formUtil").getStrings;
|
61
|
+
generateFormChange: typeof import("@formio/core/lib/utils/formUtil").generateFormChange;
|
62
|
+
applyFormChanges: typeof import("@formio/core/lib/utils/formUtil").applyFormChanges;
|
63
|
+
findComponent: typeof import("@formio/core/lib/utils/formUtil").findComponent;
|
64
|
+
getEmptyValue: typeof import("@formio/core/lib/utils/formUtil").getEmptyValue;
|
65
|
+
isComponentDataEmpty: typeof import("@formio/core/lib/utils/formUtil").isComponentDataEmpty;
|
66
|
+
isSelectResourceWithObjectValue: typeof import("@formio/core/lib/utils/formUtil").isSelectResourceWithObjectValue;
|
67
|
+
compareSelectResourceWithObjectTypeValues: typeof import("@formio/core/lib/utils/formUtil").compareSelectResourceWithObjectTypeValues;
|
68
|
+
getItemTemplateKeys: typeof import("@formio/core/lib/utils/formUtil").getItemTemplateKeys;
|
69
|
+
evaluate(func: string | object | Function, args: any, ret: string, interpolate: boolean, options?: import("@formio/core").EvaluatorOptions): any;
|
70
|
+
getRandomComponentId(): string;
|
71
|
+
getPropertyValue(style: CSSStyleDeclaration, prop: string): number;
|
72
|
+
getElementRect(element: HTMLElement): {
|
73
|
+
x: number;
|
74
|
+
y: number;
|
75
|
+
width: number;
|
76
|
+
height: number;
|
77
|
+
};
|
78
|
+
getScriptPlugin(property: string): any;
|
79
|
+
boolValue(value: string | boolean): boolean;
|
80
|
+
isMongoId(text: string): boolean;
|
81
|
+
checkCalculated(component: import("@formio/core").Component, submission: import("@formio/core").Submission, rowData: any): void;
|
82
|
+
checkSimpleConditional(component: any, condition: any, row: any, data: any, instance: any): boolean;
|
83
|
+
checkCustomConditional(component: import("@formio/core").Component, custom: string, row: any, data: any, form: import("@formio/core").Form, variable: string, onError: any, instance: any): any;
|
84
|
+
checkJsonConditional(component: import("@formio/core").Component, json: import("@formio/core").JSONConditional, row: any, data: any, form: import("@formio/core").Form, onError: any): boolean;
|
85
|
+
checkCondition(component: import("@formio/core").Component, row: any, data: any, form: import("@formio/core").Form, instance: any): boolean;
|
86
|
+
checkTrigger(component: import("@formio/core").Component, trigger: any, row: import("@formio/core").DataObject, data: import("@formio/core").DataObject, form: import("@formio/core").Form, instance: any): boolean;
|
87
|
+
setActionProperty(component: import("@formio/core").Component, action: any, result: string, row: import("@formio/core").DataObject, data: import("@formio/core").DataObject, instance: any): import("@formio/core").Component;
|
88
|
+
removeHTML(str: string): string;
|
89
|
+
unescapeHTML(str: string): string;
|
90
|
+
convertStringToHTMLElement(str: string, selector: string): HTMLElement;
|
91
|
+
getDateSetting(date: string | Date): import("dayjs").Dayjs | null;
|
92
|
+
isValidDate(date: string | Date): boolean;
|
93
|
+
currentTimezone(): string;
|
94
|
+
offsetDate(date: Date, timezone: string): {
|
95
|
+
date: Date;
|
96
|
+
abbr: string;
|
97
|
+
};
|
98
|
+
shouldHandleTimezone(timezone: string): boolean;
|
99
|
+
dayjsDate(value: string | Date, format: string, timezone: string, options: object): import("dayjs").Dayjs;
|
100
|
+
formatDate(value: string | Date, format: string, timezone: string, flatPickrInputFormat: string): string;
|
101
|
+
formatOffset(formatFn: Function, date: string | Date, format: string, timezone: string): string;
|
102
|
+
getLocaleDateFormatInfo(locale: Intl.LocalesArgument): object;
|
103
|
+
convertFormatToFlatpickr(format: string): string;
|
104
|
+
convertFormatToDayjs(format: string): string;
|
105
|
+
convertFormatToMask(format: string): string;
|
106
|
+
getInputMask(mask: string, placeholderChar: string): any[];
|
107
|
+
unmaskValue(value: string, mask: string, placeholderChar: string): string;
|
108
|
+
matchInputMask(value: string, inputMask: string): boolean;
|
109
|
+
getNumberSeparators(lang?: string): {
|
110
|
+
delimiter: string;
|
111
|
+
decimalSeparator: string;
|
112
|
+
};
|
113
|
+
getNumberDecimalLimit(component: import("@formio/core").Component, defaultLimit: number): number;
|
114
|
+
getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }: {
|
115
|
+
currency: string;
|
116
|
+
decimalLimit: number;
|
117
|
+
decimalSeparator: string;
|
118
|
+
lang: string;
|
119
|
+
}): {
|
120
|
+
prefix: string;
|
121
|
+
suffix: string;
|
122
|
+
};
|
123
|
+
fieldData(data: import("@formio/core").DataObject, component: import("@formio/core").Component): any;
|
124
|
+
delay(fn: Function, delay?: number, ...args: any[]): any;
|
125
|
+
iterateKey(key: string): string;
|
126
|
+
uniqueKey(map: Record<string, string>, base: string): string;
|
127
|
+
bootstrapVersion(options: {
|
128
|
+
bootstrap: string;
|
129
|
+
}): number;
|
130
|
+
unfold(e: any): any;
|
131
|
+
withSwitch(a: any, b: any): Functions[];
|
132
|
+
observeOverload(callback: Function, options?: {
|
133
|
+
limit: number;
|
134
|
+
delay: number;
|
135
|
+
}): Function;
|
136
|
+
getContextComponents(context: any, excludeNested: boolean, excludedTypes?: string[]): any[];
|
137
|
+
getContextButtons(context: any): any[];
|
138
|
+
translateHTMLTemplate(template: string, translate: Function): string;
|
139
|
+
sanitize(string: string, options: any): string;
|
140
|
+
fastCloneDeep(obj: any): any;
|
141
|
+
isInputComponent(componentJson: import("@formio/core").Component): boolean;
|
142
|
+
getArrayFromComponentPath(pathStr: string): string[];
|
143
|
+
isChildOf(child: any, parent: any): boolean;
|
144
|
+
getStringFromComponentPath(path: number[]): string;
|
145
|
+
round(number: number, precision: number): string;
|
146
|
+
getIEBrowserVersion(): number | null;
|
147
|
+
getBrowserInfo(): object;
|
148
|
+
getComponentPathWithoutIndicies(path?: string): string;
|
149
|
+
getDataParentComponent(componentInstance: Component): any;
|
150
|
+
isPromise(value: any): boolean;
|
151
|
+
getFocusableElements(element: HTMLElement): NodeList<HTMLElement>;
|
152
|
+
getComponentSavedTypes(fullSchema: import("@formio/core").Component): string[] | null;
|
153
|
+
hasEncodedTimezone(value: string): boolean;
|
154
|
+
firstNonNil: any;
|
155
|
+
componentValueTypes: {
|
156
|
+
number: string;
|
157
|
+
string: string;
|
158
|
+
boolean: string;
|
159
|
+
array: string;
|
160
|
+
object: string;
|
161
|
+
date: string;
|
162
|
+
any: string;
|
163
|
+
};
|
164
|
+
interpolateErrors: (component: Component, errors: FieldError[], interpolateFn: Function) => [];
|
165
|
+
};
|
166
|
+
import { Evaluator } from './Evaluator';
|
167
|
+
import { registerEvaluator } from './Evaluator';
|
168
|
+
import { interpolate } from './Evaluator';
|
169
|
+
import moment from 'moment';
|
170
|
+
export { FormioUtils as Utils, Evaluator, registerEvaluator };
|
package/lib/cjs/utils/index.js
CHANGED
@@ -22,11 +22,31 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
22
|
__setModuleDefault(result, mod);
|
23
23
|
return result;
|
24
24
|
};
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27
|
+
};
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
30
|
+
};
|
25
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.Utils = void 0;
|
27
|
-
const
|
32
|
+
exports.registerEvaluator = exports.Evaluator = exports.Utils = void 0;
|
33
|
+
const utils = __importStar(require("./utils"));
|
34
|
+
const formUtils = __importStar(require("./formUtils"));
|
35
|
+
const Evaluator_1 = require("./Evaluator");
|
36
|
+
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
37
|
+
Object.defineProperty(exports, "registerEvaluator", { enumerable: true, get: function () { return Evaluator_1.registerEvaluator; } });
|
38
|
+
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
39
|
+
const lodash_1 = __importDefault(require("lodash"));
|
40
|
+
const moment_1 = __importDefault(require("moment"));
|
41
|
+
const FormioUtils = Object.assign(Object.assign(Object.assign({}, utils), formUtils), { Evaluator: Evaluator_1.Evaluator,
|
42
|
+
interpolate: Evaluator_1.interpolate,
|
43
|
+
ConditionOperators: conditionOperators_1.default,
|
44
|
+
_: lodash_1.default,
|
45
|
+
moment: moment_1.default });
|
28
46
|
exports.Utils = FormioUtils;
|
29
47
|
if (typeof global === 'object') {
|
30
48
|
global.FormioUtils = FormioUtils;
|
31
49
|
}
|
50
|
+
__exportStar(require("./utils"), exports);
|
51
|
+
__exportStar(require("./formUtils"), exports);
|
32
52
|
exports.default = FormioUtils;
|
package/lib/cjs/utils/utils.d.ts
CHANGED
@@ -403,15 +403,15 @@ export function fastCloneDeep(obj: any): any;
|
|
403
403
|
/**
|
404
404
|
* Returns if the component is an input component.
|
405
405
|
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
406
|
-
* @returns {
|
406
|
+
* @returns {boolean} - TRUE if the component is an input component; FALSE otherwise.
|
407
407
|
*/
|
408
|
-
export function isInputComponent(componentJson: import('@formio/core').Component):
|
408
|
+
export function isInputComponent(componentJson: import('@formio/core').Component): boolean;
|
409
409
|
/**
|
410
410
|
* Takes a component path, and returns a component path array.
|
411
411
|
* @param {string} pathStr - The path string to convert to an array.
|
412
|
-
* @returns {
|
412
|
+
* @returns {Array<string>} - The array of paths.
|
413
413
|
*/
|
414
|
-
export function getArrayFromComponentPath(pathStr: string):
|
414
|
+
export function getArrayFromComponentPath(pathStr: string): Array<string>;
|
415
415
|
/**
|
416
416
|
* Returns true if the component is a child of the parent.
|
417
417
|
* @param {any} child - The child component to check.
|
@@ -488,7 +488,6 @@ export function getComponentSavedTypes(fullSchema: import('@formio/core').Compon
|
|
488
488
|
* @returns {boolean} if value has encoded timezone
|
489
489
|
*/
|
490
490
|
export function hasEncodedTimezone(value: string): boolean;
|
491
|
-
export * from "./formUtils";
|
492
491
|
/**
|
493
492
|
* Map values through unfold and return first non-nil value.
|
494
493
|
* @param {Array<T>} collection - The collection to map through unfold.;
|
@@ -506,7 +505,3 @@ export namespace componentValueTypes {
|
|
506
505
|
}
|
507
506
|
export function interpolateErrors(component: Component, errors: FieldError[], interpolateFn: Function): [];
|
508
507
|
import dayjs from "dayjs";
|
509
|
-
import ConditionOperators from './conditionOperators';
|
510
|
-
import { Evaluator } from './Evaluator';
|
511
|
-
export const interpolate: typeof Evaluator.interpolate;
|
512
|
-
export { jsonLogic, ConditionOperators, moment, Evaluator, _ };
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -1,64 +1,26 @@
|
|
1
1
|
"use strict";
|
2
|
-
/* global jQuery */
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4
|
-
if (k2 === undefined) k2 = k;
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
8
|
-
}
|
9
|
-
Object.defineProperty(o, k2, desc);
|
10
|
-
}) : (function(o, m, k, k2) {
|
11
|
-
if (k2 === undefined) k2 = k;
|
12
|
-
o[k2] = m[k];
|
13
|
-
}));
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
16
|
-
};
|
17
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
18
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
19
4
|
};
|
20
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
|
-
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 =
|
22
|
-
exports.hasEncodedTimezone = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports.
|
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
|
+
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 */
|
23
9
|
const lodash_1 = __importDefault(require("lodash"));
|
24
|
-
exports._ = lodash_1.default;
|
25
|
-
const json_logic_js_1 = __importDefault(require("json-logic-js"));
|
26
|
-
exports.jsonLogic = json_logic_js_1.default;
|
27
10
|
const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
|
28
|
-
exports.moment = moment_timezone_1.default;
|
29
11
|
const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
|
30
|
-
const operators_1 = require("./jsonlogic/operators");
|
31
12
|
const dompurify_1 = __importDefault(require("dompurify"));
|
32
|
-
const formUtils_1 = require("./formUtils");
|
33
|
-
const Evaluator_1 = require("./Evaluator");
|
34
|
-
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
35
|
-
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
36
|
-
exports.ConditionOperators = conditionOperators_1.default;
|
37
|
-
const core_1 = require("@formio/core");
|
38
13
|
const dayjs_1 = __importDefault(require("dayjs"));
|
39
14
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
40
15
|
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
41
16
|
const advancedFormat_1 = __importDefault(require("dayjs/plugin/advancedFormat"));
|
17
|
+
const core_1 = require("@formio/core");
|
18
|
+
const formUtils_1 = require("./formUtils");
|
19
|
+
const Evaluator_1 = require("./Evaluator");
|
20
|
+
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
42
21
|
dayjs_1.default.extend(timezone_1.default);
|
43
22
|
dayjs_1.default.extend(advancedFormat_1.default);
|
44
23
|
dayjs_1.default.extend(utc_1.default);
|
45
|
-
const interpolate = Evaluator_1.Evaluator.interpolate;
|
46
|
-
exports.interpolate = interpolate;
|
47
|
-
__exportStar(require("./formUtils"), exports);
|
48
|
-
// Configure JsonLogic
|
49
|
-
operators_1.lodashOperators.forEach((name) => json_logic_js_1.default.add_operation(`_${name}`, lodash_1.default[name]));
|
50
|
-
// Retrieve Any Date
|
51
|
-
json_logic_js_1.default.add_operation('getDate', (date) => {
|
52
|
-
return (0, moment_timezone_1.default)(date).toISOString();
|
53
|
-
});
|
54
|
-
// Set Relative Minimum Date
|
55
|
-
json_logic_js_1.default.add_operation('relativeMinDate', (relativeMinDate) => {
|
56
|
-
return (0, moment_timezone_1.default)().subtract(relativeMinDate, 'days').toISOString();
|
57
|
-
});
|
58
|
-
// Set Relative Maximum Date
|
59
|
-
json_logic_js_1.default.add_operation('relativeMaxDate', (relativeMaxDate) => {
|
60
|
-
return (0, moment_timezone_1.default)().add(relativeMaxDate, 'days').toISOString();
|
61
|
-
});
|
62
24
|
/**
|
63
25
|
* Evaluate a method.
|
64
26
|
* @param {Function|string|object} func - The function to evaluate.
|
@@ -247,13 +209,20 @@ function checkSimpleConditional(component, condition, row, data, instance) {
|
|
247
209
|
return true;
|
248
210
|
}
|
249
211
|
const conditionsResult = lodash_1.default.map(conditions, (cond) => {
|
250
|
-
var _a, _b;
|
251
212
|
const { value: comparedValue, operator, component: conditionComponentPath } = cond;
|
252
213
|
if (!conditionComponentPath) {
|
253
214
|
return true;
|
254
215
|
}
|
255
216
|
const splittedConditionPath = conditionComponentPath.split('.');
|
256
|
-
const
|
217
|
+
const checkParentTypeInTree = (instance, componentType) => {
|
218
|
+
if (!(instance === null || instance === void 0 ? void 0 : instance.parent)) {
|
219
|
+
return false;
|
220
|
+
}
|
221
|
+
return (instance === null || instance === void 0 ? void 0 : instance.parent.type) === componentType || checkParentTypeInTree(instance.parent, componentType);
|
222
|
+
};
|
223
|
+
const conditionalPaths = checkParentTypeInTree(instance, 'datagrid') || checkParentTypeInTree(instance, 'editgrid')
|
224
|
+
? []
|
225
|
+
: getConditionalPathsRecursive(splittedConditionPath, data);
|
257
226
|
if (conditionalPaths.length > 0) {
|
258
227
|
return conditionalPaths.map((path) => {
|
259
228
|
const value = getComponentActualValue(path, data, row);
|
@@ -342,7 +311,7 @@ exports.checkCustomConditional = checkCustomConditional;
|
|
342
311
|
*/
|
343
312
|
function checkJsonConditional(component, json, row, data, form, onError) {
|
344
313
|
try {
|
345
|
-
return
|
314
|
+
return core_1.jsonLogic.apply(json, {
|
346
315
|
data,
|
347
316
|
row,
|
348
317
|
form,
|
@@ -372,7 +341,7 @@ function getRow(component, row, instance, conditional) {
|
|
372
341
|
}
|
373
342
|
const dataParent = getDataParentComponent(instance);
|
374
343
|
if (dataParent) {
|
375
|
-
const parentPath = (_a = dataParent.paths) === null || _a === void 0 ? void 0 : _a.
|
344
|
+
const parentPath = (_a = dataParent.paths) === null || _a === void 0 ? void 0 : _a.localPath;
|
376
345
|
const isTriggerCondtionComponentPath = condition.when || !condition.conditions
|
377
346
|
? (_b = condition.when) === null || _b === void 0 ? void 0 : _b.startsWith((_c = dataParent.paths) === null || _c === void 0 ? void 0 : _c.localPath)
|
378
347
|
: lodash_1.default.some(condition.conditions, cond => { var _a; return cond.component.startsWith((_a = dataParent.paths) === null || _a === void 0 ? void 0 : _a.localPath); });
|
@@ -1355,7 +1324,7 @@ exports.fastCloneDeep = fastCloneDeep;
|
|
1355
1324
|
/**
|
1356
1325
|
* Returns if the component is an input component.
|
1357
1326
|
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
1358
|
-
* @returns {
|
1327
|
+
* @returns {boolean} - TRUE if the component is an input component; FALSE otherwise.
|
1359
1328
|
*/
|
1360
1329
|
function isInputComponent(componentJson) {
|
1361
1330
|
if (componentJson.input === false || componentJson.input === true) {
|
@@ -1380,7 +1349,7 @@ exports.isInputComponent = isInputComponent;
|
|
1380
1349
|
/**
|
1381
1350
|
* Takes a component path, and returns a component path array.
|
1382
1351
|
* @param {string} pathStr - The path string to convert to an array.
|
1383
|
-
* @returns {
|
1352
|
+
* @returns {Array<string>} - The array of paths.
|
1384
1353
|
*/
|
1385
1354
|
function getArrayFromComponentPath(pathStr) {
|
1386
1355
|
if (!pathStr || !lodash_1.default.isString(pathStr)) {
|
@@ -77,7 +77,7 @@ export default class CalendarWidget extends InputWidget {
|
|
77
77
|
* @returns {void}
|
78
78
|
*/
|
79
79
|
setValue(value: any): void;
|
80
|
-
getValueAsString(value: any, format
|
80
|
+
getValueAsString(value: any, format?: string): string;
|
81
81
|
setErrorClasses(hasErrors: any): void;
|
82
82
|
isCalendarElement(element: any): any;
|
83
83
|
initFlatpickr(Flatpickr: any): void;
|
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const Formio_1 = require("../Formio");
|
7
|
-
const InputWidget_1 = __importDefault(require("./InputWidget"));
|
8
|
-
const utils_1 = require("../utils/utils");
|
9
6
|
const moment_1 = __importDefault(require("moment"));
|
10
7
|
const lodash_1 = __importDefault(require("lodash"));
|
8
|
+
const Formio_1 = require("../Formio");
|
9
|
+
const InputWidget_1 = __importDefault(require("./InputWidget"));
|
10
|
+
const utils_1 = require("../utils");
|
11
11
|
const DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';
|
12
12
|
const ISO_8601_FORMAT = 'yyyy-MM-ddTHH:mm:ssZ';
|
13
13
|
const isIEBrowser = (0, utils_1.getBrowserInfo)().ie;
|
@@ -265,9 +265,7 @@ class CalendarWidget extends InputWidget_1.default {
|
|
265
265
|
}
|
266
266
|
// If the component is a textfield that does not have timezone information included in the string value then skip
|
267
267
|
// the timezone offset
|
268
|
-
|
269
|
-
this.settings.skipOffset = true;
|
270
|
-
}
|
268
|
+
this.settings.skipOffset = this.component.type === 'textfield' && !(0, utils_1.hasEncodedTimezone)(value);
|
271
269
|
if (value) {
|
272
270
|
if (!saveAsText && this.settings.readOnly) {
|
273
271
|
this.calendar.setDate((0, utils_1.dayjsDate)(value, this.valueFormat, this.timezone).format(), false);
|
@@ -283,7 +281,7 @@ class CalendarWidget extends InputWidget_1.default {
|
|
283
281
|
this.calendar.clear(false);
|
284
282
|
}
|
285
283
|
}
|
286
|
-
getValueAsString(value, format) {
|
284
|
+
getValueAsString(value, format = '') {
|
287
285
|
const inputFormat = format || this.dateFormat;
|
288
286
|
const valueFormat = this.calendar ? this.valueFormat : this.settings.dateFormat;
|
289
287
|
if (this.settings.saveAs === 'text' && this.componentInstance.parent && !this.settings.readOnly) {
|
package/lib/mjs/Element.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
import EventEmitter from './EventEmitter';
|
2
|
-
import { Formio } from './Formio';
|
3
|
-
import * as FormioUtils from './utils/utils';
|
4
|
-
import { I18n } from './utils/i18n';
|
5
1
|
import _ from 'lodash';
|
6
2
|
import moment from 'moment';
|
7
3
|
import maskInput from '@formio/vanilla-text-mask';
|
4
|
+
import EventEmitter from './EventEmitter';
|
5
|
+
import { Formio } from './Formio';
|
6
|
+
import { I18n } from './utils/i18n';
|
7
|
+
import FormioUtils from './utils';
|
8
8
|
/**
|
9
9
|
* The root component for all elements within the Form.io renderer.
|
10
10
|
*/
|
@@ -523,9 +523,9 @@ export default class Element {
|
|
523
523
|
if (this.component.filter === string && !this.options.building) {
|
524
524
|
const evalContext = this.evalContext(data);
|
525
525
|
evalContext.data = _.mapValues(evalContext.data, (val) => _.isString(val) ? encodeURIComponent(val) : val);
|
526
|
-
return FormioUtils.interpolate(string, evalContext, options);
|
526
|
+
return FormioUtils.Evaluator.interpolate(string, evalContext, options);
|
527
527
|
}
|
528
|
-
return FormioUtils.interpolate(string, this.evalContext(data), options);
|
528
|
+
return FormioUtils.Evaluator.interpolate(string, this.evalContext(data), options);
|
529
529
|
}
|
530
530
|
/**
|
531
531
|
* Performs an evaluation using the evaluation context of this component.
|
package/lib/mjs/EventEmitter.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { EventEmitter as EventEmitter3 } from 'eventemitter3';
|
2
|
-
import
|
2
|
+
import { observeOverload } from './utils';
|
3
3
|
export default class EventEmitter extends EventEmitter3 {
|
4
4
|
constructor(conf = {}) {
|
5
5
|
const { loadLimit = 1000, eventsSafeInterval = 300 } = conf;
|
@@ -7,7 +7,7 @@ export default class EventEmitter extends EventEmitter3 {
|
|
7
7
|
const overloadHandler = () => {
|
8
8
|
console.warn(`There were more than ${loadLimit} events emitted in ${eventsSafeInterval} ms. It might be caused by events' infinite loop`, this.id);
|
9
9
|
};
|
10
|
-
const dispatch =
|
10
|
+
const dispatch = observeOverload(overloadHandler, {
|
11
11
|
limit: loadLimit,
|
12
12
|
delay: eventsSafeInterval
|
13
13
|
});
|
package/lib/mjs/Form.js
CHANGED
@@ -2,7 +2,7 @@ import Element from './Element';
|
|
2
2
|
import { Formio } from './Formio';
|
3
3
|
import Displays from './displays';
|
4
4
|
import templates from './templates';
|
5
|
-
import
|
5
|
+
import FormioUtils from './utils';
|
6
6
|
export default class Form extends Element {
|
7
7
|
/**
|
8
8
|
* Represents a JSON value.
|
package/lib/mjs/PDF.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Formio } from './Formio';
|
2
2
|
import Webform from './Webform';
|
3
|
-
import { fastCloneDeep, eachComponent } from './utils
|
3
|
+
import { fastCloneDeep, eachComponent } from './utils';
|
4
4
|
export default class PDF extends Webform {
|
5
5
|
constructor(element, options) {
|
6
6
|
options.display = 'pdf';
|
package/lib/mjs/PDFBuilder.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import { Formio } from './Formio';
|
3
3
|
import WebformBuilder from './WebformBuilder';
|
4
|
-
import { fastCloneDeep, getElementRect, getBrowserInfo } from './utils
|
5
|
-
import { eachComponent } from './utils/formUtils';
|
4
|
+
import { fastCloneDeep, getElementRect, getBrowserInfo, eachComponent } from './utils';
|
6
5
|
import BuilderUtils from './utils/builder';
|
7
6
|
import PDF from './PDF';
|
8
7
|
export default class PDFBuilder extends WebformBuilder {
|
package/lib/mjs/Webform.js
CHANGED
@@ -5,8 +5,7 @@ import i18nDefaults from './i18n';
|
|
5
5
|
import { Formio } from './Formio';
|
6
6
|
import Components from './components/Components';
|
7
7
|
import NestedDataComponent from './components/_classes/nesteddata/NestedDataComponent';
|
8
|
-
import { fastCloneDeep, currentTimezone, unescapeHTML, getStringFromComponentPath, convertStringToHTMLElement, getArrayFromComponentPath, } from './utils
|
9
|
-
import { eachComponent } from './utils/formUtils';
|
8
|
+
import { fastCloneDeep, currentTimezone, unescapeHTML, getStringFromComponentPath, convertStringToHTMLElement, getArrayFromComponentPath, eachComponent } from './utils';
|
10
9
|
import dayjs from "dayjs";
|
11
10
|
// We need this here because dragula pulls in CustomEvent class that requires global to exist.
|
12
11
|
if (typeof window !== 'undefined' && typeof window.global === 'undefined') {
|
@@ -77,6 +77,7 @@ export default class WebformBuilder extends Component {
|
|
77
77
|
removeComponent(component: any, parent: any, original: any, componentInstance: any): boolean | undefined;
|
78
78
|
replaceDoubleQuotes(data: any, fieldsToRemoveDoubleQuotes?: any[]): any;
|
79
79
|
updateComponent(component: any, changed: any): void;
|
80
|
+
originalDefaultValue: any;
|
80
81
|
findRepeatablePaths(): any[];
|
81
82
|
highlightInvalidComponents(): void;
|
82
83
|
/**
|
@@ -3,8 +3,7 @@ import Component from './components/_classes/component/Component';
|
|
3
3
|
import tippy from 'tippy.js';
|
4
4
|
import Components from './components/Components';
|
5
5
|
import { Formio } from './Formio';
|
6
|
-
import { fastCloneDeep, bootstrapVersion, getArrayFromComponentPath, getStringFromComponentPath } from './utils
|
7
|
-
import { eachComponent, getComponent } from './utils/formUtils';
|
6
|
+
import { fastCloneDeep, bootstrapVersion, getArrayFromComponentPath, getStringFromComponentPath, eachComponent, getComponent, componentInfo } from './utils';
|
8
7
|
import BuilderUtils from './utils/builder';
|
9
8
|
import _ from 'lodash';
|
10
9
|
import autoScroll from 'dom-autoscroller';
|
@@ -1054,6 +1053,16 @@ export default class WebformBuilder extends Component {
|
|
1054
1053
|
'fields.month.required',
|
1055
1054
|
'fields.year.required',
|
1056
1055
|
]));
|
1056
|
+
if (defaultValueComponent.component.components) {
|
1057
|
+
if (!this.originalDefaultValue) {
|
1058
|
+
this.originalDefaultValue = fastCloneDeep(defaultValueComponent.component);
|
1059
|
+
}
|
1060
|
+
eachComponent(defaultValueComponent.component.components, (comp => {
|
1061
|
+
if (comp.validate?.required) {
|
1062
|
+
comp.validate.required = false;
|
1063
|
+
}
|
1064
|
+
}));
|
1065
|
+
}
|
1057
1066
|
const parentComponent = defaultValueComponent.parent;
|
1058
1067
|
let tabIndex = -1;
|
1059
1068
|
let index = -1;
|
@@ -1103,11 +1112,14 @@ export default class WebformBuilder extends Component {
|
|
1103
1112
|
const repeatablePaths = [];
|
1104
1113
|
const keys = new Map();
|
1105
1114
|
eachComponent(this.form.components, (comp, path, components, parent, paths) => {
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1115
|
+
const isLayout = componentInfo(comp).layout;
|
1116
|
+
if (!isLayout) {
|
1117
|
+
if (keys.has(paths.dataPath)) {
|
1118
|
+
repeatablePaths.push(paths.dataPath);
|
1119
|
+
}
|
1120
|
+
else {
|
1121
|
+
keys.set(paths.dataPath, true);
|
1122
|
+
}
|
1111
1123
|
}
|
1112
1124
|
}, true);
|
1113
1125
|
return repeatablePaths;
|
@@ -1121,6 +1133,9 @@ export default class WebformBuilder extends Component {
|
|
1121
1133
|
comp.setCustomValidity(this.t('apiKey', { key: comp.key }));
|
1122
1134
|
hasInvalidComponents = true;
|
1123
1135
|
}
|
1136
|
+
else {
|
1137
|
+
comp.setCustomValidity();
|
1138
|
+
}
|
1124
1139
|
});
|
1125
1140
|
this.emit('builderFormValidityChange', hasInvalidComponents);
|
1126
1141
|
}
|
@@ -1145,6 +1160,9 @@ export default class WebformBuilder extends Component {
|
|
1145
1160
|
if (index !== -1) {
|
1146
1161
|
let submissionData = this.editForm.submission.data;
|
1147
1162
|
submissionData = submissionData.componentJson || submissionData;
|
1163
|
+
if (submissionData.components && this.originalDefaultValue) {
|
1164
|
+
submissionData.components = this.originalDefaultValue.components;
|
1165
|
+
}
|
1148
1166
|
const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];
|
1149
1167
|
this.replaceDoubleQuotes(submissionData, fieldsToRemoveDoubleQuotes);
|
1150
1168
|
this.hook('beforeSaveComponentSettings', submissionData);
|
package/lib/mjs/Wizard.d.ts
CHANGED
@@ -6,7 +6,6 @@ declare class Wizard extends Webform {
|
|
6
6
|
originalComponents: any[];
|
7
7
|
page: number;
|
8
8
|
currentPanel: any;
|
9
|
-
currentPanels: any[] | null;
|
10
9
|
currentNextPage: number;
|
11
10
|
_seenPages: number[];
|
12
11
|
subWizards: any[];
|
@@ -17,7 +16,7 @@ declare class Wizard extends Webform {
|
|
17
16
|
originalOptions: any;
|
18
17
|
isLastPage(): any;
|
19
18
|
getPages(args?: {}): any[];
|
20
|
-
get
|
19
|
+
get hasSubWizards(): boolean;
|
21
20
|
get localData(): any;
|
22
21
|
get wizardKey(): string;
|
23
22
|
set wizard(form: object);
|