UNPKG

@blinkk/selective-edit

Version:
33 lines 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RadioField = void 0; const field_1 = require("../field"); const option_1 = require("../../mixins/option"); const lit_html_1 = require("lit-html"); const dom_1 = require("../../utility/dom"); class RadioField extends (0, option_1.OptionMixin)(field_1.Field) { constructor(types, config, globalConfig, fieldType = 'checkboxMulti') { super(types, config, globalConfig, fieldType); this.config = config; } handleInput(evt) { const target = (0, dom_1.findParentByClassname)(evt.target, 'selective__options__option'); if (!target) { return; } this.currentValue = target.dataset.value; this.render(); } templateInput(editor, data) { return (0, lit_html_1.html) `${this.templateHelp(editor, data)} ${this.templateOptions(editor, data, { handleBlur: this.handleBlur.bind(this), handleInput: this.handleInput.bind(this), isMulti: false, isOptionSelected: (option) => this.currentValue === option.value, }, this.config.options)} ${this.templateErrors(editor, data)}`; } } exports.RadioField = RadioField; //# sourceMappingURL=radio.js.map