@formio/js 5.1.0-dev.6066.c5295e7 → 5.1.0-dev.6067.676f8e2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formio.form.js +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +3 -3
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/cjs/components/address/editForm/Address.edit.display.d.ts +4 -0
- package/lib/cjs/components/address/editForm/Address.edit.display.js +1 -0
- package/lib/cjs/components/survey/Survey.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/address/editForm/Address.edit.display.d.ts +4 -0
- package/lib/mjs/components/address/editForm/Address.edit.display.js +1 -0
- package/lib/mjs/components/survey/Survey.js +1 -1
- package/package.json +1 -1
package/dist/formio.form.js
CHANGED
@@ -4941,7 +4941,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4941
4941
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
4942
4942
|
|
4943
4943
|
"use strict";
|
4944
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst Evaluator_1 = __webpack_require__(/*! ../../../../utils/Evaluator */ \"./lib/cjs/utils/Evaluator.js\");\nconst EditFormUtils = {\n sortAndFilterComponents(components) {\n return lodash_1.default.filter(lodash_1.default.sortBy(components, 'weight'), (item) => !item.ignore);\n },\n unifyComponents(objValue, srcValue) {\n if (objValue.key && srcValue.key) {\n if (objValue.skipMerge || srcValue.skipMerge) {\n return false;\n }\n if (objValue.key === srcValue.key) {\n // Create complete objects by including missing keys.\n lodash_1.default.each(objValue, (value, prop) => {\n if (objValue.overrideEditForm || !srcValue.hasOwnProperty(prop)) {\n srcValue[prop] = value;\n }\n });\n lodash_1.default.each(srcValue, (value, prop) => {\n if (srcValue.overrideEditForm || !objValue.hasOwnProperty(prop)) {\n objValue[prop] = value;\n }\n });\n if (objValue.components) {\n srcValue.components = EditFormUtils.sortAndFilterComponents(lodash_1.default.unionWith(objValue.components, srcValue.components, EditFormUtils.unifyComponents));\n }\n return true;\n }\n else {\n return false;\n }\n }\n return lodash_1.default.isEqual(objValue, srcValue);\n },\n tokenVariableDescription() {\n return '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>';\n },\n logicVariablesTable(additional) {\n additional = additional || '';\n return {\n type: 'htmlelement',\n tag: 'div',\n /* eslint-disable prefer-template */\n content: '<p>The following variables are available in all scripts.</p>' +\n '<table class=\"table table-bordered table-condensed table-striped\">' +\n additional +\n '<tr><th>form</th><td>The complete form JSON object</td></tr>' +\n '<tr><th>submission</th><td>The complete submission object.</td></tr>' +\n '<tr><th>data</th><td>The complete submission data object.</td></tr>' +\n '<tr><th>row</th><td>Contextual \"row\" data, used within DataGrid, EditGrid, and Container components</td></tr>' +\n '<tr><th>component</th><td>The current component JSON</td></tr>' +\n '<tr><th>instance</th><td>The current component instance.</td></tr>' +\n '<tr><th>value</th><td>The current value of the component.</td></tr>' +\n '<tr><th>moment</th><td>The moment.js library for date manipulation.</td></tr>' +\n '<tr><th>_</th><td>An instance of <a href=\"https://lodash.com/docs/\" target=\"_blank\" rel=\"noopener noreferrer\">Lodash</a>.</td></tr>' +\n '<tr><th>utils</th><td>An instance of the <a href=\"https://help.form.io/developers/javascript-development/javascript-utilities\" target=\"_blank\" rel=\"noopener noreferrer\">FormioUtils</a> object.</td></tr>' +\n '<tr><th>util</th><td>An alias for \"utils\".</td></tr>' +\n '</table><br/>'\n /* eslint-enable prefer-template */\n };\n },\n javaScriptValue(title, property, propertyJSON, weight, exampleHTML, exampleJSON, additionalParams = '', excludeJSONLogic) {\n const components = [\n this.logicVariablesTable(additionalParams),\n {\n type: 'panel',\n title: 'JavaScript',\n collapsible: true,\n collapsed: false,\n style: { 'margin-bottom': '10px' },\n key: `${property}-js`,\n customConditional() {\n return !Evaluator_1.Evaluator.noeval || Evaluator_1.Evaluator.protectedEval;\n },\n components: [\n {\n type: 'textarea',\n key: property,\n rows: 5,\n editor: 'ace',\n hideLabel: true,\n as: 'javascript',\n input: true\n },\n {\n type: 'htmlelement',\n tag: 'div',\n content: `<p>Enter custom javascript code.</p>${exampleHTML}`\n }\n ]\n },\n {\n type: 'panel',\n title: 'JSONLogic',\n collapsible: true,\n collapsed: true,\n key: `${property}-json`,\n components: [\n {\n type: 'htmlelement',\n tag: 'div',\n /* eslint-disable prefer-template */\n content: '<p>Execute custom logic using <a href=\"http://jsonlogic.com/\" target=\"_blank\" rel=\"noopener noreferrer\">JSONLogic</a>.</p>' +\n '<p>Full <a href=\"https://lodash.com/docs\" target=\"_blank\" rel=\"noopener noreferrer\">Lodash</a> support is provided using an \"_\" before each operation, such as <code>{\"_sum\": {var: \"data.a\"}}</code></p>' +\n exampleJSON\n /* eslint-enable prefer-template */\n },\n {\n type: 'textarea',\n key: propertyJSON,\n rows: 5,\n editor: 'ace',\n hideLabel: true,\n as: 'json',\n input: true\n }\n ]\n }\n ];\n if (excludeJSONLogic) {\n components.splice(2, 1);\n }\n return {\n type: 'panel',\n title: title,\n theme: 'default',\n collapsible: true,\n collapsed: true,\n key: `${property}Panel`,\n weight: weight,\n components\n };\n }\n};\nexports[\"default\"] = EditFormUtils;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/_classes/component/editForm/utils.js?");
|
4944
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst Evaluator_1 = __webpack_require__(/*! ../../../../utils/Evaluator */ \"./lib/cjs/utils/Evaluator.js\");\nconst EditFormUtils = {\n sortAndFilterComponents(components) {\n return lodash_1.default.filter(lodash_1.default.sortBy(components, 'weight'), (item) => !item.ignore);\n },\n unifyComponents(objValue, srcValue) {\n if (objValue.key && srcValue.key) {\n if ((objValue.skipMerge || srcValue.skipMerge) && !objValue.ignore) {\n return false;\n }\n if (objValue.key === srcValue.key) {\n // Create complete objects by including missing keys.\n lodash_1.default.each(objValue, (value, prop) => {\n if (objValue.overrideEditForm || !srcValue.hasOwnProperty(prop)) {\n srcValue[prop] = value;\n }\n });\n lodash_1.default.each(srcValue, (value, prop) => {\n if (srcValue.overrideEditForm || !objValue.hasOwnProperty(prop)) {\n objValue[prop] = value;\n }\n });\n if (objValue.components) {\n srcValue.components = EditFormUtils.sortAndFilterComponents(lodash_1.default.unionWith(objValue.components, srcValue.components, EditFormUtils.unifyComponents));\n }\n return true;\n }\n else {\n return false;\n }\n }\n return lodash_1.default.isEqual(objValue, srcValue);\n },\n tokenVariableDescription() {\n return '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>';\n },\n logicVariablesTable(additional) {\n additional = additional || '';\n return {\n type: 'htmlelement',\n tag: 'div',\n /* eslint-disable prefer-template */\n content: '<p>The following variables are available in all scripts.</p>' +\n '<table class=\"table table-bordered table-condensed table-striped\">' +\n additional +\n '<tr><th>form</th><td>The complete form JSON object</td></tr>' +\n '<tr><th>submission</th><td>The complete submission object.</td></tr>' +\n '<tr><th>data</th><td>The complete submission data object.</td></tr>' +\n '<tr><th>row</th><td>Contextual \"row\" data, used within DataGrid, EditGrid, and Container components</td></tr>' +\n '<tr><th>component</th><td>The current component JSON</td></tr>' +\n '<tr><th>instance</th><td>The current component instance.</td></tr>' +\n '<tr><th>value</th><td>The current value of the component.</td></tr>' +\n '<tr><th>moment</th><td>The moment.js library for date manipulation.</td></tr>' +\n '<tr><th>_</th><td>An instance of <a href=\"https://lodash.com/docs/\" target=\"_blank\" rel=\"noopener noreferrer\">Lodash</a>.</td></tr>' +\n '<tr><th>utils</th><td>An instance of the <a href=\"https://help.form.io/developers/javascript-development/javascript-utilities\" target=\"_blank\" rel=\"noopener noreferrer\">FormioUtils</a> object.</td></tr>' +\n '<tr><th>util</th><td>An alias for \"utils\".</td></tr>' +\n '</table><br/>'\n /* eslint-enable prefer-template */\n };\n },\n javaScriptValue(title, property, propertyJSON, weight, exampleHTML, exampleJSON, additionalParams = '', excludeJSONLogic) {\n const components = [\n this.logicVariablesTable(additionalParams),\n {\n type: 'panel',\n title: 'JavaScript',\n collapsible: true,\n collapsed: false,\n style: { 'margin-bottom': '10px' },\n key: `${property}-js`,\n customConditional() {\n return !Evaluator_1.Evaluator.noeval || Evaluator_1.Evaluator.protectedEval;\n },\n components: [\n {\n type: 'textarea',\n key: property,\n rows: 5,\n editor: 'ace',\n hideLabel: true,\n as: 'javascript',\n input: true\n },\n {\n type: 'htmlelement',\n tag: 'div',\n content: `<p>Enter custom javascript code.</p>${exampleHTML}`\n }\n ]\n },\n {\n type: 'panel',\n title: 'JSONLogic',\n collapsible: true,\n collapsed: true,\n key: `${property}-json`,\n components: [\n {\n type: 'htmlelement',\n tag: 'div',\n /* eslint-disable prefer-template */\n content: '<p>Execute custom logic using <a href=\"http://jsonlogic.com/\" target=\"_blank\" rel=\"noopener noreferrer\">JSONLogic</a>.</p>' +\n '<p>Full <a href=\"https://lodash.com/docs\" target=\"_blank\" rel=\"noopener noreferrer\">Lodash</a> support is provided using an \"_\" before each operation, such as <code>{\"_sum\": {var: \"data.a\"}}</code></p>' +\n exampleJSON\n /* eslint-enable prefer-template */\n },\n {\n type: 'textarea',\n key: propertyJSON,\n rows: 5,\n editor: 'ace',\n hideLabel: true,\n as: 'json',\n input: true\n }\n ]\n }\n ];\n if (excludeJSONLogic) {\n components.splice(2, 1);\n }\n return {\n type: 'panel',\n title: title,\n theme: 'default',\n collapsible: true,\n collapsed: true,\n key: `${property}Panel`,\n weight: weight,\n components\n };\n }\n};\nexports[\"default\"] = EditFormUtils;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/_classes/component/editForm/utils.js?");
|
4945
4945
|
|
4946
4946
|
/***/ }),
|
4947
4947
|
|
@@ -5359,7 +5359,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5359
5359
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
5360
5360
|
|
5361
5361
|
"use strict";
|
5362
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst Field_1 = __importDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/cjs/components/_classes/field/Field.js\"));\nconst utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nclass SurveyComponent extends Field_1.default {\n static schema(...extend) {\n return Field_1.default.schema({\n type: 'survey',\n label: 'Survey',\n key: 'survey',\n questions: [],\n values: []\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Survey',\n group: 'advanced',\n icon: 'list',\n weight: 110,\n documentation: '/userguide/form-building/advanced-components#survey',\n schema: SurveyComponent.schema()\n };\n }\n static get serverConditionSettings() {\n return SurveyComponent.conditionOperatorsSettings;\n }\n static get conditionOperatorsSettings() {\n return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEmpty', 'isNotEmpty'] });\n }\n static savedValueTypes(schema) {\n return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];\n }\n get defaultSchema() {\n return SurveyComponent.schema();\n }\n render() {\n return super.render(this.renderTemplate('survey'));\n }\n attach(element) {\n this.loadRefs(element, { input: 'multiple' });\n const superAttach = super.attach(element);\n this.refs.input.forEach((input) => {\n if (this.disabled) {\n input.setAttribute('disabled', 'disabled');\n }\n else {\n this.addEventListener(input, 'change', () => this.updateValue(null, {\n modified: true\n }));\n }\n });\n this.setValue(this.dataValue);\n return superAttach;\n }\n setValue(value, flags = {}) {\n if (!value) {\n return false;\n }\n lodash_1.default.each(this.component.questions, (question) => {\n lodash_1.default.each(this.refs.input, (input) => {\n if (input.name === this.getInputName(question)) {\n input.checked = (input.value === value[question.value]);\n }\n });\n });\n const changed = this.updateValue(value, flags);\n if (changed && this.isHtmlRenderMode()) {\n this.redraw();\n }\n return changed;\n }\n get emptyValue() {\n return {};\n }\n get defaultValue() {\n const defaultValue = super.defaultValue;\n //support for default values created in old formio.js versions\n if (defaultValue && !lodash_1.default.isObject(defaultValue) && this.component.values.some(value => value.value === defaultValue)) {\n const adoptedDefaultValue = {};\n this.component.questions.forEach(question => {\n adoptedDefaultValue[question.value] = defaultValue;\n });\n return adoptedDefaultValue;\n }\n return defaultValue;\n }\n getValue() {\n if (this.viewOnly || !this.refs.input || !this.refs.input.length) {\n return this.dataValue;\n }\n const value = {};\n lodash_1.default.each(this.component.questions, (question) => {\n lodash_1.default.each(this.refs.input, (input) => {\n if (input.checked && (input.name === this.getInputName(question))) {\n value[question.value] = input.value;\n return false;\n }\n });\n });\n return value;\n }\n set disabled(disabled) {\n super.disabled = disabled;\n lodash_1.default.each(this.refs.input, (input) => {\n input.disabled = true;\n });\n }\n get disabled() {\n return super.disabled;\n }\n validateRequired(setting, value) {\n if (!(0, utils_1.boolValue)(setting)) {\n return true;\n }\n return this.component.questions.reduce((result, question) => result && Boolean(value[question.value]), true);\n }\n getInputName(question) {\n return `${this.options.name}[${question.value}]`;\n }\n getValueAsString(value, options) {\n if (options === null || options === void 0 ? void 0 : options.email) {\n let result = (`\n <table border=\"1\" style=\"width:100%\">\n <thead>\n <tr>\n <th>${this.t('surveyQuestion')}</th>\n <th>${this.t('surveyQuestionValue')}</th>\n </tr>\n </thead>\n <tbody>\n `);\n lodash_1.default.forIn(value, (value, key) => {\n const question = lodash_1.default.find(this.component.questions, ['value', key]);\n const answer = lodash_1.default.find(this.component.values, ['value', value]);\n if (!question || !answer) {\n return;\n }\n result += (`\n <tr>\n <td style=\"text-align:center;padding: 5px 10px;\">${question.label}</td>\n <td style=\"text-align:center;padding: 5px 10px;\">${answer.label}</td>\n </tr>\n `);\n });\n result += '</tbody></table>';\n return result;\n }\n if (lodash_1.default.isPlainObject(value)) {\n const { values = [], questions = [] } = this.component;\n return lodash_1.default.isEmpty(value)\n ? ''\n : lodash_1.default.map(value, (v, q) => {\n const valueLabel = lodash_1.default.get(lodash_1.default.find(values, val => lodash_1.default.isEqual(val.value, v)), 'label', v);\n const questionLabel = lodash_1.default.get(lodash_1.default.find(questions, quest => lodash_1.default.isEqual(quest.value, q)), 'label', q);\n return `${questionLabel}: ${valueLabel}`;\n }).join('; ');\n }\n return super.getValueAsString(value, options);\n }\n}\nexports[\"default\"] = SurveyComponent;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/survey/Survey.js?");
|
5362
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst lodash_1 = __importDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nconst Field_1 = __importDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/cjs/components/_classes/field/Field.js\"));\nconst utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nclass SurveyComponent extends Field_1.default {\n static schema(...extend) {\n return Field_1.default.schema({\n type: 'survey',\n label: 'Survey',\n key: 'survey',\n questions: [],\n values: []\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Survey',\n group: 'advanced',\n icon: 'list',\n weight: 110,\n documentation: '/userguide/form-building/advanced-components#survey',\n schema: SurveyComponent.schema()\n };\n }\n static get serverConditionSettings() {\n return SurveyComponent.conditionOperatorsSettings;\n }\n static get conditionOperatorsSettings() {\n return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEmpty', 'isNotEmpty'] });\n }\n static savedValueTypes(schema) {\n return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];\n }\n get defaultSchema() {\n return SurveyComponent.schema();\n }\n render() {\n return super.render(this.renderTemplate('survey'));\n }\n attach(element) {\n this.loadRefs(element, { input: 'multiple' });\n const superAttach = super.attach(element);\n this.refs.input.forEach((input) => {\n if (this.disabled) {\n input.setAttribute('disabled', 'disabled');\n }\n else {\n this.addEventListener(input, 'change', () => this.updateValue(null, {\n modified: true\n }));\n }\n });\n this.setValue(this.dataValue);\n return superAttach;\n }\n setValue(value, flags = {}) {\n if (!value) {\n return false;\n }\n lodash_1.default.each(this.component.questions, (question) => {\n lodash_1.default.each(this.refs.input, (input) => {\n if (input.name === this.getInputName(question)) {\n input.checked = (input.value === value[question.value]);\n }\n });\n });\n const changed = this.updateValue(value, flags);\n if (changed && this.isHtmlRenderMode()) {\n this.redraw();\n }\n return changed;\n }\n get emptyValue() {\n return {};\n }\n get defaultValue() {\n const defaultValue = super.defaultValue;\n //support for default values created in old formio.js versions\n if (defaultValue && !lodash_1.default.isObject(defaultValue) && this.component.values.some(value => value.value === defaultValue)) {\n const adoptedDefaultValue = {};\n this.component.questions.forEach(question => {\n adoptedDefaultValue[question.value] = defaultValue;\n });\n return adoptedDefaultValue;\n }\n return defaultValue;\n }\n getValue() {\n if (this.viewOnly || !this.refs.input || !this.refs.input.length) {\n return this.dataValue;\n }\n const value = {};\n lodash_1.default.each(this.component.questions, (question) => {\n lodash_1.default.each(this.refs.input, (input) => {\n if (input.checked && (input.name === this.getInputName(question))) {\n value[question.value] = input.value;\n return false;\n }\n });\n });\n return value;\n }\n set disabled(disabled) {\n super.disabled = disabled;\n lodash_1.default.each(this.refs.input, (input) => {\n input.disabled = true;\n });\n }\n get disabled() {\n return super.disabled;\n }\n validateRequired(setting, value) {\n if (!(0, utils_1.boolValue)(setting)) {\n return true;\n }\n return this.component.questions.reduce((result, question) => result && Boolean(value[question.value]), true);\n }\n getInputName(question) {\n return `${this.options.name}[${question.value}][${this.id}]`;\n }\n getValueAsString(value, options) {\n if (options === null || options === void 0 ? void 0 : options.email) {\n let result = (`\n <table border=\"1\" style=\"width:100%\">\n <thead>\n <tr>\n <th>${this.t('surveyQuestion')}</th>\n <th>${this.t('surveyQuestionValue')}</th>\n </tr>\n </thead>\n <tbody>\n `);\n lodash_1.default.forIn(value, (value, key) => {\n const question = lodash_1.default.find(this.component.questions, ['value', key]);\n const answer = lodash_1.default.find(this.component.values, ['value', value]);\n if (!question || !answer) {\n return;\n }\n result += (`\n <tr>\n <td style=\"text-align:center;padding: 5px 10px;\">${question.label}</td>\n <td style=\"text-align:center;padding: 5px 10px;\">${answer.label}</td>\n </tr>\n `);\n });\n result += '</tbody></table>';\n return result;\n }\n if (lodash_1.default.isPlainObject(value)) {\n const { values = [], questions = [] } = this.component;\n return lodash_1.default.isEmpty(value)\n ? ''\n : lodash_1.default.map(value, (v, q) => {\n const valueLabel = lodash_1.default.get(lodash_1.default.find(values, val => lodash_1.default.isEqual(val.value, v)), 'label', v);\n const questionLabel = lodash_1.default.get(lodash_1.default.find(questions, quest => lodash_1.default.isEqual(quest.value, q)), 'label', q);\n return `${questionLabel}: ${valueLabel}`;\n }).join('; ');\n }\n return super.getValueAsString(value, options);\n }\n}\nexports[\"default\"] = SurveyComponent;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/survey/Survey.js?");
|
5363
5363
|
|
5364
5364
|
/***/ }),
|
5365
5365
|
|