@formio/js 5.0.0-rc.75 → 5.0.0-rc.77
Sign up to get free protection for your applications and to get access to all the features.
- 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 +19 -19
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +21 -21
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +4 -4
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/PDFBuilder.js +2 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +43 -25
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +6 -0
- package/lib/cjs/components/address/Address.d.ts +6 -0
- package/lib/cjs/components/address/Address.js +7 -1
- package/lib/cjs/components/datagrid/DataGrid.js +1 -0
- package/lib/cjs/components/datagrid/fixtures/comp11.d.ts +50 -0
- package/lib/cjs/components/datagrid/fixtures/comp11.js +55 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +5 -1
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/day/Day.js +28 -7
- package/lib/cjs/components/editgrid/EditGrid.js +1 -0
- package/lib/cjs/components/file/File.d.ts +1 -1
- package/lib/cjs/components/file/File.js +3 -1
- package/lib/cjs/components/file/editForm/File.edit.display.js +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +2 -18
- package/lib/cjs/components/radio/Radio.js +12 -21
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +6 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.js +6 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +0 -22
- package/lib/cjs/components/selectboxes/SelectBoxes.js +12 -9
- package/lib/cjs/components/tags/Tags.js +3 -3
- package/lib/cjs/components/time/Time.js +0 -5
- package/lib/mjs/PDFBuilder.js +1 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +43 -25
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +6 -0
- package/lib/mjs/components/address/Address.d.ts +6 -0
- package/lib/mjs/components/address/Address.js +10 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -0
- package/lib/mjs/components/datagrid/fixtures/comp11.d.ts +50 -0
- package/lib/mjs/components/datagrid/fixtures/comp11.js +53 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/day/Day.js +27 -7
- package/lib/mjs/components/editgrid/EditGrid.js +1 -0
- package/lib/mjs/components/file/File.d.ts +1 -1
- package/lib/mjs/components/file/File.js +3 -1
- package/lib/mjs/components/file/editForm/File.edit.display.js +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +2 -18
- package/lib/mjs/components/radio/Radio.js +15 -24
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +6 -0
- package/lib/mjs/components/recaptcha/ReCaptcha.js +9 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +0 -22
- package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -9
- package/lib/mjs/components/tags/Tags.js +3 -3
- package/lib/mjs/components/time/Time.js +0 -11
- package/package.json +2 -2
package/dist/formio.utils.js
CHANGED
@@ -125,7 +125,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
125
125
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
126
126
|
|
127
127
|
"use strict";
|
128
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.clearHiddenProcessInfo = exports.clearHiddenProcess = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst isParentHidden_1 = __webpack_require__(/*! ../utils/isParentHidden */ \"./node_modules/@formio/core/lib/utils/isParentHidden.js\");\n/**\n * This processor function checks components for the `hidden` property and unsets corresponding data\n */\nconst clearHiddenProcess = (context) => {\n var _a;\n const { component, data, path, value, scope } = context;\n // No need to unset the value if it's undefined\n if (value === undefined) {\n return;\n }\n if (!scope.clearHidden) {\n scope.clearHidden = {};\n }\n // Check if there's a conditional set for the component and if it's marked as conditionally hidden\n const isConditionallyHidden = (_a = scope.conditionals) === null || _a === void 0 ? void 0 : _a.find((cond) => {\n return path
|
128
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.clearHiddenProcessInfo = exports.clearHiddenProcess = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst isParentHidden_1 = __webpack_require__(/*! ../utils/isParentHidden */ \"./node_modules/@formio/core/lib/utils/isParentHidden.js\");\n/**\n * This processor function checks components for the `hidden` property and unsets corresponding data\n */\nconst clearHiddenProcess = (context) => {\n var _a;\n const { component, data, path, value, scope } = context;\n // No need to unset the value if it's undefined\n if (value === undefined) {\n return;\n }\n if (!scope.clearHidden) {\n scope.clearHidden = {};\n }\n // Check if there's a conditional set for the component and if it's marked as conditionally hidden\n const isConditionallyHidden = (_a = scope.conditionals) === null || _a === void 0 ? void 0 : _a.find((cond) => {\n return path === cond.path && cond.conditionallyHidden;\n });\n const shouldClearValueWhenHidden = !component.hasOwnProperty('clearOnHide') || component.clearOnHide;\n if (shouldClearValueWhenHidden && (isConditionallyHidden || (0, isParentHidden_1.isParentHidden)(component))) {\n (0, lodash_1.unset)(data, path);\n scope.clearHidden[path] = true;\n }\n};\nexports.clearHiddenProcess = clearHiddenProcess;\nexports.clearHiddenProcessInfo = {\n name: 'clearHidden',\n shouldProcess: () => true,\n processSync: exports.clearHiddenProcess,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/clearHidden.js?");
|
129
129
|
|
130
130
|
/***/ }),
|
131
131
|
|
@@ -136,7 +136,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
136
136
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
137
137
|
|
138
138
|
"use strict";
|
139
|
-
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.conditionProcessInfo = exports.simpleConditionProcessInfo = exports.customConditionProcessInfo = exports.conditionProcessSync = exports.conditionProcess = exports.simpleConditionProcessSync = exports.simpleConditionProcess = exports.customConditionProcessSync = exports.customConditionProcess = exports.conditionalProcess = exports.isConditionallyHidden = exports.isSimpleConditionallyHidden = exports.isCustomConditionallyHidden = exports.hasConditions = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst conditions_1 = __webpack_require__(/*! ../../utils/conditions */ \"./node_modules/@formio/core/lib/utils/conditions.js\");\nconst hasCustomConditions = (context) => {\n const { component } = context;\n return !!component.customConditional;\n};\nconst hasSimpleConditions = (context) => {\n const { component } = context;\n const { conditional } = component;\n if ((0, conditions_1.isLegacyConditional)(conditional) ||\n (0, conditions_1.isSimpleConditional)(conditional) ||\n (0, conditions_1.isJSONConditional)(conditional)) {\n return true;\n }\n return false;\n};\nconst hasConditions = (context) => {\n return hasSimpleConditions(context) || hasCustomConditions(context);\n};\nexports.hasConditions = hasConditions;\nconst isCustomConditionallyHidden = (context) => {\n if (!hasCustomConditions(context)) {\n return false;\n }\n const { component } = context;\n const { customConditional } = component;\n let show = null;\n if (customConditional) {\n show = (0, conditions_1.checkCustomConditional)(customConditional, context, 'show');\n }\n if (show === null) {\n return false;\n }\n return !show;\n};\nexports.isCustomConditionallyHidden = isCustomConditionallyHidden;\nconst isSimpleConditionallyHidden = (context) => {\n if (!hasSimpleConditions(context)) {\n return false;\n }\n const { component } = context;\n const { conditional } = component;\n let show = null;\n if ((0, conditions_1.isJSONConditional)(conditional)) {\n show = (0, conditions_1.checkJsonConditional)(conditional, context);\n }\n if ((0, conditions_1.isLegacyConditional)(conditional)) {\n show = (0, conditions_1.checkLegacyConditional)(conditional, context);\n }\n if ((0, conditions_1.isSimpleConditional)(conditional)) {\n show = (0, conditions_1.checkSimpleConditional)(conditional, context);\n }\n if (show === null || show === undefined) {\n return false;\n }\n return !show;\n};\nexports.isSimpleConditionallyHidden = isSimpleConditionallyHidden;\nconst isConditionallyHidden = (context) => {\n return (0, exports.isCustomConditionallyHidden)(context) || (0, exports.isSimpleConditionallyHidden)(context);\n};\nexports.isConditionallyHidden = isConditionallyHidden;\nconst conditionalProcess = (context, isHidden) => {\n const { component,
|
139
|
+
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.conditionProcessInfo = exports.simpleConditionProcessInfo = exports.customConditionProcessInfo = exports.conditionProcessSync = exports.conditionProcess = exports.simpleConditionProcessSync = exports.simpleConditionProcess = exports.customConditionProcessSync = exports.customConditionProcess = exports.conditionalProcess = exports.isConditionallyHidden = exports.isSimpleConditionallyHidden = exports.isCustomConditionallyHidden = exports.hasConditions = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst conditions_1 = __webpack_require__(/*! ../../utils/conditions */ \"./node_modules/@formio/core/lib/utils/conditions.js\");\nconst hasCustomConditions = (context) => {\n const { component } = context;\n return !!component.customConditional;\n};\nconst hasSimpleConditions = (context) => {\n const { component } = context;\n const { conditional } = component;\n if ((0, conditions_1.isLegacyConditional)(conditional) ||\n (0, conditions_1.isSimpleConditional)(conditional) ||\n (0, conditions_1.isJSONConditional)(conditional)) {\n return true;\n }\n return false;\n};\nconst hasConditions = (context) => {\n return hasSimpleConditions(context) || hasCustomConditions(context);\n};\nexports.hasConditions = hasConditions;\nconst isCustomConditionallyHidden = (context) => {\n if (!hasCustomConditions(context)) {\n return false;\n }\n const { component } = context;\n const { customConditional } = component;\n let show = null;\n if (customConditional) {\n show = (0, conditions_1.checkCustomConditional)(customConditional, context, 'show');\n }\n if (show === null) {\n return false;\n }\n return !show;\n};\nexports.isCustomConditionallyHidden = isCustomConditionallyHidden;\nconst isSimpleConditionallyHidden = (context) => {\n if (!hasSimpleConditions(context)) {\n return false;\n }\n const { component } = context;\n const { conditional } = component;\n let show = null;\n if ((0, conditions_1.isJSONConditional)(conditional)) {\n show = (0, conditions_1.checkJsonConditional)(conditional, context);\n }\n if ((0, conditions_1.isLegacyConditional)(conditional)) {\n show = (0, conditions_1.checkLegacyConditional)(conditional, context);\n }\n if ((0, conditions_1.isSimpleConditional)(conditional)) {\n show = (0, conditions_1.checkSimpleConditional)(conditional, context);\n }\n if (show === null || show === undefined) {\n return false;\n }\n return !show;\n};\nexports.isSimpleConditionallyHidden = isSimpleConditionallyHidden;\nconst isConditionallyHidden = (context) => {\n return (0, exports.isCustomConditionallyHidden)(context) || (0, exports.isSimpleConditionallyHidden)(context);\n};\nexports.isConditionallyHidden = isConditionallyHidden;\nconst conditionalProcess = (context, isHidden) => {\n const { component, scope, path } = context;\n if (!(0, exports.hasConditions)(context)) {\n return;\n }\n if (!scope.conditionals) {\n scope.conditionals = [];\n }\n let conditionalComp = scope.conditionals.find((cond) => (cond.path === path));\n if (!conditionalComp) {\n conditionalComp = { path, conditionallyHidden: false };\n scope.conditionals.push(conditionalComp);\n }\n conditionalComp.conditionallyHidden = conditionalComp.conditionallyHidden || isHidden(context);\n if (conditionalComp.conditionallyHidden) {\n (0, lodash_1.set)(component, 'hidden', true);\n }\n};\nexports.conditionalProcess = conditionalProcess;\nconst customConditionProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.customConditionProcessSync)(context);\n});\nexports.customConditionProcess = customConditionProcess;\nconst customConditionProcessSync = (context) => {\n return (0, exports.conditionalProcess)(context, exports.isCustomConditionallyHidden);\n};\nexports.customConditionProcessSync = customConditionProcessSync;\nconst simpleConditionProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.simpleConditionProcessSync)(context);\n});\nexports.simpleConditionProcess = simpleConditionProcess;\nconst simpleConditionProcessSync = (context) => {\n return (0, exports.conditionalProcess)(context, exports.isSimpleConditionallyHidden);\n};\nexports.simpleConditionProcessSync = simpleConditionProcessSync;\nconst conditionProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.conditionProcessSync)(context);\n});\nexports.conditionProcess = conditionProcess;\nconst conditionProcessSync = (context) => {\n return (0, exports.conditionalProcess)(context, exports.isConditionallyHidden);\n};\nexports.conditionProcessSync = conditionProcessSync;\nexports.customConditionProcessInfo = {\n name: 'customConditions',\n process: exports.customConditionProcess,\n processSync: exports.customConditionProcessSync,\n shouldProcess: hasCustomConditions,\n};\nexports.simpleConditionProcessInfo = {\n name: 'simpleConditions',\n process: exports.simpleConditionProcess,\n processSync: exports.simpleConditionProcessSync,\n shouldProcess: hasSimpleConditions,\n};\nexports.conditionProcessInfo = {\n name: 'conditions',\n process: exports.conditionProcess,\n processSync: exports.conditionProcessSync,\n shouldProcess: hasSimpleConditions,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/conditions/index.js?");
|
140
140
|
|
141
141
|
/***/ }),
|
142
142
|
|
@@ -191,7 +191,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
191
191
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
192
192
|
|
193
193
|
"use strict";
|
194
|
-
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.hiddenChildrenProcessorInfo = exports.hiddenChildrenProcessorAsync = exports.hiddenChildrenProcessor = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\n/**\n * This processor function checks components for the `hidden` property and, if children are present, sets them to hidden as well.\n */\nconst hiddenChildrenProcessor = (context) => {\n var _a;\n const { component, path, row, scope } = context;\n // Check if there's a conditional set for the component and if it's marked as conditionally hidden\n const isConditionallyHidden = (_a = scope.conditionals) === null || _a === void 0 ? void 0 : _a.find((cond) => {\n return path
|
194
|
+
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.hiddenChildrenProcessorInfo = exports.hiddenChildrenProcessorAsync = exports.hiddenChildrenProcessor = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil.js\");\n/**\n * This processor function checks components for the `hidden` property and, if children are present, sets them to hidden as well.\n */\nconst hiddenChildrenProcessor = (context) => {\n var _a;\n const { component, path, row, scope } = context;\n // Check if there's a conditional set for the component and if it's marked as conditionally hidden\n const isConditionallyHidden = (_a = scope.conditionals) === null || _a === void 0 ? void 0 : _a.find((cond) => {\n return path === cond.path && cond.conditionallyHidden;\n });\n if (component.hidden && isConditionallyHidden) {\n const info = (0, formUtil_1.componentInfo)(component);\n if (info.hasColumns || info.hasComps || info.hasRows) {\n // If this is a container component, we need to make the mutation to all the child components as well.\n (0, formUtil_1.eachComponentData)([component], row, (comp, data, compRow, compPath) => {\n var _a;\n if (comp !== component) {\n // the path set here is not the absolute path, but the path relative to the parent component\n (_a = scope.conditionals) === null || _a === void 0 ? void 0 : _a.push({ path: (0, formUtil_1.getComponentPath)(comp, compPath), conditionallyHidden: true });\n (0, lodash_1.set)(comp, 'hidden', true);\n }\n });\n }\n }\n else if (component.hidden) {\n const info = (0, formUtil_1.componentInfo)(component);\n if (info.hasColumns || info.hasComps || info.hasRows) {\n // If this is a container component, we need to make the mutation to all the child components as well.\n (0, formUtil_1.eachComponentData)([component], row, (comp, data, compRow, compPath) => {\n if (comp !== component) {\n (0, lodash_1.set)(comp, 'hidden', true);\n }\n });\n }\n }\n};\nexports.hiddenChildrenProcessor = hiddenChildrenProcessor;\nconst hiddenChildrenProcessorAsync = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.hiddenChildrenProcessor)(context);\n});\nexports.hiddenChildrenProcessorAsync = hiddenChildrenProcessorAsync;\nexports.hiddenChildrenProcessorInfo = {\n name: 'hiddenChildren',\n shouldProcess: () => true,\n processSync: exports.hiddenChildrenProcessor,\n process: exports.hiddenChildrenProcessorAsync,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/hiddenChildren.js?");
|
195
195
|
|
196
196
|
/***/ }),
|
197
197
|
|
@@ -389,7 +389,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
389
389
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
390
390
|
|
391
391
|
"use strict";
|
392
|
-
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.validateDayInfo = exports.validateDaySync = exports.validateDay = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isLeapYear = (year) => {\n // Year is leap if it is evenly divisible by 400 or evenly divisible by 4 and not evenly divisible by 100.\n return !(year % 400) || (!!(year % 100) && !(year % 4));\n};\nconst getDaysInMonthCount = (month, year) => {\n switch (month) {\n case 1: // January\n case 3: // March\n case 5: // May\n case 7: // July\n case 8: // August\n case 10: // October\n case 12: // December\n return 31;\n case 4: // April\n case 6: // June\n case 9: // September\n case 11: // November\n return 30;\n case 2: // February\n return isLeapYear(year) ? 29 : 28;\n default:\n return 31;\n }\n};\nconst isDayComponent = (component) => {\n return component && component.type === 'day';\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!value) {\n return false;\n }\n if (!isDayComponent(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateDay = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateDaySync)(context);\n});\nexports.validateDay = validateDay;\nconst validateDaySync = (context) => {\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const error = new error_1.FieldError('invalidDay', context, 'day');\n if (typeof value !== 'string') {\n return error;\n }\n
|
392
|
+
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.validateDayInfo = exports.validateDaySync = exports.validateDay = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isLeapYear = (year) => {\n // Year is leap if it is evenly divisible by 400 or evenly divisible by 4 and not evenly divisible by 100.\n return !(year % 400) || (!!(year % 100) && !(year % 4));\n};\nconst getDaysInMonthCount = (month, year) => {\n switch (month) {\n case 1: // January\n case 3: // March\n case 5: // May\n case 7: // July\n case 8: // August\n case 10: // October\n case 12: // December\n return 31;\n case 4: // April\n case 6: // June\n case 9: // September\n case 11: // November\n return 30;\n case 2: // February\n return isLeapYear(year) ? 29 : 28;\n default:\n return 31;\n }\n};\nconst isDayComponent = (component) => {\n return component && component.type === 'day';\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!value) {\n return false;\n }\n if (!isDayComponent(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateDay = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateDaySync)(context);\n});\nexports.validateDay = validateDay;\nconst validateDaySync = (context) => {\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context) || !isDayComponent(component)) {\n return null;\n }\n const error = new error_1.FieldError('invalidDay', context, 'day');\n if (typeof value !== 'string') {\n return error;\n }\n let [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n const values = value.split('/').map((x) => parseInt(x, 10));\n let day = values[DAY];\n let month = values[MONTH];\n let year = values[YEAR];\n if (values.length !== 3) {\n if (component.fields.day.hide) {\n MONTH = MONTH === 0 ? 0 : MONTH - 1;\n YEAR = YEAR - 1;\n day = 0;\n month = values[MONTH];\n year = values[YEAR];\n }\n ;\n if (component.fields.month.hide) {\n DAY = DAY === 0 ? 0 : DAY - 1;\n YEAR = YEAR - 1;\n day = values[DAY];\n month = 0;\n year = values[YEAR];\n }\n ;\n if (component.fields.year.hide) {\n day = values[DAY];\n month = values[MONTH];\n year = 0;\n }\n ;\n }\n const maxDay = getDaysInMonthCount(month, year);\n if (isNaN(day) || day < 0 || day > maxDay) {\n return error;\n }\n if (isNaN(month) || month < 0 || month > 12) {\n return error;\n }\n if (isNaN(year) || year < 0 || year > 9999) {\n return error;\n }\n return null;\n};\nexports.validateDaySync = validateDaySync;\nexports.validateDayInfo = {\n name: 'validateDay',\n process: exports.validateDay,\n processSync: exports.validateDaySync,\n shouldProcess: exports.shouldValidate\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateDay.js?");
|
393
393
|
|
394
394
|
/***/ }),
|
395
395
|
|