@formio/js 5.1.0-dev.6114.02b6d9c → 5.1.0-dev.6123.055aa35

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 (143) hide show
  1. package/dist/formio.builder.css +6 -0
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.css +1 -1
  4. package/dist/formio.embed.min.css +1 -1
  5. package/dist/formio.form.css +6 -0
  6. package/dist/formio.form.js +112 -123
  7. package/dist/formio.form.min.css +1 -1
  8. package/dist/formio.form.min.js +1 -1
  9. package/dist/formio.full.css +6 -0
  10. package/dist/formio.full.js +119 -130
  11. package/dist/formio.full.min.css +1 -1
  12. package/dist/formio.full.min.js +1 -1
  13. package/dist/formio.js +61 -50
  14. package/dist/formio.min.js +1 -1
  15. package/dist/formio.utils.js +72 -72
  16. package/dist/formio.utils.min.js +1 -1
  17. package/lib/cjs/Element.js +13 -36
  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.js +4 -5
  22. package/lib/cjs/Webform.js +5 -6
  23. package/lib/cjs/WebformBuilder.js +9 -10
  24. package/lib/cjs/Wizard.js +1 -1
  25. package/lib/cjs/WizardBuilder.js +1 -1
  26. package/lib/cjs/components/_classes/component/Component.js +29 -52
  27. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  28. package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  29. package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
  30. package/lib/cjs/components/_classes/input/Input.js +1 -1
  31. package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
  32. package/lib/cjs/components/_classes/nested/NestedComponent.js +6 -6
  33. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  34. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  35. package/lib/cjs/components/address/Address.js +1 -1
  36. package/lib/cjs/components/alert/Alert.js +1 -1
  37. package/lib/cjs/components/button/Button.d.ts +1 -1
  38. package/lib/cjs/components/button/Button.js +4 -4
  39. package/lib/cjs/components/checkbox/Checkbox.js +1 -1
  40. package/lib/cjs/components/container/Container.js +1 -1
  41. package/lib/cjs/components/currency/Currency.js +1 -1
  42. package/lib/cjs/components/datagrid/DataGrid.js +1 -1
  43. package/lib/cjs/components/datamap/DataMap.d.ts +1 -1
  44. package/lib/cjs/components/datamap/DataMap.js +4 -4
  45. package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
  46. package/lib/cjs/components/datetime/DateTime.js +15 -13
  47. package/lib/cjs/components/day/Day.js +1 -1
  48. package/lib/cjs/components/editgrid/EditGrid.js +1 -1
  49. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  50. package/lib/cjs/components/file/File.js +1 -1
  51. package/lib/cjs/components/form/Form.js +14 -2
  52. package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
  53. package/lib/cjs/components/number/Number.js +1 -1
  54. package/lib/cjs/components/panel/Panel.js +1 -1
  55. package/lib/cjs/components/radio/Radio.js +1 -1
  56. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  57. package/lib/cjs/components/select/Select.js +1 -1
  58. package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
  59. package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
  60. package/lib/cjs/components/signature/Signature.js +1 -1
  61. package/lib/cjs/components/survey/Survey.js +1 -1
  62. package/lib/cjs/components/tags/Tags.js +1 -1
  63. package/lib/cjs/components/textarea/TextArea.js +3 -3
  64. package/lib/cjs/components/textfield/TextField.js +7 -30
  65. package/lib/cjs/components/time/Time.js +1 -1
  66. package/lib/cjs/formio.form.js +3 -3
  67. package/lib/cjs/i18n.js +1 -1
  68. package/lib/cjs/providers/storage/uploadAdapter.js +1 -1
  69. package/lib/cjs/utils/Evaluator.d.ts +13 -6
  70. package/lib/cjs/utils/Evaluator.js +27 -15
  71. package/lib/cjs/utils/builder.js +5 -5
  72. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
  73. package/lib/cjs/utils/i18n.js +3 -3
  74. package/lib/cjs/utils/index.d.ts +161 -2
  75. package/lib/cjs/utils/index.js +12 -2
  76. package/lib/cjs/utils/utils.d.ts +18 -33
  77. package/lib/cjs/utils/utils.js +52 -130
  78. package/lib/cjs/widgets/CalendarWidget.d.ts +0 -7
  79. package/lib/cjs/widgets/CalendarWidget.js +15 -39
  80. package/lib/mjs/Element.js +6 -6
  81. package/lib/mjs/EventEmitter.js +2 -2
  82. package/lib/mjs/Form.js +1 -1
  83. package/lib/mjs/PDF.js +1 -1
  84. package/lib/mjs/PDFBuilder.js +1 -2
  85. package/lib/mjs/Webform.js +3 -4
  86. package/lib/mjs/WebformBuilder.js +1 -2
  87. package/lib/mjs/Wizard.js +1 -1
  88. package/lib/mjs/WizardBuilder.js +1 -1
  89. package/lib/mjs/components/_classes/component/Component.js +2 -2
  90. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  91. package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  92. package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
  93. package/lib/mjs/components/_classes/input/Input.js +1 -1
  94. package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
  95. package/lib/mjs/components/_classes/nested/NestedComponent.js +6 -6
  96. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  97. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  98. package/lib/mjs/components/address/Address.js +1 -1
  99. package/lib/mjs/components/alert/Alert.js +1 -1
  100. package/lib/mjs/components/button/Button.d.ts +1 -1
  101. package/lib/mjs/components/button/Button.js +1 -1
  102. package/lib/mjs/components/checkbox/Checkbox.js +1 -1
  103. package/lib/mjs/components/container/Container.js +1 -1
  104. package/lib/mjs/components/currency/Currency.js +1 -1
  105. package/lib/mjs/components/datagrid/DataGrid.js +1 -1
  106. package/lib/mjs/components/datamap/DataMap.d.ts +1 -1
  107. package/lib/mjs/components/datamap/DataMap.js +1 -1
  108. package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
  109. package/lib/mjs/components/datetime/DateTime.js +15 -13
  110. package/lib/mjs/components/day/Day.js +1 -1
  111. package/lib/mjs/components/editgrid/EditGrid.js +1 -1
  112. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  113. package/lib/mjs/components/file/File.js +1 -1
  114. package/lib/mjs/components/form/Form.js +13 -2
  115. package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
  116. package/lib/mjs/components/number/Number.js +1 -1
  117. package/lib/mjs/components/panel/Panel.js +1 -1
  118. package/lib/mjs/components/radio/Radio.js +1 -1
  119. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  120. package/lib/mjs/components/select/Select.js +1 -1
  121. package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
  122. package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
  123. package/lib/mjs/components/signature/Signature.js +1 -1
  124. package/lib/mjs/components/survey/Survey.js +1 -1
  125. package/lib/mjs/components/tags/Tags.js +1 -1
  126. package/lib/mjs/components/textarea/TextArea.js +3 -3
  127. package/lib/mjs/components/textfield/TextField.js +1 -1
  128. package/lib/mjs/components/time/Time.js +1 -1
  129. package/lib/mjs/formio.form.js +2 -2
  130. package/lib/mjs/i18n.js +1 -1
  131. package/lib/mjs/providers/storage/uploadAdapter.js +1 -1
  132. package/lib/mjs/utils/Evaluator.d.ts +13 -6
  133. package/lib/mjs/utils/Evaluator.js +21 -13
  134. package/lib/mjs/utils/builder.js +1 -1
  135. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
  136. package/lib/mjs/utils/i18n.js +1 -1
  137. package/lib/mjs/utils/index.d.ts +161 -2
  138. package/lib/mjs/utils/index.js +11 -1
  139. package/lib/mjs/utils/utils.d.ts +18 -33
  140. package/lib/mjs/utils/utils.js +45 -105
  141. package/lib/mjs/widgets/CalendarWidget.d.ts +0 -7
  142. package/lib/mjs/widgets/CalendarWidget.js +15 -39
  143. package/package.json +3 -2
