@formio/js 5.1.0-dev.6082.51d4e33 → 5.1.0-dev.6085.9179bc5

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.
@@ -661,7 +661,9 @@ class Webform extends NestedDataComponent_1.default {
661
661
  const rebuild = this.rebuild() || Promise.resolve();
662
662
  return rebuild.then(() => {
663
663
  this.emit('formLoad', form);
664
- this.triggerCaptcha();
664
+ if (!this.options.server) {
665
+ this.triggerCaptcha();
666
+ }
665
667
  // Make sure to trigger onChange after a render event occurs to speed up form rendering.
666
668
  setTimeout(() => {
667
669
  this.onChange(flags);
@@ -102,8 +102,8 @@ class TextFieldComponent extends Input_1.default {
102
102
  if (((_c = this.component.widget) === null || _c === void 0 ? void 0 : _c.type) === 'calendar') {
103
103
  this.component.widget = Object.assign(Object.assign({}, this.component.widget), { readOnly: this.options.readOnly, timezone,
104
104
  displayInTimezone, locale: this.component.widget.locale || this.options.language, saveAs: 'text' });
105
- // update originalComponent to include widget settings after component initialization
106
- // originalComponent is used to restore the component (and widget) after evaluating field logic
105
+ // update originalComponent to include widget settings after component initialization
106
+ // originalComponent is used to restore the component (and widget) after evaluating field logic
107
107
  this.originalComponent = FormioUtils.fastCloneDeep(this.component);
108
108
  }
109
109
  }
@@ -490,15 +490,6 @@ export function getFocusableElements(element: HTMLElement): NodeList<HTMLElement
490
490
  * @returns {Array<string>|null} - The saved types for the component
491
491
  */
492
492
  export function getComponentSavedTypes(fullSchema: import('@formio/core').Component): Array<string> | null;
493
- /**
494
- * Checks if a string has timezone information encoded in it
495
- * Example: 2024-01-01T00:00:00Z -> true
496
- * Example: 2024-01-01T00:00:00+03:00 -> true
497
- * Example: 2011-05-03T00:00:00 -> false
498
- * @param {string} value the string value to check
499
- * @returns {boolean} if value has encoded timezone
500
- */
501
- export function hasEncodedTimezone(value: string): boolean;
502
493
  export * from "./formUtils";
503
494
  /**
504
495
  * Map values through unfold and return first non-nil value.
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
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;
22
+ 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;
23
23
  const lodash_1 = __importDefault(require("lodash"));
24
24
  exports._ = lodash_1.default;
25
25
  const json_logic_js_1 = __importDefault(require("json-logic-js"));
@@ -1646,18 +1646,3 @@ const interpolateErrors = (component, errors, interpolateFn) => {
1646
1646
  });
1647
1647
  };
1648
1648
  exports.interpolateErrors = interpolateErrors;
1649
- /**
1650
- * Checks if a string has timezone information encoded in it
1651
- * Example: 2024-01-01T00:00:00Z -> true
1652
- * Example: 2024-01-01T00:00:00+03:00 -> true
1653
- * Example: 2011-05-03T00:00:00 -> false
1654
- * @param {string} value the string value to check
1655
- * @returns {boolean} if value has encoded timezone
1656
- */
1657
- function hasEncodedTimezone(value) {
1658
- if (typeof value !== 'string') {
1659
- return false;
1660
- }
1661
- return (value.substring(value.length - 1) === 'z' || value.substring(value.length - 1) === 'Z' || value.match(/[+|-][0-9]{2}:[0-9]{2}$/));
1662
- }
1663
- exports.hasEncodedTimezone = hasEncodedTimezone;
@@ -286,11 +286,6 @@ class CalendarWidget extends InputWidget_1.default {
286
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;
287
287
  return super.setValue(value);
288
288
  }
289
- // If the component is a textfield that does not have timezone information included in the string value then skip
290
- // the timezone offset
291
- if (this.component.type === 'textfield' && !(0, utils_1.hasEncodedTimezone)(value)) {
292
- this.settings.skipOffset = true;
293
- }
294
289
  const zonesLoading = this.loadZones();
295
290
  if (value) {
296
291
  if (!saveAsText && this.settings.readOnly && !zonesLoading) {
@@ -458,7 +453,7 @@ class CalendarWidget extends InputWidget_1.default {
458
453
  return (date, format) => {
459
454
  // Only format this if this is the altFormat and the form is readOnly.
460
455
  if (this.settings.readOnly && (format === this.settings.altFormat)) {
461
- if (!this.settings.enableTime || this.loadZones() || this.settings.skipOffset) {
456
+ if (!this.settings.enableTime || this.loadZones()) {
462
457
  return Flatpickr.formatDate(date, format);
463
458
  }
464
459
  const currentValue = new Date(this.getValue());
@@ -659,7 +659,9 @@ export default class Webform extends NestedDataComponent {
659
659
  const rebuild = this.rebuild() || Promise.resolve();
660
660
  return rebuild.then(() => {
661
661
  this.emit('formLoad', form);
662
- this.triggerCaptcha();
662
+ if (!this.options.server) {
663
+ this.triggerCaptcha();
664
+ }
663
665
  // Make sure to trigger onChange after a render event occurs to speed up form rendering.
664
666
  setTimeout(() => {
665
667
  this.onChange(flags);
@@ -86,8 +86,8 @@ export default class TextFieldComponent extends Input {
86
86
  locale: this.component.widget.locale || this.options.language,
87
87
  saveAs: 'text'
88
88
  };
89
- // update originalComponent to include widget settings after component initialization
90
- // originalComponent is used to restore the component (and widget) after evaluating field logic
89
+ // update originalComponent to include widget settings after component initialization
90
+ // originalComponent is used to restore the component (and widget) after evaluating field logic
91
91
  this.originalComponent = FormioUtils.fastCloneDeep(this.component);
92
92
  }
93
93
  }
@@ -490,15 +490,6 @@ export function getFocusableElements(element: HTMLElement): NodeList<HTMLElement
490
490
  * @returns {Array<string>|null} - The saved types for the component
491
491
  */
492
492
  export function getComponentSavedTypes(fullSchema: import('@formio/core').Component): Array<string> | null;
493
- /**
494
- * Checks if a string has timezone information encoded in it
495
- * Example: 2024-01-01T00:00:00Z -> true
496
- * Example: 2024-01-01T00:00:00+03:00 -> true
497
- * Example: 2011-05-03T00:00:00 -> false
498
- * @param {string} value the string value to check
499
- * @returns {boolean} if value has encoded timezone
500
- */
501
- export function hasEncodedTimezone(value: string): boolean;
502
493
  export * from "./formUtils";
503
494
  /**
504
495
  * Map values through unfold and return first non-nil value.
@@ -1554,17 +1554,3 @@ export const interpolateErrors = (component, errors, interpolateFn) => {
1554
1554
  return { ...error, message: unescapeHTML(interpolateFn(toInterpolate, context)), context: { ...context } };
1555
1555
  });
1556
1556
  };
1557
- /**
1558
- * Checks if a string has timezone information encoded in it
1559
- * Example: 2024-01-01T00:00:00Z -> true
1560
- * Example: 2024-01-01T00:00:00+03:00 -> true
1561
- * Example: 2011-05-03T00:00:00 -> false
1562
- * @param {string} value the string value to check
1563
- * @returns {boolean} if value has encoded timezone
1564
- */
1565
- export function hasEncodedTimezone(value) {
1566
- if (typeof value !== 'string') {
1567
- return false;
1568
- }
1569
- return (value.substring(value.length - 1) === 'z' || value.substring(value.length - 1) === 'Z' || value.match(/[+|-][0-9]{2}:[0-9]{2}$/));
1570
- }
@@ -1,6 +1,6 @@
1
1
  import { Formio } from '../Formio';
2
2
  import InputWidget from './InputWidget';
3
- import { convertFormatToFlatpickr, convertFormatToMask, convertFormatToMoment, formatDate, formatOffset, getBrowserInfo, getDateSetting, getLocaleDateFormatInfo, momentDate, zonesLoaded, shouldLoadZones, loadZones, hasEncodedTimezone, } from '../utils/utils';
3
+ import { convertFormatToFlatpickr, convertFormatToMask, convertFormatToMoment, formatDate, formatOffset, getBrowserInfo, getDateSetting, getLocaleDateFormatInfo, momentDate, zonesLoaded, shouldLoadZones, loadZones, } from '../utils/utils';
4
4
  import moment from 'moment';
5
5
  import _ from 'lodash';
6
6
  const DEFAULT_FORMAT = 'yyyy-MM-dd hh:mm a';
@@ -278,11 +278,6 @@ export default class CalendarWidget extends InputWidget {
278
278
  value = value ? formatDate(this.timezonesUrl, value, convertFormatToMoment(this.settings.format), this.timezone, convertFormatToMoment(this.valueMomentFormat)) : value;
279
279
  return super.setValue(value);
280
280
  }
281
- // If the component is a textfield that does not have timezone information included in the string value then skip
282
- // the timezone offset
283
- if (this.component.type === 'textfield' && !hasEncodedTimezone(value)) {
284
- this.settings.skipOffset = true;
285
- }
286
281
  const zonesLoading = this.loadZones();
287
282
  if (value) {
288
283
  if (!saveAsText && this.settings.readOnly && !zonesLoading) {
@@ -448,7 +443,7 @@ export default class CalendarWidget extends InputWidget {
448
443
  return (date, format) => {
449
444
  // Only format this if this is the altFormat and the form is readOnly.
450
445
  if (this.settings.readOnly && (format === this.settings.altFormat)) {
451
- if (!this.settings.enableTime || this.loadZones() || this.settings.skipOffset) {
446
+ if (!this.settings.enableTime || this.loadZones()) {
452
447
  return Flatpickr.formatDate(date, format);
453
448
  }
454
449
  const currentValue = new Date(this.getValue());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6082.51d4e33",
3
+ "version": "5.1.0-dev.6085.9179bc5",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {