vueJava/nuxt/constants/theme/grid/MaxLengthTextEditor.ts

28 lines
557 B
TypeScript

import type { CellEditorProps } from 'tui-grid/types/editor';
export class MaxLengthTextEditor {
el: HTMLInputElement;
constructor(props: CellEditorProps) {
const el = document.createElement('input');
el.type = 'text';
el.value = props.value as string;
el.maxLength = props.columnInfo.editor?.options?.maxlength;
el.placeholder = props.columnInfo.editor?.options?.placeholder;
this.el = el;
}
getElement() {
return this.el;
}
getValue() {
return this.el.value;
}
mounted() {
this.el.select();
}
}