@@ -1,8 +1,8 @@
1
- import { Formio } from '../Formio';
2
- import InputWidget from './InputWidget';
3
- import { convertFormatToFlatpickr, convertFormatToMask, convertFormatToMoment, formatDate, formatOffset, getBrowserInfo, getDateSetting, getLocaleDateFormatInfo, momentDate, zonesLoaded, shouldLoadZones, loadZones, hasEncodedTimezone, } from '../utils/utils';
4
1
  import moment from 'moment';
5
2
  import _ from 'lodash';
3
+ import { Formio } from '../Formio';
4
+ import InputWidget from './InputWidget';
5
+ import { convertFormatToFlatpickr, convertFormatToMask, convertFormatToDayjs, formatDate, formatOffset, getBrowserInfo, getDateSetting, getLocaleDateFormatInfo, hasEncodedTimezone, dayjsDate } from '../utils';
6
6
  const DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';
7
7
  const ISO_8601_FORMAT = 'yyyy-MM-ddTHH:mm:ssZ';
8
8
  const isIEBrowser = getBrowserInfo().ie;
@@ -46,29 +46,6 @@ export default class CalendarWidget extends InputWidget {
46
46
  else if (this.settings.time_24hr) {
47
47
  this.settings.format = this.settings.format.replace(/hh:mm a$/g, 'HH:mm');
48
48
  }
49
- this.zoneLoading = false;
50
- this.timezonesUrl = `${Formio.cdn['moment-timezone']}/data/packed/latest.json`;
51
- }
52
- /**
53
- * Load the timezones.
54
- * @returns {boolean} TRUE if the zones are loading, FALSE otherwise.
55
- */
56
- loadZones() {
57
- const timezone = this.timezone;
58
- if (this.zoneLoading) {
59
- return true;
60
- }
61
- if (!zonesLoaded() && shouldLoadZones(timezone)) {
62
- this.zoneLoading = true;
63
- loadZones(this.timezonesUrl, timezone).then(() => {
64
- this.zoneLoading = false;
65
- this.emit('redraw');
66
- });
67
- // Return zones are loading.
68
- return true;
69
- }
70
- // Zones are already loaded.
71
- return false;
72
49
  }
