@formio/js 5.1.0-dev.6109.79f22ad → 5.1.0-dev.6112.1314654

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 (180) hide show
  1. package/README.md +7 -0
  2. package/dist/formio.builder.css +1 -0
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.form.css +1 -0
  5. package/dist/formio.form.js +119 -152
  6. package/dist/formio.form.min.css +1 -1
  7. package/dist/formio.form.min.js +1 -1
  8. package/dist/formio.full.css +1 -0
  9. package/dist/formio.full.js +126 -159
  10. package/dist/formio.full.min.css +1 -1
  11. package/dist/formio.full.min.js +1 -1
  12. package/dist/formio.js +66 -55
  13. package/dist/formio.min.js +1 -1
  14. package/dist/formio.utils.js +76 -76
  15. package/dist/formio.utils.min.js +1 -1
  16. package/lib/cjs/Element.d.ts +2 -1
  17. package/lib/cjs/Element.js +18 -39
  18. package/lib/cjs/EventEmitter.js +2 -25
  19. package/lib/cjs/Form.js +2 -25
  20. package/lib/cjs/PDF.js +1 -1
  21. package/lib/cjs/PDFBuilder.d.ts +1 -0
  22. package/lib/cjs/PDFBuilder.js +10 -11
  23. package/lib/cjs/Webform.d.ts +2 -2
  24. package/lib/cjs/Webform.js +10 -10
  25. package/lib/cjs/WebformBuilder.d.ts +1 -1
  26. package/lib/cjs/WebformBuilder.js +45 -21
  27. package/lib/cjs/Wizard.d.ts +1 -2
  28. package/lib/cjs/Wizard.js +18 -24
  29. package/lib/cjs/WizardBuilder.js +1 -1
  30. package/lib/cjs/components/Components.js +7 -1
  31. package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
  32. package/lib/cjs/components/_classes/component/Component.js +70 -64
  33. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  34. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
  35. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
  36. package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  37. package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
  38. package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
  39. package/lib/cjs/components/_classes/input/Input.js +3 -3
  40. package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
  41. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -0
  42. package/lib/cjs/components/_classes/nested/NestedComponent.js +19 -9
  43. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  44. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  45. package/lib/cjs/components/address/Address.js +2 -2
  46. package/lib/cjs/components/alert/Alert.js +1 -1
  47. package/lib/cjs/components/button/Button.js +1 -1
  48. package/lib/cjs/components/checkbox/Checkbox.js +1 -1
  49. package/lib/cjs/components/container/Container.js +1 -1
  50. package/lib/cjs/components/currency/Currency.js +1 -1
  51. package/lib/cjs/components/datagrid/DataGrid.js +5 -1
  52. package/lib/cjs/components/datamap/DataMap.js +7 -2
  53. package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
  54. package/lib/cjs/components/datetime/DateTime.js +15 -13
  55. package/lib/cjs/components/day/Day.js +2 -2
  56. package/lib/cjs/components/editgrid/EditGrid.d.ts +0 -1
  57. package/lib/cjs/components/editgrid/EditGrid.js +1 -9
  58. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  59. package/lib/cjs/components/fieldset/Fieldset.js +1 -0
  60. package/lib/cjs/components/file/File.js +1 -1
  61. package/lib/cjs/components/form/Form.js +14 -2
  62. package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
  63. package/lib/cjs/components/number/Number.js +1 -1
  64. package/lib/cjs/components/panel/Panel.js +1 -1
  65. package/lib/cjs/components/radio/Radio.d.ts +9 -0
  66. package/lib/cjs/components/radio/Radio.js +20 -10
  67. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  68. package/lib/cjs/components/select/Select.js +7 -3
  69. package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
  70. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  71. package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
  72. package/lib/cjs/components/signature/Signature.js +1 -1
  73. package/lib/cjs/components/survey/Survey.js +1 -1
  74. package/lib/cjs/components/tags/Tags.js +1 -1
  75. package/lib/cjs/components/textarea/TextArea.js +9 -4
  76. package/lib/cjs/components/textfield/TextField.js +13 -31
  77. package/lib/cjs/components/time/Time.js +1 -1
  78. package/lib/cjs/formio.form.js +5 -5
  79. package/lib/cjs/providers/storage/uploadAdapter.js +1 -1
  80. package/lib/cjs/providers/storage/url.js +7 -3
  81. package/lib/cjs/translations/en.d.ts +1 -232
  82. package/lib/cjs/translations/en.js +4 -2
  83. package/lib/cjs/utils/Evaluator.d.ts +20 -6
  84. package/lib/cjs/utils/Evaluator.js +38 -15
  85. package/lib/cjs/utils/builder.js +5 -5
  86. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
  87. package/lib/cjs/utils/formUtils.d.ts +2 -2
  88. package/lib/cjs/utils/index.d.ts +169 -2
  89. package/lib/cjs/utils/index.js +22 -2
  90. package/lib/cjs/utils/utils.d.ts +22 -37
  91. package/lib/cjs/utils/utils.js +63 -138
  92. package/lib/cjs/widgets/CalendarWidget.d.ts +1 -8
  93. package/lib/cjs/widgets/CalendarWidget.js +17 -43
  94. package/lib/mjs/Element.d.ts +2 -1
  95. package/lib/mjs/Element.js +11 -9
  96. package/lib/mjs/EventEmitter.js +2 -2
  97. package/lib/mjs/Form.js +1 -1
  98. package/lib/mjs/PDF.js +1 -1
  99. package/lib/mjs/PDFBuilder.d.ts +1 -0
  100. package/lib/mjs/PDFBuilder.js +9 -10
  101. package/lib/mjs/Webform.d.ts +2 -2
  102. package/lib/mjs/Webform.js +8 -8
  103. package/lib/mjs/WebformBuilder.d.ts +1 -1
  104. package/lib/mjs/WebformBuilder.js +36 -13
  105. package/lib/mjs/Wizard.d.ts +1 -2
  106. package/lib/mjs/Wizard.js +17 -23
  107. package/lib/mjs/WizardBuilder.js +1 -1
  108. package/lib/mjs/components/Components.js +7 -1
  109. package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
  110. package/lib/mjs/components/_classes/component/Component.js +42 -13
  111. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  112. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +7 -0
  113. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -0
  114. package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  115. package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
  116. package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
  117. package/lib/mjs/components/_classes/input/Input.js +3 -3
  118. package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
  119. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -0
  120. package/lib/mjs/components/_classes/nested/NestedComponent.js +19 -9
  121. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  122. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  123. package/lib/mjs/components/address/Address.js +2 -2
  124. package/lib/mjs/components/alert/Alert.js +1 -1
  125. package/lib/mjs/components/button/Button.js +1 -1
  126. package/lib/mjs/components/checkbox/Checkbox.js +1 -1
  127. package/lib/mjs/components/container/Container.js +1 -1
  128. package/lib/mjs/components/currency/Currency.js +1 -1
  129. package/lib/mjs/components/datagrid/DataGrid.js +5 -1
  130. package/lib/mjs/components/datamap/DataMap.js +7 -2
  131. package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
  132. package/lib/mjs/components/datetime/DateTime.js +15 -13
  133. package/lib/mjs/components/day/Day.js +2 -2
  134. package/lib/mjs/components/editgrid/EditGrid.d.ts +0 -1
  135. package/lib/mjs/components/editgrid/EditGrid.js +1 -9
  136. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  137. package/lib/mjs/components/fieldset/Fieldset.js +1 -0
  138. package/lib/mjs/components/file/File.js +1 -1
  139. package/lib/mjs/components/form/Form.js +13 -2
  140. package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
  141. package/lib/mjs/components/number/Number.js +1 -1
  142. package/lib/mjs/components/panel/Panel.js +1 -1
  143. package/lib/mjs/components/radio/Radio.d.ts +9 -0
  144. package/lib/mjs/components/radio/Radio.js +20 -10
  145. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  146. package/lib/mjs/components/select/Select.js +7 -3
  147. package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
  148. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  149. package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
  150. package/lib/mjs/components/signature/Signature.js +1 -1
  151. package/lib/mjs/components/survey/Survey.js +1 -1
  152. package/lib/mjs/components/tags/Tags.js +1 -1
  153. package/lib/mjs/components/textarea/TextArea.js +9 -4
  154. package/lib/mjs/components/textfield/TextField.js +7 -2
  155. package/lib/mjs/components/time/Time.js +1 -1
  156. package/lib/mjs/formio.form.js +3 -3
  157. package/lib/mjs/providers/storage/uploadAdapter.js +1 -1
  158. package/lib/mjs/providers/storage/url.js +7 -3
  159. package/lib/mjs/translations/en.d.ts +1 -232
  160. package/lib/mjs/translations/en.js +8 -47
  161. package/lib/mjs/utils/Evaluator.d.ts +20 -6
  162. package/lib/mjs/utils/Evaluator.js +31 -13
  163. package/lib/mjs/utils/builder.js +1 -1
  164. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
  165. package/lib/mjs/utils/formUtils.d.ts +2 -2
  166. package/lib/mjs/utils/index.d.ts +169 -2
  167. package/lib/mjs/utils/index.js +18 -1
  168. package/lib/mjs/utils/utils.d.ts +22 -37
  169. package/lib/mjs/utils/utils.js +57 -113
  170. package/lib/mjs/widgets/CalendarWidget.d.ts +1 -8
  171. package/lib/mjs/widgets/CalendarWidget.js +17 -43
  172. package/package.json +5 -3
  173. package/lib/cjs/i18n.d.ts +0 -13
  174. package/lib/cjs/i18n.js +0 -19
  175. package/lib/cjs/utils/i18n.d.ts +0 -19
  176. package/lib/cjs/utils/i18n.js +0 -120
  177. package/lib/mjs/i18n.d.ts +0 -13
  178. package/lib/mjs/i18n.js +0 -14
  179. package/lib/mjs/utils/i18n.d.ts +0 -19
  180. package/lib/mjs/utils/i18n.js +0 -112
