@formio/js 5.1.0-dev.6101.0682abe → 5.1.0-dev.6102.9a0147c

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.
Files changed (139) hide show
  1. package/README.md +5 -0
  2. package/dist/formio.form.js +125 -125
  3. package/dist/formio.form.min.js +1 -1
  4. package/dist/formio.form.min.js.LICENSE.txt +2 -0
  5. package/dist/formio.full.js +131 -131
  6. package/dist/formio.full.min.js +1 -1
  7. package/dist/formio.full.min.js.LICENSE.txt +2 -0
  8. package/dist/formio.js +73 -62
  9. package/dist/formio.min.js +1 -1
  10. package/dist/formio.utils.js +85 -74
  11. package/dist/formio.utils.min.js +1 -1
  12. package/dist/formio.utils.min.js.LICENSE.txt +2 -0
  13. package/lib/cjs/Element.js +13 -36
  14. package/lib/cjs/EventEmitter.js +2 -25
  15. package/lib/cjs/Form.js +2 -25
  16. package/lib/cjs/PDF.js +1 -1
  17. package/lib/cjs/PDFBuilder.js +4 -5
  18. package/lib/cjs/Webform.js +3 -4
  19. package/lib/cjs/WebformBuilder.d.ts +1 -0
  20. package/lib/cjs/WebformBuilder.js +22 -9
  21. package/lib/cjs/Wizard.d.ts +1 -2
  22. package/lib/cjs/Wizard.js +18 -24
  23. package/lib/cjs/WizardBuilder.js +1 -1
  24. package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
  25. package/lib/cjs/components/_classes/component/Component.js +29 -53
  26. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  27. package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  28. package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
  29. package/lib/cjs/components/_classes/input/Input.js +1 -1
  30. package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
  31. package/lib/cjs/components/_classes/nested/NestedComponent.js +7 -7
  32. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  33. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  34. package/lib/cjs/components/address/Address.js +1 -1
  35. package/lib/cjs/components/alert/Alert.js +1 -1
  36. package/lib/cjs/components/button/Button.d.ts +2 -2
  37. package/lib/cjs/components/button/Button.js +10 -14
  38. package/lib/cjs/components/checkbox/Checkbox.js +1 -1
  39. package/lib/cjs/components/container/Container.js +1 -1
  40. package/lib/cjs/components/currency/Currency.js +1 -1
  41. package/lib/cjs/components/datagrid/DataGrid.js +5 -1
  42. package/lib/cjs/components/datamap/DataMap.d.ts +1 -1
  43. package/lib/cjs/components/datamap/DataMap.js +4 -4
  44. package/lib/cjs/components/datetime/DateTime.js +1 -1
  45. package/lib/cjs/components/day/Day.js +1 -1
  46. package/lib/cjs/components/editgrid/EditGrid.js +1 -1
  47. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  48. package/lib/cjs/components/file/File.js +5 -6
  49. package/lib/cjs/components/form/Form.js +1 -1
  50. package/lib/cjs/components/number/Number.js +1 -1
  51. package/lib/cjs/components/panel/Panel.js +1 -1
  52. package/lib/cjs/components/radio/Radio.js +1 -1
  53. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  54. package/lib/cjs/components/select/Select.js +1 -1
  55. package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
  56. package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
  57. package/lib/cjs/components/signature/Signature.js +1 -1
  58. package/lib/cjs/components/survey/Survey.js +1 -1
  59. package/lib/cjs/components/tags/Tags.js +1 -1
  60. package/lib/cjs/components/textarea/TextArea.js +3 -3
  61. package/lib/cjs/components/textfield/TextField.js +7 -30
  62. package/lib/cjs/components/time/Time.js +1 -1
  63. package/lib/cjs/formio.form.js +3 -3
  64. package/lib/cjs/i18n.js +1 -1
  65. package/lib/cjs/providers/storage/uploadAdapter.js +3 -3
  66. package/lib/cjs/utils/Evaluator.d.ts +13 -6
  67. package/lib/cjs/utils/Evaluator.js +27 -15
  68. package/lib/cjs/utils/builder.js +5 -5
  69. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
  70. package/lib/cjs/utils/i18n.js +3 -3
  71. package/lib/cjs/utils/index.d.ts +160 -2
  72. package/lib/cjs/utils/index.js +12 -2
  73. package/lib/cjs/utils/utils.d.ts +0 -5
  74. package/lib/cjs/utils/utils.js +4 -42
  75. package/lib/cjs/widgets/CalendarWidget.js +1 -1
  76. package/lib/mjs/Element.js +6 -6
  77. package/lib/mjs/EventEmitter.js +2 -2
  78. package/lib/mjs/Form.js +1 -1
  79. package/lib/mjs/PDF.js +1 -1
  80. package/lib/mjs/PDFBuilder.js +1 -2
  81. package/lib/mjs/Webform.js +1 -2
  82. package/lib/mjs/WebformBuilder.d.ts +1 -0
  83. package/lib/mjs/WebformBuilder.js +14 -2
  84. package/lib/mjs/Wizard.d.ts +1 -2
  85. package/lib/mjs/Wizard.js +17 -23
  86. package/lib/mjs/WizardBuilder.js +1 -1
  87. package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
  88. package/lib/mjs/components/_classes/component/Component.js +2 -3
  89. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  90. package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  91. package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
  92. package/lib/mjs/components/_classes/input/Input.js +1 -1
  93. package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
  94. package/lib/mjs/components/_classes/nested/NestedComponent.js +7 -7
  95. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  96. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  97. package/lib/mjs/components/address/Address.js +1 -1
  98. package/lib/mjs/components/alert/Alert.js +1 -1
  99. package/lib/mjs/components/button/Button.d.ts +2 -2
  100. package/lib/mjs/components/button/Button.js +7 -10
  101. package/lib/mjs/components/checkbox/Checkbox.js +1 -1
  102. package/lib/mjs/components/container/Container.js +1 -1
  103. package/lib/mjs/components/currency/Currency.js +1 -1
  104. package/lib/mjs/components/datagrid/DataGrid.js +5 -1
  105. package/lib/mjs/components/datamap/DataMap.d.ts +1 -1
  106. package/lib/mjs/components/datamap/DataMap.js +1 -1
  107. package/lib/mjs/components/datetime/DateTime.js +1 -1
  108. package/lib/mjs/components/day/Day.js +1 -1
  109. package/lib/mjs/components/editgrid/EditGrid.js +1 -1
  110. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  111. package/lib/mjs/components/file/File.js +5 -6
  112. package/lib/mjs/components/form/Form.js +1 -1
  113. package/lib/mjs/components/number/Number.js +1 -1
  114. package/lib/mjs/components/panel/Panel.js +1 -1
  115. package/lib/mjs/components/radio/Radio.js +1 -1
  116. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  117. package/lib/mjs/components/select/Select.js +1 -1
  118. package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
  119. package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
  120. package/lib/mjs/components/signature/Signature.js +1 -1
  121. package/lib/mjs/components/survey/Survey.js +1 -1
  122. package/lib/mjs/components/tags/Tags.js +1 -1
  123. package/lib/mjs/components/textarea/TextArea.js +3 -3
  124. package/lib/mjs/components/textfield/TextField.js +1 -1
  125. package/lib/mjs/components/time/Time.js +1 -1
  126. package/lib/mjs/formio.form.js +2 -2
  127. package/lib/mjs/i18n.js +1 -1
  128. package/lib/mjs/providers/storage/uploadAdapter.js +3 -3
  129. package/lib/mjs/utils/Evaluator.d.ts +13 -6
  130. package/lib/mjs/utils/Evaluator.js +21 -13
  131. package/lib/mjs/utils/builder.js +1 -1
  132. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
  133. package/lib/mjs/utils/i18n.js +1 -1
  134. package/lib/mjs/utils/index.d.ts +160 -2
  135. package/lib/mjs/utils/index.js +11 -1
  136. package/lib/mjs/utils/utils.d.ts +0 -5
  137. package/lib/mjs/utils/utils.js +1 -23
  138. package/lib/mjs/widgets/CalendarWidget.js +1 -1
  139. package/package.json +4 -4
