@formio/js 5.0.1-rc.1 → 5.0.1-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +15 -15
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +15 -15
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +6 -6
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +5 -5
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/components/day/Day.js +2 -18
- package/lib/cjs/formio.embed.d.ts +1 -1
- package/lib/cjs/formio.embed.js +3 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.js +23 -1
- package/lib/cjs/translations/en.js +2 -2
- package/lib/mjs/components/day/Day.js +2 -18
- package/lib/mjs/formio.embed.d.ts +1 -1
- package/lib/mjs/formio.embed.js +1 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.js +22 -1
- package/lib/mjs/translations/en.js +2 -2
- package/package.json +4 -4
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
|
14
14
|
|
15
|
-
/*! formiojs v5.0.1-rc.
|
15
|
+
/*! formiojs v5.0.1-rc.3 | https://unpkg.com/formiojs@5.0.1-rc.3/LICENSE.txt */
|
16
16
|
|
17
17
|
/**
|
18
18
|
* @license
|
package/dist/formio.utils.js
CHANGED
@@ -433,7 +433,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
433
433
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
434
434
|
|
435
435
|
"use strict";
|
436
|
-
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateMaximumDayInfo = exports.validateMaximumDaySync = exports.validateMaximumDay = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst date_1 = __webpack_require__(/*! ../../../utils/date */ \"./node_modules/@formio/core/lib/utils/date.js\");\nconst isValidatableDayComponent = (component) => {\n return component && component.type === 'day' && component.hasOwnProperty('maxDate');\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!isValidatableDayComponent(component)) {\n return false;\n }\n if ((0, date_1.isPartialDay)(component, value)) {\n return false;\n }\n if (!(0, date_1.getDateSetting)(component.maxDate)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMaximumDay = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMaximumDaySync)(context);\n});\nexports.validateMaximumDay = validateMaximumDay;\nconst validateMaximumDaySync = (context) => {\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (typeof value !== 'string') {\n throw new error_1.ProcessorError(`Cannot validate day value ${value} because it is not a string`, context, 'validate:validateMaximumDay');\n }\n // TODO: this validation probably goes for dates and days\n const format = (0, date_1.getDateValidationFormat)(component);\n const date = (0, date_1.dayjs)(value, format);\n const maxDate = (0, date_1.getDateSetting)(component.maxDate);\n if (maxDate === null) {\n return null;\n }\n else {\n maxDate.setHours(0, 0, 0, 0);\n }\n const error = new error_1.FieldError('
|
436
|
+
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateMaximumDayInfo = exports.validateMaximumDaySync = exports.validateMaximumDay = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst date_1 = __webpack_require__(/*! ../../../utils/date */ \"./node_modules/@formio/core/lib/utils/date.js\");\nconst isValidatableDayComponent = (component) => {\n return component && component.type === 'day' && component.hasOwnProperty('maxDate');\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!isValidatableDayComponent(component)) {\n return false;\n }\n if ((0, date_1.isPartialDay)(component, value)) {\n return false;\n }\n if (!(0, date_1.getDateSetting)(component.maxDate)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMaximumDay = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMaximumDaySync)(context);\n});\nexports.validateMaximumDay = validateMaximumDay;\nconst validateMaximumDaySync = (context) => {\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (typeof value !== 'string') {\n throw new error_1.ProcessorError(`Cannot validate day value ${value} because it is not a string`, context, 'validate:validateMaximumDay');\n }\n // TODO: this validation probably goes for dates and days\n const format = (0, date_1.getDateValidationFormat)(component);\n const date = (0, date_1.dayjs)(value, format);\n const maxDate = (0, date_1.getDateSetting)(component.maxDate);\n if (maxDate === null) {\n return null;\n }\n else {\n maxDate.setHours(0, 0, 0, 0);\n }\n const error = new error_1.FieldError('maxDate', Object.assign(Object.assign({}, context), { maxDate: (0, date_1.dayjs)(maxDate).format((0, date_1.getDayFormat)(component)), setting: String(maxDate) }));\n return date.isBefore((0, date_1.dayjs)(maxDate)) || date.isSame((0, date_1.dayjs)(maxDate)) ? null : error;\n};\nexports.validateMaximumDaySync = validateMaximumDaySync;\nexports.validateMaximumDayInfo = {\n name: 'validateMaximumDay',\n process: exports.validateMaximumDay,\n processSync: exports.validateMaximumDaySync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateMaximumDay.js?");
|
437
437
|
|
438
438
|
/***/ }),
|
439
439
|
|
@@ -499,7 +499,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
499
499
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
500
500
|
|
501
501
|
"use strict";
|
502
|
-
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateMinimumDayInfo = exports.validateMinimumDaySync = exports.validateMinimumDay = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst date_1 = __webpack_require__(/*! ../../../utils/date */ \"./node_modules/@formio/core/lib/utils/date.js\");\nconst isValidatableDayComponent = (component) => {\n return component && component.type === 'day' && component.hasOwnProperty('minDate');\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!isValidatableDayComponent(component)) {\n return false;\n }\n if ((0, date_1.isPartialDay)(component, value)) {\n return false;\n }\n if ((0, date_1.getDateSetting)(component.minDate) === null) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMinimumDay = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMinimumDaySync)(context);\n});\nexports.validateMinimumDay = validateMinimumDay;\nconst validateMinimumDaySync = (context) => {\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (typeof value !== 'string') {\n throw new error_1.ProcessorError(`Cannot validate day value ${value} because it is not a string`, context, 'validate:validateMinimumDay');\n }\n const date = (0, date_1.getDateValidationFormat)(component)\n ? (0, date_1.dayjs)(value, (0, date_1.getDateValidationFormat)(component))\n : (0, date_1.dayjs)(value);\n const minDate = (0, date_1.getDateSetting)(component.minDate);\n if (minDate === null) {\n return null;\n }\n else {\n minDate.setHours(0, 0, 0, 0);\n }\n const error = new error_1.FieldError('
|
502
|
+
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateMinimumDayInfo = exports.validateMinimumDaySync = exports.validateMinimumDay = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst date_1 = __webpack_require__(/*! ../../../utils/date */ \"./node_modules/@formio/core/lib/utils/date.js\");\nconst isValidatableDayComponent = (component) => {\n return component && component.type === 'day' && component.hasOwnProperty('minDate');\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!isValidatableDayComponent(component)) {\n return false;\n }\n if ((0, date_1.isPartialDay)(component, value)) {\n return false;\n }\n if ((0, date_1.getDateSetting)(component.minDate) === null) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMinimumDay = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMinimumDaySync)(context);\n});\nexports.validateMinimumDay = validateMinimumDay;\nconst validateMinimumDaySync = (context) => {\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (typeof value !== 'string') {\n throw new error_1.ProcessorError(`Cannot validate day value ${value} because it is not a string`, context, 'validate:validateMinimumDay');\n }\n const date = (0, date_1.getDateValidationFormat)(component)\n ? (0, date_1.dayjs)(value, (0, date_1.getDateValidationFormat)(component))\n : (0, date_1.dayjs)(value);\n const minDate = (0, date_1.getDateSetting)(component.minDate);\n if (minDate === null) {\n return null;\n }\n else {\n minDate.setHours(0, 0, 0, 0);\n }\n const error = new error_1.FieldError('minDate', Object.assign(Object.assign({}, context), { minDate: (0, date_1.dayjs)(minDate).format((0, date_1.getDayFormat)(component)), setting: String(minDate) }));\n return date.isAfter(minDate) || date.isSame(minDate) ? null : error;\n};\nexports.validateMinimumDaySync = validateMinimumDaySync;\nexports.validateMinimumDayInfo = {\n name: 'validateMinimumDay',\n process: exports.validateMinimumDay,\n processSync: exports.validateMinimumDaySync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateMinimumDay.js?");
|
503
503
|
|
504
504
|
/***/ }),
|
505
505
|
|
@@ -1302,7 +1302,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1302
1302
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1303
1303
|
|
1304
1304
|
"use strict";
|
1305
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.dayjs = exports.isPartialDay = exports.getDateValidationFormat = exports.getDateSetting = exports.formatDate = exports.momentDate = exports.convertFormatToMoment = exports.currentTimezone = void 0;\nconst dayjs_1 = __importDefault(__webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\"));\nexports.dayjs = dayjs_1.default;\nconst timezone_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/timezone */ \"./node_modules/dayjs/plugin/timezone.js\"));\nconst utc_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/utc */ \"./node_modules/dayjs/plugin/utc.js\"));\nconst customParseFormat_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/customParseFormat */ \"./node_modules/dayjs/plugin/customParseFormat.js\"));\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst Evaluator_1 = __webpack_require__(/*! ./Evaluator */ \"./node_modules/@formio/core/lib/utils/Evaluator.js\");\ndayjs_1.default.extend(utc_1.default);\ndayjs_1.default.extend(timezone_1.default);\ndayjs_1.default.extend(customParseFormat_1.default);\n/**\n * Get the current timezone string.\n *\n * @return {string}\n */\nfunction currentTimezone() {\n return dayjs_1.default.tz.guess();\n}\nexports.currentTimezone = currentTimezone;\n/**\n * Convert the format from the angular-datepicker module to moment format.\n * @param format\n * @return {string}\n */\nfunction convertFormatToMoment(format) {\n return (format\n // Year conversion.\n .replace(/y/g, 'Y')\n // Day in month.\n .replace(/d/g, 'D')\n // Day in week.\n .replace(/E/g, 'd')\n // AM/PM marker\n .replace(/a/g, 'A')\n // Unix Timestamp\n .replace(/U/g, 'X'));\n}\nexports.convertFormatToMoment = convertFormatToMoment;\n/**\n * Get the moment date object for translating dates with timezones.\n *\n * @param value\n * @param format\n * @param timezone\n * @return {*}\n */\nfunction momentDate(value, format, timezone) {\n const momentDate = (0, dayjs_1.default)(value);\n if (timezone === 'UTC') {\n return dayjs_1.default.utc();\n }\n if (timezone !== currentTimezone() || (format && format.match(/\\s(z$|z\\s)/))) {\n return momentDate.tz(timezone);\n }\n return momentDate;\n}\nexports.momentDate = momentDate;\n/**\n * Format a date provided a value, format, and timezone object.\n *\n * @param value\n * @param format\n * @param timezone\n * @return {string}\n */\nfunction formatDate(value, format, timezone) {\n const momentDate = (0, dayjs_1.default)(value);\n if (timezone === 'UTC') {\n return `${dayjs_1.default.utc().format(convertFormatToMoment(format))} UTC`;\n }\n if (timezone) {\n return momentDate.tz(timezone).format(`${convertFormatToMoment(format)} z`);\n }\n return momentDate.format(convertFormatToMoment(format));\n}\nexports.formatDate = formatDate;\n/**\n * Return a translated date setting.\n *\n * @param date\n * @return {(null|Date)}\n */\nfunction getDateSetting(date) {\n if ((0, lodash_1.isNil)(date) || (0, lodash_1.isNaN)(date) || date === '') {\n return null;\n }\n if (date instanceof Date) {\n return date;\n }\n else if (typeof date.toDate === 'function') {\n return date.isValid() ? date.toDate() : null;\n }\n let dateSetting = typeof date !== 'string' || date.indexOf('moment(') === -1 ? (0, dayjs_1.default)(date) : null;\n if (dateSetting && dateSetting.isValid()) {\n return dateSetting.toDate();\n }\n dateSetting = null;\n try {\n const value = Evaluator_1.Evaluator.evaluator(`return ${date};`, 'moment')(dayjs_1.default);\n if (typeof value === 'string') {\n dateSetting = (0, dayjs_1.default)(value);\n }\n else if (typeof value.toDate === 'function') {\n dateSetting = (0, dayjs_1.default)(value.toDate().toUTCString());\n }\n else if (value instanceof Date) {\n dateSetting = (0, dayjs_1.default)(value);\n }\n }\n catch (ignoreError) {\n return null;\n }\n if (!dateSetting) {\n return null;\n }\n // Ensure this is a date.\n if (!dateSetting.isValid()) {\n return null;\n }\n return dateSetting.toDate();\n}\nexports.getDateSetting = getDateSetting;\nconst getDateValidationFormat = (component) => {\n return component.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';\n};\nexports.getDateValidationFormat = getDateValidationFormat;\nconst isPartialDay = (component, value) => {\n if (!value) {\n return true;\n }\n const [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n const values = value.split('/');\n return values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000';\n};\nexports.isPartialDay = isPartialDay;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/date.js?");
|
1305
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.dayjs = exports.isPartialDay = exports.getDateValidationFormat = exports.getDateSetting = exports.getDayFormat = exports.formatDate = exports.momentDate = exports.convertFormatToMoment = exports.currentTimezone = void 0;\nconst dayjs_1 = __importDefault(__webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\"));\nexports.dayjs = dayjs_1.default;\nconst timezone_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/timezone */ \"./node_modules/dayjs/plugin/timezone.js\"));\nconst utc_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/utc */ \"./node_modules/dayjs/plugin/utc.js\"));\nconst customParseFormat_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/customParseFormat */ \"./node_modules/dayjs/plugin/customParseFormat.js\"));\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst Evaluator_1 = __webpack_require__(/*! ./Evaluator */ \"./node_modules/@formio/core/lib/utils/Evaluator.js\");\ndayjs_1.default.extend(utc_1.default);\ndayjs_1.default.extend(timezone_1.default);\ndayjs_1.default.extend(customParseFormat_1.default);\n/**\n * Get the current timezone string.\n *\n * @return {string}\n */\nfunction currentTimezone() {\n return dayjs_1.default.tz.guess();\n}\nexports.currentTimezone = currentTimezone;\n/**\n * Convert the format from the angular-datepicker module to moment format.\n * @param format\n * @return {string}\n */\nfunction convertFormatToMoment(format) {\n return (format\n // Year conversion.\n .replace(/y/g, 'Y')\n // Day in month.\n .replace(/d/g, 'D')\n // Day in week.\n .replace(/E/g, 'd')\n // AM/PM marker\n .replace(/a/g, 'A')\n // Unix Timestamp\n .replace(/U/g, 'X'));\n}\nexports.convertFormatToMoment = convertFormatToMoment;\n/**\n * Get the moment date object for translating dates with timezones.\n *\n * @param value\n * @param format\n * @param timezone\n * @return {*}\n */\nfunction momentDate(value, format, timezone) {\n const momentDate = (0, dayjs_1.default)(value);\n if (timezone === 'UTC') {\n return dayjs_1.default.utc();\n }\n if (timezone !== currentTimezone() || (format && format.match(/\\s(z$|z\\s)/))) {\n return momentDate.tz(timezone);\n }\n return momentDate;\n}\nexports.momentDate = momentDate;\n/**\n * Format a date provided a value, format, and timezone object.\n *\n * @param value\n * @param format\n * @param timezone\n * @return {string}\n */\nfunction formatDate(value, format, timezone) {\n const momentDate = (0, dayjs_1.default)(value);\n if (timezone === 'UTC') {\n return `${dayjs_1.default.utc().format(convertFormatToMoment(format))} UTC`;\n }\n if (timezone) {\n return momentDate.tz(timezone).format(`${convertFormatToMoment(format)} z`);\n }\n return momentDate.format(convertFormatToMoment(format));\n}\nexports.formatDate = formatDate;\nfunction getDayFormat(component) {\n let format = '';\n const showDay = !(0, lodash_1.get)(component, 'fields.day.hide', false);\n const showMonth = !(0, lodash_1.get)(component, 'fields.month.hide', false);\n const showYear = !(0, lodash_1.get)(component, 'fields.year.hide', false);\n if (component.dayFirst && showDay) {\n format += 'D/';\n }\n if (showMonth) {\n format += 'M/';\n }\n if (!component.dayFirst && showDay) {\n format += 'D/';\n }\n if (showYear) {\n format += 'YYYY';\n return format;\n }\n else {\n // Trim off the \"/\" from the end of the format string.\n return format.length ? format.substring(0, format.length - 1) : format;\n }\n}\nexports.getDayFormat = getDayFormat;\n/**\n * Return a translated date setting.\n *\n * @param date\n * @return {(null|Date)}\n */\nfunction getDateSetting(date) {\n if ((0, lodash_1.isNil)(date) || (0, lodash_1.isNaN)(date) || date === '') {\n return null;\n }\n if (date instanceof Date) {\n return date;\n }\n else if (typeof date.toDate === 'function') {\n return date.isValid() ? date.toDate() : null;\n }\n let dateSetting = typeof date !== 'string' || date.indexOf('moment(') === -1 ? (0, dayjs_1.default)(date) : null;\n if (dateSetting && dateSetting.isValid()) {\n return dateSetting.toDate();\n }\n dateSetting = null;\n try {\n const value = Evaluator_1.Evaluator.evaluator(`return ${date};`, 'moment')(dayjs_1.default);\n if (typeof value === 'string') {\n dateSetting = (0, dayjs_1.default)(value);\n }\n else if (typeof value.toDate === 'function') {\n dateSetting = (0, dayjs_1.default)(value.toDate().toUTCString());\n }\n else if (value instanceof Date) {\n dateSetting = (0, dayjs_1.default)(value);\n }\n }\n catch (ignoreError) {\n return null;\n }\n if (!dateSetting) {\n return null;\n }\n // Ensure this is a date.\n if (!dateSetting.isValid()) {\n return null;\n }\n return dateSetting.toDate();\n}\nexports.getDateSetting = getDateSetting;\nconst getDateValidationFormat = (component) => {\n return component.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';\n};\nexports.getDateValidationFormat = getDateValidationFormat;\nconst isPartialDay = (component, value) => {\n if (!value) {\n return true;\n }\n const [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n const values = value.split('/');\n return values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000';\n};\nexports.isPartialDay = isPartialDay;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/date.js?");
|
1306
1306
|
|
1307
1307
|
/***/ }),
|
1308
1308
|
|
@@ -1368,7 +1368,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
1368
1368
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1369
1369
|
|
1370
1370
|
"use strict";
|
1371
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.eachComponentData = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst index_1 = __webpack_require__(/*! ./index */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst eachComponent_1 = __webpack_require__(/*! ./eachComponent */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponent.js\");\nconst eachComponentData = (components, data, fn, path = '', index, parent, includeAll = false) => {\n if (!components
|
1371
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.eachComponentData = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst index_1 = __webpack_require__(/*! ./index */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst eachComponent_1 = __webpack_require__(/*! ./eachComponent */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponent.js\");\nconst eachComponentData = (components, data, fn, path = '', index, parent, includeAll = false) => {\n if (!components) {\n return;\n }\n return (0, eachComponent_1.eachComponent)(components, (component, compPath, componentComponents, compParent) => {\n var _a;\n const row = (0, index_1.getContextualRowData)(component, compPath, data);\n if (fn(component, data, row, compPath, componentComponents, index, compParent) === true) {\n return true;\n }\n if ((0, index_1.isComponentNestedDataType)(component)) {\n const value = (0, lodash_1.get)(data, compPath, data);\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const nestedComponentPath = (0, index_1.getModelType)(component) === 'nestedDataArray'\n ? `${compPath}[${i}].data`\n : `${compPath}[${i}]`;\n (0, exports.eachComponentData)(component.components, data, fn, nestedComponentPath, i, component, includeAll);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row) && !includeAll) {\n // Tree components may submit empty objects; since we've already evaluated the parent tree/layout component, we won't worry about constituent elements\n return true;\n }\n if ((0, index_1.getModelType)(component) === 'dataObject') {\n const nestedFormValue = (0, lodash_1.get)(data, component.path);\n const noReferenceAttached = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id)\n ? (0, lodash_1.isEmpty)(nestedFormValue.data) && !(0, lodash_1.has)(nestedFormValue, 'form')\n : false;\n const shouldBeCleared = (!component.hasOwnProperty('clearOnHide') || component.clearOnHide) &&\n (component.hidden || ((_a = component.ephermalState) === null || _a === void 0 ? void 0 : _a.conditionallyHidden));\n // Skip all the nested components processing if nested form is hidden and should be cleared on hide or if submission is saved as reference and not loaded\n const shouldSkipProcessingNestedFormData = noReferenceAttached || shouldBeCleared;\n if (!shouldSkipProcessingNestedFormData) {\n // For nested forms, we need to reset the \"data\" and \"path\" objects for all of the children components, and then re-establish the data when it is done.\n const childPath = (0, index_1.componentDataPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, {});\n (0, exports.eachComponentData)(component.components, childData, fn, '', index, component, includeAll);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n (0, exports.eachComponentData)(component.components, data, fn, (0, index_1.componentDataPath)(component, path, compPath), index, component, includeAll);\n }\n return true;\n }\n else if ((0, index_1.getModelType)(component) === 'none') {\n const info = (0, index_1.componentInfo)(component);\n if (info.hasColumns) {\n const columnsComponent = component;\n columnsComponent.columns.forEach((column) => (0, exports.eachComponentData)(column.components, data, fn, (0, index_1.componentFormPath)(columnsComponent, path, columnsComponent.path), index, component));\n }\n else if (info.hasRows) {\n const rowsComponent = component;\n rowsComponent.rows.forEach((row) => {\n if (Array.isArray(row)) {\n row.forEach((row) => (0, exports.eachComponentData)(row.components, data, fn, (0, index_1.componentFormPath)(rowsComponent, path, rowsComponent.path), index, component));\n }\n });\n }\n else if (info.hasComps) {\n const componentWithChildren = component;\n (0, exports.eachComponentData)(componentWithChildren.components, data, fn, (0, index_1.componentFormPath)(componentWithChildren, path, componentWithChildren.path), index, component);\n }\n return true;\n }\n return false;\n }, true, path, parent);\n};\nexports.eachComponentData = eachComponentData;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/formUtil/eachComponentData.js?");
|
1372
1372
|
|
1373
1373
|
/***/ }),
|
1374
1374
|
|
@@ -1379,7 +1379,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1379
1379
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1380
1380
|
|
1381
1381
|
"use strict";
|
1382
|
-
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.eachComponentDataAsync = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst index_1 = __webpack_require__(/*! ./index */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst eachComponentAsync_1 = __webpack_require__(/*! ./eachComponentAsync */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponentAsync.js\");\n// Async each component data.\nconst eachComponentDataAsync = (components_1, data_1, fn_1, ...args_1) => __awaiter(void 0, [components_1, data_1, fn_1, ...args_1], void 0, function* (components, data, fn, path = '', index, parent, includeAll = false) {\n if (!components
|
1382
|
+
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.eachComponentDataAsync = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst index_1 = __webpack_require__(/*! ./index */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst eachComponentAsync_1 = __webpack_require__(/*! ./eachComponentAsync */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponentAsync.js\");\n// Async each component data.\nconst eachComponentDataAsync = (components_1, data_1, fn_1, ...args_1) => __awaiter(void 0, [components_1, data_1, fn_1, ...args_1], void 0, function* (components, data, fn, path = '', index, parent, includeAll = false) {\n if (!components) {\n return;\n }\n return yield (0, eachComponentAsync_1.eachComponentAsync)(components, (component, compPath, componentComponents, compParent) => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n const row = (0, index_1.getContextualRowData)(component, compPath, data);\n if ((yield fn(component, data, row, compPath, componentComponents, index, compParent)) === true) {\n return true;\n }\n if ((0, index_1.isComponentNestedDataType)(component)) {\n const value = (0, lodash_1.get)(data, compPath, data);\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const nestedComponentPath = (0, index_1.getModelType)(component) === 'nestedDataArray'\n ? `${compPath}[${i}].data`\n : `${compPath}[${i}]`;\n yield (0, exports.eachComponentDataAsync)(component.components, data, fn, nestedComponentPath, i, component, includeAll);\n }\n return true;\n }\n else if ((0, lodash_1.isEmpty)(row) && !includeAll) {\n // Tree components may submit empty objects; since we've already evaluated the parent tree/layout component, we won't worry about constituent elements\n return true;\n }\n if ((0, index_1.getModelType)(component) === 'dataObject') {\n const nestedFormValue = (0, lodash_1.get)(data, component.path);\n const noReferenceAttached = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id)\n ? (0, lodash_1.isEmpty)(nestedFormValue.data) && !(0, lodash_1.has)(nestedFormValue, 'form')\n : false;\n const shouldBeCleared = (!component.hasOwnProperty('clearOnHide') || component.clearOnHide) &&\n (component.hidden || ((_a = component.ephermalState) === null || _a === void 0 ? void 0 : _a.conditionallyHidden));\n // Skip all the nested components processing if nested form is hidden and should be cleared on hide or if submission is saved as reference and not loaded\n const shouldSkipProcessingNestedFormData = noReferenceAttached || shouldBeCleared;\n if (!shouldSkipProcessingNestedFormData) {\n // For nested forms, we need to reset the \"data\" and \"path\" objects for all of the children components, and then re-establish the data when it is done.\n const childPath = (0, index_1.componentDataPath)(component, path, compPath);\n const childData = (0, lodash_1.get)(data, childPath, null);\n yield (0, exports.eachComponentDataAsync)(component.components, childData, fn, '', index, component, includeAll);\n (0, lodash_1.set)(data, childPath, childData);\n }\n }\n else {\n yield (0, exports.eachComponentDataAsync)(component.components, data, fn, (0, index_1.componentDataPath)(component, path, compPath), index, component, includeAll);\n }\n return true;\n }\n else if ((0, index_1.getModelType)(component) === 'none') {\n const info = (0, index_1.componentInfo)(component);\n if (info.hasColumns) {\n const columnsComponent = component;\n for (const column of columnsComponent.columns) {\n yield (0, exports.eachComponentDataAsync)(column.components, data, fn, path, index, component);\n }\n }\n else if (info.hasRows) {\n const rowsComponent = component;\n for (const rowArray of rowsComponent.rows) {\n if (Array.isArray(rowArray)) {\n for (const row of rowArray) {\n yield (0, exports.eachComponentDataAsync)(row.components, data, fn, path, index, component);\n }\n }\n }\n }\n else if (info.hasComps) {\n const componentWithChildren = component;\n yield (0, exports.eachComponentDataAsync)(componentWithChildren.components, data, fn, (0, index_1.componentFormPath)(componentWithChildren, path, componentWithChildren.path), index, component);\n }\n return true;\n }\n return false;\n }), true, path, parent);\n});\nexports.eachComponentDataAsync = eachComponentDataAsync;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/formUtil/eachComponentDataAsync.js?");
|
1383
1383
|
|
1384
1384
|
/***/ }),
|
1385
1385
|
|