@@ -1,57 +1,25 @@
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.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;
23
8
  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
9
  const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
28
- exports.moment = moment_timezone_1.default;
29
10
  const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
30
- const operators_1 = require("./jsonlogic/operators");
31
11
  const dompurify_1 = __importDefault(require("dompurify"));
12
+ const dayjs_1 = __importDefault(require("dayjs"));
13
+ const utc_1 = __importDefault(require("dayjs/plugin/utc"));
14
+ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
15
+ const advancedFormat_1 = __importDefault(require("dayjs/plugin/advancedFormat"));
16
+ const core_1 = require("@formio/core");
32
17
  const formUtils_1 = require("./formUtils");
33
18
  const Evaluator_1 = require("./Evaluator");
34
- Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
35
19
  const conditionOperators_1 = __importDefault(require("./conditionOperators"));
36
- exports.ConditionOperators = conditionOperators_1.default;
37
- 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
- });
20
+ dayjs_1.default.extend(timezone_1.default);
21
+ dayjs_1.default.extend(advancedFormat_1.default);
22
+ dayjs_1.default.extend(utc_1.default);
55
23
  /**
56
24
  * Evaluate a method.
57
25
  * @param {Function|string|object} func - The function to evaluate.
@@ -240,13 +208,20 @@ function checkSimpleConditional(component, condition, row, data, instance) {
240
208
  return true;
241
209
  }
242
210
  const conditionsResult = lodash_1.default.map(conditions, (cond) => {
243
- var _a, _b;
244
211
  const { value: comparedValue, operator, component: conditionComponentPath } = cond;
245
212
  if (!conditionComponentPath) {
246
213
  return true;
247
214
  }
248
215
  const splittedConditionPath = conditionComponentPath.split('.');
249
- const conditionalPaths = ((_a = instance === null || instance === void 0 ? void 0 : instance.parent) === null || _a === void 0 ? void 0 : _a.type) === 'datagrid' || ((_b = instance === null || instance === void 0 ? void 0 : instance.parent) === null || _b === void 0 ? void 0 : _b.type) === 'editgrid' ? [] : getConditionalPathsRecursive(splittedConditionPath, data);
216
+ const checkParentTypeInTree = (instance, componentType) => {
217
+ if (!(instance === null || instance === void 0 ? void 0 : instance.parent)) {
218
+ return false;
219
+ }
220
+ return (instance === null || instance === void 0 ? void 0 : instance.parent.type) === componentType || checkParentTypeInTree(instance.parent, componentType);
221
+ };
222
+ const conditionalPaths = checkParentTypeInTree(instance, 'datagrid') || checkParentTypeInTree(instance, 'editgrid')
223
+ ? []
224
+ : getConditionalPathsRecursive(splittedConditionPath, data);
250
225
  if (conditionalPaths.length > 0) {
251
226
  return conditionalPaths.map((path) => {
252
227
  const value = getComponentActualValue(path, data, row);
@@ -335,7 +310,7 @@ exports.checkCustomConditional = checkCustomConditional;
335
310
  */