@@ -1,3 +1,161 @@
1
- export { FormioUtils as Utils };
1
+ export * from "./utils";
2
+ export * from "./formUtils";
2
3
  export default FormioUtils;
3
- import * as FormioUtils from './utils';
4
+ declare const FormioUtils: {
5
+ Evaluator: import("./Evaluator").DefaultEvaluator;
6
+ flattenComponents: typeof import("@formio/core/lib/utils/formUtil").flattenComponents;
7
+ guid: typeof import("@formio/core/lib/utils/formUtil").guid;
8
+ uniqueName: typeof import("@formio/core/lib/utils/formUtil").uniqueName;
9
+ MODEL_TYPES_OF_KNOWN_COMPONENTS: {
10
+ nestedArray: string[];
11
+ nestedDataArray: string[];
12
+ dataObject: string[];
13
+ object: string[];
14
+ map: string[];
15
+ content: string[];
16
+ string: string[];
17
+ number: string[];
18
+ boolean: string[];
19
+ none: string[];
20
+ any: string[];
21
+ };
22
+ getModelType: typeof import("@formio/core/lib/utils/formUtil").getModelType;
23
+ getComponentPath: any;
24
+ setComponentScope: typeof import("@formio/core/lib/utils/formUtil").setComponentScope;
25
+ resetComponentScope: typeof import("@formio/core/lib/utils/formUtil").resetComponentScope;
26
+ isComponentNestedDataType: typeof import("@formio/core/lib/utils/formUtil").isComponentNestedDataType;
27
+ componentPath: typeof import("@formio/core/lib/utils/formUtil").componentPath;
28
+ getComponentPaths: typeof import("@formio/core/lib/utils/formUtil").getComponentPaths;
29
+ componentMatches: typeof import("@formio/core/lib/utils/formUtil").componentMatches;
30
+ getBestMatch: typeof import("@formio/core/lib/utils/formUtil").getBestMatch;
31
+ getComponentFromPath: typeof import("@formio/core/lib/utils/formUtil").getComponentFromPath;
32
+ getComponentValue: typeof import("@formio/core/lib/utils/formUtil").getComponentValue;
33
+ findComponents: typeof import("@formio/core/lib/utils/formUtil").findComponents;
34
+ 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>;
35
+ 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;
36
+ getComponentKey: typeof import("@formio/core/lib/utils/formUtil").getComponentKey;
37
+ getContextualRowPath: typeof import("@formio/core/lib/utils/formUtil").getContextualRowPath;
38
+ getContextualRowData: typeof import("@formio/core/lib/utils/formUtil").getContextualRowData;
39
+ componentInfo: typeof import("@formio/core/lib/utils/formUtil").componentInfo;
40
+ eachComponent: typeof import("@formio/core/lib/utils/formUtil").eachComponent;
41
+ eachComponentAsync: typeof import("@formio/core/lib/utils/formUtil").eachComponentAsync;
42
+ getComponentData: typeof import("@formio/core/lib/utils/formUtil").getComponentData;
43
+ getComponentActualValue: any;
44
+ isLayoutComponent: typeof import("@formio/core/lib/utils/formUtil").isLayoutComponent;
45
+ matchComponent: typeof import("@formio/core/lib/utils/formUtil").matchComponent;
46
+ getComponent: typeof import("@formio/core/lib/utils/formUtil").getComponent;
47
+ searchComponents: typeof import("@formio/core/lib/utils/formUtil").searchComponents;
48
+ removeComponent: typeof import("@formio/core/lib/utils/formUtil").removeComponent;
49
+ hasCondition: typeof import("@formio/core/lib/utils/formUtil").hasCondition;
50
+ parseFloatExt: typeof import("@formio/core/lib/utils/formUtil").parseFloatExt;
51
+ formatAsCurrency: typeof import("@formio/core/lib/utils/formUtil").formatAsCurrency;
52
+ escapeRegExCharacters: typeof import("@formio/core/lib/utils/formUtil").escapeRegExCharacters;
53
+ getValue: typeof import("@formio/core/lib/utils/formUtil").getValue;
54
+ getStrings: typeof import("@formio/core/lib/utils/formUtil").getStrings;
55
+ generateFormChange: typeof import("@formio/core/lib/utils/formUtil").generateFormChange;
56
+ applyFormChanges: typeof import("@formio/core/lib/utils/formUtil").applyFormChanges;
57
+ findComponent: typeof import("@formio/core/lib/utils/formUtil").findComponent;
58
+ getEmptyValue: typeof import("@formio/core/lib/utils/formUtil").getEmptyValue;
59
+ isComponentDataEmpty: typeof import("@formio/core/lib/utils/formUtil").isComponentDataEmpty;
60
+ isSelectResourceWithObjectValue: typeof import("@formio/core/lib/utils/formUtil").isSelectResourceWithObjectValue;
61
+ compareSelectResourceWithObjectTypeValues: typeof import("@formio/core/lib/utils/formUtil").compareSelectResourceWithObjectTypeValues;
62
+ getItemTemplateKeys: typeof import("@formio/core/lib/utils/formUtil").getItemTemplateKeys;
63
+ evaluate(func: string | object | Function, args: any, ret: string, interpolate: boolean, options?: import("@formio/core").EvaluatorOptions): any;
64
+ getRandomComponentId(): string;
65
+ getPropertyValue(style: CSSStyleDeclaration, prop: string): number;
66
+ getElementRect(element: HTMLElement): {
67
+ x: number;
68
+ y: number;
69
+ width: number;
70
+ height: number;
71
+ };
72
+ getScriptPlugin(property: string): any;
73
+ boolValue(value: string | boolean): boolean;
74
+ isMongoId(text: string): boolean;
75
+ checkCalculated(component: import("@formio/core").Component, submission: import("@formio/core").Submission, rowData: any): void;
76
+ checkSimpleConditional(component: any, condition: any, row: any, data: any, instance: any): boolean;
77
+ checkCustomConditional(component: import("@formio/core").Component, custom: string, row: any, data: any, form: import("@formio/core").Form, variable: string, onError: any, instance: any): any;
78
+ checkJsonConditional(component: import("@formio/core").Component, json: import("@formio/core").JSONConditional, row: any, data: any, form: import("@formio/core").Form, onError: any): boolean;
79
+ checkCondition(component: import("@formio/core").Component, row: any, data: any, form: import("@formio/core").Form, instance: any): boolean;
80
+ 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;
81
+ 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;
82
+ removeHTML(str: string): string;
83
+ unescapeHTML(str: string): string;
84
+ convertStringToHTMLElement(str: string, selector: string): HTMLElement;
85
+ getDateSetting(date: string | Date): Date | null;
86
+ isValidDate(date: string | Date): boolean;
87
+ currentTimezone(): string;
88
+ offsetDate(date: Date, timezone: string): Date;
89
+ zonesLoaded(): boolean;
90
+ shouldLoadZones(timezone: string): boolean;
91
+ loadZones(url: string, timezone: string): any;
92
+ momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
93
+ formatDate(timezonesUrl: string, value: string | Date, format: string, timezone: string, flatPickrInputFormat: string): string;
94
+ formatOffset(timezonesUrl: string, formatFn: Function, date: string | Date, format: string, timezone: string): string;
95
+ getLocaleDateFormatInfo(locale: Intl.LocalesArgument): object;
96
+ convertFormatToFlatpickr(format: string): string;
97
+ convertFormatToMoment(format: string): string;
98
+ convertFormatToMask(format: string): string;
99
+ getInputMask(mask: string, placeholderChar: string): any[];
100
+ unmaskValue(value: string, mask: string, placeholderChar: string): string;
101
+ matchInputMask(value: string, inputMask: string): boolean;
102
+ getNumberSeparators(lang?: string): {
103
+ delimiter: string;
104
+ decimalSeparator: string;
105
+ };
106
+ getNumberDecimalLimit(component: import("@formio/core").Component, defaultLimit: number): number;
107
+ getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }: {
108
+ currency: string;
109
+ decimalLimit: number;
110
+ decimalSeparator: string;
111
+ lang: string;
112
+ }): {
113
+ prefix: string;
114
+ suffix: string;
115
+ };
116
+ fieldData(data: import("@formio/core").DataObject, component: import("@formio/core").Component): any;
117
+ delay(fn: Function, delay?: number, ...args: any[]): any;
118
+ iterateKey(key: string): string;
119
+ uniqueKey(map: Record<string, string>, base: string): string;
120
+ bootstrapVersion(options: {
121
+ bootstrap: string;
122
+ }): number;
123
+ unfold(e: any): any;
124
+ withSwitch(a: any, b: any): Functions[];
125
+ observeOverload(callback: Function, options?: {
126
+ limit: number;
127
+ delay: number;
128
+ }): Function;
129
+ getContextComponents(context: any, excludeNested: boolean, excludedTypes?: string[]): any[];
130
+ getContextButtons(context: any): any[];
131
+ translateHTMLTemplate(template: string, translate: Function): string;
132
+ sanitize(string: string, options: any): string;
133
+ fastCloneDeep(obj: any): any;
134
+ isInputComponent(componentJson: import("@formio/core").Component): bool;
135
+ getArrayFromComponentPath(pathStr: string): Arryay<number>;
136
+ isChildOf(child: any, parent: any): boolean;
137
+ getStringFromComponentPath(path: number[]): string;
138
+ round(number: number, precision: number): string;
139
+ getIEBrowserVersion(): number | null;
140
+ getBrowserInfo(): object;
141
+ getComponentPathWithoutIndicies(path?: string): string;
142
+ getDataParentComponent(componentInstance: Component): any;
143
+ isPromise(value: any): boolean;
144
+ getFocusableElements(element: HTMLElement): NodeList<HTMLElement>;
145
+ getComponentSavedTypes(fullSchema: import("@formio/core").Component): string[] | null;
146
+ hasEncodedTimezone(value: string): boolean;
147
+ firstNonNil: any;
148
+ componentValueTypes: {
149
+ number: string;
150
+ string: string;
151
+ boolean: string;
152
+ array: string;
153
+ object: string;
154
+ date: string;
155
+ any: string;
156
+ };
157
+ interpolateErrors: (component: Component, errors: FieldError[], interpolateFn: Function) => [];
158
+ };
159
+ import { Evaluator } from './Evaluator';
160
+ import { registerEvaluator } from './Evaluator';
161
+ export { FormioUtils as Utils, Evaluator, registerEvaluator };
@@ -22,11 +22,21 @@ 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
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Utils = void 0;
27
- const FormioUtils = __importStar(require("./utils"));
29
+ exports.registerEvaluator = exports.Evaluator = exports.Utils = void 0;
30
+ const utils = __importStar(require("./utils"));
31
+ const formUtils = __importStar(require("./formUtils"));
32
+ const Evaluator_1 = require("./Evaluator");
33
+ Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
34
+ Object.defineProperty(exports, "registerEvaluator", { enumerable: true, get: function () { return Evaluator_1.registerEvaluator; } });
35
+ const FormioUtils = Object.assign(Object.assign(Object.assign({}, utils), formUtils), { Evaluator: Evaluator_1.Evaluator });
28
36
  exports.Utils = FormioUtils;
