@formio/js 5.1.0-dev.6065.68180ce → 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 +1 -1
- 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/WebformBuilder.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/WebformBuilder.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
@@ -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
|
|