73
50
  attach(input) {
74
51
  const superAttach = super.attach(input);
@@ -79,7 +56,7 @@ export default class CalendarWidget extends InputWidget {
79
56
  };
80
57
  this.closedOn = 0;
81
58
  this.valueFormat = (this.settings.saveAs === 'date') ? ISO_8601_FORMAT : this.settings.dateFormat || ISO_8601_FORMAT;
82
- this.valueMomentFormat = convertFormatToMoment(this.valueFormat);
59
+ this.valueMomentFormat = convertFormatToDayjs(this.valueFormat);
83
60
  const isReadOnly = this.settings.readOnly;
84
61
  this.settings.minDate = isReadOnly ? null : getDateSetting(this.settings.minDate);
85
62
  this.settings.maxDate = isReadOnly ? null : getDateSetting(this.settings.maxDate);
@@ -241,9 +218,9 @@ export default class CalendarWidget extends InputWidget {
241
218
  */
242
219
  getDateValue(date, format, useTimezone) {
243
220
  if (useTimezone) {
244
- return momentDate(date, this.valueFormat, this.timezone).format(convertFormatToMoment(format));
221
+ return dayjsDate(date, this.valueFormat, this.timezone).format(convertFormatToDayjs(format));
245
222
  }
246
- return moment(date).format(convertFormatToMoment(format));
223
+ return moment(date).format(convertFormatToDayjs(format));
247
224
  }
248
225
  /**
249
226
  * Return the value of the selected date.
@@ -275,7 +252,7 @@ export default class CalendarWidget extends InputWidget {
275
252
  setValue(value) {
276
253
  const saveAsText = (this.settings.saveAs === 'text');
277
254
  if (!this.calendar) {
278
- value = value ? formatDate(this.timezonesUrl, value, convertFormatToMoment(this.settings.format), this.timezone, convertFormatToMoment(this.valueMomentFormat)) : value;
255
+ value = value ? formatDate(value, convertFormatToDayjs(this.settings.format), this.timezone, convertFormatToDayjs(this.valueMomentFormat)) : value;
279
256
  return super.setValue(value);
280
257
  }
281
258
  // If the component is a textfield that does not have timezone information included in the string value then skip
@@ -283,10 +260,9 @@ export default class CalendarWidget extends InputWidget {
283
260
  if (this.component.type === 'textfield' && !hasEncodedTimezone(value)) {
284
261
  this.settings.skipOffset = true;
285
262
  }
286
- const zonesLoading = this.loadZones();
287
263
  if (value) {
288
- if (!saveAsText && this.settings.readOnly && !zonesLoading) {
289
- this.calendar.setDate(momentDate(value, this.valueFormat, this.timezone).format(), false);
264
+ if (!saveAsText && this.settings.readOnly) {
265
+ this.calendar.setDate(dayjsDate(value, this.valueFormat, this.timezone).format(), false);
290
266
  }
291
267
  else if (this.isValueISO8601(value)) {
292
268
  this.calendar.setDate(value, false);
@@ -303,9 +279,9 @@ export default class CalendarWidget extends InputWidget {
303
279
  const inputFormat = format || this.dateFormat;
304
280
  const valueFormat = this.calendar ? this.valueFormat : this.settings.dateFormat;
305
281
  if (this.settings.saveAs === 'text' && this.componentInstance.parent && !this.settings.readOnly) {
306
- return moment(value, convertFormatToMoment(valueFormat)).format(convertFormatToMoment(valueFormat));
282
+ return moment(value, convertFormatToDayjs(valueFormat)).format(convertFormatToDayjs(valueFormat));
307
283
  }
308
- return formatDate(this.timezonesUrl, value, inputFormat, this.timezone, convertFormatToMoment(valueFormat));
284
+ return formatDate(value, inputFormat, this.timezone, convertFormatToDayjs(valueFormat));
309
285
  }
310
286
  setErrorClasses(hasErrors) {
311
287
  if (!this.input) {
@@ -396,7 +372,7 @@ export default class CalendarWidget extends InputWidget {
396
372
  const relatedTarget = event.relatedTarget ? event.relatedTarget : activeElement;
397
373
  if (!(isIEBrowser && !relatedTarget) && !this.isCalendarElement(relatedTarget)) {
398
374
  const inputValue = this.calendar.input.value;
399
- const dateValue = inputValue ? moment(this.calendar.input.value, convertFormatToMoment(this.valueFormat)).toDate() : inputValue;
375
+ const dateValue = inputValue ? moment(this.calendar.input.value, convertFormatToDayjs(this.valueFormat)).toDate() : inputValue;
400
376
  this.calendar.setDate(dateValue, true, this.settings.altFormat);
401
377
  }
402
378
  else if (!this.calendar.input.value && this.calendar.config.noCalendar) {
@@ -448,14 +424,14 @@ export default class CalendarWidget extends InputWidget {
448
424
  return (date, format) => {
449
425
  // Only format this if this is the altFormat and the form is readOnly.
450
426
  if (this.settings.readOnly && (format === this.settings.altFormat)) {
451
- if (!this.settings.enableTime || this.loadZones() || this.settings.skipOffset) {
427
+ if (!this.settings.enableTime || this.settings.skipOffset) {
452
428
  return Flatpickr.formatDate(date, format);
453
429
  }
454
430
  const currentValue = new Date(this.getValue());
455
431
  if (currentValue.toString() === date.toString()) {
456
- return formatOffset(this.timezonesUrl, Flatpickr.formatDate.bind(Flatpickr), new Date(this.componentValue), format, this.timezone);
432
+ return formatOffset(Flatpickr.formatDate.bind(Flatpickr), new Date(this.componentValue), format, this.timezone);
457
433
  }
458
- return formatOffset(this.timezonesUrl, Flatpickr.formatDate.bind(Flatpickr), date, format, this.timezone);
434
+ return formatOffset(Flatpickr.formatDate.bind(Flatpickr), date, format, this.timezone);
459
435
  }
460
436
  return Flatpickr.formatDate(date, format);
461
437
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6114.02b6d9c",
3
+ "version": "5.1.0-dev.6123.055aa35",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "homepage": "https://github.com/formio/formio.js#readme",
82
82
  "dependencies": {
83
83
  "@formio/bootstrap": "v3.0.0-dev.121.085d187",
84
- "@formio/core": "v2.4.0-dev.232.d91b1e4",
84
+ "@formio/core": "2.4.0-dev.245.326cac7",
85
85
  "@formio/text-mask-addons": "3.8.0-formio.4",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",
@@ -92,6 +92,7 @@
92
92
  "choices.js": "^11.0.6",
93
93
  "compare-versions": "^6.1.1",
94
94
  "core-js": "^3.37.1",
95
+ "dayjs": "^1.11.13",
95
96
  "dialog-polyfill": "^0.5.6",
96
97
  "dom-autoscroller": "^2.3.4",
97
98
  "dompurify": "^3.2.5",