29
37
  if (typeof global === 'object') {
30
38
  global.FormioUtils = FormioUtils;
31
39
  }
40
+ __exportStar(require("./utils"), exports);
41
+ __exportStar(require("./formUtils"), exports);
32
42
  exports.default = FormioUtils;
@@ -499,7 +499,6 @@ export function getComponentSavedTypes(fullSchema: import('@formio/core').Compon
499
499
  * @returns {boolean} if value has encoded timezone
500
500
  */
501
501
  export function hasEncodedTimezone(value: string): boolean;
502
- export * from "./formUtils";
503
502
  /**
504
503
  * Map values through unfold and return first non-nil value.
505
504
  * @param {Array<T>} collection - The collection to map through unfold.;
@@ -516,7 +515,3 @@ export namespace componentValueTypes {
516
515
  let any: string;
517
516
  }
518
517
  export function interpolateErrors(component: Component, errors: FieldError[], interpolateFn: Function): [];
519
- import ConditionOperators from './conditionOperators';
520
- import { Evaluator } from './Evaluator';
521
- export const interpolate: typeof Evaluator.interpolate;
522
- export { jsonLogic, ConditionOperators, moment, Evaluator, _ };
@@ -1,57 +1,19 @@
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.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.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = 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 = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
22
- exports.hasEncodedTimezone = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = 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.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
6
+ 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.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = 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 = exports.translateHTMLTemplate = exports.getContextButtons = 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
13
  const formUtils_1 = require("./formUtils");
33
14
  const Evaluator_1 = require("./Evaluator");
34
- Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
35
15
  const conditionOperators_1 = __importDefault(require("./conditionOperators"));
36
- exports.ConditionOperators = conditionOperators_1.default;
37
16
  const core_1 = require("@formio/core");
38
- const interpolate = Evaluator_1.Evaluator.interpolate;
39
- exports.interpolate = interpolate;
40
- __exportStar(require("./formUtils"), exports);
41
- // Configure JsonLogic
42
- operators_1.lodashOperators.forEach((name) => json_logic_js_1.default.add_operation(`_${name}`, lodash_1.default[name]));
43
- // Retrieve Any Date
44
- json_logic_js_1.default.add_operation('getDate', (date) => {
45
- return (0, moment_timezone_1.default)(date).toISOString();
46
- });
47
- // Set Relative Minimum Date
48
- json_logic_js_1.default.add_operation('relativeMinDate', (relativeMinDate) => {
49
- return (0, moment_timezone_1.default)().subtract(relativeMinDate, 'days').toISOString();
50
- });
51
- // Set Relative Maximum Date
52
- json_logic_js_1.default.add_operation('relativeMaxDate', (relativeMaxDate) => {
53
- return (0, moment_timezone_1.default)().add(relativeMaxDate, 'days').toISOString();
54
- });
55
17
  /**
56
18
  * Evaluate a method.
57
19
  * @param {Function|string|object} func - The function to evaluate.
@@ -335,7 +297,7 @@ exports.checkCustomConditional = checkCustomConditional;
335
297
  */
336
298
  function checkJsonConditional(component, json, row, data, form, onError) {
337
299
  try {
338
- return json_logic_js_1.default.apply(json, {
300
+ return core_1.jsonLogic.apply(json, {
339
301
  data,
340
302
  row,
341
303
  form,
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Formio_1 = require("../Formio");
7
7
  const InputWidget_1 = __importDefault(require("./InputWidget"));
8
- const utils_1 = require("../utils/utils");
8
+ const utils_1 = require("../utils");
9
9
  const moment_1 = __importDefault(require("moment"));
10
10
  const lodash_1 = __importDefault(require("lodash"));
11
11
  const DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';
@@ -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.
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter as EventEmitter3 } from 'eventemitter3';
2
- import * as utils from './utils/utils';
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 = utils.observeOverload(overloadHandler, {
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 * as FormioUtils from './utils/utils';
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/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';
@@ -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/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 {
@@ -6,8 +6,7 @@ import i18nDefaults from './i18n';
6
6
  import { Formio } from './Formio';
7
7
  import Components from './components/Components';
8
8
  import NestedDataComponent from './components/_classes/nesteddata/NestedDataComponent';
9
- import { fastCloneDeep, currentTimezone, unescapeHTML, getStringFromComponentPath, convertStringToHTMLElement, getArrayFromComponentPath, } from './utils/utils';
10
- import { eachComponent } from './utils/formUtils';
9
+ import { fastCloneDeep, currentTimezone, unescapeHTML, getStringFromComponentPath, convertStringToHTMLElement, getArrayFromComponentPath, eachComponent } from './utils';
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') {
13
12
  window.global = window;
@@ -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/utils';
7
- import { eachComponent, getComponent } from './utils/formUtils';
6
+ import { fastCloneDeep, bootstrapVersion, getArrayFromComponentPath, getStringFromComponentPath, eachComponent, getComponent, } 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;
@@ -1145,6 +1154,9 @@ export default class WebformBuilder extends Component {
1145
1154
  if (index !== -1) {
1146
1155
  let submissionData = this.editForm.submission.data;
1147
1156
  submissionData = submissionData.componentJson || submissionData;
1157
+ if (submissionData.components && this.originalDefaultValue) {
1158
+ submissionData.components = this.originalDefaultValue.components;
1159
+ }
1148
1160
  const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];
1149
1161
  this.replaceDoubleQuotes(submissionData, fieldsToRemoveDoubleQuotes);
1150
1162
  this.hook('beforeSaveComponentSettings', submissionData);
@@ -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 hasExtraPages(): boolean;
19
+ get hasSubWizards(): boolean;
21
20
  get localData(): any;
22
21
  get wizardKey(): string;
23
22
  set wizard(form: object);
package/lib/mjs/Wizard.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _ from 'lodash';
2
2
  import Webform from './Webform';
3
3
  import { Formio } from './Formio';
4
- import { fastCloneDeep, checkCondition, firstNonNil, uniqueKey, eachComponent, } from './utils/utils';
4
+ import { fastCloneDeep, checkCondition, firstNonNil, uniqueKey, eachComponent, } from './utils';
5
5
  export default class Wizard extends Webform {
6
6
  /**
7
7
  * Constructor for wizard-based forms.
@@ -29,7 +29,6 @@ export default class Wizard extends Webform {
29
29
  this.originalComponents = [];
30
30
  this.page = 0;
31
31
  this.currentPanel = null;
32
- this.currentPanels = null;
33
32
  this.currentNextPage = 0;
34
33
  this._seenPages = [0];
35
34
  this.subWizards = [];
@@ -48,12 +47,12 @@ export default class Wizard extends Webform {
48
47
  }
49
48
  getPages(args = {}) {
50
49
  const { all = false } = args;
51
- const pages = this.hasExtraPages ? this.components : this.pages;
50
+ const pages = this.hasSubWizards ? this.components : this.pages;
52
51
  const filteredPages = pages
53
52
  .filter(all ? _.identity : (p, index) => this._seenPages.includes(index));
54
53
  return filteredPages;
55
54
  }
56
- get hasExtraPages() {
55
+ get hasSubWizards() {
57
56
  return !_.isEmpty(this.subWizards);
58
57
  }
59
58
  get data() {
@@ -177,9 +176,9 @@ export default class Wizard extends Webform {
177
176
  }
178
177
  render() {
179
178
  const ctx = this.renderContext;
180
- if (this.component.key) {
181
- ctx.panels.map(panel => {
182
- if (panel.key === this.component.key) {
179
+ if (this.component.id) {
180
+ ctx.panels.forEach(panel => {
181
+ if (panel.id === this.component.id) {
183
182
  this.currentPanel = panel;
184
183
  ctx.wizardPageTooltip = this.getFormattedTooltip(panel.tooltip);
185
184
  }
@@ -580,7 +579,7 @@ export default class Wizard extends Webform {
580
579
  this.pageFieldLogic(num);
581
580
  this.getNextPage();
582
581
  let parentNum = num;
583
- if (this.hasExtraPages) {
582
+ if (this.hasSubWizards) {
584
583
  const pageFromPages = this.pages[num];
585
584
  const pageFromComponents = this.components[num];
586
585
  if (!pageFromComponents || pageFromPages?.id !== pageFromComponents.id) {
@@ -869,23 +868,18 @@ export default class Wizard extends Webform {
869
868
  this.showErrors(errors, true, true);
870
869
  }
871
870
  // If the pages change, need to redraw the header.
872
- let currentPanels;
873
- let panels;
871
+ const currentPanels = this.pages;
872
+ // calling this.establishPages() updates/mutates this.pages to be the current pages
873
+ this.establishPages();
874
+ const newPanels = this.pages;
874
875
  const currentNextPage = this.currentNextPage;
875
- if (this.hasExtraPages) {
876
- currentPanels = this.pages.map(page => page.component.key);
877
- this.establishPages();
878
- panels = this.pages.map(page => page.component.key);
879
- }
880
- else {
881
- currentPanels = this.currentPanels || this.pages.map(page => page.component.key);
882
- panels = this.establishPages().map(panel => panel.key);
883
- this.currentPanels = panels;
884
- if (this.currentPanel?.key && this.currentPanels?.length) {
885
- this.setPage(this.currentPanels.findIndex(panel => panel === this.currentPanel.key));
886
- }
876
+ const panelsUpdated = !_.isEqual(newPanels, currentPanels);
877
+ if (this.currentPanel?.id && this.pages.length && (!this.hasSubWizards || (this.hasSubWizards && panelsUpdated))) {
878
+ const newIndex = this.pages.findIndex(page => page.id === this.currentPanel.id);
879
+ if (newIndex !== -1)
880
+ this.setPage(newIndex);
887
881
  }
888
- if (!_.isEqual(panels, currentPanels) || (flags && flags.fromSubmission)) {
882
+ if (panelsUpdated || (flags && flags.fromSubmission)) {
889
883
  this.redrawHeader();
890
884
  }
891
885
  // If the next page changes, then make sure to redraw navigation.
@@ -2,7 +2,7 @@ import WebformBuilder from './WebformBuilder';
2
2
  import Webform from './Webform';
3
3
  import BuilderUtils from './utils/builder';
4
4
  import _ from 'lodash';
5
- import { fastCloneDeep } from './utils/utils';
5
+ import { fastCloneDeep } from './utils';
6
6
  export default class WizardBuilder extends WebformBuilder {
7
7
  constructor() {
8
8
  let element, options;
@@ -165,7 +165,6 @@ declare class Component extends Element {
165
165
  get componentsMap(): object;
166
166
  /**
167
167
  * Returns if the parent should conditionally clear.
168
- *
169
168
  * @returns {boolean} - If the parent should conditionally clear.
170
169
  */
171
170
  parentShouldConditionallyClear(): boolean;
@@ -5,8 +5,8 @@ import _ from 'lodash';
5
5
  import isMobile from 'ismobilejs';
6
6
  import { processOne, processOneSync, validateProcessInfo } from '@formio/core/process';
7
7
  import { Formio } from '../../../Formio';
8
- import * as FormioUtils from '../../../utils/utils';
9
- import { fastCloneDeep, boolValue, currentTimezone, getScriptPlugin, getContextualRowData } from '../../../utils/utils';
8
+ import FormioUtils from '../../../utils';
9
+ import { fastCloneDeep, boolValue, currentTimezone, getScriptPlugin, getContextualRowData } from '../../../utils';
10
10
  import Element from '../../../Element';
11
11
  import ComponentModal from '../componentModal/ComponentModal';
12
12
  import Widgets from '../../../widgets';
@@ -424,7 +424,6 @@ export default class Component extends Element {
424
424
  }
425
425
  /**
426
426
  * Returns if the parent should conditionally clear.
427
- *
428
427
  * @returns {boolean} - If the parent should conditionally clear.
429
428
  */
430
429
  parentShouldConditionallyClear() {
@@ -1,5 +1,5 @@
1
1
  import EditFormUtils from './utils';
2
- import { getContextComponents } from '../../../../utils/utils';
2
+ import { getContextComponents } from '../../../../utils';
3
3
  /* eslint-disable quotes, max-len */
4
4
  export default [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  import EditFormUtils from './utils';
2
- import { getContextComponents } from '../../../../utils/utils';
2
+ import { getContextComponents } from '../../../../utils';
3
3
  /* eslint-disable quotes, max-len */
4
4
  export default [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { fastCloneDeep } from '../../../utils/utils';
2
+ import { fastCloneDeep } from '../../../utils';
3
3
  export default class ComponentModal {
4
4
  static render(component, data, topLevel) {
5
5
  const children = component.renderTemplate('component', data, topLevel);
@@ -1,5 +1,5 @@
1
1
  import Multivalue from '../multivalue/Multivalue';
2
- import { convertStringToHTMLElement } from '../../../utils/utils';
2
+ import { convertStringToHTMLElement } from '../../../utils';
3
3
  import Widgets from '../../../widgets';
4
4
  import _ from 'lodash';
5
5
  export default class Input extends Multivalue {
@@ -1,7 +1,7 @@
1
1
  import Field from '../field/Field';
2
2
  import { Formio } from '../../../Formio';
3
3
  import _ from 'lodash';
4
- import { getItemTemplateKeys } from '../../../utils/utils';
4
+ import { getItemTemplateKeys } from '../../../utils';
5
5
  export default class ListComponent extends Field {
6
6
  static schema(...extend) {
7
7
  return Field.schema({