@formio/js 5.0.0-dev.5594.b3f7e58 → 5.0.0-dev.5595.8e56e8f
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 +2 -2
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +9 -2
- package/lib/cjs/components/checkbox/fixtures/index.d.ts +1 -2
- package/lib/cjs/components/checkbox/fixtures/index.js +1 -3
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +5 -0
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +3 -0
- package/lib/mjs/components/checkbox/Checkbox.js +9 -2
- package/lib/mjs/components/checkbox/fixtures/index.d.ts +1 -2
- package/lib/mjs/components/checkbox/fixtures/index.js +1 -2
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +5 -0
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +3 -0
- package/package.json +1 -1
- package/lib/cjs/components/checkbox/fixtures/comp5.d.ts +0 -34
- package/lib/cjs/components/checkbox/fixtures/comp5.js +0 -55
- package/lib/mjs/components/checkbox/fixtures/comp5.d.ts +0 -34
- package/lib/mjs/components/checkbox/fixtures/comp5.js +0 -53
package/dist/formio.form.js
CHANGED
|
@@ -5535,7 +5535,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5535
5535
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5536
5536
|
|
|
5537
5537
|
"use strict";
|
|
5538
|
-
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 utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst Field_1 = __importDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/cjs/components/_classes/field/Field.js\"));\nclass CheckBoxComponent extends Field_1.default {\n static schema(...extend) {\n return Field_1.default.schema({\n type: 'checkbox',\n inputType: 'checkbox',\n label: 'Checkbox',\n key: 'checkbox',\n dataGridLabel: true,\n labelPosition: 'right',\n value: '',\n name: ''\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Checkbox',\n group: 'basic',\n icon: 'check-square',\n documentation: '/userguide/form-building/form-components#check-box',\n weight: 50,\n schema: CheckBoxComponent.schema()\n };\n }\n static get serverConditionSettings() {\n return CheckBoxComponent.conditionOperatorsSettings;\n }\n static get conditionOperatorsSettings() {\n return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEqual'], valueComponent() {\n return {\n valueType: 'boolean',\n data: {\n values: [\n { label: 'Checked', value: 'true' },\n { label: 'Not Checked', value: 'false' },\n ]\n },\n type: 'select'\n };\n } });\n }\n static savedValueTypes(schema) {\n schema = schema || {};\n const types = (0, utils_1.getComponentSavedTypes)(schema);\n if (lodash_1.default.isArray(types)) {\n return types;\n }\n if (schema.inputType === 'radio') {\n return [utils_1.componentValueTypes.string];\n }\n return [utils_1.componentValueTypes.boolean];\n }\n get defaultSchema() {\n return CheckBoxComponent.schema();\n }\n get labelClass() {\n let className = '';\n if (this.isInputComponent\n && !this.options.inputsOnly\n && this.component.validate\n && this.component.validate.required) {\n className += ' field-required';\n }\n return `${className}`;\n }\n get hasSetValue() {\n return this.hasValue();\n }\n get inputInfo() {\n const info = super.elementInfo();\n info.type = 'input';\n info.changeEvent = 'click';\n info.attr.type = this.component.inputType || 'checkbox';\n info.attr.class = 'form-check-input';\n if (this.component.name) {\n info.attr.name = `data[${this.component.name}]`;\n }\n info.attr.value = this.component.value ? this.component.value : 0;\n info.label = this.t(this.component.label, { _userInput: true });\n info.labelClass = this.labelClass;\n return info;\n }\n get labelInfo() {\n return {\n hidden: true\n };\n }\n render() {\n return super.render(this.renderTemplate('checkbox', {\n input: this.inputInfo,\n checked: this.checked,\n tooltip: this.interpolate(this.t(this.component.tooltip) || '', { _userInput: true }).replace(/(?:\\r\\n|\\r|\\n)/g, '<br />')\n }));\n }\n attach(element) {\n this.loadRefs(element, { input: 'multiple' });\n this.input = this.refs.input[0];\n if (this.refs.input) {\n this.addEventListener(this.input, this.inputInfo.changeEvent, () => this.updateValue(null, {\n modified: true\n }));\n this.addShortcut(this.input);\n }\n return super.attach(element);\n }\n detach(element) {\n if (element && this.input) {\n this.removeShortcut(this.input);\n }\n super.detach();\n }\n get emptyValue() {\n return this.component.inputType === 'radio' ? null : false;\n }\n isEmpty(value = this.dataValue) {\n return super.isEmpty(value) || value === false;\n }\n get key() {\n return this.component.name ? this.component.name : super.key;\n }\n getValueAt(index) {\n if (this.component.name) {\n return this.refs.input[index].checked ? this.component.value : '';\n }\n return !!this.refs.input[index].checked;\n }\n getValue() {\n const value = super.getValue();\n if (this.component.name) {\n return value ? this.setCheckedState(value) : this.setCheckedState(this.dataValue);\n }\n else {\n return (value === '') ? this.dataValue : !!value;\n }\n }\n get checked() {\n if (this.component.name) {\n return (this.dataValue === this.component.value);\n }\n return !!this.dataValue;\n }\n setCheckedState(value) {\n if (!this.input) {\n return;\n }\n if (this.component.name) {\n this.input.value = (value === this.component.value) ? this.component.value : 0;\n this.input.checked = (value === this.component.value) ? 1 : 0;\n }\n else if (value === 'on') {\n this.input.value = 1;\n this.input.checked = 1;\n }\n else if (value === 'off') {\n this.input.value = 0;\n this.input.checked = 0;\n }\n else if (value) {\n this.input.value = 1;\n this.input.checked = 1;\n }\n else {\n this.input.value = 0;\n this.input.checked = 0;\n }\n if (this.input.checked) {\n this.input.setAttribute('checked', true);\n }\n else {\n this.input.removeAttribute('checked');\n }\n return value;\n }\n setValue(value, flags = {}) {\n this.setCheckedState(value)
|
|
5538
|
+
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 utils_1 = __webpack_require__(/*! ../../utils/utils */ \"./lib/cjs/utils/utils.js\");\nconst Field_1 = __importDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/cjs/components/_classes/field/Field.js\"));\nclass CheckBoxComponent extends Field_1.default {\n static schema(...extend) {\n return Field_1.default.schema({\n type: 'checkbox',\n inputType: 'checkbox',\n label: 'Checkbox',\n key: 'checkbox',\n dataGridLabel: true,\n labelPosition: 'right',\n value: '',\n name: ''\n }, ...extend);\n }\n static get builderInfo() {\n return {\n title: 'Checkbox',\n group: 'basic',\n icon: 'check-square',\n documentation: '/userguide/form-building/form-components#check-box',\n weight: 50,\n schema: CheckBoxComponent.schema()\n };\n }\n static get serverConditionSettings() {\n return CheckBoxComponent.conditionOperatorsSettings;\n }\n static get conditionOperatorsSettings() {\n return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEqual'], valueComponent() {\n return {\n valueType: 'boolean',\n data: {\n values: [\n { label: 'Checked', value: 'true' },\n { label: 'Not Checked', value: 'false' },\n ]\n },\n type: 'select'\n };\n } });\n }\n static savedValueTypes(schema) {\n schema = schema || {};\n const types = (0, utils_1.getComponentSavedTypes)(schema);\n if (lodash_1.default.isArray(types)) {\n return types;\n }\n if (schema.inputType === 'radio') {\n return [utils_1.componentValueTypes.string];\n }\n return [utils_1.componentValueTypes.boolean];\n }\n get defaultSchema() {\n return CheckBoxComponent.schema();\n }\n get labelClass() {\n let className = '';\n if (this.isInputComponent\n && !this.options.inputsOnly\n && this.component.validate\n && this.component.validate.required) {\n className += ' field-required';\n }\n return `${className}`;\n }\n get hasSetValue() {\n return this.hasValue();\n }\n get inputInfo() {\n const info = super.elementInfo();\n info.type = 'input';\n info.changeEvent = 'click';\n info.attr.type = this.component.inputType || 'checkbox';\n info.attr.class = 'form-check-input';\n if (this.component.name) {\n info.attr.name = `data[${this.component.name}]`;\n }\n info.attr.value = this.component.value ? this.component.value : 0;\n info.label = this.t(this.component.label, { _userInput: true });\n info.labelClass = this.labelClass;\n return info;\n }\n get labelInfo() {\n return {\n hidden: true\n };\n }\n render() {\n return super.render(this.renderTemplate('checkbox', {\n input: this.inputInfo,\n checked: this.checked,\n tooltip: this.interpolate(this.t(this.component.tooltip) || '', { _userInput: true }).replace(/(?:\\r\\n|\\r|\\n)/g, '<br />')\n }));\n }\n attach(element) {\n this.loadRefs(element, { input: 'multiple' });\n this.input = this.refs.input[0];\n if (this.refs.input) {\n this.addEventListener(this.input, this.inputInfo.changeEvent, () => this.updateValue(null, {\n modified: true\n }));\n this.addShortcut(this.input);\n }\n return super.attach(element);\n }\n detach(element) {\n if (element && this.input) {\n this.removeShortcut(this.input);\n }\n super.detach();\n }\n get emptyValue() {\n return this.component.inputType === 'radio' ? null : false;\n }\n isEmpty(value = this.dataValue) {\n return super.isEmpty(value) || value === false;\n }\n get key() {\n return this.component.name ? this.component.name : super.key;\n }\n getValueAt(index) {\n if (this.component.name) {\n return this.refs.input[index].checked ? this.component.value : '';\n }\n return !!this.refs.input[index].checked;\n }\n getValue() {\n const value = super.getValue();\n if (this.component.name) {\n return value ? this.setCheckedState(value) : this.setCheckedState(this.dataValue);\n }\n else {\n return (value === '') ? this.dataValue : !!value;\n }\n }\n get checked() {\n if (this.component.name) {\n return (this.dataValue === this.component.value);\n }\n return !!this.dataValue;\n }\n setCheckedState(value) {\n if (!this.input) {\n return;\n }\n if (this.component.name) {\n this.input.value = (value === this.component.value) ? this.component.value : 0;\n this.input.checked = (value === this.component.value) ? 1 : 0;\n }\n else if (value === 'on') {\n this.input.value = 1;\n this.input.checked = 1;\n }\n else if (value === 'off') {\n this.input.value = 0;\n this.input.checked = 0;\n }\n else if (value) {\n this.input.value = 1;\n this.input.checked = 1;\n }\n else {\n this.input.value = 0;\n this.input.checked = 0;\n }\n if (this.input.checked) {\n this.input.setAttribute('checked', true);\n }\n else {\n this.input.removeAttribute('checked');\n }\n return value;\n }\n setValue(value, flags = {}) {\n if (this.setCheckedState(value) !== undefined ||\n (!this.input && value !== undefined && (this.visible || this.conditionallyVisible() || !this.component.clearOnHide))) {\n const changed = this.updateValue(value, flags);\n if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {\n this.redraw();\n }\n return changed;\n }\n return false;\n }\n getValueAsString(value) {\n const { name: componentName, value: componentValue } = this.component;\n const hasValue = componentName ? lodash_1.default.isEqual(value, componentValue) : value;\n if (lodash_1.default.isUndefined(value) && this.inDataTable) {\n return '';\n }\n return this.t(hasValue ? 'Yes' : 'No');\n }\n updateValue(value, flags) {\n // If this is a radio and is alredy checked, uncheck it.\n if (this.component.name && flags.modified && (this.dataValue === this.component.value)) {\n this.input.checked = 0;\n this.input.value = 0;\n this.dataValue = '';\n this.updateOnChange(flags, true);\n }\n const changed = super.updateValue(value, flags);\n // Update attributes of the input element\n if (changed && this.input) {\n if (this.input.checked) {\n this.input.setAttribute('checked', 'true');\n }\n else {\n this.input.removeAttribute('checked');\n }\n }\n return changed;\n }\n}\nexports[\"default\"] = CheckBoxComponent;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/components/checkbox/Checkbox.js?");
|
|
5539
5539
|
|
|
5540
5540
|
/***/ }),
|
|
5541
5541
|
|