37 lines
906 B
TypeScript
37 lines
906 B
TypeScript
import type { CellRendererProps } from 'tui-grid/types/renderer';
|
|
|
|
export class ConditionButtonRenderer {
|
|
el: HTMLElement;
|
|
|
|
constructor(props: CellRendererProps) {
|
|
const { rowKey, grid } = props;
|
|
const { options } = props.columnInfo.renderer;
|
|
const data = grid.getRow(rowKey);
|
|
|
|
console.log(!data.baAnswerYn);
|
|
if (!data.baAnswerYn) {
|
|
const el = document.createElement('button');
|
|
el.className = 'ant-btn ant-btn-primary';
|
|
el.onclick = () => options?.onClick(data);
|
|
el.innerHTML = `<span>${options?.buttonName}</span>`;
|
|
this.el = el;
|
|
} else {
|
|
const el = document.createElement('span');
|
|
el.innerHTML = options?.spanName;
|
|
this.el = el;
|
|
}
|
|
}
|
|
|
|
beforeDestroy(): void {}
|
|
|
|
focused(): void {}
|
|
|
|
getElement(): Element {
|
|
return this.el;
|
|
}
|
|
|
|
mounted(parent: HTMLElement): void {}
|
|
|
|
render(props: CellRendererProps): void {}
|
|
}
|