336
311
  function checkJsonConditional(component, json, row, data, form, onError) {
337
312
  try {
338
- return json_logic_js_1.default.apply(json, {
313
+ return core_1.jsonLogic.apply(json, {
339
314
  data,
340
315
  row,
341
316
  form,
@@ -365,7 +340,7 @@ function getRow(component, row, instance, conditional) {
365
340
  }
366
341
  const dataParent = getDataParentComponent(instance);
367
342
  if (dataParent) {
368
- const parentPath = (_a = dataParent.paths) === null || _a === void 0 ? void 0 : _a.localDataPath;
343
+ const parentPath = (_a = dataParent.paths) === null || _a === void 0 ? void 0 : _a.localPath;
369
344
  const isTriggerCondtionComponentPath = condition.when || !condition.conditions
370
345
  ? (_b = condition.when) === null || _b === void 0 ? void 0 : _b.startsWith((_c = dataParent.paths) === null || _c === void 0 ? void 0 : _c.localPath)
371
346
  : lodash_1.default.some(condition.conditions, cond => { var _a; return cond.component.startsWith((_a = dataParent.paths) === null || _a === void 0 ? void 0 : _a.localPath); });
@@ -553,7 +528,7 @@ exports.guid = guid;
553
528
  /**
554
529
  * Return a translated date setting.
555
530
  * @param {string|Date} date - The date to translate.
556
- * @returns {(null|Date)} - The translated date.
531
+ * @returns {(null|dayjs.Dayjs)} - The translated date.
557
532
  */
558
533
  function getDateSetting(date) {
559
534
  if (lodash_1.default.isNil(date) || lodash_1.default.isNaN(date) || date === '') {
@@ -573,13 +548,13 @@ function getDateSetting(date) {
573
548
  try {
574
549
  const value = Evaluator_1.Evaluator.evaluator(`return ${date};`, 'moment')(moment_timezone_1.default);
575
550
  if (typeof value === 'string') {
576
- dateSetting = (0, moment_timezone_1.default)(value);
551
+ dateSetting = (0, dayjs_1.default)(value);
577
552
  }
578
553
  else if (typeof value.toDate === 'function') {
579
- dateSetting = (0, moment_timezone_1.default)(value.toDate().toUTCString());
554
+ dateSetting = (0, dayjs_1.default)(value.toDate().toUTCString());
580
555
  }
581
556
  else if (value instanceof Date) {
582
- dateSetting = (0, moment_timezone_1.default)(value);
557
+ dateSetting = (0, dayjs_1.default)(value);
583
558
  }
584
559
  }
585
560
  catch (e) {
@@ -609,18 +584,18 @@ exports.isValidDate = isValidDate;
609
584
  * @returns {string} - The current timezone.
610
585
  */
611
586
  function currentTimezone() {
612
- if (moment_timezone_1.default.currentTimezone) {
613
- return moment_timezone_1.default.currentTimezone;
587
+ if (dayjs_1.default.currentTimezone) {
588
+ return dayjs_1.default.currentTimezone;
614
589
  }
615
- moment_timezone_1.default.currentTimezone = jstimezonedetect_1.default.determine().name();
616
- return moment_timezone_1.default.currentTimezone;
590
+ dayjs_1.default.currentTimezone = jstimezonedetect_1.default.determine().name();
591
+ return dayjs_1.default.currentTimezone;
617
592
  }
618
593
  exports.currentTimezone = currentTimezone;
619
594
  /**
620
595
  * Get an offset date provided a date object and timezone object.
621
596
  * @param {Date} date - The date to offset.
622
597
  * @param {string} timezone - The timezone to offset the date to.
623
- * @returns {Date} - The offset date.
598
+ * @returns {{date: Date, abbr: string}} - The offset date.
624
599
  */
625
600
  function offsetDate(date, timezone) {
626
601
  if (timezone === 'UTC') {
@@ -629,7 +604,7 @@ function offsetDate(date, timezone) {
629
604
  abbr: 'UTC'
630
605
  };
631
606
  }
632
- const dateMoment = (0, moment_timezone_1.default)(date).tz(timezone);
607
+ const dateMoment = (0, dayjs_1.default)(date).tz(timezone);
633
608
  return {
634
609
  date: new Date(date.getTime() + ((dateMoment.utcOffset() + date.getTimezoneOffset()) * 60000)),
635
610
  abbr: dateMoment.format('z')
@@ -637,132 +612,85 @@ function offsetDate(date, timezone) {
637
612
  }
638
613
  exports.offsetDate = offsetDate;
639
614
  /**
640
- * Returns if the zones are loaded.
641
- * @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
642
- */
643
- function zonesLoaded() {
644
- return moment_timezone_1.default.zonesLoaded;
645
- }
646
- exports.zonesLoaded = zonesLoaded;
647
- /**
648
- * Returns if we should load the zones.
615
+ * Returns if we should handle a timezone difference.
649
616
  * @param {string} timezone - The timezone to check if we should load the zones.
650
- * @returns {boolean} - TRUE if we should load the zones; FALSE otherwise.
617
+ * @returns {boolean} - TRUE if we should handle timezones; FALSE otherwise.
651
618
  */
652
- function shouldLoadZones(timezone) {
653
- if (timezone === currentTimezone() || timezone === 'UTC') {
654
- return false;
655
- }
656
- return true;
657
- }
658
- exports.shouldLoadZones = shouldLoadZones;
659
- /**
660
- * Externally load the timezone data.
661
- * @param {string} url - The URL to load the timezone data from.
662
- * @param {string} timezone - The timezone to load.
663
- * @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
664
- */
665
- function loadZones(url, timezone) {
666
- if (timezone && !shouldLoadZones(timezone)) {
667
- // Return non-resolving promise.
668
- return new Promise(lodash_1.default.noop);
669
- }
670
- if (moment_timezone_1.default.zonesPromise) {
671
- return moment_timezone_1.default.zonesPromise;
672
- }
673
- return moment_timezone_1.default.zonesPromise = fetch(url)
674
- .then(resp => resp.json().then(zones => {
675
- moment_timezone_1.default.tz.load(zones);
676
- moment_timezone_1.default.zonesLoaded = true;
677
- // Trigger a global event that the timezones have finished loading.
678
- if (document && document.createEvent && document.body && document.body.dispatchEvent) {
679
- var event = document.createEvent('Event');
680
- event.initEvent('zonesLoaded', true, true);
681
- document.body.dispatchEvent(event);
682
- }
683
- }));
619
+ function shouldHandleTimezone(timezone) {
620
+ return !(timezone === currentTimezone() || timezone === 'UTC');
684
621
  }
685
- exports.loadZones = loadZones;
622
+ exports.shouldHandleTimezone = shouldHandleTimezone;
686
623
  /**
687
- * Get the moment date object for translating dates with timezones.
688
- * @param {string|Date} value - The value to convert into a moment date.
624
+ * Get the Dayjs date object for translating dates with timezones.
625
+ * @param {string|Date} value - The value to convert into a dayjs date.
689
626
  * @param {string} format - The format to convert the date to.
690
627
  * @param {string} timezone - The timezone to convert the date to.
691
628
  * @param {object} options - The options object
692
- * @returns {Date} - The moment date object.
629
+ * @returns {dayjs.Dayjs} - The dayjs date object.
693
630
  */
694
- function momentDate(value, format, timezone, options) {
695
- const momentDate = (0, moment_timezone_1.default)(value);
631
+ function dayjsDate(value, format, timezone, options) {
632
+ const dayjsDate = (0, dayjs_1.default)(value);
696
633
  if (!timezone) {
697
- return momentDate;
634
+ return dayjsDate;
698
635
  }
699
636
  if (timezone === 'UTC') {
700
637
  timezone = 'Etc/UTC';
701
638
  }
702
- if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && (moment_timezone_1.default.zonesLoaded || (options === null || options === void 0 ? void 0 : options.email))) {
703
- return momentDate.tz(timezone);
639
+ if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && (shouldHandleTimezone(timezone) || (options === null || options === void 0 ? void 0 : options.email))) {
640
+ return dayjsDate.tz(timezone);
704
641
  }
705
- return momentDate;
642
+ return dayjsDate;
706
643
  }
707
- exports.momentDate = momentDate;
644
+ exports.dayjsDate = dayjsDate;
708
645
  /**
709
646
  * Format a date provided a value, format, and timezone object.
710
- * @param {string} timezonesUrl - The URL to load the timezone data from.
711
647
  * @param {string|Date} value - The value to format.
712
648
  * @param {string} format - The format to format the date to.
713
649
  * @param {string} timezone - The timezone to format the date to.
714
650
  * @param {string} flatPickrInputFormat - The format to use for flatpickr input.
715
651
  * @returns {string} - The formatted date.
716
652
  */
717
- function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
718
- const momentDate = (0, moment_timezone_1.default)(value, flatPickrInputFormat || undefined);
653
+ function formatDate(value, format, timezone, flatPickrInputFormat) {
654
+ const dayjsDate = (0, dayjs_1.default)(value, flatPickrInputFormat || undefined);
719
655
  if (timezone === currentTimezone()) {
720
656
  // See if our format contains a "z" timezone character.
721
657
  if (format.match(/\s(z$|z\s)/)) {
722
- loadZones(timezonesUrl);
723
- if (moment_timezone_1.default.zonesLoaded) {
724
- return momentDate.tz(timezone).format(convertFormatToMoment(format));
658
+ if (shouldHandleTimezone(timezone)) {
659
+ return dayjsDate.tz(timezone).format(convertFormatToDayjs(format));
725
660
  }
726
661
  else {
727
- return momentDate.format(convertFormatToMoment(format.replace(/\s(z$|z\s)/, '')));
662
+ return dayjsDate.format(convertFormatToDayjs(format.replace(/\s(z$|z\s)/, '')));
728
663
  }
729
664
  }
730
665
  // Return the standard format.
731
- return momentDate.format(convertFormatToMoment(format));
666
+ return dayjsDate.format(convertFormatToDayjs(format));
732
667
  }
733
668
  if (timezone === 'UTC') {
734
- const offset = offsetDate(momentDate.toDate(), 'UTC');
735
- return `${(0, moment_timezone_1.default)(offset.date).format(convertFormatToMoment(format))} UTC`;
669
+ const offset = offsetDate(dayjsDate.toDate(), 'UTC');
670
+ return `${(0, dayjs_1.default)(offset.date).format(convertFormatToDayjs(format))} UTC`;
736
671
  }
737
- // Load the zones since we need timezone information.
738
- loadZones(timezonesUrl);
739
- if (moment_timezone_1.default.zonesLoaded && timezone) {
740
- return momentDate.tz(timezone).format(`${convertFormatToMoment(format)} z`);
741
- }
742
- else {
743
- return momentDate.format(convertFormatToMoment(format));
672
+ if (shouldHandleTimezone(timezone)) {
673
+ return dayjsDate.tz(timezone).format(`${convertFormatToDayjs(format)} z`);
744
674
  }
675
+ return dayjsDate.format(convertFormatToDayjs(format));
745
676
  }
746
677
  exports.formatDate = formatDate;
747
678
  /**
748
679
  * Pass a format function to format within a timezone.
749
- * @param {string} timezonesUrl - The URL to load the timezone data from.
750
680
  * @param {Function} formatFn - The format function to use.
751
681
  * @param {Date|string} date - The date to format.
752
682
  * @param {string} format - The format to format the date to.
753
683
  * @param {string} timezone - The timezone to format the date to.
754
684
  * @returns {string} - The formatted date.
755
685
  */
756
- function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
686
+ function formatOffset(formatFn, date, format, timezone) {
757
687
  if (timezone === currentTimezone()) {
758
688
  return formatFn(date, format);
759
689
  }
760
690
  if (timezone === 'UTC') {
761
691
  return `${formatFn(offsetDate(date, 'UTC').date, format)} UTC`;
762
692
  }
763
- // Load the zones since we need timezone information.
764
- loadZones(timezonesUrl);
765
- if (moment_timezone_1.default.zonesLoaded) {
693
+ if (shouldHandleTimezone(timezone)) {
766
694
  const offset = offsetDate(date, timezone);
767
695
  return `${formatFn(offset.date, format)} ${offset.abbr}`;
768
696
  }
@@ -822,7 +750,7 @@ exports.convertFormatToFlatpickr = convertFormatToFlatpickr;
822
750
  * @param {string} format - The format to convert.
823
751
  * @returns {string} - The converted format.
824
752
  */
825
- function convertFormatToMoment(format) {
753
+ function convertFormatToDayjs(format) {
826
754
  return format
827
755
  // Year conversion.
828
756
  .replace(/y/g, 'Y')
@@ -835,7 +763,7 @@ function convertFormatToMoment(format) {
835
763
  // Unix Timestamp
836
764
  .replace(/U/g, 'X');
837
765
  }
838
- exports.convertFormatToMoment = convertFormatToMoment;
766
+ exports.convertFormatToDayjs = convertFormatToDayjs;
839
767
  /**
840
768
  * Convert the format from the angular-datepicker module to mask format.
841
769
  * @param {string} format - The format to convert.
@@ -1135,9 +1063,6 @@ function bootstrapVersion(options) {
1135
1063
  if (options.bootstrap) {
1136
1064
  return options.bootstrap;
1137
1065
  }
1138
- if ((typeof jQuery === 'function') && (typeof jQuery().collapse === 'function')) {
1139
- return parseInt(jQuery.fn.collapse.Constructor.VERSION.split('.')[0], 10);
1140
- }
1141
1066
  if (window.bootstrap && window.bootstrap.Collapse) {
1142
1067
  return parseInt(window.bootstrap.Collapse.VERSION.split('.')[0], 10);
1143
1068
  }
@@ -1395,7 +1320,7 @@ exports.fastCloneDeep = fastCloneDeep;
1395
1320
  /**
1396
1321
  * Returns if the component is an input component.
1397
1322
  * @param {import('@formio/core').Component} componentJson - The JSON of a component.
1398
- * @returns {bool} - TRUE if the component is an input component; FALSE otherwise.
1323
+ * @returns {boolean} - TRUE if the component is an input component; FALSE otherwise.
1399
1324
  */
1400
1325
  function isInputComponent(componentJson) {
1401
1326
  if (componentJson.input === false || componentJson.input === true) {
@@ -1420,7 +1345,7 @@ exports.isInputComponent = isInputComponent;
1420
1345
  /**
1421
1346
  * Takes a component path, and returns a component path array.
1422
1347
  * @param {string} pathStr - The path string to convert to an array.
1423
- * @returns {Arryay<number>} - The array of paths.
1348
+ * @returns {Array<string>} - The array of paths.
1424
1349
  */
1425
1350
  function getArrayFromComponentPath(pathStr) {
1426
1351
  if (!pathStr || !lodash_1.default.isString(pathStr)) {
@@ -22,13 +22,6 @@ export default class CalendarWidget extends InputWidget {
22
22
  minDate: string;
23
23
  maxDate: string;
24
24
  };
25
- zoneLoading: boolean;
26
- timezonesUrl: string;
27
- /**
28
- * Load the timezones.
29
- * @returns {boolean} TRUE if the zones are loading, FALSE otherwise.
30
- */
31
- loadZones(): boolean;
32
25
  attach(input: any): Promise<any>;
33
26
  defaultFormat: {
34
27
  date: string;
@@ -84,7 +77,7 @@ export default class CalendarWidget extends InputWidget {
84
77
  * @returns {void}
85
78
  */
86
79
  setValue(value: any): void;
87
- getValueAsString(value: any, format: any): string;
80
+ getValueAsString(value: any, format?: string): string;
88
81
  setErrorClasses(hasErrors: any): void;
89
82
  isCalendarElement(element: any): any;
90
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;
@@ -51,29 +51,6 @@ class CalendarWidget extends InputWidget_1.default {
51
51
  else if (this.settings.time_24hr) {
52
52
  this.settings.format = this.settings.format.replace(/hh:mm a$/g, 'HH:mm');
53
53
  }
54
- this.zoneLoading = false;
55
- this.timezonesUrl = `${Formio_1.Formio.cdn['moment-timezone']}/data/packed/latest.json`;
56
- }
57
- /**
58
- * Load the timezones.
59
- * @returns {boolean} TRUE if the zones are loading, FALSE otherwise.
60
- */
61
- loadZones() {
62
- const timezone = this.timezone;
63
- if (this.zoneLoading) {
64
- return true;
65
- }
66
- if (!(0, utils_1.zonesLoaded)() && (0, utils_1.shouldLoadZones)(timezone)) {
67
- this.zoneLoading = true;
68
- (0, utils_1.loadZones)(this.timezonesUrl, timezone).then(() => {
69
- this.zoneLoading = false;
70
- this.emit('redraw');
71
- });
72
- // Return zones are loading.
73
- return true;
74
- }
75
- // Zones are already loaded.
76
- return false;
77
54
  }
78
55
  attach(input) {
79
56
  var _a;
@@ -85,7 +62,7 @@ class CalendarWidget extends InputWidget_1.default {
85
62
  };
86
63
  this.closedOn = 0;
87
64
  this.valueFormat = (this.settings.saveAs === 'date') ? ISO_8601_FORMAT : this.settings.dateFormat || ISO_8601_FORMAT;
88
- this.valueMomentFormat = (0, utils_1.convertFormatToMoment)(this.valueFormat);
65
+ this.valueMomentFormat = (0, utils_1.convertFormatToDayjs)(this.valueFormat);
89
66
  const isReadOnly = this.settings.readOnly;
90
67
  this.settings.minDate = isReadOnly ? null : (0, utils_1.getDateSetting)(this.settings.minDate);
91
68
  this.settings.maxDate = isReadOnly ? null : (0, utils_1.getDateSetting)(this.settings.maxDate);
@@ -249,9 +226,9 @@ class CalendarWidget extends InputWidget_1.default {
249
226
  */
250
227
  getDateValue(date, format, useTimezone) {
251
228
  if (useTimezone) {
252
- return (0, utils_1.momentDate)(date, this.valueFormat, this.timezone).format((0, utils_1.convertFormatToMoment)(format));
229
+ return (0, utils_1.dayjsDate)(date, this.valueFormat, this.timezone).format((0, utils_1.convertFormatToDayjs)(format));
253
230
  }
254
- return (0, moment_1.default)(date).format((0, utils_1.convertFormatToMoment)(format));
231
+ return (0, moment_1.default)(date).format((0, utils_1.convertFormatToDayjs)(format));
255
232
  }
256
233
  /**
257
234
  * Return the value of the selected date.
@@ -283,18 +260,15 @@ class CalendarWidget extends InputWidget_1.default {
283
260
  setValue(value) {
284
261
  const saveAsText = (this.settings.saveAs === 'text');
285
262
  if (!this.calendar) {
286
- value = value ? (0, utils_1.formatDate)(this.timezonesUrl, value, (0, utils_1.convertFormatToMoment)(this.settings.format), this.timezone, (0, utils_1.convertFormatToMoment)(this.valueMomentFormat)) : value;
263
+ value = value ? (0, utils_1.formatDate)(value, (0, utils_1.convertFormatToDayjs)(this.settings.format), this.timezone, (0, utils_1.convertFormatToDayjs)(this.valueMomentFormat)) : value;
287
264
  return super.setValue(value);
288
265
  }
289
266
  // If the component is a textfield that does not have timezone information included in the string value then skip
290
267
  // the timezone offset
291
- if (this.component.type === 'textfield' && !(0, utils_1.hasEncodedTimezone)(value)) {
292
- this.settings.skipOffset = true;
293
- }
294
- const zonesLoading = this.loadZones();
268
+ this.settings.skipOffset = this.component.type === 'textfield' && !(0, utils_1.hasEncodedTimezone)(value);
295
269
  if (value) {
296
- if (!saveAsText && this.settings.readOnly && !zonesLoading) {
297
- this.calendar.setDate((0, utils_1.momentDate)(value, this.valueFormat, this.timezone).format(), false);
270
+ if (!saveAsText && this.settings.readOnly) {
271
+ this.calendar.setDate((0, utils_1.dayjsDate)(value, this.valueFormat, this.timezone).format(), false);
298
272
  }
299
273
  else if (this.isValueISO8601(value)) {
300
274
  this.calendar.setDate(value, false);
@@ -307,13 +281,13 @@ class CalendarWidget extends InputWidget_1.default {
307
281
  this.calendar.clear(false);
308
282
  }
309
283
  }
310
- getValueAsString(value, format) {
284
+ getValueAsString(value, format = '') {
311
285
  const inputFormat = format || this.dateFormat;
312
286
  const valueFormat = this.calendar ? this.valueFormat : this.settings.dateFormat;
313
287
  if (this.settings.saveAs === 'text' && this.componentInstance.parent && !this.settings.readOnly) {
314
- return (0, moment_1.default)(value, (0, utils_1.convertFormatToMoment)(valueFormat)).format((0, utils_1.convertFormatToMoment)(valueFormat));
288
+ return (0, moment_1.default)(value, (0, utils_1.convertFormatToDayjs)(valueFormat)).format((0, utils_1.convertFormatToDayjs)(valueFormat));
315
289
  }
316
- return (0, utils_1.formatDate)(this.timezonesUrl, value, inputFormat, this.timezone, (0, utils_1.convertFormatToMoment)(valueFormat));
290
+ return (0, utils_1.formatDate)(value, inputFormat, this.timezone, (0, utils_1.convertFormatToDayjs)(valueFormat));
317
291
  }
318
292
  setErrorClasses(hasErrors) {
319
293
  if (!this.input) {
@@ -406,7 +380,7 @@ class CalendarWidget extends InputWidget_1.default {
406
380
  const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;
407
381
  if (!(isIEBrowser && !relatedTarget) && !this.isCalendarElement(relatedTarget)) {
408
382
  const inputValue = this.calendar.input.value;
409
- const dateValue = inputValue ? (0, moment_1.default)(this.calendar.input.value, (0, utils_1.convertFormatToMoment)(this.valueFormat)).toDate() : inputValue;
383
+ const dateValue = inputValue ? (0, moment_1.default)(this.calendar.input.value, (0, utils_1.convertFormatToDayjs)(this.valueFormat)).toDate() : inputValue;
410
384
  this.calendar.setDate(dateValue, true, this.settings.altFormat);
411
385
  }
412
386
  else if (!this.calendar.input.value && this.calendar.config.noCalendar) {
@@ -458,14 +432,14 @@ class CalendarWidget extends InputWidget_1.default {
458
432
  return (date, format) => {
459
433
  // Only format this if this is the altFormat and the form is readOnly.
460
434
  if (this.settings.readOnly && (format === this.settings.altFormat)) {
461
- if (!this.settings.enableTime || this.loadZones() || this.settings.skipOffset) {
435
+ if (!this.settings.enableTime || this.settings.skipOffset) {
462
436
  return Flatpickr.formatDate(date, format);
463
437
  }
464
438
  const currentValue = new Date(this.getValue());
465
439
  if (currentValue.toString() === date.toString()) {
466
- return (0, utils_1.formatOffset)(this.timezonesUrl, Flatpickr.formatDate.bind(Flatpickr), new Date(this.componentValue), format, this.timezone);
440
+ return (0, utils_1.formatOffset)(Flatpickr.formatDate.bind(Flatpickr), new Date(this.componentValue), format, this.timezone);
467
441
  }
468
- return (0, utils_1.formatOffset)(this.timezonesUrl, Flatpickr.formatDate.bind(Flatpickr), date, format, this.timezone);
442
+ return (0, utils_1.formatOffset)(Flatpickr.formatDate.bind(Flatpickr), date, format, this.timezone);
469
443
  }
470
444
  return Flatpickr.formatDate(date, format);
471
445
  };
@@ -170,10 +170,11 @@ export default class Element {
170
170
  /**
171
171
  * Translate a text using the i18n system.
172
172
  * @param {string|Array<string>} text - The i18n identifier.
173
+ * @param {any} data - contextual data object containing data, component, row, etc.
173
174
  * @param {...any} args - The arguments to pass to the i18n translation.
174
175
  * @returns {string} - The translated text.
175
176
  */
176
- t(text: string | Array<string>, ...args: any[]): string;
177
+ t(text: string | Array<string>, data: any, ...args: any[]): string;
177
178
  /**
178
179
  * Alias to create a text node.
179
180
  * @param {string} text - The text to create.
@@ -1,10 +1,11 @@
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 FormioUtils from './utils';
7
+ import { I18n } from '@formio/core';
8
+ import enTranslation from './translations/en';
8
9
  /**
9
10
  * The root component for all elements within the Form.io renderer.
10
11
  */
@@ -38,7 +39,7 @@ export default class Element {
38
39
  if (this.options?.language) {
39
40
  this.options.i18n.language = this.options.language;
40
41
  }
41
- this.options.i18next = this.i18next = this.options.i18next || I18n.init(this.options.i18n);
42
+ this.options.i18next = this.i18next = this.options.i18next || I18n.init({ en: enTranslation, ...this.options.i18n });
42
43
  /**
43
44
  * An instance of the EventEmitter class to handle the emitting and registration of events.
44
45
  * @type {EventEmitter}
@@ -385,11 +386,12 @@ export default class Element {
385
386
  /**
386
387
  * Translate a text using the i18n system.
387
388
  * @param {string|Array<string>} text - The i18n identifier.
389
+ * @param {any} data - contextual data object containing data, component, row, etc.
388
390
  * @param {...any} args - The arguments to pass to the i18n translation.
389
391
  * @returns {string} - The translated text.
390
392
  */
391
- t(text, ...args) {
392
- return this.i18next ? this.i18next.t(text, ...args) : text;
393
+ t(text, data, ...args) {
394
+ return this.i18next ? this.i18next.t(text, data, ...args) : text;
393
395
  }
394
396
  /**
395
397
  * Alias to create a text node.
@@ -523,9 +525,9 @@ export default class Element {
523
525
  if (this.component.filter === string && !this.options.building) {
524
526
  const evalContext = this.evalContext(data);
525
527
  evalContext.data = _.mapValues(evalContext.data, (val) => _.isString(val) ? encodeURIComponent(val) : val);
526
- return FormioUtils.interpolate(string, evalContext, options);
528
+ return FormioUtils.Evaluator.interpolate(string, evalContext, options);
527
529
  }
528
- return FormioUtils.interpolate(string, this.evalContext(data), options);
530
+ return FormioUtils.Evaluator.interpolate(string, this.evalContext(data), options);
529
531
  }
530
532
  /**
531
533
  * 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';
@@ -51,5 +51,6 @@ export default class PDFBuilder extends WebformBuilder {
51
51
  onDropzoneDrop(e: any): boolean;
52
52
  dropEvent: any;
53
53
  onDragEnd(e: any): void;
54
+ repeatablePathsComps: any[] | undefined;
54
55
  }
55
56
  import WebformBuilder from './WebformBuilder';