snice 1.13.2 → 1.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/templates/base/README.md +1 -1
- package/dist/components/accordion/snice-accordion-item.d.ts +25 -0
- package/dist/components/accordion/snice-accordion-item.js +260 -0
- package/dist/components/accordion/snice-accordion-item.js.map +1 -0
- package/dist/components/accordion/snice-accordion.d.ts +28 -0
- package/dist/components/accordion/snice-accordion.js +221 -0
- package/dist/components/accordion/snice-accordion.js.map +1 -0
- package/dist/components/accordion/snice-accordion.types.d.ts +29 -0
- package/dist/components/accordion/snice-accordion.types.js +2 -0
- package/dist/components/accordion/snice-accordion.types.js.map +1 -0
- package/dist/components/alert/snice-alert.d.ts +26 -0
- package/dist/components/alert/snice-alert.js +191 -0
- package/dist/components/alert/snice-alert.js.map +1 -0
- package/dist/components/alert/snice-alert.types.d.ts +11 -0
- package/dist/components/alert/snice-alert.types.js +2 -0
- package/dist/components/alert/snice-alert.types.js.map +1 -0
- package/dist/components/avatar/snice-avatar.d.ts +24 -0
- package/dist/components/avatar/snice-avatar.js +177 -0
- package/dist/components/avatar/snice-avatar.js.map +1 -0
- package/dist/components/avatar/snice-avatar.types.d.ts +12 -0
- package/dist/components/avatar/snice-avatar.types.js +2 -0
- package/dist/components/avatar/snice-avatar.types.js.map +1 -0
- package/dist/components/badge/snice-badge.d.ts +25 -0
- package/dist/components/badge/snice-badge.js +157 -0
- package/dist/components/badge/snice-badge.js.map +1 -0
- package/dist/components/badge/snice-badge.types.d.ts +15 -0
- package/dist/components/badge/snice-badge.types.js +2 -0
- package/dist/components/badge/snice-badge.types.js.map +1 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +27 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +212 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.types.d.ts +23 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.types.js +2 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.types.js.map +1 -0
- package/dist/components/breadcrumbs/snice-crumb.d.ts +9 -0
- package/dist/components/breadcrumbs/snice-crumb.js +50 -0
- package/dist/components/breadcrumbs/snice-crumb.js.map +1 -0
- package/dist/components/button/snice-button.d.ts +32 -0
- package/dist/components/button/snice-button.js +212 -0
- package/dist/components/button/snice-button.js.map +1 -0
- package/dist/components/button/snice-button.types.d.ts +23 -0
- package/dist/components/button/snice-button.types.js +2 -0
- package/dist/components/button/snice-button.types.js.map +1 -0
- package/dist/components/card/snice-card.d.ts +19 -0
- package/dist/components/card/snice-card.js +132 -0
- package/dist/components/card/snice-card.js.map +1 -0
- package/dist/components/card/snice-card.types.d.ts +9 -0
- package/dist/components/card/snice-card.types.js +2 -0
- package/dist/components/card/snice-card.types.js.map +1 -0
- package/dist/components/checkbox/snice-checkbox.d.ts +34 -0
- package/dist/components/checkbox/snice-checkbox.js +289 -0
- package/dist/components/checkbox/snice-checkbox.js.map +1 -0
- package/dist/components/checkbox/snice-checkbox.types.d.ts +20 -0
- package/dist/components/checkbox/snice-checkbox.types.js +2 -0
- package/dist/components/checkbox/snice-checkbox.types.js.map +1 -0
- package/dist/components/chip/snice-chip.d.ts +28 -0
- package/dist/components/chip/snice-chip.js +203 -0
- package/dist/components/chip/snice-chip.js.map +1 -0
- package/dist/components/chip/snice-chip.types.d.ts +14 -0
- package/dist/components/chip/snice-chip.types.js +2 -0
- package/dist/components/chip/snice-chip.types.js.map +1 -0
- package/dist/components/date-picker/snice-date-picker.d.ts +82 -0
- package/dist/components/date-picker/snice-date-picker.js +880 -0
- package/dist/components/date-picker/snice-date-picker.js.map +1 -0
- package/dist/components/date-picker/snice-date-picker.types.d.ts +71 -0
- package/dist/components/date-picker/snice-date-picker.types.js +2 -0
- package/dist/components/date-picker/snice-date-picker.types.js.map +1 -0
- package/dist/components/divider/snice-divider.d.ts +17 -0
- package/dist/components/divider/snice-divider.js +111 -0
- package/dist/components/divider/snice-divider.js.map +1 -0
- package/dist/components/divider/snice-divider.types.d.ts +14 -0
- package/dist/components/divider/snice-divider.types.js +2 -0
- package/dist/components/divider/snice-divider.types.js.map +1 -0
- package/dist/components/drawer/snice-drawer.d.ts +37 -0
- package/dist/components/drawer/snice-drawer.js +335 -0
- package/dist/components/drawer/snice-drawer.js.map +1 -0
- package/dist/components/drawer/snice-drawer.types.d.ts +16 -0
- package/dist/components/drawer/snice-drawer.types.js +2 -0
- package/dist/components/drawer/snice-drawer.types.js.map +1 -0
- package/dist/components/input/snice-input.d.ts +65 -0
- package/dist/components/input/snice-input.js +603 -0
- package/dist/components/input/snice-input.js.map +1 -0
- package/dist/components/input/snice-input.types.d.ts +53 -0
- package/dist/components/input/snice-input.types.js +2 -0
- package/dist/components/input/snice-input.types.js.map +1 -0
- package/dist/components/layout/snice-layout-blog.d.ts +4 -0
- package/dist/components/layout/snice-layout-blog.js +56 -0
- package/dist/components/layout/snice-layout-blog.js.map +1 -0
- package/dist/components/layout/snice-layout-card.d.ts +6 -0
- package/dist/components/layout/snice-layout-card.js +53 -0
- package/dist/components/layout/snice-layout-card.js.map +1 -0
- package/dist/components/layout/snice-layout-centered.d.ts +5 -0
- package/dist/components/layout/snice-layout-centered.js +38 -0
- package/dist/components/layout/snice-layout-centered.js.map +1 -0
- package/dist/components/layout/snice-layout-dashboard.d.ts +4 -0
- package/dist/components/layout/snice-layout-dashboard.js +53 -0
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -0
- package/dist/components/layout/snice-layout-fullscreen.d.ts +5 -0
- package/dist/components/layout/snice-layout-fullscreen.js +50 -0
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -0
- package/dist/components/layout/snice-layout-landing.d.ts +4 -0
- package/dist/components/layout/snice-layout-landing.js +55 -0
- package/dist/components/layout/snice-layout-landing.js.map +1 -0
- package/dist/components/layout/snice-layout-minimal.d.ts +4 -0
- package/dist/components/layout/snice-layout-minimal.js +27 -0
- package/dist/components/layout/snice-layout-minimal.js.map +1 -0
- package/dist/components/layout/snice-layout-sidebar.d.ts +5 -0
- package/dist/components/layout/snice-layout-sidebar.js +64 -0
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -0
- package/dist/components/layout/snice-layout-split.d.ts +6 -0
- package/dist/components/layout/snice-layout-split.js +47 -0
- package/dist/components/layout/snice-layout-split.js.map +1 -0
- package/dist/components/layout/snice-layout.d.ts +4 -0
- package/dist/components/layout/snice-layout.js +43 -0
- package/dist/components/layout/snice-layout.js.map +1 -0
- package/dist/components/layout/snice-layout.types.d.ts +3 -0
- package/dist/components/layout/snice-layout.types.js +2 -0
- package/dist/components/layout/snice-layout.types.js.map +1 -0
- package/dist/components/login/snice-login.d.ts +45 -0
- package/dist/components/login/snice-login.js +385 -0
- package/dist/components/login/snice-login.js.map +1 -0
- package/dist/components/login/snice-login.types.d.ts +31 -0
- package/dist/components/login/snice-login.types.js +2 -0
- package/dist/components/login/snice-login.types.js.map +1 -0
- package/dist/components/modal/snice-modal.d.ts +32 -0
- package/dist/components/modal/snice-modal.js +288 -0
- package/dist/components/modal/snice-modal.js.map +1 -0
- package/dist/components/modal/snice-modal.types.d.ts +18 -0
- package/dist/components/modal/snice-modal.types.js +2 -0
- package/dist/components/modal/snice-modal.types.js.map +1 -0
- package/dist/components/pagination/snice-pagination.d.ts +26 -0
- package/dist/components/pagination/snice-pagination.js +373 -0
- package/dist/components/pagination/snice-pagination.js.map +1 -0
- package/dist/components/pagination/snice-pagination.types.d.ts +18 -0
- package/dist/components/pagination/snice-pagination.types.js +2 -0
- package/dist/components/pagination/snice-pagination.types.js.map +1 -0
- package/dist/components/progress/snice-progress.d.ts +35 -0
- package/dist/components/progress/snice-progress.js +295 -0
- package/dist/components/progress/snice-progress.js.map +1 -0
- package/dist/components/progress/snice-progress.types.d.ts +18 -0
- package/dist/components/progress/snice-progress.types.js +2 -0
- package/dist/components/progress/snice-progress.types.js.map +1 -0
- package/dist/components/radio/snice-radio.d.ts +33 -0
- package/dist/components/radio/snice-radio.js +286 -0
- package/dist/components/radio/snice-radio.js.map +1 -0
- package/dist/components/radio/snice-radio.types.d.ts +19 -0
- package/dist/components/radio/snice-radio.types.js +2 -0
- package/dist/components/radio/snice-radio.types.js.map +1 -0
- package/dist/components/select/snice-option.d.ts +17 -0
- package/dist/components/select/snice-option.js +77 -0
- package/dist/components/select/snice-option.js.map +1 -0
- package/dist/components/select/snice-option.types.d.ts +14 -0
- package/dist/components/select/snice-option.types.js +2 -0
- package/dist/components/select/snice-option.types.js.map +1 -0
- package/dist/components/select/snice-select.d.ts +89 -0
- package/dist/components/select/snice-select.js +900 -0
- package/dist/components/select/snice-select.js.map +1 -0
- package/dist/components/select/snice-select.types.d.ts +49 -0
- package/dist/components/select/snice-select.types.js +2 -0
- package/dist/components/select/snice-select.types.js.map +1 -0
- package/dist/components/skeleton/snice-skeleton.d.ts +16 -0
- package/dist/components/skeleton/snice-skeleton.js +159 -0
- package/dist/components/skeleton/snice-skeleton.js.map +1 -0
- package/dist/components/skeleton/snice-skeleton.types.d.ts +10 -0
- package/dist/components/skeleton/snice-skeleton.types.js +2 -0
- package/dist/components/skeleton/snice-skeleton.types.js.map +1 -0
- package/dist/components/switch/snice-switch.d.ts +38 -0
- package/dist/components/switch/snice-switch.js +309 -0
- package/dist/components/switch/snice-switch.js.map +1 -0
- package/dist/components/switch/snice-switch.types.d.ts +21 -0
- package/dist/components/switch/snice-switch.types.js +2 -0
- package/dist/components/switch/snice-switch.types.js.map +1 -0
- package/dist/components/symbols.d.ts +1 -0
- package/dist/components/symbols.js +20 -0
- package/dist/components/symbols.js.map +1 -0
- package/dist/components/table/snice-cell-boolean.d.ts +21 -0
- package/dist/components/table/snice-cell-boolean.js +152 -0
- package/dist/components/table/snice-cell-boolean.js.map +1 -0
- package/dist/components/table/snice-cell-date.d.ts +24 -0
- package/dist/components/table/snice-cell-date.js +240 -0
- package/dist/components/table/snice-cell-date.js.map +1 -0
- package/dist/components/table/snice-cell-duration.d.ts +16 -0
- package/dist/components/table/snice-cell-duration.js +123 -0
- package/dist/components/table/snice-cell-duration.js.map +1 -0
- package/dist/components/table/snice-cell-filesize.d.ts +16 -0
- package/dist/components/table/snice-cell-filesize.js +119 -0
- package/dist/components/table/snice-cell-filesize.js.map +1 -0
- package/dist/components/table/snice-cell-number.d.ts +23 -0
- package/dist/components/table/snice-cell-number.js +202 -0
- package/dist/components/table/snice-cell-number.js.map +1 -0
- package/dist/components/table/snice-cell-progress.d.ts +17 -0
- package/dist/components/table/snice-cell-progress.js +114 -0
- package/dist/components/table/snice-cell-progress.js.map +1 -0
- package/dist/components/table/snice-cell-rating.d.ts +17 -0
- package/dist/components/table/snice-cell-rating.js +113 -0
- package/dist/components/table/snice-cell-rating.js.map +1 -0
- package/dist/components/table/snice-cell-sparkline.d.ts +29 -0
- package/dist/components/table/snice-cell-sparkline.js +290 -0
- package/dist/components/table/snice-cell-sparkline.js.map +1 -0
- package/dist/components/table/snice-cell-text.d.ts +19 -0
- package/dist/components/table/snice-cell-text.js +153 -0
- package/dist/components/table/snice-cell-text.js.map +1 -0
- package/dist/components/table/snice-cell.d.ts +32 -0
- package/dist/components/table/snice-cell.js +451 -0
- package/dist/components/table/snice-cell.js.map +1 -0
- package/dist/components/table/snice-column.d.ts +62 -0
- package/dist/components/table/snice-column.js +440 -0
- package/dist/components/table/snice-column.js.map +1 -0
- package/dist/components/table/snice-header.d.ts +33 -0
- package/dist/components/table/snice-header.js +303 -0
- package/dist/components/table/snice-header.js.map +1 -0
- package/dist/components/table/snice-progress.d.ts +10 -0
- package/dist/components/table/snice-progress.js +91 -0
- package/dist/components/table/snice-progress.js.map +1 -0
- package/dist/components/table/snice-rating.d.ts +9 -0
- package/dist/components/table/snice-rating.js +68 -0
- package/dist/components/table/snice-rating.js.map +1 -0
- package/dist/components/table/snice-row.d.ts +43 -0
- package/dist/components/table/snice-row.js +365 -0
- package/dist/components/table/snice-row.js.map +1 -0
- package/dist/components/table/snice-table.d.ts +69 -0
- package/dist/components/table/snice-table.js +814 -0
- package/dist/components/table/snice-table.js.map +1 -0
- package/dist/components/table/snice-table.types.d.ts +137 -0
- package/dist/components/table/snice-table.types.js +2 -0
- package/dist/components/table/snice-table.types.js.map +1 -0
- package/dist/components/tabs/snice-tab-panel.d.ts +12 -0
- package/dist/components/tabs/snice-tab-panel.js +78 -0
- package/dist/components/tabs/snice-tab-panel.js.map +1 -0
- package/dist/components/tabs/snice-tab.d.ts +13 -0
- package/dist/components/tabs/snice-tab.js +90 -0
- package/dist/components/tabs/snice-tab.js.map +1 -0
- package/dist/components/tabs/snice-tabs.d.ts +34 -0
- package/dist/components/tabs/snice-tabs.js +367 -0
- package/dist/components/tabs/snice-tabs.js.map +1 -0
- package/dist/components/tabs/snice-tabs.types.d.ts +23 -0
- package/dist/components/tabs/snice-tabs.types.js +2 -0
- package/dist/components/tabs/snice-tabs.types.js.map +1 -0
- package/dist/components/toast/snice-toast-container.d.ts +25 -0
- package/dist/components/toast/snice-toast-container.js +251 -0
- package/dist/components/toast/snice-toast-container.js.map +1 -0
- package/dist/components/toast/snice-toast.d.ts +23 -0
- package/dist/components/toast/snice-toast.js +316 -0
- package/dist/components/toast/snice-toast.js.map +1 -0
- package/dist/components/toast/snice-toast.types.d.ts +30 -0
- package/dist/components/toast/snice-toast.types.js +2 -0
- package/dist/components/toast/snice-toast.types.js.map +1 -0
- package/dist/components/tooltip/snice-tooltip.d.ts +50 -0
- package/dist/components/tooltip/snice-tooltip.js +656 -0
- package/dist/components/tooltip/snice-tooltip.js.map +1 -0
- package/dist/components/tooltip/snice-tooltip.types.d.ts +18 -0
- package/dist/components/tooltip/snice-tooltip.types.js +2 -0
- package/dist/components/tooltip/snice-tooltip.types.js.map +1 -0
- package/dist/components/transitions.d.ts +11 -0
- package/dist/components/transitions.js +69 -0
- package/dist/components/transitions.js.map +1 -0
- package/dist/src/controller.d.ts +61 -0
- package/dist/src/controller.js +297 -0
- package/dist/src/controller.js.map +1 -0
- package/dist/src/element.d.ts +77 -0
- package/dist/src/element.js +805 -0
- package/dist/src/element.js.map +1 -0
- package/dist/src/events.d.ts +37 -0
- package/dist/src/events.js +289 -0
- package/dist/src/events.js.map +1 -0
- package/dist/src/global.d.ts +7 -0
- package/dist/src/global.js +23 -0
- package/dist/src/global.js.map +1 -0
- package/{src/index.ts → dist/src/index.d.ts} +1 -1
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/observe.d.ts +26 -0
- package/dist/src/observe.js +329 -0
- package/dist/src/observe.js.map +1 -0
- package/dist/src/request-response.d.ts +46 -0
- package/dist/src/request-response.js +267 -0
- package/dist/src/request-response.js.map +1 -0
- package/dist/src/router.d.ts +87 -0
- package/dist/src/router.js +375 -0
- package/dist/src/router.js.map +1 -0
- package/dist/src/symbols.d.ts +29 -0
- package/{src/symbols.ts → dist/src/symbols.js} +2 -12
- package/dist/src/symbols.js.map +1 -0
- package/dist/src/transitions.d.ts +50 -0
- package/dist/src/transitions.js +199 -0
- package/dist/src/transitions.js.map +1 -0
- package/package.json +6 -8
- package/src/controller.ts +0 -347
- package/src/element.ts +0 -897
- package/src/events.ts +0 -349
- package/src/global.ts +0 -31
- package/src/observe.ts +0 -414
- package/src/request-response.ts +0 -336
- package/src/router.ts +0 -552
- package/src/transitions.ts +0 -264
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { element, property, on, watch, ready, dispatch } from '../../src/index';
|
|
11
|
+
let SniceHeader = class SniceHeader extends HTMLElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.sticky = false;
|
|
15
|
+
this.columns = [];
|
|
16
|
+
this.selectable = false;
|
|
17
|
+
this.sortable = false;
|
|
18
|
+
this.currentSort = { column: '', direction: null };
|
|
19
|
+
this.allSelected = false;
|
|
20
|
+
this.someSelected = false;
|
|
21
|
+
}
|
|
22
|
+
html() {
|
|
23
|
+
return `
|
|
24
|
+
<div class="header-container" part="container">
|
|
25
|
+
${this.selectable ? this.renderSelectAllCheckbox() : ''}
|
|
26
|
+
${this.renderHeaderCells()}
|
|
27
|
+
</div>
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
init() {
|
|
31
|
+
this.updateHeaderAttributes();
|
|
32
|
+
}
|
|
33
|
+
updateHeaderAttributes() {
|
|
34
|
+
this.classList.toggle('header--sticky', this.sticky);
|
|
35
|
+
this.classList.toggle('header--selectable', this.selectable);
|
|
36
|
+
this.classList.toggle('header--sortable', this.sortable);
|
|
37
|
+
}
|
|
38
|
+
updateHeaderCells() {
|
|
39
|
+
const cellsContainer = this.shadowRoot?.querySelector('.cells-container');
|
|
40
|
+
if (cellsContainer) {
|
|
41
|
+
cellsContainer.innerHTML = this.renderHeaderCells();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
updateSelectAllCheckbox() {
|
|
45
|
+
const checkbox = this.shadowRoot?.querySelector('.select-all-checkbox');
|
|
46
|
+
if (checkbox) {
|
|
47
|
+
checkbox.checked = this.allSelected;
|
|
48
|
+
checkbox.indeterminate = this.someSelected && !this.allSelected;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
handleSort(e) {
|
|
52
|
+
const cell = e.currentTarget;
|
|
53
|
+
const columnKey = cell.dataset.columnKey;
|
|
54
|
+
if (columnKey && this.sortable) {
|
|
55
|
+
this.dispatchSort(columnKey);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
handleSelectAll(e) {
|
|
59
|
+
const checkbox = e.target;
|
|
60
|
+
this.dispatchSelectAll(checkbox.checked);
|
|
61
|
+
}
|
|
62
|
+
handleKeyDown(e) {
|
|
63
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
const cell = e.currentTarget;
|
|
66
|
+
const columnKey = cell.dataset.columnKey;
|
|
67
|
+
if (columnKey && this.sortable) {
|
|
68
|
+
this.dispatchSort(columnKey);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
renderSelectAllCheckbox() {
|
|
73
|
+
return `
|
|
74
|
+
<div class="header-cell header-cell--checkbox" part="checkbox-cell">
|
|
75
|
+
<input
|
|
76
|
+
type="checkbox"
|
|
77
|
+
class="select-all-checkbox"
|
|
78
|
+
${this.allSelected ? 'checked' : ''}
|
|
79
|
+
title="Select all rows"
|
|
80
|
+
tabindex="0"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
renderHeaderCells() {
|
|
86
|
+
if (!this.columns.length) {
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
return `
|
|
90
|
+
<div class="cells-container">
|
|
91
|
+
${this.columns.map((column, index) => this.renderHeaderCell(column, index)).join('')}
|
|
92
|
+
</div>
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
renderHeaderCell(column, index) {
|
|
96
|
+
const isSortable = this.sortable && column.sortable !== false;
|
|
97
|
+
const isCurrentSort = this.currentSort.column === column.key;
|
|
98
|
+
const sortDirection = isCurrentSort ? this.currentSort.direction : null;
|
|
99
|
+
return `
|
|
100
|
+
<div
|
|
101
|
+
class="header-cell header-cell--${column.type || 'text'}"
|
|
102
|
+
part="cell"
|
|
103
|
+
data-column-key="${column.key}"
|
|
104
|
+
data-column-index="${index}"
|
|
105
|
+
data-sortable="${isSortable}"
|
|
106
|
+
style="${this.getHeaderCellStyles(column)}"
|
|
107
|
+
${isSortable ? 'role="button" tabindex="0"' : ''}
|
|
108
|
+
${isSortable ? `aria-label="Sort by ${column.label}"` : ''}
|
|
109
|
+
${isCurrentSort ? `aria-sort="${this.getAriaSortValue(sortDirection)}"` : ''}
|
|
110
|
+
>
|
|
111
|
+
<div class="header-cell-content">
|
|
112
|
+
<span class="header-cell-label">${column.label}</span>
|
|
113
|
+
${isSortable ? this.renderSortIndicator(sortDirection) : ''}
|
|
114
|
+
</div>
|
|
115
|
+
${column.filterable ? this.renderFilterButton(column) : ''}
|
|
116
|
+
</div>
|
|
117
|
+
`;
|
|
118
|
+
}
|
|
119
|
+
renderSortIndicator(direction) {
|
|
120
|
+
const ascIcon = '▲';
|
|
121
|
+
const descIcon = '▼';
|
|
122
|
+
const neutralIcon = '⇅';
|
|
123
|
+
let icon = neutralIcon;
|
|
124
|
+
let state = 'neutral';
|
|
125
|
+
if (direction === 'asc') {
|
|
126
|
+
icon = ascIcon;
|
|
127
|
+
state = 'ascending';
|
|
128
|
+
}
|
|
129
|
+
else if (direction === 'desc') {
|
|
130
|
+
icon = descIcon;
|
|
131
|
+
state = 'descending';
|
|
132
|
+
}
|
|
133
|
+
return `
|
|
134
|
+
<span
|
|
135
|
+
class="sort-indicator sort-indicator--${state}"
|
|
136
|
+
part="sort-indicator"
|
|
137
|
+
aria-hidden="true"
|
|
138
|
+
>${icon}</span>
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
renderFilterButton(column) {
|
|
142
|
+
return `
|
|
143
|
+
<button
|
|
144
|
+
class="filter-button"
|
|
145
|
+
part="filter-button"
|
|
146
|
+
data-column-key="${column.key}"
|
|
147
|
+
title="Filter ${column.label}"
|
|
148
|
+
tabindex="-1"
|
|
149
|
+
>
|
|
150
|
+
🔽
|
|
151
|
+
</button>
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
154
|
+
getHeaderCellStyles(column) {
|
|
155
|
+
let styles = [];
|
|
156
|
+
if (column.width) {
|
|
157
|
+
styles.push(`width: ${column.width}`);
|
|
158
|
+
styles.push(`min-width: ${column.width}`);
|
|
159
|
+
styles.push(`max-width: ${column.width}`);
|
|
160
|
+
}
|
|
161
|
+
if (column.align) {
|
|
162
|
+
styles.push(`text-align: ${column.align}`);
|
|
163
|
+
}
|
|
164
|
+
return styles.join('; ');
|
|
165
|
+
}
|
|
166
|
+
getAriaSortValue(direction) {
|
|
167
|
+
switch (direction) {
|
|
168
|
+
case 'asc':
|
|
169
|
+
return 'ascending';
|
|
170
|
+
case 'desc':
|
|
171
|
+
return 'descending';
|
|
172
|
+
default:
|
|
173
|
+
return 'none';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
dispatchSort(columnKey) {
|
|
177
|
+
return { column: columnKey };
|
|
178
|
+
}
|
|
179
|
+
dispatchSelectAll(checked) {
|
|
180
|
+
return { checked };
|
|
181
|
+
}
|
|
182
|
+
dispatchFilter(columnKey) {
|
|
183
|
+
return { column: columnKey };
|
|
184
|
+
}
|
|
185
|
+
// Public API methods
|
|
186
|
+
setSortState(column, direction) {
|
|
187
|
+
this.currentSort = { column, direction };
|
|
188
|
+
}
|
|
189
|
+
setSelectionState(allSelected, someSelected = false) {
|
|
190
|
+
this.allSelected = allSelected;
|
|
191
|
+
this.someSelected = someSelected && !allSelected;
|
|
192
|
+
}
|
|
193
|
+
getColumnElement(columnKey) {
|
|
194
|
+
return this.shadowRoot?.querySelector(`[data-column-key="${columnKey}"]`) || null;
|
|
195
|
+
}
|
|
196
|
+
// Method to update column definitions
|
|
197
|
+
updateColumns(columns) {
|
|
198
|
+
this.columns = columns;
|
|
199
|
+
}
|
|
200
|
+
// Method to highlight a column temporarily
|
|
201
|
+
highlightColumn(columnKey, duration = 2000) {
|
|
202
|
+
const columnElement = this.getColumnElement(columnKey);
|
|
203
|
+
if (columnElement) {
|
|
204
|
+
columnElement.classList.add('header-cell--highlighted');
|
|
205
|
+
setTimeout(() => {
|
|
206
|
+
columnElement.classList.remove('header-cell--highlighted');
|
|
207
|
+
}, duration);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ type: Boolean, reflect: true }),
|
|
213
|
+
__metadata("design:type", Boolean)
|
|
214
|
+
], SniceHeader.prototype, "sticky", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property({ type: Array }),
|
|
217
|
+
__metadata("design:type", Array)
|
|
218
|
+
], SniceHeader.prototype, "columns", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
property({ type: Boolean, reflect: true }),
|
|
221
|
+
__metadata("design:type", Boolean)
|
|
222
|
+
], SniceHeader.prototype, "selectable", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ type: Boolean, reflect: true }),
|
|
225
|
+
__metadata("design:type", Boolean)
|
|
226
|
+
], SniceHeader.prototype, "sortable", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
property({ type: Object }),
|
|
229
|
+
__metadata("design:type", Object)
|
|
230
|
+
], SniceHeader.prototype, "currentSort", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
property({ type: Boolean, reflect: true, attribute: 'all-selected' }),
|
|
233
|
+
__metadata("design:type", Boolean)
|
|
234
|
+
], SniceHeader.prototype, "allSelected", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
property({ type: Boolean, reflect: true, attribute: 'some-selected' }),
|
|
237
|
+
__metadata("design:type", Boolean)
|
|
238
|
+
], SniceHeader.prototype, "someSelected", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
ready(),
|
|
241
|
+
__metadata("design:type", Function),
|
|
242
|
+
__metadata("design:paramtypes", []),
|
|
243
|
+
__metadata("design:returntype", void 0)
|
|
244
|
+
], SniceHeader.prototype, "init", null);
|
|
245
|
+
__decorate([
|
|
246
|
+
watch('sticky', 'selectable', 'sortable'),
|
|
247
|
+
__metadata("design:type", Function),
|
|
248
|
+
__metadata("design:paramtypes", []),
|
|
249
|
+
__metadata("design:returntype", void 0)
|
|
250
|
+
], SniceHeader.prototype, "updateHeaderAttributes", null);
|
|
251
|
+
__decorate([
|
|
252
|
+
watch('columns', 'currentSort'),
|
|
253
|
+
__metadata("design:type", Function),
|
|
254
|
+
__metadata("design:paramtypes", []),
|
|
255
|
+
__metadata("design:returntype", void 0)
|
|
256
|
+
], SniceHeader.prototype, "updateHeaderCells", null);
|
|
257
|
+
__decorate([
|
|
258
|
+
watch('allSelected', 'someSelected'),
|
|
259
|
+
__metadata("design:type", Function),
|
|
260
|
+
__metadata("design:paramtypes", []),
|
|
261
|
+
__metadata("design:returntype", void 0)
|
|
262
|
+
], SniceHeader.prototype, "updateSelectAllCheckbox", null);
|
|
263
|
+
__decorate([
|
|
264
|
+
on('click', '.header-cell[data-sortable="true"]'),
|
|
265
|
+
__metadata("design:type", Function),
|
|
266
|
+
__metadata("design:paramtypes", [MouseEvent]),
|
|
267
|
+
__metadata("design:returntype", void 0)
|
|
268
|
+
], SniceHeader.prototype, "handleSort", null);
|
|
269
|
+
__decorate([
|
|
270
|
+
on('change', '.select-all-checkbox'),
|
|
271
|
+
__metadata("design:type", Function),
|
|
272
|
+
__metadata("design:paramtypes", [Event]),
|
|
273
|
+
__metadata("design:returntype", void 0)
|
|
274
|
+
], SniceHeader.prototype, "handleSelectAll", null);
|
|
275
|
+
__decorate([
|
|
276
|
+
on('keydown', '.header-cell[data-sortable="true"]'),
|
|
277
|
+
__metadata("design:type", Function),
|
|
278
|
+
__metadata("design:paramtypes", [KeyboardEvent]),
|
|
279
|
+
__metadata("design:returntype", void 0)
|
|
280
|
+
], SniceHeader.prototype, "handleKeyDown", null);
|
|
281
|
+
__decorate([
|
|
282
|
+
dispatch('@snice/header-sort', { bubbles: true, composed: true }),
|
|
283
|
+
__metadata("design:type", Function),
|
|
284
|
+
__metadata("design:paramtypes", [String]),
|
|
285
|
+
__metadata("design:returntype", void 0)
|
|
286
|
+
], SniceHeader.prototype, "dispatchSort", null);
|
|
287
|
+
__decorate([
|
|
288
|
+
dispatch('@snice/header-select-all', { bubbles: true, composed: true }),
|
|
289
|
+
__metadata("design:type", Function),
|
|
290
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
291
|
+
__metadata("design:returntype", void 0)
|
|
292
|
+
], SniceHeader.prototype, "dispatchSelectAll", null);
|
|
293
|
+
__decorate([
|
|
294
|
+
dispatch('@snice/header-filter', { bubbles: true, composed: true }),
|
|
295
|
+
__metadata("design:type", Function),
|
|
296
|
+
__metadata("design:paramtypes", [String]),
|
|
297
|
+
__metadata("design:returntype", void 0)
|
|
298
|
+
], SniceHeader.prototype, "dispatchFilter", null);
|
|
299
|
+
SniceHeader = __decorate([
|
|
300
|
+
element('snice-header')
|
|
301
|
+
], SniceHeader);
|
|
302
|
+
export { SniceHeader };
|
|
303
|
+
//# sourceMappingURL=snice-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snice-header.js","sourceRoot":"","sources":["../../../components/table/snice-header.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AASzE,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,WAAW;IAArC;;QAEL,WAAM,GAAY,KAAK,CAAC;QAGxB,YAAO,GAAuB,EAAE,CAAC;QAGjC,eAAU,GAAY,KAAK,CAAC;QAG5B,aAAQ,GAAY,KAAK,CAAC;QAG1B,gBAAW,GAAc,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAGzD,gBAAW,GAAY,KAAK,CAAC;QAG7B,iBAAY,GAAY,KAAK,CAAC;IAuOhC,CAAC;IArOC,IAAI;QACF,OAAO;;UAED,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M,EAAE,CAAC;;gDAC8B;AAGzD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;;gDACzC;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;;iDACzC;AAY9B;IADC,KAAK,EAAE;;;;uCAGP;AAGD;IADC,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAC;;;;yDAKzC;AAGD;IADC,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC;;;;oDAM/B;AAGD;IADC,KAAK,CAAC,aAAa,EAAE,cAAc,CAAC;;;;0DAOpC;AAGD;IADC,EAAE,CAAC,OAAO,EAAE,oCAAoC,CAAC;;qCACpC,UAAU;;6CAOvB;AAGD;IADC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,CAAC;;qCAClB,KAAK;;kDAGvB;AAGD;IADC,EAAE,CAAC,SAAS,EAAE,oCAAoC,CAAC;;qCACnC,aAAa;;gDAU7B;AAyHO;IADP,QAAQ,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;;;+CAGjE;AAGO;IADP,QAAQ,CAAC,0BAA0B,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;;;oDAGvE;AAGO;IADP,QAAQ,CAAC,sBAAsB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;;;iDAGnE;AA5NU,WAAW;IADvB,OAAO,CAAC,cAAc,CAAC;GACX,WAAW,CA2PvB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { element, property } from '../../src/index';
|
|
11
|
+
let SniceProgress = class SniceProgress extends HTMLElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.value = 0;
|
|
15
|
+
this.max = 100;
|
|
16
|
+
this.color = '#3b82f6';
|
|
17
|
+
this.backgroundColor = '#e5e7eb';
|
|
18
|
+
this.height = '0.5rem'; /* 8px */
|
|
19
|
+
this.showPercentage = false;
|
|
20
|
+
}
|
|
21
|
+
html() {
|
|
22
|
+
const percentage = Math.min(100, (this.value / this.max) * 100);
|
|
23
|
+
return `
|
|
24
|
+
<div class="progress-container">
|
|
25
|
+
<div class="progress-bar" style="width: ${percentage}%"></div>
|
|
26
|
+
</div>
|
|
27
|
+
${this.showPercentage ? `
|
|
28
|
+
<span class="percentage">${percentage.toFixed(0)}%</span>
|
|
29
|
+
` : ''}
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
css() {
|
|
33
|
+
return `
|
|
34
|
+
:host {
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
width: 100%;
|
|
38
|
+
gap: 0.5rem; /* 8px */
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.progress-container {
|
|
42
|
+
flex: 1;
|
|
43
|
+
height: ${this.height};
|
|
44
|
+
background: ${this.backgroundColor};
|
|
45
|
+
border-radius: 0.25rem; /* 4px */
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.progress-bar {
|
|
50
|
+
height: 100%;
|
|
51
|
+
background: ${this.color};
|
|
52
|
+
transition: width 0.3s ease;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.percentage {
|
|
56
|
+
font-size: 0.875rem; /* 14px */
|
|
57
|
+
color: #6b7280;
|
|
58
|
+
min-width: 2.1875rem; /* 35px */
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
__decorate([
|
|
64
|
+
property({ type: Number }),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], SniceProgress.prototype, "value", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
property({ type: Number }),
|
|
69
|
+
__metadata("design:type", Object)
|
|
70
|
+
], SniceProgress.prototype, "max", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
property(),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], SniceProgress.prototype, "color", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
property(),
|
|
77
|
+
__metadata("design:type", Object)
|
|
78
|
+
], SniceProgress.prototype, "backgroundColor", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
property(),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], SniceProgress.prototype, "height", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
property({ type: Boolean }),
|
|
85
|
+
__metadata("design:type", Object)
|
|
86
|
+
], SniceProgress.prototype, "showPercentage", void 0);
|
|
87
|
+
SniceProgress = __decorate([
|
|
88
|
+
element('snice-progress')
|
|
89
|
+
], SniceProgress);
|
|
90
|
+
export { SniceProgress };
|
|
91
|
+
//# sourceMappingURL=snice-progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snice-progress.js","sourceRoot":"","sources":["../../../components/table/snice-progress.ts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1,68 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { element, property } from '../../src/index';
|
|
11
|
+
let SniceRating = class SniceRating extends HTMLElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.value = 0;
|
|
15
|
+
this.max = 5;
|
|
16
|
+
this.symbol = '★';
|
|
17
|
+
this.emptySymbol = '☆';
|
|
18
|
+
this.color = '#facc15';
|
|
19
|
+
}
|
|
20
|
+
html() {
|
|
21
|
+
const filled = Math.round(this.value);
|
|
22
|
+
const empty = this.max - filled;
|
|
23
|
+
return `
|
|
24
|
+
<span class="filled">${this.symbol.repeat(filled)}</span><span class="empty">${this.emptySymbol.repeat(empty)}</span>
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
27
|
+
css() {
|
|
28
|
+
return `
|
|
29
|
+
:host {
|
|
30
|
+
display: inline-block;
|
|
31
|
+
font-size: 1.2em;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.filled {
|
|
35
|
+
color: ${this.color};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.empty {
|
|
39
|
+
color: #d1d5db;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
__decorate([
|
|
45
|
+
property({ type: Number }),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], SniceRating.prototype, "value", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
property({ type: Number }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], SniceRating.prototype, "max", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
property(),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], SniceRating.prototype, "symbol", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
property(),
|
|
58
|
+
__metadata("design:type", Object)
|
|
59
|
+
], SniceRating.prototype, "emptySymbol", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
property(),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], SniceRating.prototype, "color", void 0);
|
|
64
|
+
SniceRating = __decorate([
|
|
65
|
+
element('snice-rating')
|
|
66
|
+
], SniceRating);
|
|
67
|
+
export { SniceRating };
|
|
68
|
+
//# sourceMappingURL=snice-rating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snice-rating.js","sourceRoot":"","sources":["../../../components/table/snice-rating.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG7C,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,WAAW;IAArC;;QAEL,UAAK,GAAG,CAAC,CAAC;QAGV,QAAG,GAAG,CAAC,CAAC;QAGR,WAAM,GAAG,GAAG,CAAC;QAGb,gBAAW,GAAG,GAAG,CAAC;QAGlB,UAAK,GAAG,SAAS,CAAC;IA2BpB,CAAC;IAzBC,IAAI;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC;QAEhC,OAAO;6BACkB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,8BAA8B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;KAC9G,CAAC;IACJ,CAAC;IAED,GAAG;QACD,OAAO;;;;;;;iBAOM,IAAI,CAAC,KAAK;;;;;;KAMtB,CAAC;IACJ,CAAC;CACF,CAAA;AAvCC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACjB;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACnB;AAGR;IADC,QAAQ,EAAE;;2CACE;AAGb;IADC,QAAQ,EAAE;;gDACO;AAGlB;IADC,QAAQ,EAAE;;0CACO;AAdP,WAAW;IADvB,OAAO,CAAC,cAAc,CAAC;GACX,WAAW,CAyCvB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SniceRowElement, ColumnDefinition, SniceCellElement } from './snice-table.types';
|
|
2
|
+
import './snice-cell';
|
|
3
|
+
import './snice-cell-text';
|
|
4
|
+
import './snice-cell-number';
|
|
5
|
+
import './snice-cell-date';
|
|
6
|
+
import './snice-cell-sparkline';
|
|
7
|
+
export declare class SniceRow extends HTMLElement implements SniceRowElement {
|
|
8
|
+
selected: boolean;
|
|
9
|
+
hoverable: boolean;
|
|
10
|
+
clickable: boolean;
|
|
11
|
+
selectable: boolean;
|
|
12
|
+
data: any;
|
|
13
|
+
private extractDataFromAttributes;
|
|
14
|
+
index: number;
|
|
15
|
+
columns: ColumnDefinition[];
|
|
16
|
+
html(): string;
|
|
17
|
+
css(): string;
|
|
18
|
+
init(): void;
|
|
19
|
+
private configureCells;
|
|
20
|
+
updateSelection(): void;
|
|
21
|
+
updateRowAttributes(): void;
|
|
22
|
+
updateCells(): void;
|
|
23
|
+
handleRowClick(e: MouseEvent): void;
|
|
24
|
+
handleCheckboxChange(e: Event): void;
|
|
25
|
+
handleKeyDown(e: KeyboardEvent): void;
|
|
26
|
+
private renderCheckbox;
|
|
27
|
+
private renderCells;
|
|
28
|
+
private renderCell;
|
|
29
|
+
private getCellComponent;
|
|
30
|
+
private getCellStyles;
|
|
31
|
+
private escapeHtml;
|
|
32
|
+
private toggleSelection;
|
|
33
|
+
private dispatchRowClick;
|
|
34
|
+
private dispatchRowSelect;
|
|
35
|
+
private dispatchRowHover;
|
|
36
|
+
select(): void;
|
|
37
|
+
deselect(): void;
|
|
38
|
+
focusRow(): void;
|
|
39
|
+
getCellValue(columnKey: string): any;
|
|
40
|
+
setCellValue(columnKey: string, value: any): void;
|
|
41
|
+
getCellElement(columnKey: string): SniceCellElement | null;
|
|
42
|
+
highlight(duration?: number): void;
|
|
43
|
+
}
|