render(): void { super.render() empty(this.el) const name = uniqueId() const active = this.model.active const labels = this.model.labels for (let i = 0; i < labels.length; i++) { const text = labels[i] const inputEl = input({type: `radio`, name: name, value: `${i}`}) inputEl.addEventListener("change", () => this.change_input()) if (this.model.disabled) inputEl.disabled = true if (i == active) inputEl.checked = true const labelEl = label({}, inputEl, text) if (this.model.inline) { labelEl.classList.add("bk-bs-radio-inline") this.el.appendChild(labelEl) } else { const divEl = div({class: "bk-bs-radio"}, labelEl) this.el.appendChild(divEl) } } }
toColumn(): Column { return { id: uniqueId(), field: this.field, name: this.title, width: this.width, formatter: this.formatter != null ? this.formatter.doFormat.bind(this.formatter) : undefined, model: this.editor, editor: this.editor.default_view, sortable: this.sortable, defaultSortAsc: this.default_sort == "ascending", } }
newIndexColumn() { return { id: uniqueId(), name: "#", field: DTINDEX_NAME, width: 40, behavior: "select", cannotTriggerInsert: true, resizable: false, selectable: false, sortable: true, cssClass: "bk-cell-index", }; }
toColumn(): { id: string, field: string, name: string, width: number, formatter: (...args: any[]) => HTMLElement, editor: Class<View>, sortable: boolean, defaultSortAsc: boolean, } { return { id: uniqueId(), field: this.field, name: this.title, width: this.width, formatter: (this.formatter != null ? this.formatter.doFormat.bind(this.formatter) : undefined), editor: this.editor.default_view, sortable: this.sortable, defaultSortAsc: this.default_sort === "ascending", }; }
render(): void { super.render() const group = div({class: ["bk-input-group", this.model.inline ? "bk-inline" : null]}) this.el.appendChild(group) const name = uniqueId() const {active, labels} = this.model for (let i = 0; i < labels.length; i++) { const radio = input({type: `radio`, name, value: `${i}`}) radio.addEventListener("change", () => this.change_active(i)) if (this.model.disabled) radio.disabled = true if (i == active) radio.checked = true const label_el = label({}, radio, span({}, labels[i])) group.appendChild(label_el) } }
render(): void { super.render() empty(this.el) const divEl = div({class: "bk-bs-btn-group"}) this.el.appendChild(divEl) const name = uniqueId() const active = this.model.active const labels = this.model.labels for (let i = 0; i < labels.length; i++) { const text = labels[i] const inputEl = input({type: `radio`, name: name, value: `${i}`, checked: i == active}) inputEl.addEventListener("change", () => this.change_input()) const labelEl = label({class: [`bk-bs-btn`, `bk-bs-btn-${this.model.button_type}`]}, inputEl, text) if (i == active) labelEl.classList.add("bk-bs-active") divEl.appendChild(labelEl) } }