@formio/js 5.0.0-rc.93 → 5.0.0-rc.95
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 +96 -85
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +96 -85
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +203 -11
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +3 -1
- package/dist/formio.utils.js +77 -66
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +6 -8
- package/lib/cjs/components/editgrid/fixtures/comp20.d.ts +43 -0
- package/lib/cjs/components/editgrid/fixtures/comp20.js +44 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +3 -1
- package/lib/cjs/components/number/Number.js +7 -1
- package/lib/cjs/components/number/fixtures/index.js +1 -1
- package/lib/cjs/components/number/fixtures/scientificNotation.d.ts +14 -0
- package/lib/cjs/components/number/fixtures/scientificNotation.js +15 -0
- package/lib/cjs/components/select/Select.d.ts +1 -1
- package/lib/cjs/components/select/Select.js +12 -5
- package/lib/mjs/components/editgrid/EditGrid.js +6 -8
- package/lib/mjs/components/editgrid/fixtures/comp20.d.ts +43 -0
- package/lib/mjs/components/editgrid/fixtures/comp20.js +42 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +2 -1
- package/lib/mjs/components/number/Number.js +7 -1
- package/lib/mjs/components/number/fixtures/index.js +1 -1
- package/lib/mjs/components/number/fixtures/scientificNotation.d.ts +14 -0
- package/lib/mjs/components/number/fixtures/scientificNotation.js +13 -0
- package/lib/mjs/components/select/Select.d.ts +1 -1
- package/lib/mjs/components/select/Select.js +11 -4
- package/package.json +4 -4
package/dist/formio.utils.js
CHANGED
@@ -26,7 +26,7 @@ return /******/ (function() { // webpackBootstrap
|
|
26
26
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
27
27
|
|
28
28
|
"use strict";
|
29
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FieldError = void 0;\nconst util_1 = __webpack_require__(/*! ../process/validation/util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nclass FieldError {\n constructor(errorKeyOrMessage, context, ruleName = errorKeyOrMessage) {\n var _a;\n const { component, hasLabel = true, field = (0, util_1.getComponentErrorField)(component, context), level = 'error' } = context;\n this.ruleName = ruleName;\n if ((_a = context.component.validate) === null || _a === void 0 ? void 0 : _a.customMessage) {\n this.errorKeyOrMessage = context.component.validate.customMessage;\n this.context = Object.assign(Object.assign({}, context), { hasLabel: false, field, level });\n }\n else {\n this.errorKeyOrMessage = errorKeyOrMessage;\n this.context = Object.assign(Object.assign({}, context), { hasLabel, field });\n this.level = level;\n }\n }\n}\nexports.FieldError = FieldError;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/error/FieldError.js?");
|
29
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FieldError = void 0;\nconst util_1 = __webpack_require__(/*! ../process/validation/util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nclass FieldError {\n constructor(errorKeyOrMessage, context, ruleName = errorKeyOrMessage) {\n var _a;\n const { component, hasLabel = true, field = (0, util_1.getComponentErrorField)(component, context), level = 'error', } = context;\n this.ruleName = ruleName;\n if ((_a = context.component.validate) === null || _a === void 0 ? void 0 : _a.customMessage) {\n this.errorKeyOrMessage = context.component.validate.customMessage;\n this.context = Object.assign(Object.assign({}, context), { hasLabel: false, field, level });\n }\n else {\n this.errorKeyOrMessage = errorKeyOrMessage;\n this.context = Object.assign(Object.assign({}, context), { hasLabel, field });\n this.level = level;\n }\n }\n}\nexports.FieldError = FieldError;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/error/FieldError.js?");
|
30
30
|
|
31
31
|
/***/ }),
|
32
32
|
|
@@ -37,7 +37,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
37
37
|
/***/ (function(__unused_webpack_module, exports) {
|
38
38
|
|
39
39
|
"use strict";
|
40
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ProcessorError = void 0;\nclass ProcessorError extends Error {\n constructor(message, context, processor = 'unknown') {\n super(message);\n this.message = `${message}\\nin ${processor} at ${context.path}`;\n const { component, path, data, row } = context;\n this.context = { component, path, data, row };\n }\n}\nexports.ProcessorError = ProcessorError;\n
|
40
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ProcessorError = void 0;\nclass ProcessorError extends Error {\n constructor(message, context, processor = 'unknown') {\n super(message);\n this.message = `${message}\\nin ${processor} at ${context.path}`;\n const { component, path, data, row } = context;\n this.context = { component, path, data, row };\n }\n}\nexports.ProcessorError = ProcessorError;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/error/ProcessorError.js?");
|
41
41
|
|
42
42
|
/***/ }),
|
43
43
|
|
@@ -70,7 +70,7 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
|
|
70
70
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
71
71
|
|
72
72
|
"use strict";
|
73
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst jsonlogic_1 = __webpack_require__(/*! ./jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nexports[\"default\"] = [
|
73
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst jsonlogic_1 = __webpack_require__(/*! ./jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nexports[\"default\"] = [jsonlogic_1.JSONLogicModule];\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/modules/index.js?");
|
74
74
|
|
75
75
|
/***/ }),
|
76
76
|
|
@@ -81,7 +81,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\ncons
|
|
81
81
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
82
82
|
|
83
83
|
"use strict";
|
84
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.JSONLogicModule = exports.interpolate = exports.evaluate = exports.JSONLogicEvaluator = void 0;\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst jsonLogic_1 = __webpack_require__(/*! ./jsonLogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/jsonLogic.js\");\nclass JSONLogicEvaluator extends utils_1.BaseEvaluator {\n static evaluate(func, args = {}, ret = '', interpolate = false, context = {}, options = {}) {\n let returnVal = null;\n if (typeof func === 'object') {\n try {\n returnVal = jsonLogic_1.jsonLogic.apply(func, args);\n }\n catch (err) {\n returnVal = null;\n console.warn(`An error occured within JSON Logic`, err);\n }\n }\n else {\n returnVal = utils_1.BaseEvaluator.evaluate(func, args, ret, interpolate, context, options);\n }\n return returnVal;\n }\n}\nexports.JSONLogicEvaluator = JSONLogicEvaluator;\nfunction evaluate(context, evaluation, ret = 'result', evalContextFn, options = {}) {\n const { evalContext, instance } = context;\n const evalContextValue = evalContext ? evalContext(context) : context;\n if (evalContextFn) {\n evalContextFn(evalContextValue);\n }\n if (instance && instance.evaluate) {\n return instance.evaluate(evaluation, evalContextValue, ret, false, options);\n }\n return JSONLogicEvaluator.evaluate(evaluation, evalContextValue, ret, false, context, options);\n}\nexports.evaluate = evaluate;\nfunction interpolate(context, evaluation, evalContextFn) {\n const { evalContext, instance } = context;\n const evalContextValue = evalContext ? evalContext(context) : context;\n if (evalContextFn) {\n evalContextFn(evalContextValue);\n }\n if (instance && instance.evaluate) {\n return instance.interpolate(evaluation, evalContextValue, {\n noeval: true
|
84
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.JSONLogicModule = exports.interpolate = exports.evaluate = exports.JSONLogicEvaluator = void 0;\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst jsonLogic_1 = __webpack_require__(/*! ./jsonLogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/jsonLogic.js\");\nclass JSONLogicEvaluator extends utils_1.BaseEvaluator {\n static evaluate(func, args = {}, ret = '', interpolate = false, context = {}, options = {}) {\n let returnVal = null;\n if (typeof func === 'object') {\n try {\n returnVal = jsonLogic_1.jsonLogic.apply(func, args);\n }\n catch (err) {\n returnVal = null;\n console.warn(`An error occured within JSON Logic`, err);\n }\n }\n else {\n returnVal = utils_1.BaseEvaluator.evaluate(func, args, ret, interpolate, context, options);\n }\n return returnVal;\n }\n}\nexports.JSONLogicEvaluator = JSONLogicEvaluator;\nfunction evaluate(context, evaluation, ret = 'result', evalContextFn, options = {}) {\n const { evalContext, instance } = context;\n const evalContextValue = evalContext ? evalContext(context) : context;\n if (evalContextFn) {\n evalContextFn(evalContextValue);\n }\n if (instance && instance.evaluate) {\n return instance.evaluate(evaluation, evalContextValue, ret, false, options);\n }\n return JSONLogicEvaluator.evaluate(evaluation, evalContextValue, ret, false, context, options);\n}\nexports.evaluate = evaluate;\nfunction interpolate(context, evaluation, evalContextFn) {\n const { evalContext, instance } = context;\n const evalContextValue = evalContext ? evalContext(context) : context;\n if (evalContextFn) {\n evalContextFn(evalContextValue);\n }\n if (instance && instance.evaluate) {\n return instance.interpolate(evaluation, evalContextValue, {\n noeval: true,\n });\n }\n return JSONLogicEvaluator.interpolate(evaluation, evalContextValue, {\n noeval: true,\n });\n}\nexports.interpolate = interpolate;\n__exportStar(__webpack_require__(/*! ./jsonLogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/jsonLogic.js\"), exports);\nexports.JSONLogicModule = {\n evaluator: JSONLogicEvaluator,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/modules/jsonlogic/index.js?");
|
85
85
|
|
86
86
|
/***/ }),
|
87
87
|
|
@@ -92,7 +92,7 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
|
|
92
92
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
93
93
|
|
94
94
|
"use strict";
|
95
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.jsonLogic = void 0;\nconst json_logic_js_1 = __importDefault(__webpack_require__(/*! json-logic-js */ \"./node_modules/json-logic-js/logic.js\"));\nexports.jsonLogic = json_logic_js_1.default;\nconst date_1 = __webpack_require__(/*! ../../utils/date */ \"./node_modules/@formio/core/lib/utils/date.js\");\nconst operators_1 = __webpack_require__(/*! ./operators */ \"./node_modules/@formio/core/lib/modules/jsonlogic/operators.js\");\n// Configure JsonLogic\nfor (
|
95
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.jsonLogic = void 0;\nconst json_logic_js_1 = __importDefault(__webpack_require__(/*! json-logic-js */ \"./node_modules/json-logic-js/logic.js\"));\nexports.jsonLogic = json_logic_js_1.default;\nconst date_1 = __webpack_require__(/*! ../../utils/date */ \"./node_modules/@formio/core/lib/utils/date.js\");\nconst operators_1 = __webpack_require__(/*! ./operators */ \"./node_modules/@formio/core/lib/modules/jsonlogic/operators.js\");\n// Configure JsonLogic\nfor (const operator in operators_1._) {\n json_logic_js_1.default.add_operation(`_${operator}`, operators_1._[operator]);\n}\n// Retrieve Any Date\njson_logic_js_1.default.add_operation('getDate', (date) => {\n return (0, date_1.dayjs)(date).toISOString();\n});\n// Set Relative Minimum Date\njson_logic_js_1.default.add_operation('relativeMinDate', (relativeMinDate) => {\n return (0, date_1.dayjs)().subtract(relativeMinDate, 'days').toISOString();\n});\n// Set Relative Maximum Date\njson_logic_js_1.default.add_operation('relativeMaxDate', (relativeMaxDate) => {\n return (0, date_1.dayjs)().add(relativeMaxDate, 'days').toISOString();\n});\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/modules/jsonlogic/jsonLogic.js?");
|
96
96
|
|
97
97
|
/***/ }),
|
98
98
|
|
@@ -103,7 +103,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
103
103
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
104
104
|
|
105
105
|
"use strict";
|
106
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports._ = void 0;\n// Use only immutable useful functions from Lodash.\n// Visit https://lodash.com/docs for more info.\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nexports._ = {\n chunk: lodash_1.chunk,\n compact: lodash_1.compact,\n concat: lodash_1.concat,\n difference: lodash_1.difference,\n drop: lodash_1.drop,\n dropRight: lodash_1.dropRight,\n findIndex: lodash_1.findIndex,\n findLastIndex: lodash_1.findLastIndex,\n first: lodash_1.first,\n flatten: lodash_1.flatten,\n flattenDeep: lodash_1.flattenDeep,\n flattenDepth: lodash_1.flattenDepth,\n fromPairs: lodash_1.fromPairs,\n head: lodash_1.head,\n indexOf: lodash_1.indexOf,\n initial: lodash_1.initial,\n intersection: lodash_1.intersection,\n intersectionBy: lodash_1.intersectionBy,\n intersectionWith: lodash_1.intersectionWith,\n join: lodash_1.join,\n last: lodash_1.last,\n lastIndexOf: lodash_1.lastIndexOf,\n nth: lodash_1.nth,\n slice: lodash_1.slice,\n sortedIndex: lodash_1.sortedIndex,\n sortedIndexBy: lodash_1.sortedIndexBy,\n sortedIndexOf: lodash_1.sortedIndexOf,\n sortedLastIndex: lodash_1.sortedLastIndex,\n sortedLastIndexBy: lodash_1.sortedLastIndexBy,\n sortedLastIndexOf: lodash_1.sortedLastIndexOf,\n sortedUniq: lodash_1.sortedUniq,\n sortedUniqBy: lodash_1.sortedUniqBy,\n tail: lodash_1.tail,\n take: lodash_1.take,\n takeRight: lodash_1.takeRight,\n takeRightWhile: lodash_1.takeRightWhile,\n takeWhile: lodash_1.takeWhile,\n union: lodash_1.union,\n unionBy: lodash_1.unionBy,\n unionWith: lodash_1.unionWith,\n uniq: lodash_1.uniq,\n uniqBy: lodash_1.uniqBy,\n uniqWith: lodash_1.uniqWith,\n unzip: lodash_1.unzip,\n unzipWith: lodash_1.unzipWith,\n without: lodash_1.without,\n xor: lodash_1.xor,\n xorBy: lodash_1.xorBy,\n xorWith: lodash_1.xorWith,\n zip: lodash_1.zip,\n zipObject: lodash_1.zipObject,\n zipObjectDeep: lodash_1.zipObjectDeep,\n zipWith: lodash_1.zipWith,\n countBy: lodash_1.countBy,\n every: lodash_1.every,\n filter: lodash_1.filter,\n find: lodash_1.find,\n findLast: lodash_1.findLast,\n flatMap: lodash_1.flatMap,\n flatMapDeep: lodash_1.flatMapDeep,\n flatMapDepth: lodash_1.flatMapDepth,\n groupBy: lodash_1.groupBy,\n includes: lodash_1.includes,\n invokeMap: lodash_1.invokeMap,\n keyBy: lodash_1.keyBy,\n map: lodash_1.map,\n orderBy: lodash_1.orderBy,\n partition: lodash_1.partition,\n reduce: lodash_1.reduce,\n reduceRight: lodash_1.reduceRight,\n reject: lodash_1.reject,\n sample: lodash_1.sample,\n sampleSize: lodash_1.sampleSize,\n shuffle: lodash_1.shuffle,\n size: lodash_1.size,\n some: lodash_1.some,\n sortBy: lodash_1.sortBy,\n now: lodash_1.now,\n flip: lodash_1.flip,\n negate: lodash_1.negate,\n overArgs: lodash_1.overArgs,\n partial: lodash_1.partial,\n partialRight: lodash_1.partialRight,\n rearg: lodash_1.rearg,\n rest: lodash_1.rest,\n spread: lodash_1.spread,\n castArray: lodash_1.castArray,\n clone: lodash_1.clone,\n cloneDeepWith: lodash_1.cloneDeepWith,\n cloneDeep: lodash_1.cloneDeep,\n conformsTo: lodash_1.conformsTo,\n eq: lodash_1.eq,\n gt: lodash_1.gt,\n gte: lodash_1.gte,\n isArguments: lodash_1.isArguments,\n isArray: lodash_1.isArray,\n isArrayBuffer: lodash_1.isArrayBuffer,\n isArrayLike: lodash_1.isArrayLike,\n isArrayLikeObject: lodash_1.isArrayLikeObject,\n isBoolean: lodash_1.isBoolean,\n isBuffer: lodash_1.isBuffer,\n isDate: lodash_1.isDate,\n isElement: lodash_1.isElement,\n isEmpty: lodash_1.isEmpty,\n isEqual: lodash_1.isEqual,\n isEqualWith: lodash_1.isEqualWith,\n isError: lodash_1.isError,\n isFinite: lodash_1.isFinite,\n isFunction: lodash_1.isFunction,\n isInteger: lodash_1.isInteger,\n isLength: lodash_1.isLength,\n isMap: lodash_1.isMap,\n isMatch: lodash_1.isMatch,\n isMatchWith: lodash_1.isMatchWith,\n isNaN: lodash_1.isNaN,\n isNative: lodash_1.isNative,\n isNil: lodash_1.isNil,\n isNull: lodash_1.isNull,\n isNumber: lodash_1.isNumber,\n isObject: lodash_1.isObject,\n isObjectLike: lodash_1.isObjectLike,\n isPlainObject: lodash_1.isPlainObject,\n isRegExp: lodash_1.isRegExp,\n isSafeInteger: lodash_1.isSafeInteger,\n isSet: lodash_1.isSet,\n isString: lodash_1.isString,\n isSymbol: lodash_1.isSymbol,\n isTypedArray: lodash_1.isTypedArray,\n isUndefined: lodash_1.isUndefined,\n isWeakMap: lodash_1.isWeakMap,\n isWeakSet: lodash_1.isWeakSet,\n lt: lodash_1.lt,\n lte: lodash_1.lte,\n toArray: lodash_1.toArray,\n toFinite: lodash_1.toFinite,\n toInteger: lodash_1.toInteger,\n toLength: lodash_1.toLength,\n toNumber: lodash_1.toNumber,\n toPlainObject: lodash_1.toPlainObject,\n toSafeInteger: lodash_1.toSafeInteger,\n toString: lodash_1.toString,\n add: lodash_1.add,\n ceil: lodash_1.ceil,\n divide: lodash_1.divide,\n floor: lodash_1.floor,\n max: lodash_1.max,\n maxBy: lodash_1.maxBy,\n mean: lodash_1.mean,\n meanBy: lodash_1.meanBy,\n min: lodash_1.min,\n minBy: lodash_1.minBy,\n multiply: lodash_1.multiply,\n round: lodash_1.round,\n subtract: lodash_1.subtract,\n sum: lodash_1.sum,\n sumBy: lodash_1.sumBy,\n clamp: lodash_1.clamp,\n inRange: lodash_1.inRange,\n random: lodash_1.random,\n at: lodash_1.at,\n entries: lodash_1.entries,\n entriesIn: lodash_1.entriesIn,\n findKey: lodash_1.findKey,\n findLastKey: lodash_1.findLastKey,\n functions: lodash_1.functions,\n functionsIn: lodash_1.functionsIn,\n get: lodash_1.get,\n has: lodash_1.has,\n hasIn: lodash_1.hasIn,\n invert: lodash_1.invert,\n invertBy: lodash_1.invertBy,\n invoke: lodash_1.invoke,\n keys: lodash_1.keys,\n keysIn: lodash_1.keysIn,\n mapKeys: lodash_1.mapKeys,\n mapValues: lodash_1.mapValues,\n omit: lodash_1.omit,\n omitBy: lodash_1.omitBy,\n pick: lodash_1.pick,\n pickBy: lodash_1.pickBy,\n result: lodash_1.result,\n toPairs: lodash_1.toPairs,\n toPairsIn: lodash_1.toPairsIn,\n transform: lodash_1.transform,\n values: lodash_1.values,\n valuesIn: lodash_1.valuesIn,\n camelCase: lodash_1.camelCase,\n capitalize: lodash_1.capitalize,\n deburr: lodash_1.deburr,\n endsWith: lodash_1.endsWith,\n escape: lodash_1.escape,\n escapeRegExp: lodash_1.escapeRegExp,\n kebabCase: lodash_1.kebabCase,\n lowerCase: lodash_1.lowerCase,\n lowerFirst: lodash_1.lowerFirst,\n pad: lodash_1.pad,\n padEnd: lodash_1.padEnd,\n padStart: lodash_1.padStart,\n parseInt: lodash_1.parseInt,\n repeat: lodash_1.repeat,\n replace: lodash_1.replace,\n snakeCase: lodash_1.snakeCase,\n split: lodash_1.split,\n startCase: lodash_1.startCase,\n startsWith: lodash_1.startsWith,\n toLower: lodash_1.toLower,\n toUpper: lodash_1.toUpper,\n trim: lodash_1.trim,\n trimEnd: lodash_1.trimEnd,\n trimStart: lodash_1.trimStart,\n truncate: lodash_1.truncate,\n unescape: lodash_1.unescape,\n upperCase: lodash_1.upperCase,\n upperFirst: lodash_1.upperFirst,\n words: lodash_1.words,\n cond: lodash_1.cond,\n conforms: lodash_1.conforms,\n constant: lodash_1.constant,\n defaultTo: lodash_1.defaultTo,\n flow: lodash_1.flow,\n flowRight: lodash_1.flowRight,\n identity: lodash_1.identity,\n iteratee: lodash_1.iteratee,\n matches: lodash_1.matches,\n matchesProperty: lodash_1.matchesProperty,\n method: lodash_1.method,\n methodOf: lodash_1.methodOf,\n nthArg: lodash_1.nthArg,\n over: lodash_1.over,\n overEvery: lodash_1.overEvery,\n overSome: lodash_1.overSome,\n property: lodash_1.property,\n propertyOf: lodash_1.propertyOf,\n range: lodash_1.range,\n rangeRight: lodash_1.rangeRight,\n stubArray: lodash_1.stubArray,\n stubFalse: lodash_1.stubFalse,\n stubObject: lodash_1.stubObject,\n stubString: lodash_1.stubString,\n stubTrue: lodash_1.stubTrue,\n times: lodash_1.times,\n toPath: lodash_1.toPath,\n uniqueId: lodash_1.uniqueId
|
106
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports._ = void 0;\n// Use only immutable useful functions from Lodash.\n// Visit https://lodash.com/docs for more info.\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nexports._ = {\n chunk: lodash_1.chunk,\n compact: lodash_1.compact,\n concat: lodash_1.concat,\n difference: lodash_1.difference,\n drop: lodash_1.drop,\n dropRight: lodash_1.dropRight,\n findIndex: lodash_1.findIndex,\n findLastIndex: lodash_1.findLastIndex,\n first: lodash_1.first,\n flatten: lodash_1.flatten,\n flattenDeep: lodash_1.flattenDeep,\n flattenDepth: lodash_1.flattenDepth,\n fromPairs: lodash_1.fromPairs,\n head: lodash_1.head,\n indexOf: lodash_1.indexOf,\n initial: lodash_1.initial,\n intersection: lodash_1.intersection,\n intersectionBy: lodash_1.intersectionBy,\n intersectionWith: lodash_1.intersectionWith,\n join: lodash_1.join,\n last: lodash_1.last,\n lastIndexOf: lodash_1.lastIndexOf,\n nth: lodash_1.nth,\n slice: lodash_1.slice,\n sortedIndex: lodash_1.sortedIndex,\n sortedIndexBy: lodash_1.sortedIndexBy,\n sortedIndexOf: lodash_1.sortedIndexOf,\n sortedLastIndex: lodash_1.sortedLastIndex,\n sortedLastIndexBy: lodash_1.sortedLastIndexBy,\n sortedLastIndexOf: lodash_1.sortedLastIndexOf,\n sortedUniq: lodash_1.sortedUniq,\n sortedUniqBy: lodash_1.sortedUniqBy,\n tail: lodash_1.tail,\n take: lodash_1.take,\n takeRight: lodash_1.takeRight,\n takeRightWhile: lodash_1.takeRightWhile,\n takeWhile: lodash_1.takeWhile,\n union: lodash_1.union,\n unionBy: lodash_1.unionBy,\n unionWith: lodash_1.unionWith,\n uniq: lodash_1.uniq,\n uniqBy: lodash_1.uniqBy,\n uniqWith: lodash_1.uniqWith,\n unzip: lodash_1.unzip,\n unzipWith: lodash_1.unzipWith,\n without: lodash_1.without,\n xor: lodash_1.xor,\n xorBy: lodash_1.xorBy,\n xorWith: lodash_1.xorWith,\n zip: lodash_1.zip,\n zipObject: lodash_1.zipObject,\n zipObjectDeep: lodash_1.zipObjectDeep,\n zipWith: lodash_1.zipWith,\n countBy: lodash_1.countBy,\n every: lodash_1.every,\n filter: lodash_1.filter,\n find: lodash_1.find,\n findLast: lodash_1.findLast,\n flatMap: lodash_1.flatMap,\n flatMapDeep: lodash_1.flatMapDeep,\n flatMapDepth: lodash_1.flatMapDepth,\n groupBy: lodash_1.groupBy,\n includes: lodash_1.includes,\n invokeMap: lodash_1.invokeMap,\n keyBy: lodash_1.keyBy,\n map: lodash_1.map,\n orderBy: lodash_1.orderBy,\n partition: lodash_1.partition,\n reduce: lodash_1.reduce,\n reduceRight: lodash_1.reduceRight,\n reject: lodash_1.reject,\n sample: lodash_1.sample,\n sampleSize: lodash_1.sampleSize,\n shuffle: lodash_1.shuffle,\n size: lodash_1.size,\n some: lodash_1.some,\n sortBy: lodash_1.sortBy,\n now: lodash_1.now,\n flip: lodash_1.flip,\n negate: lodash_1.negate,\n overArgs: lodash_1.overArgs,\n partial: lodash_1.partial,\n partialRight: lodash_1.partialRight,\n rearg: lodash_1.rearg,\n rest: lodash_1.rest,\n spread: lodash_1.spread,\n castArray: lodash_1.castArray,\n clone: lodash_1.clone,\n cloneDeepWith: lodash_1.cloneDeepWith,\n cloneDeep: lodash_1.cloneDeep,\n conformsTo: lodash_1.conformsTo,\n eq: lodash_1.eq,\n gt: lodash_1.gt,\n gte: lodash_1.gte,\n isArguments: lodash_1.isArguments,\n isArray: lodash_1.isArray,\n isArrayBuffer: lodash_1.isArrayBuffer,\n isArrayLike: lodash_1.isArrayLike,\n isArrayLikeObject: lodash_1.isArrayLikeObject,\n isBoolean: lodash_1.isBoolean,\n isBuffer: lodash_1.isBuffer,\n isDate: lodash_1.isDate,\n isElement: lodash_1.isElement,\n isEmpty: lodash_1.isEmpty,\n isEqual: lodash_1.isEqual,\n isEqualWith: lodash_1.isEqualWith,\n isError: lodash_1.isError,\n isFinite: lodash_1.isFinite,\n isFunction: lodash_1.isFunction,\n isInteger: lodash_1.isInteger,\n isLength: lodash_1.isLength,\n isMap: lodash_1.isMap,\n isMatch: lodash_1.isMatch,\n isMatchWith: lodash_1.isMatchWith,\n isNaN: lodash_1.isNaN,\n isNative: lodash_1.isNative,\n isNil: lodash_1.isNil,\n isNull: lodash_1.isNull,\n isNumber: lodash_1.isNumber,\n isObject: lodash_1.isObject,\n isObjectLike: lodash_1.isObjectLike,\n isPlainObject: lodash_1.isPlainObject,\n isRegExp: lodash_1.isRegExp,\n isSafeInteger: lodash_1.isSafeInteger,\n isSet: lodash_1.isSet,\n isString: lodash_1.isString,\n isSymbol: lodash_1.isSymbol,\n isTypedArray: lodash_1.isTypedArray,\n isUndefined: lodash_1.isUndefined,\n isWeakMap: lodash_1.isWeakMap,\n isWeakSet: lodash_1.isWeakSet,\n lt: lodash_1.lt,\n lte: lodash_1.lte,\n toArray: lodash_1.toArray,\n toFinite: lodash_1.toFinite,\n toInteger: lodash_1.toInteger,\n toLength: lodash_1.toLength,\n toNumber: lodash_1.toNumber,\n toPlainObject: lodash_1.toPlainObject,\n toSafeInteger: lodash_1.toSafeInteger,\n toString: lodash_1.toString,\n add: lodash_1.add,\n ceil: lodash_1.ceil,\n divide: lodash_1.divide,\n floor: lodash_1.floor,\n max: lodash_1.max,\n maxBy: lodash_1.maxBy,\n mean: lodash_1.mean,\n meanBy: lodash_1.meanBy,\n min: lodash_1.min,\n minBy: lodash_1.minBy,\n multiply: lodash_1.multiply,\n round: lodash_1.round,\n subtract: lodash_1.subtract,\n sum: lodash_1.sum,\n sumBy: lodash_1.sumBy,\n clamp: lodash_1.clamp,\n inRange: lodash_1.inRange,\n random: lodash_1.random,\n at: lodash_1.at,\n entries: lodash_1.entries,\n entriesIn: lodash_1.entriesIn,\n findKey: lodash_1.findKey,\n findLastKey: lodash_1.findLastKey,\n functions: lodash_1.functions,\n functionsIn: lodash_1.functionsIn,\n get: lodash_1.get,\n has: lodash_1.has,\n hasIn: lodash_1.hasIn,\n invert: lodash_1.invert,\n invertBy: lodash_1.invertBy,\n invoke: lodash_1.invoke,\n keys: lodash_1.keys,\n keysIn: lodash_1.keysIn,\n mapKeys: lodash_1.mapKeys,\n mapValues: lodash_1.mapValues,\n omit: lodash_1.omit,\n omitBy: lodash_1.omitBy,\n pick: lodash_1.pick,\n pickBy: lodash_1.pickBy,\n result: lodash_1.result,\n toPairs: lodash_1.toPairs,\n toPairsIn: lodash_1.toPairsIn,\n transform: lodash_1.transform,\n values: lodash_1.values,\n valuesIn: lodash_1.valuesIn,\n camelCase: lodash_1.camelCase,\n capitalize: lodash_1.capitalize,\n deburr: lodash_1.deburr,\n endsWith: lodash_1.endsWith,\n escape: lodash_1.escape,\n escapeRegExp: lodash_1.escapeRegExp,\n kebabCase: lodash_1.kebabCase,\n lowerCase: lodash_1.lowerCase,\n lowerFirst: lodash_1.lowerFirst,\n pad: lodash_1.pad,\n padEnd: lodash_1.padEnd,\n padStart: lodash_1.padStart,\n parseInt: lodash_1.parseInt,\n repeat: lodash_1.repeat,\n replace: lodash_1.replace,\n snakeCase: lodash_1.snakeCase,\n split: lodash_1.split,\n startCase: lodash_1.startCase,\n startsWith: lodash_1.startsWith,\n toLower: lodash_1.toLower,\n toUpper: lodash_1.toUpper,\n trim: lodash_1.trim,\n trimEnd: lodash_1.trimEnd,\n trimStart: lodash_1.trimStart,\n truncate: lodash_1.truncate,\n unescape: lodash_1.unescape,\n upperCase: lodash_1.upperCase,\n upperFirst: lodash_1.upperFirst,\n words: lodash_1.words,\n cond: lodash_1.cond,\n conforms: lodash_1.conforms,\n constant: lodash_1.constant,\n defaultTo: lodash_1.defaultTo,\n flow: lodash_1.flow,\n flowRight: lodash_1.flowRight,\n identity: lodash_1.identity,\n iteratee: lodash_1.iteratee,\n matches: lodash_1.matches,\n matchesProperty: lodash_1.matchesProperty,\n method: lodash_1.method,\n methodOf: lodash_1.methodOf,\n nthArg: lodash_1.nthArg,\n over: lodash_1.over,\n overEvery: lodash_1.overEvery,\n overSome: lodash_1.overSome,\n property: lodash_1.property,\n propertyOf: lodash_1.propertyOf,\n range: lodash_1.range,\n rangeRight: lodash_1.rangeRight,\n stubArray: lodash_1.stubArray,\n stubFalse: lodash_1.stubFalse,\n stubObject: lodash_1.stubObject,\n stubString: lodash_1.stubString,\n stubTrue: lodash_1.stubTrue,\n times: lodash_1.times,\n toPath: lodash_1.toPath,\n uniqueId: lodash_1.uniqueId,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/modules/jsonlogic/operators.js?");
|
107
107
|
|
108
108
|
/***/ }),
|
109
109
|
|
@@ -114,7 +114,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
114
114
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
115
115
|
|
116
116
|
"use strict";
|
117
|
-
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.calculateProcessInfo = exports.calculateProcess = exports.calculateProcessSync = exports.shouldCalculate = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst shouldCalculate = (context) => {\n const { component, config } = context;\n if (!component.calculateValue
|
117
|
+
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.calculateProcessInfo = exports.calculateProcess = exports.calculateProcessSync = exports.shouldCalculate = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst shouldCalculate = (context) => {\n const { component, config } = context;\n if (!component.calculateValue || ((config === null || config === void 0 ? void 0 : config.server) && !component.calculateServer)) {\n return false;\n }\n return true;\n};\nexports.shouldCalculate = shouldCalculate;\nconst calculateProcessSync = (context) => {\n const { component, data, evalContext, scope, path, value } = context;\n if (!(0, exports.shouldCalculate)(context)) {\n return;\n }\n const evalContextValue = evalContext ? evalContext(context) : context;\n evalContextValue.value = value || null;\n if (!scope.calculated)\n scope.calculated = [];\n const newValue = jsonlogic_1.JSONLogicEvaluator.evaluate(component.calculateValue, evalContextValue, 'value');\n // Only set a new value if it is not \"null\" which would be the case if no calculation occurred.\n if (newValue !== null) {\n scope.calculated.push({\n path,\n value: newValue,\n });\n (0, lodash_1.set)(data, path, newValue);\n }\n return;\n};\nexports.calculateProcessSync = calculateProcessSync;\nconst calculateProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.calculateProcessSync)(context);\n});\nexports.calculateProcess = calculateProcess;\nexports.calculateProcessInfo = {\n name: 'calculate',\n process: exports.calculateProcess,\n processSync: exports.calculateProcessSync,\n shouldProcess: exports.shouldCalculate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/calculation/index.js?");
|
118
118
|
|
119
119
|
/***/ }),
|
120
120
|
|
@@ -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\");\n/**\n * This processor function checks components for the `hidden` property and unsets corresponding data\n */\nconst clearHiddenProcess = (context) => {\n var _a, _b;\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
|
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\");\n/**\n * This processor function checks components for the `hidden` property and unsets corresponding data\n */\nconst clearHiddenProcess = (context) => {\n var _a, _b;\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 &&\n (isConditionallyHidden || component.hidden || ((_b = component.ephermalState) === null || _b === void 0 ? void 0 : _b.conditionallyHidden))) {\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 utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.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 { 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) =>
|
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 utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.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 { 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 =\n conditionalComp.conditionallyHidden || isHidden(context) === true;\n if (conditionalComp.conditionallyHidden) {\n (0, utils_1.registerEphermalState)(context.component, 'conditionallyHidden', 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
|
|
@@ -147,7 +147,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
147
147
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
148
148
|
|
149
149
|
"use strict";
|
150
|
-
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.defaultValueProcessInfo = exports.serverDefaultValueProcessInfo = exports.customDefaultValueProcessInfo = exports.defaultValueProcessSync = exports.defaultValueProcess = exports.serverDefaultValueProcessSync = exports.serverDefaultValueProcess = exports.customDefaultValueProcessSync = exports.customDefaultValueProcess = exports.hasDefaultValue = exports.hasServerDefaultValue = exports.hasCustomDefaultValue = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\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/index.js\");\nconst hasCustomDefaultValue = (context) => {\n const { component } = context;\n if (!component.customDefaultValue) {\n return false;\n }\n return true;\n};\nexports.hasCustomDefaultValue = hasCustomDefaultValue;\nconst hasServerDefaultValue = (context) => {\n const { component } = context;\n if (!component.hasOwnProperty('defaultValue')) {\n return false;\n }\n return true;\n};\nexports.hasServerDefaultValue = hasServerDefaultValue;\nconst hasDefaultValue = (context) => {\n return (0, exports.hasCustomDefaultValue)(context) || (0, exports.hasServerDefaultValue)(context);\n};\nexports.hasDefaultValue = hasDefaultValue;\nconst customDefaultValueProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.customDefaultValueProcessSync)(context);\n});\nexports.customDefaultValueProcess = customDefaultValueProcess;\nconst customDefaultValueProcessSync = (context) => {\n const { component, row, data, scope, evalContext, path } = context;\n if (!(0, exports.hasCustomDefaultValue)(context)) {\n return;\n }\n if (!scope.defaultValues)\n scope.defaultValues = [];\n if ((0, lodash_1.has)(row, (0, formUtil_1.getComponentKey)(component))) {\n return;\n }\n let defaultValue = null;\n if (component.customDefaultValue) {\n const evalContextValue = evalContext ? evalContext(context) : context;\n evalContextValue.value = null;\n defaultValue = jsonlogic_1.JSONLogicEvaluator.evaluate(component.customDefaultValue, evalContextValue, 'value');\n if (component.multiple && !Array.isArray(defaultValue)) {\n defaultValue = defaultValue ? [defaultValue] : [];\n }\n scope.defaultValues.push({\n path,\n value: defaultValue
|
150
|
+
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.defaultValueProcessInfo = exports.serverDefaultValueProcessInfo = exports.customDefaultValueProcessInfo = exports.defaultValueProcessSync = exports.defaultValueProcess = exports.serverDefaultValueProcessSync = exports.serverDefaultValueProcess = exports.customDefaultValueProcessSync = exports.customDefaultValueProcess = exports.hasDefaultValue = exports.hasServerDefaultValue = exports.hasCustomDefaultValue = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\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/index.js\");\nconst hasCustomDefaultValue = (context) => {\n const { component } = context;\n if (!component.customDefaultValue) {\n return false;\n }\n return true;\n};\nexports.hasCustomDefaultValue = hasCustomDefaultValue;\nconst hasServerDefaultValue = (context) => {\n const { component } = context;\n if (!component.hasOwnProperty('defaultValue')) {\n return false;\n }\n return true;\n};\nexports.hasServerDefaultValue = hasServerDefaultValue;\nconst hasDefaultValue = (context) => {\n return (0, exports.hasCustomDefaultValue)(context) || (0, exports.hasServerDefaultValue)(context);\n};\nexports.hasDefaultValue = hasDefaultValue;\nconst customDefaultValueProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.customDefaultValueProcessSync)(context);\n});\nexports.customDefaultValueProcess = customDefaultValueProcess;\nconst customDefaultValueProcessSync = (context) => {\n const { component, row, data, scope, evalContext, path } = context;\n if (!(0, exports.hasCustomDefaultValue)(context)) {\n return;\n }\n if (!scope.defaultValues)\n scope.defaultValues = [];\n if ((0, lodash_1.has)(row, (0, formUtil_1.getComponentKey)(component))) {\n return;\n }\n let defaultValue = null;\n if (component.customDefaultValue) {\n const evalContextValue = evalContext ? evalContext(context) : context;\n evalContextValue.value = null;\n defaultValue = jsonlogic_1.JSONLogicEvaluator.evaluate(component.customDefaultValue, evalContextValue, 'value');\n if (component.multiple && !Array.isArray(defaultValue)) {\n defaultValue = defaultValue ? [defaultValue] : [];\n }\n scope.defaultValues.push({\n path,\n value: defaultValue,\n });\n }\n if (defaultValue !== null && defaultValue !== undefined) {\n (0, lodash_1.set)(data, path, defaultValue);\n }\n};\nexports.customDefaultValueProcessSync = customDefaultValueProcessSync;\nconst serverDefaultValueProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.serverDefaultValueProcessSync)(context);\n});\nexports.serverDefaultValueProcess = serverDefaultValueProcess;\nconst serverDefaultValueProcessSync = (context) => {\n const { component, row, data, scope, path } = context;\n if (!(0, exports.hasServerDefaultValue)(context)) {\n return;\n }\n if (!scope.defaultValues)\n scope.defaultValues = [];\n if ((0, lodash_1.has)(row, (0, formUtil_1.getComponentKey)(component))) {\n return;\n }\n let defaultValue = null;\n if (component.defaultValue !== undefined && component.defaultValue !== null) {\n defaultValue = component.defaultValue;\n if (component.multiple && !Array.isArray(defaultValue)) {\n defaultValue = defaultValue ? [defaultValue] : [];\n }\n scope.defaultValues.push({\n path,\n value: defaultValue,\n });\n }\n if (defaultValue !== null && defaultValue !== undefined) {\n (0, lodash_1.set)(data, path, defaultValue);\n }\n};\nexports.serverDefaultValueProcessSync = serverDefaultValueProcessSync;\nconst defaultValueProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.defaultValueProcessSync)(context);\n});\nexports.defaultValueProcess = defaultValueProcess;\nconst defaultValueProcessSync = (context) => {\n (0, exports.customDefaultValueProcessSync)(context);\n (0, exports.serverDefaultValueProcessSync)(context);\n};\nexports.defaultValueProcessSync = defaultValueProcessSync;\nexports.customDefaultValueProcessInfo = {\n name: 'customDefaultValue',\n process: exports.customDefaultValueProcess,\n processSync: exports.customDefaultValueProcessSync,\n shouldProcess: exports.hasCustomDefaultValue,\n};\nexports.serverDefaultValueProcessInfo = {\n name: 'serverDefaultValue',\n process: exports.serverDefaultValueProcess,\n processSync: exports.serverDefaultValueProcessSync,\n shouldProcess: exports.hasServerDefaultValue,\n};\nexports.defaultValueProcessInfo = {\n name: 'defaultValue',\n process: exports.defaultValueProcess,\n processSync: exports.defaultValueProcessSync,\n shouldProcess: exports.hasDefaultValue,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/defaultValue/index.js?");
|
151
151
|
|
152
152
|
/***/ }),
|
153
153
|
|
@@ -158,7 +158,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
158
158
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
159
159
|
|
160
160
|
"use strict";
|
161
|
-
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.dereferenceProcessInfo = exports.dereferenceProcess = void 0;\nconst error_1 = __webpack_require__(/*! ../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst isDereferenceableDataTableComponent = (component) => {\n var _a, _b, _c;\n return component
|
161
|
+
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.dereferenceProcessInfo = exports.dereferenceProcess = void 0;\nconst error_1 = __webpack_require__(/*! ../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst isDereferenceableDataTableComponent = (component) => {\n var _a, _b, _c;\n return (component &&\n component.type === 'datatable' &&\n ((_a = component.fetch) === null || _a === void 0 ? void 0 : _a.enableFetch) === true &&\n ((_b = component.fetch) === null || _b === void 0 ? void 0 : _b.dataSrc) === 'resource' &&\n typeof ((_c = component.fetch) === null || _c === void 0 ? void 0 : _c.resource) === 'string');\n};\n/**\n * This function is used to dereference reference IDs contained in the form.\n * It is currently only compatible with Data Table components.\n * @todo Add support for other components (if applicable) and for submission data dereferencing (e.g. save-as-reference, currently a property action).\n */\nconst dereferenceProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n const { component, config, scope, path } = context;\n if (!scope.dereference) {\n scope.dereference = {};\n }\n if (!isDereferenceableDataTableComponent(component)) {\n return;\n }\n if (!(config === null || config === void 0 ? void 0 : config.database)) {\n throw new error_1.ProcessorError('Cannot dereference resource value without a database config object', context, 'dereference');\n }\n try {\n const components = yield ((_a = config.database) === null || _a === void 0 ? void 0 : _a.dereferenceDataTableComponent(component));\n const vmCompatibleComponents = (0, utils_1.fastCloneDeep)(components);\n scope.dereference[path] = vmCompatibleComponents;\n // Modify the components in place; we have to do this now as opposed to a \"post-processor\" step because\n // eachComponentDataAsync will immediately turn around and introspect these components in the case of Data Table\n component.components = vmCompatibleComponents;\n }\n catch (err) {\n throw new error_1.ProcessorError(err.message || err, context, 'dereference');\n }\n});\nexports.dereferenceProcess = dereferenceProcess;\nexports.dereferenceProcessInfo = {\n name: 'dereference',\n shouldProcess: () => true,\n process: exports.dereferenceProcess,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/dereference/index.js?");
|
162
162
|
|
163
163
|
/***/ }),
|
164
164
|
|
@@ -169,7 +169,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
169
169
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
170
170
|
|
171
171
|
"use strict";
|
172
|
-
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.fetchProcessInfo = exports.fetchProcess = exports.shouldFetch = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst shouldFetch = (context) => {\n const { component, config } = context;\n if (component.type !== 'datasource' ||\n ((config === null || config === void 0 ? void 0 : config.server) && !(0, lodash_1.get)(component, 'trigger.server', false))) {\n return false;\n }\n return true;\n};\nexports.shouldFetch = shouldFetch;\nconst fetchProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n const { component, row, evalContext, path, scope, config } = context;\n let _fetch = null;\n try {\n _fetch = context.fetch ? context.fetch : fetch;\n }\n catch (
|
172
|
+
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.fetchProcessInfo = exports.fetchProcess = exports.shouldFetch = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst shouldFetch = (context) => {\n const { component, config } = context;\n if (component.type !== 'datasource' ||\n ((config === null || config === void 0 ? void 0 : config.server) && !(0, lodash_1.get)(component, 'trigger.server', false))) {\n return false;\n }\n return true;\n};\nexports.shouldFetch = shouldFetch;\nconst fetchProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n const { component, row, evalContext, path, scope, config } = context;\n let _fetch = null;\n try {\n _fetch = context.fetch ? context.fetch : fetch;\n }\n catch (ignoreErr) {\n _fetch = null;\n }\n if (!_fetch) {\n console.log('You must provide a fetch interface to the fetch processor.');\n return;\n }\n if (!(0, exports.shouldFetch)(context)) {\n return;\n }\n if (!scope.fetched)\n scope.fetched = {};\n const evalContextValue = evalContext ? evalContext(context) : context;\n const url = utils_1.Evaluator.interpolateString((0, lodash_1.get)(component, 'fetch.url', ''), evalContextValue);\n if (!url) {\n return;\n }\n const request = {\n method: (0, lodash_1.get)(component, 'fetch.method', 'get').toUpperCase(),\n headers: {},\n };\n if ((config === null || config === void 0 ? void 0 : config.headers) &&\n (component === null || component === void 0 ? void 0 : component.fetch) &&\n ((_a = component === null || component === void 0 ? void 0 : component.fetch) === null || _a === void 0 ? void 0 : _a.forwardHeaders)) {\n request.headers = JSON.parse(JSON.stringify(config.headers));\n delete request.headers['host'];\n delete request.headers['content-length'];\n delete request.headers['content-type'];\n delete request.headers['connection'];\n delete request.headers['cache-control'];\n }\n request.headers['Accept'] = '*/*';\n request.headers['user-agent'] = 'Form.io DataSource Component';\n (0, lodash_1.get)(component, 'fetch.headers', []).map((header) => {\n header.value = utils_1.Evaluator.interpolateString(header.value, evalContextValue);\n if (header.value && header.key) {\n request.headers[header.key] = header.value;\n }\n return header;\n });\n if ((0, lodash_1.get)(component, 'fetch.authenticate', false) && (config === null || config === void 0 ? void 0 : config.tokens)) {\n Object.assign(request.headers, config.tokens);\n }\n const body = (0, lodash_1.get)(component, 'fetch.specifyBody', '');\n if (request.method === 'POST') {\n request.body = JSON.stringify(utils_1.Evaluator.evaluate(body, evalContextValue, 'body'));\n }\n try {\n // Perform the fetch.\n const result = yield (yield _fetch(url, request)).json();\n const mapFunction = (0, lodash_1.get)(component, 'fetch.mapFunction');\n // Set the row data of the fetched value.\n const key = (0, formUtil_1.getComponentKey)(component);\n (0, lodash_1.set)(row, key, mapFunction\n ? utils_1.Evaluator.evaluate(mapFunction, Object.assign(Object.assign({}, evalContextValue), { responseData: result }), 'value')\n : result);\n // Make sure the value does not get filtered for now...\n if (!scope.filter)\n scope.filter = {};\n scope.filter[path] = true;\n scope.fetched[path] = true;\n }\n catch (err) {\n console.log(err.message);\n }\n});\nexports.fetchProcess = fetchProcess;\nexports.fetchProcessInfo = {\n name: 'fetch',\n process: exports.fetchProcess,\n shouldProcess: exports.shouldFetch,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/fetch/index.js?");
|
173
173
|
|
174
174
|
/***/ }),
|
175
175
|
|
@@ -180,7 +180,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
180
180
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
181
181
|
|
182
182
|
"use strict";
|
183
|
-
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.filterProcessInfo = exports.filterPostProcess = exports.filterProcess = exports.filterProcessSync = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst lodash_2 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst filterProcessSync = (context) => {\n const { scope, component } = context;\n
|
183
|
+
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.filterProcessInfo = exports.filterPostProcess = exports.filterProcess = exports.filterProcessSync = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst lodash_2 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst filterProcessSync = (context) => {\n const { scope, component } = context;\n const { value } = context;\n const absolutePath = (0, formUtil_1.getComponentAbsolutePath)(component);\n if (!scope.filter)\n scope.filter = {};\n if (value !== undefined) {\n const modelType = utils_1.Utils.getModelType(component);\n switch (modelType) {\n case 'dataObject':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: { data: {} },\n };\n break;\n case 'nestedArray':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: [],\n };\n break;\n case 'nestedDataArray':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: Array.isArray(value) ? value.map((v) => (Object.assign(Object.assign({}, v), { data: {} }))) : [],\n };\n break;\n case 'object':\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n value: component.type === 'address' ? false : {},\n };\n break;\n default:\n scope.filter[absolutePath] = {\n compModelType: modelType,\n include: true,\n };\n break;\n }\n }\n};\nexports.filterProcessSync = filterProcessSync;\nconst filterProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.filterProcessSync)(context);\n});\nexports.filterProcess = filterProcess;\nconst filterPostProcess = (context) => {\n var _a;\n const { scope, submission } = context;\n const filtered = {};\n for (const path in scope.filter) {\n if (scope.filter[path].include) {\n let value = (0, lodash_2.get)(submission === null || submission === void 0 ? void 0 : submission.data, path);\n if (scope.filter[path].value) {\n if ((0, lodash_2.isObject)(value) && ((_a = scope.filter[path].value) === null || _a === void 0 ? void 0 : _a.data)) {\n value = Object.assign(Object.assign({}, value), scope.filter[path].value);\n }\n else {\n value = scope.filter[path].value;\n }\n }\n (0, lodash_1.set)(filtered, path, value);\n }\n }\n context.data = filtered;\n};\nexports.filterPostProcess = filterPostProcess;\nexports.filterProcessInfo = {\n name: 'filter',\n process: exports.filterProcess,\n processSync: exports.filterProcessSync,\n postProcess: exports.filterPostProcess,\n shouldProcess: () => true,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/filter/index.js?");
|
184
184
|
|
185
185
|
/***/ }),
|
186
186
|
|
@@ -213,7 +213,7 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
|
|
213
213
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
214
214
|
|
215
215
|
"use strict";
|
216
|
-
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.logicProcessInfo = exports.logicProcess = exports.logicProcessSync = void 0;\nconst logic_1 = __webpack_require__(/*! ../../utils/logic */ \"./node_modules/@formio/core/lib/utils/logic.js\");\n// This processor ensures that a \"linked\" row context is provided to every component.\nconst logicProcessSync = (context) => {\n return (0, logic_1.applyActions)(context);\n};\nexports.logicProcessSync = logicProcessSync;\nconst logicProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.logicProcessSync)(context);\n});\nexports.logicProcess = logicProcess;\nexports.logicProcessInfo = {\n name: 'logic',\n process: exports.logicProcess,\n processSync: exports.logicProcessSync,\n shouldProcess: logic_1.hasLogic
|
216
|
+
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.logicProcessInfo = exports.logicProcess = exports.logicProcessSync = void 0;\nconst logic_1 = __webpack_require__(/*! ../../utils/logic */ \"./node_modules/@formio/core/lib/utils/logic.js\");\n// This processor ensures that a \"linked\" row context is provided to every component.\nconst logicProcessSync = (context) => {\n return (0, logic_1.applyActions)(context);\n};\nexports.logicProcessSync = logicProcessSync;\nconst logicProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.logicProcessSync)(context);\n});\nexports.logicProcess = logicProcess;\nexports.logicProcessInfo = {\n name: 'logic',\n process: exports.logicProcess,\n processSync: exports.logicProcessSync,\n shouldProcess: logic_1.hasLogic,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/logic/index.js?");
|
217
217
|
|
218
218
|
/***/ }),
|
219
219
|
|
@@ -224,7 +224,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
224
224
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
225
225
|
|
226
226
|
"use strict";
|
227
|
-
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.normalizeProcessInfo = exports.normalizeProcessSync = exports.normalizeProcess = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst dayjs_1 = __importDefault(__webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\"));\nconst customParseFormat_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/customParseFormat */ \"./node_modules/dayjs/plugin/customParseFormat.js\"));\ndayjs_1.default.extend(customParseFormat_1.default);\nconst isAddressComponent = (component) => component.type === \"address\";\nconst isDayComponent = (component) => component.type === \"day\";\nconst isEmailComponent = (component) => component.type === \"email\";\nconst isRadioComponent = (component) => component.type === \"radio\";\nconst isRecaptchaComponent = (component) => component.type === \"recaptcha\";\nconst isSelectComponent = (component) => component.type === \"select\";\nconst isSelectBoxesComponent = (component) => component.type === \"selectboxes\";\nconst isTagsComponent = (component) => component.type === \"tags\";\nconst isTextFieldComponent = (component) => component.type === \"textfield\";\nconst isTimeComponent = (component) => component.type === \"time\";\nconst isNumberComponent = (component) => component.type === \"number\";\nconst normalizeAddressComponentValue = (component, value) => {\n if (!component.multiple && Boolean(component.enableManualMode) && value && !value.mode) {\n return {\n mode: 'autocomplete',\n address: value,\n };\n }\n return value;\n};\nconst getLocaleDateFormatInfo = (locale = 'en') => {\n const formatInfo = {};\n const day = 21;\n const exampleDate = new Date(2017, 11, day);\n const localDateString = exampleDate.toLocaleDateString(locale);\n formatInfo.dayFirst = localDateString.slice(0, 2) === day.toString();\n return formatInfo;\n};\nconst getLocaleDayFirst = (component, form) => {\n var _a;\n if (component.useLocaleSettings) {\n return getLocaleDateFormatInfo((_a = form.options) === null || _a === void 0 ? void 0 : _a.language).dayFirst;\n }\n return component.dayFirst;\n};\nconst normalizeDayComponentValue = (component, form, value) => {\n // TODO: this is a quick and dirty port of the Day component's normalizeValue method, may need some updates\n const valueMask = /^\\d{2}\\/\\d{2}\\/\\d{4}$/;\n const isDayFirst = getLocaleDayFirst(component, form);\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 (!value || valueMask.test(value)) {\n return value;\n }\n let dateParts = [];\n const valueParts = value.split('/');\n const [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n const defaultValue = component.defaultValue ? component.defaultValue.split('/') : '';\n let defaultDay = '';\n let defaultMonth = '';\n let defaultYear = '';\n const getDayWithHiddenFields = (parts) => {\n let DAY, MONTH, YEAR;\n [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n if (!showDay) {\n MONTH = MONTH === 0 ? 0 : MONTH - 1;\n YEAR = YEAR - 1;\n DAY = null;\n }\n if (!showMonth) {\n if (!(0, lodash_1.isNull)(DAY)) {\n DAY = DAY === 0 ? 0 : DAY - 1;\n }\n YEAR = YEAR - 1;\n MONTH = null;\n }\n if (!showYear) {\n YEAR = null;\n }\n return {\n month: (0, lodash_1.isNull)(MONTH) ? '' : parts[MONTH],\n day: (0, lodash_1.isNull)(DAY) ? '' : parts[DAY],\n year: (0, lodash_1.isNull)(YEAR) ? '' : parts[YEAR],\n };\n };\n const getNextPart = (shouldTake, defaultValue) => {\n // Only push the part if it's not an empty string\n const part = shouldTake ? valueParts.shift() : defaultValue;\n if (part !== '') {\n dateParts.push(part);\n }\n };\n if (defaultValue) {\n const hasHiddenFields = defaultValue.length !== 3;\n defaultDay = hasHiddenFields ? getDayWithHiddenFields(defaultValue).day : defaultValue[DAY];\n defaultMonth = hasHiddenFields ? getDayWithHiddenFields(defaultValue).month : defaultValue[MONTH];\n defaultYear = hasHiddenFields ? getDayWithHiddenFields(defaultValue).year : defaultValue[YEAR];\n }\n if (isDayFirst) {\n getNextPart(showDay, defaultDay);\n }\n getNextPart(showMonth, defaultMonth);\n if (!isDayFirst) {\n getNextPart(showDay, defaultDay);\n }\n getNextPart(showYear, defaultYear);\n return dateParts.join('/');\n};\nconst normalizeRadioComponentValue = (value, dataType) => {\n switch (dataType) {\n case 'number':\n return +value;\n case 'string':\n return typeof value === 'object' ? JSON.stringify(value) : String(value);\n case 'boolean':\n return !(!value || value.toString() === 'false');\n }\n const isEquivalent = (0, lodash_1.toString)(value) === Number(value).toString();\n if (!isNaN(parseFloat(value)) && isFinite(value) && isEquivalent) {\n return +value;\n }\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n return value;\n};\nconst normalizeSingleSelectComponentValue = (component, value) => {\n if ((0, lodash_1.isNil)(value)) {\n return;\n }\n const valueIsObject = (0, lodash_1.isObject)(value);\n //check if value equals to default emptyValue\n if (valueIsObject && Object.keys(value).length === 0) {\n return value;\n }\n const dataType = component.dataType || 'auto';\n const normalize = {\n value,\n number() {\n const numberValue = Number(this.value);\n const isEquivalent = value.toString() === numberValue.toString();\n if (!Number.isNaN(numberValue) && Number.isFinite(numberValue) && value !== '' && isEquivalent) {\n this.value = numberValue;\n }\n return this;\n },\n boolean() {\n if ((0, lodash_1.isString)(this.value) && (this.value.toLowerCase() === 'true' || this.value.toLowerCase() === 'false')) {\n this.value = (this.value.toLowerCase() === 'true');\n }\n return this;\n },\n string() {\n this.value = String(this.value);\n return this;\n },\n object() {\n return this;\n },\n auto() {\n if ((0, lodash_1.isObject)(this.value)) {\n this.value = this.object().value;\n }\n else {\n this.value = this.string().number().boolean().value;\n }\n return this;\n }\n };\n try {\n return normalize[dataType]().value;\n }\n catch (err) {\n console.warn('Failed to normalize value', err);\n return value;\n }\n};\nconst normalizeSelectComponentValue = (component, value) => {\n if (component.multiple && Array.isArray(value)) {\n return value.map((singleValue) => normalizeSingleSelectComponentValue(component, singleValue));\n }\n return normalizeSingleSelectComponentValue(component, value);\n};\nconst normalizeSelectBoxesComponentValue = (value) => {\n if (!value) {\n value = {};\n }\n if (typeof value !== 'object') {\n if (typeof value === 'string') {\n return {\n [value]: true\n };\n }\n else {\n return {};\n }\n }\n if (Array.isArray(value)) {\n return value.reduce((acc, curr) => {\n return Object.assign(Object.assign({}, acc), { [curr]: true });\n }, {});\n }\n return value;\n};\nconst normalizeTagsComponentValue = (component, value) => {\n const delimiter = component.delimeter || ',';\n if ((!component.hasOwnProperty('storeas') || component.storeas === 'string') && Array.isArray(value)) {\n return value.join(delimiter);\n }\n else if (component.storeas === 'array' && typeof value === 'string') {\n return value.split(delimiter).filter(result => result);\n }\n return value;\n};\nconst normalizeMaskValue = (component, defaultValues, value, path) => {\n if (component.inputMasks && component.inputMasks.length > 0) {\n if (!value || typeof value !== 'object') {\n return {\n value: value,\n maskName: component.inputMasks[0].label\n };\n }\n if (!value.value) {\n const defaultValue = defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.find((defaultValue) => defaultValue.path === path);\n value.value = Array.isArray(defaultValue) && defaultValue.length > 0 ? defaultValue[0] : defaultValue;\n }\n }\n return value;\n};\nconst normalizeTextFieldComponentValue = (component, defaultValues, value, path) => {\n // If the component has truncate multiple spaces enabled, then normalize the value to remove extra spaces.\n if (component.truncateMultipleSpaces && typeof value === 'string') {\n value = value.trim().replace(/\\s{2,}/g, ' ');\n }\n if (component.allowMultipleMasks && component.inputMasks && component.inputMasks.length > 0) {\n if (Array.isArray(value)) {\n return value.map((val) => normalizeMaskValue(component, defaultValues, val, path));\n }\n else {\n return normalizeMaskValue(component, defaultValues, value, path);\n }\n }\n return value;\n};\n// Allow submissions of time components in their visual \"format\" property by coercing them to the \"dataFormat\" property\n// i.e. \"HH:mm\" -> \"HH:mm:ss\"\nconst normalizeTimeComponentValue = (component, value) => {\n const defaultDataFormat = 'HH:mm:ss';\n const defaultFormat = 'HH:mm';\n if ((0, dayjs_1.default)(value, component.format || defaultFormat, true).isValid()) {\n return (0, dayjs_1.default)(value, component.format || defaultFormat, true).format(component.dataFormat || defaultDataFormat);\n }\n return value;\n};\nconst normalizeSingleNumberComponentValue = (component, value) => {\n if (!isNaN(parseFloat(value)) && isFinite(value)) {\n return +value;\n }\n return value;\n};\nconst normalizeNumberComponentValue = (component, value) => {\n if (component.multiple && Array.isArray(value)) {\n return value.map((singleValue) => normalizeSingleNumberComponentValue(component, singleValue));\n }\n return normalizeSingleNumberComponentValue(component, value);\n};\nconst normalizeProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.normalizeProcessSync)(context);\n});\nexports.normalizeProcess = normalizeProcess;\nconst normalizeProcessSync = (context) => {\n const { component, form, scope, path, data, value } = context;\n if (!scope.normalize) {\n scope.normalize = {};\n }\n let { defaultValues } = scope;\n scope.normalize[path] = {\n type: component.type,\n normalized: false\n };\n // First check for component-type-specific transformations\n if (isAddressComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeAddressComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isDayComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeDayComponentValue(component, form, value));\n scope.normalize[path].normalized = true;\n }\n else if (isEmailComponent(component)) {\n if (value && typeof value === 'string') {\n (0, lodash_1.set)(data, path, value.toLowerCase());\n scope.normalize[path].normalized = true;\n }\n }\n else if (isRadioComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeRadioComponentValue(value, component.dataType));\n scope.normalize[path].normalized = true;\n }\n else if (isSelectComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeSelectComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isSelectBoxesComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeSelectBoxesComponentValue(value));\n scope.normalize[path].normalized = true;\n }\n else if (isTagsComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeTagsComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isTextFieldComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeTextFieldComponentValue(component, defaultValues, value, path));\n scope.normalize[path].normalized = true;\n }\n else if (isTimeComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeTimeComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isNumberComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeNumberComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n // Next perform component-type-agnostic transformations (i.e. super())\n if (component.multiple && !Array.isArray(value)) {\n (0, lodash_1.set)(data, path, value ? [value] : []);\n scope.normalize[path].normalized = true;\n }\n};\nexports.normalizeProcessSync = normalizeProcessSync;\nexports.normalizeProcessInfo = {\n name: 'normalize',\n shouldProcess: () => true,\n process: exports.normalizeProcess,\n processSync: exports.normalizeProcessSync\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/normalize/index.js?");
|
227
|
+
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.normalizeProcessInfo = exports.normalizeProcessSync = exports.normalizeProcess = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst dayjs_1 = __importDefault(__webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\"));\nconst customParseFormat_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/customParseFormat */ \"./node_modules/dayjs/plugin/customParseFormat.js\"));\ndayjs_1.default.extend(customParseFormat_1.default);\nconst isAddressComponent = (component) => component.type === 'address';\nconst isDayComponent = (component) => component.type === 'day';\nconst isEmailComponent = (component) => component.type === 'email';\nconst isRadioComponent = (component) => component.type === 'radio';\nconst isSelectComponent = (component) => component.type === 'select';\nconst isSelectBoxesComponent = (component) => component.type === 'selectboxes';\nconst isTagsComponent = (component) => component.type === 'tags';\nconst isTextFieldComponent = (component) => component.type === 'textfield';\nconst isTimeComponent = (component) => component.type === 'time';\nconst isNumberComponent = (component) => component.type === 'number';\nconst normalizeAddressComponentValue = (component, value) => {\n if (!component.multiple && Boolean(component.enableManualMode) && value && !value.mode) {\n return {\n mode: 'autocomplete',\n address: value,\n };\n }\n return value;\n};\nconst getLocaleDateFormatInfo = (locale = 'en') => {\n const formatInfo = {};\n const day = 21;\n const exampleDate = new Date(2017, 11, day);\n const localDateString = exampleDate.toLocaleDateString(locale);\n formatInfo.dayFirst = localDateString.slice(0, 2) === day.toString();\n return formatInfo;\n};\nconst getLocaleDayFirst = (component, form) => {\n var _a;\n if (component.useLocaleSettings) {\n return getLocaleDateFormatInfo((_a = form.options) === null || _a === void 0 ? void 0 : _a.language).dayFirst;\n }\n return component.dayFirst;\n};\nconst normalizeDayComponentValue = (component, form, value) => {\n // TODO: this is a quick and dirty port of the Day component's normalizeValue method, may need some updates\n const valueMask = /^\\d{2}\\/\\d{2}\\/\\d{4}$/;\n const isDayFirst = getLocaleDayFirst(component, form);\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 (!value || valueMask.test(value)) {\n return value;\n }\n const dateParts = [];\n const valueParts = value.split('/');\n const [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n const defaultValue = component.defaultValue ? component.defaultValue.split('/') : '';\n let defaultDay = '';\n let defaultMonth = '';\n let defaultYear = '';\n const getDayWithHiddenFields = (parts) => {\n let DAY, MONTH, YEAR;\n [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n if (!showDay) {\n MONTH = MONTH === 0 ? 0 : MONTH - 1;\n YEAR = YEAR - 1;\n DAY = null;\n }\n if (!showMonth) {\n if (!(0, lodash_1.isNull)(DAY)) {\n DAY = DAY === 0 ? 0 : DAY - 1;\n }\n YEAR = YEAR - 1;\n MONTH = null;\n }\n if (!showYear) {\n YEAR = null;\n }\n return {\n month: (0, lodash_1.isNull)(MONTH) ? '' : parts[MONTH],\n day: (0, lodash_1.isNull)(DAY) ? '' : parts[DAY],\n year: (0, lodash_1.isNull)(YEAR) ? '' : parts[YEAR],\n };\n };\n const getNextPart = (shouldTake, defaultValue) => {\n // Only push the part if it's not an empty string\n const part = shouldTake ? valueParts.shift() : defaultValue;\n if (part !== '') {\n dateParts.push(part);\n }\n };\n if (defaultValue) {\n const hasHiddenFields = defaultValue.length !== 3;\n defaultDay = hasHiddenFields ? getDayWithHiddenFields(defaultValue).day : defaultValue[DAY];\n defaultMonth = hasHiddenFields\n ? getDayWithHiddenFields(defaultValue).month\n : defaultValue[MONTH];\n defaultYear = hasHiddenFields ? getDayWithHiddenFields(defaultValue).year : defaultValue[YEAR];\n }\n if (isDayFirst) {\n getNextPart(showDay, defaultDay);\n }\n getNextPart(showMonth, defaultMonth);\n if (!isDayFirst) {\n getNextPart(showDay, defaultDay);\n }\n getNextPart(showYear, defaultYear);\n return dateParts.join('/');\n};\nconst normalizeRadioComponentValue = (value, dataType) => {\n switch (dataType) {\n case 'number':\n return +value;\n case 'string':\n return typeof value === 'object' ? JSON.stringify(value) : String(value);\n case 'boolean':\n return !(!value || value.toString() === 'false');\n }\n const isEquivalent = (0, lodash_1.toString)(value) === Number(value).toString();\n if (!isNaN(parseFloat(value)) && isFinite(value) && isEquivalent) {\n return +value;\n }\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n return value;\n};\nconst normalizeSingleSelectComponentValue = (component, value) => {\n if ((0, lodash_1.isNil)(value)) {\n return;\n }\n const valueIsObject = (0, lodash_1.isObject)(value);\n //check if value equals to default emptyValue\n if (valueIsObject && Object.keys(value).length === 0) {\n return value;\n }\n const dataType = component.dataType || 'auto';\n const normalize = {\n value,\n number() {\n const numberValue = Number(this.value);\n const isEquivalent = value.toString() === numberValue.toString();\n if (!Number.isNaN(numberValue) &&\n Number.isFinite(numberValue) &&\n value !== '' &&\n isEquivalent) {\n this.value = numberValue;\n }\n return this;\n },\n boolean() {\n if ((0, lodash_1.isString)(this.value) &&\n (this.value.toLowerCase() === 'true' || this.value.toLowerCase() === 'false')) {\n this.value = this.value.toLowerCase() === 'true';\n }\n return this;\n },\n string() {\n this.value = String(this.value);\n return this;\n },\n object() {\n return this;\n },\n auto() {\n if ((0, lodash_1.isObject)(this.value)) {\n this.value = this.object().value;\n }\n else {\n this.value = this.string().number().boolean().value;\n }\n return this;\n },\n };\n try {\n return normalize[dataType]().value;\n }\n catch (err) {\n console.warn('Failed to normalize value', err);\n return value;\n }\n};\nconst normalizeSelectComponentValue = (component, value) => {\n if (component.multiple && Array.isArray(value)) {\n return value.map((singleValue) => normalizeSingleSelectComponentValue(component, singleValue));\n }\n return normalizeSingleSelectComponentValue(component, value);\n};\nconst normalizeSelectBoxesComponentValue = (value) => {\n if (!value) {\n value = {};\n }\n if (typeof value !== 'object') {\n if (typeof value === 'string') {\n return {\n [value]: true,\n };\n }\n else {\n return {};\n }\n }\n if (Array.isArray(value)) {\n return value.reduce((acc, curr) => {\n return Object.assign(Object.assign({}, acc), { [curr]: true });\n }, {});\n }\n return value;\n};\nconst normalizeTagsComponentValue = (component, value) => {\n const delimiter = component.delimeter || ',';\n if ((!component.hasOwnProperty('storeas') || component.storeas === 'string') &&\n Array.isArray(value)) {\n return value.join(delimiter);\n }\n else if (component.storeas === 'array' && typeof value === 'string') {\n return value.split(delimiter).filter((result) => result);\n }\n return value;\n};\nconst normalizeMaskValue = (component, defaultValues, value, path) => {\n if (component.inputMasks && component.inputMasks.length > 0) {\n if (!value || typeof value !== 'object') {\n return {\n value: value,\n maskName: component.inputMasks[0].label,\n };\n }\n if (!value.value) {\n const defaultValue = defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.find((defaultValue) => defaultValue.path === path);\n value.value =\n Array.isArray(defaultValue) && defaultValue.length > 0 ? defaultValue[0] : defaultValue;\n }\n }\n return value;\n};\nconst normalizeTextFieldComponentValue = (component, defaultValues, value, path) => {\n // If the component has truncate multiple spaces enabled, then normalize the value to remove extra spaces.\n if (component.truncateMultipleSpaces && typeof value === 'string') {\n value = value.trim().replace(/\\s{2,}/g, ' ');\n }\n if (component.allowMultipleMasks && component.inputMasks && component.inputMasks.length > 0) {\n if (Array.isArray(value)) {\n return value.map((val) => normalizeMaskValue(component, defaultValues, val, path));\n }\n else {\n return normalizeMaskValue(component, defaultValues, value, path);\n }\n }\n return value;\n};\n// Allow submissions of time components in their visual \"format\" property by coercing them to the \"dataFormat\" property\n// i.e. \"HH:mm\" -> \"HH:mm:ss\"\nconst normalizeTimeComponentValue = (component, value) => {\n const defaultDataFormat = 'HH:mm:ss';\n const defaultFormat = 'HH:mm';\n if ((0, dayjs_1.default)(value, component.format || defaultFormat, true).isValid()) {\n return (0, dayjs_1.default)(value, component.format || defaultFormat, true).format(component.dataFormat || defaultDataFormat);\n }\n return value;\n};\nconst normalizeSingleNumberComponentValue = (component, value) => {\n if (!isNaN(parseFloat(value)) && isFinite(value)) {\n return +value;\n }\n return value;\n};\nconst normalizeNumberComponentValue = (component, value) => {\n if (component.multiple && Array.isArray(value)) {\n return value.map((singleValue) => normalizeSingleNumberComponentValue(component, singleValue));\n }\n return normalizeSingleNumberComponentValue(component, value);\n};\nconst normalizeProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.normalizeProcessSync)(context);\n});\nexports.normalizeProcess = normalizeProcess;\nconst normalizeProcessSync = (context) => {\n const { component, form, scope, path, data, value } = context;\n if (!scope.normalize) {\n scope.normalize = {};\n }\n const { defaultValues } = scope;\n scope.normalize[path] = {\n type: component.type,\n normalized: false,\n };\n // First check for component-type-specific transformations\n if (isAddressComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeAddressComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isDayComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeDayComponentValue(component, form, value));\n scope.normalize[path].normalized = true;\n }\n else if (isEmailComponent(component)) {\n if (value && typeof value === 'string') {\n (0, lodash_1.set)(data, path, value.toLowerCase());\n scope.normalize[path].normalized = true;\n }\n }\n else if (isRadioComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeRadioComponentValue(value, component.dataType));\n scope.normalize[path].normalized = true;\n }\n else if (isSelectComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeSelectComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isSelectBoxesComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeSelectBoxesComponentValue(value));\n scope.normalize[path].normalized = true;\n }\n else if (isTagsComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeTagsComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isTextFieldComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeTextFieldComponentValue(component, defaultValues, value, path));\n scope.normalize[path].normalized = true;\n }\n else if (isTimeComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeTimeComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n else if (isNumberComponent(component)) {\n (0, lodash_1.set)(data, path, normalizeNumberComponentValue(component, value));\n scope.normalize[path].normalized = true;\n }\n // Next perform component-type-agnostic transformations (i.e. super())\n if (component.multiple && !Array.isArray(value)) {\n (0, lodash_1.set)(data, path, value ? [value] : []);\n scope.normalize[path].normalized = true;\n }\n};\nexports.normalizeProcessSync = normalizeProcessSync;\nexports.normalizeProcessInfo = {\n name: 'normalize',\n shouldProcess: () => true,\n process: exports.normalizeProcess,\n processSync: exports.normalizeProcessSync,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/normalize/index.js?");
|
228
228
|
|
229
229
|
/***/ }),
|
230
230
|
|
@@ -235,7 +235,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
235
235
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
236
236
|
|
237
237
|
"use strict";
|
238
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.populateProcessInfo = exports.populateProcessSync = 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/index.js\");\n// This processor ensures that a \"linked\" row context is provided to every component.\nconst populateProcessSync = (context) => {\n const { component, path, scope } = context;\n const { data } = scope;\n const compDataPath = (0, formUtil_1.componentPath)(component, (0, formUtil_1.getContextualRowPath)(component, path));\n const compData = (0, lodash_1.get)(data, compDataPath);\n if (!scope.populated)\n scope.populated = [];\n switch ((0, formUtil_1.getModelType)(component)) {\n case 'nestedArray':\n if (!compData || !compData.length) {\n (0, lodash_1.set)(data, compDataPath, [{}]);\n scope.row = (0, lodash_1.get)(data, compDataPath)[0];\n scope.populated.push({\n path,\n row: (0, lodash_1.get)(data, compDataPath)[0]
|
238
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.populateProcessInfo = exports.populateProcessSync = 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/index.js\");\n// This processor ensures that a \"linked\" row context is provided to every component.\nconst populateProcessSync = (context) => {\n const { component, path, scope } = context;\n const { data } = scope;\n const compDataPath = (0, formUtil_1.componentPath)(component, (0, formUtil_1.getContextualRowPath)(component, path));\n const compData = (0, lodash_1.get)(data, compDataPath);\n if (!scope.populated)\n scope.populated = [];\n switch ((0, formUtil_1.getModelType)(component)) {\n case 'nestedArray':\n if (!compData || !compData.length) {\n (0, lodash_1.set)(data, compDataPath, [{}]);\n scope.row = (0, lodash_1.get)(data, compDataPath)[0];\n scope.populated.push({\n path,\n row: (0, lodash_1.get)(data, compDataPath)[0],\n });\n }\n break;\n case 'dataObject':\n case 'object':\n if (!compData || typeof compData !== 'object') {\n (0, lodash_1.set)(data, compDataPath, {});\n scope.row = (0, lodash_1.get)(data, compDataPath);\n scope.populated.push({\n path,\n row: (0, lodash_1.get)(data, compDataPath),\n });\n }\n break;\n }\n};\nexports.populateProcessSync = populateProcessSync;\nexports.populateProcessInfo = {\n name: 'populate',\n shouldProcess: () => true,\n processSync: exports.populateProcessSync,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/populate/index.js?");
|
239
239
|
|
240
240
|
/***/ }),
|
241
241
|
|
@@ -246,7 +246,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
246
246
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
247
247
|
|
248
248
|
"use strict";
|
249
|
-
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.ProcessTargets = exports.ProcessorMap = exports.processSync = exports.process = void 0;\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst processOne_1 = __webpack_require__(/*! ./processOne */ \"./node_modules/@formio/core/lib/process/processOne.js\");\nconst defaultValue_1 = __webpack_require__(/*! ./defaultValue */ \"./node_modules/@formio/core/lib/process/defaultValue/index.js\");\nconst fetch_1 = __webpack_require__(/*! ./fetch */ \"./node_modules/@formio/core/lib/process/fetch/index.js\");\nconst calculation_1 = __webpack_require__(/*! ./calculation */ \"./node_modules/@formio/core/lib/process/calculation/index.js\");\nconst logic_1 = __webpack_require__(/*! ./logic */ \"./node_modules/@formio/core/lib/process/logic/index.js\");\nconst conditions_1 = __webpack_require__(/*! ./conditions */ \"./node_modules/@formio/core/lib/process/conditions/index.js\");\nconst validation_1 = __webpack_require__(/*! ./validation */ \"./node_modules/@formio/core/lib/process/validation/index.js\");\nconst filter_1 = __webpack_require__(/*! ./filter */ \"./node_modules/@formio/core/lib/process/filter/index.js\");\nconst normalize_1 = __webpack_require__(/*! ./normalize */ \"./node_modules/@formio/core/lib/process/normalize/index.js\");\nconst dereference_1 = __webpack_require__(/*! ./dereference */ \"./node_modules/@formio/core/lib/process/dereference/index.js\");\nconst clearHidden_1 = __webpack_require__(/*! ./clearHidden */ \"./node_modules/@formio/core/lib/process/clearHidden.js\");\nconst hideChildren_1 = __webpack_require__(/*! ./hideChildren */ \"./node_modules/@formio/core/lib/process/hideChildren.js\");\nfunction process(context) {\n return __awaiter(this, void 0, void 0, function* () {\n const { instances, components, data, scope, flat, processors } = context;\n yield (0, formUtil_1.eachComponentDataAsync)(components, data, (component, compData, row, path, components, index, parent) => __awaiter(this, void 0, void 0, function* () {\n // Skip processing if row is null or undefined\n if (!row) {\n return;\n }\n yield (0, processOne_1.processOne)(Object.assign(Object.assign({}, context), { data: compData, component,\n components,\n path,\n row,\n index, instance: instances ? instances[path] : undefined, parent }));\n if (flat) {\n return true;\n }\n if (scope.noRecurse) {\n scope.noRecurse = false;\n return true;\n }\n }));\n for (let i = 0; i < (processors === null || processors === void 0 ? void 0 : processors.length); i++) {\n const processor = processors[i];\n if (processor.postProcess) {\n processor.postProcess(context);\n }\n }\n return scope;\n });\n}\nexports.process = process;\nfunction processSync(context) {\n const { instances, components, data, scope, flat, processors } = context;\n (0, formUtil_1.eachComponentData)(components, data, (component, compData, row, path, components, index, parent) => {\n // Skip processing if row is null or undefined\n if (!row) {\n return;\n }\n (0, processOne_1.processOneSync)(Object.assign(Object.assign({}, context), { data: compData, component,\n components,\n path,\n row,\n index, instance: instances ? instances[path] : undefined, parent }));\n if (flat) {\n return true;\n }\n if (scope.noRecurse) {\n scope.noRecurse = false;\n return true;\n }\n });\n for (let i = 0; i < (processors === null || processors === void 0 ? void 0 : processors.length); i++) {\n const processor = processors[i];\n if (processor.postProcess) {\n processor.postProcess(context);\n }\n }\n return scope;\n}\nexports.processSync = processSync;\nexports.ProcessorMap = {\n filter: filter_1.filterProcessInfo,\n defaultValue: defaultValue_1.defaultValueProcessInfo,\n serverDefaultValue: defaultValue_1.serverDefaultValueProcessInfo,\n customDefaultValue: defaultValue_1.customDefaultValueProcessInfo,\n calculate: calculation_1.calculateProcessInfo,\n conditions: conditions_1.conditionProcessInfo,\n customConditions: conditions_1.customConditionProcessInfo,\n simpleConditions: conditions_1.simpleConditionProcessInfo,\n normalize: normalize_1.normalizeProcessInfo,\n dereference: dereference_1.dereferenceProcessInfo,\n clearHidden: clearHidden_1.clearHiddenProcessInfo,\n fetch: fetch_1.fetchProcessInfo,\n logic: logic_1.logicProcessInfo,\n validate: validation_1.validateProcessInfo,\n validateCustom: validation_1.validateCustomProcessInfo,\n validateServer: validation_1.validateServerProcessInfo,\n hideChildren: hideChildren_1.hideChildrenProcessorInfo
|
249
|
+
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.ProcessTargets = exports.ProcessorMap = exports.processSync = exports.process = void 0;\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst processOne_1 = __webpack_require__(/*! ./processOne */ \"./node_modules/@formio/core/lib/process/processOne.js\");\nconst defaultValue_1 = __webpack_require__(/*! ./defaultValue */ \"./node_modules/@formio/core/lib/process/defaultValue/index.js\");\nconst fetch_1 = __webpack_require__(/*! ./fetch */ \"./node_modules/@formio/core/lib/process/fetch/index.js\");\nconst calculation_1 = __webpack_require__(/*! ./calculation */ \"./node_modules/@formio/core/lib/process/calculation/index.js\");\nconst logic_1 = __webpack_require__(/*! ./logic */ \"./node_modules/@formio/core/lib/process/logic/index.js\");\nconst conditions_1 = __webpack_require__(/*! ./conditions */ \"./node_modules/@formio/core/lib/process/conditions/index.js\");\nconst validation_1 = __webpack_require__(/*! ./validation */ \"./node_modules/@formio/core/lib/process/validation/index.js\");\nconst filter_1 = __webpack_require__(/*! ./filter */ \"./node_modules/@formio/core/lib/process/filter/index.js\");\nconst normalize_1 = __webpack_require__(/*! ./normalize */ \"./node_modules/@formio/core/lib/process/normalize/index.js\");\nconst dereference_1 = __webpack_require__(/*! ./dereference */ \"./node_modules/@formio/core/lib/process/dereference/index.js\");\nconst clearHidden_1 = __webpack_require__(/*! ./clearHidden */ \"./node_modules/@formio/core/lib/process/clearHidden.js\");\nconst hideChildren_1 = __webpack_require__(/*! ./hideChildren */ \"./node_modules/@formio/core/lib/process/hideChildren.js\");\nfunction process(context) {\n return __awaiter(this, void 0, void 0, function* () {\n const { instances, components, data, scope, flat, processors } = context;\n yield (0, formUtil_1.eachComponentDataAsync)(components, data, (component, compData, row, path, components, index, parent) => __awaiter(this, void 0, void 0, function* () {\n // Skip processing if row is null or undefined\n if (!row) {\n return;\n }\n yield (0, processOne_1.processOne)(Object.assign(Object.assign({}, context), { data: compData, component,\n components,\n path,\n row,\n index, instance: instances ? instances[path] : undefined, parent }));\n if (flat) {\n return true;\n }\n if (scope.noRecurse) {\n scope.noRecurse = false;\n return true;\n }\n }));\n for (let i = 0; i < (processors === null || processors === void 0 ? void 0 : processors.length); i++) {\n const processor = processors[i];\n if (processor.postProcess) {\n processor.postProcess(context);\n }\n }\n return scope;\n });\n}\nexports.process = process;\nfunction processSync(context) {\n const { instances, components, data, scope, flat, processors } = context;\n (0, formUtil_1.eachComponentData)(components, data, (component, compData, row, path, components, index, parent) => {\n // Skip processing if row is null or undefined\n if (!row) {\n return;\n }\n (0, processOne_1.processOneSync)(Object.assign(Object.assign({}, context), { data: compData, component,\n components,\n path,\n row,\n index, instance: instances ? instances[path] : undefined, parent }));\n if (flat) {\n return true;\n }\n if (scope.noRecurse) {\n scope.noRecurse = false;\n return true;\n }\n });\n for (let i = 0; i < (processors === null || processors === void 0 ? void 0 : processors.length); i++) {\n const processor = processors[i];\n if (processor.postProcess) {\n processor.postProcess(context);\n }\n }\n return scope;\n}\nexports.processSync = processSync;\nexports.ProcessorMap = {\n filter: filter_1.filterProcessInfo,\n defaultValue: defaultValue_1.defaultValueProcessInfo,\n serverDefaultValue: defaultValue_1.serverDefaultValueProcessInfo,\n customDefaultValue: defaultValue_1.customDefaultValueProcessInfo,\n calculate: calculation_1.calculateProcessInfo,\n conditions: conditions_1.conditionProcessInfo,\n customConditions: conditions_1.customConditionProcessInfo,\n simpleConditions: conditions_1.simpleConditionProcessInfo,\n normalize: normalize_1.normalizeProcessInfo,\n dereference: dereference_1.dereferenceProcessInfo,\n clearHidden: clearHidden_1.clearHiddenProcessInfo,\n fetch: fetch_1.fetchProcessInfo,\n logic: logic_1.logicProcessInfo,\n validate: validation_1.validateProcessInfo,\n validateCustom: validation_1.validateCustomProcessInfo,\n validateServer: validation_1.validateServerProcessInfo,\n hideChildren: hideChildren_1.hideChildrenProcessorInfo,\n};\nexports.ProcessTargets = {\n submission: [\n filter_1.filterProcessInfo,\n defaultValue_1.serverDefaultValueProcessInfo,\n normalize_1.normalizeProcessInfo,\n dereference_1.dereferenceProcessInfo,\n fetch_1.fetchProcessInfo,\n conditions_1.simpleConditionProcessInfo,\n validation_1.validateServerProcessInfo,\n ],\n evaluator: [\n defaultValue_1.customDefaultValueProcessInfo,\n calculation_1.calculateProcessInfo,\n logic_1.logicProcessInfo,\n conditions_1.conditionProcessInfo,\n hideChildren_1.hideChildrenProcessorInfo,\n clearHidden_1.clearHiddenProcessInfo,\n validation_1.validateProcessInfo,\n ],\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/process.js?");
|
250
250
|
|
251
251
|
/***/ }),
|
252
252
|
|
@@ -257,7 +257,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
257
257
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
258
258
|
|
259
259
|
"use strict";
|
260
|
-
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.processOneSync = exports.processOne = exports.dataValue = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@formio/core/lib/types/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst utils_1 = __webpack_require__(/*! ../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nfunction dataValue(component, row) {\n const key = (0, formUtil_1.getComponentKey)(component);\n return key ? (0, lodash_1.get)(row, key) : undefined;\n}\nexports.dataValue = dataValue;\nfunction processOne(context) {\n return __awaiter(this, void 0, void 0, function* () {\n const { processors, component } = context;\n // Create a getter for `value` that is always derived from the current data object\n if (typeof context.value === 'undefined') {\n Object.defineProperty(context, 'value', {\n enumerable: true,\n get() {\n return (0, lodash_1.get)(context.data, context.path);\n },\n set(newValue) {\n (0, lodash_1.set)(context.data, context.path, newValue);\n }
|
260
|
+
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.processOneSync = exports.processOne = exports.dataValue = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst types_1 = __webpack_require__(/*! ../types */ \"./node_modules/@formio/core/lib/types/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst utils_1 = __webpack_require__(/*! ../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nfunction dataValue(component, row) {\n const key = (0, formUtil_1.getComponentKey)(component);\n return key ? (0, lodash_1.get)(row, key) : undefined;\n}\nexports.dataValue = dataValue;\nfunction processOne(context) {\n return __awaiter(this, void 0, void 0, function* () {\n const { processors, component } = context;\n // Create a getter for `value` that is always derived from the current data object\n if (typeof context.value === 'undefined') {\n Object.defineProperty(context, 'value', {\n enumerable: true,\n get() {\n return (0, lodash_1.get)(context.data, context.path);\n },\n set(newValue) {\n (0, lodash_1.set)(context.data, context.path, newValue);\n },\n });\n }\n // If the component has ephermal state, then we need to reset the ephermal state in case this is e.g. a data grid, in which each row needs to be validated independently\n (0, utils_1.resetEphermalState)(component);\n if (!context.row) {\n return;\n }\n context.processor = types_1.ProcessorType.Custom;\n for (const processor of processors) {\n if (processor === null || processor === void 0 ? void 0 : processor.process) {\n yield processor.process(context);\n }\n }\n });\n}\nexports.processOne = processOne;\nfunction processOneSync(context) {\n const { processors, component } = context;\n // Create a getter for `value` that is always derived from the current data object\n if (typeof context.value === 'undefined') {\n Object.defineProperty(context, 'value', {\n enumerable: true,\n get() {\n return (0, lodash_1.get)(context.data, context.path);\n },\n set(newValue) {\n (0, lodash_1.set)(context.data, context.path, newValue);\n },\n });\n }\n // If the component has ephermal state, then we need to reset the ephermal state in case this is e.g. a data grid, in which each row needs to be validated independently\n (0, utils_1.resetEphermalState)(component);\n if (!context.row) {\n return;\n }\n context.processor = types_1.ProcessorType.Custom;\n for (const processor of processors) {\n if (processor === null || processor === void 0 ? void 0 : processor.processSync) {\n processor.processSync(context);\n }\n }\n}\nexports.processOneSync = processOneSync;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/processOne.js?");
|
261
261
|
|
262
262
|
/***/ }),
|
263
263
|
|
@@ -268,7 +268,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
268
268
|
/***/ (function(__unused_webpack_module, exports) {
|
269
269
|
|
270
270
|
"use strict";
|
271
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.EN_ERRORS = void 0;\nexports.EN_ERRORS = {\n unsavedRowsError: 'Please save all rows before proceeding.',\n invalidRowsError: 'Please correct invalid rows before proceeding.',\n invalidRowError: 'Invalid row. Please correct it or delete.',\n invalidOption: '{{field}} is an invalid value.',\n invalidDay: '{{field}} is not a valid day.',\n required: '{{field}} is required',\n unique: '{{field}} must be unique',\n array: '{{field}} must be an array',\n array_nonempty: '{{field}} must be a non-empty array'
|
271
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.EN_ERRORS = void 0;\nexports.EN_ERRORS = {\n unsavedRowsError: 'Please save all rows before proceeding.',\n invalidRowsError: 'Please correct invalid rows before proceeding.',\n invalidRowError: 'Invalid row. Please correct it or delete.',\n invalidOption: '{{field}} is an invalid value.',\n invalidDay: '{{field}} is not a valid day.',\n required: '{{field}} is required',\n unique: '{{field}} must be unique',\n array: '{{field}} must be an array',\n array_nonempty: '{{field}} must be a non-empty array',\n nonarray: '{{field}} must not be an array',\n select: '{{field}} contains an invalid selection',\n pattern: '{{field}} does not match the pattern {{pattern}}',\n minLength: '{{field}} must have at least {{length}} characters.',\n maxLength: '{{field}} must have no more than {{length}} characters.',\n minWords: '{{field}} must have at least {{length}} words.',\n maxWords: '{{field}} must have no more than {{length}} words.',\n min: '{{field}} cannot be less than {{min}}.',\n max: '{{field}} cannot be greater than {{max}}.',\n maxDate: '{{field}} should not contain date after {{- maxDate}}',\n minDate: '{{field}} should not contain date before {{- minDate}}',\n maxYear: '{{field}} should not contain year greater than {{maxYear}}',\n minSelectedCount: 'You must select at least {{minCount}} items',\n maxSelectedCount: 'You may only select up to {{maxCount}} items',\n minYear: '{{field}} should not contain year less than {{minYear}}',\n invalid_email: '{{field}} must be a valid email.',\n invalid_url: '{{field}} must be a valid url.',\n invalid_regex: '{{field}} does not match the pattern {{regex}}.',\n invalid_date: '{{field}} is not a valid date.',\n invalid_day: '{{field}} is not a valid day.',\n invalidValueProperty: 'Invalid Value Property',\n mask: '{{field}} does not match the mask.',\n valueIsNotAvailable: '{{ field }} is an invalid value.',\n time: '{{field}} is not a valid time.',\n invalidDate: '{{field}} is not a valid date',\n number: '{{field}} is not a valid number.',\n requiredDayField: '{{ field }} is required',\n requiredMonthField: '{{ field }} is required',\n requiredYearField: '{{ field }} is required',\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/i18n/en.js?");
|
272
272
|
|
273
273
|
/***/ }),
|
274
274
|
|
@@ -279,7 +279,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
279
279
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
280
280
|
|
281
281
|
"use strict";
|
282
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.VALIDATION_ERRORS = void 0;\nconst en_1 = __webpack_require__(/*! ./en */ \"./node_modules/@formio/core/lib/process/validation/i18n/en.js\");\nexports.VALIDATION_ERRORS = {\n en: en_1.EN_ERRORS
|
282
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.VALIDATION_ERRORS = void 0;\nconst en_1 = __webpack_require__(/*! ./en */ \"./node_modules/@formio/core/lib/process/validation/i18n/en.js\");\nexports.VALIDATION_ERRORS = {\n en: en_1.EN_ERRORS,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/i18n/index.js?");
|
283
283
|
|
284
284
|
/***/ }),
|
285
285
|
|
@@ -290,7 +290,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
290
290
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
291
291
|
|
292
292
|
"use strict";
|
293
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateProcessInfo = exports.validateServerProcessInfo = exports.validateCustomProcessInfo = exports.validateAllProcessSync = exports.validateAllProcess = exports.validateServerProcessSync = exports.validateServerProcess = exports.validateCustomProcessSync = exports.validateCustomProcess = exports.validateProcessSync = exports.validateProcess = exports.shouldValidateServer = exports.shouldValidateCustom = exports.shouldValidateAll = exports.shouldSkipValidation = exports.shouldSkipValidationSimple = exports.shouldSkipValidationCustom = exports._shouldSkipValidation = exports.isForcedHidden = exports.isValueHidden = exports.isInputComponent = exports.validationRules = void 0;\nconst rules_1 = __webpack_require__(/*! ./rules */ \"./node_modules/@formio/core/lib/process/validation/rules/index.js\");\nconst find_1 = __importDefault(__webpack_require__(/*! lodash/find */ \"./node_modules/lodash/find.js\"));\nconst get_1 = __importDefault(__webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\"));\nconst pick_1 = __importDefault(__webpack_require__(/*! lodash/pick */ \"./node_modules/lodash/pick.js\"));\nconst formUtil_1 = __webpack_require__(/*! ../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst error_1 = __webpack_require__(/*! ../../utils/error */ \"./node_modules/@formio/core/lib/utils/error.js\");\nconst conditions_1 = __webpack_require__(/*! ../conditions */ \"./node_modules/@formio/core/lib/process/conditions/index.js\");\n// Cleans up validation errors to remove unnessesary parts\n// and make them transferable to ivm.\nconst cleanupValidationError = (error) => (Object.assign(Object.assign({}, error), { context: (0, pick_1.default)(error.context, [\n 'component',\n 'path',\n 'index',\n 'value',\n 'field',\n 'hasLabel',\n 'processor',\n 'setting',\n 'pattern',\n 'length',\n 'min',\n 'max',\n 'maxDate',\n 'minDate',\n 'maxYear',\n 'minYear',\n 'minCount',\n 'maxCount',\n 'regex'\n ]) }));\nfunction validationRules(context, rules, skipValidation) {\n if (skipValidation && skipValidation(context)) {\n return [];\n }\n const validationRules = [];\n return rules.reduce((acc, rule) => {\n if (rule.shouldProcess && rule.shouldProcess(context)) {\n acc.push(rule);\n }\n return acc;\n }, validationRules);\n}\nexports.validationRules = validationRules;\nfunction isInputComponent(context) {\n const { component } = context;\n return !component.hasOwnProperty('input') || component.input;\n}\nexports.isInputComponent = isInputComponent;\nfunction isValueHidden(context) {\n const { component, config } = context;\n if (component.protected) {\n return false;\n }\n if ((component.hasOwnProperty('persistent') && !component.persistent) ||\n (component.persistent === 'client-only')) {\n return true;\n }\n return false;\n}\nexports.isValueHidden = isValueHidden;\nfunction isForcedHidden(context, isConditionallyHidden) {\n const { component } = context;\n if (isConditionallyHidden(context)) {\n return true;\n }\n if (component.hasOwnProperty('hidden')) {\n return !!component.hidden;\n }\n return false;\n}\nexports.isForcedHidden = isForcedHidden;\nconst _shouldSkipValidation = (context, isConditionallyHidden) => {\n var _a;\n const { component, scope, path } = context;\n if ((scope === null || scope === void 0 ? void 0 : scope.conditionals) &&\n ((0, find_1.default)(scope.conditionals, {\n path: (0, formUtil_1.getComponentPath)(component, path),\n conditionallyHidden: true\n }) || ((_a = component.ephermalState) === null || _a === void 0 ? void 0 : _a.conditionallyHidden) === true)) {\n return true;\n }\n const { validateWhenHidden = false } = component || {};\n const rules = [\n // Skip validation if component is readOnly\n // () => this.options.readOnly,\n // Do not check validations if component is not an input component.\n () => !isInputComponent(context),\n // Check to see if we are editing and if so, check component persistence.\n () => isValueHidden(context),\n // Force valid if component is hidden.\n () => isForcedHidden(context, isConditionallyHidden) && !validateWhenHidden,\n ];\n return rules.some(pred => pred());\n ;\n};\nexports._shouldSkipValidation = _shouldSkipValidation;\nconst shouldSkipValidationCustom = (context) => {\n return (0, exports._shouldSkipValidation)(context, conditions_1.isCustomConditionallyHidden);\n};\nexports.shouldSkipValidationCustom = shouldSkipValidationCustom;\nconst shouldSkipValidationSimple = (context) => {\n return (0, exports._shouldSkipValidation)(context, conditions_1.isSimpleConditionallyHidden);\n};\nexports.shouldSkipValidationSimple = shouldSkipValidationSimple;\nconst shouldSkipValidation = (context) => {\n return (0, exports._shouldSkipValidation)(context, conditions_1.isConditionallyHidden);\n};\nexports.shouldSkipValidation = shouldSkipValidation;\nfunction shouldValidateAll(context) {\n return validationRules(context, rules_1.rules, exports.shouldSkipValidation).length > 0;\n}\nexports.shouldValidateAll = shouldValidateAll;\nfunction shouldValidateCustom(context) {\n const { component } = context;\n if (component.customConditional) {\n return true;\n }\n return !(0, exports.shouldSkipValidationCustom)(context);\n}\nexports.shouldValidateCustom = shouldValidateCustom;\nfunction shouldValidateServer(context) {\n const { component } = context;\n if (component.customConditional) {\n return false;\n }\n if ((0, exports.shouldSkipValidationSimple)(context)) {\n return false;\n }\n return shouldValidateAll(context);\n}\nexports.shouldValidateServer = shouldValidateServer;\nfunction handleError(error, context) {\n const { scope, component } = context;\n const absolutePath = (0, formUtil_1.getComponentAbsolutePath)(component);\n if (error) {\n const cleanedError = cleanupValidationError(error);\n cleanedError.context.path = absolutePath;\n if (!(0, find_1.default)(scope.errors, { errorKeyOrMessage: cleanedError.errorKeyOrMessage, context: {\n path: absolutePath\n } })) {\n if (!scope.validated)\n scope.validated = [];\n if (!scope.errors)\n scope.errors = [];\n scope.errors.push(cleanedError);\n scope.validated.push({ path: absolutePath, error: cleanedError });\n }\n }\n}\nconst validateProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n const { component, data, row, path, instance, scope, rules, skipValidation } = context;\n let { value } = context;\n if (!scope.validated)\n scope.validated = [];\n if (!scope.errors)\n scope.errors = [];\n if (!rules || !rules.length) {\n return;\n }\n if (component.multiple && Array.isArray(value) && value.length > 0) {\n const fullValueRules = rules.filter(rule => rule.fullValue);\n const otherRules = rules.filter(rule => !rule.fullValue);\n for (let i = 0; i < value.length; i++) {\n const amendedPath = `${path}[${i}]`;\n let amendedValue = (0, get_1.default)(data, amendedPath);\n if (instance === null || instance === void 0 ? void 0 : instance.shouldSkipValidation(data)) {\n return;\n }\n const rulesToExecute = validationRules(context, otherRules, skipValidation);\n if (!rulesToExecute.length) {\n continue;\n }\n if (component.truncateMultipleSpaces && amendedValue && typeof amendedValue === 'string') {\n amendedValue = amendedValue.trim().replace(/\\s{2,}/g, ' ');\n }\n for (const rule of rulesToExecute) {\n if (rule && rule.process) {\n handleError(yield rule.process(Object.assign(Object.assign({}, context), { value: amendedValue, index: i, path: amendedPath })), context);\n }\n }\n }\n for (const rule of fullValueRules) {\n if (rule && rule.process) {\n handleError(yield rule.process(Object.assign(Object.assign({}, context), { value })), context);\n }\n }\n return;\n }\n if (instance === null || instance === void 0 ? void 0 : instance.shouldSkipValidation(data, row)) {\n return;\n }\n const rulesToExecute = validationRules(context, rules, skipValidation);\n if (!rulesToExecute.length) {\n return;\n }\n if (component.truncateMultipleSpaces && value && typeof value === 'string') {\n value = value.trim().replace(/\\s{2,}/g, ' ');\n }\n for (const rule of rulesToExecute) {\n try {\n if (rule && rule.process) {\n handleError(yield rule.process(Object.assign(Object.assign({}, context), { value })), context);\n }\n }\n catch (err) {\n console.error(\"Validator error:\", (0, error_1.getErrorMessage)(err));\n }\n }\n return;\n});\nexports.validateProcess = validateProcess;\nconst validateProcessSync = (context) => {\n const { component, data, row, path, instance, scope, rules, skipValidation } = context;\n let { value } = context;\n if (!scope.validated)\n scope.validated = [];\n if (!scope.errors)\n scope.errors = [];\n if (!rules || !rules.length) {\n return;\n }\n if (component.multiple && Array.isArray(value) && value.length > 0) {\n const fullValueRules = rules.filter(rule => rule.fullValue);\n const otherRules = rules.filter(rule => !rule.fullValue);\n for (let i = 0; i < value.length; i++) {\n const amendedPath = `${path}[${i}]`;\n let amendedValue = (0, get_1.default)(data, amendedPath);\n if (instance === null || instance === void 0 ? void 0 : instance.shouldSkipValidation(data)) {\n return;\n }\n const rulesToExecute = validationRules(context, otherRules, skipValidation);\n if (!rulesToExecute.length) {\n continue;\n }\n if (component.truncateMultipleSpaces && amendedValue && typeof amendedValue === 'string') {\n amendedValue = amendedValue.trim().replace(/\\s{2,}/g, ' ');\n }\n for (const rule of rulesToExecute) {\n if (rule && rule.processSync) {\n handleError(rule.processSync(Object.assign(Object.assign({}, context), { value: amendedValue, index: i, path: amendedPath })), context);\n }\n }\n }\n for (const rule of fullValueRules) {\n if (rule && rule.processSync) {\n handleError(rule.processSync(Object.assign(Object.assign({}, context), { value })), context);\n }\n }\n return;\n }\n if (instance === null || instance === void 0 ? void 0 : instance.shouldSkipValidation(data, row)) {\n return;\n }\n const rulesToExecute = validationRules(context, rules, skipValidation);\n if (!rulesToExecute.length) {\n return;\n }\n if (component.truncateMultipleSpaces && value && typeof value === 'string') {\n value = value.trim().replace(/\\s{2,}/g, ' ');\n }\n for (const rule of rulesToExecute) {\n try {\n if (rule && rule.processSync) {\n handleError(rule.processSync(Object.assign(Object.assign({}, context), { value })), context);\n }\n }\n catch (err) {\n console.error(\"Validator error:\", (0, error_1.getErrorMessage)(err));\n }\n }\n return;\n};\nexports.validateProcessSync = validateProcessSync;\nconst validateCustomProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n context.rules = context.rules || rules_1.evaluationRules;\n context.skipValidation = exports.shouldSkipValidationCustom;\n return (0, exports.validateProcess)(context);\n});\nexports.validateCustomProcess = validateCustomProcess;\nconst validateCustomProcessSync = (context) => {\n context.rules = context.rules || rules_1.evaluationRules;\n context.skipValidation = exports.shouldSkipValidationCustom;\n return (0, exports.validateProcessSync)(context);\n};\nexports.validateCustomProcessSync = validateCustomProcessSync;\nconst validateServerProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n context.rules = context.rules || rules_1.serverRules;\n context.skipValidation = exports.shouldSkipValidationSimple;\n return (0, exports.validateProcess)(context);\n});\nexports.validateServerProcess = validateServerProcess;\nconst validateServerProcessSync = (context) => {\n context.rules = context.rules || rules_1.serverRules;\n context.skipValidation = exports.shouldSkipValidationSimple;\n return (0, exports.validateProcessSync)(context);\n};\nexports.validateServerProcessSync = validateServerProcessSync;\nconst validateAllProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n context.rules = context.rules || rules_1.rules;\n context.skipValidation = exports.shouldSkipValidation;\n return (0, exports.validateProcess)(context);\n});\nexports.validateAllProcess = validateAllProcess;\nconst validateAllProcessSync = (context) => {\n context.rules = context.rules || rules_1.rules;\n context.skipValidation = exports.shouldSkipValidation;\n return (0, exports.validateProcessSync)(context);\n};\nexports.validateAllProcessSync = validateAllProcessSync;\nexports.validateCustomProcessInfo = {\n name: 'validateCustom',\n process: exports.validateCustomProcess,\n processSync: exports.validateCustomProcessSync,\n shouldProcess: shouldValidateCustom,\n};\nexports.validateServerProcessInfo = {\n name: 'validateServer',\n process: exports.validateServerProcess,\n processSync: exports.validateServerProcessSync,\n shouldProcess: shouldValidateServer,\n};\nexports.validateProcessInfo = {\n name: 'validate',\n process: exports.validateAllProcess,\n processSync: exports.validateAllProcessSync,\n shouldProcess: shouldValidateAll,\n};\n__exportStar(__webpack_require__(/*! ./util */ \"./node_modules/@formio/core/lib/process/validation/util.js\"), exports);\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/index.js?");
|
293
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateProcessInfo = exports.validateServerProcessInfo = exports.validateCustomProcessInfo = exports.validateAllProcessSync = exports.validateAllProcess = exports.validateServerProcessSync = exports.validateServerProcess = exports.validateCustomProcessSync = exports.validateCustomProcess = exports.validateProcessSync = exports.validateProcess = exports.shouldValidateServer = exports.shouldValidateCustom = exports.shouldValidateAll = exports.shouldSkipValidation = exports.shouldSkipValidationSimple = exports.shouldSkipValidationCustom = exports._shouldSkipValidation = exports.isForcedHidden = exports.isValueHidden = exports.isInputComponent = exports.validationRules = void 0;\nconst rules_1 = __webpack_require__(/*! ./rules */ \"./node_modules/@formio/core/lib/process/validation/rules/index.js\");\nconst find_1 = __importDefault(__webpack_require__(/*! lodash/find */ \"./node_modules/lodash/find.js\"));\nconst get_1 = __importDefault(__webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\"));\nconst pick_1 = __importDefault(__webpack_require__(/*! lodash/pick */ \"./node_modules/lodash/pick.js\"));\nconst formUtil_1 = __webpack_require__(/*! ../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst error_1 = __webpack_require__(/*! ../../utils/error */ \"./node_modules/@formio/core/lib/utils/error.js\");\nconst conditions_1 = __webpack_require__(/*! ../conditions */ \"./node_modules/@formio/core/lib/process/conditions/index.js\");\n// Cleans up validation errors to remove unnessesary parts\n// and make them transferable to ivm.\nconst cleanupValidationError = (error) => (Object.assign(Object.assign({}, error), { context: (0, pick_1.default)(error.context, [\n 'component',\n 'path',\n 'index',\n 'value',\n 'field',\n 'hasLabel',\n 'processor',\n 'setting',\n 'pattern',\n 'length',\n 'min',\n 'max',\n 'maxDate',\n 'minDate',\n 'maxYear',\n 'minYear',\n 'minCount',\n 'maxCount',\n 'regex',\n ]) }));\nfunction validationRules(context, rules, skipValidation) {\n if (skipValidation && skipValidation(context)) {\n return [];\n }\n const validationRules = [];\n return rules.reduce((acc, rule) => {\n if (rule.shouldProcess && rule.shouldProcess(context)) {\n acc.push(rule);\n }\n return acc;\n }, validationRules);\n}\nexports.validationRules = validationRules;\nfunction isInputComponent(context) {\n const { component } = context;\n return !component.hasOwnProperty('input') || component.input;\n}\nexports.isInputComponent = isInputComponent;\nfunction isValueHidden(context) {\n const { component } = context;\n if (component.protected) {\n return false;\n }\n if ((component.hasOwnProperty('persistent') && !component.persistent) ||\n component.persistent === 'client-only') {\n return true;\n }\n return false;\n}\nexports.isValueHidden = isValueHidden;\nfunction isForcedHidden(context, isConditionallyHidden) {\n const { component } = context;\n if (isConditionallyHidden(context)) {\n return true;\n }\n if (component.hasOwnProperty('hidden')) {\n return !!component.hidden;\n }\n return false;\n}\nexports.isForcedHidden = isForcedHidden;\nconst _shouldSkipValidation = (context, isConditionallyHidden) => {\n var _a;\n const { component, scope, path } = context;\n if ((scope === null || scope === void 0 ? void 0 : scope.conditionals) &&\n ((0, find_1.default)(scope.conditionals, {\n path: (0, formUtil_1.getComponentPath)(component, path),\n conditionallyHidden: true,\n }) ||\n ((_a = component.ephermalState) === null || _a === void 0 ? void 0 : _a.conditionallyHidden) === true)) {\n return true;\n }\n const { validateWhenHidden = false } = component || {};\n const rules = [\n // Skip validation if component is readOnly\n // () => this.options.readOnly,\n // Do not check validations if component is not an input component.\n () => !isInputComponent(context),\n // Check to see if we are editing and if so, check component persistence.\n () => isValueHidden(context),\n // Force valid if component is hidden.\n () => isForcedHidden(context, isConditionallyHidden) && !validateWhenHidden,\n ];\n return rules.some((pred) => pred());\n};\nexports._shouldSkipValidation = _shouldSkipValidation;\nconst shouldSkipValidationCustom = (context) => {\n return (0, exports._shouldSkipValidation)(context, conditions_1.isCustomConditionallyHidden);\n};\nexports.shouldSkipValidationCustom = shouldSkipValidationCustom;\nconst shouldSkipValidationSimple = (context) => {\n return (0, exports._shouldSkipValidation)(context, conditions_1.isSimpleConditionallyHidden);\n};\nexports.shouldSkipValidationSimple = shouldSkipValidationSimple;\nconst shouldSkipValidation = (context) => {\n return (0, exports._shouldSkipValidation)(context, conditions_1.isConditionallyHidden);\n};\nexports.shouldSkipValidation = shouldSkipValidation;\nfunction shouldValidateAll(context) {\n return validationRules(context, rules_1.rules, exports.shouldSkipValidation).length > 0;\n}\nexports.shouldValidateAll = shouldValidateAll;\nfunction shouldValidateCustom(context) {\n const { component } = context;\n if (component.customConditional) {\n return true;\n }\n return !(0, exports.shouldSkipValidationCustom)(context);\n}\nexports.shouldValidateCustom = shouldValidateCustom;\nfunction shouldValidateServer(context) {\n const { component } = context;\n if (component.customConditional) {\n return false;\n }\n if ((0, exports.shouldSkipValidationSimple)(context)) {\n return false;\n }\n return shouldValidateAll(context);\n}\nexports.shouldValidateServer = shouldValidateServer;\nfunction handleError(error, context) {\n const { scope, component } = context;\n const absolutePath = (0, formUtil_1.getComponentAbsolutePath)(component);\n if (error) {\n const cleanedError = cleanupValidationError(error);\n cleanedError.context.path = absolutePath;\n if (!(0, find_1.default)(scope.errors, {\n errorKeyOrMessage: cleanedError.errorKeyOrMessage,\n context: {\n path: absolutePath,\n },\n })) {\n if (!scope.validated)\n scope.validated = [];\n if (!scope.errors)\n scope.errors = [];\n scope.errors.push(cleanedError);\n scope.validated.push({ path: absolutePath, error: cleanedError });\n }\n }\n}\nconst validateProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n const { component, data, row, path, instance, scope, rules, skipValidation } = context;\n let { value } = context;\n if (!scope.validated)\n scope.validated = [];\n if (!scope.errors)\n scope.errors = [];\n if (!rules || !rules.length) {\n return;\n }\n if (component.multiple && Array.isArray(value) && value.length > 0) {\n const fullValueRules = rules.filter((rule) => rule.fullValue);\n const otherRules = rules.filter((rule) => !rule.fullValue);\n for (let i = 0; i < value.length; i++) {\n const amendedPath = `${path}[${i}]`;\n let amendedValue = (0, get_1.default)(data, amendedPath);\n if (instance === null || instance === void 0 ? void 0 : instance.shouldSkipValidation(data)) {\n return;\n }\n const rulesToExecute = validationRules(context, otherRules, skipValidation);\n if (!rulesToExecute.length) {\n continue;\n }\n if (component.truncateMultipleSpaces && amendedValue && typeof amendedValue === 'string') {\n amendedValue = amendedValue.trim().replace(/\\s{2,}/g, ' ');\n }\n for (const rule of rulesToExecute) {\n if (rule && rule.process) {\n handleError(yield rule.process(Object.assign(Object.assign({}, context), { value: amendedValue, index: i, path: amendedPath })), context);\n }\n }\n }\n for (const rule of fullValueRules) {\n if (rule && rule.process) {\n handleError(yield rule.process(Object.assign(Object.assign({}, context), { value })), context);\n }\n }\n return;\n }\n if (instance === null || instance === void 0 ? void 0 : instance.shouldSkipValidation(data, row)) {\n return;\n }\n const rulesToExecute = validationRules(context, rules, skipValidation);\n if (!rulesToExecute.length) {\n return;\n }\n if (component.truncateMultipleSpaces && value && typeof value === 'string') {\n value = value.trim().replace(/\\s{2,}/g, ' ');\n }\n for (const rule of rulesToExecute) {\n try {\n if (rule && rule.process) {\n handleError(yield rule.process(Object.assign(Object.assign({}, context), { value })), context);\n }\n }\n catch (err) {\n console.error('Validator error:', (0, error_1.getErrorMessage)(err));\n }\n }\n return;\n});\nexports.validateProcess = validateProcess;\nconst validateProcessSync = (context) => {\n const { component, data, row, path, instance, scope, rules, skipValidation } = context;\n let { value } = context;\n if (!scope.validated)\n scope.validated = [];\n if (!scope.errors)\n scope.errors = [];\n if (!rules || !rules.length) {\n return;\n }\n if (component.multiple && Array.isArray(value) && value.length > 0) {\n const fullValueRules = rules.filter((rule) => rule.fullValue);\n const otherRules = rules.filter((rule) => !rule.fullValue);\n for (let i = 0; i < value.length; i++) {\n const amendedPath = `${path}[${i}]`;\n let amendedValue = (0, get_1.default)(data, amendedPath);\n if (instance === null || instance === void 0 ? void 0 : instance.shouldSkipValidation(data)) {\n return;\n }\n const rulesToExecute = validationRules(context, otherRules, skipValidation);\n if (!rulesToExecute.length) {\n continue;\n }\n if (component.truncateMultipleSpaces && amendedValue && typeof amendedValue === 'string') {\n amendedValue = amendedValue.trim().replace(/\\s{2,}/g, ' ');\n }\n for (const rule of rulesToExecute) {\n if (rule && rule.processSync) {\n handleError(rule.processSync(Object.assign(Object.assign({}, context), { value: amendedValue, index: i, path: amendedPath })), context);\n }\n }\n }\n for (const rule of fullValueRules) {\n if (rule && rule.processSync) {\n handleError(rule.processSync(Object.assign(Object.assign({}, context), { value })), context);\n }\n }\n return;\n }\n if (instance === null || instance === void 0 ? void 0 : instance.shouldSkipValidation(data, row)) {\n return;\n }\n const rulesToExecute = validationRules(context, rules, skipValidation);\n if (!rulesToExecute.length) {\n return;\n }\n if (component.truncateMultipleSpaces && value && typeof value === 'string') {\n value = value.trim().replace(/\\s{2,}/g, ' ');\n }\n for (const rule of rulesToExecute) {\n try {\n if (rule && rule.processSync) {\n handleError(rule.processSync(Object.assign(Object.assign({}, context), { value })), context);\n }\n }\n catch (err) {\n console.error('Validator error:', (0, error_1.getErrorMessage)(err));\n }\n }\n return;\n};\nexports.validateProcessSync = validateProcessSync;\nconst validateCustomProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n context.rules = context.rules || rules_1.evaluationRules;\n context.skipValidation = exports.shouldSkipValidationCustom;\n return (0, exports.validateProcess)(context);\n});\nexports.validateCustomProcess = validateCustomProcess;\nconst validateCustomProcessSync = (context) => {\n context.rules = context.rules || rules_1.evaluationRules;\n context.skipValidation = exports.shouldSkipValidationCustom;\n return (0, exports.validateProcessSync)(context);\n};\nexports.validateCustomProcessSync = validateCustomProcessSync;\nconst validateServerProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n context.rules = context.rules || rules_1.serverRules;\n context.skipValidation = exports.shouldSkipValidationSimple;\n return (0, exports.validateProcess)(context);\n});\nexports.validateServerProcess = validateServerProcess;\nconst validateServerProcessSync = (context) => {\n context.rules = context.rules || rules_1.serverRules;\n context.skipValidation = exports.shouldSkipValidationSimple;\n return (0, exports.validateProcessSync)(context);\n};\nexports.validateServerProcessSync = validateServerProcessSync;\nconst validateAllProcess = (context) => __awaiter(void 0, void 0, void 0, function* () {\n context.rules = context.rules || rules_1.rules;\n context.skipValidation = exports.shouldSkipValidation;\n return (0, exports.validateProcess)(context);\n});\nexports.validateAllProcess = validateAllProcess;\nconst validateAllProcessSync = (context) => {\n context.rules = context.rules || rules_1.rules;\n context.skipValidation = exports.shouldSkipValidation;\n return (0, exports.validateProcessSync)(context);\n};\nexports.validateAllProcessSync = validateAllProcessSync;\nexports.validateCustomProcessInfo = {\n name: 'validateCustom',\n process: exports.validateCustomProcess,\n processSync: exports.validateCustomProcessSync,\n shouldProcess: shouldValidateCustom,\n};\nexports.validateServerProcessInfo = {\n name: 'validateServer',\n process: exports.validateServerProcess,\n processSync: exports.validateServerProcessSync,\n shouldProcess: shouldValidateServer,\n};\nexports.validateProcessInfo = {\n name: 'validate',\n process: exports.validateAllProcess,\n processSync: exports.validateAllProcessSync,\n shouldProcess: shouldValidateAll,\n};\n__exportStar(__webpack_require__(/*! ./util */ \"./node_modules/@formio/core/lib/process/validation/util.js\"), exports);\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/index.js?");
|
294
294
|
|
295
295
|
/***/ }),
|
296
296
|
|
@@ -301,7 +301,7 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
|
|
301
301
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
302
302
|
|
303
303
|
"use strict";
|
304
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.asynchronousRules = void 0;\nconst validateUrlSelectValue_1 = __webpack_require__(/*! ./validateUrlSelectValue */ \"./node_modules/@formio/core/lib/process/validation/rules/validateUrlSelectValue.js\");\nconst validateAvailableItems_1 = __webpack_require__(/*! ./validateAvailableItems */ \"./node_modules/@formio/core/lib/process/validation/rules/validateAvailableItems.js\");\n// These are the validations that are asynchronouse (e.g. require fetch\nexports.asynchronousRules = [\n validateUrlSelectValue_1.validateUrlSelectValueInfo,\n validateAvailableItems_1.validateAvailableItemsInfo
|
304
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.asynchronousRules = void 0;\nconst validateUrlSelectValue_1 = __webpack_require__(/*! ./validateUrlSelectValue */ \"./node_modules/@formio/core/lib/process/validation/rules/validateUrlSelectValue.js\");\nconst validateAvailableItems_1 = __webpack_require__(/*! ./validateAvailableItems */ \"./node_modules/@formio/core/lib/process/validation/rules/validateAvailableItems.js\");\n// These are the validations that are asynchronouse (e.g. require fetch\nexports.asynchronousRules = [\n validateUrlSelectValue_1.validateUrlSelectValueInfo,\n validateAvailableItems_1.validateAvailableItemsInfo,\n];\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/asynchronousRules.js?");
|
305
305
|
|
306
306
|
/***/ }),
|
307
307
|
|
@@ -312,7 +312,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
312
312
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
313
313
|
|
314
314
|
"use strict";
|
315
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.clientRules = void 0;\nconst validateDate_1 = __webpack_require__(/*! ./validateDate */ \"./node_modules/@formio/core/lib/process/validation/rules/validateDate.js\");\nconst validateDay_1 = __webpack_require__(/*! ./validateDay */ \"./node_modules/@formio/core/lib/process/validation/rules/validateDay.js\");\nconst validateEmail_1 = __webpack_require__(/*! ./validateEmail */ \"./node_modules/@formio/core/lib/process/validation/rules/validateEmail.js\");\nconst validateJson_1 = __webpack_require__(/*! ./validateJson */ \"./node_modules/@formio/core/lib/process/validation/rules/validateJson.js\");\nconst validateMask_1 = __webpack_require__(/*! ./validateMask */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMask.js\");\nconst validateMaximumDay_1 = __webpack_require__(/*! ./validateMaximumDay */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumDay.js\");\nconst validateMaximumLength_1 = __webpack_require__(/*! ./validateMaximumLength */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumLength.js\");\nconst validateMaximumSelectedCount_1 = __webpack_require__(/*! ./validateMaximumSelectedCount */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumSelectedCount.js\");\nconst validateMaximumValue_1 = __webpack_require__(/*! ./validateMaximumValue */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumValue.js\");\nconst validateMaximumWords_1 = __webpack_require__(/*! ./validateMaximumWords */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumWords.js\");\nconst validateMaximumYear_1 = __webpack_require__(/*! ./validateMaximumYear */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumYear.js\");\nconst validateMinimumDay_1 = __webpack_require__(/*! ./validateMinimumDay */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumDay.js\");\nconst validateMinimumLength_1 = __webpack_require__(/*! ./validateMinimumLength */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumLength.js\");\nconst validateMinimumSelectedCount_1 = __webpack_require__(/*! ./validateMinimumSelectedCount */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumSelectedCount.js\");\nconst validateMinimumValue_1 = __webpack_require__(/*! ./validateMinimumValue */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumValue.js\");\nconst validateMinimumWords_1 = __webpack_require__(/*! ./validateMinimumWords */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumWords.js\");\nconst validateMinimumYear_1 = __webpack_require__(/*! ./validateMinimumYear */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumYear.js\");\nconst validateMultiple_1 = __webpack_require__(/*! ./validateMultiple */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMultiple.js\");\nconst validateRegexPattern_1 = __webpack_require__(/*! ./validateRegexPattern */ \"./node_modules/@formio/core/lib/process/validation/rules/validateRegexPattern.js\");\nconst validateRequired_1 = __webpack_require__(/*! ./validateRequired */ \"./node_modules/@formio/core/lib/process/validation/rules/validateRequired.js\");\nconst validateRequiredDay_1 = __webpack_require__(/*! ./validateRequiredDay */ \"./node_modules/@formio/core/lib/process/validation/rules/validateRequiredDay.js\");\nconst validateTime_1 = __webpack_require__(/*! ./validateTime */ \"./node_modules/@formio/core/lib/process/validation/rules/validateTime.js\");\nconst validateUrl_1 = __webpack_require__(/*! ./validateUrl */ \"./node_modules/@formio/core/lib/process/validation/rules/validateUrl.js\");\nconst validateValueProperty_1 = __webpack_require__(/*! ./validateValueProperty */ \"./node_modules/@formio/core/lib/process/validation/rules/validateValueProperty.js\");\nconst validateNumber_1 = __webpack_require__(/*! ./validateNumber */ \"./node_modules/@formio/core/lib/process/validation/rules/validateNumber.js\");\n// These are the validations that are performed in the client.\nexports.clientRules = [\n validateDate_1.validateDateInfo,\n validateDay_1.validateDayInfo,\n validateEmail_1.validateEmailInfo,\n validateJson_1.validateJsonInfo,\n validateMask_1.validateMaskInfo,\n validateMaximumDay_1.validateMaximumDayInfo,\n validateMaximumLength_1.validateMaximumLengthInfo,\n validateMaximumSelectedCount_1.validateMaximumSelectedCountInfo,\n validateMaximumValue_1.validateMaximumValueInfo,\n validateMaximumWords_1.validateMaximumWordsInfo,\n validateMaximumYear_1.validateMaximumYearInfo,\n validateMinimumDay_1.validateMinimumDayInfo,\n validateMinimumLength_1.validateMinimumLengthInfo,\n validateMinimumSelectedCount_1.validateMinimumSelectedCountInfo,\n validateMinimumValue_1.validateMinimumValueInfo,\n validateMinimumWords_1.validateMinimumWordsInfo,\n validateMinimumYear_1.validateMinimumYearInfo,\n validateMultiple_1.validateMultipleInfo,\n validateRegexPattern_1.validateRegexPatternInfo,\n validateRequired_1.validateRequiredInfo,\n validateRequiredDay_1.validateRequiredDayInfo,\n validateTime_1.validateTimeInfo,\n validateUrl_1.validateUrlInfo,\n validateValueProperty_1.validateValuePropertyInfo,\n validateNumber_1.validateNumberInfo
|
315
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.clientRules = void 0;\nconst validateDate_1 = __webpack_require__(/*! ./validateDate */ \"./node_modules/@formio/core/lib/process/validation/rules/validateDate.js\");\nconst validateDay_1 = __webpack_require__(/*! ./validateDay */ \"./node_modules/@formio/core/lib/process/validation/rules/validateDay.js\");\nconst validateEmail_1 = __webpack_require__(/*! ./validateEmail */ \"./node_modules/@formio/core/lib/process/validation/rules/validateEmail.js\");\nconst validateJson_1 = __webpack_require__(/*! ./validateJson */ \"./node_modules/@formio/core/lib/process/validation/rules/validateJson.js\");\nconst validateMask_1 = __webpack_require__(/*! ./validateMask */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMask.js\");\nconst validateMaximumDay_1 = __webpack_require__(/*! ./validateMaximumDay */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumDay.js\");\nconst validateMaximumLength_1 = __webpack_require__(/*! ./validateMaximumLength */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumLength.js\");\nconst validateMaximumSelectedCount_1 = __webpack_require__(/*! ./validateMaximumSelectedCount */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumSelectedCount.js\");\nconst validateMaximumValue_1 = __webpack_require__(/*! ./validateMaximumValue */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumValue.js\");\nconst validateMaximumWords_1 = __webpack_require__(/*! ./validateMaximumWords */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumWords.js\");\nconst validateMaximumYear_1 = __webpack_require__(/*! ./validateMaximumYear */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMaximumYear.js\");\nconst validateMinimumDay_1 = __webpack_require__(/*! ./validateMinimumDay */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumDay.js\");\nconst validateMinimumLength_1 = __webpack_require__(/*! ./validateMinimumLength */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumLength.js\");\nconst validateMinimumSelectedCount_1 = __webpack_require__(/*! ./validateMinimumSelectedCount */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumSelectedCount.js\");\nconst validateMinimumValue_1 = __webpack_require__(/*! ./validateMinimumValue */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumValue.js\");\nconst validateMinimumWords_1 = __webpack_require__(/*! ./validateMinimumWords */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumWords.js\");\nconst validateMinimumYear_1 = __webpack_require__(/*! ./validateMinimumYear */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMinimumYear.js\");\nconst validateMultiple_1 = __webpack_require__(/*! ./validateMultiple */ \"./node_modules/@formio/core/lib/process/validation/rules/validateMultiple.js\");\nconst validateRegexPattern_1 = __webpack_require__(/*! ./validateRegexPattern */ \"./node_modules/@formio/core/lib/process/validation/rules/validateRegexPattern.js\");\nconst validateRequired_1 = __webpack_require__(/*! ./validateRequired */ \"./node_modules/@formio/core/lib/process/validation/rules/validateRequired.js\");\nconst validateRequiredDay_1 = __webpack_require__(/*! ./validateRequiredDay */ \"./node_modules/@formio/core/lib/process/validation/rules/validateRequiredDay.js\");\nconst validateTime_1 = __webpack_require__(/*! ./validateTime */ \"./node_modules/@formio/core/lib/process/validation/rules/validateTime.js\");\nconst validateUrl_1 = __webpack_require__(/*! ./validateUrl */ \"./node_modules/@formio/core/lib/process/validation/rules/validateUrl.js\");\nconst validateValueProperty_1 = __webpack_require__(/*! ./validateValueProperty */ \"./node_modules/@formio/core/lib/process/validation/rules/validateValueProperty.js\");\nconst validateNumber_1 = __webpack_require__(/*! ./validateNumber */ \"./node_modules/@formio/core/lib/process/validation/rules/validateNumber.js\");\n// These are the validations that are performed in the client.\nexports.clientRules = [\n validateDate_1.validateDateInfo,\n validateDay_1.validateDayInfo,\n validateEmail_1.validateEmailInfo,\n validateJson_1.validateJsonInfo,\n validateMask_1.validateMaskInfo,\n validateMaximumDay_1.validateMaximumDayInfo,\n validateMaximumLength_1.validateMaximumLengthInfo,\n validateMaximumSelectedCount_1.validateMaximumSelectedCountInfo,\n validateMaximumValue_1.validateMaximumValueInfo,\n validateMaximumWords_1.validateMaximumWordsInfo,\n validateMaximumYear_1.validateMaximumYearInfo,\n validateMinimumDay_1.validateMinimumDayInfo,\n validateMinimumLength_1.validateMinimumLengthInfo,\n validateMinimumSelectedCount_1.validateMinimumSelectedCountInfo,\n validateMinimumValue_1.validateMinimumValueInfo,\n validateMinimumWords_1.validateMinimumWordsInfo,\n validateMinimumYear_1.validateMinimumYearInfo,\n validateMultiple_1.validateMultipleInfo,\n validateRegexPattern_1.validateRegexPatternInfo,\n validateRequired_1.validateRequiredInfo,\n validateRequiredDay_1.validateRequiredDayInfo,\n validateTime_1.validateTimeInfo,\n validateUrl_1.validateUrlInfo,\n validateValueProperty_1.validateValuePropertyInfo,\n validateNumber_1.validateNumberInfo,\n];\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/clientRules.js?");
|
316
316
|
|
317
317
|
/***/ }),
|
318
318
|
|
@@ -323,7 +323,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
323
323
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
324
324
|
|
325
325
|
"use strict";
|
326
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.databaseRules = void 0;\nconst validateUnique_1 = __webpack_require__(/*! ./validateUnique */ \"./node_modules/@formio/core/lib/process/validation/rules/validateUnique.js\");\nconst validateResourceSelectValue_1 = __webpack_require__(/*! ./validateResourceSelectValue */ \"./node_modules/@formio/core/lib/process/validation/rules/validateResourceSelectValue.js\");\n// These are the validations that require a database connection.\nexports.databaseRules = [\n validateUnique_1.validateUniqueInfo,\n validateResourceSelectValue_1.validateResourceSelectValueInfo
|
326
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.databaseRules = void 0;\nconst validateUnique_1 = __webpack_require__(/*! ./validateUnique */ \"./node_modules/@formio/core/lib/process/validation/rules/validateUnique.js\");\nconst validateResourceSelectValue_1 = __webpack_require__(/*! ./validateResourceSelectValue */ \"./node_modules/@formio/core/lib/process/validation/rules/validateResourceSelectValue.js\");\n// These are the validations that require a database connection.\nexports.databaseRules = [\n validateUnique_1.validateUniqueInfo,\n validateResourceSelectValue_1.validateResourceSelectValueInfo,\n];\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/databaseRules.js?");
|
327
327
|
|
328
328
|
/***/ }),
|
329
329
|
|
@@ -334,7 +334,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
334
334
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
335
335
|
|
336
336
|
"use strict";
|
337
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.evaluationRules = void 0;\nconst validateCustom_1 = __webpack_require__(/*! ./validateCustom */ \"./node_modules/@formio/core/lib/process/validation/rules/validateCustom.js\");\nconst validateAvailableItems_1 = __webpack_require__(/*! ./validateAvailableItems */ \"./node_modules/@formio/core/lib/process/validation/rules/validateAvailableItems.js\");\nexports.evaluationRules = [\n validateCustom_1.validateCustomInfo,\n validateAvailableItems_1.validateAvailableItemsInfo
|
337
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.evaluationRules = void 0;\nconst validateCustom_1 = __webpack_require__(/*! ./validateCustom */ \"./node_modules/@formio/core/lib/process/validation/rules/validateCustom.js\");\nconst validateAvailableItems_1 = __webpack_require__(/*! ./validateAvailableItems */ \"./node_modules/@formio/core/lib/process/validation/rules/validateAvailableItems.js\");\nexports.evaluationRules = [\n validateCustom_1.validateCustomInfo,\n validateAvailableItems_1.validateAvailableItemsInfo,\n];\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/evaluationRules.js?");
|
338
338
|
|
339
339
|
/***/ }),
|
340
340
|
|
@@ -356,7 +356,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
356
356
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
357
357
|
|
358
358
|
"use strict";
|
359
|
-
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.validateAvailableItemsInfo = exports.validateAvailableItemsSync = exports.shouldValidate = exports.validateAvailableItems = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst error_2 = __webpack_require__(/*! ../../../utils/error */ \"./node_modules/@formio/core/lib/utils/error.js\");\nfunction isValidatableRadioComponent(component) {\n var _a;\n return (component &&\n component.type === 'radio' &&\n !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.onlyAvailableItems));\n}\nfunction isValidateableSelectComponent(component) {\n var _a;\n return (component &&\n !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.onlyAvailableItems) &&\n component.type === 'select' &&\n component.dataSrc !== 'resource');\n}\nfunction isValidateableSelectBoxesComponent(component) {\n var _a;\n return (component &&\n !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.onlyAvailableItems) &&\n component.type === 'selectboxes' &&\n component.dataSrc === 'url');\n}\nfunction mapDynamicValues(component, values) {\n return values.map((value) => {\n if (component.valueProperty) {\n return value[component.valueProperty];\n }\n return value;\n });\n}\nfunction mapStaticValues(values) {\n return values.map((obj) => obj.value);\n}\nconst getAvailableDynamicValues = (component, context) => __awaiter(void 0, void 0, void 0, function* () {\n let _fetch = null;\n try {\n _fetch = context.fetch ? context.fetch : fetch;\n }\n catch (err) {\n _fetch = null;\n }\n try {\n if (!_fetch) {\n console.log('You must provide a fetch interface to the fetch processor.');\n return null;\n }\n const response = yield _fetch(component.data.url, { method: 'GET' });\n const data = yield response.json();\n return data ? mapDynamicValues(component, data) : null;\n }\n catch (err) {\n console.error((0, error_2.getErrorMessage)(err));\n return null;\n }\n});\nfunction getAvailableSelectValues(component, context) {\n return __awaiter(this, void 0, void 0, function* () {\n if ((0, lodash_1.isUndefined)(component.dataSrc) && component.data.hasOwnProperty('values')) {\n component.dataSrc = 'values';\n }\n ;\n switch (component.dataSrc) {\n case 'values':\n if (Array.isArray(component.data.values)) {\n return mapStaticValues(component.data.values);\n }\n throw new error_1.ProcessorError(`Failed to validate available values in static values select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n case 'json': {\n if (typeof component.data.json === 'string') {\n try {\n return mapDynamicValues(component, JSON.parse(component.data.json));\n }\n catch (err) {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': ${err}`, context, 'validate:validateAvailableItems');\n }\n }\n else if (Array.isArray(component.data.json)) {\n // TODO: need to retype this\n return mapDynamicValues(component, component.data.json);\n }\n else {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n }\n case 'custom':\n const customItems = utils_1.Evaluator.evaluate(component.data.custom, {\n values: [],\n }, 'values');\n if ((0, util_1.isPromise)(customItems)) {\n const resolvedCustomItems = yield customItems;\n if (Array.isArray(resolvedCustomItems)) {\n return resolvedCustomItems;\n }\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n if (Array.isArray(customItems)) {\n return customItems;\n }\n else {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n case 'url':\n return yield getAvailableDynamicValues(component, context);\n default:\n throw new error_1.ProcessorError(`Failed to validate available values in select component '${component.key}': data source ${component.dataSrc} is not valid}`, context, 'validate:validateAvailableItems');\n }\n });\n}\nfunction getAvailableSelectValuesSync(component, context) {\n var _a;\n if ((0, lodash_1.isUndefined)(component.dataSrc) && component.data.hasOwnProperty('values')) {\n component.dataSrc = 'values';\n }\n ;\n switch (component.dataSrc) {\n case 'values':\n if (Array.isArray((_a = component.data) === null || _a === void 0 ? void 0 : _a.values)) {\n return mapStaticValues(component.data.values);\n }\n throw new error_1.ProcessorError(`Failed to validate available values in static values select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n case 'json': {\n if (typeof component.data.json === 'string') {\n try {\n return mapDynamicValues(component, JSON.parse(component.data.json));\n }\n catch (err) {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': ${err}`, context, 'validate:validateAvailableItems');\n }\n }\n else if (Array.isArray(component.data.json)) {\n // TODO: need to retype this\n return mapDynamicValues(component, component.data.json);\n }\n else {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n }\n case 'custom':\n const customItems = utils_1.Evaluator.evaluate(component.data.custom, {\n values: [],\n }, 'values');\n if (Array.isArray(customItems)) {\n return customItems;\n }\n else {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n case 'url':\n return null;\n default:\n throw new error_1.ProcessorError(`Failed to validate available values in select component '${component.key}': data source ${component.dataSrc} is not valid}`, context, 'validate:validateAvailableItems');\n }\n}\nfunction compareComplexValues(valueA, valueB, context) {\n if (!(0, util_1.isObject)(valueA) || !(0, util_1.isObject)(valueB)) {\n return false;\n }\n try {\n // TODO: we need to have normalized values here at this moment, otherwise\n // this won't work\n return JSON.stringify(valueA) === JSON.stringify(valueB);\n }\n catch (err) {\n throw new error_1.ProcessorError(`Error while comparing available values: ${err}`, context, 'validate:validateAvailableItems');\n }\n}\nconst validateAvailableItems = (context) => __awaiter(void 0, void 0, void 0, function* () {\n const { component, value } = context;\n const error = new error_1.FieldError('invalidOption', context, 'onlyAvailableItems');\n try {\n if (isValidatableRadioComponent(component)) {\n if (value == null || (0, lodash_1.isEmpty)(value)) {\n return null;\n }\n const values = component.dataSrc === 'url' ? yield getAvailableDynamicValues(component, context) : component.values;\n if (values) {\n if ((0, util_1.isObject)(value)) {\n return values.find((optionValue) => compareComplexValues(optionValue, value, context)) !==\n undefined\n ? null\n : error;\n }\n return values.find((optionValue) => optionValue === value) !== undefined ? null : error;\n }\n return null;\n }\n else if (isValidateableSelectComponent(component)) {\n if (value == null || (0, lodash_1.isEmpty)(value)) {\n return null;\n }\n const values = yield getAvailableSelectValues(component, context);\n if (values) {\n if ((0, util_1.isObject)(value)) {\n return values.find((optionValue) => compareComplexValues(optionValue, value, context)) !==\n undefined\n ? null\n : error;\n }\n return values.find((optionValue) => optionValue === value) !== undefined ? null : error;\n }\n }\n else if (isValidateableSelectBoxesComponent(component)) {\n if (value == null || (0, lodash_1.isEmpty)(value)) {\n return null;\n }\n const values = yield getAvailableDynamicValues(component, context);\n if (values) {\n if ((0, util_1.isObject)(value)) {\n return values.find((optionValue) => compareComplexValues(optionValue, value, context)) !==\n undefined\n ? null\n : error;\n }\n return values.find((optionValue) => optionValue === value) !== undefined ? null : error;\n }\n }\n }\n catch (err) {\n throw new error_1.ProcessorError(err.message || err, context, 'validate:validateAvailableItems');\n }\n return null;\n});\nexports.validateAvailableItems = validateAvailableItems;\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (value == null || (0, lodash_1.isEmpty)(value)) {\n return false;\n }\n if (isValidatableRadioComponent(component)) {\n return true;\n }\n if (isValidateableSelectComponent(component)) {\n return true;\n }\n if (isValidateableSelectBoxesComponent(component)) {\n return true;\n }\n return false;\n};\nexports.shouldValidate = shouldValidate;\nconst validateAvailableItemsSync = (context) => {\n const { component, value } = context;\n const error = new error_1.FieldError('invalidOption', context, 'onlyAvailableItems');\n try {\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (isValidatableRadioComponent(component) && component.dataSrc !== 'url') {\n const values = component.values;\n if (values) {\n return values.findIndex(({ value: optionValue }) => optionValue === value) !== -1\n ? null\n : error;\n }\n return null;\n }\n else if (isValidateableSelectComponent(component)) {\n const values = getAvailableSelectValuesSync(component, context);\n if (values) {\n if ((0, util_1.isObject)(value)) {\n return values.find((optionValue) => compareComplexValues(optionValue, value, context)) !==\n undefined\n ? null\n : error;\n }\n return values.find((optionValue) => optionValue === value) !== undefined ? null : error;\n }\n }\n }\n catch (err) {\n throw new error_1.ProcessorError(err.message || err, context, 'validate:validateAvailableItems');\n }\n return null;\n};\nexports.validateAvailableItemsSync = validateAvailableItemsSync;\nexports.validateAvailableItemsInfo = {\n name: 'validateAvailableItems',\n process: exports.validateAvailableItems,\n processSync: exports.validateAvailableItemsSync,\n shouldProcess: exports.shouldValidate\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateAvailableItems.js?");
|
359
|
+
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.validateAvailableItemsInfo = exports.validateAvailableItemsSync = exports.shouldValidate = exports.validateAvailableItems = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst error_2 = __webpack_require__(/*! ../../../utils/error */ \"./node_modules/@formio/core/lib/utils/error.js\");\nfunction isValidatableRadioComponent(component) {\n var _a;\n return component && component.type === 'radio' && !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.onlyAvailableItems);\n}\nfunction isValidateableSelectComponent(component) {\n var _a;\n return (component &&\n !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.onlyAvailableItems) &&\n component.type === 'select' &&\n component.dataSrc !== 'resource');\n}\nfunction isValidateableSelectBoxesComponent(component) {\n var _a;\n return (component &&\n !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.onlyAvailableItems) &&\n component.type === 'selectboxes' &&\n component.dataSrc === 'url');\n}\nfunction mapDynamicValues(component, values) {\n return values.map((value) => {\n if (component.valueProperty) {\n return value[component.valueProperty];\n }\n return value;\n });\n}\nfunction mapStaticValues(values) {\n return values.map((obj) => obj.value);\n}\nconst getAvailableDynamicValues = (component, context) => __awaiter(void 0, void 0, void 0, function* () {\n let _fetch = null;\n try {\n _fetch = context.fetch ? context.fetch : fetch;\n }\n catch (ignoreErr) {\n _fetch = null;\n }\n try {\n if (!_fetch) {\n console.log('You must provide a fetch interface to the fetch processor.');\n return null;\n }\n const response = yield _fetch(component.data.url, { method: 'GET' });\n const data = yield response.json();\n return data ? mapDynamicValues(component, data) : null;\n }\n catch (err) {\n console.error((0, error_2.getErrorMessage)(err));\n return null;\n }\n});\nfunction getAvailableSelectValues(component, context) {\n return __awaiter(this, void 0, void 0, function* () {\n if ((0, lodash_1.isUndefined)(component.dataSrc) && component.data.hasOwnProperty('values')) {\n component.dataSrc = 'values';\n }\n switch (component.dataSrc) {\n case 'values':\n if (Array.isArray(component.data.values)) {\n return mapStaticValues(component.data.values);\n }\n throw new error_1.ProcessorError(`Failed to validate available values in static values select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n case 'json': {\n if (typeof component.data.json === 'string') {\n try {\n return mapDynamicValues(component, JSON.parse(component.data.json));\n }\n catch (err) {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': ${err}`, context, 'validate:validateAvailableItems');\n }\n }\n else if (Array.isArray(component.data.json)) {\n // TODO: need to retype this\n return mapDynamicValues(component, component.data.json);\n }\n else {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n }\n case 'custom': {\n const customItems = utils_1.Evaluator.evaluate(component.data.custom, {\n values: [],\n }, 'values');\n if ((0, util_1.isPromise)(customItems)) {\n const resolvedCustomItems = yield customItems;\n if (Array.isArray(resolvedCustomItems)) {\n return resolvedCustomItems;\n }\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n if (Array.isArray(customItems)) {\n return customItems;\n }\n else {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n }\n case 'url':\n return yield getAvailableDynamicValues(component, context);\n default:\n throw new error_1.ProcessorError(`Failed to validate available values in select component '${component.key}': data source ${component.dataSrc} is not valid}`, context, 'validate:validateAvailableItems');\n }\n });\n}\nfunction getAvailableSelectValuesSync(component, context) {\n var _a;\n if ((0, lodash_1.isUndefined)(component.dataSrc) && component.data.hasOwnProperty('values')) {\n component.dataSrc = 'values';\n }\n switch (component.dataSrc) {\n case 'values':\n if (Array.isArray((_a = component.data) === null || _a === void 0 ? void 0 : _a.values)) {\n return mapStaticValues(component.data.values);\n }\n throw new error_1.ProcessorError(`Failed to validate available values in static values select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n case 'json': {\n if (typeof component.data.json === 'string') {\n try {\n return mapDynamicValues(component, JSON.parse(component.data.json));\n }\n catch (err) {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': ${err}`, context, 'validate:validateAvailableItems');\n }\n }\n else if (Array.isArray(component.data.json)) {\n // TODO: need to retype this\n return mapDynamicValues(component, component.data.json);\n }\n else {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n }\n case 'custom': {\n const customItems = utils_1.Evaluator.evaluate(component.data.custom, {\n values: [],\n }, 'values');\n if (Array.isArray(customItems)) {\n return customItems;\n }\n else {\n throw new error_1.ProcessorError(`Failed to validate available values in JSON select component '${component.key}': the values are not an array`, context, 'validate:validateAvailableItems');\n }\n }\n case 'url':\n return null;\n default:\n throw new error_1.ProcessorError(`Failed to validate available values in select component '${component.key}': data source ${component.dataSrc} is not valid}`, context, 'validate:validateAvailableItems');\n }\n}\nfunction compareComplexValues(valueA, valueB, context) {\n if (!(0, util_1.isObject)(valueA) || !(0, util_1.isObject)(valueB)) {\n return false;\n }\n try {\n // TODO: we need to have normalized values here at this moment, otherwise\n // this won't work\n return JSON.stringify(valueA) === JSON.stringify(valueB);\n }\n catch (err) {\n throw new error_1.ProcessorError(`Error while comparing available values: ${err}`, context, 'validate:validateAvailableItems');\n }\n}\nconst validateAvailableItems = (context) => __awaiter(void 0, void 0, void 0, function* () {\n const { component, value } = context;\n const error = new error_1.FieldError('invalidOption', context, 'onlyAvailableItems');\n try {\n if (isValidatableRadioComponent(component)) {\n if (value == null || (0, lodash_1.isEmpty)(value)) {\n return null;\n }\n const values = component.dataSrc === 'url'\n ? yield getAvailableDynamicValues(component, context)\n : component.values;\n if (values) {\n if ((0, util_1.isObject)(value)) {\n return values.find((optionValue) => compareComplexValues(optionValue, value, context)) !==\n undefined\n ? null\n : error;\n }\n return values.find((optionValue) => optionValue.value === value || optionValue === value) !== undefined\n ? null\n : error;\n }\n return null;\n }\n else if (isValidateableSelectComponent(component)) {\n if (value == null || (0, lodash_1.isEmpty)(value)) {\n return null;\n }\n const values = yield getAvailableSelectValues(component, context);\n if (values) {\n if ((0, util_1.isObject)(value)) {\n return values.find((optionValue) => compareComplexValues(optionValue, value, context)) !==\n undefined\n ? null\n : error;\n }\n return values.find((optionValue) => optionValue === value) !== undefined ? null : error;\n }\n }\n else if (isValidateableSelectBoxesComponent(component)) {\n if (value == null || (0, lodash_1.isEmpty)(value)) {\n return null;\n }\n const values = yield getAvailableDynamicValues(component, context);\n if (values) {\n if ((0, util_1.isObject)(value)) {\n return values.find((optionValue) => compareComplexValues(optionValue, value, context)) !==\n undefined\n ? null\n : error;\n }\n return values.find((optionValue) => optionValue === value) !== undefined ? null : error;\n }\n }\n }\n catch (err) {\n throw new error_1.ProcessorError(err.message || err, context, 'validate:validateAvailableItems');\n }\n return null;\n});\nexports.validateAvailableItems = validateAvailableItems;\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (value == null || (0, lodash_1.isEmpty)(value)) {\n return false;\n }\n if (isValidatableRadioComponent(component)) {\n return true;\n }\n if (isValidateableSelectComponent(component)) {\n return true;\n }\n if (isValidateableSelectBoxesComponent(component)) {\n return true;\n }\n return false;\n};\nexports.shouldValidate = shouldValidate;\nconst validateAvailableItemsSync = (context) => {\n const { component, value } = context;\n const error = new error_1.FieldError('invalidOption', context, 'onlyAvailableItems');\n try {\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (isValidatableRadioComponent(component) && component.dataSrc !== 'url') {\n const values = component.values;\n if (values) {\n return values.findIndex(({ value: optionValue }) => optionValue === value) !== -1\n ? null\n : error;\n }\n return null;\n }\n else if (isValidateableSelectComponent(component)) {\n const values = getAvailableSelectValuesSync(component, context);\n if (values) {\n if ((0, util_1.isObject)(value)) {\n return values.find((optionValue) => compareComplexValues(optionValue, value, context)) !==\n undefined\n ? null\n : error;\n }\n return values.find((optionValue) => optionValue === value) !== undefined ? null : error;\n }\n }\n }\n catch (err) {\n throw new error_1.ProcessorError(err.message || err, context, 'validate:validateAvailableItems');\n }\n return null;\n};\nexports.validateAvailableItemsSync = validateAvailableItemsSync;\nexports.validateAvailableItemsInfo = {\n name: 'validateAvailableItems',\n process: exports.validateAvailableItems,\n processSync: exports.validateAvailableItemsSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateAvailableItems.js?");
|
360
360
|
|
361
361
|
/***/ }),
|
362
362
|
|
@@ -367,7 +367,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
367
367
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
368
368
|
|
369
369
|
"use strict";
|
370
|
-
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.validateCustomInfo = exports.validateCustomSync = exports.shouldValidate = exports.validateCustom = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst validateCustom = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateCustomSync)(context);\n});\nexports.validateCustom = validateCustom;\nconst shouldValidate = (context) => {\n var _a;\n const { component } = context;\n const customValidation = (_a = component.validate) === null || _a === void 0 ? void 0 : _a.custom;\n if (!customValidation) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateCustomSync = (context) => {\n var _a;\n const { component, data, row, value, index, instance, evalContext } = context;\n const customValidation = (_a = component.validate) === null || _a === void 0 ? void 0 : _a.custom;\n try {\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const evalContextValue = Object.assign(Object.assign({}, ((instance === null || instance === void 0 ? void 0 : instance.evalContext)
|
370
|
+
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.validateCustomInfo = exports.validateCustomSync = exports.shouldValidate = exports.validateCustom = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst validateCustom = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateCustomSync)(context);\n});\nexports.validateCustom = validateCustom;\nconst shouldValidate = (context) => {\n var _a;\n const { component } = context;\n const customValidation = (_a = component.validate) === null || _a === void 0 ? void 0 : _a.custom;\n if (!customValidation) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateCustomSync = (context) => {\n var _a;\n const { component, data, row, value, index, instance, evalContext } = context;\n const customValidation = (_a = component.validate) === null || _a === void 0 ? void 0 : _a.custom;\n try {\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const evalContextValue = Object.assign(Object.assign({}, ((instance === null || instance === void 0 ? void 0 : instance.evalContext)\n ? instance.evalContext()\n : evalContext\n ? evalContext(context)\n : context)), { component,\n data,\n row, rowIndex: index, instance, valid: true, input: value });\n const isValid = utils_1.Evaluator.evaluate(customValidation, evalContextValue, 'valid', true, {}, {});\n if (isValid === null || isValid === true) {\n return null;\n }\n return new error_1.FieldError(typeof isValid === 'string' ? isValid : 'custom', Object.assign(Object.assign({}, context), { hasLabel: false, setting: customValidation }), 'custom');\n }\n catch (err) {\n throw new error_1.ProcessorError(err.message || err, context, 'validate:validateCustom');\n }\n};\nexports.validateCustomSync = validateCustomSync;\nexports.validateCustomInfo = {\n name: 'validateCustom',\n process: exports.validateCustom,\n processSync: exports.validateCustomSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateCustom.js?");
|
371
371
|
|
372
372
|
/***/ }),
|
373
373
|
|
@@ -378,7 +378,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
378
378
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
379
379
|
|
380
380
|
"use strict";
|
381
|
-
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.validateDateInfo = exports.validateDateSync = exports.validateDate = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableDateTimeComponent = (obj) => {\n return !!obj && !!obj.type && obj.type === 'datetime';\n};\nconst isValidatable = (component) => {\n return isValidatableDateTimeComponent(component);\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!value || !isValidatable(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateDate = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateDateSync)(context);\n});\nexports.validateDate = validateDate;\nconst validateDateSync = (context) => {\n const error = new error_1.FieldError('invalidDate', context, 'date');\n const {
|
381
|
+
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.validateDateInfo = exports.validateDateSync = exports.validateDate = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableDateTimeComponent = (obj) => {\n return !!obj && !!obj.type && obj.type === 'datetime';\n};\nconst isValidatable = (component) => {\n return isValidatableDateTimeComponent(component);\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!value || !isValidatable(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateDate = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateDateSync)(context);\n});\nexports.validateDate = validateDate;\nconst validateDateSync = (context) => {\n const error = new error_1.FieldError('invalidDate', context, 'date');\n const { value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n // TODO: is this right?\n if (typeof value === 'string') {\n if (value.toLowerCase() === 'invalid date') {\n return error;\n }\n if (new Date(value).toString() === 'Invalid Date') {\n return error;\n }\n return null;\n }\n else if (value instanceof Date) {\n return value.toString() !== 'Invalid Date' ? null : error;\n }\n return error;\n};\nexports.validateDateSync = validateDateSync;\nexports.validateDateInfo = {\n name: 'validateDate',\n process: exports.validateDate,\n processSync: exports.validateDateSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateDate.js?");
|
382
382
|
|
383
383
|
/***/ }),
|
384
384
|
|
@@ -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) || !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
|
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 if (component.fields.month.hide) {\n DAY = DAY === 0 ? 0 : DAY - 1;\n YEAR = YEAR - 1;\n day = component.fields.day.hide && day === 0 ? 0 : values[DAY];\n month = 0;\n year = values[YEAR];\n }\n if (component.fields.year.hide) {\n day = component.fields.day.hide && day === 0 ? 0 : values[DAY];\n month = component.fields.month.hide && month === 0 ? 0 : values[MONTH];\n year = 0;\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
|
|
@@ -400,7 +400,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
400
400
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
401
401
|
|
402
402
|
"use strict";
|
403
|
-
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.validateEmailInfo = exports.validateEmailSync = exports.validateEmail = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableEmailComponent = (component) => {\n return component && component.type === 'email';\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!value) {\n return false;\n }\n if (!isValidatableEmailComponent(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateEmail = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateEmailSync)(context);\n});\nexports.validateEmail = validateEmail;\nconst validateEmailSync = (context) => {\n const error = new error_1.FieldError('invalid_email', context, 'email');\n const { value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n // From http://stackoverflow.com/questions/46155/validate-email-address-in-javascript\n const emailRegex = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n // Allow emails to be valid if the component is pristine and no value is provided.\n if (typeof value === 'string' && !emailRegex.test(value)) {\n return error;\n }\n return null;\n};\nexports.validateEmailSync = validateEmailSync;\nexports.validateEmailInfo = {\n name: 'validateEmail',\n process: exports.validateEmail,\n processSync: exports.validateEmailSync,\n shouldProcess: exports.shouldValidate
|
403
|
+
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.validateEmailInfo = exports.validateEmailSync = exports.validateEmail = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableEmailComponent = (component) => {\n return component && component.type === 'email';\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!value) {\n return false;\n }\n if (!isValidatableEmailComponent(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateEmail = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateEmailSync)(context);\n});\nexports.validateEmail = validateEmail;\nconst validateEmailSync = (context) => {\n const error = new error_1.FieldError('invalid_email', context, 'email');\n const { value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n // From http://stackoverflow.com/questions/46155/validate-email-address-in-javascript\n const emailRegex = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n // Allow emails to be valid if the component is pristine and no value is provided.\n if (typeof value === 'string' && !emailRegex.test(value)) {\n return error;\n }\n return null;\n};\nexports.validateEmailSync = validateEmailSync;\nexports.validateEmailInfo = {\n name: 'validateEmail',\n process: exports.validateEmail,\n processSync: exports.validateEmailSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateEmail.js?");
|
404
404
|
|
405
405
|
/***/ }),
|
406
406
|
|
@@ -411,7 +411,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
411
411
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
412
412
|
|
413
413
|
"use strict";
|
414
|
-
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.validateJsonInfo = exports.validateJsonSync = exports.validateJson = exports.shouldValidate = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../../../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst shouldValidate = (context) => {\n var _a;\n const { component } = context;\n if (!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.json) || !(0, lodash_1.isObject)(component.validate.json)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateJson = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateJsonSync)(context);\n});\nexports.validateJson = validateJson;\nconst validateJsonSync = (context) => {\n var _a;\n const { component,
|
414
|
+
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.validateJsonInfo = exports.validateJsonSync = exports.validateJson = exports.shouldValidate = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../../../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst shouldValidate = (context) => {\n var _a;\n const { component } = context;\n if (!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.json) || !(0, lodash_1.isObject)(component.validate.json)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateJson = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateJsonSync)(context);\n});\nexports.validateJson = validateJson;\nconst validateJsonSync = (context) => {\n var _a;\n const { component, value, evalContext } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const func = (_a = component === null || component === void 0 ? void 0 : component.validate) === null || _a === void 0 ? void 0 : _a.json;\n const evalContextValue = evalContext ? evalContext(context) : context;\n evalContextValue.value = value || null;\n const valid = jsonlogic_1.JSONLogicEvaluator.evaluate(func, Object.assign(Object.assign({}, evalContextValue), { input: value }), 'valid');\n if (valid === null) {\n return null;\n }\n return valid === true\n ? null\n : new error_1.FieldError(valid || 'jsonLogic', Object.assign(Object.assign({}, context), { setting: func }), 'json');\n};\nexports.validateJsonSync = validateJsonSync;\nexports.validateJsonInfo = {\n name: 'validateJson',\n process: exports.validateJson,\n processSync: exports.validateJsonSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateJson.js?");
|
415
415
|
|
416
416
|
/***/ }),
|
417
417
|
|
@@ -422,7 +422,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
422
422
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
423
423
|
|
424
424
|
"use strict";
|
425
|
-
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateMaskInfo = exports.validateMaskSync = exports.validateMask = exports.shouldValidate = exports.matchInputMask = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst inputmask_1 = __importDefault(__webpack_require__(/*! inputmask */ \"./node_modules/@formio/core/node_modules/inputmask/dist/inputmask.js\"));\nconst isMaskType = (obj) => {\n return ((obj === null || obj === void 0 ? void 0 : obj.maskName) &&\n typeof (obj === null || obj === void 0 ? void 0 : obj.maskName) === 'string' &&\n (obj === null || obj === void 0 ? void 0 : obj.value) &&\n typeof (obj === null || obj === void 0 ? void 0 : obj.value) === 'string');\n};\nconst isValidatableComponent = (component) => {\n // For some reason we skip mask validation for time components\n return ((component
|
425
|
+
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateMaskInfo = exports.validateMaskSync = exports.validateMask = exports.shouldValidate = exports.matchInputMask = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst inputmask_1 = __importDefault(__webpack_require__(/*! inputmask */ \"./node_modules/@formio/core/node_modules/inputmask/dist/inputmask.js\"));\nconst isMaskType = (obj) => {\n return ((obj === null || obj === void 0 ? void 0 : obj.maskName) &&\n typeof (obj === null || obj === void 0 ? void 0 : obj.maskName) === 'string' &&\n (obj === null || obj === void 0 ? void 0 : obj.value) &&\n typeof (obj === null || obj === void 0 ? void 0 : obj.value) === 'string');\n};\nconst isValidatableComponent = (component) => {\n // For some reason we skip mask validation for time components\n return ((component &&\n component.type &&\n component.type !== 'time' &&\n component &&\n component.hasOwnProperty('inputMask') &&\n !!component.inputMask) ||\n (component && component.hasOwnProperty('inputMasks') && !(0, lodash_1.isEmpty)(component.inputMasks)));\n};\nfunction getMaskByLabel(component, maskName) {\n var _a;\n if (maskName) {\n const inputMask = (_a = component.inputMasks) === null || _a === void 0 ? void 0 : _a.find((inputMask) => {\n return inputMask.label === maskName;\n });\n return inputMask ? inputMask.mask : undefined;\n }\n return;\n}\nfunction getInputMask(mask, placeholderChar) {\n if (mask instanceof Array) {\n return mask;\n }\n const maskArray = [];\n for (let i = 0; i < mask.length; i++) {\n switch (mask[i]) {\n case '9':\n maskArray.push(/\\d/);\n break;\n case 'A':\n maskArray.push(/[a-zA-Z]/);\n break;\n case 'a':\n maskArray.push(/[a-z]/);\n break;\n case '*':\n maskArray.push(/[a-zA-Z0-9]/);\n break;\n // If char which is used inside mask placeholder was used in the mask, replace it with space to prevent errors\n case placeholderChar:\n maskArray.push(' ');\n break;\n default:\n maskArray.push(mask[i]);\n break;\n }\n }\n return maskArray;\n}\nfunction matchInputMask(value, inputMask) {\n if (!inputMask) {\n return true;\n }\n // If value is longer than mask, it isn't valid.\n if (value.length > inputMask.length) {\n return false;\n }\n for (let i = 0; i < inputMask.length; i++) {\n const char = value[i];\n const charPart = inputMask[i];\n if (charPart instanceof RegExp) {\n if (!charPart.test(char)) {\n return false;\n }\n continue;\n }\n else if (charPart !== char) {\n return false;\n }\n }\n return true;\n}\nexports.matchInputMask = matchInputMask;\nconst shouldValidate = (context) => {\n var _a;\n const { component, value } = context;\n if (!isValidatableComponent(component) || !value) {\n return false;\n }\n if (value == null) {\n return false;\n }\n if (component.allowMultipleMasks && ((_a = component.inputMasks) === null || _a === void 0 ? void 0 : _a.length)) {\n const mask = value && isMaskType(value) ? value : undefined;\n const formioInputMask = getMaskByLabel(component, mask === null || mask === void 0 ? void 0 : mask.maskName);\n if (formioInputMask && !getInputMask(formioInputMask)) {\n return false;\n }\n }\n else if (!getInputMask(component.inputMask || '')) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMask = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMaskSync)(context);\n});\nexports.validateMask = validateMask;\n// TODO: this function has side effects\nconst validateMaskSync = (context) => {\n var _a;\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n let inputMask;\n let maskValue;\n if (component.allowMultipleMasks && ((_a = component.inputMasks) === null || _a === void 0 ? void 0 : _a.length)) {\n const mask = value && isMaskType(value) ? value : undefined;\n const formioInputMask = getMaskByLabel(component, mask === null || mask === void 0 ? void 0 : mask.maskName);\n if (formioInputMask) {\n inputMask = formioInputMask;\n }\n maskValue = mask === null || mask === void 0 ? void 0 : mask.value;\n }\n else {\n inputMask = component.inputMask || '';\n }\n if (!inputMask) {\n return null;\n }\n if (value && inputMask && typeof value === 'string' && component.type === 'textfield') {\n return inputmask_1.default.isValid(value, { mask: inputMask.toString() })\n ? null\n : new error_1.FieldError('mask', context);\n }\n const inputMaskArr = getInputMask(inputMask);\n if (value != null && inputMaskArr) {\n const error = new error_1.FieldError('mask', context);\n return matchInputMask(maskValue || value, inputMaskArr) ? null : error;\n }\n return null;\n};\nexports.validateMaskSync = validateMaskSync;\nexports.validateMaskInfo = {\n name: 'validateMask',\n process: exports.validateMask,\n processSync: exports.validateMaskSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateMask.js?");
|
426
426
|
|
427
427
|
/***/ }),
|
428
428
|
|
@@ -444,7 +444,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
444
444
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
445
445
|
|
446
446
|
"use strict";
|
447
|
-
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.validateMaximumLengthInfo = exports.validateMaximumLengthSync = exports.validateMaximumLength = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableTextFieldComponent = (component) => {\n var _a;\n return component && ((_a = component.validate) === null || _a === void 0 ? void 0 : _a.hasOwnProperty('maxLength'));\n};\nconst getValidationSetting = (component) => {\n var _a;\n let maxLength = (_a = component.validate) === null || _a === void 0 ? void 0 : _a.maxLength;\n maxLength =
|
447
|
+
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.validateMaximumLengthInfo = exports.validateMaximumLengthSync = exports.validateMaximumLength = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableTextFieldComponent = (component) => {\n var _a;\n return component && ((_a = component.validate) === null || _a === void 0 ? void 0 : _a.hasOwnProperty('maxLength'));\n};\nconst getValidationSetting = (component) => {\n var _a;\n let maxLength = (_a = component.validate) === null || _a === void 0 ? void 0 : _a.maxLength;\n maxLength = typeof maxLength === 'string' ? parseInt(maxLength, 10) : maxLength;\n return maxLength;\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!isValidatableTextFieldComponent(component)) {\n return false;\n }\n if (!value) {\n return false;\n }\n if (typeof value !== 'string') {\n return false;\n }\n const setting = getValidationSetting(component);\n if (setting === undefined) {\n return false;\n }\n if (!setting || Number.isNaN(setting)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMaximumLength = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMaximumLengthSync)(context);\n});\nexports.validateMaximumLength = validateMaximumLength;\nconst validateMaximumLengthSync = (context) => {\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const maxLength = getValidationSetting(component);\n if (maxLength === undefined || Number.isNaN(maxLength)) {\n return null;\n }\n if (!value || typeof value !== 'string') {\n return null;\n }\n if (value.length > maxLength) {\n const error = new error_1.FieldError('maxLength', Object.assign(Object.assign({}, context), { length: String(maxLength), setting: String(maxLength) }));\n return error;\n }\n return null;\n};\nexports.validateMaximumLengthSync = validateMaximumLengthSync;\nexports.validateMaximumLengthInfo = {\n name: 'validateMaximumLength',\n process: exports.validateMaximumLength,\n processSync: exports.validateMaximumLengthSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateMaximumLength.js?");
|
448
448
|
|
449
449
|
/***/ }),
|
450
450
|
|
@@ -565,7 +565,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
565
565
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
566
566
|
|
567
567
|
"use strict";
|
568
|
-
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.validateMultipleInfo = exports.validateMultipleSync = exports.validateMultiple = exports.shouldValidate = exports.emptyValueIsArray = exports.isEligible = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst isEligible = (component) => {\n // TODO: would be nice if this was type safe\n switch (component.type) {\n case 'hidden':\n case 'address':\n if (!component.multiple) {\n return false;\n }\n return true;\n case 'textarea':\n if (!component.as ||\n component.as !== 'json' ||\n (component.as === 'json' && !component.multiple)) {\n return false;\n }\n return true;\n // TODO: For backwards compatibility, skip multiple validation for select components until we can investigate\n // how this validation might break existing forms\n case 'select':\n return false;\n default:\n return true;\n }\n};\nexports.isEligible = isEligible;\nconst isTagsComponent = (component) => {\n return (component === null || component === void 0 ? void 0 : component.type) === 'tags';\n};\nconst emptyValueIsArray = (component) => {\n // TODO: How do we infer the data model of the compoennt given only its JSON? For now, we have to hardcode component types\n switch (component.type) {\n case 'datagrid':\n case 'editgrid':\n case 'tagpad':\n case 'sketchpad':\n case 'datatable':\n case 'dynamicWizard':\n case 'file':\n return true;\n case 'select':\n case 'textfield':\n return !!component.multiple;\n case 'tags':\n return component.storeas !== 'string';\n default:\n return true;\n }\n};\nexports.emptyValueIsArray = emptyValueIsArray;\nconst shouldValidate = (context) => {\n const { component } = context;\n if (!(0, exports.isEligible)(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMultiple = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMultipleSync)(context);\n});\nexports.validateMultiple = validateMultiple;\nconst validateMultipleSync = (context) => {\n var _a;\n const { component, value } = context;\n // Skip multiple validation if the component tells us to\n if (!(0, exports.isEligible)(component)) {\n return null;\n }\n const shouldBeMultipleArray = !!component.multiple;\n const isRequired = !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.required);\n const compModelType = (0, formUtil_1.getModelType)(component);\n const underlyingValueShouldBeArray = ['nestedArray', 'nestedDataArray'].indexOf(compModelType) !== -1
|
568
|
+
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.validateMultipleInfo = exports.validateMultipleSync = exports.validateMultiple = exports.shouldValidate = exports.emptyValueIsArray = exports.isEligible = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst isEligible = (component) => {\n // TODO: would be nice if this was type safe\n switch (component.type) {\n case 'hidden':\n case 'address':\n if (!component.multiple) {\n return false;\n }\n return true;\n case 'textarea':\n if (!component.as ||\n component.as !== 'json' ||\n (component.as === 'json' && !component.multiple)) {\n return false;\n }\n return true;\n // TODO: For backwards compatibility, skip multiple validation for select components until we can investigate\n // how this validation might break existing forms\n case 'select':\n return false;\n default:\n return true;\n }\n};\nexports.isEligible = isEligible;\nconst isTagsComponent = (component) => {\n return (component === null || component === void 0 ? void 0 : component.type) === 'tags';\n};\nconst emptyValueIsArray = (component) => {\n // TODO: How do we infer the data model of the compoennt given only its JSON? For now, we have to hardcode component types\n switch (component.type) {\n case 'datagrid':\n case 'editgrid':\n case 'tagpad':\n case 'sketchpad':\n case 'datatable':\n case 'dynamicWizard':\n case 'file':\n return true;\n case 'select':\n case 'textfield':\n return !!component.multiple;\n case 'tags':\n return component.storeas !== 'string';\n default:\n return true;\n }\n};\nexports.emptyValueIsArray = emptyValueIsArray;\nconst shouldValidate = (context) => {\n const { component } = context;\n if (!(0, exports.isEligible)(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateMultiple = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateMultipleSync)(context);\n});\nexports.validateMultiple = validateMultiple;\nconst validateMultipleSync = (context) => {\n var _a;\n const { component, value } = context;\n // Skip multiple validation if the component tells us to\n if (!(0, exports.isEligible)(component)) {\n return null;\n }\n const shouldBeMultipleArray = !!component.multiple;\n const isRequired = !!((_a = component.validate) === null || _a === void 0 ? void 0 : _a.required);\n const compModelType = (0, formUtil_1.getModelType)(component);\n const underlyingValueShouldBeArray = ['nestedArray', 'nestedDataArray'].indexOf(compModelType) !== -1 ||\n (isTagsComponent(component) && component.storeas === 'array');\n const valueIsArray = Array.isArray(value);\n if (shouldBeMultipleArray) {\n if (valueIsArray && underlyingValueShouldBeArray) {\n if (value.length === 0) {\n return isRequired ? new error_1.FieldError('array_nonempty', Object.assign(Object.assign({}, context), { setting: true })) : null;\n }\n // TODO: We need to be permissive here for file components, which have an array model type but don't have an underlying array value\n // (in other words, a file component's data object will always be a single array regardless of whether or not multiple is set)\n // In the future, we could consider checking the underlying value's type to determine if it should be an array\n // return Array.isArray(value[0]) ? null : new FieldError('array', { ...context, setting: true });\n return null;\n }\n else if (valueIsArray && !underlyingValueShouldBeArray) {\n if (value.length === 0) {\n return isRequired ? new error_1.FieldError('array_nonempty', Object.assign(Object.assign({}, context), { setting: true })) : null;\n }\n return Array.isArray(value[0]) && compModelType !== 'any'\n ? new error_1.FieldError('nonarray', Object.assign(Object.assign({}, context), { setting: true }))\n : null;\n }\n else {\n const error = new error_1.FieldError('array', Object.assign(Object.assign({}, context), { setting: true }));\n // Null/undefined is ok if this value isn't required; anything else should fail\n return (0, lodash_1.isNil)(value) ? (isRequired ? error : null) : error;\n }\n }\n else {\n const canBeArray = (0, exports.emptyValueIsArray)(component) || underlyingValueShouldBeArray;\n if (!canBeArray && valueIsArray) {\n return new error_1.FieldError('nonarray', Object.assign(Object.assign({}, context), { setting: false }));\n }\n return null;\n }\n};\nexports.validateMultipleSync = validateMultipleSync;\nexports.validateMultipleInfo = {\n name: 'validateMultiple',\n process: exports.validateMultiple,\n fullValue: true,\n processSync: exports.validateMultipleSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateMultiple.js?");
|
569
569
|
|
570
570
|
/***/ }),
|
571
571
|
|
@@ -598,7 +598,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
598
598
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
599
599
|
|
600
600
|
"use strict";
|
601
|
-
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.validateRequiredInfo = exports.validateRequiredSync = exports.validateRequired = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst isAddressComponent = (component) => {\n return component.type === 'address';\n};\nconst isDayComponent = (component) => {\n return component.type === 'day';\n};\nconst isAddressComponentDataObject = (value) => {\n return value !== null
|
601
|
+
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.validateRequiredInfo = exports.validateRequiredSync = exports.validateRequired = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst isAddressComponent = (component) => {\n return component.type === 'address';\n};\nconst isDayComponent = (component) => {\n return component.type === 'day';\n};\nconst isAddressComponentDataObject = (value) => {\n return (value !== null &&\n typeof value === 'object' &&\n value.mode &&\n value.address &&\n typeof value.address === 'object');\n};\n// Checkboxes and selectboxes consider false to be falsy, whereas other components with\n// settable values (e.g. radio, select, datamap, container, etc.) consider it truthy\nconst isComponentThatCannotHaveFalseValue = (component) => {\n return component.type === 'checkbox' || component.type === 'selectboxes';\n};\nconst valueIsPresent = (value, considerFalseTruthy, isNestedDatatype) => {\n // Evaluate for 3 out of 6 falsy values (\"\", null, undefined), don't check for 0\n // and only check for false under certain conditions\n if (value === null ||\n value === undefined ||\n value === '' ||\n (!considerFalseTruthy && value === false)) {\n return false;\n }\n // Evaluate for empty object\n else if ((0, util_1.isEmptyObject)(value)) {\n return false;\n }\n // Evaluate for empty array\n else if (Array.isArray(value) && value.length === 0) {\n return false;\n }\n // Recursively evaluate\n else if (typeof value === 'object' && !isNestedDatatype) {\n return Object.values(value).some((val) => valueIsPresent(val, considerFalseTruthy, isNestedDatatype));\n }\n // If value is an array, check it's children have value\n else if (Array.isArray(value) && value.length) {\n return (0, util_1.doesArrayDataHaveValue)(value);\n }\n return true;\n};\nconst shouldValidate = (context) => {\n var _a, _b;\n const { component } = context;\n if (((_a = component.validate) === null || _a === void 0 ? void 0 : _a.required) &&\n !(component.hidden || ((_b = component.ephermalState) === null || _b === void 0 ? void 0 : _b.conditionallyHidden))) {\n return true;\n }\n return false;\n};\nexports.shouldValidate = shouldValidate;\nconst validateRequired = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateRequiredSync)(context);\n});\nexports.validateRequired = validateRequired;\nconst validateRequiredSync = (context) => {\n const error = new error_1.FieldError('required', Object.assign(Object.assign({}, context), { setting: true }));\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (isAddressComponent(component) && isAddressComponentDataObject(value)) {\n return (0, util_1.isEmptyObject)(value.address)\n ? error\n : Object.values(value.address).every((val) => !!val)\n ? null\n : error;\n }\n else if (isDayComponent(component) && value === '00/00/0000') {\n return error;\n }\n else if (isComponentThatCannotHaveFalseValue(component)) {\n return !valueIsPresent(value, false, (0, formUtil_1.isComponentNestedDataType)(component)) ? error : null;\n }\n return !valueIsPresent(value, true, (0, formUtil_1.isComponentNestedDataType)(component)) ? error : null;\n};\nexports.validateRequiredSync = validateRequiredSync;\nexports.validateRequiredInfo = {\n name: 'validateRequired',\n process: exports.validateRequired,\n processSync: exports.validateRequiredSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateRequired.js?");
|
602
602
|
|
603
603
|
/***/ }),
|
604
604
|
|
@@ -609,7 +609,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
609
609
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
610
610
|
|
611
611
|
"use strict";
|
612
|
-
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.validateRequiredDayInfo = exports.validateRequiredDaySync = exports.validateRequiredDay = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableDayComponent = (component) => {\n var _a, _b, _c, _d, _e, _f;\n return (component &&\n component.type === 'day' &&\n (((_b = (_a = component.fields) === null || _a === void 0 ? void 0 : _a.day) === null || _b === void 0 ? void 0 : _b.required)
|
612
|
+
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.validateRequiredDayInfo = exports.validateRequiredDaySync = exports.validateRequiredDay = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableDayComponent = (component) => {\n var _a, _b, _c, _d, _e, _f;\n return (component &&\n component.type === 'day' &&\n (((_b = (_a = component.fields) === null || _a === void 0 ? void 0 : _a.day) === null || _b === void 0 ? void 0 : _b.required) ||\n ((_d = (_c = component.fields) === null || _c === void 0 ? void 0 : _c.month) === null || _d === void 0 ? void 0 : _d.required) ||\n ((_f = (_e = component.fields) === null || _e === void 0 ? void 0 : _e.year) === null || _f === void 0 ? void 0 : _f.required)));\n};\nconst shouldValidate = (context) => {\n const { component } = context;\n return isValidatableDayComponent(component);\n};\nexports.shouldValidate = shouldValidate;\nconst validateRequiredDay = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateRequiredDaySync)(context);\n});\nexports.validateRequiredDay = validateRequiredDay;\nconst validateRequiredDaySync = (context) => {\n var _a, _b, _c, _d, _e, _f;\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (!isValidatableDayComponent(component)) {\n return null;\n }\n if (!value) {\n return new error_1.FieldError('requiredDayEmpty', context, 'day');\n }\n if (typeof value !== 'string') {\n throw new error_1.ProcessorError(`Cannot validate required day field of ${value} because it is not a string`, context, 'validate:validateRequiredDay');\n }\n const [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2];\n const values = value.split('/').map((x) => parseInt(x, 10)), day = values[DAY], month = values[MONTH], year = values[YEAR];\n if (!day && ((_b = (_a = component.fields) === null || _a === void 0 ? void 0 : _a.day) === null || _b === void 0 ? void 0 : _b.required)) {\n return new error_1.FieldError('requiredDayField', context, 'day');\n }\n if (!month && ((_d = (_c = component.fields) === null || _c === void 0 ? void 0 : _c.month) === null || _d === void 0 ? void 0 : _d.required)) {\n return new error_1.FieldError('requiredMonthField', context, 'day');\n }\n if (!year && ((_f = (_e = component.fields) === null || _e === void 0 ? void 0 : _e.year) === null || _f === void 0 ? void 0 : _f.required)) {\n return new error_1.FieldError('requiredYearField', context, 'day');\n }\n return null;\n};\nexports.validateRequiredDaySync = validateRequiredDaySync;\nexports.validateRequiredDayInfo = {\n name: 'validateRequiredDay',\n process: exports.validateRequiredDay,\n processSync: exports.validateRequiredDaySync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateRequiredDay.js?");
|
613
613
|
|
614
614
|
/***/ }),
|
615
615
|
|
@@ -620,7 +620,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
620
620
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
621
621
|
|
622
622
|
"use strict";
|
623
|
-
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.validateResourceSelectValueInfo = exports.validateResourceSelectValue = exports.shouldValidate = exports.generateUrl = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst isValidatableSelectComponent = (component) => {\n var _a;\n return (component &&\n component.type === 'select' &&\n (0, util_1.toBoolean)(component.dataSrc === 'resource') &&\n (0, util_1.toBoolean)((_a = component.validate) === null || _a === void 0 ? void 0 : _a.select));\n};\nconst generateUrl = (baseUrl, component, value) => {\n const url = baseUrl;\n const query = url.searchParams;\n if (component.searchField) {\n let searchValue = value;\n if (component.valueProperty) {\n searchValue = value[component.valueProperty];\n }\n else {\n searchValue = value;\n }\n query.set(component.searchField, typeof searchValue === 'string' ? searchValue : JSON.stringify(searchValue));\n }\n if (component.selectFields) {\n query.set('select', component.selectFields);\n }\n if (component.sort) {\n query.set('sort', component.sort);\n }\n if (component.filter) {\n const filterQueryStrings = new URLSearchParams(component.filter);\n filterQueryStrings.forEach((value, key) => query.set(key, value));\n }\n return url;\n};\nexports.generateUrl = generateUrl;\nconst shouldValidate = (context) => {\n var _a;\n const { component, value,
|
623
|
+
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.validateResourceSelectValueInfo = exports.validateResourceSelectValue = exports.shouldValidate = exports.generateUrl = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst isValidatableSelectComponent = (component) => {\n var _a;\n return (component &&\n component.type === 'select' &&\n (0, util_1.toBoolean)(component.dataSrc === 'resource') &&\n (0, util_1.toBoolean)((_a = component.validate) === null || _a === void 0 ? void 0 : _a.select));\n};\nconst generateUrl = (baseUrl, component, value) => {\n const url = baseUrl;\n const query = url.searchParams;\n if (component.searchField) {\n let searchValue = value;\n if (component.valueProperty) {\n searchValue = value[component.valueProperty];\n }\n else {\n searchValue = value;\n }\n query.set(component.searchField, typeof searchValue === 'string' ? searchValue : JSON.stringify(searchValue));\n }\n if (component.selectFields) {\n query.set('select', component.selectFields);\n }\n if (component.sort) {\n query.set('sort', component.sort);\n }\n if (component.filter) {\n const filterQueryStrings = new URLSearchParams(component.filter);\n filterQueryStrings.forEach((value, key) => query.set(key, value));\n }\n return url;\n};\nexports.generateUrl = generateUrl;\nconst shouldValidate = (context) => {\n var _a;\n const { component, value, config } = context;\n // Only run this validation if server-side\n if (!(config === null || config === void 0 ? void 0 : config.server)) {\n return false;\n }\n if (!isValidatableSelectComponent(component)) {\n return false;\n }\n if (!value ||\n (0, util_1.isEmptyObject)(value) ||\n (Array.isArray(value) && value.length === 0)) {\n return false;\n }\n // If given an invalid configuration, do not validate the remote value\n if (component.dataSrc !== 'resource' || !((_a = component.data) === null || _a === void 0 ? void 0 : _a.resource)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateResourceSelectValue = (context) => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n const { value, config } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (!config || !config.database) {\n throw new error_1.ProcessorError(\"Can't validate for resource value without a database config object\", context, 'validate:validateResourceSelectValue');\n }\n try {\n const resourceSelectValueResult = yield ((_a = config.database) === null || _a === void 0 ? void 0 : _a.validateResourceSelectValue(context, value));\n return resourceSelectValueResult === true ? null : new error_1.FieldError('select', context);\n }\n catch (err) {\n throw new error_1.ProcessorError(err.message || err, context, 'validate:validateResourceSelectValue');\n }\n});\nexports.validateResourceSelectValue = validateResourceSelectValue;\nexports.validateResourceSelectValueInfo = {\n name: 'validateResourceSelectValue',\n process: exports.validateResourceSelectValue,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateResourceSelectValue.js?");
|
624
624
|
|
625
625
|
/***/ }),
|
626
626
|
|
@@ -631,7 +631,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
631
631
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
632
632
|
|
633
633
|
"use strict";
|
634
|
-
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateTimeInfo = exports.validateTime = exports.validateTimeSync = exports.shouldValidate = void 0;\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\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 customParseFormat_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/customParseFormat */ \"./node_modules/dayjs/plugin/customParseFormat.js\"));\ndate_1.dayjs.extend(customParseFormat_1.default);\nconst isValidatableTimeComponent = (comp) => {\n return comp && comp.type === 'time';\n};\nconst shouldValidate = (context) => {\n const { component
|
634
|
+
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};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.validateTimeInfo = exports.validateTime = exports.validateTimeSync = exports.shouldValidate = void 0;\nconst formUtil_1 = __webpack_require__(/*! ../../../utils/formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\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 customParseFormat_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/customParseFormat */ \"./node_modules/dayjs/plugin/customParseFormat.js\"));\ndate_1.dayjs.extend(customParseFormat_1.default);\nconst isValidatableTimeComponent = (comp) => {\n return comp && comp.type === 'time';\n};\nconst shouldValidate = (context) => {\n const { component } = context;\n if (!isValidatableTimeComponent(component)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateTimeSync = (context) => {\n const { component, data, path, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n try {\n if (!value || (0, formUtil_1.isComponentDataEmpty)(component, data, path))\n return null;\n const format = component.dataFormat || 'HH:mm:ss';\n const isValid = (0, date_1.dayjs)(String(value), format, true).isValid();\n return isValid ? null : new error_1.FieldError('time', context);\n }\n catch (ignoreErr) {\n throw new error_1.ProcessorError(`Could not validate time component ${component.key} with value ${value}`, context, 'validate:validateTime');\n }\n};\nexports.validateTimeSync = validateTimeSync;\nconst validateTime = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateTimeSync)(context);\n});\nexports.validateTime = validateTime;\nexports.validateTimeInfo = {\n name: 'validateTime',\n process: exports.validateTime,\n processSync: exports.validateTimeSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateTime.js?");
|
635
635
|
|
636
636
|
/***/ }),
|
637
637
|
|
@@ -642,7 +642,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
642
642
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
643
643
|
|
644
644
|
"use strict";
|
645
|
-
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.validateUniqueInfo = exports.validateUnique = exports.shouldValidate = void 0;\nconst FieldError_1 = __webpack_require__(/*! ../../../error/FieldError */ \"./node_modules/@formio/core/lib/error/FieldError.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!component.unique) {\n return false;\n }\n if (!value || (0, util_1.isEmptyObject)(value)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateUnique = (context) => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n const { value, config, component } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (!config || !config.database) {\n throw new error_1.ProcessorError(\"Can't test for unique value without a database config object\", context, 'validate:validateUnique');\n }\n try {\n const isUnique = yield ((_a = config.database) === null || _a === void 0 ? void 0 : _a.isUnique(context, value));\n if (typeof isUnique === 'string') {\n return new FieldError_1.FieldError('unique', Object.assign(Object.assign({}, context), { component: Object.assign(Object.assign({}, component), { conflictId: isUnique }) }));\n }\n return
|
645
|
+
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.validateUniqueInfo = exports.validateUnique = exports.shouldValidate = void 0;\nconst FieldError_1 = __webpack_require__(/*! ../../../error/FieldError */ \"./node_modules/@formio/core/lib/error/FieldError.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!component.unique) {\n return false;\n }\n if (!value || (0, util_1.isEmptyObject)(value)) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateUnique = (context) => __awaiter(void 0, void 0, void 0, function* () {\n var _a;\n const { value, config, component } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n if (!config || !config.database) {\n throw new error_1.ProcessorError(\"Can't test for unique value without a database config object\", context, 'validate:validateUnique');\n }\n try {\n const isUnique = yield ((_a = config.database) === null || _a === void 0 ? void 0 : _a.isUnique(context, value));\n if (typeof isUnique === 'string') {\n return new FieldError_1.FieldError('unique', Object.assign(Object.assign({}, context), { component: Object.assign(Object.assign({}, component), { conflictId: isUnique }) }));\n }\n return isUnique === true ? null : new FieldError_1.FieldError('unique', context);\n }\n catch (err) {\n throw new error_1.ProcessorError(err.message || err, context, 'validate:validateUnique');\n }\n});\nexports.validateUnique = validateUnique;\nexports.validateUniqueInfo = {\n name: 'validateUnique',\n fullValue: true,\n process: exports.validateUnique,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateUnique.js?");
|
646
646
|
|
647
647
|
/***/ }),
|
648
648
|
|
@@ -653,7 +653,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
653
653
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
654
654
|
|
655
655
|
"use strict";
|
656
|
-
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.validateUrlInfo = exports.validateUrl = exports.validateUrlSync = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isUrlComponent = (component) => {\n return component && component.type === 'url';\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!isUrlComponent(component)) {\n return false;\n }\n if (!value) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateUrlSync = (context) => {\n const { value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const error = new error_1.FieldError('invalid_url', context, 'url');\n if (typeof value !== 'string') {\n return error;\n }\n // From https://stackoverflow.com/questions/8667070/javascript-regular-expression-to-validate-url\n const re = /^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#]\\S*)?$/i;\n // From http://stackoverflow.com/questions/46155/validate-email-address-in-javascript\n const emailRe = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n // Allow urls to be valid if the component is pristine and no value is provided.\n return
|
656
|
+
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.validateUrlInfo = exports.validateUrl = exports.validateUrlSync = exports.shouldValidate = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isUrlComponent = (component) => {\n return component && component.type === 'url';\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!isUrlComponent(component)) {\n return false;\n }\n if (!value) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateUrlSync = (context) => {\n const { value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const error = new error_1.FieldError('invalid_url', context, 'url');\n if (typeof value !== 'string') {\n return error;\n }\n // From https://stackoverflow.com/questions/8667070/javascript-regular-expression-to-validate-url\n const re = /^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#]\\S*)?$/i;\n // From http://stackoverflow.com/questions/46155/validate-email-address-in-javascript\n const emailRe = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n // Allow urls to be valid if the component is pristine and no value is provided.\n return re.test(value) && !emailRe.test(value) ? null : error;\n};\nexports.validateUrlSync = validateUrlSync;\nconst validateUrl = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateUrlSync)(context);\n});\nexports.validateUrl = validateUrl;\nexports.validateUrlInfo = {\n name: 'validateUrl',\n process: exports.validateUrl,\n processSync: exports.validateUrlSync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateUrl.js?");
|
657
657
|
|
658
658
|
/***/ }),
|
659
659
|
|
@@ -664,7 +664,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
664
664
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
665
665
|
|
666
666
|
"use strict";
|
667
|
-
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.validateUrlSelectValueInfo = exports.validateUrlSelectValue = exports.shouldValidate = exports.generateUrl = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst error_2 = __webpack_require__(/*! ../../../utils/error */ \"./node_modules/@formio/core/lib/utils/error.js\");\nconst isValidatableSelectComponent = (component) => {\n var _a;\n return (component &&\n component.type === 'select' &&\n (0, util_1.toBoolean)(component.dataSrc === 'url') &&\n (0, util_1.toBoolean)((_a = component.validate) === null || _a === void 0 ? void 0 : _a.select));\n};\nconst generateUrl = (baseUrl, component, value) => {\n const url = baseUrl;\n const query = url.searchParams;\n if (component.searchField) {\n let searchValue = value;\n if (component.valueProperty) {\n searchValue = value[component.valueProperty];\n }\n else {\n searchValue = value;\n }\n query.set(component.searchField, typeof searchValue === 'string' ? searchValue : JSON.stringify(searchValue));\n }\n if (component.selectFields) {\n query.set('select', component.selectFields);\n }\n if (component.sort) {\n query.set('sort', component.sort);\n }\n if (component.filter) {\n const filterQueryStrings = new URLSearchParams(component.filter);\n filterQueryStrings.forEach((value, key) => query.set(key, value));\n }\n return url;\n};\nexports.generateUrl = generateUrl;\nconst shouldValidate = (context) => {\n var _a;\n const { component, value,
|
667
|
+
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.validateUrlSelectValueInfo = exports.validateUrlSelectValue = exports.shouldValidate = exports.generateUrl = void 0;\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst utils_1 = __webpack_require__(/*! ../../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst util_1 = __webpack_require__(/*! ../util */ \"./node_modules/@formio/core/lib/process/validation/util.js\");\nconst error_2 = __webpack_require__(/*! ../../../utils/error */ \"./node_modules/@formio/core/lib/utils/error.js\");\nconst isValidatableSelectComponent = (component) => {\n var _a;\n return (component &&\n component.type === 'select' &&\n (0, util_1.toBoolean)(component.dataSrc === 'url') &&\n (0, util_1.toBoolean)((_a = component.validate) === null || _a === void 0 ? void 0 : _a.select));\n};\nconst generateUrl = (baseUrl, component, value) => {\n const url = baseUrl;\n const query = url.searchParams;\n if (component.searchField) {\n let searchValue = value;\n if (component.valueProperty) {\n searchValue = value[component.valueProperty];\n }\n else {\n searchValue = value;\n }\n query.set(component.searchField, typeof searchValue === 'string' ? searchValue : JSON.stringify(searchValue));\n }\n if (component.selectFields) {\n query.set('select', component.selectFields);\n }\n if (component.sort) {\n query.set('sort', component.sort);\n }\n if (component.filter) {\n const filterQueryStrings = new URLSearchParams(component.filter);\n filterQueryStrings.forEach((value, key) => query.set(key, value));\n }\n return url;\n};\nexports.generateUrl = generateUrl;\nconst shouldValidate = (context) => {\n var _a;\n const { component, value, config } = context;\n // Only run this validation if server-side\n if (!(config === null || config === void 0 ? void 0 : config.server)) {\n return false;\n }\n if (!isValidatableSelectComponent(component)) {\n return false;\n }\n if (!value ||\n (0, util_1.isEmptyObject)(value) ||\n (Array.isArray(value) && value.length === 0)) {\n return false;\n }\n // If given an invalid configuration, do not validate the remote value\n if (component.dataSrc !== 'url' || !((_a = component.data) === null || _a === void 0 ? void 0 : _a.url) || !component.searchField) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateUrlSelectValue = (context) => __awaiter(void 0, void 0, void 0, function* () {\n const { component, value, data, config } = context;\n let _fetch = null;\n try {\n _fetch = context.fetch ? context.fetch : fetch;\n }\n catch (ignoreErr) {\n _fetch = null;\n }\n try {\n if (!_fetch) {\n console.log('You must provide a fetch interface to the fetch processor.');\n return null;\n }\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const baseUrl = new URL(utils_1.Evaluator\n ? utils_1.Evaluator.interpolate(component.data.url, data, {})\n : component.data.url);\n const url = (0, exports.generateUrl)(baseUrl, component, value);\n const headers = component.data.headers\n ? component.data.headers.reduce((acc, header) => (Object.assign(Object.assign({}, acc), { [header.key]: header.value })), {})\n : {};\n // Set form.io authentication\n if (component.authenticate && config && config.tokens) {\n Object.assign(headers, config.tokens);\n }\n try {\n const response = yield _fetch(url.toString(), { method: 'GET', headers });\n // TODO: should we always expect JSON here?\n if (response.ok) {\n const data = yield response.json();\n const error = new error_1.FieldError('select', context);\n if (Array.isArray(data)) {\n return data && data.length ? null : error;\n }\n return data ? ((0, util_1.isEmptyObject)(data) ? error : null) : error;\n }\n const data = yield response.text();\n throw new error_1.ProcessorError(`Component with path ${component.key} returned an error while validating remote value: ${data}`, context, 'validate:validateRemoteSelectValue');\n }\n catch (err) {\n throw new error_1.ProcessorError(`Component with path ${component.key} returned an error while validating remote value: ${err}`, context, 'validate:validateRemoteSelectValue');\n }\n }\n catch (err) {\n console.error((0, error_2.getErrorMessage)(err));\n return null;\n }\n});\nexports.validateUrlSelectValue = validateUrlSelectValue;\nexports.validateUrlSelectValueInfo = {\n name: 'validateUrlSelectValue',\n process: exports.validateUrlSelectValue,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateUrlSelectValue.js?");
|
668
668
|
|
669
669
|
/***/ }),
|
670
670
|
|
@@ -675,7 +675,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
675
675
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
676
676
|
|
677
677
|
"use strict";
|
678
|
-
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.validateValuePropertyInfo = exports.validateValuePropertySync = exports.validateValueProperty = exports.shouldValidate = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableListComponent = (comp) => {\n return (comp &&\n comp.type &&\n (comp.type ===
|
678
|
+
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.validateValuePropertyInfo = exports.validateValuePropertySync = exports.validateValueProperty = exports.shouldValidate = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst error_1 = __webpack_require__(/*! ../../../error */ \"./node_modules/@formio/core/lib/error/index.js\");\nconst isValidatableListComponent = (comp) => {\n return (comp &&\n comp.type &&\n (comp.type === 'radio' || comp.type === 'selectboxes' || comp.type === 'select'));\n};\nconst shouldValidate = (context) => {\n const { component, value } = context;\n if (!isValidatableListComponent(component)) {\n return false;\n }\n if (component.dataSrc !== 'url') {\n return false;\n }\n if (!value || (typeof value === 'object' && (0, lodash_1.isEmpty)(value))) {\n return false;\n }\n const valueProperty = component.valueProperty;\n if (!valueProperty) {\n return false;\n }\n return true;\n};\nexports.shouldValidate = shouldValidate;\nconst validateValueProperty = (context) => __awaiter(void 0, void 0, void 0, function* () {\n return (0, exports.validateValuePropertySync)(context);\n});\nexports.validateValueProperty = validateValueProperty;\nconst validateValuePropertySync = (context) => {\n const { component, value } = context;\n if (!(0, exports.shouldValidate)(context)) {\n return null;\n }\n const error = new error_1.FieldError('invalidValueProperty', context);\n // TODO: at some point in the radio component's change pipeline, object values are coerced into strings; testing for\n // '[object Object]' is an ugly way to determine whether or not the ValueProperty is invalid, but it'll have to do\n // for now\n if (component.inputType === 'radio' &&\n ((0, lodash_1.isUndefined)(value) || (0, lodash_1.isObject)(value) || value === '[object Object]')) {\n return error;\n }\n // TODO: a cousin to the above issue, but sometimes ValueProperty will resolve to a boolean value so the keys in\n // e.g. SelectBoxes components will strings coerced from booleans; again, not pretty, but good enough for now\n else if (component.inputType !== 'radio') {\n if (Object.entries(value).some(([key, value]) => value && (key === '[object Object]' || key === 'true' || key === 'false'))) {\n return error;\n }\n }\n return null;\n};\nexports.validateValuePropertySync = validateValuePropertySync;\nexports.validateValuePropertyInfo = {\n name: 'validateValueProperty',\n process: exports.validateValueProperty,\n processSync: exports.validateValuePropertySync,\n shouldProcess: exports.shouldValidate,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/rules/validateValueProperty.js?");
|
679
679
|
|
680
680
|
/***/ }),
|
681
681
|
|
@@ -686,7 +686,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
686
686
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
687
687
|
|
688
688
|
"use strict";
|
689
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.doesArrayDataHaveValue = exports.hasValue = exports.interpolateErrors = exports.isObject = exports.isPromise = exports.toBoolean = exports.getComponentErrorField = exports.isEmptyObject = exports.isComponentProtected = exports.isComponentPersistent = void 0;\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst i18n_1 = __webpack_require__(/*! ./i18n */ \"./node_modules/@formio/core/lib/process/validation/i18n/index.js\");\nconst isEmpty_1 = __importDefault(__webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\"));\nconst isObject_1 = __importDefault(__webpack_require__(/*! lodash/isObject */ \"./node_modules/lodash/isObject.js\"));\nconst isPlainObject_1 = __importDefault(__webpack_require__(/*! lodash/isPlainObject */ \"./node_modules/lodash/isPlainObject.js\"));\nfunction isComponentPersistent(component) {\n return component.persistent ? component.persistent : true;\n}\nexports.isComponentPersistent = isComponentPersistent;\nfunction isComponentProtected(component) {\n return component.protected ? component.protected : false;\n}\nexports.isComponentProtected = isComponentProtected;\nfunction isEmptyObject(obj) {\n return !!obj && Object.keys(obj).length === 0 && obj.constructor === Object;\n}\nexports.isEmptyObject = isEmptyObject;\nfunction getComponentErrorField(component, context) {\n const toInterpolate = component.errorLabel || component.label || component.placeholder || component.key;\n return utils_1.Evaluator.interpolate(toInterpolate, context);\n}\nexports.getComponentErrorField = getComponentErrorField;\nfunction toBoolean(value) {\n switch (typeof value) {\n case 'string':\n if (value === 'true' || value === '1') {\n return true;\n }\n else if (value === 'false' || value === '0') {\n return false;\n }\n else {\n throw `Cannot coerce string ${value} to boolean}`;\n }\n case 'boolean':\n return value;\n default:\n return !!value;\n }\n}\nexports.toBoolean = toBoolean;\nfunction isPromise(value) {\n return (value &&\n value.then &&\n typeof value.then === 'function' &&\n Object.prototype.toString.call(value) === '[object Promise]');\n}\nexports.isPromise = isPromise;\nfunction isObject(obj) {\n return
|
689
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.doesArrayDataHaveValue = exports.hasValue = exports.interpolateErrors = exports.isObject = exports.isPromise = exports.toBoolean = exports.getComponentErrorField = exports.isEmptyObject = exports.isComponentProtected = exports.isComponentPersistent = void 0;\nconst utils_1 = __webpack_require__(/*! ../../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\nconst i18n_1 = __webpack_require__(/*! ./i18n */ \"./node_modules/@formio/core/lib/process/validation/i18n/index.js\");\nconst isEmpty_1 = __importDefault(__webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\"));\nconst isObject_1 = __importDefault(__webpack_require__(/*! lodash/isObject */ \"./node_modules/lodash/isObject.js\"));\nconst isPlainObject_1 = __importDefault(__webpack_require__(/*! lodash/isPlainObject */ \"./node_modules/lodash/isPlainObject.js\"));\nfunction isComponentPersistent(component) {\n return component.persistent ? component.persistent : true;\n}\nexports.isComponentPersistent = isComponentPersistent;\nfunction isComponentProtected(component) {\n return component.protected ? component.protected : false;\n}\nexports.isComponentProtected = isComponentProtected;\nfunction isEmptyObject(obj) {\n return !!obj && Object.keys(obj).length === 0 && obj.constructor === Object;\n}\nexports.isEmptyObject = isEmptyObject;\nfunction getComponentErrorField(component, context) {\n const toInterpolate = component.errorLabel || component.label || component.placeholder || component.key;\n return utils_1.Evaluator.interpolate(toInterpolate, context);\n}\nexports.getComponentErrorField = getComponentErrorField;\nfunction toBoolean(value) {\n switch (typeof value) {\n case 'string':\n if (value === 'true' || value === '1') {\n return true;\n }\n else if (value === 'false' || value === '0') {\n return false;\n }\n else {\n throw `Cannot coerce string ${value} to boolean}`;\n }\n case 'boolean':\n return value;\n default:\n return !!value;\n }\n}\nexports.toBoolean = toBoolean;\nfunction isPromise(value) {\n return (value &&\n value.then &&\n typeof value.then === 'function' &&\n Object.prototype.toString.call(value) === '[object Promise]');\n}\nexports.isPromise = isPromise;\nfunction isObject(obj) {\n return obj != null && (typeof obj === 'object' || typeof obj === 'function');\n}\nexports.isObject = isObject;\nconst getCustomErrorMessage = ({ errorKeyOrMessage, context }) => { var _a, _b; return ((_b = (_a = context.component) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b[errorKeyOrMessage]) || ''; };\n/**\n * Interpolates @formio/core errors so that they are compatible with the renderer\n * @param {FieldError[]} errors\n * @param firstPass\n * @returns {[]}\n */\nconst interpolateErrors = (errors, lang = 'en') => {\n return errors.map((error) => {\n const { errorKeyOrMessage, context } = error;\n const i18n = i18n_1.VALIDATION_ERRORS[lang] || {};\n const toInterpolate = getCustomErrorMessage(error) || i18n[errorKeyOrMessage] || errorKeyOrMessage;\n const paths = [];\n context.path.split('.').forEach((part) => {\n const match = part.match(/\\[([0-9]+)\\]$/);\n if (match) {\n paths.push(part.substring(0, match.index));\n paths.push(parseInt(match[1]));\n }\n else {\n paths.push(part);\n }\n });\n return {\n message: (0, utils_1.unescapeHTML)(utils_1.Evaluator.interpolateString(toInterpolate, context)),\n level: error.level,\n path: paths,\n context: {\n validator: error.ruleName,\n hasLabel: context.hasLabel,\n key: context.component.key,\n label: context.component.label || context.component.placeholder || context.component.key,\n path: context.path,\n value: context.value,\n setting: context.setting,\n index: context.index || 0,\n },\n };\n });\n};\nexports.interpolateErrors = interpolateErrors;\nconst hasValue = (value) => {\n if ((0, isObject_1.default)(value)) {\n return !(0, isEmpty_1.default)(value);\n }\n return (typeof value === 'number' && !Number.isNaN(value)) || !!value;\n};\nexports.hasValue = hasValue;\nconst doesArrayDataHaveValue = (dataValue = []) => {\n if (!Array.isArray(dataValue)) {\n return !!dataValue;\n }\n if (!dataValue.length) {\n return false;\n }\n const isArrayDataComponent = dataValue.every(isPlainObject_1.default);\n if (isArrayDataComponent) {\n return dataValue.some((value) => Object.values(value).some(exports.hasValue));\n }\n return dataValue.some(exports.hasValue);\n};\nexports.doesArrayDataHaveValue = doesArrayDataHaveValue;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/process/validation/util.js?");
|
690
690
|
|
691
691
|
/***/ }),
|
692
692
|
|
@@ -697,7 +697,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
697
697
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
698
698
|
|
699
699
|
"use strict";
|
700
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/**\n * The Form.io Plugins allow external systems to \"hook\" into the default behaviors of the JavaScript SDK.\n */\nclass Plugins {\n /**\n * Returns the plugin identity.\n *\n * @param value\n */\n static identity(value) {\n return value;\n }\n /**\n * De-registers a plugin.\n * @param plugin The plugin you wish to deregister.\n */\n static deregisterPlugin(plugin) {\n const beforeLength = Plugins.plugins.length;\n Plugins.plugins = Plugins.plugins.filter((p) => {\n if (p !== plugin && p.__name !== plugin) {\n return true;\n }\n (p.deregister || lodash_1.noop).call(plugin, Plugins.Formio);\n return false;\n });\n return beforeLength !== Plugins.plugins.length;\n }\n /**\n * Registers a new plugin.\n *\n * @param plugin The Plugin object.\n * @param name The name of the plugin you wish to register.\n */\n static registerPlugin(plugin, name) {\n Plugins.plugins.push(plugin);\n Plugins.plugins.sort((a, b) => (b.priority || 0) - (a.priority || 0));\n plugin.__name = name;\n (plugin.init || lodash_1.noop).call(plugin, Plugins.Formio);\n }\n /**\n * Returns a plugin provided the name of the plugin.\n * @param name The name of the plugin you would like to get.\n */\n static getPlugin(name) {\n for (const plugin of Plugins.plugins) {\n if (plugin.__name === name) {\n return plugin;\n }\n }\n return null;\n }\n /**\n * Wait for a plugin function to complete.\n * @param pluginFn - A function within the plugin.\n * @param args\n */\n static pluginWait(pluginFn, ...args) {\n return Promise.all(Plugins.plugins.map((plugin) => (plugin[pluginFn] || lodash_1.noop).call(plugin, ...args)));\n }\n /**\n * Gets a value from a Plugin\n * @param pluginFn\n * @param args\n */\n static pluginGet(pluginFn, ...args) {\n const callPlugin = (index) => {\n const plugin = Plugins.plugins[index];\n if (!plugin) {\n return Promise.resolve(null);\n }\n return Promise.resolve((plugin[pluginFn] || lodash_1.noop).call(plugin, ...args))
|
700
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/**\n * The Form.io Plugins allow external systems to \"hook\" into the default behaviors of the JavaScript SDK.\n */\nclass Plugins {\n /**\n * Returns the plugin identity.\n *\n * @param value\n */\n static identity(value) {\n return value;\n }\n /**\n * De-registers a plugin.\n * @param plugin The plugin you wish to deregister.\n */\n static deregisterPlugin(plugin) {\n const beforeLength = Plugins.plugins.length;\n Plugins.plugins = Plugins.plugins.filter((p) => {\n if (p !== plugin && p.__name !== plugin) {\n return true;\n }\n (p.deregister || lodash_1.noop).call(plugin, Plugins.Formio);\n return false;\n });\n return beforeLength !== Plugins.plugins.length;\n }\n /**\n * Registers a new plugin.\n *\n * @param plugin The Plugin object.\n * @param name The name of the plugin you wish to register.\n */\n static registerPlugin(plugin, name) {\n Plugins.plugins.push(plugin);\n Plugins.plugins.sort((a, b) => (b.priority || 0) - (a.priority || 0));\n plugin.__name = name;\n (plugin.init || lodash_1.noop).call(plugin, Plugins.Formio);\n }\n /**\n * Returns a plugin provided the name of the plugin.\n * @param name The name of the plugin you would like to get.\n */\n static getPlugin(name) {\n for (const plugin of Plugins.plugins) {\n if (plugin.__name === name) {\n return plugin;\n }\n }\n return null;\n }\n /**\n * Wait for a plugin function to complete.\n * @param pluginFn - A function within the plugin.\n * @param args\n */\n static pluginWait(pluginFn, ...args) {\n return Promise.all(Plugins.plugins.map((plugin) => (plugin[pluginFn] || lodash_1.noop).call(plugin, ...args)));\n }\n /**\n * Gets a value from a Plugin\n * @param pluginFn\n * @param args\n */\n static pluginGet(pluginFn, ...args) {\n const callPlugin = (index) => {\n const plugin = Plugins.plugins[index];\n if (!plugin) {\n return Promise.resolve(null);\n }\n return Promise.resolve((plugin[pluginFn] || lodash_1.noop).call(plugin, ...args)).then((result) => {\n if (!(0, lodash_1.isNil)(result)) {\n return result;\n }\n return callPlugin(index + 1);\n });\n };\n return callPlugin(0);\n }\n /**\n * Allows a Plugin to alter the behavior of the JavaScript library.\n *\n * @param pluginFn\n * @param value\n * @param args\n */\n static pluginAlter(pluginFn, value, ...args) {\n return Plugins.plugins.reduce((value, plugin) => (plugin[pluginFn] || Plugins.identity)(value, ...args), value);\n }\n}\n/**\n * An array of Form.io Plugins.\n */\nPlugins.plugins = [];\nexports[\"default\"] = Plugins;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/sdk/Plugins.js?");
|
701
701
|
|
702
702
|
/***/ }),
|
703
703
|
|
@@ -789,6 +789,17 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n\n\n
|
|
789
789
|
|
790
790
|
/***/ }),
|
791
791
|
|
792
|
+
/***/ "./node_modules/@formio/core/lib/types/ResourceToDomOptions.js":
|
793
|
+
/*!*********************************************************************!*\
|
794
|
+
!*** ./node_modules/@formio/core/lib/types/ResourceToDomOptions.js ***!
|
795
|
+
\*********************************************************************/
|
796
|
+
/***/ (function(__unused_webpack_module, exports) {
|
797
|
+
|
798
|
+
"use strict";
|
799
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/types/ResourceToDomOptions.js?");
|
800
|
+
|
801
|
+
/***/ }),
|
802
|
+
|
792
803
|
/***/ "./node_modules/@formio/core/lib/types/Role.js":
|
793
804
|
/*!*****************************************************!*\
|
794
805
|
!*** ./node_modules/@formio/core/lib/types/Role.js ***!
|
@@ -840,7 +851,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n\n\n
|
|
840
851
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
841
852
|
|
842
853
|
"use strict";
|
843
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./project/Project */ \"./node_modules/@formio/core/lib/types/project/Project.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Form */ \"./node_modules/@formio/core/lib/types/Form.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Submission */ \"./node_modules/@formio/core/lib/types/Submission.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Role */ \"./node_modules/@formio/core/lib/types/Role.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Action */ \"./node_modules/@formio/core/lib/types/Action.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Access */ \"./node_modules/@formio/core/lib/types/Access.js\"), exports);\n__exportStar(__webpack_require__(/*! ./RuleFn */ \"./node_modules/@formio/core/lib/types/RuleFn.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Component */ \"./node_modules/@formio/core/lib/types/Component.js\"), exports);\n__exportStar(__webpack_require__(/*! ./process */ \"./node_modules/@formio/core/lib/types/process/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./DataObject */ \"./node_modules/@formio/core/lib/types/DataObject.js\"), exports);\n__exportStar(__webpack_require__(/*! ./formUtil */ \"./node_modules/@formio/core/lib/types/formUtil.js\"), exports);\n__exportStar(__webpack_require__(/*! ./PassedComponentInstance */ \"./node_modules/@formio/core/lib/types/PassedComponentInstance.js\"), exports);\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/types/index.js?");
|
854
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./project/Project */ \"./node_modules/@formio/core/lib/types/project/Project.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Form */ \"./node_modules/@formio/core/lib/types/Form.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Submission */ \"./node_modules/@formio/core/lib/types/Submission.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Role */ \"./node_modules/@formio/core/lib/types/Role.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Action */ \"./node_modules/@formio/core/lib/types/Action.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Access */ \"./node_modules/@formio/core/lib/types/Access.js\"), exports);\n__exportStar(__webpack_require__(/*! ./RuleFn */ \"./node_modules/@formio/core/lib/types/RuleFn.js\"), exports);\n__exportStar(__webpack_require__(/*! ./Component */ \"./node_modules/@formio/core/lib/types/Component.js\"), exports);\n__exportStar(__webpack_require__(/*! ./process */ \"./node_modules/@formio/core/lib/types/process/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./DataObject */ \"./node_modules/@formio/core/lib/types/DataObject.js\"), exports);\n__exportStar(__webpack_require__(/*! ./formUtil */ \"./node_modules/@formio/core/lib/types/formUtil.js\"), exports);\n__exportStar(__webpack_require__(/*! ./PassedComponentInstance */ \"./node_modules/@formio/core/lib/types/PassedComponentInstance.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ResourceToDomOptions */ \"./node_modules/@formio/core/lib/types/ResourceToDomOptions.js\"), exports);\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/types/index.js?");
|
844
855
|
|
845
856
|
/***/ }),
|
846
857
|
|
@@ -1115,7 +1126,7 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
|
|
1115
1126
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1116
1127
|
|
1117
1128
|
"use strict";
|
1118
|
-
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.processes = void 0;\nconst processes_1 = __webpack_require__(/*! ../../process */ \"./node_modules/@formio/core/lib/process/index.js\");\n__exportStar(__webpack_require__(/*! ./ProcessType */ \"./node_modules/@formio/core/lib/types/process/ProcessType.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorType */ \"./node_modules/@formio/core/lib/types/process/ProcessorType.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorContext */ \"./node_modules/@formio/core/lib/types/process/ProcessorContext.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorFn */ \"./node_modules/@formio/core/lib/types/process/ProcessorFn.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessContext */ \"./node_modules/@formio/core/lib/types/process/ProcessContext.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorContext */ \"./node_modules/@formio/core/lib/types/process/ProcessorContext.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorScope */ \"./node_modules/@formio/core/lib/types/process/ProcessorScope.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorsScope */ \"./node_modules/@formio/core/lib/types/process/ProcessorsScope.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessConfig */ \"./node_modules/@formio/core/lib/types/process/ProcessConfig.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorInfo */ \"./node_modules/@formio/core/lib/types/process/ProcessorInfo.js\"), exports);\n__exportStar(__webpack_require__(/*! ./validation */ \"./node_modules/@formio/core/lib/types/process/validation/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./calculation */ \"./node_modules/@formio/core/lib/types/process/calculation/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./conditions */ \"./node_modules/@formio/core/lib/types/process/conditions/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./defaultValue */ \"./node_modules/@formio/core/lib/types/process/defaultValue/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./fetch */ \"./node_modules/@formio/core/lib/types/process/fetch/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./filter */ \"./node_modules/@formio/core/lib/types/process/filter/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./populate */ \"./node_modules/@formio/core/lib/types/process/populate/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./logic */ \"./node_modules/@formio/core/lib/types/process/logic/index.js\"), exports);\nexports.processes = {\n calculation: processes_1.calculateProcessInfo,\n conditions: processes_1.conditionProcessInfo,\n defaultValue: processes_1.defaultValueProcessInfo,\n fetch: processes_1.fetchProcessInfo,\n filter: processes_1.filterProcessInfo,\n logic: processes_1.logicProcessInfo,\n populate: processes_1.populateProcessInfo,\n validation: processes_1.validateProcessInfo
|
1129
|
+
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.processes = void 0;\nconst processes_1 = __webpack_require__(/*! ../../process */ \"./node_modules/@formio/core/lib/process/index.js\");\n__exportStar(__webpack_require__(/*! ./ProcessType */ \"./node_modules/@formio/core/lib/types/process/ProcessType.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorType */ \"./node_modules/@formio/core/lib/types/process/ProcessorType.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorContext */ \"./node_modules/@formio/core/lib/types/process/ProcessorContext.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorFn */ \"./node_modules/@formio/core/lib/types/process/ProcessorFn.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessContext */ \"./node_modules/@formio/core/lib/types/process/ProcessContext.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorContext */ \"./node_modules/@formio/core/lib/types/process/ProcessorContext.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorScope */ \"./node_modules/@formio/core/lib/types/process/ProcessorScope.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorsScope */ \"./node_modules/@formio/core/lib/types/process/ProcessorsScope.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessConfig */ \"./node_modules/@formio/core/lib/types/process/ProcessConfig.js\"), exports);\n__exportStar(__webpack_require__(/*! ./ProcessorInfo */ \"./node_modules/@formio/core/lib/types/process/ProcessorInfo.js\"), exports);\n__exportStar(__webpack_require__(/*! ./validation */ \"./node_modules/@formio/core/lib/types/process/validation/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./calculation */ \"./node_modules/@formio/core/lib/types/process/calculation/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./conditions */ \"./node_modules/@formio/core/lib/types/process/conditions/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./defaultValue */ \"./node_modules/@formio/core/lib/types/process/defaultValue/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./fetch */ \"./node_modules/@formio/core/lib/types/process/fetch/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./filter */ \"./node_modules/@formio/core/lib/types/process/filter/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./populate */ \"./node_modules/@formio/core/lib/types/process/populate/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./logic */ \"./node_modules/@formio/core/lib/types/process/logic/index.js\"), exports);\nexports.processes = {\n calculation: processes_1.calculateProcessInfo,\n conditions: processes_1.conditionProcessInfo,\n defaultValue: processes_1.defaultValueProcessInfo,\n fetch: processes_1.fetchProcessInfo,\n filter: processes_1.filterProcessInfo,\n logic: processes_1.logicProcessInfo,\n populate: processes_1.populateProcessInfo,\n validation: processes_1.validateProcessInfo,\n};\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/types/process/index.js?");
|
1119
1130
|
|
1120
1131
|
/***/ }),
|
1121
1132
|
|
@@ -1269,7 +1280,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1269
1280
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1270
1281
|
|
1271
1282
|
"use strict";
|
1272
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Evaluator = exports.BaseEvaluator = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n// BaseEvaluator is for extending.\nclass BaseEvaluator {\n static evaluator(func, ...params) {\n if (Evaluator.noeval) {\n console.warn('No evaluations allowed for this renderer.');\n return lodash_1.noop;\n }\n if (typeof func === 'function') {\n return func;\n }\n if (typeof params[0] === 'object') {\n params = (0, lodash_1.keys)(params[0]);\n }\n return new Function(...params, func);\n }\n
|
1283
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Evaluator = exports.BaseEvaluator = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n// BaseEvaluator is for extending.\nclass BaseEvaluator {\n static evaluator(func, ...params) {\n if (Evaluator.noeval) {\n console.warn('No evaluations allowed for this renderer.');\n return lodash_1.noop;\n }\n if (typeof func === 'function') {\n return func;\n }\n if (typeof params[0] === 'object') {\n params = (0, lodash_1.keys)(params[0]);\n }\n return new Function(...params, func);\n }\n static interpolateString(rawTemplate, data, options = {}) {\n if (!rawTemplate) {\n return '';\n }\n if (typeof rawTemplate !== 'string') {\n return rawTemplate.toString();\n }\n return rawTemplate.replace(/({{\\s*(.*?)\\s*}})/g, (match, $1, $2) => {\n // If this is a function call and we allow evals.\n if ($2.indexOf('(') !== -1 && !(Evaluator.noeval || options.noeval)) {\n return $2.replace(/([^(]+)\\(([^)]+)\\s*\\);?/, (evalMatch, funcName, args) => {\n funcName = (0, lodash_1.trim)(funcName);\n const func = (0, lodash_1.get)(data, funcName);\n if (func) {\n if (args) {\n args = args.split(',').map((arg) => {\n arg = (0, lodash_1.trim)(arg);\n if (arg.indexOf('\"') === 0 || arg.indexOf(\"'\") === 0) {\n return arg.substring(1, arg.length - 1);\n }\n return (0, lodash_1.get)(data, arg);\n });\n }\n return Evaluator.evaluate(func, args, '', false, data, options);\n }\n return '';\n });\n }\n else {\n let dataPath = $2;\n if ($2.indexOf('?') !== -1) {\n dataPath = $2.replace(/\\?\\./g, '.');\n }\n // Allow for conditional values.\n const parts = dataPath.split('||').map((item) => item.trim());\n let value = '';\n let path = '';\n for (let i = 0; i < parts.length; i++) {\n path = parts[i];\n value = (0, lodash_1.get)(data, path);\n if (value) {\n break;\n }\n }\n if (options.data) {\n (0, lodash_1.set)(options.data, path, value);\n }\n return value;\n }\n });\n }\n static interpolate(rawTemplate, data, options = {}) {\n if (typeof rawTemplate === 'function' && !(Evaluator.noeval || options.noeval)) {\n try {\n return rawTemplate(data);\n }\n catch (err) {\n console.warn('Error interpolating template', err, data);\n return err.message;\n }\n }\n return Evaluator.interpolateString(String(rawTemplate), data, options);\n }\n /**\n * Evaluate a method.\n *\n * @param func\n * @param args\n * @return {*}\n */\n static evaluate(func, args = {}, ret = '', interpolate = false, context = {}, options = {}) {\n let returnVal = null;\n options = (0, lodash_1.isObject)(options) ? options : { noeval: options };\n const component = args.component ? args.component : { key: 'unknown' };\n if (!args.form && args.instance) {\n args.form = (0, lodash_1.get)(args.instance, 'root._form', {});\n }\n const componentKey = component.key;\n if (typeof func === 'string') {\n if (ret) {\n func = `var ${ret};${func};return ${ret}`;\n }\n if (interpolate) {\n func = BaseEvaluator.interpolate(func, args, options);\n }\n try {\n if (Evaluator.noeval || options.noeval) {\n func = lodash_1.noop;\n }\n else {\n func = Evaluator.evaluator(func, args, context);\n }\n args = (0, lodash_1.values)(args);\n }\n catch (err) {\n console.warn(`An error occured within the custom function for ${componentKey}`, err);\n returnVal = null;\n func = false;\n }\n }\n if (typeof func === 'function') {\n try {\n returnVal = Evaluator.execute(func, args, context, options);\n }\n catch (err) {\n returnVal = null;\n console.warn(`An error occured within custom function for ${componentKey}`, err);\n }\n }\n else if (func) {\n console.warn(`Unknown function type for ${componentKey}`);\n }\n return returnVal;\n }\n /**\n * Execute a function.\n *\n * @param func\n * @param args\n * @returns\n */\n static execute(func, args, context = {}, options = {}) {\n options = (0, lodash_1.isObject)(options) ? options : { noeval: options };\n if (Evaluator.noeval || options.noeval) {\n console.warn('No evaluations allowed for this renderer.');\n return;\n }\n return Array.isArray(args) ? func.apply(context, args) : func.call(context, args);\n }\n}\nexports.BaseEvaluator = BaseEvaluator;\nBaseEvaluator.templateSettings = {\n interpolate: /{{([\\s\\S]+?)}}/g,\n evaluate: /\\{%([\\s\\S]+?)%\\}/g,\n escape: /\\{\\{\\{([\\s\\S]+?)\\}\\}\\}/g,\n};\nBaseEvaluator.noeval = false;\n// The extendable evaluator\nclass Evaluator extends BaseEvaluator {\n /**\n * Allow external modules the ability to extend the Evaluator.\n * @param evaluator\n */\n static registerEvaluator(evaluator) {\n Object.keys(evaluator).forEach((key) => {\n Evaluator[key] = evaluator[key];\n });\n }\n}\nexports.Evaluator = Evaluator;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/Evaluator.js?");
|
1273
1284
|
|
1274
1285
|
/***/ }),
|
1275
1286
|
|
@@ -1280,7 +1291,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1280
1291
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1281
1292
|
|
1282
1293
|
"use strict";
|
1283
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.checkSimpleConditional = exports.checkJsonConditional = exports.checkLegacyConditional = exports.checkCustomConditional = exports.conditionallyHidden = exports.isSimpleConditional = exports.isLegacyConditional = exports.isJSONConditional = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ./formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst operators_1 = __importDefault(__webpack_require__(/*! ./operators */ \"./node_modules/@formio/core/lib/utils/operators/index.js\"));\nconst isJSONConditional = (conditional) => {\n return conditional && conditional.json && (0, lodash_1.isObject)(conditional.json);\n};\nexports.isJSONConditional = isJSONConditional;\nconst isLegacyConditional = (conditional) => {\n return conditional && conditional.when;\n};\nexports.isLegacyConditional = isLegacyConditional;\nconst isSimpleConditional = (conditional) => {\n return conditional && conditional.conjunction && conditional.conditions;\n};\nexports.isSimpleConditional = isSimpleConditional;\nfunction conditionallyHidden(context) {\n const { scope, path } = context;\n if (scope.conditionals && path) {\n const hidden = (0, lodash_1.find)(scope.conditionals, (conditional) => {\n return conditional.path === path;\n });\n return hidden === null || hidden === void 0 ? void 0 : hidden.conditionallyHidden;\n }\n return false;\n}\nexports.conditionallyHidden = conditionallyHidden;\n/**\n * Check custom javascript conditional.\n *\n * @param component\n * @param custom\n * @param row\n * @param data\n * @returns {*}\n */\nfunction checkCustomConditional(condition, context, variable = 'show') {\n const { evalContext } = context;\n if (!condition) {\n return null;\n }\n const value = (0, jsonlogic_1.evaluate)(context, condition, variable, evalContext);\n if (value === null) {\n return null;\n }\n return value;\n}\nexports.checkCustomConditional = checkCustomConditional;\n/**\n * Checks the legacy conditionals.\n *\n * @param conditional\n * @param context\n * @param checkDefault\n * @returns\n */\nfunction checkLegacyConditional(conditional, context) {\n const { row, data, component } = context;\n if (!conditional || !(0, exports.isLegacyConditional)(conditional) || !conditional.when) {\n return null;\n }\n const value = (0, formUtil_1.getComponentActualValue)(component, conditional.when, data, row);\n const eq = String(conditional.eq);\n const show = String(conditional.show);\n if ((0, lodash_1.isObject)(value) && (0, lodash_1.has)(value, eq)) {\n return String(value[eq]) === show;\n }\n if (Array.isArray(value) && value.map(String).includes(eq)) {\n return show === 'true';\n }\n return (String(value) === eq) === (show === 'true');\n}\nexports.checkLegacyConditional = checkLegacyConditional;\n/**\n * Checks the JSON Conditionals.\n * @param conditional\n * @param context\n * @returns\n */\nfunction checkJsonConditional(conditional, context) {\n const { evalContext } = context;\n if (!conditional || !(0, exports.isJSONConditional)(conditional)) {\n return null;\n }\n const evalContextValue = evalContext ? evalContext(context) : context;\n return jsonlogic_1.JSONLogicEvaluator.evaluate(conditional.json, evalContextValue);\n}\nexports.checkJsonConditional = checkJsonConditional;\n/**\n * Checks if condition can potentially have a value path instead of component path.\n * @param condition\n * @returns {boolean}\n */\nfunction isConditionPotentiallyBasedOnValuePath(condition = {}) {\n let comparedValue;\n try {\n comparedValue = JSON.parse(condition.value);\n }\n catch (
|
1294
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.checkSimpleConditional = exports.checkJsonConditional = exports.checkLegacyConditional = exports.checkCustomConditional = exports.conditionallyHidden = exports.isSimpleConditional = exports.isLegacyConditional = exports.isJSONConditional = void 0;\nconst jsonlogic_1 = __webpack_require__(/*! ../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst formUtil_1 = __webpack_require__(/*! ./formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst operators_1 = __importDefault(__webpack_require__(/*! ./operators */ \"./node_modules/@formio/core/lib/utils/operators/index.js\"));\nconst isJSONConditional = (conditional) => {\n return conditional && conditional.json && (0, lodash_1.isObject)(conditional.json);\n};\nexports.isJSONConditional = isJSONConditional;\nconst isLegacyConditional = (conditional) => {\n return conditional && conditional.when;\n};\nexports.isLegacyConditional = isLegacyConditional;\nconst isSimpleConditional = (conditional) => {\n return conditional && conditional.conjunction && conditional.conditions;\n};\nexports.isSimpleConditional = isSimpleConditional;\nfunction conditionallyHidden(context) {\n const { scope, path } = context;\n if (scope.conditionals && path) {\n const hidden = (0, lodash_1.find)(scope.conditionals, (conditional) => {\n return conditional.path === path;\n });\n return hidden === null || hidden === void 0 ? void 0 : hidden.conditionallyHidden;\n }\n return false;\n}\nexports.conditionallyHidden = conditionallyHidden;\n/**\n * Check custom javascript conditional.\n *\n * @param component\n * @param custom\n * @param row\n * @param data\n * @returns {*}\n */\nfunction checkCustomConditional(condition, context, variable = 'show') {\n const { evalContext } = context;\n if (!condition) {\n return null;\n }\n const value = (0, jsonlogic_1.evaluate)(context, condition, variable, evalContext);\n if (value === null) {\n return null;\n }\n return value;\n}\nexports.checkCustomConditional = checkCustomConditional;\n/**\n * Checks the legacy conditionals.\n *\n * @param conditional\n * @param context\n * @param checkDefault\n * @returns\n */\nfunction checkLegacyConditional(conditional, context) {\n const { row, data, component } = context;\n if (!conditional || !(0, exports.isLegacyConditional)(conditional) || !conditional.when) {\n return null;\n }\n const value = (0, formUtil_1.getComponentActualValue)(component, conditional.when, data, row);\n const eq = String(conditional.eq);\n const show = String(conditional.show);\n if ((0, lodash_1.isObject)(value) && (0, lodash_1.has)(value, eq)) {\n return String(value[eq]) === show;\n }\n if (Array.isArray(value) && value.map(String).includes(eq)) {\n return show === 'true';\n }\n return (String(value) === eq) === (show === 'true');\n}\nexports.checkLegacyConditional = checkLegacyConditional;\n/**\n * Checks the JSON Conditionals.\n * @param conditional\n * @param context\n * @returns\n */\nfunction checkJsonConditional(conditional, context) {\n const { evalContext } = context;\n if (!conditional || !(0, exports.isJSONConditional)(conditional)) {\n return null;\n }\n const evalContextValue = evalContext ? evalContext(context) : context;\n return jsonlogic_1.JSONLogicEvaluator.evaluate(conditional.json, evalContextValue);\n}\nexports.checkJsonConditional = checkJsonConditional;\n/**\n * Checks if condition can potentially have a value path instead of component path.\n * @param condition\n * @returns {boolean}\n */\nfunction isConditionPotentiallyBasedOnValuePath(condition = {}) {\n let comparedValue;\n try {\n comparedValue = JSON.parse(condition.value);\n }\n catch (ignoreError) {\n comparedValue = condition.value;\n }\n return ((0, lodash_1.isBoolean)(comparedValue) &&\n (condition.component || '').split('.').length > 1 &&\n condition.operator === 'isEqual');\n}\n/**\n * Checks the simple conditionals.\n * @param conditional\n * @param context\n * @returns\n */\nfunction checkSimpleConditional(conditional, context) {\n const { component, data, row, instance, form } = context;\n if (!conditional || !(0, exports.isSimpleConditional)(conditional)) {\n return null;\n }\n const { conditions = [], conjunction = 'all', show = true } = conditional;\n if (!conditions.length) {\n return null;\n }\n const conditionsResult = (0, lodash_1.filter)((0, lodash_1.map)(conditions, (cond) => {\n let { value: comparedValue, component: conditionComponentPath } = cond;\n const { operator } = cond;\n if (!conditionComponentPath) {\n // Ignore conditions if there is no component path.\n return null;\n }\n const formComponents = (form === null || form === void 0 ? void 0 : form.components) || [];\n let conditionComponent = (0, formUtil_1.getComponent)(formComponents, conditionComponentPath, true);\n // If condition componenet is not found, check if conditionComponentPath is value path.\n // Need to handle condtions like:\n // {\n // \"component\": \"selectBoxes.a\",\n // \"operator\": \"isEqual\",\n // \"value\": \"true\"\n // }\n if (!conditionComponent &&\n isConditionPotentiallyBasedOnValuePath(cond) &&\n formComponents.length) {\n const flattenedComponents = (0, formUtil_1.flattenComponents)(formComponents, true);\n const pathParts = (0, lodash_1.split)(conditionComponentPath, '.');\n const valuePathParts = [];\n while (!conditionComponent && pathParts.length) {\n conditionComponent = flattenedComponents[`${pathParts.join('.')}`];\n if (!conditionComponent) {\n valuePathParts.unshift(pathParts.pop());\n }\n }\n if (conditionComponent &&\n conditionComponent.type === 'selectboxes' &&\n valuePathParts.length) {\n console.warn('Condition based on selectboxes has wrong format. Resave the form in the form builder to fix it.');\n conditionComponentPath = pathParts.join('.');\n comparedValue = valuePathParts.join('.');\n }\n }\n const value = conditionComponent\n ? (0, formUtil_1.getComponentActualValue)(conditionComponent, conditionComponentPath, data, row)\n : null;\n const ConditionOperator = operators_1.default[operator];\n return ConditionOperator\n ? new ConditionOperator().getResult({\n value,\n comparedValue,\n instance,\n component,\n conditionComponent,\n conditionComponentPath,\n data,\n })\n : true;\n }), (res) => res !== null);\n let result = false;\n switch (conjunction) {\n case 'any':\n result = (0, lodash_1.some)(conditionsResult, (res) => !!res);\n break;\n default:\n result = (0, lodash_1.every)(conditionsResult, (res) => !!res);\n }\n return show ? result : !result;\n}\nexports.checkSimpleConditional = checkSimpleConditional;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/conditions.js?");
|
1284
1295
|
|
1285
1296
|
/***/ }),
|
1286
1297
|
|
@@ -1291,7 +1302,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1291
1302
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1292
1303
|
|
1293
1304
|
"use strict";
|
1294
|
-
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 =
|
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?");
|
1295
1306
|
|
1296
1307
|
/***/ }),
|
1297
1308
|
|
@@ -1335,7 +1346,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1335
1346
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1336
1347
|
|
1337
1348
|
"use strict";
|
1338
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.eachComponent = void 0;\nconst index_1 = __webpack_require__(/*! ./index */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\n/**\n * Iterate through each component within a form.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Function} fn\n * The iteration function to invoke for each component.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n * @param {String} path\n * The current data path of the element. Example: data.user.firstName\n * @param {Object} parent\n * The parent object.\n */\nfunction eachComponent(components, fn, includeAll, path =
|
1349
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.eachComponent = void 0;\nconst index_1 = __webpack_require__(/*! ./index */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\n/**\n * Iterate through each component within a form.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Function} fn\n * The iteration function to invoke for each component.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n * @param {String} path\n * The current data path of the element. Example: data.user.firstName\n * @param {Object} parent\n * The parent object.\n */\nfunction eachComponent(components, fn, includeAll, path = '', parent) {\n if (!components)\n return;\n components.forEach((component) => {\n if (!component) {\n return;\n }\n const info = (0, index_1.componentInfo)(component);\n let noRecurse = false;\n // Keep track of parent references.\n if (parent) {\n // Ensure we don't create infinite JSON structures.\n Object.defineProperty(component, 'parent', {\n enumerable: false,\n writable: true,\n value: JSON.parse(JSON.stringify(parent)),\n });\n Object.defineProperty(component.parent, 'parent', {\n enumerable: false,\n writable: true,\n value: parent.parent,\n });\n Object.defineProperty(component.parent, 'path', {\n enumerable: false,\n writable: true,\n value: parent.path,\n });\n delete component.parent.components;\n delete component.parent.componentMap;\n delete component.parent.columns;\n delete component.parent.rows;\n }\n Object.defineProperty(component, 'path', {\n enumerable: false,\n writable: true,\n value: (0, index_1.componentPath)(component, path),\n });\n if (includeAll || component.tree || !info.layout) {\n noRecurse = !!fn(component, component.path, components, parent);\n }\n if (!noRecurse) {\n if (info.hasColumns) {\n component.columns.forEach((column) => eachComponent(column.components, fn, includeAll, path, parent ? component : null));\n }\n else if (info.hasRows) {\n component.rows.forEach((row) => {\n if (Array.isArray(row)) {\n row.forEach((column) => eachComponent(column.components, fn, includeAll, path, parent ? component : null));\n }\n });\n }\n else if (info.hasComps) {\n eachComponent(component.components, fn, includeAll, (0, index_1.componentFormPath)(component, path, component.path), parent ? component : null);\n }\n }\n });\n}\nexports.eachComponent = eachComponent;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/formUtil/eachComponent.js?");
|
1339
1350
|
|
1340
1351
|
/***/ }),
|
1341
1352
|
|
@@ -1346,7 +1357,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1346
1357
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1347
1358
|
|
1348
1359
|
"use strict";
|
1349
|
-
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.eachComponentAsync = void 0;\nconst index_1 = __webpack_require__(/*! ./index */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\n// Async each component.\nfunction eachComponentAsync(components_1, fn_1) {\n return __awaiter(this, arguments, void 0, function* (components, fn, includeAll = false, path =
|
1360
|
+
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.eachComponentAsync = void 0;\nconst index_1 = __webpack_require__(/*! ./index */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\n// Async each component.\nfunction eachComponentAsync(components_1, fn_1) {\n return __awaiter(this, arguments, void 0, function* (components, fn, includeAll = false, path = '', parent) {\n var _a, _b;\n if (!components)\n return;\n for (let i = 0; i < components.length; i++) {\n if (!components[i]) {\n continue;\n }\n const component = components[i];\n const info = (0, index_1.componentInfo)(component);\n // Keep track of parent references.\n if (parent) {\n // Ensure we don't create infinite JSON structures.\n Object.defineProperty(component, 'parent', {\n enumerable: false,\n writable: true,\n value: JSON.parse(JSON.stringify(parent)),\n });\n Object.defineProperty(component.parent, 'parent', {\n enumerable: false,\n writable: true,\n value: parent.parent,\n });\n Object.defineProperty(component.parent, 'path', {\n enumerable: false,\n writable: true,\n value: parent.path,\n });\n delete component.parent.components;\n delete component.parent.componentMap;\n delete component.parent.columns;\n delete component.parent.rows;\n }\n Object.defineProperty(component, 'path', {\n enumerable: false,\n writable: true,\n value: (0, index_1.componentPath)(component, path),\n });\n if (includeAll || component.tree || !info.layout) {\n if (yield fn(component, component.path, components, parent)) {\n continue;\n }\n }\n if (info.hasColumns) {\n for (let j = 0; j < component.columns.length; j++) {\n yield eachComponentAsync((_a = component.columns[j]) === null || _a === void 0 ? void 0 : _a.components, fn, includeAll, path, parent ? component : null);\n }\n }\n else if (info.hasRows) {\n for (let j = 0; j < component.rows.length; j++) {\n const row = component.rows[j];\n if (Array.isArray(row)) {\n for (let k = 0; k < row.length; k++) {\n yield eachComponentAsync((_b = row[k]) === null || _b === void 0 ? void 0 : _b.components, fn, includeAll, path, parent ? component : null);\n }\n }\n }\n }\n else if (info.hasComps) {\n yield eachComponentAsync(component.components, fn, includeAll, (0, index_1.componentFormPath)(component, path, component.path), parent ? component : null);\n }\n }\n });\n}\nexports.eachComponentAsync = eachComponentAsync;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/formUtil/eachComponentAsync.js?");
|
1350
1361
|
|
1351
1362
|
/***/ }),
|
1352
1363
|
|
@@ -1357,7 +1368,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
1357
1368
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1358
1369
|
|
1359
1370
|
"use strict";
|
1360
|
-
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 =
|
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 || !data) {\n return;\n }\n return (0, eachComponent_1.eachComponent)(components, (component, compPath, componentComponents, compParent) => {\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 // No need to bother processing all the children data if there is no data for this form or the reference value has not been loaded.\n const nestedFormValue = (0, lodash_1.get)(data, component.path);\n const noReferenceAttached = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) && (0, lodash_1.isEmpty)(nestedFormValue.data) && !(0, lodash_1.has)(nestedFormValue, 'form');\n const shouldProcessNestedFormData = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id)\n ? !noReferenceAttached\n : (0, lodash_1.has)(data, component.path);\n if (shouldProcessNestedFormData) {\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?");
|
1361
1372
|
|
1362
1373
|
/***/ }),
|
1363
1374
|
|
@@ -1368,7 +1379,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1368
1379
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1369
1380
|
|
1370
1381
|
"use strict";
|
1371
|
-
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 =
|
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 || !data) {\n return;\n }\n return yield (0, eachComponentAsync_1.eachComponentAsync)(components, (component, compPath, componentComponents, compParent) => __awaiter(void 0, void 0, void 0, function* () {\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 // No need to bother processing all the children data if there is no data for this form or the reference value has not been loaded.\n const nestedFormValue = (0, lodash_1.get)(data, component.path);\n const noReferenceAttached = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id) && (0, lodash_1.isEmpty)(nestedFormValue.data) && !(0, lodash_1.has)(nestedFormValue, 'form');\n const shouldProcessNestedFormData = (nestedFormValue === null || nestedFormValue === void 0 ? void 0 : nestedFormValue._id)\n ? !noReferenceAttached\n : (0, lodash_1.has)(data, component.path);\n if (shouldProcessNestedFormData) {\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?");
|
1372
1383
|
|
1373
1384
|
/***/ }),
|
1374
1385
|
|
@@ -1379,7 +1390,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
1379
1390
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1380
1391
|
|
1381
1392
|
"use strict";
|
1382
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.eachComponentDataAsync = exports.eachComponentAsync = exports.eachComponentData = exports.eachComponent = exports.compareSelectResourceWithObjectTypeValues = exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.findComponents = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.componentFormPath = exports.componentDataPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES_OF_KNOWN_COMPONENTS = exports.uniqueName = exports.guid = exports.flattenComponents = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst fast_json_patch_1 = __webpack_require__(/*! fast-json-patch */ \"./node_modules/fast-json-patch/index.mjs\");\nconst Evaluator_1 = __webpack_require__(/*! ../Evaluator */ \"./node_modules/@formio/core/lib/utils/Evaluator.js\");\nconst eachComponent_1 = __webpack_require__(/*! ./eachComponent */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponent.js\");\nObject.defineProperty(exports, \"eachComponent\", ({ enumerable: true, get: function () { return eachComponent_1.eachComponent; } }));\nconst eachComponentData_1 = __webpack_require__(/*! ./eachComponentData */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponentData.js\");\nObject.defineProperty(exports, \"eachComponentData\", ({ enumerable: true, get: function () { return eachComponentData_1.eachComponentData; } }));\nconst eachComponentAsync_1 = __webpack_require__(/*! ./eachComponentAsync */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponentAsync.js\");\nObject.defineProperty(exports, \"eachComponentAsync\", ({ enumerable: true, get: function () { return eachComponentAsync_1.eachComponentAsync; } }));\nconst eachComponentDataAsync_1 = __webpack_require__(/*! ./eachComponentDataAsync */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponentDataAsync.js\");\nObject.defineProperty(exports, \"eachComponentDataAsync\", ({ enumerable: true, get: function () { return eachComponentDataAsync_1.eachComponentDataAsync; } }));\n/**\n * Flatten the form components for data manipulation.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n *\n * @returns {Object}\n * The flattened components map.\n */\nfunction flattenComponents(components, includeAll = false) {\n const flattened = {};\n (0, eachComponent_1.eachComponent)(components, (component, path) => {\n flattened[path] = component;\n }, includeAll);\n return flattened;\n}\nexports.flattenComponents = flattenComponents;\nfunction guid() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\nexports.guid = guid;\n/**\n * Make a filename guaranteed to be unique.\n * @param name\n * @param template\n * @param evalContext\n * @returns {string}\n */\nfunction uniqueName(name, template, evalContext) {\n template = template || \"{{fileName}}-{{guid}}\";\n //include guid in template anyway, to prevent overwriting issue if filename matches existing file\n if (!template.includes(\"{{guid}}\")) {\n template = `${template}-{{guid}}`;\n }\n const parts = name.split(\".\");\n let fileName = parts.slice(0, parts.length - 1).join(\".\");\n const extension = parts.length > 1 ? `.${(0, lodash_1.last)(parts)}` : \"\";\n //allow only 100 characters from original name to avoid issues with filename length restrictions\n fileName = fileName.substr(0, 100);\n evalContext = Object.assign(evalContext || {}, {\n fileName,\n guid: guid(),\n });\n //only letters, numbers, dots, dashes, underscores and spaces are allowed. Anything else will be replaced with dash\n const uniqueName = `${Evaluator_1.Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\\-_ ]/g, \"-\");\n return uniqueName;\n}\nexports.uniqueName = uniqueName;\n/**\n * Defines model types for known components.\n * For now, these will be the only model types supported by the @formio/core library.\n *\n * nestedArray: for components that store their data as an array and have nested components.\n * nestedDataArray: for components that store their data as an array and have nested components, but keeps the value of nested components inside 'data' property.\n * array: for components that store their data as an array.\n * dataObject: for components that store their data in a nested { data: {} } object.\n * object: for components that store their data in an object.\n * map: for components that store their data in a map.\n * content: for components that do not store data.\n * string: for components that store their data as a string.\n * number: for components that store their data as a number.\n * boolean: for components that store their data as a boolean.\n * none: for components that do not store data and should not be included in the submission.\n * any: for components that can store any type of data.\n *\n */\nexports.MODEL_TYPES_OF_KNOWN_COMPONENTS = {\n nestedArray: [\n 'datagrid',\n 'editgrid',\n 'datatable',\n 'dynamicWizard',\n ],\n nestedDataArray: [\n 'tagpad',\n ],\n dataObject: [\n 'form'\n ],\n object: [\n 'container',\n 'address',\n ],\n map: [\n 'datamap',\n ],\n content: [\n 'htmlelement',\n 'content'\n ],\n string: [\n 'textfield',\n 'password',\n 'email',\n 'url',\n 'phoneNumber',\n 'day',\n 'datetime',\n 'time',\n 'signature',\n ],\n number: [\n 'number',\n 'currency'\n ],\n boolean: [\n 'checkbox',\n 'radio',\n ],\n none: [\n 'table',\n 'well',\n 'columns',\n 'fieldset',\n 'panel',\n 'tabs'\n ],\n any: [\n 'survey',\n 'captcha',\n 'textarea',\n 'selectboxes',\n 'tags',\n 'select',\n 'hidden',\n 'button',\n 'datasource',\n 'sketchpad',\n 'reviewpage',\n 'file',\n ],\n};\nfunction getModelType(component) {\n // If the component JSON asserts a model type, use that.\n if (component.modelType) {\n return component.modelType;\n }\n // Otherwise, check for known component types.\n for (const type of Object.keys(exports.MODEL_TYPES_OF_KNOWN_COMPONENTS)) {\n if (exports.MODEL_TYPES_OF_KNOWN_COMPONENTS[type].includes(component.type)) {\n return type;\n }\n }\n // Otherwise check for components that assert no value.\n if ((component.input === false)) {\n return 'none';\n }\n // Otherwise default to any.\n return 'any';\n}\nexports.getModelType = getModelType;\nfunction getComponentAbsolutePath(component) {\n let paths = [component.path];\n while (component.parent) {\n component = component.parent;\n // We only need to do this for nested forms because they reset the data contexts for the children.\n if (getModelType(component) === 'dataObject') {\n paths[paths.length - 1] = `data.${paths[paths.length - 1]}`;\n paths.push(component.path);\n }\n }\n return paths.reverse().join('.');\n}\nexports.getComponentAbsolutePath = getComponentAbsolutePath;\nfunction getComponentPath(component, path) {\n const key = getComponentKey(component);\n if (!key) {\n return path;\n }\n if (!path) {\n return key;\n }\n if (path.match(new RegExp(`${key}$`))) {\n return path;\n }\n return (getModelType(component) === 'none') ? `${path}.${key}` : path;\n}\nexports.getComponentPath = getComponentPath;\nfunction isComponentNestedDataType(component) {\n return component.tree || getModelType(component) === 'nestedArray' ||\n getModelType(component) === 'nestedDataArray' ||\n getModelType(component) === 'dataObject' ||\n getModelType(component) === 'object' ||\n getModelType(component) === 'map';\n}\nexports.isComponentNestedDataType = isComponentNestedDataType;\nfunction componentPath(component, parentPath) {\n parentPath = component.parentPath || parentPath;\n const key = getComponentKey(component);\n if (!key) {\n // If the component does not have a key, then just always return the parent path.\n return parentPath || '';\n }\n return parentPath ? `${parentPath}.${key}` : key;\n}\nexports.componentPath = componentPath;\nconst componentDataPath = (component, parentPath, path) => {\n parentPath = component.parentPath || parentPath;\n path = path || componentPath(component, parentPath);\n // See if we are a nested component.\n if (component.components && Array.isArray(component.components)) {\n if (getModelType(component) === 'dataObject') {\n return `${path}.data`;\n }\n if (getModelType(component) === 'nestedArray') {\n return `${path}[0]`;\n }\n if (getModelType(component) === 'nestedDataArray') {\n return `${path}[0].data`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath;\n }\n return path;\n};\nexports.componentDataPath = componentDataPath;\nconst componentFormPath = (component, parentPath, path) => {\n parentPath = component.parentPath || parentPath;\n path = path || componentPath(component, parentPath);\n if (getModelType(component) === 'dataObject') {\n return `${path}.data`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath;\n};\nexports.componentFormPath = componentFormPath;\nfunction getComponentKey(component) {\n if (component.type === 'checkbox' &&\n component.inputType === 'radio' &&\n component.name) {\n return component.name;\n }\n return component.key;\n}\nexports.getComponentKey = getComponentKey;\nfunction getContextualRowPath(component, path) {\n return path.replace(new RegExp(`\\.?${getComponentKey(component)}$`), '');\n}\nexports.getContextualRowPath = getContextualRowPath;\nfunction getContextualRowData(component, path, data) {\n const rowPath = getContextualRowPath(component, path);\n return rowPath ? (0, lodash_1.get)(data, rowPath, null) : data;\n}\nexports.getContextualRowData = getContextualRowData;\nfunction componentInfo(component) {\n const hasColumns = component.columns && Array.isArray(component.columns);\n const hasRows = component.rows && Array.isArray(component.rows);\n const hasComps = component.components && Array.isArray(component.components);\n const isContent = getModelType(component) === 'content';\n const isLayout = getModelType(component) === 'none';\n const isInput = !component.hasOwnProperty('input') || !!component.input;\n return {\n hasColumns,\n hasRows,\n hasComps,\n layout: hasColumns || hasRows || (hasComps && !isInput) || isLayout || isContent,\n iterable: hasColumns || hasRows || hasComps || isContent,\n };\n}\nexports.componentInfo = componentInfo;\n// Provided components, data, and a key, this will return the components data.\nfunction getComponentData(components, data, path) {\n const compData = { component: null, data: null };\n (0, eachComponentData_1.eachComponentData)(components, data, (component, data, row, compPath) => {\n if (compPath === path) {\n compData.component = component;\n compData.data = row;\n return true;\n }\n });\n return compData;\n}\nexports.getComponentData = getComponentData;\nfunction getComponentActualValue(component, compPath, data, row) {\n var _a;\n // The compPath here will NOT contain the indexes for DataGrids and EditGrids.\n //\n // a[0].b[2].c[3].d\n //\n // Because of this, we will need to determine our parent component path (not data path),\n // and find the \"row\" based comp path.\n //\n // a[0].b[2].c[3].d => a.b.c.d\n //\n let parentInputComponent = null;\n let parent = component;\n let rowPath = '';\n while (((_a = parent === null || parent === void 0 ? void 0 : parent.parent) === null || _a === void 0 ? void 0 : _a.path) && !parentInputComponent) {\n parent = parent.parent;\n if (parent.input) {\n parentInputComponent = parent;\n }\n }\n if (parentInputComponent) {\n const parentCompPath = parentInputComponent.path.replace(/\\[[0-9]+\\]/g, '');\n rowPath = compPath.replace(parentCompPath, '');\n rowPath = (0, lodash_1.trim)(rowPath, '. ');\n }\n let value = null;\n if (data) {\n value = (0, lodash_1.get)(data, compPath);\n }\n if (rowPath && row && (0, lodash_1.isNil)(value)) {\n value = (0, lodash_1.get)(row, rowPath);\n }\n if ((0, lodash_1.isNil)(value) || ((0, lodash_1.isObject)(value) && (0, lodash_1.isEmpty)(value))) {\n value = '';\n }\n return value;\n}\nexports.getComponentActualValue = getComponentActualValue;\n/**\n * Determine if a component is a layout component or not.\n *\n * @param {Object} component\n * The component to check.\n *\n * @returns {Boolean}\n * Whether or not the component is a layout component.\n */\nfunction isLayoutComponent(component) {\n return Boolean((component.columns && Array.isArray(component.columns)) ||\n (component.rows && Array.isArray(component.rows)) ||\n (component.components && Array.isArray(component.components)));\n}\nexports.isLayoutComponent = isLayoutComponent;\n/**\n * Matches if a component matches the query.\n *\n * @param component\n * @param query\n * @return {boolean}\n */\nfunction matchComponent(component, query) {\n if ((0, lodash_1.isString)(query)) {\n return (component.key === query) || (component.path === query);\n }\n else {\n let matches = false;\n (0, lodash_1.forOwn)(query, (value, key) => {\n matches = ((0, lodash_1.get)(component, key) === value);\n if (!matches) {\n return false;\n }\n });\n return matches;\n }\n}\nexports.matchComponent = matchComponent;\n/**\n * Get a component by its key\n *\n * @param {Object} components - The components to iterate.\n * @param {String|Object} key - The key of the component to get, or a query of the component to search.\n * @param {boolean} includeAll - Whether or not to include layout components.\n * @returns {Component} - The component that matches the given key, or undefined if not found.\n */\nfunction getComponent(components, key, includeAll = false) {\n let result;\n (0, eachComponent_1.eachComponent)(components, (component, path) => {\n if ((path === key) || (component.path === key) || (component.input && (component.key === key))) {\n result = component;\n return true;\n }\n }, includeAll);\n return result;\n}\nexports.getComponent = getComponent;\n/**\n * Finds a component provided a query of properties of that component.\n *\n * @param components\n * @param query\n * @return {*}\n */\nfunction searchComponents(components, query) {\n const results = [];\n (0, eachComponent_1.eachComponent)(components, (component) => {\n if (matchComponent(component, query)) {\n results.push(component);\n }\n }, true);\n return results;\n}\nexports.searchComponents = searchComponents;\n/**\n * Deprecated version of findComponents. Renamed to searchComponents.\n * @param {import('@formio/core').Component[]} components - The components to find components within.\n * @param {object} query - The query to use when searching for the components.\n * @returns {import('@formio/core').Component[]} - The result of the component that is found.\n */\nfunction findComponents(components, query) {\n console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');\n return searchComponents(components, query);\n}\nexports.findComponents = findComponents;\n/**\n * Remove a component by path.\n *\n * @param components\n * @param path\n */\nfunction removeComponent(components, path) {\n // Using _.unset() leave a null value. Use Array splice instead.\n // @ts-ignore\n var index = path.pop();\n if (path.length !== 0) {\n components = (0, lodash_1.get)(components, path);\n }\n components.splice(index, 1);\n}\nexports.removeComponent = removeComponent;\n/**\n * Returns if this component has a conditional statement.\n *\n * @param component - The component JSON schema.\n *\n * @returns {boolean} - TRUE - This component has a conditional, FALSE - No conditional provided.\n */\nfunction hasCondition(component) {\n return Boolean((component.customConditional) ||\n (component.conditional && (component.conditional.when ||\n component.conditional.json ||\n (component.conditional.conjunction && (0, lodash_1.isBoolean)(component.conditional.show) && !(0, lodash_1.isEmpty)(component.conditional.conditions)))));\n}\nexports.hasCondition = hasCondition;\n/**\n * Extension of standard #parseFloat(value) function, that also clears input string.\n *\n * @param {any} value\n * The value to parse.\n *\n * @returns {Number}\n * Parsed value.\n */\nfunction parseFloatExt(value) {\n return parseFloat((0, lodash_1.isString)(value)\n ? value.replace(/[^\\de.+-]/gi, '')\n : value);\n}\nexports.parseFloatExt = parseFloatExt;\n/**\n * Formats provided value in way how Currency component uses it.\n *\n * @param {any} value\n * The value to format.\n *\n * @returns {String}\n * Value formatted for Currency component.\n */\nfunction formatAsCurrency(value) {\n const parsedValue = parseFloatExt(value);\n if (isNaN(parsedValue)) {\n return '';\n }\n const parts = (0, lodash_1.round)(parsedValue, 2)\n .toString()\n .split('.');\n parts[0] = (0, lodash_1.chunk)(Array.from(parts[0]).reverse(), 3)\n .reverse()\n .map((part) => part\n .reverse()\n .join(''))\n .join(',');\n parts[1] = (0, lodash_1.pad)(parts[1], 2, '0');\n return parts.join('.');\n}\nexports.formatAsCurrency = formatAsCurrency;\n/**\n * Escapes RegEx characters in provided String value.\n *\n * @param {String} value\n * String for escaping RegEx characters.\n * @returns {string}\n * String with escaped RegEx characters.\n */\nfunction escapeRegExCharacters(value) {\n return value.replace(/[-[\\]/{}()*+?.\\\\^$|]/g, '\\\\$&');\n}\nexports.escapeRegExCharacters = escapeRegExCharacters;\n/**\n * Get the value for a component key, in the given submission.\n *\n * @param {Object} submission\n * A submission object to search.\n * @param {String} key\n * A for components API key to search for.\n */\nfunction getValue(submission, key) {\n const search = (data) => {\n if ((0, lodash_1.isPlainObject)(data)) {\n if ((0, lodash_1.has)(data, key)) {\n return (0, lodash_1.get)(data, key);\n }\n let value = null;\n (0, lodash_1.forOwn)(data, (prop) => {\n const result = search(prop);\n if (!(0, lodash_1.isNil)(result)) {\n value = result;\n return false;\n }\n });\n return value;\n }\n else {\n return null;\n }\n };\n return search(submission.data);\n}\nexports.getValue = getValue;\n/**\n * Iterate over all components in a form and get string values for translation.\n * @param form\n */\nfunction getStrings(form) {\n const properties = ['label', 'title', 'legend', 'tooltip', 'description', 'placeholder', 'prefix', 'suffix', 'errorLabel', 'content', 'html'];\n const strings = [];\n (0, eachComponent_1.eachComponent)(form.components, (component) => {\n properties.forEach(property => {\n if (component.hasOwnProperty(property) && component[property]) {\n strings.push({\n key: component.key,\n type: component.type,\n property,\n string: component[property]\n });\n }\n });\n if ((!component.dataSrc || component.dataSrc === 'values') && component.hasOwnProperty('values') && Array.isArray(component.values) && component.values.length) {\n component.values.forEach((value, index) => {\n strings.push({\n key: component.key,\n property: `value[${index}].label`,\n string: component.values[index].label\n });\n });\n }\n // Hard coded values from Day component\n if (component.type === 'day') {\n [\n 'day',\n 'month',\n 'year',\n 'Day',\n 'Month',\n 'Year',\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december'\n ].forEach(string => {\n strings.push({\n key: component.key,\n property: 'day',\n string,\n });\n });\n if (component.fields.day.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.day.placeholder',\n string: component.fields.day.placeholder,\n });\n }\n if (component.fields.month.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.month.placeholder',\n string: component.fields.month.placeholder,\n });\n }\n if (component.fields.year.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.year.placeholder',\n string: component.fields.year.placeholder,\n });\n }\n }\n if (component.type === 'editgrid') {\n const string = component.addAnother || 'Add Another';\n if (component.addAnother) {\n strings.push({\n key: component.key,\n property: 'addAnother',\n string,\n });\n }\n }\n if (component.type === 'select') {\n [\n 'loading...',\n 'Type to search'\n ].forEach(string => {\n strings.push({\n key: component.key,\n property: 'select',\n string,\n });\n });\n }\n }, true);\n return strings;\n}\nexports.getStrings = getStrings;\n// ?????????????????????????\n// questionable section\nfunction generateFormChange(type, data) {\n let change;\n switch (type) {\n case 'add':\n change = {\n op: 'add',\n key: data.component.key,\n container: data.parent.key, // Parent component\n path: data.path, // Path to container within parent component.\n index: data.index, // Index of component in parent container.\n component: data.component\n };\n break;\n case 'edit':\n change = {\n op: 'edit',\n key: data.originalComponent.key,\n patches: (0, fast_json_patch_1.compare)(data.originalComponent, data.component)\n };\n // Don't save if nothing changed.\n if (!change.patches.length) {\n change = null;\n }\n break;\n case 'remove':\n change = {\n op: 'remove',\n key: data.component.key,\n };\n break;\n }\n return change;\n}\nexports.generateFormChange = generateFormChange;\nfunction applyFormChanges(form, changes) {\n const failed = [];\n changes.forEach(function (change) {\n var found = false;\n switch (change.op) {\n case 'add':\n var newComponent = change.component;\n // Find the container to set the component in.\n findComponent(form.components, change.container, null, function (parent) {\n if (!change.container) {\n parent = form;\n }\n // A move will first run an add so remove any existing components with matching key before inserting.\n findComponent(form.components, change.key, null, function (component, path) {\n // If found, use the existing component. (If someone else edited it, the changes would be here)\n newComponent = component;\n removeComponent(form.components, path);\n });\n found = true;\n var container = (0, lodash_1.get)(parent, change.path);\n container.splice(change.index, 0, newComponent);\n });\n break;\n case 'remove':\n findComponent(form.components, change.key, null, function (component, path) {\n found = true;\n const oldComponent = (0, lodash_1.get)(form.components, path);\n if (oldComponent.key !== component.key) {\n path.pop();\n }\n removeComponent(form.components, path);\n });\n break;\n case 'edit':\n findComponent(form.components, change.key, null, function (component, path) {\n found = true;\n try {\n const oldComponent = (0, lodash_1.get)(form.components, path);\n const newComponent = (0, fast_json_patch_1.applyPatch)(component, change.patches).newDocument;\n if (oldComponent.key !== newComponent.key) {\n path.pop();\n }\n (0, lodash_1.set)(form.components, path, newComponent);\n }\n catch (err) {\n failed.push(change);\n }\n });\n break;\n case 'move':\n break;\n }\n if (!found) {\n failed.push(change);\n }\n });\n return {\n form,\n failed\n };\n}\nexports.applyFormChanges = applyFormChanges;\n/**\n* This function will find a component in a form and return the component AND THE PATH to the component in the form.\n* Path to the component is stored as an array of nested components and their indexes.The Path is being filled recursively\n* when you iterating through the nested structure.\n* If the component is not found the callback won't be called and function won't return anything.\n*\n* @param components\n* @param key\n* @param fn\n* @param path\n* @returns {*}\n*/\nfunction findComponent(components, key, path, fn) {\n if (!components)\n return;\n path = path || [];\n if (!key) {\n return fn(components);\n }\n components.forEach(function (component, index) {\n var newPath = path.slice();\n // Add an index of the component it iterates through in nested structure\n newPath.push(index);\n if (!component)\n return;\n if (component.hasOwnProperty('columns') && Array.isArray(component.columns)) {\n newPath.push('columns');\n component.columns.forEach(function (column, index) {\n var colPath = newPath.slice();\n colPath.push(index);\n colPath.push('components');\n findComponent(column.components, key, colPath, fn);\n });\n }\n if (component.hasOwnProperty('rows') && Array.isArray(component.rows)) {\n newPath.push('rows');\n component.rows.forEach(function (row, index) {\n var rowPath = newPath.slice();\n rowPath.push(index);\n row.forEach(function (column, index) {\n var colPath = rowPath.slice();\n colPath.push(index);\n colPath.push('components');\n findComponent(column.components, key, colPath, fn);\n });\n });\n }\n if (component.hasOwnProperty('components') && Array.isArray(component.components)) {\n newPath.push('components');\n findComponent(component.components, key, newPath, fn);\n }\n if (component.key === key) {\n //Final callback if the component is found\n fn(component, newPath, components);\n }\n });\n}\nexports.findComponent = findComponent;\nconst isCheckboxComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'checkbox';\nconst isDataGridComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datagrid';\nconst isEditGridComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'editgrid';\nconst isAddressComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'address';\nconst isDataTableComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datatable';\nconst hasChildComponents = (component) => (component === null || component === void 0 ? void 0 : component.components) != null;\nconst isDateTimeComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datetime';\nconst isSelectBoxesComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'selectboxes';\nconst isTextAreaComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'textarea';\nconst isTextFieldComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'textfield';\nfunction getEmptyValue(component) {\n switch (component.type) {\n case 'textarea':\n case 'textfield':\n case 'time':\n case 'datetime':\n case 'day':\n return '';\n case 'datagrid':\n case 'editgrid':\n return [];\n default:\n return null;\n }\n}\nexports.getEmptyValue = getEmptyValue;\nconst replaceBlanks = (value) => {\n const nbsp = '<p> </p>';\n const br = '<p><br></p>';\n const brNbsp = '<p><br> </p>';\n const regExp = new RegExp(`^${nbsp}|${nbsp}$|^${br}|${br}$|^${brNbsp}|${brNbsp}$`, 'g');\n return typeof value === 'string' ? value.replace(regExp, '').trim() : value;\n};\nfunction trimBlanks(value) {\n if (!value) {\n return value;\n }\n if (Array.isArray(value)) {\n value = value.map((val) => replaceBlanks(val));\n }\n else {\n value = replaceBlanks(value);\n }\n return value;\n}\nfunction isValueEmpty(component, value) {\n const compValueIsEmptyArray = ((0, lodash_1.isArray)(value) && value.length === 1) ? (0, lodash_1.isEqual)(value[0], getEmptyValue(component)) : false;\n return value == null || value === '' || ((0, lodash_1.isArray)(value) && value.length === 0) || compValueIsEmptyArray;\n}\nfunction isComponentDataEmpty(component, data, path, valueCond) {\n var _a;\n const value = (0, lodash_1.isNil)(valueCond) ? (0, lodash_1.get)(data, path) : valueCond;\n const addressIgnoreProperties = ['mode', 'address'];\n if (isCheckboxComponent(component)) {\n return isValueEmpty(component, value) || value === false;\n }\n else if (isAddressComponent(component)) {\n if (Object.keys(value).length === 0) {\n return true;\n }\n return !Object.values((0, lodash_1.omit)(value, addressIgnoreProperties)).some(Boolean);\n }\n else if (isDataGridComponent(component) || isEditGridComponent(component) || isDataTableComponent(component) || hasChildComponents(component)) {\n if ((_a = component.components) === null || _a === void 0 ? void 0 : _a.length) {\n let childrenEmpty = true;\n // wrap component in an array to let eachComponentData handle introspection to child components (e.g. this will be different\n // for data grids versus nested forms, etc.)\n (0, eachComponentData_1.eachComponentData)([component], data, (thisComponent, data, row, path, components, index) => {\n if (component.key === thisComponent.key)\n return;\n if (!isComponentDataEmpty(thisComponent, data, path)) {\n childrenEmpty = false;\n }\n });\n return isValueEmpty(component, value) || childrenEmpty;\n }\n return isValueEmpty(component, value);\n }\n else if (isDateTimeComponent(component)) {\n return isValueEmpty(component, value) || value.toString() === 'Invalid date';\n }\n else if (isSelectBoxesComponent(component)) {\n let selectBoxEmpty = true;\n for (const key in value) {\n if (value[key]) {\n selectBoxEmpty = false;\n break;\n }\n }\n return isValueEmpty(component, value) || selectBoxEmpty;\n }\n else if (isTextAreaComponent(component)) {\n const isPlain = !component.wysiwyg && !component.editor;\n return isPlain ? typeof value === 'string' ? isValueEmpty(component, value.trim()) : isValueEmpty(component, value) : isValueEmpty(component, trimBlanks(value));\n }\n else if (isTextFieldComponent(component)) {\n if (component.allowMultipleMasks && !!component.inputMasks && !!component.inputMasks.length) {\n return isValueEmpty(component, value) || (component.multiple ? value.length === 0 : (!value.maskName || !value.value));\n }\n return isValueEmpty(component, value === null || value === void 0 ? void 0 : value.toString().trim());\n }\n return isValueEmpty(component, value);\n}\nexports.isComponentDataEmpty = isComponentDataEmpty;\n/**\n * Returns the template keys inside the template code.\n * @param {string} template - The template to get the keys from.\n * @returns {Array<string>} - The keys inside the template.\n */\nfunction getItemTemplateKeys(template) {\n const templateKeys = [];\n if (!template) {\n return templateKeys;\n }\n const keys = template.match(/({{\\s*(.*?)\\s*}})/g);\n if (keys) {\n keys.forEach((key) => {\n const propKey = key.match(/{{\\s*item\\.(.*?)\\s*}}/);\n if (propKey && propKey.length > 1) {\n templateKeys.push(propKey[1]);\n }\n });\n }\n return templateKeys;\n}\nexports.getItemTemplateKeys = getItemTemplateKeys;\n/**\n * Returns if the component is a select resource with an object for its value.\n * @param {Component} comp - The component to check.\n * @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.\n */\nfunction isSelectResourceWithObjectValue(comp = {}) {\n const { reference, dataSrc, valueProperty } = comp;\n return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));\n}\nexports.isSelectResourceWithObjectValue = isSelectResourceWithObjectValue;\n/**\n * Compares real select resource value with expected value in condition.\n * @param {any} value - current value of selectcomponent.\n * @param {any} comparedValue - expocted value of select component.\n * @param {SelectComponent} conditionComponent - select component on which the condtion is based.\n * @returns {boolean} - TRUE if the select component current value is equal to the expected value; FALSE otherwise.\n */\nfunction compareSelectResourceWithObjectTypeValues(value, comparedValue, conditionComponent) {\n if (!value || !(0, lodash_1.isPlainObject)(value)) {\n return false;\n }\n const { template, valueProperty } = conditionComponent;\n if (valueProperty === 'data') {\n value = { data: value };\n comparedValue = { data: comparedValue };\n }\n return (0, lodash_1.every)(getItemTemplateKeys(template) || [], (k) => (0, lodash_1.isEqual)((0, lodash_1.get)(value, k), (0, lodash_1.get)(comparedValue, k)));\n}\nexports.compareSelectResourceWithObjectTypeValues = compareSelectResourceWithObjectTypeValues;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/formUtil/index.js?");
|
1393
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.eachComponentDataAsync = exports.eachComponentAsync = exports.eachComponentData = exports.eachComponent = exports.compareSelectResourceWithObjectTypeValues = exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.isComponentDataEmpty = exports.getEmptyValue = exports.findComponent = exports.applyFormChanges = exports.generateFormChange = exports.getStrings = exports.getValue = exports.escapeRegExCharacters = exports.formatAsCurrency = exports.parseFloatExt = exports.hasCondition = exports.removeComponent = exports.findComponents = exports.searchComponents = exports.getComponent = exports.matchComponent = exports.isLayoutComponent = exports.getComponentActualValue = exports.getComponentData = exports.componentInfo = exports.getContextualRowData = exports.getContextualRowPath = exports.getComponentKey = exports.componentFormPath = exports.componentDataPath = exports.componentPath = exports.isComponentNestedDataType = exports.getComponentPath = exports.getComponentAbsolutePath = exports.getModelType = exports.MODEL_TYPES_OF_KNOWN_COMPONENTS = exports.uniqueName = exports.guid = exports.flattenComponents = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst fast_json_patch_1 = __webpack_require__(/*! fast-json-patch */ \"./node_modules/fast-json-patch/index.mjs\");\nconst Evaluator_1 = __webpack_require__(/*! ../Evaluator */ \"./node_modules/@formio/core/lib/utils/Evaluator.js\");\nconst eachComponent_1 = __webpack_require__(/*! ./eachComponent */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponent.js\");\nObject.defineProperty(exports, \"eachComponent\", ({ enumerable: true, get: function () { return eachComponent_1.eachComponent; } }));\nconst eachComponentData_1 = __webpack_require__(/*! ./eachComponentData */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponentData.js\");\nObject.defineProperty(exports, \"eachComponentData\", ({ enumerable: true, get: function () { return eachComponentData_1.eachComponentData; } }));\nconst eachComponentAsync_1 = __webpack_require__(/*! ./eachComponentAsync */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponentAsync.js\");\nObject.defineProperty(exports, \"eachComponentAsync\", ({ enumerable: true, get: function () { return eachComponentAsync_1.eachComponentAsync; } }));\nconst eachComponentDataAsync_1 = __webpack_require__(/*! ./eachComponentDataAsync */ \"./node_modules/@formio/core/lib/utils/formUtil/eachComponentDataAsync.js\");\nObject.defineProperty(exports, \"eachComponentDataAsync\", ({ enumerable: true, get: function () { return eachComponentDataAsync_1.eachComponentDataAsync; } }));\n/**\n * Flatten the form components for data manipulation.\n *\n * @param {Object} components\n * The components to iterate.\n * @param {Boolean} includeAll\n * Whether or not to include layout components.\n *\n * @returns {Object}\n * The flattened components map.\n */\nfunction flattenComponents(components, includeAll = false) {\n const flattened = {};\n (0, eachComponent_1.eachComponent)(components, (component, path) => {\n flattened[path] = component;\n }, includeAll);\n return flattened;\n}\nexports.flattenComponents = flattenComponents;\nfunction guid() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\nexports.guid = guid;\n/**\n * Make a filename guaranteed to be unique.\n * @param name\n * @param template\n * @param evalContext\n * @returns {string}\n */\nfunction uniqueName(name, template, evalContext) {\n template = template || '{{fileName}}-{{guid}}';\n //include guid in template anyway, to prevent overwriting issue if filename matches existing file\n if (!template.includes('{{guid}}')) {\n template = `${template}-{{guid}}`;\n }\n const parts = name.split('.');\n let fileName = parts.slice(0, parts.length - 1).join('.');\n const extension = parts.length > 1 ? `.${(0, lodash_1.last)(parts)}` : '';\n //allow only 100 characters from original name to avoid issues with filename length restrictions\n fileName = fileName.substr(0, 100);\n evalContext = Object.assign(evalContext || {}, {\n fileName,\n guid: guid(),\n });\n //only letters, numbers, dots, dashes, underscores and spaces are allowed. Anything else will be replaced with dash\n const uniqueName = `${Evaluator_1.Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\\-_ ]/g, '-');\n return uniqueName;\n}\nexports.uniqueName = uniqueName;\n/**\n * Defines model types for known components.\n * For now, these will be the only model types supported by the @formio/core library.\n *\n * nestedArray: for components that store their data as an array and have nested components.\n * nestedDataArray: for components that store their data as an array and have nested components, but keeps the value of nested components inside 'data' property.\n * array: for components that store their data as an array.\n * dataObject: for components that store their data in a nested { data: {} } object.\n * object: for components that store their data in an object.\n * map: for components that store their data in a map.\n * content: for components that do not store data.\n * string: for components that store their data as a string.\n * number: for components that store their data as a number.\n * boolean: for components that store their data as a boolean.\n * none: for components that do not store data and should not be included in the submission.\n * any: for components that can store any type of data.\n *\n */\nexports.MODEL_TYPES_OF_KNOWN_COMPONENTS = {\n nestedArray: ['datagrid', 'editgrid', 'datatable', 'dynamicWizard'],\n nestedDataArray: ['tagpad'],\n dataObject: ['form'],\n object: ['container', 'address'],\n map: ['datamap'],\n content: ['htmlelement', 'content'],\n string: [\n 'textfield',\n 'password',\n 'email',\n 'url',\n 'phoneNumber',\n 'day',\n 'datetime',\n 'time',\n 'signature',\n ],\n number: ['number', 'currency'],\n boolean: ['checkbox', 'radio'],\n none: ['table', 'well', 'columns', 'fieldset', 'panel', 'tabs'],\n any: [\n 'survey',\n 'captcha',\n 'textarea',\n 'selectboxes',\n 'tags',\n 'select',\n 'hidden',\n 'button',\n 'datasource',\n 'sketchpad',\n 'reviewpage',\n 'file',\n ],\n};\nfunction getModelType(component) {\n // If the component JSON asserts a model type, use that.\n if (component.modelType) {\n return component.modelType;\n }\n // Otherwise, check for known component types.\n for (const type of Object.keys(exports.MODEL_TYPES_OF_KNOWN_COMPONENTS)) {\n if (exports.MODEL_TYPES_OF_KNOWN_COMPONENTS[type].includes(component.type)) {\n return type;\n }\n }\n // Otherwise check for components that assert no value.\n if (component.input === false) {\n return 'none';\n }\n // Otherwise default to any.\n return 'any';\n}\nexports.getModelType = getModelType;\nfunction getComponentAbsolutePath(component) {\n const paths = [component.path];\n while (component.parent) {\n component = component.parent;\n // We only need to do this for nested forms because they reset the data contexts for the children.\n if (getModelType(component) === 'dataObject') {\n paths[paths.length - 1] = `data.${paths[paths.length - 1]}`;\n paths.push(component.path);\n }\n }\n return paths.reverse().join('.');\n}\nexports.getComponentAbsolutePath = getComponentAbsolutePath;\nfunction getComponentPath(component, path) {\n const key = getComponentKey(component);\n if (!key) {\n return path;\n }\n if (!path) {\n return key;\n }\n if (path.match(new RegExp(`${key}$`))) {\n return path;\n }\n return getModelType(component) === 'none' ? `${path}.${key}` : path;\n}\nexports.getComponentPath = getComponentPath;\nfunction isComponentNestedDataType(component) {\n return (component.tree ||\n getModelType(component) === 'nestedArray' ||\n getModelType(component) === 'nestedDataArray' ||\n getModelType(component) === 'dataObject' ||\n getModelType(component) === 'object' ||\n getModelType(component) === 'map');\n}\nexports.isComponentNestedDataType = isComponentNestedDataType;\nfunction componentPath(component, parentPath) {\n parentPath = component.parentPath || parentPath;\n const key = getComponentKey(component);\n if (!key) {\n // If the component does not have a key, then just always return the parent path.\n return parentPath || '';\n }\n return parentPath ? `${parentPath}.${key}` : key;\n}\nexports.componentPath = componentPath;\nconst componentDataPath = (component, parentPath, path) => {\n parentPath = component.parentPath || parentPath;\n path = path || componentPath(component, parentPath);\n // See if we are a nested component.\n if (component.components && Array.isArray(component.components)) {\n if (getModelType(component) === 'dataObject') {\n return `${path}.data`;\n }\n if (getModelType(component) === 'nestedArray') {\n return `${path}[0]`;\n }\n if (getModelType(component) === 'nestedDataArray') {\n return `${path}[0].data`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath;\n }\n return path;\n};\nexports.componentDataPath = componentDataPath;\nconst componentFormPath = (component, parentPath, path) => {\n parentPath = component.parentPath || parentPath;\n path = path || componentPath(component, parentPath);\n if (getModelType(component) === 'dataObject') {\n return `${path}.data`;\n }\n if (isComponentNestedDataType(component)) {\n return path;\n }\n return parentPath;\n};\nexports.componentFormPath = componentFormPath;\nfunction getComponentKey(component) {\n if (component.type === 'checkbox' &&\n component.inputType === 'radio' &&\n component.name) {\n return component.name;\n }\n return component.key;\n}\nexports.getComponentKey = getComponentKey;\nfunction getContextualRowPath(component, path) {\n return path.replace(new RegExp(`.?${getComponentKey(component)}$`), '');\n}\nexports.getContextualRowPath = getContextualRowPath;\nfunction getContextualRowData(component, path, data) {\n const rowPath = getContextualRowPath(component, path);\n return rowPath ? (0, lodash_1.get)(data, rowPath, null) : data;\n}\nexports.getContextualRowData = getContextualRowData;\nfunction componentInfo(component) {\n const hasColumns = component.columns && Array.isArray(component.columns);\n const hasRows = component.rows && Array.isArray(component.rows);\n const hasComps = component.components && Array.isArray(component.components);\n const isContent = getModelType(component) === 'content';\n const isLayout = getModelType(component) === 'none';\n const isInput = !component.hasOwnProperty('input') || !!component.input;\n return {\n hasColumns,\n hasRows,\n hasComps,\n layout: hasColumns || hasRows || (hasComps && !isInput) || isLayout || isContent,\n iterable: hasColumns || hasRows || hasComps || isContent,\n };\n}\nexports.componentInfo = componentInfo;\n// Provided components, data, and a key, this will return the components data.\nfunction getComponentData(components, data, path) {\n const compData = { component: null, data: null };\n (0, eachComponentData_1.eachComponentData)(components, data, (component, data, row, compPath) => {\n if (compPath === path) {\n compData.component = component;\n compData.data = row;\n return true;\n }\n });\n return compData;\n}\nexports.getComponentData = getComponentData;\nfunction getComponentActualValue(component, compPath, data, row) {\n var _a;\n // The compPath here will NOT contain the indexes for DataGrids and EditGrids.\n //\n // a[0].b[2].c[3].d\n //\n // Because of this, we will need to determine our parent component path (not data path),\n // and find the \"row\" based comp path.\n //\n // a[0].b[2].c[3].d => a.b.c.d\n //\n let parentInputComponent = null;\n let parent = component;\n let rowPath = '';\n while (((_a = parent === null || parent === void 0 ? void 0 : parent.parent) === null || _a === void 0 ? void 0 : _a.path) && !parentInputComponent) {\n parent = parent.parent;\n if (parent.input) {\n parentInputComponent = parent;\n }\n }\n if (parentInputComponent) {\n const parentCompPath = parentInputComponent.path.replace(/\\[[0-9]+\\]/g, '');\n rowPath = compPath.replace(parentCompPath, '');\n rowPath = (0, lodash_1.trim)(rowPath, '. ');\n }\n let value = null;\n if (data) {\n value = (0, lodash_1.get)(data, compPath);\n }\n if (rowPath && row && (0, lodash_1.isNil)(value)) {\n value = (0, lodash_1.get)(row, rowPath);\n }\n if ((0, lodash_1.isNil)(value) || ((0, lodash_1.isObject)(value) && (0, lodash_1.isEmpty)(value))) {\n value = '';\n }\n return value;\n}\nexports.getComponentActualValue = getComponentActualValue;\n/**\n * Determine if a component is a layout component or not.\n *\n * @param {Object} component\n * The component to check.\n *\n * @returns {Boolean}\n * Whether or not the component is a layout component.\n */\nfunction isLayoutComponent(component) {\n return Boolean((component.columns &&\n Array.isArray(component.columns)) ||\n (component.rows && Array.isArray(component.rows)) ||\n (component.components &&\n Array.isArray(component.components)));\n}\nexports.isLayoutComponent = isLayoutComponent;\n/**\n * Matches if a component matches the query.\n *\n * @param component\n * @param query\n * @return {boolean}\n */\nfunction matchComponent(component, query) {\n if ((0, lodash_1.isString)(query)) {\n return component.key === query || component.path === query;\n }\n else {\n let matches = false;\n (0, lodash_1.forOwn)(query, (value, key) => {\n matches = (0, lodash_1.get)(component, key) === value;\n if (!matches) {\n return false;\n }\n });\n return matches;\n }\n}\nexports.matchComponent = matchComponent;\n/**\n * Get a component by its key\n *\n * @param {Object} components - The components to iterate.\n * @param {String|Object} key - The key of the component to get, or a query of the component to search.\n * @param {boolean} includeAll - Whether or not to include layout components.\n * @returns {Component} - The component that matches the given key, or undefined if not found.\n */\nfunction getComponent(components, key, includeAll = false) {\n let result;\n (0, eachComponent_1.eachComponent)(components, (component, path) => {\n if (path === key || component.path === key || (component.input && component.key === key)) {\n result = component;\n return true;\n }\n }, includeAll);\n return result;\n}\nexports.getComponent = getComponent;\n/**\n * Finds a component provided a query of properties of that component.\n *\n * @param components\n * @param query\n * @return {*}\n */\nfunction searchComponents(components, query) {\n const results = [];\n (0, eachComponent_1.eachComponent)(components, (component) => {\n if (matchComponent(component, query)) {\n results.push(component);\n }\n }, true);\n return results;\n}\nexports.searchComponents = searchComponents;\n/**\n * Deprecated version of findComponents. Renamed to searchComponents.\n * @param {import('@formio/core').Component[]} components - The components to find components within.\n * @param {object} query - The query to use when searching for the components.\n * @returns {import('@formio/core').Component[]} - The result of the component that is found.\n */\nfunction findComponents(components, query) {\n console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');\n return searchComponents(components, query);\n}\nexports.findComponents = findComponents;\n/**\n * Remove a component by path.\n *\n * @param components\n * @param path\n */\nfunction removeComponent(components, path) {\n // Using _.unset() leave a null value. Use Array splice instead.\n // @ts-expect-error - no clue why we did this, isn't it a string?\n const index = path.pop();\n if (path.length !== 0) {\n components = (0, lodash_1.get)(components, path);\n }\n components.splice(index, 1);\n}\nexports.removeComponent = removeComponent;\n/**\n * Returns if this component has a conditional statement.\n *\n * @param component - The component JSON schema.\n *\n * @returns {boolean} - TRUE - This component has a conditional, FALSE - No conditional provided.\n */\nfunction hasCondition(component) {\n return Boolean(component.customConditional ||\n (component.conditional &&\n (component.conditional.when ||\n component.conditional.json ||\n (component.conditional.conjunction &&\n (0, lodash_1.isBoolean)(component.conditional.show) &&\n !(0, lodash_1.isEmpty)(component.conditional.conditions)))));\n}\nexports.hasCondition = hasCondition;\n/**\n * Extension of standard #parseFloat(value) function, that also clears input string.\n *\n * @param {any} value\n * The value to parse.\n *\n * @returns {Number}\n * Parsed value.\n */\nfunction parseFloatExt(value) {\n return parseFloat((0, lodash_1.isString)(value) ? value.replace(/[^\\de.+-]/gi, '') : value);\n}\nexports.parseFloatExt = parseFloatExt;\n/**\n * Formats provided value in way how Currency component uses it.\n *\n * @param {any} value\n * The value to format.\n *\n * @returns {String}\n * Value formatted for Currency component.\n */\nfunction formatAsCurrency(value) {\n const parsedValue = parseFloatExt(value);\n if (isNaN(parsedValue)) {\n return '';\n }\n const parts = (0, lodash_1.round)(parsedValue, 2).toString().split('.');\n parts[0] = (0, lodash_1.chunk)(Array.from(parts[0]).reverse(), 3)\n .reverse()\n .map((part) => part.reverse().join(''))\n .join(',');\n parts[1] = (0, lodash_1.pad)(parts[1], 2, '0');\n return parts.join('.');\n}\nexports.formatAsCurrency = formatAsCurrency;\n/**\n * Escapes RegEx characters in provided String value.\n *\n * @param {String} value\n * String for escaping RegEx characters.\n * @returns {string}\n * String with escaped RegEx characters.\n */\nfunction escapeRegExCharacters(value) {\n return value.replace(/[-[\\]/{}()*+?.\\\\^$|]/g, '\\\\$&');\n}\nexports.escapeRegExCharacters = escapeRegExCharacters;\n/**\n * Get the value for a component key, in the given submission.\n *\n * @param {Object} submission\n * A submission object to search.\n * @param {String} key\n * A for components API key to search for.\n */\nfunction getValue(submission, key) {\n const search = (data) => {\n if ((0, lodash_1.isPlainObject)(data)) {\n if ((0, lodash_1.has)(data, key)) {\n return (0, lodash_1.get)(data, key);\n }\n let value = null;\n (0, lodash_1.forOwn)(data, (prop) => {\n const result = search(prop);\n if (!(0, lodash_1.isNil)(result)) {\n value = result;\n return false;\n }\n });\n return value;\n }\n else {\n return null;\n }\n };\n return search(submission.data);\n}\nexports.getValue = getValue;\n/**\n * Iterate over all components in a form and get string values for translation.\n * @param form\n */\nfunction getStrings(form) {\n const properties = [\n 'label',\n 'title',\n 'legend',\n 'tooltip',\n 'description',\n 'placeholder',\n 'prefix',\n 'suffix',\n 'errorLabel',\n 'content',\n 'html',\n ];\n const strings = [];\n (0, eachComponent_1.eachComponent)(form.components, (component) => {\n properties.forEach((property) => {\n if (component.hasOwnProperty(property) && component[property]) {\n strings.push({\n key: component.key,\n type: component.type,\n property,\n string: component[property],\n });\n }\n });\n if ((!component.dataSrc || component.dataSrc === 'values') &&\n component.hasOwnProperty('values') &&\n Array.isArray(component.values) &&\n component.values.length) {\n component.values.forEach((value, index) => {\n strings.push({\n key: component.key,\n property: `value[${index}].label`,\n string: component.values[index].label,\n });\n });\n }\n // Hard coded values from Day component\n if (component.type === 'day') {\n [\n 'day',\n 'month',\n 'year',\n 'Day',\n 'Month',\n 'Year',\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december',\n ].forEach((string) => {\n strings.push({\n key: component.key,\n property: 'day',\n string,\n });\n });\n if (component.fields.day.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.day.placeholder',\n string: component.fields.day.placeholder,\n });\n }\n if (component.fields.month.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.month.placeholder',\n string: component.fields.month.placeholder,\n });\n }\n if (component.fields.year.placeholder) {\n strings.push({\n key: component.key,\n property: 'fields.year.placeholder',\n string: component.fields.year.placeholder,\n });\n }\n }\n if (component.type === 'editgrid') {\n const string = component.addAnother || 'Add Another';\n if (component.addAnother) {\n strings.push({\n key: component.key,\n property: 'addAnother',\n string,\n });\n }\n }\n if (component.type === 'select') {\n ['loading...', 'Type to search'].forEach((string) => {\n strings.push({\n key: component.key,\n property: 'select',\n string,\n });\n });\n }\n }, true);\n return strings;\n}\nexports.getStrings = getStrings;\n// ?????????????????????????\n// questionable section\nfunction generateFormChange(type, data) {\n let change;\n switch (type) {\n case 'add':\n change = {\n op: 'add',\n key: data.component.key,\n container: data.parent.key, // Parent component\n path: data.path, // Path to container within parent component.\n index: data.index, // Index of component in parent container.\n component: data.component,\n };\n break;\n case 'edit':\n change = {\n op: 'edit',\n key: data.originalComponent.key,\n patches: (0, fast_json_patch_1.compare)(data.originalComponent, data.component),\n };\n // Don't save if nothing changed.\n if (!change.patches.length) {\n change = null;\n }\n break;\n case 'remove':\n change = {\n op: 'remove',\n key: data.component.key,\n };\n break;\n }\n return change;\n}\nexports.generateFormChange = generateFormChange;\nfunction applyFormChanges(form, changes) {\n const failed = [];\n changes.forEach(function (change) {\n let found = false;\n switch (change.op) {\n case 'add': {\n let newComponent = change.component;\n // Find the container to set the component in.\n findComponent(form.components, change.container, null, function (parent) {\n if (!change.container) {\n parent = form;\n }\n // A move will first run an add so remove any existing components with matching key before inserting.\n findComponent(form.components, change.key, null, function (component, path) {\n // If found, use the existing component. (If someone else edited it, the changes would be here)\n newComponent = component;\n removeComponent(form.components, path);\n });\n found = true;\n const container = (0, lodash_1.get)(parent, change.path);\n container.splice(change.index, 0, newComponent);\n });\n break;\n }\n case 'remove':\n findComponent(form.components, change.key, null, function (component, path) {\n found = true;\n const oldComponent = (0, lodash_1.get)(form.components, path);\n if (oldComponent.key !== component.key) {\n path.pop();\n }\n removeComponent(form.components, path);\n });\n break;\n case 'edit':\n findComponent(form.components, change.key, null, function (component, path) {\n found = true;\n try {\n const oldComponent = (0, lodash_1.get)(form.components, path);\n const newComponent = (0, fast_json_patch_1.applyPatch)(component, change.patches).newDocument;\n if (oldComponent.key !== newComponent.key) {\n path.pop();\n }\n (0, lodash_1.set)(form.components, path, newComponent);\n }\n catch (ignoreError) {\n failed.push(change);\n }\n });\n break;\n case 'move':\n break;\n }\n if (!found) {\n failed.push(change);\n }\n });\n return {\n form,\n failed,\n };\n}\nexports.applyFormChanges = applyFormChanges;\n/**\n * This function will find a component in a form and return the component AND THE PATH to the component in the form.\n * Path to the component is stored as an array of nested components and their indexes.The Path is being filled recursively\n * when you iterating through the nested structure.\n * If the component is not found the callback won't be called and function won't return anything.\n *\n * @param components\n * @param key\n * @param fn\n * @param path\n * @returns {*}\n */\nfunction findComponent(components, key, path, fn) {\n if (!components)\n return;\n path = path || [];\n if (!key) {\n return fn(components);\n }\n components.forEach(function (component, index) {\n const newPath = path.slice();\n // Add an index of the component it iterates through in nested structure\n newPath.push(index);\n if (!component)\n return;\n if (component.hasOwnProperty('columns') && Array.isArray(component.columns)) {\n newPath.push('columns');\n component.columns.forEach(function (column, index) {\n const colPath = newPath.slice();\n colPath.push(index);\n colPath.push('components');\n findComponent(column.components, key, colPath, fn);\n });\n }\n if (component.hasOwnProperty('rows') && Array.isArray(component.rows)) {\n newPath.push('rows');\n component.rows.forEach(function (row, index) {\n const rowPath = newPath.slice();\n rowPath.push(index);\n row.forEach(function (column, index) {\n const colPath = rowPath.slice();\n colPath.push(index);\n colPath.push('components');\n findComponent(column.components, key, colPath, fn);\n });\n });\n }\n if (component.hasOwnProperty('components') && Array.isArray(component.components)) {\n newPath.push('components');\n findComponent(component.components, key, newPath, fn);\n }\n if (component.key === key) {\n //Final callback if the component is found\n fn(component, newPath, components);\n }\n });\n}\nexports.findComponent = findComponent;\nconst isCheckboxComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'checkbox';\nconst isDataGridComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datagrid';\nconst isEditGridComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'editgrid';\nconst isAddressComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'address';\nconst isDataTableComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datatable';\nconst hasChildComponents = (component) => (component === null || component === void 0 ? void 0 : component.components) != null;\nconst isDateTimeComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'datetime';\nconst isSelectBoxesComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'selectboxes';\nconst isTextAreaComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'textarea';\nconst isTextFieldComponent = (component) => (component === null || component === void 0 ? void 0 : component.type) === 'textfield';\nfunction getEmptyValue(component) {\n switch (component.type) {\n case 'textarea':\n case 'textfield':\n case 'time':\n case 'datetime':\n case 'day':\n return '';\n case 'datagrid':\n case 'editgrid':\n return [];\n default:\n return null;\n }\n}\nexports.getEmptyValue = getEmptyValue;\nconst replaceBlanks = (value) => {\n const nbsp = '<p> </p>';\n const br = '<p><br></p>';\n const brNbsp = '<p><br> </p>';\n const regExp = new RegExp(`^${nbsp}|${nbsp}$|^${br}|${br}$|^${brNbsp}|${brNbsp}$`, 'g');\n return typeof value === 'string' ? value.replace(regExp, '').trim() : value;\n};\nfunction trimBlanks(value) {\n if (!value) {\n return value;\n }\n if (Array.isArray(value)) {\n value = value.map((val) => replaceBlanks(val));\n }\n else {\n value = replaceBlanks(value);\n }\n return value;\n}\nfunction isValueEmpty(component, value) {\n const compValueIsEmptyArray = (0, lodash_1.isArray)(value) && value.length === 1 ? (0, lodash_1.isEqual)(value[0], getEmptyValue(component)) : false;\n return (value == null || value === '' || ((0, lodash_1.isArray)(value) && value.length === 0) || compValueIsEmptyArray);\n}\nfunction isComponentDataEmpty(component, data, path, valueCond) {\n var _a;\n const value = (0, lodash_1.isNil)(valueCond) ? (0, lodash_1.get)(data, path) : valueCond;\n const addressIgnoreProperties = ['mode', 'address'];\n if (isCheckboxComponent(component)) {\n return isValueEmpty(component, value) || value === false;\n }\n else if (isAddressComponent(component)) {\n if (Object.keys(value).length === 0) {\n return true;\n }\n return !Object.values((0, lodash_1.omit)(value, addressIgnoreProperties)).some(Boolean);\n }\n else if (isDataGridComponent(component) ||\n isEditGridComponent(component) ||\n isDataTableComponent(component) ||\n hasChildComponents(component)) {\n if ((_a = component.components) === null || _a === void 0 ? void 0 : _a.length) {\n let childrenEmpty = true;\n // wrap component in an array to let eachComponentData handle introspection to child components (e.g. this will be different\n // for data grids versus nested forms, etc.)\n (0, eachComponentData_1.eachComponentData)([component], data, (thisComponent, data, row, path) => {\n if (component.key === thisComponent.key)\n return;\n if (!isComponentDataEmpty(thisComponent, data, path)) {\n childrenEmpty = false;\n }\n });\n return isValueEmpty(component, value) || childrenEmpty;\n }\n return isValueEmpty(component, value);\n }\n else if (isDateTimeComponent(component)) {\n return isValueEmpty(component, value) || value.toString() === 'Invalid date';\n }\n else if (isSelectBoxesComponent(component)) {\n let selectBoxEmpty = true;\n for (const key in value) {\n if (value[key]) {\n selectBoxEmpty = false;\n break;\n }\n }\n return isValueEmpty(component, value) || selectBoxEmpty;\n }\n else if (isTextAreaComponent(component)) {\n const isPlain = !component.wysiwyg && !component.editor;\n return isPlain\n ? typeof value === 'string'\n ? isValueEmpty(component, value.trim())\n : isValueEmpty(component, value)\n : isValueEmpty(component, trimBlanks(value));\n }\n else if (isTextFieldComponent(component)) {\n if (component.allowMultipleMasks && !!component.inputMasks && !!component.inputMasks.length) {\n return (isValueEmpty(component, value) ||\n (component.multiple ? value.length === 0 : !value.maskName || !value.value));\n }\n return isValueEmpty(component, value === null || value === void 0 ? void 0 : value.toString().trim());\n }\n return isValueEmpty(component, value);\n}\nexports.isComponentDataEmpty = isComponentDataEmpty;\n/**\n * Returns the template keys inside the template code.\n * @param {string} template - The template to get the keys from.\n * @returns {Array<string>} - The keys inside the template.\n */\nfunction getItemTemplateKeys(template) {\n const templateKeys = [];\n if (!template) {\n return templateKeys;\n }\n const keys = template.match(/({{\\s*(.*?)\\s*}})/g);\n if (keys) {\n keys.forEach((key) => {\n const propKey = key.match(/{{\\s*item\\.(.*?)\\s*}}/);\n if (propKey && propKey.length > 1) {\n templateKeys.push(propKey[1]);\n }\n });\n }\n return templateKeys;\n}\nexports.getItemTemplateKeys = getItemTemplateKeys;\n/**\n * Returns if the component is a select resource with an object for its value.\n * @param {Component} comp - The component to check.\n * @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.\n */\nfunction isSelectResourceWithObjectValue(comp = {}) {\n const { reference, dataSrc, valueProperty } = comp;\n return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));\n}\nexports.isSelectResourceWithObjectValue = isSelectResourceWithObjectValue;\n/**\n * Compares real select resource value with expected value in condition.\n * @param {any} value - current value of selectcomponent.\n * @param {any} comparedValue - expocted value of select component.\n * @param {SelectComponent} conditionComponent - select component on which the condtion is based.\n * @returns {boolean} - TRUE if the select component current value is equal to the expected value; FALSE otherwise.\n */\nfunction compareSelectResourceWithObjectTypeValues(value, comparedValue, conditionComponent) {\n if (!value || !(0, lodash_1.isPlainObject)(value)) {\n return false;\n }\n const { template, valueProperty } = conditionComponent;\n if (valueProperty === 'data') {\n value = { data: value };\n comparedValue = { data: comparedValue };\n }\n return (0, lodash_1.every)(getItemTemplateKeys(template) || [], (k) => (0, lodash_1.isEqual)((0, lodash_1.get)(value, k), (0, lodash_1.get)(comparedValue, k)));\n}\nexports.compareSelectResourceWithObjectTypeValues = compareSelectResourceWithObjectTypeValues;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/formUtil/index.js?");
|
1383
1394
|
|
1384
1395
|
/***/ }),
|
1385
1396
|
|
@@ -1401,7 +1412,7 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
|
|
1401
1412
|
/***/ (function(__unused_webpack_module, exports) {
|
1402
1413
|
|
1403
1414
|
"use strict";
|
1404
|
-
eval("\n// copied from https://github.com/auth0/jwt-decode\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.jwtDecode = void 0;\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {\n let code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = '0' + code;\n }\n return '%' + code;\n }));\n}\nfunction b64UrlDecode(str) {\n let output = str.replace(/-/g, '+').replace(/_/g, '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw new Error('base64 string is not of the correct length');\n }\n try {\n return b64DecodeUnicode(output);\n }\n catch (
|
1415
|
+
eval("\n// copied from https://github.com/auth0/jwt-decode\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.jwtDecode = void 0;\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {\n let code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = '0' + code;\n }\n return '%' + code;\n }));\n}\nfunction b64UrlDecode(str) {\n let output = str.replace(/-/g, '+').replace(/_/g, '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw new Error('base64 string is not of the correct length');\n }\n try {\n return b64DecodeUnicode(output);\n }\n catch (ignoreError) {\n return atob(output);\n }\n}\nfunction jwtDecode(token, options = {}) {\n if (typeof token !== 'string') {\n throw new Error('Invalid token specified: must be a string');\n }\n const pos = options.header === true ? 0 : 1;\n const part = token.split('.')[pos];\n if (typeof part !== 'string') {\n throw new Error('Invalid token specified: missing part #' + (pos + 1));\n }\n let decoded;\n try {\n decoded = b64UrlDecode(part);\n }\n catch (e) {\n throw new Error('Invalid token specified: invalid base64 for part #' + (pos + 1) + ' (' + e.message + ')');\n }\n try {\n return JSON.parse(decoded);\n }\n catch (e) {\n throw new Error('Invalid token specified: invalid json for part #' + (pos + 1) + ' (' + e.message + ')');\n }\n}\nexports.jwtDecode = jwtDecode;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/jwtDecode.js?");
|
1405
1416
|
|
1406
1417
|
/***/ }),
|
1407
1418
|
|
@@ -1412,7 +1423,7 @@ eval("\n// copied from https://github.com/auth0/jwt-decode\nObject.definePropert
|
|
1412
1423
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1413
1424
|
|
1414
1425
|
"use strict";
|
1415
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.applyActions = exports.setCustomAction = exports.setMergeComponentSchema = exports.setValueProperty = exports.setActionProperty = exports.setActionStringProperty = exports.setActionBooleanProperty = exports.checkTrigger = exports.hasLogic = void 0;\nconst conditions_1 = __webpack_require__(/*! ./conditions */ \"./node_modules/@formio/core/lib/utils/conditions.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst jsonlogic_1 = __webpack_require__(/*! ../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst utils_1 = __webpack_require__(/*! ./utils */ \"./node_modules/@formio/core/lib/utils/utils.js\");\nconst hasLogic = (context) => {\n const { component } = context;\n const { logic } = component;\n if (!logic || !logic.length) {\n return false;\n }\n return true;\n};\nexports.hasLogic = hasLogic;\nconst checkTrigger = (context, trigger) => {\n let shouldTrigger = false;\n switch (trigger.type) {\n case 'simple':\n if ((0, conditions_1.isLegacyConditional)(trigger.simple)) {\n shouldTrigger = (0, conditions_1.checkLegacyConditional)(trigger.simple, context);\n }\n else {\n shouldTrigger = (0, conditions_1.checkSimpleConditional)(trigger.simple, context);\n }\n break;\n case 'javascript':\n shouldTrigger = (0, conditions_1.checkCustomConditional)(trigger.javascript, context, 'result');\n break;\n case 'json':\n shouldTrigger = (0, conditions_1.checkJsonConditional)(trigger, context);\n break;\n default:\n shouldTrigger = false;\n break;\n }\n if (shouldTrigger === null) {\n return false;\n }\n return shouldTrigger;\n};\nexports.checkTrigger = checkTrigger;\nfunction setActionBooleanProperty(context, action) {\n var _a, _b;\n const { component, scope, path } = context;\n const property = action.property.value;\n const currentValue = (0, lodash_1.get)(component, property, false).toString();\n const newValue = action.state.toString();\n if (currentValue !== newValue) {\n (0, lodash_1.set)(component, property, newValue === 'true');\n // If this is \"logic\" forcing a component to set hidden property, then we will set the \"conditionallyHidden\"\n // flag which will trigger the clearOnHide functionality.\n if (property === 'hidden'
|
1426
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.applyActions = exports.setCustomAction = exports.setMergeComponentSchema = exports.setValueProperty = exports.setActionProperty = exports.setActionStringProperty = exports.setActionBooleanProperty = exports.checkTrigger = exports.hasLogic = void 0;\nconst conditions_1 = __webpack_require__(/*! ./conditions */ \"./node_modules/@formio/core/lib/utils/conditions.js\");\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst jsonlogic_1 = __webpack_require__(/*! ../modules/jsonlogic */ \"./node_modules/@formio/core/lib/modules/jsonlogic/index.js\");\nconst utils_1 = __webpack_require__(/*! ./utils */ \"./node_modules/@formio/core/lib/utils/utils.js\");\nconst hasLogic = (context) => {\n const { component } = context;\n const { logic } = component;\n if (!logic || !logic.length) {\n return false;\n }\n return true;\n};\nexports.hasLogic = hasLogic;\nconst checkTrigger = (context, trigger) => {\n let shouldTrigger = false;\n switch (trigger.type) {\n case 'simple':\n if ((0, conditions_1.isLegacyConditional)(trigger.simple)) {\n shouldTrigger = (0, conditions_1.checkLegacyConditional)(trigger.simple, context);\n }\n else {\n shouldTrigger = (0, conditions_1.checkSimpleConditional)(trigger.simple, context);\n }\n break;\n case 'javascript':\n shouldTrigger = (0, conditions_1.checkCustomConditional)(trigger.javascript, context, 'result');\n break;\n case 'json':\n shouldTrigger = (0, conditions_1.checkJsonConditional)(trigger, context);\n break;\n default:\n shouldTrigger = false;\n break;\n }\n if (shouldTrigger === null) {\n return false;\n }\n return shouldTrigger;\n};\nexports.checkTrigger = checkTrigger;\nfunction setActionBooleanProperty(context, action) {\n var _a, _b;\n const { component, scope, path } = context;\n const property = action.property.value;\n const currentValue = (0, lodash_1.get)(component, property, false).toString();\n const newValue = action.state.toString();\n if (currentValue !== newValue) {\n (0, lodash_1.set)(component, property, newValue === 'true');\n // If this is \"logic\" forcing a component to set hidden property, then we will set the \"conditionallyHidden\"\n // flag which will trigger the clearOnHide functionality.\n if (property === 'hidden' && path) {\n if (!scope.conditionals) {\n scope.conditionals = [];\n }\n const conditionallyHidden = (_a = scope.conditionals) === null || _a === void 0 ? void 0 : _a.find((cond) => {\n return cond.path === path;\n });\n if (conditionallyHidden) {\n conditionallyHidden.conditionallyHidden = !!component.hidden;\n (0, utils_1.registerEphermalState)(component, 'conditionallyHidden', !!component.hidden);\n }\n else {\n (_b = scope.conditionals) === null || _b === void 0 ? void 0 : _b.push({\n path,\n conditionallyHidden: !!component.hidden,\n });\n }\n }\n return true;\n }\n return false;\n}\nexports.setActionBooleanProperty = setActionBooleanProperty;\nfunction setActionStringProperty(context, action) {\n const { component } = context;\n const property = action.property.value;\n const textValue = action.property.component\n ? action[action.property.component]\n : action.text;\n const currentValue = (0, lodash_1.get)(component, property, '');\n const newValue = (0, jsonlogic_1.interpolate)(Object.assign(Object.assign({}, context), { value: '' }), textValue, (evalContext) => {\n evalContext.value = currentValue;\n });\n if (newValue !== currentValue) {\n (0, lodash_1.set)(component, property, newValue);\n return true;\n }\n return false;\n}\nexports.setActionStringProperty = setActionStringProperty;\nfunction setActionProperty(context, action) {\n switch (action.property.type) {\n case 'boolean':\n return setActionBooleanProperty(context, action);\n case 'string':\n return setActionStringProperty(context, action);\n }\n return false;\n}\nexports.setActionProperty = setActionProperty;\nfunction setValueProperty(context, action) {\n const { component, data, path } = context;\n const oldValue = (0, lodash_1.get)(data, path);\n const newValue = (0, jsonlogic_1.evaluate)(context, action.value, 'value', (evalContext) => {\n evalContext.value = (0, lodash_1.clone)(oldValue);\n });\n if (!(0, lodash_1.isEqual)(oldValue, newValue) &&\n !(component.clearOnHide && (0, conditions_1.conditionallyHidden)(context))) {\n (0, lodash_1.set)(data, path, newValue);\n return true;\n }\n return false;\n}\nexports.setValueProperty = setValueProperty;\nfunction setMergeComponentSchema(context, action) {\n const { component, data, path } = context;\n const oldValue = (0, lodash_1.get)(data, path);\n const schema = (0, jsonlogic_1.evaluate)(Object.assign(Object.assign({}, context), { value: {} }), action.schemaDefinition, 'schema', (evalContext) => {\n evalContext.value = (0, lodash_1.clone)(oldValue);\n });\n const merged = (0, lodash_1.assign)({}, component, schema);\n if (!(0, lodash_1.isEqual)(component, merged)) {\n (0, lodash_1.assign)(component, schema);\n return true;\n }\n return false;\n}\nexports.setMergeComponentSchema = setMergeComponentSchema;\nfunction setCustomAction(context, action) {\n return setValueProperty(context, { type: 'value', value: action.customAction });\n}\nexports.setCustomAction = setCustomAction;\nconst applyActions = (context) => {\n const { component } = context;\n const { logic } = component;\n if (!logic || !logic.length) {\n return false;\n }\n return logic.reduce((changed, logicItem) => {\n const { actions, trigger } = logicItem;\n if (!trigger || !actions || !actions.length || !(0, exports.checkTrigger)(context, trigger)) {\n return changed;\n }\n return actions.reduce((changed, action) => {\n switch (action.type) {\n case 'property':\n if (setActionProperty(context, action)) {\n return true;\n }\n return changed;\n case 'value':\n return setValueProperty(context, action) || changed;\n case 'mergeComponentSchema':\n if (setMergeComponentSchema(context, action)) {\n return true;\n }\n return changed;\n case 'customAction':\n return setCustomAction(context, action) || changed;\n default:\n return changed;\n }\n }, changed);\n }, false);\n};\nexports.applyActions = applyActions;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/logic.js?");
|
1416
1427
|
|
1417
1428
|
/***/ }),
|
1418
1429
|
|
@@ -1423,7 +1434,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1423
1434
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1424
1435
|
|
1425
1436
|
"use strict";
|
1426
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.matchInputMask = exports.getInputMask = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/**\n * Returns an input mask that is compatible with the input mask library.\n * @param {string} mask - The Form.io input mask.\n * @param {string} placeholderChar - Char which is used as a placeholder.\n * @returns {Array} - The input mask for the mask library.\n */\nfunction getInputMask(mask, placeholderChar) {\n if (mask instanceof Array) {\n return mask;\n }\n const maskArray = [];\n maskArray.numeric = true;\n for (let i = 0; i < mask.length; i++) {\n switch (mask[i]) {\n case '9':\n maskArray.push(/\\d/);\n break;\n case 'A':\n maskArray.numeric = false;\n maskArray.push(/[a-zA-Z]/);\n break;\n case 'a':\n maskArray.numeric = false;\n maskArray.push(/[a-z]/);\n break;\n case '*':\n maskArray.numeric = false;\n maskArray.push(/[a-zA-Z0-9]/);\n break;\n // If char which is used inside mask placeholder was used in the mask, replace it with space to prevent errors\n case placeholderChar:\n maskArray.numeric = false;\n maskArray.push(' ');\n break;\n default:\n maskArray.numeric = false;\n maskArray.push(mask[i]);\n break;\n }\n }\n return maskArray;\n}\nexports.getInputMask = getInputMask;\nfunction matchInputMask(value, inputMask) {\n if (!inputMask) {\n return true;\n }\n // If value is longer than mask, it isn't valid.\n if (value.length > inputMask.length) {\n return false;\n }\n for (let i = 0; i < inputMask.length; i++) {\n const char = value[i];\n const charPart = inputMask[i];\n if (!((0, lodash_1.isRegExp)(charPart) && charPart.test(char) || charPart === char)) {\n return false;\n }\n }\n return true;\n}\nexports.matchInputMask = matchInputMask;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/mask.js?");
|
1437
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.matchInputMask = exports.getInputMask = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/**\n * Returns an input mask that is compatible with the input mask library.\n * @param {string} mask - The Form.io input mask.\n * @param {string} placeholderChar - Char which is used as a placeholder.\n * @returns {Array} - The input mask for the mask library.\n */\nfunction getInputMask(mask, placeholderChar) {\n if (mask instanceof Array) {\n return mask;\n }\n const maskArray = [];\n maskArray.numeric = true;\n for (let i = 0; i < mask.length; i++) {\n switch (mask[i]) {\n case '9':\n maskArray.push(/\\d/);\n break;\n case 'A':\n maskArray.numeric = false;\n maskArray.push(/[a-zA-Z]/);\n break;\n case 'a':\n maskArray.numeric = false;\n maskArray.push(/[a-z]/);\n break;\n case '*':\n maskArray.numeric = false;\n maskArray.push(/[a-zA-Z0-9]/);\n break;\n // If char which is used inside mask placeholder was used in the mask, replace it with space to prevent errors\n case placeholderChar:\n maskArray.numeric = false;\n maskArray.push(' ');\n break;\n default:\n maskArray.numeric = false;\n maskArray.push(mask[i]);\n break;\n }\n }\n return maskArray;\n}\nexports.getInputMask = getInputMask;\nfunction matchInputMask(value, inputMask) {\n if (!inputMask) {\n return true;\n }\n // If value is longer than mask, it isn't valid.\n if (value.length > inputMask.length) {\n return false;\n }\n for (let i = 0; i < inputMask.length; i++) {\n const char = value[i];\n const charPart = inputMask[i];\n if (!(((0, lodash_1.isRegExp)(charPart) && charPart.test(char)) || charPart === char)) {\n return false;\n }\n }\n return true;\n}\nexports.matchInputMask = matchInputMask;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/mask.js?");
|
1427
1438
|
|
1428
1439
|
/***/ }),
|
1429
1440
|
|
@@ -1434,7 +1445,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1434
1445
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1435
1446
|
|
1436
1447
|
"use strict";
|
1437
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\
|
1448
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nclass ConditionOperator {\n static get operatorKey() {\n return '';\n }\n static get displayedName() {\n return '';\n }\n static get requireValue() {\n return true;\n }\n execute() {\n return true;\n }\n getResult(options = {}) {\n const { value } = options;\n if ((0, lodash_1.isArray)(value)) {\n return (0, lodash_1.some)(value, (valueItem) => this.execute(Object.assign(Object.assign({}, options), { value: valueItem })));\n }\n return this.execute(options);\n }\n}\nexports[\"default\"] = ConditionOperator;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/operators/ConditionOperator.js?");
|
1438
1449
|
|
1439
1450
|
/***/ }),
|
1440
1451
|
|
@@ -1445,7 +1456,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\ncons
|
|
1445
1456
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1446
1457
|
|
1447
1458
|
"use strict";
|
1448
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst ConditionOperator_1 = __importDefault(__webpack_require__(/*! ./ConditionOperator */ \"./node_modules/@formio/core/lib/utils/operators/ConditionOperator.js\"));\nconst moment_1 = __importDefault(__webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\"));\nconst date_1 = __webpack_require__(/*! ../../utils/date */ \"./node_modules/@formio/core/lib/utils/date.js\");\nclass DateGeaterThan extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'dateGreaterThan';\n }\n static get displayedName() {\n return 'Greater Than';\n }\n getFormattedDates({ value, comparedValue, conditionTriggerComponent }) {\n const validationFormat = conditionTriggerComponent && conditionTriggerComponent.component.type === 'day'
|
1459
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst ConditionOperator_1 = __importDefault(__webpack_require__(/*! ./ConditionOperator */ \"./node_modules/@formio/core/lib/utils/operators/ConditionOperator.js\"));\nconst moment_1 = __importDefault(__webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\"));\nconst date_1 = __webpack_require__(/*! ../../utils/date */ \"./node_modules/@formio/core/lib/utils/date.js\");\nclass DateGeaterThan extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'dateGreaterThan';\n }\n static get displayedName() {\n return 'Greater Than';\n }\n getFormattedDates({ value, comparedValue, conditionTriggerComponent }) {\n const validationFormat = conditionTriggerComponent && conditionTriggerComponent.component.type === 'day'\n ? (0, date_1.getDateValidationFormat)(conditionTriggerComponent.component)\n : null;\n const date = validationFormat ? (0, moment_1.default)(value, validationFormat) : (0, moment_1.default)(value);\n const comparedDate = validationFormat\n ? (0, moment_1.default)(comparedValue, validationFormat)\n : (0, moment_1.default)(comparedValue);\n return { date, comparedDate };\n }\n execute(options, functionName = 'isAfter') {\n const { value, instance, conditionComponentPath } = options;\n if (!value) {\n return false;\n }\n let conditionTriggerComponent = null;\n if (instance && instance.root) {\n conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);\n }\n if (conditionTriggerComponent &&\n conditionTriggerComponent.component.type === 'day' &&\n (0, date_1.isPartialDay)(conditionTriggerComponent.component, value)) {\n return false;\n }\n const { date, comparedDate } = this.getFormattedDates(Object.assign(Object.assign({}, options), { conditionTriggerComponent }));\n return date[functionName](comparedDate);\n }\n}\nexports[\"default\"] = DateGeaterThan;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/operators/DateGreaterThan.js?");
|
1449
1460
|
|
1450
1461
|
/***/ }),
|
1451
1462
|
|
@@ -1555,7 +1566,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1555
1566
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1556
1567
|
|
1557
1568
|
"use strict";
|
1558
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst formUtil_1 = __webpack_require__(/*! ../formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst ConditionOperator_1 = __importDefault(__webpack_require__(/*! ./ConditionOperator */ \"./node_modules/@formio/core/lib/utils/operators/ConditionOperator.js\"));\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nclass IsEqualTo extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'isEqual';\n }\n static get displayedName() {\n return 'Is Equal To';\n }\n execute({ value, comparedValue, conditionComponent }) {\n // special check for select boxes\n if ((conditionComponent === null || conditionComponent === void 0 ? void 0 : conditionComponent.type) === 'selectboxes') {\n return (0, lodash_1.get)(value, comparedValue, false);\n }\n if (value
|
1569
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst formUtil_1 = __webpack_require__(/*! ../formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nconst ConditionOperator_1 = __importDefault(__webpack_require__(/*! ./ConditionOperator */ \"./node_modules/@formio/core/lib/utils/operators/ConditionOperator.js\"));\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nclass IsEqualTo extends ConditionOperator_1.default {\n static get operatorKey() {\n return 'isEqual';\n }\n static get displayedName() {\n return 'Is Equal To';\n }\n execute({ value, comparedValue, conditionComponent }) {\n // special check for select boxes\n if ((conditionComponent === null || conditionComponent === void 0 ? void 0 : conditionComponent.type) === 'selectboxes') {\n return (0, lodash_1.get)(value, comparedValue, false);\n }\n if (value &&\n comparedValue &&\n typeof value !== typeof comparedValue &&\n (0, lodash_1.isString)(comparedValue)) {\n try {\n comparedValue = JSON.parse(comparedValue);\n }\n catch (ignoreError) {\n // do nothing\n }\n }\n if (conditionComponent &&\n (0, formUtil_1.isSelectResourceWithObjectValue)(conditionComponent) &&\n conditionComponent.template) {\n return (0, formUtil_1.compareSelectResourceWithObjectTypeValues)(value, comparedValue, conditionComponent);\n }\n return (0, lodash_1.isEqual)(value, comparedValue);\n }\n}\nexports[\"default\"] = IsEqualTo;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/operators/IsEqualTo.js?");
|
1559
1570
|
|
1560
1571
|
/***/ }),
|
1561
1572
|
|
@@ -1643,7 +1654,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1643
1654
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1644
1655
|
|
1645
1656
|
"use strict";
|
1646
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst IsNotEqualTo_1 = __importDefault(__webpack_require__(/*! ./IsNotEqualTo */ \"./node_modules/@formio/core/lib/utils/operators/IsNotEqualTo.js\"));\nconst IsEmptyValue_1 = __importDefault(__webpack_require__(/*! ./IsEmptyValue */ \"./node_modules/@formio/core/lib/utils/operators/IsEmptyValue.js\"));\nconst IsNotEmptyValue_1 = __importDefault(__webpack_require__(/*! ./IsNotEmptyValue */ \"./node_modules/@formio/core/lib/utils/operators/IsNotEmptyValue.js\"));\nconst LessThan_1 = __importDefault(__webpack_require__(/*! ./LessThan */ \"./node_modules/@formio/core/lib/utils/operators/LessThan.js\"));\nconst GreaterThan_1 = __importDefault(__webpack_require__(/*! ./GreaterThan */ \"./node_modules/@formio/core/lib/utils/operators/GreaterThan.js\"));\nconst IsEqualTo_1 = __importDefault(__webpack_require__(/*! ./IsEqualTo */ \"./node_modules/@formio/core/lib/utils/operators/IsEqualTo.js\"));\nconst DateGreaterThan_1 = __importDefault(__webpack_require__(/*! ./DateGreaterThan */ \"./node_modules/@formio/core/lib/utils/operators/DateGreaterThan.js\"));\nconst DateLessThan_1 = __importDefault(__webpack_require__(/*! ./DateLessThan */ \"./node_modules/@formio/core/lib/utils/operators/DateLessThan.js\"));\nconst Includes_1 = __importDefault(__webpack_require__(/*! ./Includes */ \"./node_modules/@formio/core/lib/utils/operators/Includes.js\"));\nconst StartsWith_1 = __importDefault(__webpack_require__(/*! ./StartsWith */ \"./node_modules/@formio/core/lib/utils/operators/StartsWith.js\"));\nconst NotIncludes_1 = __importDefault(__webpack_require__(/*! ./NotIncludes */ \"./node_modules/@formio/core/lib/utils/operators/NotIncludes.js\"));\nconst EndsWith_1 = __importDefault(__webpack_require__(/*! ./EndsWith */ \"./node_modules/@formio/core/lib/utils/operators/EndsWith.js\"));\nconst DateGreaterThanOrEqual_1 = __importDefault(__webpack_require__(/*! ./DateGreaterThanOrEqual */ \"./node_modules/@formio/core/lib/utils/operators/DateGreaterThanOrEqual.js\"));\nconst DateLessThanOrEqual_1 = __importDefault(__webpack_require__(/*! ./DateLessThanOrEqual */ \"./node_modules/@formio/core/lib/utils/operators/DateLessThanOrEqual.js\"));\nconst LessThanOrEqual_1 = __importDefault(__webpack_require__(/*! ./LessThanOrEqual */ \"./node_modules/@formio/core/lib/utils/operators/LessThanOrEqual.js\"));\nconst GreaterThanOrEqual_1 = __importDefault(__webpack_require__(/*! ./GreaterThanOrEqual */ \"./node_modules/@formio/core/lib/utils/operators/GreaterThanOrEqual.js\"));\nconst IsDateEqual_1 = __importDefault(__webpack_require__(/*! ./IsDateEqual */ \"./node_modules/@formio/core/lib/utils/operators/IsDateEqual.js\"));\nconst IsNotDateEqual_1 = __importDefault(__webpack_require__(/*! ./IsNotDateEqual */ \"./node_modules/@formio/core/lib/utils/operators/IsNotDateEqual.js\"));\nconst ConditionOperators = {\n [`${IsNotEqualTo_1.default.operatorKey}`]: IsNotEqualTo_1.default,\n [`${IsEqualTo_1.default.operatorKey}`]: IsEqualTo_1.default,\n [`${IsEmptyValue_1.default.operatorKey}`]: IsEmptyValue_1.default,\n [`${IsNotEmptyValue_1.default.operatorKey}`]: IsNotEmptyValue_1.default,\n [`${LessThan_1.default.operatorKey}`]: LessThan_1.default,\n [`${GreaterThan_1.default.operatorKey}`]: GreaterThan_1.default,\n [`${DateGreaterThan_1.default.operatorKey}`]: DateGreaterThan_1.default,\n [`${DateLessThan_1.default.operatorKey}`]: DateLessThan_1.default,\n [`${Includes_1.default.operatorKey}`]: Includes_1.default,\n [`${StartsWith_1.default.operatorKey}`]: StartsWith_1.default,\n [`${EndsWith_1.default.operatorKey}`]: EndsWith_1.default,\n [`${NotIncludes_1.default.operatorKey}`]: NotIncludes_1.default,\n [`${DateGreaterThanOrEqual_1.default.operatorKey}`]: DateGreaterThanOrEqual_1.default,\n [`${DateLessThanOrEqual_1.default.operatorKey}`]: DateLessThanOrEqual_1.default,\n [`${LessThanOrEqual_1.default.operatorKey}`]: LessThanOrEqual_1.default,\n [`${GreaterThanOrEqual_1.default.operatorKey}`]: GreaterThanOrEqual_1.default,\n [`${IsDateEqual_1.default.operatorKey}`]: IsDateEqual_1.default,\n [`${IsNotDateEqual_1.default.operatorKey}`]: IsNotDateEqual_1.default
|
1657
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst IsNotEqualTo_1 = __importDefault(__webpack_require__(/*! ./IsNotEqualTo */ \"./node_modules/@formio/core/lib/utils/operators/IsNotEqualTo.js\"));\nconst IsEmptyValue_1 = __importDefault(__webpack_require__(/*! ./IsEmptyValue */ \"./node_modules/@formio/core/lib/utils/operators/IsEmptyValue.js\"));\nconst IsNotEmptyValue_1 = __importDefault(__webpack_require__(/*! ./IsNotEmptyValue */ \"./node_modules/@formio/core/lib/utils/operators/IsNotEmptyValue.js\"));\nconst LessThan_1 = __importDefault(__webpack_require__(/*! ./LessThan */ \"./node_modules/@formio/core/lib/utils/operators/LessThan.js\"));\nconst GreaterThan_1 = __importDefault(__webpack_require__(/*! ./GreaterThan */ \"./node_modules/@formio/core/lib/utils/operators/GreaterThan.js\"));\nconst IsEqualTo_1 = __importDefault(__webpack_require__(/*! ./IsEqualTo */ \"./node_modules/@formio/core/lib/utils/operators/IsEqualTo.js\"));\nconst DateGreaterThan_1 = __importDefault(__webpack_require__(/*! ./DateGreaterThan */ \"./node_modules/@formio/core/lib/utils/operators/DateGreaterThan.js\"));\nconst DateLessThan_1 = __importDefault(__webpack_require__(/*! ./DateLessThan */ \"./node_modules/@formio/core/lib/utils/operators/DateLessThan.js\"));\nconst Includes_1 = __importDefault(__webpack_require__(/*! ./Includes */ \"./node_modules/@formio/core/lib/utils/operators/Includes.js\"));\nconst StartsWith_1 = __importDefault(__webpack_require__(/*! ./StartsWith */ \"./node_modules/@formio/core/lib/utils/operators/StartsWith.js\"));\nconst NotIncludes_1 = __importDefault(__webpack_require__(/*! ./NotIncludes */ \"./node_modules/@formio/core/lib/utils/operators/NotIncludes.js\"));\nconst EndsWith_1 = __importDefault(__webpack_require__(/*! ./EndsWith */ \"./node_modules/@formio/core/lib/utils/operators/EndsWith.js\"));\nconst DateGreaterThanOrEqual_1 = __importDefault(__webpack_require__(/*! ./DateGreaterThanOrEqual */ \"./node_modules/@formio/core/lib/utils/operators/DateGreaterThanOrEqual.js\"));\nconst DateLessThanOrEqual_1 = __importDefault(__webpack_require__(/*! ./DateLessThanOrEqual */ \"./node_modules/@formio/core/lib/utils/operators/DateLessThanOrEqual.js\"));\nconst LessThanOrEqual_1 = __importDefault(__webpack_require__(/*! ./LessThanOrEqual */ \"./node_modules/@formio/core/lib/utils/operators/LessThanOrEqual.js\"));\nconst GreaterThanOrEqual_1 = __importDefault(__webpack_require__(/*! ./GreaterThanOrEqual */ \"./node_modules/@formio/core/lib/utils/operators/GreaterThanOrEqual.js\"));\nconst IsDateEqual_1 = __importDefault(__webpack_require__(/*! ./IsDateEqual */ \"./node_modules/@formio/core/lib/utils/operators/IsDateEqual.js\"));\nconst IsNotDateEqual_1 = __importDefault(__webpack_require__(/*! ./IsNotDateEqual */ \"./node_modules/@formio/core/lib/utils/operators/IsNotDateEqual.js\"));\nconst ConditionOperators = {\n [`${IsNotEqualTo_1.default.operatorKey}`]: IsNotEqualTo_1.default,\n [`${IsEqualTo_1.default.operatorKey}`]: IsEqualTo_1.default,\n [`${IsEmptyValue_1.default.operatorKey}`]: IsEmptyValue_1.default,\n [`${IsNotEmptyValue_1.default.operatorKey}`]: IsNotEmptyValue_1.default,\n [`${LessThan_1.default.operatorKey}`]: LessThan_1.default,\n [`${GreaterThan_1.default.operatorKey}`]: GreaterThan_1.default,\n [`${DateGreaterThan_1.default.operatorKey}`]: DateGreaterThan_1.default,\n [`${DateLessThan_1.default.operatorKey}`]: DateLessThan_1.default,\n [`${Includes_1.default.operatorKey}`]: Includes_1.default,\n [`${StartsWith_1.default.operatorKey}`]: StartsWith_1.default,\n [`${EndsWith_1.default.operatorKey}`]: EndsWith_1.default,\n [`${NotIncludes_1.default.operatorKey}`]: NotIncludes_1.default,\n [`${DateGreaterThanOrEqual_1.default.operatorKey}`]: DateGreaterThanOrEqual_1.default,\n [`${DateLessThanOrEqual_1.default.operatorKey}`]: DateLessThanOrEqual_1.default,\n [`${LessThanOrEqual_1.default.operatorKey}`]: LessThanOrEqual_1.default,\n [`${GreaterThanOrEqual_1.default.operatorKey}`]: GreaterThanOrEqual_1.default,\n [`${IsDateEqual_1.default.operatorKey}`]: IsDateEqual_1.default,\n [`${IsNotDateEqual_1.default.operatorKey}`]: IsNotDateEqual_1.default,\n};\nexports[\"default\"] = ConditionOperators;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/operators/index.js?");
|
1647
1658
|
|
1648
1659
|
/***/ }),
|
1649
1660
|
|
@@ -1654,7 +1665,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1654
1665
|
/***/ (function(__unused_webpack_module, exports) {
|
1655
1666
|
|
1656
1667
|
"use strict";
|
1657
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.override = void 0;\n/**\n * Simple class to allow for overriding base classes.\n * @param classObj\n * @param extenders\n */\nfunction override(classObj, extenders) {\n for (
|
1668
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.override = void 0;\n/**\n * Simple class to allow for overriding base classes.\n * @param classObj\n * @param extenders\n */\nfunction override(classObj, extenders) {\n for (const key in extenders) {\n if (extenders.hasOwnProperty(key)) {\n const extender = extenders[key];\n if (typeof extender === 'function') {\n classObj.prototype[key] = extender;\n }\n else {\n const prop = Object.getOwnPropertyDescriptor(classObj.prototype, key);\n for (const attr in extender) {\n if (extender.hasOwnProperty(attr)) {\n prop[attr] = extender[attr](prop[attr]);\n }\n }\n Object.defineProperty(classObj.prototype, key, prop);\n }\n }\n }\n}\nexports.override = override;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/override.js?");
|
1658
1669
|
|
1659
1670
|
/***/ }),
|
1660
1671
|
|
@@ -1665,7 +1676,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1665
1676
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1666
1677
|
|
1667
1678
|
"use strict";
|
1668
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.sanitize = void 0;\nconst dompurify_1 = __importDefault(__webpack_require__(/*! dompurify */ \"./node_modules/dompurify/dist/purify.js\"));\nlet DOMPurify = null;\nconst getDOMPurify = () => {\n if (DOMPurify) {\n return DOMPurify;\n }\n if (window) {\n DOMPurify = (0, dompurify_1.default)(window);\n return DOMPurify;\n }\n return null;\n};\n/**\n * Sanitize an html string.\n *\n * @param string\n * @returns {*}\n */\nfunction sanitize(string, options) {\n const dompurify = getDOMPurify();\n if (!dompurify) {\n console.log('DOMPurify unable to sanitize the contents.');\n return string;\n }\n // Dompurify configuration\n const sanitizeOptions = {\n ADD_ATTR: ['ref', 'target', 'within'],\n USE_PROFILES: { html: true }
|
1679
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.sanitize = void 0;\nconst dompurify_1 = __importDefault(__webpack_require__(/*! dompurify */ \"./node_modules/dompurify/dist/purify.js\"));\nlet DOMPurify = null;\nconst getDOMPurify = () => {\n if (DOMPurify) {\n return DOMPurify;\n }\n if (window) {\n DOMPurify = (0, dompurify_1.default)(window);\n return DOMPurify;\n }\n return null;\n};\n/**\n * Sanitize an html string.\n *\n * @param string\n * @returns {*}\n */\nfunction sanitize(string, options) {\n const dompurify = getDOMPurify();\n if (!dompurify) {\n console.log('DOMPurify unable to sanitize the contents.');\n return string;\n }\n // Dompurify configuration\n const sanitizeOptions = {\n ADD_ATTR: ['ref', 'target', 'within'],\n USE_PROFILES: { html: true },\n };\n // Add attrs\n if (options.sanitizeConfig &&\n Array.isArray(options.sanitizeConfig.addAttr) &&\n options.sanitizeConfig.addAttr.length > 0) {\n options.sanitizeConfig.addAttr.forEach((attr) => {\n sanitizeOptions.ADD_ATTR.push(attr);\n });\n }\n // Add tags\n if (options.sanitizeConfig &&\n Array.isArray(options.sanitizeConfig.addTags) &&\n options.sanitizeConfig.addTags.length > 0) {\n sanitizeOptions.ADD_TAGS = options.sanitizeConfig.addTags;\n }\n // Allow tags\n if (options.sanitizeConfig &&\n Array.isArray(options.sanitizeConfig.allowedTags) &&\n options.sanitizeConfig.allowedTags.length > 0) {\n sanitizeOptions.ALLOWED_TAGS = options.sanitizeConfig.allowedTags;\n }\n // Allow attributes\n if (options.sanitizeConfig &&\n Array.isArray(options.sanitizeConfig.allowedAttrs) &&\n options.sanitizeConfig.allowedAttrs.length > 0) {\n sanitizeOptions.ALLOWED_ATTR = options.sanitizeConfig.allowedAttrs;\n }\n // Allowd URI Regex\n if (options.sanitizeConfig && options.sanitizeConfig.allowedUriRegex) {\n sanitizeOptions.ALLOWED_URI_REGEXP = options.sanitizeConfig.allowedUriRegex;\n }\n // Allow to extend the existing array of elements that are safe for URI-like values\n if (options.sanitizeConfig &&\n Array.isArray(options.sanitizeConfig.addUriSafeAttr) &&\n options.sanitizeConfig.addUriSafeAttr.length > 0) {\n sanitizeOptions.ADD_URI_SAFE_ATTR = options.sanitizeConfig.addUriSafeAttr;\n }\n return dompurify.sanitize(string, sanitizeOptions);\n}\nexports.sanitize = sanitize;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/sanitize.js?");
|
1669
1680
|
|
1670
1681
|
/***/ }),
|
1671
1682
|
|
@@ -1676,7 +1687,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1676
1687
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1677
1688
|
|
1678
1689
|
"use strict";
|
1679
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.unwind = exports.rewind = exports.mergeArray = exports.mergeObject = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst fastCloneDeep_1 = __webpack_require__(/*! ./fastCloneDeep */ \"./node_modules/@formio/core/lib/utils/fastCloneDeep.js\");\nconst formUtil_1 = __webpack_require__(/*! ./formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nfunction mergeObject(src, dst) {\n (0, lodash_1.each)(src, function (value, key) {\n if (!Array.isArray(value)) {\n dst[key] = value;\n }\n else {\n if (!dst[key]) {\n dst[key] = [];\n }\n mergeArray(value, dst[key]);\n }\n });\n}\nexports.mergeObject = mergeObject;\nfunction mergeArray(src, dst) {\n src.forEach(function (value) {\n
|
1690
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.unwind = exports.rewind = exports.mergeArray = exports.mergeObject = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nconst fastCloneDeep_1 = __webpack_require__(/*! ./fastCloneDeep */ \"./node_modules/@formio/core/lib/utils/fastCloneDeep.js\");\nconst formUtil_1 = __webpack_require__(/*! ./formUtil */ \"./node_modules/@formio/core/lib/utils/formUtil/index.js\");\nfunction mergeObject(src, dst) {\n (0, lodash_1.each)(src, function (value, key) {\n if (!Array.isArray(value)) {\n dst[key] = value;\n }\n else {\n if (!dst[key]) {\n dst[key] = [];\n }\n mergeArray(value, dst[key]);\n }\n });\n}\nexports.mergeObject = mergeObject;\nfunction mergeArray(src, dst) {\n src.forEach(function (value) {\n const query = {};\n (0, lodash_1.each)(value, function (subValue, key) {\n if (!Array.isArray(subValue)) {\n query[key] = subValue;\n }\n });\n const dstValue = (0, lodash_1.find)(dst, query);\n if (dstValue) {\n mergeObject(value, dstValue);\n }\n else {\n dst.push(value);\n }\n });\n}\nexports.mergeArray = mergeArray;\nfunction rewind(submissions) {\n const submission = { data: {} };\n if (submissions && submissions.length) {\n submissions.forEach((sub) => mergeObject(sub.data, submission.data));\n }\n return submission;\n}\nexports.rewind = rewind;\nfunction unwind(form, submission) {\n const dataPaths = {};\n const locked = {};\n const submissions = [(0, fastCloneDeep_1.fastCloneDeep)(submission)];\n // Set the data value for a data path.\n const setDataValue = function (dataPath, values, parent, offset, current) {\n offset = offset || 0;\n current = current || 0;\n // Make sure we don't overwrite any locked values.\n while ((0, lodash_1.has)(locked, '[' + current + '].' + parent)) {\n if (current + 1 >= submissions.length) {\n submissions.push((0, fastCloneDeep_1.fastCloneDeep)(submissions[current]));\n }\n current++;\n }\n // Ensure that all parents have been copied over to this path.\n /* eslint-disable no-useless-escape */\n const parentPath = parent.replace(/\\.[^\\.]+$/, '');\n if (!(0, lodash_1.has)(submissions[current].data, parentPath) &&\n submissions[current - 1] &&\n (0, lodash_1.has)(submissions[current - 1].data, parentPath)) {\n (0, lodash_1.set)(submissions[current].data, parentPath, (0, fastCloneDeep_1.fastCloneDeep)((0, lodash_1.get)(submissions[current - 1].data, parentPath)));\n }\n /* eslint-enable no-useless-escape */\n const pathValue = [];\n (0, lodash_1.set)(submissions[current].data, parent, pathValue);\n (0, lodash_1.set)(locked, '[' + current + '].' + parent, true);\n for (let i = offset; i < values.length; i++) {\n if (i - offset <= dataPath.max) {\n pathValue.push(values[i]);\n if (dataPath.paths && Object.keys(dataPath.paths).length) {\n addData(dataPath.paths, values[i], parent + '[' + (i - offset) + ']', current);\n }\n }\n else {\n setDataValue(dataPath, values, parent, i, current);\n break;\n }\n }\n };\n // Add data to a series of data paths.\n const addData = function (dataPaths, data, parent, current) {\n for (const path in dataPaths) {\n const dataPath = dataPaths[path];\n if (data[path] && Array.isArray(data[path])) {\n setDataValue(dataPath, data[path], parent ? parent + '.' + path : path, 0, current);\n }\n }\n };\n const addDataPaths = function (dataPath, paths, index, parentDataPath) {\n index = index || 0;\n const path = paths[index];\n /* eslint-disable no-useless-escape */\n const matches = path.match(/([^\\[]+)\\[?([0-9]+)?\\]?/);\n /* eslint-enable no-useless-escape */\n if (matches && matches.length === 3) {\n const dataParam = matches[1];\n const dataIndex = parseInt(matches[2], 10) || 0;\n if (dataPath[dataParam]) {\n if (dataIndex > dataPath[dataParam].max) {\n dataPath[dataParam].max = dataIndex;\n }\n }\n else {\n dataPath[dataParam] = {\n max: dataIndex,\n param: dataParam,\n parent: parentDataPath || null,\n paths: {},\n };\n }\n if (index + 1 < paths.length) {\n addDataPaths(dataPath[dataParam].paths, paths, index + 1, dataPath[dataParam]);\n }\n }\n };\n // Iterate through all components.\n (0, formUtil_1.eachComponent)(form.components, function (component, path) {\n var _a;\n if (component.type === 'form' && ((_a = component.components) === null || _a === void 0 ? void 0 : _a.length)) {\n (0, formUtil_1.eachComponent)(component.components, (comp) => {\n comp.isInsideNestedForm = true;\n });\n }\n if (!component.overlay || (!component.overlay.width && !component.overlay.height)) {\n return;\n }\n const hasDataPath = component.properties && component.properties.dataPath;\n let key = component.key;\n if (hasDataPath) {\n path = component.properties.dataPath;\n key = component.properties.dataPath;\n }\n const paths = (0, lodash_1.filter)(path.replace(new RegExp('.?' + component.key + '$'), '').split('.'));\n if (!hasDataPath && paths.length && !component.isInsideNestedForm) {\n key = paths.join('.') + '.' + component.key;\n }\n if (component.multiple) {\n paths.push(component.key);\n }\n component.key = key;\n if (paths && paths.length) {\n addDataPaths(dataPaths, paths);\n }\n }, true);\n addData(dataPaths, submission.data);\n return submissions;\n}\nexports.unwind = unwind;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/unwind.js?");
|
1680
1691
|
|
1681
1692
|
/***/ }),
|
1682
1693
|
|
@@ -1687,7 +1698,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
1687
1698
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
1688
1699
|
|
1689
1700
|
"use strict";
|
1690
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.resetEphermalState = exports.registerEphermalState = exports.unescapeHTML = exports.boolValue = exports.escapeRegExCharacters = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/**\n * Escapes RegEx characters in provided String value.\n *\n * @param {String} value\n * String for escaping RegEx characters.\n * @returns {string}\n * String with escaped RegEx characters.\n */\nfunction escapeRegExCharacters(value) {\n return value.replace(/[-[\\]/{}()*+?.\\\\^$|]/g, '\\\\$&');\n}\nexports.escapeRegExCharacters = escapeRegExCharacters;\n/**\n * Determines the boolean value of a setting.\n *\n * @param value\n * @return {boolean}\n */\nfunction boolValue(value) {\n if ((0, lodash_1.isBoolean)(value)) {\n return value;\n }\n else if ((0, lodash_1.isString)(value)) {\n return
|
1701
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.resetEphermalState = exports.attachResourceToDom = exports.registerEphermalState = exports.unescapeHTML = exports.boolValue = exports.escapeRegExCharacters = void 0;\nconst lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/**\n * Escapes RegEx characters in provided String value.\n *\n * @param {String} value\n * String for escaping RegEx characters.\n * @returns {string}\n * String with escaped RegEx characters.\n */\nfunction escapeRegExCharacters(value) {\n return value.replace(/[-[\\]/{}()*+?.\\\\^$|]/g, '\\\\$&');\n}\nexports.escapeRegExCharacters = escapeRegExCharacters;\n/**\n * Determines the boolean value of a setting.\n *\n * @param value\n * @return {boolean}\n */\nfunction boolValue(value) {\n if ((0, lodash_1.isBoolean)(value)) {\n return value;\n }\n else if ((0, lodash_1.isString)(value)) {\n return value.toLowerCase() === 'true';\n }\n else {\n return !!value;\n }\n}\nexports.boolValue = boolValue;\n/**\n * Unescape HTML characters like <, >, & and etc.\n * @param str\n * @returns {string}\n */\nfunction unescapeHTML(str) {\n if (typeof window === 'undefined' || !('DOMParser' in window)) {\n return str;\n }\n const doc = new window.DOMParser().parseFromString(str, 'text/html');\n return doc.documentElement.textContent;\n}\nexports.unescapeHTML = unescapeHTML;\nfunction registerEphermalState(component, name, value) {\n if (!component.ephermalState) {\n Object.defineProperty(component, 'ephermalState', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: {},\n });\n }\n Object.defineProperty(component.ephermalState, name, {\n enumerable: false,\n writable: false,\n configurable: true,\n value,\n });\n}\nexports.registerEphermalState = registerEphermalState;\nfunction attachResourceToDom(options) {\n const { name, formio, onload, rootElement } = options;\n let { src } = options;\n src = Array.isArray(src) ? src : [src];\n src.forEach((lib) => {\n let attrs = {};\n let elementType = '';\n if (typeof lib === 'string') {\n lib = {\n type: 'script',\n src: lib,\n };\n }\n switch (lib.type) {\n case 'script':\n elementType = 'script';\n attrs = {\n src: lib.src,\n type: 'text/javascript',\n defer: true,\n async: true,\n referrerpolicy: 'origin',\n };\n break;\n case 'styles':\n elementType = 'link';\n attrs = {\n href: lib.src,\n rel: 'stylesheet',\n };\n break;\n }\n // Add the script to the top of the page.\n const element = document.createElement(elementType);\n if (element.setAttribute) {\n for (const attr in attrs) {\n element.setAttribute(attr, attrs[attr]);\n }\n }\n if (onload) {\n element.addEventListener('load', () => {\n formio.libraries[name].loaded = true;\n onload(formio.libraries[name].ready);\n });\n }\n if (rootElement) {\n rootElement.insertAdjacentElement('afterend', element);\n return;\n }\n const { head } = document;\n if (head) {\n head.appendChild(element);\n }\n });\n}\nexports.attachResourceToDom = attachResourceToDom;\nfunction resetEphermalState(component) {\n if (component.ephermalState) {\n delete component.ephermalState;\n }\n}\nexports.resetEphermalState = resetEphermalState;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/utils/utils.js?");
|
1691
1702
|
|
1692
1703
|
/***/ }),
|
1693
1704
|
|
@@ -3280,7 +3291,7 @@ eval("\n\nfunction hash(str) {\n var hash = 5381,\n i = str.length;\n\n
|
|
3280
3291
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
3281
3292
|
|
3282
3293
|
"use strict";
|
3283
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Formio = exports.FormioPathType = void 0;\nconst fetch_ponyfill_1 = __importDefault(__webpack_require__(/*! fetch-ponyfill */ \"./node_modules/fetch-ponyfill/build/fetch-browser.js\"));\nconst fastCloneDeep_1 = __webpack_require__(/*! ../utils/fastCloneDeep */ \"./node_modules/@formio/core/lib/utils/fastCloneDeep.js\");\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/index.js\");\nconst jwtDecode_1 = __webpack_require__(/*! ../utils/jwtDecode */ \"./node_modules/@formio/core/lib/utils/jwtDecode.js\");\nconst eventemitter3_1 = __importDefault(__webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\"));\nconst browser_cookies_1 = __importDefault(__webpack_require__(/*! browser-cookies */ \"./node_modules/browser-cookies/src/browser-cookies.js\"));\nconst { fetch, Headers } = (0, fetch_ponyfill_1.default)();\nconst Plugins_1 = __importDefault(__webpack_require__(/*! ./Plugins */ \"./node_modules/@formio/core/lib/sdk/Plugins.js\"));\n/**\n * The different path types for a project.\n */\nvar FormioPathType;\n(function (FormioPathType) {\n FormioPathType[\"Subdirectories\"] = \"Subdirectories\";\n FormioPathType[\"Subdomains\"] = \"Subdomains\";\n})(FormioPathType || (exports.FormioPathType = FormioPathType = {}));\n/**\n * The Formio interface class. This is a minimalistic API library that allows you to work with the Form.io API's within JavaScript.\n *\n * ## Usage\n * Creating an instance of Formio is simple, and takes only a path (URL String). The path can be different, depending on the desired output.\n * The Formio instance can also access higher level operations, depending on how granular of a path you start with.\n *\n * ```ts\n * var formio = new Formio(<endpoint>, [options]);\n * ```\n *\n * Where **endpoint** is any valid API endpoint within Form.io. These URL's can provide a number of different methods depending on the granularity of the endpoint. This allows you to use the same interface but have access to different methods depending on how granular the endpoint url is.\n * **options** is defined within the {link Formio.constructor} documentation.\n *\n * Here is an example of how this library can be used to load a form JSON from the Form.io API's\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadForm().then((form) => {\n * console.log(form);\n * });\n * ```\n */\nclass Formio {\n /* eslint-disable max-statements */\n /**\n * @constructor\n * @param {string} path - A project, form, and submission API Url.\n * @param {FormioOptions} options - Available options to configure the Javascript API.\n */\n constructor(path, options = {}) {\n this.path = path;\n this.options = options;\n /**\n * The base API url of the Form.io Platform. Example: https://api.form.io\n */\n this.base = '';\n /**\n * The Projects Endpoint derived from the provided source.\n *\n * @example https://api.form.io/project\n */\n this.projectsUrl = '';\n /**\n * A specific project endpoint derived from the provided source.\n *\n * @example https://examples.form.io\n */\n this.projectUrl = '';\n /**\n * The Project ID found within the provided source.\n */\n this.projectId = '';\n /**\n * A specific Role URL provided the source.\n *\n * @example https://examples.form.io/role/2342343234234234\n */\n this.roleUrl = '';\n /**\n * The roles endpoint derived from the provided source.\n *\n * @example https://examples.form.io/role\n */\n this.rolesUrl = '';\n /**\n * The roleID derieved from the provided source.\n */\n this.roleId = '';\n /**\n * A specific form url derived from the provided source.\n *\n * @example https://examples.form.io/example\n */\n this.formUrl = '';\n /**\n * The forms url derived from the provided source.\n *\n * @example https://example.form.io/form\n */\n this.formsUrl = '';\n /**\n * The Form ID derived from the provided source.\n */\n this.formId = '';\n /**\n * The submissions URL derived from the provided source.\n *\n * @example https://examples.form.io/example/submission\n */\n this.submissionsUrl = '';\n /**\n * A specific submissions URL derived from a provided source.\n *\n * @example https://examples.form.io/example/submission/223423423423\n */\n this.submissionUrl = '';\n /**\n * The submission ID provided a submission url.\n */\n this.submissionId = '';\n /**\n * The actions url provided a form url as the source.\n *\n * @example https://examples.form.io/example/action\n */\n this.actionsUrl = '';\n /**\n * The Action ID derived from a provided Action url.\n */\n this.actionId = '';\n /**\n * A specific action api endoint.\n */\n this.actionUrl = '';\n this.vsUrl = '';\n this.vId = '';\n this.vUrl = '';\n /**\n * The query string derived from the provided src url.\n */\n this.query = '';\n /**\n * If this is a non-project url, such is the case for Open Source API.\n */\n this.noProject = false;\n // Ensure we have an instance of Formio.\n if (!(this instanceof Formio)) {\n return new Formio(path);\n }\n if (options.useSessionToken) {\n Formio.useSessionToken(options);\n }\n if (options.hasOwnProperty('base') && options.base) {\n this.base = options.base;\n }\n else if (Formio.baseUrl) {\n this.base = Formio.baseUrl;\n }\n else if (window && window.location) {\n const match = window.location.href.match(/http[s]?:\\/\\/api./);\n this.base = match ? match[0] : window.location.origin;\n }\n if (!path) {\n // Allow user to create new projects if this was instantiated without\n // a url\n this.projectUrl = Formio.projectUrl || `${this.base}/project`;\n this.projectsUrl = `${this.base}/project`;\n this.projectId = '';\n this.query = '';\n return;\n }\n if (options.hasOwnProperty('project') && options.project) {\n this.projectUrl = options.project;\n }\n const project = this.projectUrl || Formio.projectUrl;\n const projectRegEx = /(^|\\/)(project)($|\\/[^/]+)/;\n const isProjectUrl = (path.search(projectRegEx) !== -1);\n // The baseURL is the same as the projectUrl, and does not contain \"/project/MONGO_ID\" in\n // its domain. This is almost certainly against the Open Source server.\n if (project && this.base === project && !isProjectUrl) {\n this.noProject = true;\n this.projectUrl = this.base;\n }\n // Normalize to an absolute path.\n if ((path.indexOf('http') !== 0) && (path.indexOf('//') !== 0)) {\n path = this.base + path;\n }\n const hostparts = this.getUrlParts(path);\n let hostName = '';\n let parts = [];\n if (hostparts) {\n hostName = hostparts[1] + hostparts[2];\n path = hostparts.length > 3 ? hostparts[3] : '';\n const queryparts = path.split('?');\n if (queryparts.length > 1) {\n path = queryparts[0];\n this.query = `?${queryparts[1]}`;\n }\n }\n // Register a specific path.\n const registerPath = (name, base) => {\n this[`${name}sUrl`] = `${base}/${name}`;\n const regex = new RegExp(`/${name}/([^/]+)`);\n if (path && path.search(regex) !== -1) {\n parts = path.match(regex);\n this[`${name}Url`] = parts ? (base + parts[0]) : '';\n this[`${name}Id`] = (parts.length > 1) ? parts[1] : '';\n base += parts[0];\n }\n return base;\n };\n // Register an array of items.\n const registerItems = (items, base, staticBase) => {\n for (const i in items) {\n if (items.hasOwnProperty(i)) {\n const item = items[i];\n if (Array.isArray(item)) {\n registerItems(item, base, true);\n }\n else {\n const newBase = registerPath(item, base);\n base = staticBase ? base : newBase;\n }\n }\n }\n };\n if (!this.projectUrl || (this.projectUrl === this.base)) {\n // If a project uses Subdirectories path type, we need to specify a projectUrl\n if (!this.projectUrl && !isProjectUrl && Formio.pathType === 'Subdirectories') {\n const regex = `^${hostName.replace(/\\//g, '\\\\/')}.[^/]+`;\n const match = project.match(new RegExp(regex));\n this.projectUrl = match ? match[0] : hostName;\n }\n else {\n this.projectUrl = hostName;\n }\n }\n // Check if we have a specified path type.\n let isNotSubdomainType = false;\n if (Formio.pathType) {\n isNotSubdomainType = Formio.pathType !== 'Subdomains';\n }\n if (!this.noProject) {\n // Determine the projectUrl and projectId\n if (isProjectUrl) {\n // Get project id as project/:projectId.\n registerItems(['project'], hostName);\n path = path.replace(projectRegEx, '');\n }\n else if (hostName === this.base) {\n // Get project id as first part of path (subdirectory).\n if (hostparts && hostparts.length > 3 && path.split('/').length > 1) {\n const isFile = path.match(/.json/);\n const pathParts = path.split('/');\n if (isFile) {\n this.projectUrl = hostName;\n }\n else {\n pathParts.shift(); // Throw away the first /.\n const projectId = pathParts.shift();\n if (projectId) {\n this.projectId = projectId;\n path = `/${pathParts.join('/')}`;\n this.projectUrl = `${hostName}/${this.projectId}`;\n }\n }\n }\n }\n else {\n // Get project id from subdomain.\n if (hostparts && hostparts.length > 2 && (hostparts[2].split('.').length > 2 || hostName.includes('localhost')) && !isNotSubdomainType) {\n this.projectUrl = hostName;\n this.projectId = hostparts[2].split('.')[0];\n }\n }\n this.projectsUrl = this.projectsUrl || `${this.base}/project`;\n }\n // Configure Role urls and role ids.\n registerItems(['role'], this.projectUrl);\n // Configure Form urls and form ids.\n if (/(^|\\/)(form)($|\\/)/.test(path)) {\n registerItems(['form', ['submission', 'action', 'v']], this.projectUrl);\n }\n else {\n const subRegEx = new RegExp('/(submission|action|v)($|/.*)');\n const subs = path.match(subRegEx);\n if ((subs && (subs.length > 1))) {\n this.pathType = subs[1];\n }\n path = path.replace(subRegEx, '');\n path = path.replace(/\\/$/, '');\n this.formsUrl = `${this.projectUrl}/form`;\n this.formUrl = path ? this.projectUrl + path : '';\n this.formId = path.replace(/^\\/+|\\/+$/g, '');\n const items = ['submission', 'action', 'v'];\n for (const i in items) {\n if (items.hasOwnProperty(i)) {\n const item = items[i];\n this[`${item}sUrl`] = `${this.projectUrl + path}/${item}`;\n if ((this.pathType === item) && subs && (subs.length > 2) && subs[2]) {\n this[`${item}Id`] = subs[2].replace(/^\\/+|\\/+$/g, '');\n this[`${item}Url`] = this.projectUrl + path + subs[0];\n }\n }\n }\n }\n // Set the app url if it is not set.\n if (!Formio.projectUrlSet) {\n Formio.projectUrl = this.projectUrl;\n }\n }\n /* eslint-enable max-statements */\n /**\n * Deletes a remote resource of any provided type.\n *\n * @param {string} type - The type of resource to delete. \"submission\", \"form\", etc.\n * @param {object} options - The options passed to {@link Formio.request}\n * @return {Promise<Response>}\n */\n delete(type, opts) {\n const _id = `${type}Id`;\n const _url = `${type}Url`;\n if (!this[_id]) {\n return Promise.reject('Nothing to delete');\n }\n Formio.cache = {};\n return this.makeRequest(type, this[_url], 'delete', null, opts);\n }\n /**\n * Returns the index (array of records) for any provided type.\n *\n * @param {string} type - The type of resource to fetch the index of. \"submission\", \"form\", etc.\n * @param {object} query - A query object to pass to the request.\n * @param {object} query.params - A map (key-value pairs) of URL query parameters to add to the url.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n index(type, query, opts) {\n const _url = `${type}Url`;\n query = query || '';\n if (query && (0, lodash_1.isObject)(query)) {\n query = `?${Formio.serialize(query.params)}`;\n }\n return this.makeRequest(type, this[_url] + query, 'get', null, opts);\n }\n /**\n * Save a document record using \"upsert\". If the document does not exist, it will be created, if the _id is provided,\n * it will be updated.\n *\n * @param {string} type - The type of resource to fetch the index of. \"submission\", \"form\", etc.\n * @param {object} data - The resource data object.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n save(type, data, opts) {\n const _id = `${type}Id`;\n const _url = `${type}Url`;\n const method = (this[_id] || data._id) ? 'put' : 'post';\n let reqUrl = this[_id] ? this[_url] : this[`${type}sUrl`];\n if (!this[_id] && data._id && (method === 'put') && !reqUrl.includes(data._id)) {\n reqUrl += `/${data._id}`;\n }\n Formio.cache = {};\n return this.makeRequest(type, reqUrl + this.query, method, data, opts);\n }\n /**\n * @summary Load (GET) a document record.\n *\n * @param {string} type - The type of resource to fetch the index of. \"submission\", \"form\", etc.\n * @param {object} query - A query object to pass to the request.\n * @param {object} query.params - A map (key-value pairs) of URL query parameters to add to the url.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n load(type, query, opts) {\n const _id = `${type}Id`;\n const _url = `${type}Url`;\n if (query && (0, lodash_1.isObject)(query)) {\n query = Formio.serialize(query.params);\n }\n if (query) {\n query = this.query ? (`${this.query}&${query}`) : (`?${query}`);\n }\n else {\n query = this.query;\n }\n if (!this[_id]) {\n return Promise.reject(`Missing ${_id}`);\n }\n let url = this[_url] + query;\n if (type === 'form' && !isNaN(parseInt(this.vId))) {\n url += url.indexOf('?') === -1 ? '?' : '&';\n url += `formRevision=${this.vId}`;\n }\n return this.makeRequest(type, url, 'get', null, opts);\n }\n /**\n * @summary Call {@link Formio.makeRequest} for this Formio instance.\n *\n * @param {string} type - The request resource type. \"submission\", \"form\", etc.\n * @param {string} url - The URL to request.\n * @param {string} method - The request method. GET, PUT, POST, DELETE, or PATCH\n * @param {object} data - The data to pass to the request (for PUT, POST, and PATCH methods)\n * @param {object} options - An object of options to pass to the request method.\n * @param {boolean} options.ignoreCache - To ignore internal caching of the request.\n * @param {object} options.headers - An object of headers to pass along to the request.\n * @param {boolean} options.noToken - If set to true, this will not include the Form.io x-jwt-token along with the request.\n * @param {string} options.namespace - The Form.io namespace to prepend to all LocalStorage variables such as formioToken.\n * @param {boolean} options.getHeaders - Set this if you wish to include the response headers with the return of this method.\n * @return {Promise<Response>}\n */\n makeRequest(type, url, method, data, opts) {\n return Formio.makeRequest(this, type, url, method, data, opts);\n }\n /**\n * @summary Loads a project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.loadProject().then((project) => {\n * console.log(project);\n * });\n * ```\n *\n * @param {object} query - Query parameters to pass to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n loadProject(query, opts) {\n return this.load('project', query, opts);\n }\n /**\n * Saves or Updates a project.\n *\n * ### Create a new project\n * ```ts\n * const formio = new Formio();\n * formio.saveProject({\n * title: 'My Project',\n * path: 'myproject',\n * name: 'myproject'\n * });\n * ```\n *\n * ### Update an existing project\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.loadProject().then((project) => {\n * project.title = 'Title changed';\n * formio.saveProject(project).then(() => {\n * console.log('Done saving project!');\n * });\n * });\n * ```\n *\n * @param {object} data - The project JSON to create or update.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveProject(data, opts) {\n return this.save('project', data, opts);\n }\n /**\n * Deletes a project\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.deleteProject();\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n deleteProject(opts) {\n return this.delete('project', opts);\n }\n /**\n * Loads a list of all projects.\n *\n * ```ts\n * Formio.loadProjects().then((projects) => {\n * console.log(projects);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {*}\n */\n static loadProjects(query, opts) {\n query = query || '';\n if ((0, lodash_1.isObject)(query)) {\n query = `?${Formio.serialize(query.params)}`;\n }\n return Formio.makeStaticRequest(`${Formio.baseUrl}/project${query}`, 'GET', null, opts);\n }\n /**\n * Loads a role within a project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/role/234234234234');\n * formio.loadRole().then((role) => {\n * console.log(role);\n * });\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n loadRole(opts) {\n return this.load('role', null, opts);\n }\n /**\n * Create a new or Update an existing role within a project.\n *\n * ### Create new Role example\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.saveRole({\n * title: 'Employee',\n * description: 'A person who belongs to a company.'\n * }).then((role) => {\n * console.log(role);\n * });\n * ```\n *\n * ### Update existing role example\n * ```ts\n * const formio = new Formio('https://examples.form.io/role/234234234234234');\n * formio.loadRole().then((role) => {\n * role.title = 'Manager';\n * formio.saveRole(role).then(() => {\n * console.log('DONE');\n * });\n * });\n * ```\n *\n * @param {object} role - The Role JSON to create or update.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveRole(data, opts) {\n return this.save('role', data, opts);\n }\n /**\n * Deletes a role within a project.\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n deleteRole(opts) {\n return this.delete('role', opts);\n }\n /**\n * Load all roles within a project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.loadRoles().then((roles) => {\n * console.log(roles);\n * });\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n loadRoles(opts) {\n return this.index('roles', null, opts);\n }\n /**\n * Loads a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadForm().then((form) => {\n * console.log(form);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n loadForm(query, opts) {\n return this.load('form', query, opts)\n .then((currentForm) => {\n // Check to see if there isn't a number in vId.\n if (!currentForm.revisions || isNaN(parseInt(this.vId))) {\n return currentForm;\n }\n // If a submission already exists but form is marked to load current version of form.\n if (currentForm.revisions === 'current' && this.submissionId) {\n return currentForm;\n }\n // eslint-disable-next-line eqeqeq\n if (currentForm._vid == this.vId || currentForm.revisionId === this.vId) {\n return currentForm;\n }\n // If they specified a revision form, load the revised form components.\n if (query && (0, lodash_1.isObject)(query)) {\n query = Formio.serialize(query.params);\n }\n if (query) {\n query = this.query ? (`${this.query}&${query}`) : (`?${query}`);\n }\n else {\n query = this.query;\n }\n return this.makeRequest('form', this.vUrl + query, 'get', null, opts)\n .then((revisionForm) => {\n currentForm._vid = revisionForm._vid;\n currentForm.components = revisionForm.components;\n currentForm.settings = revisionForm.settings;\n currentForm.revisionId = revisionForm.revisionId;\n // Using object.assign so we don't cross polinate multiple form loads.\n return Object.assign({}, currentForm);\n })\n // If we couldn't load the revision, just return the original form.\n .catch(() => Object.assign({}, currentForm));\n });\n }\n /**\n * Create or Update a specific form.\n *\n * ### Create form example\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.saveForm({\n * title: 'Employee',\n * type: 'resource',\n * path: 'employee',\n * name: 'employee',\n * components: [\n * {\n * type: 'textfield',\n * key: 'firstName',\n * label: 'First Name'\n * },\n * {\n * type: 'textfield',\n * key: 'lastName',\n * label: 'Last Name'\n * }\n * ]\n * });\n * ```\n *\n * ### Update a form example\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadForm().then((form) => {\n * form.title = 'Changed Title';\n * formio.saveForm(form).then(() => {\n * console.log('DONE!!!');\n * });\n * });\n * ```\n *\n * @param {object} data - The Form JSON to create or update.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveForm(data, opts) {\n return this.save('form', data, opts);\n }\n /**\n * Deletes a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.deleteForm().then(() => {\n * console.log('Deleted!');\n * });\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n deleteForm(opts) {\n return this.delete('form', opts);\n }\n /**\n * Loads all forms within a project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.loadForms().then((forms) => {\n * console.log(forms);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n loadForms(query, opts) {\n return this.index('forms', query, opts);\n }\n /**\n * Loads a specific submissionn.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/submission/23423423423423423');\n * formio.loadSubmission().then((submission) => {\n * console.log(submission);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n loadSubmission(query, opts) {\n return this.load('submission', query, opts)\n .then((submission) => {\n this.vId = submission._frid || submission._fvid;\n this.vUrl = `${this.formUrl}/v/${this.vId}`;\n return submission;\n });\n }\n /**\n * Creates a new or Updates an existing submission.\n *\n * ### Create a new submission\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.saveSubmission({\n * data: {\n * firstName: 'Joe',\n * lastName: 'Smith'\n * }\n * }).then((submission) => {\n * // This will now be the complete submission object saved on the server.\n * console.log(submission);\n * });\n * ```\n *\n * ### Update an existing submission\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/submission/23423423423423423');\n * formio.loadSubmission().then((submission) => {\n * submission.data.lastName = 'Thompson';\n * formio.saveSubmission(submission).then(() => {\n * console.log('DONE');\n * });\n * });\n * ```\n *\n * @param {object} data - The submission JSON object.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveSubmission(data, opts) {\n if (!isNaN(parseInt(this.vId)) && !data._fvid) {\n data._fvid = this.vId;\n }\n return this.save('submission', data, opts);\n }\n /**\n * Deletes a submission.\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n deleteSubmission(opts) {\n return this.delete('submission', opts);\n }\n /**\n * Loads all submissions within a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadSubmissions({\n * params: {\n * limit: 25,\n * 'data.lastName__regex': 'smith'\n * }\n * }).then((submissions) => {\n * // Should print out 25 submissions where the last name contains \"smith\".\n * console.log(submissions);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n loadSubmissions(query, opts) {\n return this.index('submissions', query, opts);\n }\n /**\n * Loads a form action.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/action/234234234234');\n * formio.loadAction().then((action) => {\n * console.log(action);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n loadAction(query, opts) {\n return this.load('action', query, opts);\n }\n /**\n * Create a new or update an existing action.\n *\n * ### Create a new action for a form.\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.saveAction({\n * data: {\n * name: 'webhook',\n * title: 'Webhook Action',\n * method: ['create', 'update', 'delete'],\n * handler: ['after'],\n * condition: {},\n * settings: {\n * url: 'https://example.com',\n * headers: [{}],\n * block: false,\n * forwardHeaders: false\n * }\n * }\n * }).then((action) => {\n * console.log(action);\n * });\n * ```\n *\n * ### Update an action\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/action/234234234234');\n * formio.loadAction().then((action) => {\n * action.title = 'Updated title';\n * formio.saveAction(action).then(() => {\n * console.log('Done!');\n * });\n * });\n * ```\n *\n * @param {object} data - The action JSON\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveAction(data, opts) {\n return this.save('action', data, opts);\n }\n /**\n * Delete an action\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/action/234234234234');\n * formio.deleteAction().then(() => {\n * console.log('Action was deleted.');\n * });\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n deleteAction(opts) {\n return this.delete('action', opts);\n }\n /**\n * Loads all actions within a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadActions().then((actions) => {\n * console.log(actions);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n loadActions(query, opts) {\n return this.index('actions', query, opts);\n }\n /**\n * Returns a list of available actions\n *\n * @return {Promise<Response>}\n */\n availableActions() {\n return this.makeRequest('availableActions', `${this.formUrl}/actions`);\n }\n /**\n * Returns the action information for a specific action, such as \"save\".\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/actions/save');\n * formio.actionInfo().then((info) => {\n * console.log(info);\n * });\n * ```\n *\n * @param {string} name - The name of the action you would like to get information for. i.e. \"save\", \"webhook\", etc.\n * @return {Promise<Response>}\n */\n actionInfo(name) {\n return this.makeRequest('actionInfo', `${this.formUrl}/actions/${name}`);\n }\n /**\n * Determine if a string ID is a valid MongoID.\n *\n * @param {string} id - The id that should be tested if it is avalid id.\n * @return {boolean} - true if it is a valid MongoId, false otherwise.\n */\n isObjectId(id) {\n const checkForHexRegExp = new RegExp('^[0-9a-fA-F]{24}$');\n return checkForHexRegExp.test(id);\n }\n /**\n * Get the project ID of project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.getProjectId().then((projectId) => {\n * console.log(projectId);\n * };\n * ```\n *\n * @return {Promise<string>}\n */\n getProjectId() {\n if (!this.projectId) {\n return Promise.resolve('');\n }\n if (this.isObjectId(this.projectId)) {\n return Promise.resolve(this.projectId);\n }\n else {\n return this.loadProject().then((project) => {\n return project._id;\n });\n }\n }\n /**\n * Get the ID of a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.getFormId().then((formId) => {\n * console.log(formId);\n * });\n * ```\n *\n * @return {Promise<string>}\n */\n getFormId() {\n if (!this.formId) {\n return Promise.resolve('');\n }\n if (this.isObjectId(this.formId)) {\n return Promise.resolve(this.formId);\n }\n else {\n return this.loadForm().then((form) => {\n return form._id;\n });\n }\n }\n /**\n * Instance method for {@link Formio.currentUser}\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n currentUser(options) {\n return Formio.currentUser(this, options);\n }\n /**\n * Instance method for {@link Formio.accessInfo}\n *\n * @return {Promise<Response>}\n */\n accessInfo() {\n return Formio.accessInfo(this);\n }\n /**\n * Sets OAuth Logout URL.\n *\n * @param {string} uri - Logout URL.\n * @param {string} options.namespace - The localStorage namespace to use when retrieving tokens from storage.\n * @return {string}\n */\n oauthLogoutURI(uri, options) {\n return Formio.oauthLogoutURI(uri, Object.assign({ formio: this }, this.options, options));\n }\n /**\n * Returns the JWT token for this instance.\n *\n * @param {object} options - The following options are provided.\n * @param {string} options.namespace - The localStorage namespace to use when retrieving tokens from storage.\n * @return {string} - The JWT token for this user.\n */\n getToken(options) {\n return Formio.getToken(Object.assign({ formio: this }, this.options, options));\n }\n /**\n * Sets the JWT token for this instance.\n *\n * @param {string} token - The JWT token to set.\n * @param {object} options - The following options are provided.\n * @param {string} options.namespace - The localStorage namespace to use when retrieving tokens from storage.\n * @return {string} - The JWT token that was set.\n */\n setToken(token, options) {\n return Formio.setToken(token, Object.assign({ formio: this }, this.options, options));\n }\n /**\n * Returns a temporary authentication token for single purpose token generation.\n *\n * @param {number|string} expire - The amount of seconds to wait before this temp token expires.\n * @param {string} allowed - The allowed path string inn the format GET:/path\n * @param {object} options - The options passed to {@link Formio#getToken}\n */\n getTempToken(expire, allowed, options) {\n const token = Formio.getToken(options);\n if (!token) {\n return Promise.reject('You must be authenticated to generate a temporary auth token.');\n }\n const authUrl = Formio.authUrl || this.projectUrl;\n return this.makeRequest('tempToken', `${authUrl}/token`, 'GET', null, {\n ignoreCache: true,\n header: new Headers({\n 'x-expire': expire,\n 'x-allow': allowed\n })\n });\n }\n /**\n * Get a PDF download url for a submission, which will generate a new PDF of the submission. This method will first\n * fetch a temporary download token, and then append this to the download url for this form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/submission/324234234234234');\n * formio.getDownloadUrl().then((url) => {\n * console.log(url);\n * });\n * ```\n *\n * @param {object} [form] - The form JSON to fetch a download url for.\n * @return {Promise<string>} - The download url.\n */\n getDownloadUrl(form) {\n if (!this.submissionId) {\n return Promise.resolve('');\n }\n if (!form) {\n // Make sure to load the form first.\n return this.loadForm().then((_form) => {\n if (!_form) {\n return '';\n }\n return this.getDownloadUrl(_form);\n });\n }\n let apiUrl = `/project/${form.project}`;\n apiUrl += `/form/${form._id}`;\n apiUrl += `/submission/${this.submissionId}`;\n const postfix = form.submissionRevisions && form.settings.changeLog ? '/download/changelog' : '/download';\n apiUrl += postfix;\n let download = this.base + apiUrl;\n return new Promise((resolve, reject) => {\n this.getTempToken(3600, `GET:${apiUrl}`).then((tempToken) => {\n download += `?token=${tempToken.key}`;\n resolve(download);\n }, () => {\n resolve(download);\n }).catch(reject);\n });\n }\n /**\n * Returns the user permissions to a form and submission.\n *\n * @param user - The user or current user if undefined. For anonymous, use \"null\"\n * @param form - The form or current form if undefined. For no form check, use \"null\"\n * @param submission - The submisison or \"index\" if undefined.\n *\n * @return {{create: boolean, read: boolean, edit: boolean, delete: boolean}}\n */\n userPermissions(user, form, submission) {\n return Promise.all([\n (form !== undefined) ? Promise.resolve(form) : this.loadForm(),\n (user !== undefined) ? Promise.resolve(user) : this.currentUser(),\n (submission !== undefined || !this.submissionId) ? Promise.resolve(submission) : this.loadSubmission(),\n this.accessInfo()\n ]).then((results) => {\n const form = results.shift();\n const user = results.shift() || { _id: false, roles: [] };\n const submission = results.shift();\n const access = results.shift();\n const permMap = {\n create: 'create',\n read: 'read',\n update: 'edit',\n delete: 'delete'\n };\n const perms = {\n user: user,\n form: form,\n access: access,\n create: false,\n read: false,\n edit: false,\n delete: false\n };\n for (const roleName in access.roles) {\n if (access.roles.hasOwnProperty(roleName)) {\n const role = access.roles[roleName];\n if (role.default && (user._id === false)) {\n // User is anonymous. Add the anonymous role.\n user.roles.push(role._id);\n }\n else if (role.admin && user.roles.indexOf(role._id) !== -1) {\n perms.create = true;\n perms.read = true;\n perms.delete = true;\n perms.edit = true;\n return perms;\n }\n }\n }\n if (form && form.submissionAccess) {\n for (let i = 0; i < form.submissionAccess.length; i++) {\n const permission = form.submissionAccess[i];\n const [perm, scope] = permission.type.split('_');\n if (['create', 'read', 'update', 'delete'].includes(perm)) {\n if ((0, lodash_1.intersection)(permission.roles, user.roles).length) {\n perms[permMap[perm]] = (scope === 'all') || (!submission || (user._id === submission.owner));\n }\n }\n }\n }\n // check for Group Permissions\n if (submission) {\n // we would anyway need to loop through components for create permission, so we'll do that for all of them\n (0, formUtil_1.eachComponent)(form.components, (component, path) => {\n if (component && component.defaultPermission) {\n const value = (0, lodash_1.get)(submission.data, path);\n // make it work for single-select Group and multi-select Group\n const groups = Array.isArray(value) ? value : [value];\n groups.forEach(group => {\n if (group && group._id && // group id is present\n user.roles.indexOf(group._id) > -1 // user has group id in his roles\n ) {\n if (component.defaultPermission === 'read') {\n perms[permMap.read] = true;\n }\n if (component.defaultPermission === 'create') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n }\n if (component.defaultPermission === 'write') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n perms[permMap.update] = true;\n }\n if (component.defaultPermission === 'admin') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n perms[permMap.update] = true;\n perms[permMap.delete] = true;\n }\n }\n });\n }\n });\n }\n return perms;\n });\n }\n /**\n * `Determine if the current user can submit a form.\n * @return {*}\n */\n canSubmit() {\n return this.userPermissions().then((perms) => {\n // If there is user and they cannot create, then check anonymous user permissions.\n if (!perms.create && Formio.getUser()) {\n return this.userPermissions(null).then((anonPerms) => {\n if (anonPerms.create) {\n Formio.setUser(null);\n return true;\n }\n return false;\n });\n }\n return perms.create;\n });\n }\n getUrlParts(url) {\n return Formio.getUrlParts(url, this);\n }\n static getUrlParts(url, formio) {\n const base = (formio && formio.base) ? formio.base : Formio.baseUrl;\n let regex = '^(http[s]?:\\\\/\\\\/)';\n if (base && url.indexOf(base) === 0) {\n regex += `(${base.replace(/^http[s]?:\\/\\//, '')})`;\n }\n else {\n regex += '([^/]+)';\n }\n regex += '($|\\\\/.*)';\n return url.match(new RegExp(regex));\n }\n static serialize(obj, _interpolate) {\n const str = [];\n const interpolate = (item) => {\n return _interpolate ? _interpolate(item) : item;\n };\n for (const p in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, p)) {\n str.push(`${encodeURIComponent(p)}=${encodeURIComponent(interpolate(obj[p]))}`);\n }\n }\n return str.join('&');\n }\n static getRequestArgs(formio, type, url, method, data, opts) {\n method = (method || 'GET').toUpperCase();\n if (!opts || !(0, lodash_1.isObject)(opts)) {\n opts = {};\n }\n const requestArgs = {\n url,\n method,\n data: data || null,\n opts\n };\n if (type) {\n requestArgs.type = type;\n }\n if (formio) {\n requestArgs.formio = formio;\n }\n return requestArgs;\n }\n static makeStaticRequest(url, method, data, opts) {\n const requestArgs = Formio.getRequestArgs(null, '', url, method, data, opts);\n const request = Plugins_1.default.pluginWait('preRequest', requestArgs)\n .then(() => Plugins_1.default.pluginGet('staticRequest', requestArgs)\n .then((result) => {\n if ((0, lodash_1.isNil)(result)) {\n return Formio.request(requestArgs.url, requestArgs.method, requestArgs.data, requestArgs.opts.header, requestArgs.opts);\n }\n return result;\n }));\n return Plugins_1.default.pluginAlter('wrapStaticRequestPromise', request, requestArgs);\n }\n /**\n * Make an API request and wrap that request with the Form.io Request plugin system. This is very similar to the\n * {Formio.request} method with a difference being that it will pass the request through the Form.io request plugin.\n *\n * @param {Formio} formio - An instance of the Formio class.\n * @param {string} type - The request resource type. \"submission\", \"form\", etc.\n * @param {string} url - The URL to request.\n * @param {string} method - The request method. GET, PUT, POST, DELETE, or PATCH\n * @param {object} data - The data to pass to the request (for PUT, POST, and PATCH methods)\n * @param {object} options - An object of options to pass to the request method.\n * @param {boolean} options.ignoreCache - To ignore internal caching of the request.\n * @param {object} options.headers - An object of headers to pass along to the request.\n * @param {boolean} options.noToken - If set to true, this will not include the Form.io x-jwt-token along with the request.\n * @param {string} options.namespace - The Form.io namespace to prepend to all LocalStorage variables such as formioToken.\n * @param {boolean} options.getHeaders - Set this if you wish to include the response headers with the return of this method.\n * @return {Promise<Response>}\n */\n static makeRequest(formio, type, url, method, data, opts) {\n if (!formio) {\n return Formio.makeStaticRequest(url, method, data, opts);\n }\n const requestArgs = Formio.getRequestArgs(formio, type, url, method, data, opts);\n requestArgs.opts = requestArgs.opts || {};\n requestArgs.opts.formio = formio;\n //for Formio requests default Accept and Content-type headers\n if (!requestArgs.opts.headers) {\n requestArgs.opts.headers = {};\n }\n requestArgs.opts.headers = (0, lodash_1.defaults)(requestArgs.opts.headers, {\n 'Accept': 'application/json',\n 'Content-type': 'application/json'\n });\n const request = Plugins_1.default.pluginWait('preRequest', requestArgs)\n .then(() => Plugins_1.default.pluginGet('request', requestArgs)\n .then((result) => {\n if ((0, lodash_1.isNil)(result)) {\n return Formio.request(requestArgs.url, requestArgs.method, requestArgs.data, requestArgs.opts.header, requestArgs.opts);\n }\n return result;\n }));\n return Plugins_1.default.pluginAlter('wrapRequestPromise', request, requestArgs);\n }\n /**\n * Execute an API request to any external system. This is a wrapper around the Web fetch method.\n *\n * ```ts\n * Formio.request('https://examples.form.io').then((form) => {\n * console.log(form);\n * });\n * ```\n *\n * @param {string} url - The URL to request.\n * @param {string} method - The request method. GET, PUT, POST, DELETE, or PATCH\n * @param {object} data - The data to pass to the request (for PUT, POST, and PATCH methods)\n * @param {Headers} header - An object of headers to pass to the request.\n * @param {object} options - An object of options to pass to the request method.\n * @param {boolean} options.ignoreCache - To ignore internal caching of the request.\n * @param {object} options.headers - An object of headers to pass along to the request.\n * @param {boolean} options.noToken - If set to true, this will not include the Form.io x-jwt-token along with the request.\n * @param {string} options.namespace - The Form.io namespace to prepend to all LocalStorage variables such as formioToken.\n * @param {boolean} options.getHeaders - Set this if you wish to include the response headers with the return of this method.\n * @return {Promise<Response>|*}\n */\n static request(url, method, data, header, opts) {\n if (!url) {\n return Promise.reject('No url provided');\n }\n method = (method || 'GET').toUpperCase();\n // For reverse compatibility, if they provided the ignoreCache parameter,\n // then change it back to the options format where that is a parameter.\n if ((0, lodash_1.isBoolean)(opts)) {\n opts = { ignoreCache: opts };\n }\n if (!opts || !(0, lodash_1.isObject)(opts)) {\n opts = {};\n }\n // Generate a cachekey.\n const cacheKey = btoa(encodeURI(url));\n // Get the cached promise to save multiple loads.\n if (!opts.ignoreCache && method === 'GET' && Formio.cache.hasOwnProperty(cacheKey)) {\n return Promise.resolve(Formio.cloneResponse(Formio.cache[cacheKey]));\n }\n if (url[0] === '/') {\n url = Formio.baseUrl + url;\n }\n // Set up and fetch request\n const headers = header || new Headers(opts.headers || {\n 'Accept': 'application/json',\n 'Content-type': 'application/json'\n });\n const token = Formio.getToken(opts);\n if (token && !opts.noToken) {\n headers.set('x-jwt-token', token);\n }\n // The fetch-ponyfill can't handle a proper Headers class anymore. Change it back to an object.\n const headerObj = {};\n headers.forEach(function (value, name) {\n headerObj[name] = value;\n });\n let options = {\n method: method,\n headers: headerObj,\n mode: 'cors'\n };\n if (data) {\n options.body = JSON.stringify(data);\n }\n // Allow plugins to alter the options.\n options = Plugins_1.default.pluginAlter('requestOptions', options, url);\n if (options.namespace || Formio.namespace) {\n opts.namespace = options.namespace || Formio.namespace;\n }\n const requestToken = options.headers['x-jwt-token'];\n const result = Plugins_1.default.pluginAlter('wrapFetchRequestPromise', Formio.fetch(url, options), { url, method, data, opts }).then((response) => {\n // Allow plugins to respond.\n response = Plugins_1.default.pluginAlter('requestResponse', response, Formio, data);\n if (!response.ok) {\n if (response.status === 440) {\n Formio.setToken(null, opts);\n Formio.events.emit('formio.sessionExpired', response.body || response);\n }\n else if (response.status === 401) {\n Formio.events.emit('formio.unauthorized', response.body || response);\n }\n else if (response.status === 416) {\n Formio.events.emit('formio.rangeIsNotSatisfiable', response.body || response);\n }\n else if (response.status === 504) {\n return Promise.reject(new Error('Network request failed'));\n }\n // Parse and return the error as a rejected promise to reject this promise\n return (response.headers.get('content-type').includes('application/json')\n ? response.json()\n : response.text())\n .then((error) => {\n return Promise.reject(error);\n });\n }\n // Handle fetch results\n const respToken = response.headers.get('x-jwt-token');\n // In some strange cases, the fetch library will return an x-jwt-token without sending\n // one to the server. This has even been debugged on the server to verify that no token\n // was introduced with the request, but the response contains a token. This is an Invalid\n // case where we do not send an x-jwt-token and get one in return for any GET request.\n let tokenIntroduced = false;\n if ((method === 'GET') &&\n !requestToken &&\n respToken &&\n !opts.external &&\n !url.includes('token=') &&\n !url.includes('x-jwt-token=')) {\n console.warn('Token was introduced in request.');\n tokenIntroduced = true;\n }\n if (response.status >= 200 &&\n response.status < 300 &&\n respToken &&\n respToken !== '' &&\n !tokenIntroduced) {\n Formio.setToken(respToken, Object.assign(Object.assign({}, opts), { fromCurrent: (opts.fromCurrent || !!requestToken) }));\n }\n // 204 is no content. Don't try to .json() it.\n if (response.status === 204) {\n return {};\n }\n const getResult = response.headers.get('content-type').includes('application/json')\n ? response.json()\n : response.text();\n return getResult.then((result) => {\n // Add some content-range metadata to the result here\n let range = response.headers.get('content-range');\n if (range && (0, lodash_1.isObject)(result)) {\n range = range.split('/');\n if (range[0] !== '*') {\n const skipLimit = range[0].split('-');\n result.skip = Number(skipLimit[0]);\n result.limit = skipLimit[1] - skipLimit[0] + 1;\n }\n result.serverCount = range[1] === '*' ? range[1] : Number(range[1]);\n }\n if (!opts.getHeaders) {\n return result;\n }\n const headers = {};\n response.headers.forEach((item, key) => {\n headers[key] = item;\n });\n // Return the result with the headers.\n return {\n result,\n headers,\n };\n });\n })\n .then((result) => {\n if (opts.getHeaders) {\n return result;\n }\n // Cache the response.\n if (method === 'GET') {\n Formio.cache[cacheKey] = result;\n }\n return Formio.cloneResponse(result);\n })\n .catch((err) => {\n if (err === 'Bad Token' && opts.noToken !== false) {\n Formio.setToken(null, opts);\n Formio.events.emit('formio.badToken', err);\n }\n if (err.message) {\n err = new Error(`Could not connect to API server (${err.message}): ${url}`);\n err.networkError = true;\n }\n if (method === 'GET') {\n delete Formio.cache[cacheKey];\n }\n return Promise.reject(err);\n });\n return result;\n }\n // Needed to maintain reverse compatability...\n static get token() {\n return Formio.tokens.formioToken || '';\n }\n // Needed to maintain reverse compatability...\n static set token(token) {\n Formio.tokens.formioToken = token || '';\n }\n static useSessionToken(options) {\n if (typeof localStorage === 'undefined') {\n return;\n }\n let namespace = options;\n if (typeof options === 'object') {\n options = options.namespace;\n }\n const tokenName = `${namespace || Formio.namespace || 'formio'}Token`;\n const token = localStorage.getItem(tokenName);\n if (token) {\n localStorage.removeItem(tokenName);\n sessionStorage.setItem(tokenName, token);\n }\n const userName = `${namespace || Formio.namespace || 'formio'}User`;\n const user = localStorage.getItem(userName);\n if (user) {\n localStorage.removeItem(userName);\n sessionStorage.setItem(userName, user);\n }\n localStorage.setItem('useSessionToken', 'true');\n }\n /**\n * Sets the JWT in storage to be used within an application.\n *\n * @param {string} token - The JWT token to set.\n * @param {object} options - Options as follows\n * @param {string} options.namespace - The namespace to save the token within. i.e. \"formio\"\n * @param {Formio} options.formio - The Formio instance.\n * @return {Promise<object>|void}\n */\n static setToken(token = '', opts = {}) {\n token = token || '';\n opts = (typeof opts === 'string') ? { namespace: opts } : opts || {};\n const tokenName = `${opts.namespace || Formio.namespace || 'formio'}Token`;\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n const storage = localStorage.getItem('useSessionToken') ? sessionStorage : localStorage;\n if (!token) {\n if (!opts.fromUser) {\n opts.fromToken = true;\n Formio.setUser(null, opts);\n }\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.removeItem(tokenName);\n }\n catch (err) {\n browser_cookies_1.default.erase(tokenName, { path: '/' });\n }\n Formio.tokens[tokenName] = token;\n return Promise.resolve(null);\n }\n if (Formio.tokens[tokenName] !== token) {\n Formio.tokens[tokenName] = token;\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.setItem(tokenName, token);\n }\n catch (err) {\n browser_cookies_1.default.set(tokenName, token, { path: '/' });\n }\n }\n // Return or updates the current user\n return Formio.currentUser(opts.formio, opts);\n }\n /**\n * Returns the token set within the application for the user.\n *\n * @param {object} options - The options as follows.\n * @param {string} options.namespace - The namespace of the token you wish to fetch.\n * @param {boolean} options.decode - If you would like the token returned as decoded JSON.\n * @return {*}\n */\n static getToken(options) {\n options = (typeof options === 'string') ? { namespace: options } : options || {};\n const tokenName = `${options.namespace || Formio.namespace || 'formio'}Token`;\n const decodedTokenName = options.decode ? `${tokenName}Decoded` : tokenName;\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n if (Formio.tokens[decodedTokenName]) {\n return Formio.tokens[decodedTokenName];\n }\n try {\n const token = localStorage.getItem('useSessionToken')\n ? sessionStorage.getItem(tokenName)\n : localStorage.getItem(tokenName);\n Formio.tokens[tokenName] = token || '';\n if (options.decode) {\n Formio.tokens[decodedTokenName] = Formio.tokens[tokenName] ? (0, jwtDecode_1.jwtDecode)(Formio.tokens[tokenName]) : {};\n return Formio.tokens[decodedTokenName];\n }\n return Formio.tokens[tokenName];\n }\n catch (e) {\n Formio.tokens[tokenName] = browser_cookies_1.default.get(tokenName);\n return '';\n }\n }\n /**\n * Sets the current user within the application cache.\n *\n * @param {object} user - JSON object of the user you wish to set.\n * @param {object} options - Options as follows\n * @param {string} options.namespace - The namespace of the tokens\n */\n static setUser(user, opts = {}) {\n const userName = `${opts.namespace || Formio.namespace || 'formio'}User`;\n const storage = localStorage.getItem('useSessionToken') ? sessionStorage : localStorage;\n if (!user) {\n if (!opts.fromToken) {\n opts.fromUser = true;\n Formio.setToken(null, opts);\n }\n // Emit an event on the cleared user.\n Formio.events.emit('formio.user', null);\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n return storage.removeItem(userName);\n }\n catch (err) {\n return browser_cookies_1.default.erase(userName, { path: '/' });\n }\n }\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.setItem(userName, JSON.stringify(user));\n }\n catch (err) {\n browser_cookies_1.default.set(userName, JSON.stringify(user), { path: '/' });\n }\n // Emit an event on the authenticated user.\n Formio.events.emit('formio.user', user);\n }\n /**\n * Returns the user JSON.\n *\n * @param {object} options - Options as follows\n * @param {string} namespace - The namespace of the tokens stored within this application.\n * @return {object} - The user object.\n */\n static getUser(options) {\n options = options || {};\n const userName = `${options.namespace || Formio.namespace || 'formio'}User`;\n try {\n return JSON.parse((localStorage.getItem('useSessionToken')\n ? sessionStorage\n : localStorage).getItem(userName) || '');\n }\n catch (e) {\n return JSON.parse(browser_cookies_1.default.get(userName));\n }\n }\n /**\n * Sets the BaseURL for the application.\n *\n * @description Every application developed using the JavaScript SDK must set both the {@link Formio.setBaseUrl} and\n * {@link Formio.setProjectUrl} methods. These two functions ensure that every URL passed into the constructor of this\n * class can determine the \"project\" context for which the application is running.\n *\n * Any Open Source server applications will set both the {@link Formio.setBaseUrl} and {@link Formio.setProjectUrl}\n * values will be the same value.\n *\n * ```ts\n * Formio.setBaseUrl('https://yourwebsite.com/forms');\n * Formio.setProjectUrl('https://yourwebsite.com/forms/project');\n *\n * // Now the Formio constructor will know what is the \"project\" and what is the form alias name. Without setBaseUrl\n * // and setProjectUrl, this would throw an error.\n *\n * const formio = new Formio('https://yourwebsite.com/forms/project/user');\n * formio.loadForm().then((form) => {\n * console.log(form);\n * });\n * ```\n *\n * @param {string} url - The URL of the Base API url.\n */\n static setBaseUrl(url) {\n Formio.baseUrl = url;\n if (!Formio.projectUrlSet) {\n Formio.projectUrl = url;\n }\n }\n /**\n * Returns the current base url described at {@link Formio.setBaseUrl}\n *\n * @return {string} - The base url of the application.\n */\n static getBaseUrl() {\n return Formio.baseUrl;\n }\n static setApiUrl(url) {\n return Formio.setBaseUrl(url);\n }\n static getApiUrl() {\n return Formio.getBaseUrl();\n }\n static setAppUrl(url) {\n console.warn('Formio.setAppUrl() is deprecated. Use Formio.setProjectUrl instead.');\n Formio.projectUrl = url;\n Formio.projectUrlSet = true;\n }\n /**\n * Sets the Project Url for the application. This is an important method that needs to be set for all applications. It\n * is documented @ {@link Formio.setBaseUrl}.\n *\n * @param {string} url - The project api url.\n */\n static setProjectUrl(url) {\n Formio.projectUrl = url;\n Formio.projectUrlSet = true;\n }\n /**\n * The Auth URL can be set to customize the authentication requests made from an application. By default, this is\n * just the same value as {@link Formio.projectUrl}\n *\n * @param {string} url - The authentication url\n */\n static setAuthUrl(url) {\n Formio.authUrl = url;\n }\n static getAppUrl() {\n console.warn('Formio.getAppUrl() is deprecated. Use Formio.getProjectUrl instead.');\n return Formio.projectUrl;\n }\n /**\n * Returns the Project url described at {@link Formio.setProjectUrl}\n *\n * @return {string|string} - The Project Url.\n */\n static getProjectUrl() {\n return Formio.projectUrl;\n }\n /**\n * Clears the runtime internal API cache.\n *\n * @description By default, the Formio class will cache all API requests in memory so that any subsequent requests\n * using GET method will return the cached results as long as the API URl is the same as what was cached previously.\n * This cache can be cleared using this method as follows.\n *\n * ```ts\n * Formio.clearCache();\n * ```\n *\n * Or, if you just wish to clear a single request, then the {@link Formio.request#options.ignoreCache} option can be\n * provided when making an API request as follows.\n *\n * ```ts\n * Formio.loadForm({}, {\n * ignoreCache: true\n * }).then((form) => {\n * console.log(form);\n * });\n * ```\n *\n * Both of the following will ensure that a new request is made to the API server and that the results will not be\n * from the cached result.\n */\n static clearCache() {\n Formio.cache = {};\n }\n /**\n * Return the access information about a Project, such as the Role ID's for that project, and if the server is\n * configured to do so, the Form and Resource access configurations that the authenticated user has access to.\n *\n * @description This is useful for an application to determine the UI for a specific user to identify which forms they have\n * access to submit or read.\n *\n * @param {Formio} formio - The Formio instance.\n * @return {Promise<Response>}\n */\n static accessInfo(formio) {\n const projectUrl = formio ? formio.projectUrl : Formio.projectUrl;\n return Formio.makeRequest(formio, 'accessInfo', `${projectUrl}/access`);\n }\n /**\n * Returns an array of roles for the project, which includes the ID's and names of those roles.\n *\n * @param {Formio} formio - The Formio instance.\n * @return {Promise<Response>}\n */\n static projectRoles(formio) {\n const projectUrl = formio ? formio.projectUrl : Formio.projectUrl;\n return Formio.makeRequest(formio, 'projectRoles', `${projectUrl}/role`);\n }\n /**\n * Return the currentUser object. This will fetch the user from the server and respond with the Submission JSON\n * of that user object.\n *\n * @param {Formio} formio - The Formio instance\n * @param {object} options - The options passed to {@link Formio.getUser}\n * @return {Promise<R>|*}\n */\n static currentUser(formio, options = {}) {\n let authUrl = Formio.authUrl;\n if (!authUrl) {\n authUrl = formio ? formio.projectUrl : (Formio.projectUrl || Formio.baseUrl);\n }\n authUrl += '/current';\n if (!options.ignoreCache || options.fromCurrent) {\n const user = Formio.getUser(options);\n if (user) {\n return Plugins_1.default.pluginAlter('wrapStaticRequestPromise', Promise.resolve(user), {\n url: authUrl,\n method: 'GET',\n options\n });\n }\n }\n const token = Formio.getToken(options);\n if ((!options || !options.external) && !token) {\n return Plugins_1.default.pluginAlter('wrapStaticRequestPromise', Promise.resolve(null), {\n url: authUrl,\n method: 'GET',\n options\n });\n }\n options.fromCurrent = true;\n return Formio.makeRequest(formio, 'currentUser', authUrl, 'GET', null, options)\n .then((response) => {\n Formio.setUser(response, options);\n return response;\n });\n }\n /**\n * Performs a logout of the Form.io application. This will reset all cache, as well as make a request to the logout\n * endpoint of the Form.io api platform.\n *\n * @param {Formio} formio - A Formio instance.\n * @param {object} options - Options passed to both {@link Formio.setToken} as well as {@link Formio.setUser}\n * @return {Promise<Response>}\n */\n static logout(formio, options = {}) {\n options.formio = formio;\n const projectUrl = Formio.authUrl ? Formio.authUrl : (formio ? formio.projectUrl : Formio.baseUrl);\n const logout = () => {\n Formio.setToken(null, options);\n Formio.setUser(null, options);\n Formio.clearCache();\n localStorage.removeItem('useSessionToken');\n };\n return Formio.makeRequest(formio, 'logout', `${projectUrl}/logout`)\n .then(function (result) {\n logout();\n if (result.shouldRedirect && result.url) {\n window.location.href = result.url;\n }\n return result;\n })\n .catch(function (err) {\n logout();\n throw err;\n });\n }\n /**\n * Returns the query passed to a page in JSON object format.\n *\n * @description For example, lets say you visit your application using\n * the url as follows.\n *\n * ```\n * https://yourapplication.com/?token=23423423423&username=Joe\n * ```\n *\n * The following code will provide your application with the following.\n *\n * ```ts\n * const query Formio.pageQuery();\n * console.log(query.token); // Will print 23423423423\n * console.log(query.username); // Will print Joe\n * ```\n *\n * @return {{}} - A JSON object representation of the query that was passed to the URL of an application.\n */\n static pageQuery() {\n const pageQuery = {};\n pageQuery.paths = [];\n const hashes = location.hash.substr(1).replace(/\\?/g, '&').split('&');\n let parts = [];\n location.search.substr(1).split('&').forEach(function (item) {\n parts = item.split('=');\n if (parts.length > 1) {\n pageQuery[parts[0]] = parts[1] && decodeURIComponent(parts[1]);\n }\n });\n hashes.forEach(function (item) {\n parts = item.split('=');\n if (parts.length > 1) {\n pageQuery[parts[0]] = parts[1] && decodeURIComponent(parts[1]);\n }\n else if (item.indexOf('/') === 0) {\n pageQuery.paths = item.substr(1).split('/');\n }\n });\n return pageQuery;\n }\n /**\n * Much like {@link Formio.currentUser}, but instead automatically injects the Bearer tokens into the headers to\n * perform a Token swap of the OAuth token which will then return the JWT token for that user.\n *\n * @param {Formio} formio - The Formio instance\n * @param {string} token - An OAuth Bearer token to use for a token swap between the OAuth provider and Form.io\n * @return {Promise<R>|*}\n */\n static oAuthCurrentUser(formio, token) {\n return Formio.currentUser(formio, {\n external: true,\n headers: {\n Authorization: `Bearer ${token}`\n }\n });\n }\n static oauthLogoutURI(uri, options) {\n options = (typeof options === 'string') ? { namespace: options } : options || {};\n const logoutURIName = `${options.namespace || Formio.namespace || 'formio'}LogoutAuthUrl`;\n Formio.tokens[logoutURIName];\n localStorage.setItem(logoutURIName, uri);\n return Formio.tokens[logoutURIName];\n }\n /**\n * Perform a SAML initialization.\n *\n * @description Typically, you would use the {@link Formio.ssoInit} method to perform this function\n * since this method is an alias for the following.\n *\n * ```ts\n * Formio.samlInit();\n * Formio.ssoInit('saml'); // This is the exact same thing as calling Formio.samlInit\n * ```\n *\n * This method will return false if the process is just starting. The code below is a typical block of code that is\n * used to automatically trigger the SAML authentication process within your application using a Button component.\n *\n * ```ts\n * if (Formio.pageQuery().saml) {\n * const sso = Formio.samlInit();\n * if (sso) {\n * sso.then((user) => {\n * // The SSO user is now loaded!\n * console.log(user);\n * });\n * }\n * }\n * ```\n *\n * You can then place the following code withiin the \"Custom\" action of a Button component on your form.\n *\n * ```ts\n * Formio.samlInit();\n * ```\n *\n * Now when you click on this button, it will start the handshake process with SAML, and once it returns, will pass\n * a \"saml\" query parameter back to your application which will execute the code to load the current user from SAML.\n *\n * @param {object} options - Options to pass to the SAML initialization process.\n * @param {string} options.relay - The URL that will be used as the authentication \"relay\" that occurs during a SAML handshake process.\n * @return {boolean|Promise<Object>|void}\n */\n static samlInit(options = {}) {\n const query = Formio.pageQuery();\n if (query.saml) {\n Formio.setUser(null);\n const retVal = Formio.setToken(query.saml);\n let uri = window.location.toString();\n uri = uri.substring(0, uri.indexOf('?'));\n if (window.location.hash) {\n uri += window.location.hash;\n }\n window.history.replaceState({}, document.title, uri);\n return retVal;\n }\n // Set the relay if not provided.\n if (!options.relay) {\n options.relay = window.location.href;\n }\n // go to the saml sso endpoint for this project.\n const authUrl = Formio.authUrl || Formio.projectUrl;\n window.location.href = `${authUrl}/saml/sso?relay=${encodeURI(options.relay)}`;\n return false;\n }\n /**\n * Perform an Okta Authentication process using the {@link https://developer.okta.com/code/javascript/okta_auth_sdk|Okta SDK}.\n *\n * @description This method does require that you first include the Okta JavaScript SDK within your application as follows.\n *\n * First you need to include the Okta Authentication script.\n *\n * ```html\n * <script src=\"https://ok1static.oktacdn.com/assets/js/sdk/okta-auth-js/2.0.1/okta-auth-js.min.js\" type=\"text/javascript\"></script>\n * ```\n *\n * Then you can call this method as follows.\n *\n * ```ts\n * Formio.oktaInit();\n * ```\n *\n * @param {object} options - Options that are passed directly to the {@link https://github.com/okta/okta-auth-js#configuration-reference|Okta SDK constructor}\n * @param {constructor} options.OktaAuth - If the OktaAuth constructor is not provided global to the application, it can be provided to this method using this property.\n * @param {Formio} options.formio - The Formio instance.\n * @param {Array<string>} options.scopes - Scopes that are passed to the {@link https://github.com/okta/okta-auth-js#tokengetwithredirectoptions|getWithRedirect} method from the Okta SDK.\n * @return {Promise<Object>}\n */\n static oktaInit(options = {}) {\n if (typeof OktaAuth !== undefined) {\n options.OktaAuth = OktaAuth;\n }\n if (typeof options.OktaAuth === undefined) {\n const errorMessage = 'Cannot find OktaAuth. Please include the Okta JavaScript SDK within your application. See https://developer.okta.com/code/javascript/okta_auth_sdk for an example.';\n console.warn(errorMessage);\n return Promise.reject(errorMessage);\n }\n return new Promise((resolve, reject) => {\n const Okta = options.OktaAuth;\n delete options.OktaAuth;\n const authClient = new Okta(options);\n authClient.tokenManager.get('accessToken')\n .then((accessToken) => {\n if (accessToken) {\n resolve(Formio.oAuthCurrentUser(options.formio, accessToken.accessToken));\n }\n else if (location.hash) {\n authClient.token.parseFromUrl()\n .then((token) => {\n authClient.tokenManager.add('accessToken', token);\n resolve(Formio.oAuthCurrentUser(options.formio, token.accessToken));\n })\n .catch((err) => {\n console.warn(err);\n reject(err);\n });\n }\n else {\n authClient.token.getWithRedirect({\n responseType: 'token',\n scopes: options.scopes\n });\n resolve(false);\n }\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n /**\n * A common static method to trigger any SSO processes. This method is really just an alias for other static methods.\n *\n * @param {('saml'|'okta')} type - The type of SSO to trigger. 'saml' is an alias for {@link Formio.samlInit}, and 'okta' is an alias for {@link Formio.oktaInit}.\n * @param {object} options - Options to pass to the specific sso methods\n * @return {*|Promise<Object>|boolean|void}\n */\n static ssoInit(type, options = {}) {\n switch (type) {\n case 'saml':\n return Formio.samlInit(options);\n case 'okta':\n return Formio.oktaInit(options);\n default:\n console.warn('Unknown SSO type');\n return Promise.reject('Unknown SSO type');\n }\n }\n /**\n * Lazy load a remote library dependency.\n *\n * @description This is useful for components that wish to lazy load a required library\n * by adding that library to the <scripts> section of the HTML webpage, and then provide a promise that will resolve\n * when the library becomes available for use.\n *\n * @example Load Google Maps API.\n * ```ts\n * Formio.requireLibrary('googleMaps', 'google.maps.Map', 'https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap', true).then(() => {\n * // Once the promise resolves, the following can now be used within your application.\n * const map = new google.maps.Map(document.getElementById(\"map\"), {...});\n * });\n * ```\n *\n * @param {string} name - The internal name to give to the library you are loading. This is useful for caching the library for later use.\n * @param {string} property - The name of the global property that will be added to the global namespace once the library has been loaded. This is used to check to see if the property exists before resolving the promise that the library is ready for use.\n * @param {string} src - The URL of the library to lazy load.\n * @param {boolean} polling - Determines if polling should be used to determine if they library is ready to use. If set to false, then it will rely on a global callback called ${name}Callback where \"name\" is the first property passed to this method. When this is called, that will indicate when the library is ready. In most cases, you will want to pass true to this parameter to initiate a polling method to check for the library availability in the global context.\n * @return {Promise<object>} - A promise that will resolve when the plugin is ready to be used.\n */\n static requireLibrary(name, property, src, polling = false, onload) {\n if (!Formio.libraries.hasOwnProperty(name)) {\n Formio.libraries[name] = {};\n Formio.libraries[name].ready = new Promise((resolve, reject) => {\n Formio.libraries[name].resolve = resolve;\n Formio.libraries[name].reject = reject;\n });\n const callbackName = `${name}Callback`;\n if (!polling && !window[callbackName]) {\n window[callbackName] = () => Formio.libraries[name].resolve();\n }\n // See if the plugin already exists.\n const plugin = (0, lodash_1.get)(window, property);\n if (plugin) {\n Formio.libraries[name].resolve(plugin);\n }\n else {\n src = Array.isArray(src) ? src : [src];\n src.forEach((lib) => {\n let attrs = {};\n let elementType = '';\n if (typeof lib === 'string') {\n lib = {\n type: 'script',\n src: lib,\n };\n }\n switch (lib.type) {\n case 'script':\n elementType = 'script';\n attrs = {\n src: lib.src,\n type: 'text/javascript',\n defer: true,\n async: true,\n referrerpolicy: 'origin',\n };\n break;\n case 'styles':\n elementType = 'link';\n attrs = {\n href: lib.src,\n rel: 'stylesheet',\n };\n break;\n }\n // Add the script to the top of the page.\n const element = document.createElement(elementType);\n if (element.setAttribute) {\n for (const attr in attrs) {\n element.setAttribute(attr, attrs[attr]);\n }\n }\n if (onload) {\n element.addEventListener('load', () => {\n Formio.libraries[name].loaded = true;\n onload(Formio.libraries[name].ready);\n });\n }\n const { head } = document;\n if (head) {\n head.appendChild(element);\n }\n });\n // if no callback is provided, then check periodically for the script.\n if (polling) {\n const interval = setInterval(() => {\n const plugin = (0, lodash_1.get)(window, property);\n if (plugin) {\n clearInterval(interval);\n Formio.libraries[name].resolve(plugin);\n }\n }, 200);\n }\n }\n }\n const lib = Formio.libraries[name];\n return onload && lib.loaded ? onload(lib.ready) : lib.ready;\n }\n /**\n * Determines if a lazy loaded library is ready to be used.\n *\n * @description Example: Let's assume that the example provided at {@link Formio.requireLibrary} was used elsewhere in your application.\n * You could now use the following within a separate place that will also resolve once the library is ready to be used.\n *\n * ```js\n * Formio.libraryReady('googleMaps').then(() => {\n * // Once the promise resolves, the following can now be used within your application.\n * const map = new google.maps.Map(document.getElementById(\"map\"), {...});\n * });\n * ```\n *\n * @param {string} name - The name of the library to check.\n * @return {Promise<object>} - A promise that will resolve when the library is ready to be used.\n */\n static libraryReady(name) {\n if (Formio.libraries.hasOwnProperty(name) &&\n Formio.libraries[name].ready) {\n return Formio.libraries[name].ready;\n }\n return Promise.reject(`${name} library was not required.`);\n }\n /**\n * Clones the response from the API so that it cannot be mutated.\n *\n * @param response\n */\n static cloneResponse(response) {\n const copy = (0, fastCloneDeep_1.fastCloneDeep)(response);\n if (Array.isArray(response)) {\n copy.skip = response.skip;\n copy.limit = response.limit;\n copy.serverCount = response.serverCount;\n }\n return copy;\n }\n /**\n * Sets the project path type.\n *\n * @param type\n */\n static setPathType(type) {\n if (typeof type === 'string') {\n Formio.pathType = type;\n }\n }\n /**\n * Gets the project path type.\n */\n static getPathType() {\n return Formio.pathType;\n }\n}\nexports.Formio = Formio;\n/**\n * The base API url of the Form.io Platform. Example: https://api.form.io\n */\nFormio.baseUrl = 'https://api.form.io';\n/**\n * The project API url of the Form.io Project. Example: https://examples.form.io\n */\nFormio.projectUrl = '';\n/**\n * The project url to use for Authentication.\n */\nFormio.authUrl = '';\n/**\n * Set to true if the project url has been established with ```Formio.setProjectUrl()```\n */\nFormio.projectUrlSet = false;\n/**\n * The Form.io API Cache. This ensures that requests to the same API endpoint are cached.\n */\nFormio.cache = {};\n/**\n * The namespace used to save the Form.io Token's and variables within an application.\n */\nFormio.namespace = '';\n/**\n * Handles events fired within this SDK library.\n */\nFormio.events = new eventemitter3_1.default();\n/**\n * Stores all of the libraries lazy loaded with ```Formio.requireLibrary``` method.\n */\nFormio.libraries = {};\n/**\n * A direct interface to the Form.io fetch polyfill.\n */\nFormio.fetch = fetch;\n/**\n * A direct interface to the Form.io fetch Headers polyfill.\n */\nFormio.Headers = Headers;\n/**\n * All of the auth tokens for this session.\n */\nFormio.tokens = {};\n/**\n * The version of this library.\n */\nFormio.version = '---VERSION---';\n/**\n * The global options for the Formio library.\n */\nFormio.options = {};\n// Add Plugin methods.\nFormio.plugins = Plugins_1.default.plugins;\nFormio.deregisterPlugin = Plugins_1.default.deregisterPlugin;\nFormio.registerPlugin = Plugins_1.default.registerPlugin;\nFormio.getPlugin = Plugins_1.default.getPlugin;\nFormio.pluginWait = Plugins_1.default.pluginWait;\nFormio.pluginGet = Plugins_1.default.pluginGet;\nFormio.pluginAlter = Plugins_1.default.pluginAlter;\n// Adds Formio to the Plugins Interface.\nPlugins_1.default.Formio = Formio;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/sdk/Formio.js?");
|
3294
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Formio = exports.FormioPathType = void 0;\nconst fetch_ponyfill_1 = __importDefault(__webpack_require__(/*! fetch-ponyfill */ \"./node_modules/fetch-ponyfill/build/fetch-browser.js\"));\nconst fastCloneDeep_1 = __webpack_require__(/*! ../utils/fastCloneDeep */ \"./node_modules/@formio/core/lib/utils/fastCloneDeep.js\");\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/index.js\");\nconst jwtDecode_1 = __webpack_require__(/*! ../utils/jwtDecode */ \"./node_modules/@formio/core/lib/utils/jwtDecode.js\");\nconst eventemitter3_1 = __importDefault(__webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\"));\nconst browser_cookies_1 = __importDefault(__webpack_require__(/*! browser-cookies */ \"./node_modules/browser-cookies/src/browser-cookies.js\"));\nconst { fetch, Headers } = (0, fetch_ponyfill_1.default)();\nconst Plugins_1 = __importDefault(__webpack_require__(/*! ./Plugins */ \"./node_modules/@formio/core/lib/sdk/Plugins.js\"));\nconst utils_1 = __webpack_require__(/*! ../utils */ \"./node_modules/@formio/core/lib/utils/index.js\");\n/**\n * The different path types for a project.\n */\nvar FormioPathType;\n(function (FormioPathType) {\n FormioPathType[\"Subdirectories\"] = \"Subdirectories\";\n FormioPathType[\"Subdomains\"] = \"Subdomains\";\n})(FormioPathType || (exports.FormioPathType = FormioPathType = {}));\n/**\n * The Formio interface class. This is a minimalistic API library that allows you to work with the Form.io API's within JavaScript.\n *\n * ## Usage\n * Creating an instance of Formio is simple, and takes only a path (URL String). The path can be different, depending on the desired output.\n * The Formio instance can also access higher level operations, depending on how granular of a path you start with.\n *\n * ```ts\n * var formio = new Formio(<endpoint>, [options]);\n * ```\n *\n * Where **endpoint** is any valid API endpoint within Form.io. These URL's can provide a number of different methods depending on the granularity of the endpoint. This allows you to use the same interface but have access to different methods depending on how granular the endpoint url is.\n * **options** is defined within the {link Formio.constructor} documentation.\n *\n * Here is an example of how this library can be used to load a form JSON from the Form.io API's\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadForm().then((form) => {\n * console.log(form);\n * });\n * ```\n */\nclass Formio {\n /**\n * @constructor\n * @param {string} path - A project, form, and submission API Url.\n * @param {FormioOptions} options - Available options to configure the Javascript API.\n */\n constructor(path, options = {}) {\n this.path = path;\n this.options = options;\n /**\n * The base API url of the Form.io Platform. Example: https://api.form.io\n */\n this.base = '';\n /**\n * The Projects Endpoint derived from the provided source.\n *\n * @example https://api.form.io/project\n */\n this.projectsUrl = '';\n /**\n * A specific project endpoint derived from the provided source.\n *\n * @example https://examples.form.io\n */\n this.projectUrl = '';\n /**\n * The Project ID found within the provided source.\n */\n this.projectId = '';\n /**\n * A specific Role URL provided the source.\n *\n * @example https://examples.form.io/role/2342343234234234\n */\n this.roleUrl = '';\n /**\n * The roles endpoint derived from the provided source.\n *\n * @example https://examples.form.io/role\n */\n this.rolesUrl = '';\n /**\n * The roleID derieved from the provided source.\n */\n this.roleId = '';\n /**\n * A specific form url derived from the provided source.\n *\n * @example https://examples.form.io/example\n */\n this.formUrl = '';\n /**\n * The forms url derived from the provided source.\n *\n * @example https://example.form.io/form\n */\n this.formsUrl = '';\n /**\n * The Form ID derived from the provided source.\n */\n this.formId = '';\n /**\n * The submissions URL derived from the provided source.\n *\n * @example https://examples.form.io/example/submission\n */\n this.submissionsUrl = '';\n /**\n * A specific submissions URL derived from a provided source.\n *\n * @example https://examples.form.io/example/submission/223423423423\n */\n this.submissionUrl = '';\n /**\n * The submission ID provided a submission url.\n */\n this.submissionId = '';\n /**\n * The actions url provided a form url as the source.\n *\n * @example https://examples.form.io/example/action\n */\n this.actionsUrl = '';\n /**\n * The Action ID derived from a provided Action url.\n */\n this.actionId = '';\n /**\n * A specific action api endoint.\n */\n this.actionUrl = '';\n this.vsUrl = '';\n this.vId = '';\n this.vUrl = '';\n /**\n * The query string derived from the provided src url.\n */\n this.query = '';\n /**\n * If this is a non-project url, such is the case for Open Source API.\n */\n this.noProject = false;\n // Ensure we have an instance of Formio.\n if (!(this instanceof Formio)) {\n return new Formio(path);\n }\n if (options.useSessionToken) {\n Formio.useSessionToken(options);\n }\n if (options.hasOwnProperty('base') && options.base) {\n this.base = options.base;\n }\n else if (Formio.baseUrl) {\n this.base = Formio.baseUrl;\n }\n else if (window && window.location) {\n const match = window.location.href.match(/http[s]?:\\/\\/api./);\n this.base = match ? match[0] : window.location.origin;\n }\n if (!path) {\n // Allow user to create new projects if this was instantiated without\n // a url\n this.projectUrl = Formio.projectUrl || `${this.base}/project`;\n this.projectsUrl = `${this.base}/project`;\n this.projectId = '';\n this.query = '';\n return;\n }\n if (options.hasOwnProperty('project') && options.project) {\n this.projectUrl = options.project;\n }\n const project = this.projectUrl || Formio.projectUrl;\n const projectRegEx = /(^|\\/)(project)($|\\/[^/]+)/;\n const isProjectUrl = path.search(projectRegEx) !== -1;\n // The baseURL is the same as the projectUrl, and does not contain \"/project/MONGO_ID\" in\n // its domain. This is almost certainly against the Open Source server.\n if (project && this.base === project && !isProjectUrl) {\n this.noProject = true;\n this.projectUrl = this.base;\n }\n // Normalize to an absolute path.\n if (path.indexOf('http') !== 0 && path.indexOf('//') !== 0) {\n path = this.base + path;\n }\n const hostparts = this.getUrlParts(path);\n let hostName = '';\n let parts = [];\n if (hostparts) {\n hostName = hostparts[1] + hostparts[2];\n path = hostparts.length > 3 ? hostparts[3] : '';\n const queryparts = path.split('?');\n if (queryparts.length > 1) {\n path = queryparts[0];\n this.query = `?${queryparts[1]}`;\n }\n }\n // Register a specific path.\n const registerPath = (name, base) => {\n this[`${name}sUrl`] = `${base}/${name}`;\n const regex = new RegExp(`/${name}/([^/]+)`);\n if (path && path.search(regex) !== -1) {\n parts = path.match(regex);\n this[`${name}Url`] = parts ? base + parts[0] : '';\n this[`${name}Id`] = parts.length > 1 ? parts[1] : '';\n base += parts[0];\n }\n return base;\n };\n // Register an array of items.\n const registerItems = (items, base, staticBase) => {\n for (const i in items) {\n if (items.hasOwnProperty(i)) {\n const item = items[i];\n if (Array.isArray(item)) {\n registerItems(item, base, true);\n }\n else {\n const newBase = registerPath(item, base);\n base = staticBase ? base : newBase;\n }\n }\n }\n };\n if (!this.projectUrl || this.projectUrl === this.base) {\n // If a project uses Subdirectories path type, we need to specify a projectUrl\n if (!this.projectUrl && !isProjectUrl && Formio.pathType === 'Subdirectories') {\n const regex = `^${hostName.replace(/\\//g, '\\\\/')}.[^/]+`;\n const match = project.match(new RegExp(regex));\n this.projectUrl = match ? match[0] : hostName;\n }\n else {\n this.projectUrl = hostName;\n }\n }\n // Check if we have a specified path type.\n let isNotSubdomainType = false;\n if (Formio.pathType) {\n isNotSubdomainType = Formio.pathType !== 'Subdomains';\n }\n if (!this.noProject) {\n // Determine the projectUrl and projectId\n if (isProjectUrl) {\n // Get project id as project/:projectId.\n registerItems(['project'], hostName);\n path = path.replace(projectRegEx, '');\n }\n else if (hostName === this.base) {\n // Get project id as first part of path (subdirectory).\n if (hostparts && hostparts.length > 3 && path.split('/').length > 1) {\n const isFile = path.match(/.json/);\n const pathParts = path.split('/');\n if (isFile) {\n this.projectUrl = hostName;\n }\n else {\n pathParts.shift(); // Throw away the first /.\n const projectId = pathParts.shift();\n if (projectId) {\n this.projectId = projectId;\n path = `/${pathParts.join('/')}`;\n this.projectUrl = `${hostName}/${this.projectId}`;\n }\n }\n }\n }\n else {\n // Get project id from subdomain.\n if (hostparts &&\n hostparts.length > 2 &&\n (hostparts[2].split('.').length > 2 || hostName.includes('localhost')) &&\n !isNotSubdomainType) {\n this.projectUrl = hostName;\n this.projectId = hostparts[2].split('.')[0];\n }\n }\n this.projectsUrl = this.projectsUrl || `${this.base}/project`;\n }\n // Configure Role urls and role ids.\n registerItems(['role'], this.projectUrl);\n // Configure Form urls and form ids.\n if (/(^|\\/)(form)($|\\/)/.test(path)) {\n registerItems(['form', ['submission', 'action', 'v']], this.projectUrl);\n }\n else {\n const subRegEx = new RegExp('/(submission|action|v)($|/.*)');\n const subs = path.match(subRegEx);\n if (subs && subs.length > 1) {\n this.pathType = subs[1];\n }\n path = path.replace(subRegEx, '');\n path = path.replace(/\\/$/, '');\n this.formsUrl = `${this.projectUrl}/form`;\n this.formUrl = path ? this.projectUrl + path : '';\n this.formId = path.replace(/^\\/+|\\/+$/g, '');\n const items = ['submission', 'action', 'v'];\n for (const i in items) {\n if (items.hasOwnProperty(i)) {\n const item = items[i];\n this[`${item}sUrl`] = `${this.projectUrl + path}/${item}`;\n if (this.pathType === item && subs && subs.length > 2 && subs[2]) {\n this[`${item}Id`] = subs[2].replace(/^\\/+|\\/+$/g, '');\n this[`${item}Url`] = this.projectUrl + path + subs[0];\n }\n }\n }\n }\n // Set the app url if it is not set.\n if (!Formio.projectUrlSet) {\n Formio.projectUrl = this.projectUrl;\n }\n }\n /**\n * Deletes a remote resource of any provided type.\n *\n * @param {string} type - The type of resource to delete. \"submission\", \"form\", etc.\n * @param {object} options - The options passed to {@link Formio.request}\n * @return {Promise<Response>}\n */\n delete(type, opts) {\n const _id = `${type}Id`;\n const _url = `${type}Url`;\n if (!this[_id]) {\n return Promise.reject('Nothing to delete');\n }\n Formio.cache = {};\n return this.makeRequest(type, this[_url], 'delete', null, opts);\n }\n /**\n * Returns the index (array of records) for any provided type.\n *\n * @param {string} type - The type of resource to fetch the index of. \"submission\", \"form\", etc.\n * @param {object} query - A query object to pass to the request.\n * @param {object} query.params - A map (key-value pairs) of URL query parameters to add to the url.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n index(type, query, opts) {\n const _url = `${type}Url`;\n query = query || '';\n if (query && (0, lodash_1.isObject)(query)) {\n query = `?${Formio.serialize(query.params)}`;\n }\n return this.makeRequest(type, this[_url] + query, 'get', null, opts);\n }\n /**\n * Save a document record using \"upsert\". If the document does not exist, it will be created, if the _id is provided,\n * it will be updated.\n *\n * @param {string} type - The type of resource to fetch the index of. \"submission\", \"form\", etc.\n * @param {object} data - The resource data object.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n save(type, data, opts) {\n const _id = `${type}Id`;\n const _url = `${type}Url`;\n const method = this[_id] || data._id ? 'put' : 'post';\n let reqUrl = this[_id] ? this[_url] : this[`${type}sUrl`];\n if (!this[_id] && data._id && method === 'put' && !reqUrl.includes(data._id)) {\n reqUrl += `/${data._id}`;\n }\n Formio.cache = {};\n return this.makeRequest(type, reqUrl + this.query, method, data, opts);\n }\n /**\n * @summary Load (GET) a document record.\n *\n * @param {string} type - The type of resource to fetch the index of. \"submission\", \"form\", etc.\n * @param {object} query - A query object to pass to the request.\n * @param {object} query.params - A map (key-value pairs) of URL query parameters to add to the url.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n load(type, query, opts) {\n const _id = `${type}Id`;\n const _url = `${type}Url`;\n if (query && (0, lodash_1.isObject)(query)) {\n query = Formio.serialize(query.params);\n }\n if (query) {\n query = this.query ? `${this.query}&${query}` : `?${query}`;\n }\n else {\n query = this.query;\n }\n if (!this[_id]) {\n return Promise.reject(`Missing ${_id}`);\n }\n let url = this[_url] + query;\n if (type === 'form' && !isNaN(parseInt(this.vId))) {\n url += url.indexOf('?') === -1 ? '?' : '&';\n url += `formRevision=${this.vId}`;\n }\n return this.makeRequest(type, url, 'get', null, opts);\n }\n /**\n * @summary Call {@link Formio.makeRequest} for this Formio instance.\n *\n * @param {string} type - The request resource type. \"submission\", \"form\", etc.\n * @param {string} url - The URL to request.\n * @param {string} method - The request method. GET, PUT, POST, DELETE, or PATCH\n * @param {object} data - The data to pass to the request (for PUT, POST, and PATCH methods)\n * @param {object} options - An object of options to pass to the request method.\n * @param {boolean} options.ignoreCache - To ignore internal caching of the request.\n * @param {object} options.headers - An object of headers to pass along to the request.\n * @param {boolean} options.noToken - If set to true, this will not include the Form.io x-jwt-token along with the request.\n * @param {string} options.namespace - The Form.io namespace to prepend to all LocalStorage variables such as formioToken.\n * @param {boolean} options.getHeaders - Set this if you wish to include the response headers with the return of this method.\n * @return {Promise<Response>}\n */\n makeRequest(type, url, method, data, opts) {\n return Formio.makeRequest(this, type, url, method, data, opts);\n }\n /**\n * @summary Loads a project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.loadProject().then((project) => {\n * console.log(project);\n * });\n * ```\n *\n * @param {object} query - Query parameters to pass to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n loadProject(query, opts) {\n return this.load('project', query, opts);\n }\n /**\n * Saves or Updates a project.\n *\n * ### Create a new project\n * ```ts\n * const formio = new Formio();\n * formio.saveProject({\n * title: 'My Project',\n * path: 'myproject',\n * name: 'myproject'\n * });\n * ```\n *\n * ### Update an existing project\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.loadProject().then((project) => {\n * project.title = 'Title changed';\n * formio.saveProject(project).then(() => {\n * console.log('Done saving project!');\n * });\n * });\n * ```\n *\n * @param {object} data - The project JSON to create or update.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveProject(data, opts) {\n return this.save('project', data, opts);\n }\n /**\n * Deletes a project\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.deleteProject();\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n deleteProject(opts) {\n return this.delete('project', opts);\n }\n /**\n * Loads a list of all projects.\n *\n * ```ts\n * Formio.loadProjects().then((projects) => {\n * console.log(projects);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {*}\n */\n static loadProjects(query, opts) {\n query = query || '';\n if ((0, lodash_1.isObject)(query)) {\n query = `?${Formio.serialize(query.params)}`;\n }\n return Formio.makeStaticRequest(`${Formio.baseUrl}/project${query}`, 'GET', null, opts);\n }\n /**\n * Loads a role within a project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/role/234234234234');\n * formio.loadRole().then((role) => {\n * console.log(role);\n * });\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n loadRole(opts) {\n return this.load('role', null, opts);\n }\n /**\n * Create a new or Update an existing role within a project.\n *\n * ### Create new Role example\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.saveRole({\n * title: 'Employee',\n * description: 'A person who belongs to a company.'\n * }).then((role) => {\n * console.log(role);\n * });\n * ```\n *\n * ### Update existing role example\n * ```ts\n * const formio = new Formio('https://examples.form.io/role/234234234234234');\n * formio.loadRole().then((role) => {\n * role.title = 'Manager';\n * formio.saveRole(role).then(() => {\n * console.log('DONE');\n * });\n * });\n * ```\n *\n * @param {object} role - The Role JSON to create or update.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveRole(data, opts) {\n return this.save('role', data, opts);\n }\n /**\n * Deletes a role within a project.\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n deleteRole(opts) {\n return this.delete('role', opts);\n }\n /**\n * Load all roles within a project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.loadRoles().then((roles) => {\n * console.log(roles);\n * });\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n loadRoles(opts) {\n return this.index('roles', null, opts);\n }\n /**\n * Loads a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadForm().then((form) => {\n * console.log(form);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n loadForm(query, opts) {\n return this.load('form', query, opts).then((currentForm) => {\n // Check to see if there isn't a number in vId.\n if (!currentForm.revisions || isNaN(parseInt(this.vId))) {\n return currentForm;\n }\n // If a submission already exists but form is marked to load current version of form.\n if (currentForm.revisions === 'current' && this.submissionId) {\n return currentForm;\n }\n if (currentForm._vid == this.vId || currentForm.revisionId === this.vId) {\n return currentForm;\n }\n // If they specified a revision form, load the revised form components.\n if (query && (0, lodash_1.isObject)(query)) {\n query = Formio.serialize(query.params);\n }\n if (query) {\n query = this.query ? `${this.query}&${query}` : `?${query}`;\n }\n else {\n query = this.query;\n }\n return (this.makeRequest('form', this.vUrl + query, 'get', null, opts)\n .then((revisionForm) => {\n currentForm._vid = revisionForm._vid;\n currentForm.components = revisionForm.components;\n currentForm.settings = revisionForm.settings;\n currentForm.revisionId = revisionForm.revisionId;\n // Using object.assign so we don't cross polinate multiple form loads.\n return Object.assign({}, currentForm);\n })\n // If we couldn't load the revision, just return the original form.\n .catch(() => Object.assign({}, currentForm)));\n });\n }\n /**\n * Create or Update a specific form.\n *\n * ### Create form example\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.saveForm({\n * title: 'Employee',\n * type: 'resource',\n * path: 'employee',\n * name: 'employee',\n * components: [\n * {\n * type: 'textfield',\n * key: 'firstName',\n * label: 'First Name'\n * },\n * {\n * type: 'textfield',\n * key: 'lastName',\n * label: 'Last Name'\n * }\n * ]\n * });\n * ```\n *\n * ### Update a form example\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadForm().then((form) => {\n * form.title = 'Changed Title';\n * formio.saveForm(form).then(() => {\n * console.log('DONE!!!');\n * });\n * });\n * ```\n *\n * @param {object} data - The Form JSON to create or update.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveForm(data, opts) {\n return this.save('form', data, opts);\n }\n /**\n * Deletes a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.deleteForm().then(() => {\n * console.log('Deleted!');\n * });\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n deleteForm(opts) {\n return this.delete('form', opts);\n }\n /**\n * Loads all forms within a project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.loadForms().then((forms) => {\n * console.log(forms);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n loadForms(query, opts) {\n return this.index('forms', query, opts);\n }\n /**\n * Loads a specific submissionn.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/submission/23423423423423423');\n * formio.loadSubmission().then((submission) => {\n * console.log(submission);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n loadSubmission(query, opts) {\n return this.load('submission', query, opts).then((submission) => {\n this.vId = submission._frid || submission._fvid;\n this.vUrl = `${this.formUrl}/v/${this.vId}`;\n return submission;\n });\n }\n /**\n * Creates a new or Updates an existing submission.\n *\n * ### Create a new submission\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.saveSubmission({\n * data: {\n * firstName: 'Joe',\n * lastName: 'Smith'\n * }\n * }).then((submission) => {\n * // This will now be the complete submission object saved on the server.\n * console.log(submission);\n * });\n * ```\n *\n * ### Update an existing submission\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/submission/23423423423423423');\n * formio.loadSubmission().then((submission) => {\n * submission.data.lastName = 'Thompson';\n * formio.saveSubmission(submission).then(() => {\n * console.log('DONE');\n * });\n * });\n * ```\n *\n * @param {object} data - The submission JSON object.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveSubmission(data, opts) {\n if (!isNaN(parseInt(this.vId)) && !data._fvid) {\n data._fvid = this.vId;\n }\n return this.save('submission', data, opts);\n }\n /**\n * Deletes a submission.\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n deleteSubmission(opts) {\n return this.delete('submission', opts);\n }\n /**\n * Loads all submissions within a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadSubmissions({\n * params: {\n * limit: 25,\n * 'data.lastName__regex': 'smith'\n * }\n * }).then((submissions) => {\n * // Should print out 25 submissions where the last name contains \"smith\".\n * console.log(submissions);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n loadSubmissions(query, opts) {\n return this.index('submissions', query, opts);\n }\n /**\n * Loads a form action.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/action/234234234234');\n * formio.loadAction().then((action) => {\n * console.log(action);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n loadAction(query, opts) {\n return this.load('action', query, opts);\n }\n /**\n * Create a new or update an existing action.\n *\n * ### Create a new action for a form.\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.saveAction({\n * data: {\n * name: 'webhook',\n * title: 'Webhook Action',\n * method: ['create', 'update', 'delete'],\n * handler: ['after'],\n * condition: {},\n * settings: {\n * url: 'https://example.com',\n * headers: [{}],\n * block: false,\n * forwardHeaders: false\n * }\n * }\n * }).then((action) => {\n * console.log(action);\n * });\n * ```\n *\n * ### Update an action\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/action/234234234234');\n * formio.loadAction().then((action) => {\n * action.title = 'Updated title';\n * formio.saveAction(action).then(() => {\n * console.log('Done!');\n * });\n * });\n * ```\n *\n * @param {object} data - The action JSON\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Object>}\n */\n saveAction(data, opts) {\n return this.save('action', data, opts);\n }\n /**\n * Delete an action\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/action/234234234234');\n * formio.deleteAction().then(() => {\n * console.log('Action was deleted.');\n * });\n * ```\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n deleteAction(opts) {\n return this.delete('action', opts);\n }\n /**\n * Loads all actions within a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.loadActions().then((actions) => {\n * console.log(actions);\n * });\n * ```\n *\n * @param {object} query - Query parameters similar to {@link Formio#load}.\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<Response>}\n */\n loadActions(query, opts) {\n return this.index('actions', query, opts);\n }\n /**\n * Returns a list of available actions\n *\n * @return {Promise<Response>}\n */\n availableActions() {\n return this.makeRequest('availableActions', `${this.formUrl}/actions`);\n }\n /**\n * Returns the action information for a specific action, such as \"save\".\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/actions/save');\n * formio.actionInfo().then((info) => {\n * console.log(info);\n * });\n * ```\n *\n * @param {string} name - The name of the action you would like to get information for. i.e. \"save\", \"webhook\", etc.\n * @return {Promise<Response>}\n */\n actionInfo(name) {\n return this.makeRequest('actionInfo', `${this.formUrl}/actions/${name}`);\n }\n /**\n * Determine if a string ID is a valid MongoID.\n *\n * @param {string} id - The id that should be tested if it is avalid id.\n * @return {boolean} - true if it is a valid MongoId, false otherwise.\n */\n isObjectId(id) {\n const checkForHexRegExp = new RegExp('^[0-9a-fA-F]{24}$');\n return checkForHexRegExp.test(id);\n }\n /**\n * Get the project ID of project.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io');\n * formio.getProjectId().then((projectId) => {\n * console.log(projectId);\n * };\n * ```\n *\n * @return {Promise<string>}\n */\n getProjectId() {\n if (!this.projectId) {\n return Promise.resolve('');\n }\n if (this.isObjectId(this.projectId)) {\n return Promise.resolve(this.projectId);\n }\n else {\n return this.loadProject().then((project) => {\n return project._id;\n });\n }\n }\n /**\n * Get the ID of a form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example');\n * formio.getFormId().then((formId) => {\n * console.log(formId);\n * });\n * ```\n *\n * @return {Promise<string>}\n */\n getFormId() {\n if (!this.formId) {\n return Promise.resolve('');\n }\n if (this.isObjectId(this.formId)) {\n return Promise.resolve(this.formId);\n }\n else {\n return this.loadForm().then((form) => {\n return form._id;\n });\n }\n }\n /**\n * Instance method for {@link Formio.currentUser}\n *\n * @param {object} options - Options to pass to {@link Formio.request}\n * @return {Promise<object>}\n */\n currentUser(options) {\n return Formio.currentUser(this, options);\n }\n /**\n * Instance method for {@link Formio.accessInfo}\n *\n * @return {Promise<Response>}\n */\n accessInfo() {\n return Formio.accessInfo(this);\n }\n /**\n * Sets OAuth Logout URL.\n *\n * @param {string} uri - Logout URL.\n * @param {string} options.namespace - The localStorage namespace to use when retrieving tokens from storage.\n * @return {string}\n */\n oauthLogoutURI(uri, options) {\n return Formio.oauthLogoutURI(uri, Object.assign({ formio: this }, this.options, options));\n }\n /**\n * Returns the JWT token for this instance.\n *\n * @param {object} options - The following options are provided.\n * @param {string} options.namespace - The localStorage namespace to use when retrieving tokens from storage.\n * @return {string} - The JWT token for this user.\n */\n getToken(options) {\n return Formio.getToken(Object.assign({ formio: this }, this.options, options));\n }\n /**\n * Sets the JWT token for this instance.\n *\n * @param {string} token - The JWT token to set.\n * @param {object} options - The following options are provided.\n * @param {string} options.namespace - The localStorage namespace to use when retrieving tokens from storage.\n * @return {string} - The JWT token that was set.\n */\n setToken(token, options) {\n return Formio.setToken(token, Object.assign({ formio: this }, this.options, options));\n }\n /**\n * Returns a temporary authentication token for single purpose token generation.\n *\n * @param {number|string} expire - The amount of seconds to wait before this temp token expires.\n * @param {string} allowed - The allowed path string inn the format GET:/path\n * @param {object} options - The options passed to {@link Formio#getToken}\n */\n getTempToken(expire, allowed, options) {\n const token = Formio.getToken(options);\n if (!token) {\n return Promise.reject('You must be authenticated to generate a temporary auth token.');\n }\n const authUrl = Formio.authUrl || this.projectUrl;\n return this.makeRequest('tempToken', `${authUrl}/token`, 'GET', null, {\n ignoreCache: true,\n header: new Headers({\n 'x-expire': expire,\n 'x-allow': allowed,\n }),\n });\n }\n /**\n * Get a PDF download url for a submission, which will generate a new PDF of the submission. This method will first\n * fetch a temporary download token, and then append this to the download url for this form.\n *\n * ```ts\n * const formio = new Formio('https://examples.form.io/example/submission/324234234234234');\n * formio.getDownloadUrl().then((url) => {\n * console.log(url);\n * });\n * ```\n *\n * @param {object} [form] - The form JSON to fetch a download url for.\n * @return {Promise<string>} - The download url.\n */\n getDownloadUrl(form) {\n if (!this.submissionId) {\n return Promise.resolve('');\n }\n if (!form) {\n // Make sure to load the form first.\n return this.loadForm().then((_form) => {\n if (!_form) {\n return '';\n }\n return this.getDownloadUrl(_form);\n });\n }\n let apiUrl = `/project/${form.project}`;\n apiUrl += `/form/${form._id}`;\n apiUrl += `/submission/${this.submissionId}`;\n const postfix = form.submissionRevisions && form.settings.changeLog ? '/download/changelog' : '/download';\n apiUrl += postfix;\n let download = this.base + apiUrl;\n return new Promise((resolve, reject) => {\n this.getTempToken(3600, `GET:${apiUrl}`)\n .then((tempToken) => {\n download += `?token=${tempToken.key}`;\n resolve(download);\n }, () => {\n resolve(download);\n })\n .catch(reject);\n });\n }\n /**\n * Returns the user permissions to a form and submission.\n *\n * @param user - The user or current user if undefined. For anonymous, use \"null\"\n * @param form - The form or current form if undefined. For no form check, use \"null\"\n * @param submission - The submisison or \"index\" if undefined.\n *\n * @return {{create: boolean, read: boolean, edit: boolean, delete: boolean}}\n */\n userPermissions(user, form, submission) {\n return Promise.all([\n form !== undefined ? Promise.resolve(form) : this.loadForm(),\n user !== undefined ? Promise.resolve(user) : this.currentUser(),\n submission !== undefined || !this.submissionId\n ? Promise.resolve(submission)\n : this.loadSubmission(),\n this.accessInfo(),\n ]).then((results) => {\n const form = results.shift();\n const user = results.shift() || { _id: false, roles: [] };\n const submission = results.shift();\n const access = results.shift();\n const permMap = {\n create: 'create',\n read: 'read',\n update: 'edit',\n delete: 'delete',\n };\n const perms = {\n user: user,\n form: form,\n access: access,\n create: false,\n read: false,\n edit: false,\n delete: false,\n };\n for (const roleName in access.roles) {\n if (access.roles.hasOwnProperty(roleName)) {\n const role = access.roles[roleName];\n if (role.default && user._id === false) {\n // User is anonymous. Add the anonymous role.\n user.roles.push(role._id);\n }\n else if (role.admin && user.roles.indexOf(role._id) !== -1) {\n perms.create = true;\n perms.read = true;\n perms.delete = true;\n perms.edit = true;\n return perms;\n }\n }\n }\n if (form && form.submissionAccess) {\n for (let i = 0; i < form.submissionAccess.length; i++) {\n const permission = form.submissionAccess[i];\n const [perm, scope] = permission.type.split('_');\n if (['create', 'read', 'update', 'delete'].includes(perm)) {\n if ((0, lodash_1.intersection)(permission.roles, user.roles).length) {\n perms[permMap[perm]] =\n scope === 'all' || !submission || user._id === submission.owner;\n }\n }\n }\n }\n // check for Group Permissions\n if (submission) {\n // we would anyway need to loop through components for create permission, so we'll do that for all of them\n (0, formUtil_1.eachComponent)(form.components, (component, path) => {\n if (component && component.defaultPermission) {\n const value = (0, lodash_1.get)(submission.data, path);\n // make it work for single-select Group and multi-select Group\n const groups = Array.isArray(value) ? value : [value];\n groups.forEach((group) => {\n if (group &&\n group._id && // group id is present\n user.roles.indexOf(group._id) > -1 // user has group id in his roles\n ) {\n if (component.defaultPermission === 'read') {\n perms[permMap.read] = true;\n }\n if (component.defaultPermission === 'create') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n }\n if (component.defaultPermission === 'write') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n perms[permMap.update] = true;\n }\n if (component.defaultPermission === 'admin') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n perms[permMap.update] = true;\n perms[permMap.delete] = true;\n }\n }\n });\n }\n });\n }\n return perms;\n });\n }\n /**\n * `Determine if the current user can submit a form.\n * @return {*}\n */\n canSubmit() {\n return this.userPermissions().then((perms) => {\n // If there is user and they cannot create, then check anonymous user permissions.\n if (!perms.create && Formio.getUser()) {\n return this.userPermissions(null).then((anonPerms) => {\n if (anonPerms.create) {\n Formio.setUser(null);\n return true;\n }\n return false;\n });\n }\n return perms.create;\n });\n }\n getUrlParts(url) {\n return Formio.getUrlParts(url, this);\n }\n static getUrlParts(url, formio) {\n const base = formio && formio.base ? formio.base : Formio.baseUrl;\n let regex = '^(http[s]?:\\\\/\\\\/)';\n if (base && url.indexOf(base) === 0) {\n regex += `(${base.replace(/^http[s]?:\\/\\//, '')})`;\n }\n else {\n regex += '([^/]+)';\n }\n regex += '($|\\\\/.*)';\n return url.match(new RegExp(regex));\n }\n static serialize(obj, _interpolate) {\n const str = [];\n const interpolate = (item) => {\n return _interpolate ? _interpolate(item) : item;\n };\n for (const p in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, p)) {\n str.push(`${encodeURIComponent(p)}=${encodeURIComponent(interpolate(obj[p]))}`);\n }\n }\n return str.join('&');\n }\n static getRequestArgs(formio, type, url, method, data, opts) {\n method = (method || 'GET').toUpperCase();\n if (!opts || !(0, lodash_1.isObject)(opts)) {\n opts = {};\n }\n const requestArgs = {\n url,\n method,\n data: data || null,\n opts,\n };\n if (type) {\n requestArgs.type = type;\n }\n if (formio) {\n requestArgs.formio = formio;\n }\n return requestArgs;\n }\n static makeStaticRequest(url, method, data, opts) {\n const requestArgs = Formio.getRequestArgs(null, '', url, method, data, opts);\n const request = Plugins_1.default.pluginWait('preRequest', requestArgs).then(() => Plugins_1.default.pluginGet('staticRequest', requestArgs).then((result) => {\n if ((0, lodash_1.isNil)(result)) {\n return Formio.request(requestArgs.url, requestArgs.method, requestArgs.data, requestArgs.opts.header, requestArgs.opts);\n }\n return result;\n }));\n return Plugins_1.default.pluginAlter('wrapStaticRequestPromise', request, requestArgs);\n }\n /**\n * Make an API request and wrap that request with the Form.io Request plugin system. This is very similar to the\n * {Formio.request} method with a difference being that it will pass the request through the Form.io request plugin.\n *\n * @param {Formio} formio - An instance of the Formio class.\n * @param {string} type - The request resource type. \"submission\", \"form\", etc.\n * @param {string} url - The URL to request.\n * @param {string} method - The request method. GET, PUT, POST, DELETE, or PATCH\n * @param {object} data - The data to pass to the request (for PUT, POST, and PATCH methods)\n * @param {object} options - An object of options to pass to the request method.\n * @param {boolean} options.ignoreCache - To ignore internal caching of the request.\n * @param {object} options.headers - An object of headers to pass along to the request.\n * @param {boolean} options.noToken - If set to true, this will not include the Form.io x-jwt-token along with the request.\n * @param {string} options.namespace - The Form.io namespace to prepend to all LocalStorage variables such as formioToken.\n * @param {boolean} options.getHeaders - Set this if you wish to include the response headers with the return of this method.\n * @return {Promise<Response>}\n */\n static makeRequest(formio, type, url, method, data, opts) {\n if (!formio) {\n return Formio.makeStaticRequest(url, method, data, opts);\n }\n const requestArgs = Formio.getRequestArgs(formio, type, url, method, data, opts);\n requestArgs.opts = requestArgs.opts || {};\n requestArgs.opts.formio = formio;\n //for Formio requests default Accept and Content-type headers\n if (!requestArgs.opts.headers) {\n requestArgs.opts.headers = {};\n }\n requestArgs.opts.headers = (0, lodash_1.defaults)(requestArgs.opts.headers, {\n Accept: 'application/json',\n 'Content-type': 'application/json',\n });\n const request = Plugins_1.default.pluginWait('preRequest', requestArgs).then(() => Plugins_1.default.pluginGet('request', requestArgs).then((result) => {\n if ((0, lodash_1.isNil)(result)) {\n return Formio.request(requestArgs.url, requestArgs.method, requestArgs.data, requestArgs.opts.header, requestArgs.opts);\n }\n return result;\n }));\n return Plugins_1.default.pluginAlter('wrapRequestPromise', request, requestArgs);\n }\n /**\n * Execute an API request to any external system. This is a wrapper around the Web fetch method.\n *\n * ```ts\n * Formio.request('https://examples.form.io').then((form) => {\n * console.log(form);\n * });\n * ```\n *\n * @param {string} url - The URL to request.\n * @param {string} method - The request method. GET, PUT, POST, DELETE, or PATCH\n * @param {object} data - The data to pass to the request (for PUT, POST, and PATCH methods)\n * @param {Headers} header - An object of headers to pass to the request.\n * @param {object} options - An object of options to pass to the request method.\n * @param {boolean} options.ignoreCache - To ignore internal caching of the request.\n * @param {object} options.headers - An object of headers to pass along to the request.\n * @param {boolean} options.noToken - If set to true, this will not include the Form.io x-jwt-token along with the request.\n * @param {string} options.namespace - The Form.io namespace to prepend to all LocalStorage variables such as formioToken.\n * @param {boolean} options.getHeaders - Set this if you wish to include the response headers with the return of this method.\n * @return {Promise<Response>|*}\n */\n static request(url, method, data, header, opts) {\n if (!url) {\n return Promise.reject('No url provided');\n }\n method = (method || 'GET').toUpperCase();\n // For reverse compatibility, if they provided the ignoreCache parameter,\n // then change it back to the options format where that is a parameter.\n if ((0, lodash_1.isBoolean)(opts)) {\n opts = { ignoreCache: opts };\n }\n if (!opts || !(0, lodash_1.isObject)(opts)) {\n opts = {};\n }\n // Generate a cachekey.\n const cacheKey = btoa(encodeURI(url));\n // Get the cached promise to save multiple loads.\n if (!opts.ignoreCache && method === 'GET' && Formio.cache.hasOwnProperty(cacheKey)) {\n return Promise.resolve(Formio.cloneResponse(Formio.cache[cacheKey]));\n }\n if (url[0] === '/') {\n url = Formio.baseUrl + url;\n }\n // Set up and fetch request\n const headers = header ||\n new Headers(opts.headers || {\n Accept: 'application/json',\n 'Content-type': 'application/json',\n });\n const token = Formio.getToken(opts);\n if (token && !opts.noToken) {\n headers.set('x-jwt-token', token);\n }\n // The fetch-ponyfill can't handle a proper Headers class anymore. Change it back to an object.\n const headerObj = {};\n headers.forEach(function (value, name) {\n headerObj[name] = value;\n });\n let options = {\n method: method,\n headers: headerObj,\n mode: 'cors',\n };\n if (data) {\n options.body = JSON.stringify(data);\n }\n // Allow plugins to alter the options.\n options = Plugins_1.default.pluginAlter('requestOptions', options, url);\n if (options.namespace || Formio.namespace) {\n opts.namespace = options.namespace || Formio.namespace;\n }\n const requestToken = options.headers['x-jwt-token'];\n const result = Plugins_1.default.pluginAlter('wrapFetchRequestPromise', Formio.fetch(url, options), {\n url,\n method,\n data,\n opts,\n })\n .then((response) => {\n // Allow plugins to respond.\n response = Plugins_1.default.pluginAlter('requestResponse', response, Formio, data);\n if (!response.ok) {\n if (response.status === 440) {\n Formio.setToken(null, opts);\n Formio.events.emit('formio.sessionExpired', response.body || response);\n }\n else if (response.status === 401) {\n Formio.events.emit('formio.unauthorized', response.body || response);\n }\n else if (response.status === 416) {\n Formio.events.emit('formio.rangeIsNotSatisfiable', response.body || response);\n }\n else if (response.status === 504) {\n return Promise.reject(new Error('Network request failed'));\n }\n // Parse and return the error as a rejected promise to reject this promise\n return (response.headers.get('content-type').includes('application/json')\n ? response.json()\n : response.text()).then((error) => {\n return Promise.reject(error);\n });\n }\n // Handle fetch results\n const respToken = response.headers.get('x-jwt-token');\n // In some strange cases, the fetch library will return an x-jwt-token without sending\n // one to the server. This has even been debugged on the server to verify that no token\n // was introduced with the request, but the response contains a token. This is an Invalid\n // case where we do not send an x-jwt-token and get one in return for any GET request.\n let tokenIntroduced = false;\n if (method === 'GET' &&\n !requestToken &&\n respToken &&\n !opts.external &&\n !url.includes('token=') &&\n !url.includes('x-jwt-token=')) {\n console.warn('Token was introduced in request.');\n tokenIntroduced = true;\n }\n if (response.status >= 200 &&\n response.status < 300 &&\n respToken &&\n respToken !== '' &&\n !tokenIntroduced) {\n Formio.setToken(respToken, Object.assign(Object.assign({}, opts), { fromCurrent: opts.fromCurrent || !!requestToken }));\n }\n // 204 is no content. Don't try to .json() it.\n if (response.status === 204) {\n return {};\n }\n const getResult = response.headers.get('content-type').includes('application/json')\n ? response.json()\n : response.text();\n return getResult.then((result) => {\n // Add some content-range metadata to the result here\n let range = response.headers.get('content-range');\n if (range && (0, lodash_1.isObject)(result)) {\n range = range.split('/');\n if (range[0] !== '*') {\n const skipLimit = range[0].split('-');\n result.skip = Number(skipLimit[0]);\n result.limit = skipLimit[1] - skipLimit[0] + 1;\n }\n result.serverCount = range[1] === '*' ? range[1] : Number(range[1]);\n }\n if (!opts.getHeaders) {\n return result;\n }\n const headers = {};\n response.headers.forEach((item, key) => {\n headers[key] = item;\n });\n // Return the result with the headers.\n return {\n result,\n headers,\n };\n });\n })\n .then((result) => {\n if (opts.getHeaders) {\n return result;\n }\n // Cache the response.\n if (method === 'GET') {\n Formio.cache[cacheKey] = result;\n }\n return Formio.cloneResponse(result);\n })\n .catch((err) => {\n if (err === 'Bad Token' && opts.noToken !== false) {\n Formio.setToken(null, opts);\n Formio.events.emit('formio.badToken', err);\n }\n if (err.message) {\n err = new Error(`Could not connect to API server (${err.message}): ${url}`);\n err.networkError = true;\n }\n if (method === 'GET') {\n delete Formio.cache[cacheKey];\n }\n return Promise.reject(err);\n });\n return result;\n }\n // Needed to maintain reverse compatability...\n static get token() {\n return Formio.tokens.formioToken || '';\n }\n // Needed to maintain reverse compatability...\n static set token(token) {\n Formio.tokens.formioToken = token || '';\n }\n static useSessionToken(options) {\n if (typeof localStorage === 'undefined') {\n return;\n }\n const namespace = options;\n if (typeof options === 'object') {\n options = options.namespace;\n }\n const tokenName = `${namespace || Formio.namespace || 'formio'}Token`;\n const token = localStorage.getItem(tokenName);\n if (token) {\n localStorage.removeItem(tokenName);\n sessionStorage.setItem(tokenName, token);\n }\n const userName = `${namespace || Formio.namespace || 'formio'}User`;\n const user = localStorage.getItem(userName);\n if (user) {\n localStorage.removeItem(userName);\n sessionStorage.setItem(userName, user);\n }\n localStorage.setItem('useSessionToken', 'true');\n }\n /**\n * Sets the JWT in storage to be used within an application.\n *\n * @param {string} token - The JWT token to set.\n * @param {object} options - Options as follows\n * @param {string} options.namespace - The namespace to save the token within. i.e. \"formio\"\n * @param {Formio} options.formio - The Formio instance.\n * @return {Promise<object>|void}\n */\n static setToken(token = '', opts = {}) {\n token = token || '';\n opts = typeof opts === 'string' ? { namespace: opts } : opts || {};\n const tokenName = `${opts.namespace || Formio.namespace || 'formio'}Token`;\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n const storage = localStorage.getItem('useSessionToken') ? sessionStorage : localStorage;\n if (!token) {\n if (!opts.fromUser) {\n opts.fromToken = true;\n Formio.setUser(null, opts);\n }\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.removeItem(tokenName);\n }\n catch (ignoreErr) {\n browser_cookies_1.default.erase(tokenName, { path: '/' });\n }\n Formio.tokens[tokenName] = token;\n return Promise.resolve(null);\n }\n if (Formio.tokens[tokenName] !== token) {\n Formio.tokens[tokenName] = token;\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.setItem(tokenName, token);\n }\n catch (ignoreErr) {\n browser_cookies_1.default.set(tokenName, token, { path: '/' });\n }\n }\n // Return or updates the current user\n return Formio.currentUser(opts.formio, opts);\n }\n /**\n * Returns the token set within the application for the user.\n *\n * @param {object} options - The options as follows.\n * @param {string} options.namespace - The namespace of the token you wish to fetch.\n * @param {boolean} options.decode - If you would like the token returned as decoded JSON.\n * @return {*}\n */\n static getToken(options) {\n options = typeof options === 'string' ? { namespace: options } : options || {};\n const tokenName = `${options.namespace || Formio.namespace || 'formio'}Token`;\n const decodedTokenName = options.decode ? `${tokenName}Decoded` : tokenName;\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n if (Formio.tokens[decodedTokenName]) {\n return Formio.tokens[decodedTokenName];\n }\n try {\n const token = localStorage.getItem('useSessionToken')\n ? sessionStorage.getItem(tokenName)\n : localStorage.getItem(tokenName);\n Formio.tokens[tokenName] = token || '';\n if (options.decode) {\n Formio.tokens[decodedTokenName] = Formio.tokens[tokenName]\n ? (0, jwtDecode_1.jwtDecode)(Formio.tokens[tokenName])\n : {};\n return Formio.tokens[decodedTokenName];\n }\n return Formio.tokens[tokenName];\n }\n catch (ignoreError) {\n Formio.tokens[tokenName] = browser_cookies_1.default.get(tokenName);\n return '';\n }\n }\n /**\n * Sets the current user within the application cache.\n *\n * @param {object} user - JSON object of the user you wish to set.\n * @param {object} options - Options as follows\n * @param {string} options.namespace - The namespace of the tokens\n */\n static setUser(user, opts = {}) {\n const userName = `${opts.namespace || Formio.namespace || 'formio'}User`;\n const storage = localStorage.getItem('useSessionToken') ? sessionStorage : localStorage;\n if (!user) {\n if (!opts.fromToken) {\n opts.fromUser = true;\n Formio.setToken(null, opts);\n }\n // Emit an event on the cleared user.\n Formio.events.emit('formio.user', null);\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n return storage.removeItem(userName);\n }\n catch (ignoreError) {\n return browser_cookies_1.default.erase(userName, { path: '/' });\n }\n }\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.setItem(userName, JSON.stringify(user));\n }\n catch (ignoreError) {\n browser_cookies_1.default.set(userName, JSON.stringify(user), { path: '/' });\n }\n // Emit an event on the authenticated user.\n Formio.events.emit('formio.user', user);\n }\n /**\n * Returns the user JSON.\n *\n * @param {object} options - Options as follows\n * @param {string} namespace - The namespace of the tokens stored within this application.\n * @return {object} - The user object.\n */\n static getUser(options) {\n options = options || {};\n const userName = `${options.namespace || Formio.namespace || 'formio'}User`;\n try {\n return JSON.parse((localStorage.getItem('useSessionToken') ? sessionStorage : localStorage).getItem(userName) || '');\n }\n catch (ignoreError) {\n return JSON.parse(browser_cookies_1.default.get(userName));\n }\n }\n /**\n * Sets the BaseURL for the application.\n *\n * @description Every application developed using the JavaScript SDK must set both the {@link Formio.setBaseUrl} and\n * {@link Formio.setProjectUrl} methods. These two functions ensure that every URL passed into the constructor of this\n * class can determine the \"project\" context for which the application is running.\n *\n * Any Open Source server applications will set both the {@link Formio.setBaseUrl} and {@link Formio.setProjectUrl}\n * values will be the same value.\n *\n * ```ts\n * Formio.setBaseUrl('https://yourwebsite.com/forms');\n * Formio.setProjectUrl('https://yourwebsite.com/forms/project');\n *\n * // Now the Formio constructor will know what is the \"project\" and what is the form alias name. Without setBaseUrl\n * // and setProjectUrl, this would throw an error.\n *\n * const formio = new Formio('https://yourwebsite.com/forms/project/user');\n * formio.loadForm().then((form) => {\n * console.log(form);\n * });\n * ```\n *\n * @param {string} url - The URL of the Base API url.\n */\n static setBaseUrl(url) {\n Formio.baseUrl = url;\n if (!Formio.projectUrlSet) {\n Formio.projectUrl = url;\n }\n }\n /**\n * Returns the current base url described at {@link Formio.setBaseUrl}\n *\n * @return {string} - The base url of the application.\n */\n static getBaseUrl() {\n return Formio.baseUrl;\n }\n static setApiUrl(url) {\n return Formio.setBaseUrl(url);\n }\n static getApiUrl() {\n return Formio.getBaseUrl();\n }\n static setAppUrl(url) {\n console.warn('Formio.setAppUrl() is deprecated. Use Formio.setProjectUrl instead.');\n Formio.projectUrl = url;\n Formio.projectUrlSet = true;\n }\n /**\n * Sets the Project Url for the application. This is an important method that needs to be set for all applications. It\n * is documented @ {@link Formio.setBaseUrl}.\n *\n * @param {string} url - The project api url.\n */\n static setProjectUrl(url) {\n Formio.projectUrl = url;\n Formio.projectUrlSet = true;\n }\n /**\n * The Auth URL can be set to customize the authentication requests made from an application. By default, this is\n * just the same value as {@link Formio.projectUrl}\n *\n * @param {string} url - The authentication url\n */\n static setAuthUrl(url) {\n Formio.authUrl = url;\n }\n static getAppUrl() {\n console.warn('Formio.getAppUrl() is deprecated. Use Formio.getProjectUrl instead.');\n return Formio.projectUrl;\n }\n /**\n * Returns the Project url described at {@link Formio.setProjectUrl}\n *\n * @return {string|string} - The Project Url.\n */\n static getProjectUrl() {\n return Formio.projectUrl;\n }\n /**\n * Clears the runtime internal API cache.\n *\n * @description By default, the Formio class will cache all API requests in memory so that any subsequent requests\n * using GET method will return the cached results as long as the API URl is the same as what was cached previously.\n * This cache can be cleared using this method as follows.\n *\n * ```ts\n * Formio.clearCache();\n * ```\n *\n * Or, if you just wish to clear a single request, then the {@link Formio.request#options.ignoreCache} option can be\n * provided when making an API request as follows.\n *\n * ```ts\n * Formio.loadForm({}, {\n * ignoreCache: true\n * }).then((form) => {\n * console.log(form);\n * });\n * ```\n *\n * Both of the following will ensure that a new request is made to the API server and that the results will not be\n * from the cached result.\n */\n static clearCache() {\n Formio.cache = {};\n }\n /**\n * Return the access information about a Project, such as the Role ID's for that project, and if the server is\n * configured to do so, the Form and Resource access configurations that the authenticated user has access to.\n *\n * @description This is useful for an application to determine the UI for a specific user to identify which forms they have\n * access to submit or read.\n *\n * @param {Formio} formio - The Formio instance.\n * @return {Promise<Response>}\n */\n static accessInfo(formio) {\n const projectUrl = formio ? formio.projectUrl : Formio.projectUrl;\n return Formio.makeRequest(formio, 'accessInfo', `${projectUrl}/access`);\n }\n /**\n * Returns an array of roles for the project, which includes the ID's and names of those roles.\n *\n * @param {Formio} formio - The Formio instance.\n * @return {Promise<Response>}\n */\n static projectRoles(formio) {\n const projectUrl = formio ? formio.projectUrl : Formio.projectUrl;\n return Formio.makeRequest(formio, 'projectRoles', `${projectUrl}/role`);\n }\n /**\n * Return the currentUser object. This will fetch the user from the server and respond with the Submission JSON\n * of that user object.\n *\n * @param {Formio} formio - The Formio instance\n * @param {object} options - The options passed to {@link Formio.getUser}\n * @return {Promise<R>|*}\n */\n static currentUser(formio, options = {}) {\n let authUrl = Formio.authUrl;\n if (!authUrl) {\n authUrl = formio ? formio.projectUrl : Formio.projectUrl || Formio.baseUrl;\n }\n authUrl += '/current';\n if (!options.ignoreCache || options.fromCurrent) {\n const user = Formio.getUser(options);\n if (user) {\n return Plugins_1.default.pluginAlter('wrapStaticRequestPromise', Promise.resolve(user), {\n url: authUrl,\n method: 'GET',\n options,\n });\n }\n }\n const token = Formio.getToken(options);\n if ((!options || !options.external) && !token) {\n return Plugins_1.default.pluginAlter('wrapStaticRequestPromise', Promise.resolve(null), {\n url: authUrl,\n method: 'GET',\n options,\n });\n }\n options.fromCurrent = true;\n return Formio.makeRequest(formio, 'currentUser', authUrl, 'GET', null, options).then((response) => {\n Formio.setUser(response, options);\n return response;\n });\n }\n /**\n * Performs a logout of the Form.io application. This will reset all cache, as well as make a request to the logout\n * endpoint of the Form.io api platform.\n *\n * @param {Formio} formio - A Formio instance.\n * @param {object} options - Options passed to both {@link Formio.setToken} as well as {@link Formio.setUser}\n * @return {Promise<Response>}\n */\n static logout(formio, options = {}) {\n options.formio = formio;\n const projectUrl = Formio.authUrl\n ? Formio.authUrl\n : formio\n ? formio.projectUrl\n : Formio.baseUrl;\n const logout = () => {\n Formio.setToken(null, options);\n Formio.setUser(null, options);\n Formio.clearCache();\n localStorage.removeItem('useSessionToken');\n };\n return Formio.makeRequest(formio, 'logout', `${projectUrl}/logout`)\n .then(function (result) {\n logout();\n if (result.shouldRedirect && result.url) {\n window.location.href = result.url;\n }\n return result;\n })\n .catch(function (err) {\n logout();\n throw err;\n });\n }\n /**\n * Returns the query passed to a page in JSON object format.\n *\n * @description For example, lets say you visit your application using\n * the url as follows.\n *\n * ```\n * https://yourapplication.com/?token=23423423423&username=Joe\n * ```\n *\n * The following code will provide your application with the following.\n *\n * ```ts\n * const query Formio.pageQuery();\n * console.log(query.token); // Will print 23423423423\n * console.log(query.username); // Will print Joe\n * ```\n *\n * @return {{}} - A JSON object representation of the query that was passed to the URL of an application.\n */\n static pageQuery() {\n const pageQuery = {};\n pageQuery.paths = [];\n const hashes = location.hash.substr(1).replace(/\\?/g, '&').split('&');\n let parts = [];\n location.search\n .substr(1)\n .split('&')\n .forEach(function (item) {\n parts = item.split('=');\n if (parts.length > 1) {\n pageQuery[parts[0]] = parts[1] && decodeURIComponent(parts[1]);\n }\n });\n hashes.forEach(function (item) {\n parts = item.split('=');\n if (parts.length > 1) {\n pageQuery[parts[0]] = parts[1] && decodeURIComponent(parts[1]);\n }\n else if (item.indexOf('/') === 0) {\n pageQuery.paths = item.substr(1).split('/');\n }\n });\n return pageQuery;\n }\n /**\n * Much like {@link Formio.currentUser}, but instead automatically injects the Bearer tokens into the headers to\n * perform a Token swap of the OAuth token which will then return the JWT token for that user.\n *\n * @param {Formio} formio - The Formio instance\n * @param {string} token - An OAuth Bearer token to use for a token swap between the OAuth provider and Form.io\n * @return {Promise<R>|*}\n */\n static oAuthCurrentUser(formio, token) {\n return Formio.currentUser(formio, {\n external: true,\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n }\n static oauthLogoutURI(uri, options) {\n options = typeof options === 'string' ? { namespace: options } : options || {};\n const logoutURIName = `${options.namespace || Formio.namespace || 'formio'}LogoutAuthUrl`;\n localStorage.setItem(logoutURIName, uri);\n return Formio.tokens[logoutURIName];\n }\n /**\n * Perform a SAML initialization.\n *\n * @description Typically, you would use the {@link Formio.ssoInit} method to perform this function\n * since this method is an alias for the following.\n *\n * ```ts\n * Formio.samlInit();\n * Formio.ssoInit('saml'); // This is the exact same thing as calling Formio.samlInit\n * ```\n *\n * This method will return false if the process is just starting. The code below is a typical block of code that is\n * used to automatically trigger the SAML authentication process within your application using a Button component.\n *\n * ```ts\n * if (Formio.pageQuery().saml) {\n * const sso = Formio.samlInit();\n * if (sso) {\n * sso.then((user) => {\n * // The SSO user is now loaded!\n * console.log(user);\n * });\n * }\n * }\n * ```\n *\n * You can then place the following code withiin the \"Custom\" action of a Button component on your form.\n *\n * ```ts\n * Formio.samlInit();\n * ```\n *\n * Now when you click on this button, it will start the handshake process with SAML, and once it returns, will pass\n * a \"saml\" query parameter back to your application which will execute the code to load the current user from SAML.\n *\n * @param {object} options - Options to pass to the SAML initialization process.\n * @param {string} options.relay - The URL that will be used as the authentication \"relay\" that occurs during a SAML handshake process.\n * @return {boolean|Promise<Object>|void}\n */\n static samlInit(options = {}) {\n const query = Formio.pageQuery();\n if (query.saml) {\n Formio.setUser(null);\n const retVal = Formio.setToken(query.saml);\n let uri = window.location.toString();\n uri = uri.substring(0, uri.indexOf('?'));\n if (window.location.hash) {\n uri += window.location.hash;\n }\n window.history.replaceState({}, document.title, uri);\n return retVal;\n }\n // Set the relay if not provided.\n if (!options.relay) {\n options.relay = window.location.href;\n }\n // go to the saml sso endpoint for this project.\n const authUrl = Formio.authUrl || Formio.projectUrl;\n window.location.href = `${authUrl}/saml/sso?relay=${encodeURI(options.relay)}`;\n return false;\n }\n /**\n * Perform an Okta Authentication process using the {@link https://developer.okta.com/code/javascript/okta_auth_sdk|Okta SDK}.\n *\n * @description This method does require that you first include the Okta JavaScript SDK within your application as follows.\n *\n * First you need to include the Okta Authentication script.\n *\n * ```html\n * <script src=\"https://ok1static.oktacdn.com/assets/js/sdk/okta-auth-js/2.0.1/okta-auth-js.min.js\" type=\"text/javascript\"></script>\n * ```\n *\n * Then you can call this method as follows.\n *\n * ```ts\n * Formio.oktaInit();\n * ```\n *\n * @param {object} options - Options that are passed directly to the {@link https://github.com/okta/okta-auth-js#configuration-reference|Okta SDK constructor}\n * @param {constructor} options.OktaAuth - If the OktaAuth constructor is not provided global to the application, it can be provided to this method using this property.\n * @param {Formio} options.formio - The Formio instance.\n * @param {Array<string>} options.scopes - Scopes that are passed to the {@link https://github.com/okta/okta-auth-js#tokengetwithredirectoptions|getWithRedirect} method from the Okta SDK.\n * @return {Promise<Object>}\n */\n static oktaInit(options = {}) {\n if (typeof OktaAuth !== 'undefined') {\n options.OktaAuth = OktaAuth;\n }\n if (typeof options.OktaAuth === 'undefined') {\n const errorMessage = 'Cannot find OktaAuth. Please include the Okta JavaScript SDK within your application. See https://developer.okta.com/code/javascript/okta_auth_sdk for an example.';\n console.warn(errorMessage);\n return Promise.reject(errorMessage);\n }\n return new Promise((resolve, reject) => {\n const Okta = options.OktaAuth;\n delete options.OktaAuth;\n const authClient = new Okta(options);\n authClient.tokenManager\n .get('accessToken')\n .then((accessToken) => {\n if (accessToken) {\n resolve(Formio.oAuthCurrentUser(options.formio, accessToken.accessToken));\n }\n else if (location.hash) {\n authClient.token\n .parseFromUrl()\n .then((token) => {\n authClient.tokenManager.add('accessToken', token);\n resolve(Formio.oAuthCurrentUser(options.formio, token.accessToken));\n })\n .catch((err) => {\n console.warn(err);\n reject(err);\n });\n }\n else {\n authClient.token.getWithRedirect({\n responseType: 'token',\n scopes: options.scopes,\n });\n resolve(false);\n }\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n /**\n * A common static method to trigger any SSO processes. This method is really just an alias for other static methods.\n *\n * @param {('saml'|'okta')} type - The type of SSO to trigger. 'saml' is an alias for {@link Formio.samlInit}, and 'okta' is an alias for {@link Formio.oktaInit}.\n * @param {object} options - Options to pass to the specific sso methods\n * @return {*|Promise<Object>|boolean|void}\n */\n static ssoInit(type, options = {}) {\n switch (type) {\n case 'saml':\n return Formio.samlInit(options);\n case 'okta':\n return Formio.oktaInit(options);\n default:\n console.warn('Unknown SSO type');\n return Promise.reject('Unknown SSO type');\n }\n }\n /**\n * Lazy load a remote library dependency.\n *\n * @description This is useful for components that wish to lazy load a required library\n * by adding that library to the <scripts> section of the HTML webpage, and then provide a promise that will resolve\n * when the library becomes available for use.\n *\n * @example Load Google Maps API.\n * ```ts\n * Formio.requireLibrary('googleMaps', 'google.maps.Map', 'https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap', true).then(() => {\n * // Once the promise resolves, the following can now be used within your application.\n * const map = new google.maps.Map(document.getElementById(\"map\"), {...});\n * });\n * ```\n *\n * @param {string} name - The internal name to give to the library you are loading. This is useful for caching the library for later use.\n * @param {string} property - The name of the global property that will be added to the global namespace once the library has been loaded. This is used to check to see if the property exists before resolving the promise that the library is ready for use.\n * @param {string} src - The URL of the library to lazy load.\n * @param {boolean} polling - Determines if polling should be used to determine if they library is ready to use. If set to false, then it will rely on a global callback called ${name}Callback where \"name\" is the first property passed to this method. When this is called, that will indicate when the library is ready. In most cases, you will want to pass true to this parameter to initiate a polling method to check for the library availability in the global context.\n * @param {HTMLElement} rootElement - The element after which the resource would be attached (useful when requiring resources from ShadowRoot).\n * @return {Promise<object>} - A promise that will resolve when the plugin is ready to be used.\n */\n static requireLibrary(name, property, src, polling = false, onload, rootElement) {\n const resourceToDomOptions = {\n name,\n src,\n formio: Formio,\n onload,\n rootElement,\n };\n let hasResourceBeenAdded = false;\n if (!Formio.libraries.hasOwnProperty(name)) {\n Formio.libraries[name] = {};\n Formio.libraries[name].ready = new Promise((resolve, reject) => {\n Formio.libraries[name].resolve = resolve;\n Formio.libraries[name].reject = reject;\n });\n const callbackName = `${name}Callback`;\n if (!polling && !window[callbackName]) {\n window[callbackName] = () => Formio.libraries[name].resolve();\n }\n // See if the plugin already exists.\n const plugin = (0, lodash_1.get)(window, property);\n if (plugin) {\n Formio.libraries[name].resolve(plugin);\n }\n else {\n (0, utils_1.attachResourceToDom)(resourceToDomOptions);\n hasResourceBeenAdded = true;\n // if no callback is provided, then check periodically for the script.\n if (polling) {\n const interval = setInterval(() => {\n const plugin = (0, lodash_1.get)(window, property);\n if (plugin) {\n clearInterval(interval);\n Formio.libraries[name].resolve(plugin);\n }\n }, 200);\n }\n }\n }\n const lib = Formio.libraries[name];\n if (rootElement && !hasResourceBeenAdded) {\n (0, utils_1.attachResourceToDom)(resourceToDomOptions);\n }\n return onload && lib.loaded ? onload(lib.ready) : lib.ready;\n }\n /**\n * Determines if a lazy loaded library is ready to be used.\n *\n * @description Example: Let's assume that the example provided at {@link Formio.requireLibrary} was used elsewhere in your application.\n * You could now use the following within a separate place that will also resolve once the library is ready to be used.\n *\n * ```js\n * Formio.libraryReady('googleMaps').then(() => {\n * // Once the promise resolves, the following can now be used within your application.\n * const map = new google.maps.Map(document.getElementById(\"map\"), {...});\n * });\n * ```\n *\n * @param {string} name - The name of the library to check.\n * @return {Promise<object>} - A promise that will resolve when the library is ready to be used.\n */\n static libraryReady(name) {\n if (Formio.libraries.hasOwnProperty(name) && Formio.libraries[name].ready) {\n return Formio.libraries[name].ready;\n }\n return Promise.reject(`${name} library was not required.`);\n }\n /**\n * Clones the response from the API so that it cannot be mutated.\n *\n * @param response\n */\n static cloneResponse(response) {\n const copy = (0, fastCloneDeep_1.fastCloneDeep)(response);\n if (Array.isArray(response)) {\n copy.skip = response.skip;\n copy.limit = response.limit;\n copy.serverCount = response.serverCount;\n }\n return copy;\n }\n /**\n * Sets the project path type.\n *\n * @param type\n */\n static setPathType(type) {\n if (typeof type === 'string') {\n Formio.pathType = type;\n }\n }\n /**\n * Gets the project path type.\n */\n static getPathType() {\n return Formio.pathType;\n }\n}\nexports.Formio = Formio;\n/**\n * The base API url of the Form.io Platform. Example: https://api.form.io\n */\nFormio.baseUrl = 'https://api.form.io';\n/**\n * The project API url of the Form.io Project. Example: https://examples.form.io\n */\nFormio.projectUrl = '';\n/**\n * The project url to use for Authentication.\n */\nFormio.authUrl = '';\n/**\n * Set to true if the project url has been established with ```Formio.setProjectUrl()```\n */\nFormio.projectUrlSet = false;\n/**\n * The Form.io API Cache. This ensures that requests to the same API endpoint are cached.\n */\nFormio.cache = {};\n/**\n * The namespace used to save the Form.io Token's and variables within an application.\n */\nFormio.namespace = '';\n/**\n * Handles events fired within this SDK library.\n */\nFormio.events = new eventemitter3_1.default();\n/**\n * Stores all of the libraries lazy loaded with ```Formio.requireLibrary``` method.\n */\nFormio.libraries = {};\n/**\n * A direct interface to the Form.io fetch polyfill.\n */\nFormio.fetch = fetch;\n/**\n * A direct interface to the Form.io fetch Headers polyfill.\n */\nFormio.Headers = Headers;\n/**\n * All of the auth tokens for this session.\n */\nFormio.tokens = {};\n/**\n * The version of this library.\n */\nFormio.version = '---VERSION---';\n/**\n * The global options for the Formio library.\n */\nFormio.options = {};\n// Add Plugin methods.\nFormio.plugins = Plugins_1.default.plugins;\nFormio.deregisterPlugin = Plugins_1.default.deregisterPlugin;\nFormio.registerPlugin = Plugins_1.default.registerPlugin;\nFormio.getPlugin = Plugins_1.default.getPlugin;\nFormio.pluginWait = Plugins_1.default.pluginWait;\nFormio.pluginGet = Plugins_1.default.pluginGet;\nFormio.pluginAlter = Plugins_1.default.pluginAlter;\n// Adds Formio to the Plugins Interface.\nPlugins_1.default.Formio = Formio;\n\n\n//# sourceURL=webpack://Formio/./node_modules/@formio/core/lib/sdk/Formio.js?");
|
3284
3295
|
|
3285
3296
|
/***/ }),
|
3286
3297
|
|