UNPKG

@3mo/data-grid

Version:
52 lines (51 loc) 1.77 kB
import { __decorate } from "tslib"; import { component, html, event, property, style } from '@a11d/lit'; import { Localizer } from '@3mo/localization'; import { tooltip } from '@3mo/tooltip'; import { DataGridColumnComponent } from './DataGridColumnComponent.js'; Localizer.dictionaries.add('de', { 'Delete position': 'Position entfernen' }); /** * @element mo-data-grid-column-deletion * * @attr prevent - Prevents the deletion button from being displayed * @attr icon - The icon to display. Defaults to 'delete' * @attr tooltip - The tooltip to display. Defaults to 'Delete position' * * @i18n "Delete position" * * @fires delete */ let DataGridColumnDeletion = class DataGridColumnDeletion extends DataGridColumnComponent { constructor() { super(...arguments); this.prevent = false; this.icon = 'delete'; this.nonSortable = true; this.nonEditable = true; this.getContentTemplate = (_, data) => this.prevent ? html.nothing : html ` <mo-icon-button icon=${this.icon} ${tooltip(this.tooltip ?? t('Delete position'))} ${style({ color: 'var(--mo-color-gray)', height: '40px', display: 'flex' })} @click=${() => !data ? void 0 : this.delete.dispatch(data)} ></mo-icon-button> `; } }; __decorate([ event() ], DataGridColumnDeletion.prototype, "delete", void 0); __decorate([ property({ type: Boolean }) ], DataGridColumnDeletion.prototype, "prevent", void 0); __decorate([ property() ], DataGridColumnDeletion.prototype, "icon", void 0); __decorate([ property() ], DataGridColumnDeletion.prototype, "tooltip", void 0); DataGridColumnDeletion = __decorate([ component('mo-data-grid-column-deletion') ], DataGridColumnDeletion); export { DataGridColumnDeletion };