@3mo/data-grid
Version:
A data grid web component
34 lines (33 loc) • 1.08 kB
JavaScript
import { __decorate } from "tslib";
import { property, html, staticHtml } from '@a11d/lit';
import { DataGridColumnComponent } from '../DataGridColumnComponent.js';
/**
* @attr formatOptions - Options to pass to Date.prototype.format()
* @attr pickerHidden - Hides the date/time picker
*/
export class DataGridColumnDateTimeBase extends DataGridColumnComponent {
constructor() {
super(...arguments);
this.pickerHidden = false;
}
get formatOptionsValue() {
return this.formatOptions ?? this.constructor.defaultFormatOptions;
}
getEditContentTemplate(value, data) {
return html `
${staticHtml `
<${this.fieldTag} dense autofocus selectOnFocus
?pickerHidden=${this.pickerHidden}
.value=${value}
@change=${(e) => this.handleEdit(e.detail, data)}
></${this.fieldTag}>
`}
`;
}
}
__decorate([
property({ type: Object })
], DataGridColumnDateTimeBase.prototype, "formatOptions", void 0);
__decorate([
property({ type: Boolean })
], DataGridColumnDateTimeBase.prototype, "pickerHidden", void 0);