snice 2.5.4 → 3.1.0
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/README.md +501 -882
- package/bin/templates/base/src/components/counter-button.ts +13 -26
- package/bin/templates/base/src/controllers/counter-controller.ts +3 -3
- package/dist/components/accordion/snice-accordion-item.d.ts +4 -5
- package/dist/components/accordion/snice-accordion-item.js +37 -39
- package/dist/components/accordion/snice-accordion-item.js.map +1 -1
- package/dist/components/accordion/snice-accordion.d.ts +5 -11
- package/dist/components/accordion/snice-accordion.js +51 -52
- package/dist/components/accordion/snice-accordion.js.map +1 -1
- package/dist/components/alert/snice-alert.d.ts +2 -6
- package/dist/components/alert/snice-alert.js +41 -56
- package/dist/components/alert/snice-alert.js.map +1 -1
- package/dist/components/avatar/snice-avatar.d.ts +2 -6
- package/dist/components/avatar/snice-avatar.js +64 -71
- package/dist/components/avatar/snice-avatar.js.map +1 -1
- package/dist/components/badge/snice-badge.d.ts +2 -3
- package/dist/components/badge/snice-badge.js +22 -23
- package/dist/components/badge/snice-badge.js.map +1 -1
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +5 -12
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +88 -89
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/components/button/snice-button.d.ts +3 -7
- package/dist/components/button/snice-button.js +37 -58
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/components/card/snice-card.d.ts +5 -8
- package/dist/components/card/snice-card.js +71 -56
- package/dist/components/card/snice-card.js.map +1 -1
- package/dist/components/checkbox/snice-checkbox.d.ts +4 -13
- package/dist/components/checkbox/snice-checkbox.js +66 -137
- package/dist/components/checkbox/snice-checkbox.js.map +1 -1
- package/dist/components/chip/snice-chip.d.ts +5 -11
- package/dist/components/chip/snice-chip.js +44 -47
- package/dist/components/chip/snice-chip.js.map +1 -1
- package/dist/components/date-picker/snice-date-picker.d.ts +11 -11
- package/dist/components/date-picker/snice-date-picker.js +134 -133
- package/dist/components/date-picker/snice-date-picker.js.map +1 -1
- package/dist/components/divider/snice-divider.d.ts +2 -4
- package/dist/components/divider/snice-divider.js +14 -22
- package/dist/components/divider/snice-divider.js.map +1 -1
- package/dist/components/drawer/snice-drawer.d.ts +4 -4
- package/dist/components/drawer/snice-drawer.js +25 -19
- package/dist/components/drawer/snice-drawer.js.map +1 -1
- package/dist/components/input/snice-input.d.ts +8 -6
- package/dist/components/input/snice-input.js +122 -105
- package/dist/components/input/snice-input.js.map +1 -1
- package/dist/components/layout/snice-layout-blog.d.ts +4 -4
- package/dist/components/layout/snice-layout-blog.js +21 -19
- package/dist/components/layout/snice-layout-blog.js.map +1 -1
- package/dist/components/layout/snice-layout-card.d.ts +2 -2
- package/dist/components/layout/snice-layout-card.js +16 -9
- package/dist/components/layout/snice-layout-card.js.map +1 -1
- package/dist/components/layout/snice-layout-centered.d.ts +2 -2
- package/dist/components/layout/snice-layout-centered.js +14 -7
- package/dist/components/layout/snice-layout-centered.js.map +1 -1
- package/dist/components/layout/snice-layout-dashboard.d.ts +5 -5
- package/dist/components/layout/snice-layout-dashboard.js +38 -30
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -1
- package/dist/components/layout/snice-layout-fullscreen.d.ts +2 -2
- package/dist/components/layout/snice-layout-fullscreen.js +17 -10
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -1
- package/dist/components/layout/snice-layout-landing.d.ts +4 -4
- package/dist/components/layout/snice-layout-landing.js +21 -19
- package/dist/components/layout/snice-layout-landing.js.map +1 -1
- package/dist/components/layout/snice-layout-minimal.d.ts +2 -2
- package/dist/components/layout/snice-layout-minimal.js +17 -6
- package/dist/components/layout/snice-layout-minimal.js.map +1 -1
- package/dist/components/layout/snice-layout-sidebar.d.ts +5 -4
- package/dist/components/layout/snice-layout-sidebar.js +42 -20
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
- package/dist/components/layout/snice-layout-split.d.ts +2 -2
- package/dist/components/layout/snice-layout-split.js +14 -7
- package/dist/components/layout/snice-layout-split.js.map +1 -1
- package/dist/components/layout/snice-layout.d.ts +4 -4
- package/dist/components/layout/snice-layout.js +16 -10
- package/dist/components/layout/snice-layout.js.map +1 -1
- package/dist/components/login/snice-login.d.ts +6 -11
- package/dist/components/login/snice-login.js +97 -71
- package/dist/components/login/snice-login.js.map +1 -1
- package/dist/components/modal/snice-modal.d.ts +5 -9
- package/dist/components/modal/snice-modal.js +47 -78
- package/dist/components/modal/snice-modal.js.map +1 -1
- package/dist/components/nav/snice-nav.d.ts +13 -7
- package/dist/components/nav/snice-nav.js +191 -100
- package/dist/components/nav/snice-nav.js.map +1 -1
- package/dist/components/nav/snice-nav.types.d.ts +3 -3
- package/dist/components/pagination/snice-pagination.d.ts +6 -7
- package/dist/components/pagination/snice-pagination.js +94 -81
- package/dist/components/pagination/snice-pagination.js.map +1 -1
- package/dist/components/progress/snice-progress.d.ts +2 -7
- package/dist/components/progress/snice-progress.js +41 -98
- package/dist/components/progress/snice-progress.js.map +1 -1
- package/dist/components/radio/snice-radio.d.ts +4 -4
- package/dist/components/radio/snice-radio.js +52 -44
- package/dist/components/radio/snice-radio.js.map +1 -1
- package/dist/components/select/snice-option.d.ts +2 -1
- package/dist/components/select/snice-option.js +12 -5
- package/dist/components/select/snice-option.js.map +1 -1
- package/dist/components/select/snice-select.d.ts +9 -21
- package/dist/components/select/snice-select.js +98 -170
- package/dist/components/select/snice-select.js.map +1 -1
- package/dist/components/skeleton/snice-skeleton.d.ts +2 -6
- package/dist/components/skeleton/snice-skeleton.js +18 -49
- package/dist/components/skeleton/snice-skeleton.js.map +1 -1
- package/dist/components/snice-cell-BLFVdxPp.js +4 -0
- package/dist/components/snice-cell-BLFVdxPp.js.map +1 -0
- package/dist/components/switch/snice-switch.d.ts +2 -2
- package/dist/components/switch/snice-switch.js +38 -26
- package/dist/components/switch/snice-switch.js.map +1 -1
- package/dist/components/table/snice-cell-actions.d.ts +24 -0
- package/dist/components/table/snice-cell-actions.js +149 -0
- package/dist/components/table/snice-cell-actions.js.map +1 -0
- package/dist/components/table/snice-cell-boolean.d.ts +2 -2
- package/dist/components/table/snice-cell-boolean.js +13 -7
- package/dist/components/table/snice-cell-boolean.js.map +1 -1
- package/dist/components/table/snice-cell-color.d.ts +18 -0
- package/dist/components/table/snice-cell-color.js +149 -0
- package/dist/components/table/snice-cell-color.js.map +1 -0
- package/dist/components/table/snice-cell-currency.d.ts +24 -0
- package/dist/components/table/snice-cell-currency.js +235 -0
- package/dist/components/table/snice-cell-currency.js.map +1 -0
- package/dist/components/table/snice-cell-date.d.ts +2 -2
- package/dist/components/table/snice-cell-date.js +14 -8
- package/dist/components/table/snice-cell-date.js.map +1 -1
- package/dist/components/table/snice-cell-duration.d.ts +2 -2
- package/dist/components/table/snice-cell-duration.js +12 -6
- package/dist/components/table/snice-cell-duration.js.map +1 -1
- package/dist/components/table/snice-cell-email.d.ts +15 -0
- package/dist/components/table/snice-cell-email.js +125 -0
- package/dist/components/table/snice-cell-email.js.map +1 -0
- package/dist/components/table/snice-cell-filesize.d.ts +2 -2
- package/dist/components/table/snice-cell-filesize.js +12 -6
- package/dist/components/table/snice-cell-filesize.js.map +1 -1
- package/dist/components/table/snice-cell-image.d.ts +20 -0
- package/dist/components/table/snice-cell-image.js +162 -0
- package/dist/components/table/snice-cell-image.js.map +1 -0
- package/dist/components/table/snice-cell-json.d.ts +20 -0
- package/dist/components/table/snice-cell-json.js +186 -0
- package/dist/components/table/snice-cell-json.js.map +1 -0
- package/dist/components/table/snice-cell-link.d.ts +17 -0
- package/dist/components/table/snice-cell-link.js +142 -0
- package/dist/components/table/snice-cell-link.js.map +1 -0
- package/dist/components/table/snice-cell-location.d.ts +19 -0
- package/dist/components/table/snice-cell-location.js +185 -0
- package/dist/components/table/snice-cell-location.js.map +1 -0
- package/dist/components/table/snice-cell-number.d.ts +2 -2
- package/dist/components/table/snice-cell-number.js +12 -6
- package/dist/components/table/snice-cell-number.js.map +1 -1
- package/dist/components/table/snice-cell-percentage.d.ts +22 -0
- package/dist/components/table/snice-cell-percentage.js +208 -0
- package/dist/components/table/snice-cell-percentage.js.map +1 -0
- package/dist/components/table/snice-cell-phone.d.ts +18 -0
- package/dist/components/table/snice-cell-phone.js +153 -0
- package/dist/components/table/snice-cell-phone.js.map +1 -0
- package/dist/components/table/snice-cell-progress.d.ts +2 -2
- package/dist/components/table/snice-cell-progress.js +12 -6
- package/dist/components/table/snice-cell-progress.js.map +1 -1
- package/dist/components/table/snice-cell-rating.d.ts +2 -2
- package/dist/components/table/snice-cell-rating.js +12 -6
- package/dist/components/table/snice-cell-rating.js.map +1 -1
- package/dist/components/table/snice-cell-sparkline.d.ts +2 -2
- package/dist/components/table/snice-cell-sparkline.js +13 -7
- package/dist/components/table/snice-cell-sparkline.js.map +1 -1
- package/dist/components/table/snice-cell-status.d.ts +17 -0
- package/dist/components/table/snice-cell-status.js +144 -0
- package/dist/components/table/snice-cell-status.js.map +1 -0
- package/dist/components/table/snice-cell-tag.d.ts +16 -0
- package/dist/components/table/snice-cell-tag.js +131 -0
- package/dist/components/table/snice-cell-tag.js.map +1 -0
- package/dist/components/table/snice-cell-text.d.ts +2 -2
- package/dist/components/table/snice-cell-text.js +14 -8
- package/dist/components/table/snice-cell-text.js.map +1 -1
- package/dist/components/table/snice-cell.d.ts +2 -2
- package/dist/components/table/snice-cell.js +12 -6
- package/dist/components/table/snice-cell.js.map +1 -1
- package/dist/components/table/snice-column.d.ts +1 -1
- package/dist/components/table/snice-column.js +6 -3
- package/dist/components/table/snice-column.js.map +1 -1
- package/dist/components/table/snice-header.d.ts +5 -5
- package/dist/components/table/snice-header.js +60 -50
- package/dist/components/table/snice-header.js.map +1 -1
- package/dist/components/table/snice-progress.d.ts +2 -2
- package/dist/components/table/snice-progress.js +18 -11
- package/dist/components/table/snice-progress.js.map +1 -1
- package/dist/components/table/snice-rating.d.ts +2 -2
- package/dist/components/table/snice-rating.js +15 -8
- package/dist/components/table/snice-rating.js.map +1 -1
- package/dist/components/table/snice-row.d.ts +17 -6
- package/dist/components/table/snice-row.js +95 -44
- package/dist/components/table/snice-row.js.map +1 -1
- package/dist/components/table/snice-table.d.ts +18 -10
- package/dist/components/table/snice-table.js +355 -173
- package/dist/components/table/snice-table.js.map +1 -1
- package/dist/components/table/snice-table.types.d.ts +101 -2
- package/dist/components/tabs/snice-tab-panel.d.ts +2 -2
- package/dist/components/tabs/snice-tab-panel.js +12 -6
- package/dist/components/tabs/snice-tab-panel.js.map +1 -1
- package/dist/components/tabs/snice-tab.d.ts +6 -5
- package/dist/components/tabs/snice-tab.js +36 -19
- package/dist/components/tabs/snice-tab.js.map +1 -1
- package/dist/components/tabs/snice-tabs.d.ts +5 -5
- package/dist/components/tabs/snice-tabs.js +38 -28
- package/dist/components/tabs/snice-tabs.js.map +1 -1
- package/dist/components/toast/snice-toast-container.d.ts +7 -7
- package/dist/components/toast/snice-toast-container.js +19 -12
- package/dist/components/toast/snice-toast-container.js.map +1 -1
- package/dist/components/toast/snice-toast.d.ts +3 -15
- package/dist/components/toast/snice-toast.js +49 -108
- package/dist/components/toast/snice-toast.js.map +1 -1
- package/dist/components/tooltip/snice-tooltip.d.ts +2 -2
- package/dist/components/tooltip/snice-tooltip.js +14 -7
- package/dist/components/tooltip/snice-tooltip.js.map +1 -1
- package/dist/context.d.ts +44 -0
- package/dist/element-ready.d.ts +40 -0
- package/dist/{types/element.d.ts → element.d.ts} +2 -8
- package/dist/{types/events.d.ts → events.d.ts} +0 -4
- package/dist/index.cjs +2589 -605
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +21 -0
- package/dist/index.esm.js +2568 -604
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +2589 -605
- package/dist/index.iife.js.map +1 -1
- package/dist/method-decorators.d.ts +121 -0
- package/dist/on.d.ts +59 -0
- package/dist/parts.d.ts +159 -0
- package/dist/render-debug.d.ts +27 -0
- package/dist/render-tracker.d.ts +14 -0
- package/dist/render.d.ts +96 -0
- package/dist/symbols.cjs +163 -0
- package/dist/symbols.cjs.map +1 -1
- package/dist/{types/symbols.d.ts → symbols.d.ts} +22 -0
- package/dist/symbols.esm.js +27 -3
- package/dist/symbols.esm.js.map +1 -1
- package/dist/template.d.ts +100 -0
- package/dist/transitions.cjs +219 -0
- package/dist/transitions.esm.js +2 -2
- package/dist/types/context.d.ts +48 -0
- package/dist/types/element-options.d.ts +26 -0
- package/dist/types/index.d.ts +25 -9
- package/dist/types/nav-context.d.ts +19 -0
- package/dist/types/{types/on-options.d.ts → on-options.d.ts} +2 -0
- package/dist/types/{types/placard.d.ts → placard.d.ts} +0 -1
- package/docs/ai/README.md +17 -0
- package/docs/ai/api.md +175 -0
- package/docs/ai/architecture.md +160 -0
- package/docs/ai/components/accordion.md +174 -0
- package/docs/ai/components/alert.md +77 -0
- package/docs/ai/components/avatar.md +61 -0
- package/docs/ai/components/badge.md +69 -0
- package/docs/ai/components/breadcrumbs.md +74 -0
- package/docs/ai/components/button.md +75 -0
- package/docs/ai/components/card.md +61 -0
- package/docs/ai/components/checkbox.md +74 -0
- package/docs/ai/components/chip.md +73 -0
- package/docs/ai/components/date-picker.md +75 -0
- package/docs/ai/components/divider.md +66 -0
- package/docs/ai/components/drawer.md +80 -0
- package/docs/ai/components/input.md +111 -0
- package/docs/ai/components/login.md +109 -0
- package/docs/ai/components/modal.md +67 -0
- package/docs/ai/components/nav.md +76 -0
- package/docs/ai/components/pagination.md +55 -0
- package/docs/ai/components/progress.md +72 -0
- package/docs/ai/components/radio.md +79 -0
- package/docs/ai/components/select.md +92 -0
- package/docs/ai/components/skeleton.md +57 -0
- package/docs/ai/components/switch.md +53 -0
- package/docs/ai/components/table.md +227 -0
- package/docs/ai/components/tabs.md +83 -0
- package/docs/ai/components/toast.md +140 -0
- package/docs/ai/components/tooltip.md +146 -0
- package/docs/ai/patterns.md +244 -0
- package/docs/components/accordion.md +558 -0
- package/docs/components/drawer.md +602 -0
- package/docs/components/modal.md +558 -0
- package/docs/components/nav.md +239 -0
- package/docs/components/pagination.md +289 -0
- package/docs/components/select.md +599 -0
- package/docs/components/switch.md +354 -0
- package/docs/components/tabs.md +546 -0
- package/docs/components/toast.md +506 -0
- package/docs/components/tooltip.md +523 -0
- package/docs/controllers.md +744 -0
- package/docs/elements.md +855 -0
- package/docs/events.md +807 -0
- package/docs/migration-v2-to-v3.md +569 -0
- package/docs/observe.md +588 -0
- package/docs/placards.md +401 -0
- package/docs/request-response.md +852 -0
- package/docs/routing.md +1186 -0
- package/package.json +10 -11
- package/dist/components/snice-cell-C9N6yGxQ.js +0 -4
- package/dist/components/snice-cell-C9N6yGxQ.js.map +0 -1
- package/dist/types/types/index.d.ts +0 -23
- /package/dist/{types/controller.d.ts → controller.d.ts} +0 -0
- /package/dist/{types/global.d.ts → global.d.ts} +0 -0
- /package/dist/{types/observe.d.ts → observe.d.ts} +0 -0
- /package/dist/{types/request-response.d.ts → request-response.d.ts} +0 -0
- /package/dist/{types/router.d.ts → router.d.ts} +0 -0
- /package/dist/{types/testing.d.ts → testing.d.ts} +0 -0
- /package/dist/{types/transitions.d.ts → transitions.d.ts} +0 -0
- /package/dist/types/{types/adopted-options.d.ts → adopted-options.d.ts} +0 -0
- /package/dist/types/{types/app-context.d.ts → app-context.d.ts} +0 -0
- /package/dist/types/{types/dispatch-options.d.ts → dispatch-options.d.ts} +0 -0
- /package/dist/types/{types/guard.d.ts → guard.d.ts} +0 -0
- /package/dist/types/{types/i-controller.d.ts → i-controller.d.ts} +0 -0
- /package/dist/types/{types/moved-options.d.ts → moved-options.d.ts} +0 -0
- /package/dist/types/{types/observe-options.d.ts → observe-options.d.ts} +0 -0
- /package/dist/types/{types/page-options.d.ts → page-options.d.ts} +0 -0
- /package/dist/types/{types/part-options.d.ts → part-options.d.ts} +0 -0
- /package/dist/types/{types/property-converter.d.ts → property-converter.d.ts} +0 -0
- /package/dist/types/{types/property-options.d.ts → property-options.d.ts} +0 -0
- /package/dist/types/{types/query-options.d.ts → query-options.d.ts} +0 -0
- /package/dist/types/{types/request-options.d.ts → request-options.d.ts} +0 -0
- /package/dist/types/{types/respond-options.d.ts → respond-options.d.ts} +0 -0
- /package/dist/types/{types/route-params.d.ts → route-params.d.ts} +0 -0
- /package/dist/types/{types/router-instance.d.ts → router-instance.d.ts} +0 -0
- /package/dist/types/{types/router-options.d.ts → router-options.d.ts} +0 -0
- /package/dist/types/{types/simple-array.d.ts → simple-array.d.ts} +0 -0
- /package/dist/types/{types/snice-element.d.ts → snice-element.d.ts} +0 -0
- /package/dist/types/{types/snice-global.d.ts → snice-global.d.ts} +0 -0
- /package/dist/types/{types/transition.d.ts → transition.d.ts} +0 -0
- /package/dist/{types/utils.d.ts → utils.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __runInitializers, __esDecorate } from 'tslib';
|
|
2
|
-
import { element, property, query, request,
|
|
2
|
+
import { element, property, query, request, styles, render, ready, watch, dispatch, css, html } from 'snice';
|
|
3
3
|
import '../input/snice-input.js';
|
|
4
4
|
import '../select/snice-select.js';
|
|
5
5
|
import './snice-cell.js';
|
|
@@ -13,7 +13,7 @@ import './snice-cell-duration.js';
|
|
|
13
13
|
import './snice-cell-filesize.js';
|
|
14
14
|
import './snice-cell-sparkline.js';
|
|
15
15
|
import '../select/snice-option.js';
|
|
16
|
-
import '../snice-cell-
|
|
16
|
+
import '../snice-cell-BLFVdxPp.js';
|
|
17
17
|
import './snice-rating.js';
|
|
18
18
|
import './snice-progress.js';
|
|
19
19
|
|
|
@@ -30,6 +30,9 @@ let SniceTable = (() => {
|
|
|
30
30
|
let _searchable_decorators;
|
|
31
31
|
let _searchable_initializers = [];
|
|
32
32
|
let _searchable_extraInitializers = [];
|
|
33
|
+
let _filterable_decorators;
|
|
34
|
+
let _filterable_initializers = [];
|
|
35
|
+
let _filterable_extraInitializers = [];
|
|
33
36
|
let _sortable_decorators;
|
|
34
37
|
let _sortable_initializers = [];
|
|
35
38
|
let _sortable_extraInitializers = [];
|
|
@@ -42,18 +45,15 @@ let SniceTable = (() => {
|
|
|
42
45
|
let _clickable_decorators;
|
|
43
46
|
let _clickable_initializers = [];
|
|
44
47
|
let _clickable_extraInitializers = [];
|
|
45
|
-
let
|
|
46
|
-
let
|
|
47
|
-
let
|
|
48
|
-
let
|
|
49
|
-
let
|
|
50
|
-
let
|
|
48
|
+
let _list_decorators;
|
|
49
|
+
let _list_initializers = [];
|
|
50
|
+
let _list_extraInitializers = [];
|
|
51
|
+
let _searchDebounce_decorators;
|
|
52
|
+
let _searchDebounce_initializers = [];
|
|
53
|
+
let _searchDebounce_extraInitializers = [];
|
|
51
54
|
let _currentSort_decorators;
|
|
52
55
|
let _currentSort_initializers = [];
|
|
53
56
|
let _currentSort_extraInitializers = [];
|
|
54
|
-
let _searchText_decorators;
|
|
55
|
-
let _searchText_initializers = [];
|
|
56
|
-
let _searchText_extraInitializers = [];
|
|
57
57
|
let _selector_decorators;
|
|
58
58
|
let _selector_initializers = [];
|
|
59
59
|
let _selector_extraInitializers = [];
|
|
@@ -77,6 +77,9 @@ let SniceTable = (() => {
|
|
|
77
77
|
let _tbody_extraInitializers = [];
|
|
78
78
|
let _getTableConfig_decorators;
|
|
79
79
|
let _getTableData_decorators;
|
|
80
|
+
let _componentStyles_decorators;
|
|
81
|
+
let _renderContent_decorators;
|
|
82
|
+
let _initialize_decorators;
|
|
80
83
|
let _handleSelectorOptionsChange_decorators;
|
|
81
84
|
let _handleSortableChange_decorators;
|
|
82
85
|
let _handleSelectableChange_decorators;
|
|
@@ -84,13 +87,6 @@ let SniceTable = (() => {
|
|
|
84
87
|
let _handleDataChange_decorators;
|
|
85
88
|
let _handleSelectedRowsChange_decorators;
|
|
86
89
|
let _handleSortChange_decorators;
|
|
87
|
-
let _handleSort_decorators;
|
|
88
|
-
let _handleRowSelect_decorators;
|
|
89
|
-
let _handleSelectAll_decorators;
|
|
90
|
-
let _handleRowClick_decorators;
|
|
91
|
-
let _onAttached_decorators;
|
|
92
|
-
let _handleSearchChange_decorators;
|
|
93
|
-
let _handleSelectorChange_decorators;
|
|
94
90
|
let _dispatchRowSelectionChanged_decorators;
|
|
95
91
|
let _dispatchSelectAllChanged_decorators;
|
|
96
92
|
(class extends _classSuper {
|
|
@@ -99,15 +95,21 @@ let SniceTable = (() => {
|
|
|
99
95
|
super(...arguments);
|
|
100
96
|
this.striped = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _striped_initializers, false));
|
|
101
97
|
this.searchable = (__runInitializers(this, _striped_extraInitializers), __runInitializers(this, _searchable_initializers, false));
|
|
102
|
-
this.
|
|
98
|
+
this.filterable = (__runInitializers(this, _searchable_extraInitializers), __runInitializers(this, _filterable_initializers, false));
|
|
99
|
+
this.sortable = (__runInitializers(this, _filterable_extraInitializers), __runInitializers(this, _sortable_initializers, false));
|
|
103
100
|
this.selectable = (__runInitializers(this, _sortable_extraInitializers), __runInitializers(this, _selectable_initializers, false));
|
|
104
101
|
this.hoverable = (__runInitializers(this, _selectable_extraInitializers), __runInitializers(this, _hoverable_initializers, true));
|
|
105
102
|
this.clickable = (__runInitializers(this, _hoverable_extraInitializers), __runInitializers(this, _clickable_initializers, false));
|
|
106
|
-
this.
|
|
107
|
-
this.
|
|
108
|
-
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
103
|
+
this.list = (__runInitializers(this, _clickable_extraInitializers), __runInitializers(this, _list_initializers, false));
|
|
104
|
+
this.searchDebounce = (__runInitializers(this, _list_extraInitializers), __runInitializers(this, _searchDebounce_initializers, 500));
|
|
105
|
+
// Plain properties - no reflection to attributes
|
|
106
|
+
this.columns = (__runInitializers(this, _searchDebounce_extraInitializers), []);
|
|
107
|
+
this.data = [];
|
|
108
|
+
this.currentSort = __runInitializers(this, _currentSort_initializers, []);
|
|
109
|
+
// Don't use @property decorator to avoid auto-rendering on searchText change
|
|
110
|
+
// This would cause the input to lose focus while typing
|
|
111
|
+
this.searchText = (__runInitializers(this, _currentSort_extraInitializers), '');
|
|
112
|
+
this.selector = __runInitializers(this, _selector_initializers, '');
|
|
111
113
|
this.selectorOptions = (__runInitializers(this, _selector_extraInitializers), __runInitializers(this, _selectorOptions_initializers, []));
|
|
112
114
|
this.loading = (__runInitializers(this, _selectorOptions_extraInitializers), __runInitializers(this, _loading_initializers, false));
|
|
113
115
|
this.selectedRows = (__runInitializers(this, _loading_extraInitializers), __runInitializers(this, _selectedRows_initializers, []));
|
|
@@ -115,19 +117,120 @@ let SniceTable = (() => {
|
|
|
115
117
|
this.thead = (__runInitializers(this, _table_extraInitializers), __runInitializers(this, _thead_initializers, void 0));
|
|
116
118
|
this.tbody = (__runInitializers(this, _thead_extraInitializers), __runInitializers(this, _tbody_initializers, void 0));
|
|
117
119
|
this.dataRequestTimeout = (__runInitializers(this, _tbody_extraInitializers), null);
|
|
120
|
+
this.handleClick = (e) => {
|
|
121
|
+
const target = e.target;
|
|
122
|
+
// Handle sortable header click
|
|
123
|
+
const th = target.closest('th.sortable');
|
|
124
|
+
if (th) {
|
|
125
|
+
const columnKey = th.getAttribute('data-key');
|
|
126
|
+
if (columnKey) {
|
|
127
|
+
this.toggleSort(columnKey, true); // Always multi-sort
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
// Handle row click
|
|
132
|
+
const tr = target.closest('tbody tr');
|
|
133
|
+
if (tr) {
|
|
134
|
+
// Don't trigger if clicking on checkbox or other interactive elements
|
|
135
|
+
if (target.matches('input[type="checkbox"], button, a, .interactive')) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const rowIndex = parseInt(tr.getAttribute('data-index') || '0');
|
|
139
|
+
const rowData = this.data[rowIndex];
|
|
140
|
+
// Handle row selection if selectable
|
|
141
|
+
if (this.selectable) {
|
|
142
|
+
const isCurrentlySelected = this.selectedRows.includes(rowIndex);
|
|
143
|
+
if (isCurrentlySelected) {
|
|
144
|
+
this.selectedRows = this.selectedRows.filter(i => i !== rowIndex);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
this.selectedRows = [...this.selectedRows, rowIndex];
|
|
148
|
+
}
|
|
149
|
+
this.updateRowSelectionState();
|
|
150
|
+
this.updateSelectAllState();
|
|
151
|
+
this.dispatchRowSelectionChanged(rowIndex, !isCurrentlySelected);
|
|
152
|
+
}
|
|
153
|
+
// Handle clickable row event
|
|
154
|
+
if (this.clickable) {
|
|
155
|
+
this.dispatchEvent(new CustomEvent('row-clicked', {
|
|
156
|
+
detail: { rowData, rowIndex }
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
this.handleChange = (e) => {
|
|
162
|
+
const target = e.target;
|
|
163
|
+
// Handle row select checkbox
|
|
164
|
+
if (target.matches('.row-select')) {
|
|
165
|
+
const checkbox = target;
|
|
166
|
+
const rowIndex = parseInt(checkbox.getAttribute('data-row-index') || '0');
|
|
167
|
+
if (checkbox.checked) {
|
|
168
|
+
if (!this.selectedRows.includes(rowIndex)) {
|
|
169
|
+
this.selectedRows = [...this.selectedRows, rowIndex];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
this.selectedRows = this.selectedRows.filter(i => i !== rowIndex);
|
|
174
|
+
}
|
|
175
|
+
this.updateRowSelectionState();
|
|
176
|
+
this.updateSelectAllState();
|
|
177
|
+
this.dispatchRowSelectionChanged(rowIndex, checkbox.checked);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
// Handle select all checkbox
|
|
181
|
+
if (target.matches('.select-all')) {
|
|
182
|
+
const checkbox = target;
|
|
183
|
+
if (checkbox.checked) {
|
|
184
|
+
this.selectedRows = this.data.map((_, index) => index);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
this.selectedRows = [];
|
|
188
|
+
}
|
|
189
|
+
this.updateRowSelectionState();
|
|
190
|
+
this.dispatchSelectAllChanged(checkbox.checked);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
this.onAttached = () => {
|
|
194
|
+
this.getTableConfig();
|
|
195
|
+
this.getTableData();
|
|
196
|
+
};
|
|
197
|
+
this.searchDebounceTimeout = null;
|
|
198
|
+
this.handleSearchInput = (e) => {
|
|
199
|
+
const target = e.target;
|
|
200
|
+
const input = target;
|
|
201
|
+
this.searchText = input.value;
|
|
202
|
+
// Manual debounce implementation
|
|
203
|
+
if (this.searchDebounceTimeout) {
|
|
204
|
+
clearTimeout(this.searchDebounceTimeout);
|
|
205
|
+
}
|
|
206
|
+
this.searchDebounceTimeout = setTimeout(() => {
|
|
207
|
+
this.debouncedDataRequest();
|
|
208
|
+
}, this.searchDebounce);
|
|
209
|
+
};
|
|
210
|
+
this.selectorDebounceTimeout = null;
|
|
211
|
+
this.handleSelectorChange = (e) => {
|
|
212
|
+
this.selector = Array.isArray(e.detail.value) ? e.detail.value.join(',') : e.detail.value;
|
|
213
|
+
// Manual debounce implementation
|
|
214
|
+
if (this.selectorDebounceTimeout) {
|
|
215
|
+
clearTimeout(this.selectorDebounceTimeout);
|
|
216
|
+
}
|
|
217
|
+
this.selectorDebounceTimeout = setTimeout(() => {
|
|
218
|
+
this.debouncedDataRequest();
|
|
219
|
+
}, 150);
|
|
220
|
+
};
|
|
118
221
|
}
|
|
119
222
|
static {
|
|
120
223
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
121
224
|
_striped_decorators = [property({ type: Boolean, attribute: 'striped' })];
|
|
122
225
|
_searchable_decorators = [property({ type: Boolean, attribute: 'searchable' })];
|
|
226
|
+
_filterable_decorators = [property({ type: Boolean, attribute: 'filterable' })];
|
|
123
227
|
_sortable_decorators = [property({ type: Boolean, attribute: 'sortable' })];
|
|
124
228
|
_selectable_decorators = [property({ type: Boolean, attribute: 'selectable' })];
|
|
125
229
|
_hoverable_decorators = [property({ type: Boolean, attribute: 'hoverable' })];
|
|
126
230
|
_clickable_decorators = [property({ type: Boolean, attribute: 'clickable' })];
|
|
127
|
-
|
|
128
|
-
|
|
231
|
+
_list_decorators = [property({ type: Boolean, attribute: 'list' })];
|
|
232
|
+
_searchDebounce_decorators = [property({ type: Number, attribute: 'search-debounce' })];
|
|
129
233
|
_currentSort_decorators = [property({ type: Array, attribute: 'current-sort' })];
|
|
130
|
-
_searchText_decorators = [property({ type: String, attribute: 'search-text' })];
|
|
131
234
|
_selector_decorators = [property({ type: String, attribute: 'selector' })];
|
|
132
235
|
_selectorOptions_decorators = [property({ type: Array, attribute: 'selector-options' })];
|
|
133
236
|
_loading_decorators = [property({ type: Boolean, attribute: 'loading' })];
|
|
@@ -137,6 +240,9 @@ let SniceTable = (() => {
|
|
|
137
240
|
_tbody_decorators = [query('tbody')];
|
|
138
241
|
_getTableConfig_decorators = [request('@snice/table/config')];
|
|
139
242
|
_getTableData_decorators = [request('@snice/table/data')];
|
|
243
|
+
_componentStyles_decorators = [styles()];
|
|
244
|
+
_renderContent_decorators = [render()];
|
|
245
|
+
_initialize_decorators = [ready()];
|
|
140
246
|
_handleSelectorOptionsChange_decorators = [watch('selector-options')];
|
|
141
247
|
_handleSortableChange_decorators = [watch('sortable')];
|
|
142
248
|
_handleSelectableChange_decorators = [watch('selectable')];
|
|
@@ -144,17 +250,13 @@ let SniceTable = (() => {
|
|
|
144
250
|
_handleDataChange_decorators = [watch('data', 'loading')];
|
|
145
251
|
_handleSelectedRowsChange_decorators = [watch('selected-rows')];
|
|
146
252
|
_handleSortChange_decorators = [watch('current-sort')];
|
|
147
|
-
_handleSort_decorators = [on('click', 'th.sortable')];
|
|
148
|
-
_handleRowSelect_decorators = [on('change', '.row-select')];
|
|
149
|
-
_handleSelectAll_decorators = [on('change', '.select-all')];
|
|
150
|
-
_handleRowClick_decorators = [on('click', 'tbody tr')];
|
|
151
|
-
_onAttached_decorators = [on('@snice/controller-attached')];
|
|
152
|
-
_handleSearchChange_decorators = [on('input', '.search-input', { debounce: 500 })];
|
|
153
|
-
_handleSelectorChange_decorators = [on('@snice/select/change', '.selector-input', { debounce: 150 })];
|
|
154
253
|
_dispatchRowSelectionChanged_decorators = [dispatch('@snice/table/row-selection-changed', { bubbles: true, composed: true })];
|
|
155
254
|
_dispatchSelectAllChanged_decorators = [dispatch('@snice/table/select-all-changed', { bubbles: true, composed: true })];
|
|
156
255
|
__esDecorate(this, null, _getTableConfig_decorators, { kind: "method", name: "getTableConfig", static: false, private: false, access: { has: obj => "getTableConfig" in obj, get: obj => obj.getTableConfig }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
157
256
|
__esDecorate(this, null, _getTableData_decorators, { kind: "method", name: "getTableData", static: false, private: false, access: { has: obj => "getTableData" in obj, get: obj => obj.getTableData }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
257
|
+
__esDecorate(this, null, _componentStyles_decorators, { kind: "method", name: "componentStyles", static: false, private: false, access: { has: obj => "componentStyles" in obj, get: obj => obj.componentStyles }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
258
|
+
__esDecorate(this, null, _renderContent_decorators, { kind: "method", name: "renderContent", static: false, private: false, access: { has: obj => "renderContent" in obj, get: obj => obj.renderContent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
259
|
+
__esDecorate(this, null, _initialize_decorators, { kind: "method", name: "initialize", static: false, private: false, access: { has: obj => "initialize" in obj, get: obj => obj.initialize }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
158
260
|
__esDecorate(this, null, _handleSelectorOptionsChange_decorators, { kind: "method", name: "handleSelectorOptionsChange", static: false, private: false, access: { has: obj => "handleSelectorOptionsChange" in obj, get: obj => obj.handleSelectorOptionsChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
159
261
|
__esDecorate(this, null, _handleSortableChange_decorators, { kind: "method", name: "handleSortableChange", static: false, private: false, access: { has: obj => "handleSortableChange" in obj, get: obj => obj.handleSortableChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
160
262
|
__esDecorate(this, null, _handleSelectableChange_decorators, { kind: "method", name: "handleSelectableChange", static: false, private: false, access: { has: obj => "handleSelectableChange" in obj, get: obj => obj.handleSelectableChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
@@ -162,25 +264,18 @@ let SniceTable = (() => {
|
|
|
162
264
|
__esDecorate(this, null, _handleDataChange_decorators, { kind: "method", name: "handleDataChange", static: false, private: false, access: { has: obj => "handleDataChange" in obj, get: obj => obj.handleDataChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
163
265
|
__esDecorate(this, null, _handleSelectedRowsChange_decorators, { kind: "method", name: "handleSelectedRowsChange", static: false, private: false, access: { has: obj => "handleSelectedRowsChange" in obj, get: obj => obj.handleSelectedRowsChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
164
266
|
__esDecorate(this, null, _handleSortChange_decorators, { kind: "method", name: "handleSortChange", static: false, private: false, access: { has: obj => "handleSortChange" in obj, get: obj => obj.handleSortChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
165
|
-
__esDecorate(this, null, _handleSort_decorators, { kind: "method", name: "handleSort", static: false, private: false, access: { has: obj => "handleSort" in obj, get: obj => obj.handleSort }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
166
|
-
__esDecorate(this, null, _handleRowSelect_decorators, { kind: "method", name: "handleRowSelect", static: false, private: false, access: { has: obj => "handleRowSelect" in obj, get: obj => obj.handleRowSelect }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
167
|
-
__esDecorate(this, null, _handleSelectAll_decorators, { kind: "method", name: "handleSelectAll", static: false, private: false, access: { has: obj => "handleSelectAll" in obj, get: obj => obj.handleSelectAll }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
168
|
-
__esDecorate(this, null, _handleRowClick_decorators, { kind: "method", name: "handleRowClick", static: false, private: false, access: { has: obj => "handleRowClick" in obj, get: obj => obj.handleRowClick }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
169
|
-
__esDecorate(this, null, _onAttached_decorators, { kind: "method", name: "onAttached", static: false, private: false, access: { has: obj => "onAttached" in obj, get: obj => obj.onAttached }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
170
|
-
__esDecorate(this, null, _handleSearchChange_decorators, { kind: "method", name: "handleSearchChange", static: false, private: false, access: { has: obj => "handleSearchChange" in obj, get: obj => obj.handleSearchChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
171
|
-
__esDecorate(this, null, _handleSelectorChange_decorators, { kind: "method", name: "handleSelectorChange", static: false, private: false, access: { has: obj => "handleSelectorChange" in obj, get: obj => obj.handleSelectorChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
172
267
|
__esDecorate(this, null, _dispatchRowSelectionChanged_decorators, { kind: "method", name: "dispatchRowSelectionChanged", static: false, private: false, access: { has: obj => "dispatchRowSelectionChanged" in obj, get: obj => obj.dispatchRowSelectionChanged }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
173
268
|
__esDecorate(this, null, _dispatchSelectAllChanged_decorators, { kind: "method", name: "dispatchSelectAllChanged", static: false, private: false, access: { has: obj => "dispatchSelectAllChanged" in obj, get: obj => obj.dispatchSelectAllChanged }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
174
269
|
__esDecorate(null, null, _striped_decorators, { kind: "field", name: "striped", static: false, private: false, access: { has: obj => "striped" in obj, get: obj => obj.striped, set: (obj, value) => { obj.striped = value; } }, metadata: _metadata }, _striped_initializers, _striped_extraInitializers);
|
|
175
270
|
__esDecorate(null, null, _searchable_decorators, { kind: "field", name: "searchable", static: false, private: false, access: { has: obj => "searchable" in obj, get: obj => obj.searchable, set: (obj, value) => { obj.searchable = value; } }, metadata: _metadata }, _searchable_initializers, _searchable_extraInitializers);
|
|
271
|
+
__esDecorate(null, null, _filterable_decorators, { kind: "field", name: "filterable", static: false, private: false, access: { has: obj => "filterable" in obj, get: obj => obj.filterable, set: (obj, value) => { obj.filterable = value; } }, metadata: _metadata }, _filterable_initializers, _filterable_extraInitializers);
|
|
176
272
|
__esDecorate(null, null, _sortable_decorators, { kind: "field", name: "sortable", static: false, private: false, access: { has: obj => "sortable" in obj, get: obj => obj.sortable, set: (obj, value) => { obj.sortable = value; } }, metadata: _metadata }, _sortable_initializers, _sortable_extraInitializers);
|
|
177
273
|
__esDecorate(null, null, _selectable_decorators, { kind: "field", name: "selectable", static: false, private: false, access: { has: obj => "selectable" in obj, get: obj => obj.selectable, set: (obj, value) => { obj.selectable = value; } }, metadata: _metadata }, _selectable_initializers, _selectable_extraInitializers);
|
|
178
274
|
__esDecorate(null, null, _hoverable_decorators, { kind: "field", name: "hoverable", static: false, private: false, access: { has: obj => "hoverable" in obj, get: obj => obj.hoverable, set: (obj, value) => { obj.hoverable = value; } }, metadata: _metadata }, _hoverable_initializers, _hoverable_extraInitializers);
|
|
179
275
|
__esDecorate(null, null, _clickable_decorators, { kind: "field", name: "clickable", static: false, private: false, access: { has: obj => "clickable" in obj, get: obj => obj.clickable, set: (obj, value) => { obj.clickable = value; } }, metadata: _metadata }, _clickable_initializers, _clickable_extraInitializers);
|
|
180
|
-
__esDecorate(null, null,
|
|
181
|
-
__esDecorate(null, null,
|
|
276
|
+
__esDecorate(null, null, _list_decorators, { kind: "field", name: "list", static: false, private: false, access: { has: obj => "list" in obj, get: obj => obj.list, set: (obj, value) => { obj.list = value; } }, metadata: _metadata }, _list_initializers, _list_extraInitializers);
|
|
277
|
+
__esDecorate(null, null, _searchDebounce_decorators, { kind: "field", name: "searchDebounce", static: false, private: false, access: { has: obj => "searchDebounce" in obj, get: obj => obj.searchDebounce, set: (obj, value) => { obj.searchDebounce = value; } }, metadata: _metadata }, _searchDebounce_initializers, _searchDebounce_extraInitializers);
|
|
182
278
|
__esDecorate(null, null, _currentSort_decorators, { kind: "field", name: "currentSort", static: false, private: false, access: { has: obj => "currentSort" in obj, get: obj => obj.currentSort, set: (obj, value) => { obj.currentSort = value; } }, metadata: _metadata }, _currentSort_initializers, _currentSort_extraInitializers);
|
|
183
|
-
__esDecorate(null, null, _searchText_decorators, { kind: "field", name: "searchText", static: false, private: false, access: { has: obj => "searchText" in obj, get: obj => obj.searchText, set: (obj, value) => { obj.searchText = value; } }, metadata: _metadata }, _searchText_initializers, _searchText_extraInitializers);
|
|
184
279
|
__esDecorate(null, null, _selector_decorators, { kind: "field", name: "selector", static: false, private: false, access: { has: obj => "selector" in obj, get: obj => obj.selector, set: (obj, value) => { obj.selector = value; } }, metadata: _metadata }, _selector_initializers, _selector_extraInitializers);
|
|
185
280
|
__esDecorate(null, null, _selectorOptions_decorators, { kind: "field", name: "selectorOptions", static: false, private: false, access: { has: obj => "selectorOptions" in obj, get: obj => obj.selectorOptions, set: (obj, value) => { obj.selectorOptions = value; } }, metadata: _metadata }, _selectorOptions_initializers, _selectorOptions_extraInitializers);
|
|
186
281
|
__esDecorate(null, null, _loading_decorators, { kind: "field", name: "loading", static: false, private: false, access: { has: obj => "loading" in obj, get: obj => obj.loading, set: (obj, value) => { obj.loading = value; } }, metadata: _metadata }, _loading_initializers, _loading_extraInitializers);
|
|
@@ -193,6 +288,14 @@ let SniceTable = (() => {
|
|
|
193
288
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
194
289
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
195
290
|
}
|
|
291
|
+
setData(data) {
|
|
292
|
+
this.data = data;
|
|
293
|
+
this.render();
|
|
294
|
+
}
|
|
295
|
+
setColumns(columns) {
|
|
296
|
+
this.columns = columns;
|
|
297
|
+
this.render();
|
|
298
|
+
}
|
|
196
299
|
async *getTableConfig() {
|
|
197
300
|
const config = await (yield {});
|
|
198
301
|
this.columns = config.columns || [];
|
|
@@ -209,9 +312,7 @@ let SniceTable = (() => {
|
|
|
209
312
|
sort: this.currentSort,
|
|
210
313
|
selector: this.selector
|
|
211
314
|
};
|
|
212
|
-
console.log('Requesting table data with params:', params);
|
|
213
315
|
const response = await (yield params);
|
|
214
|
-
console.log('Received table data response:', response);
|
|
215
316
|
this.data = response.data || [];
|
|
216
317
|
this.loading = false;
|
|
217
318
|
this.render();
|
|
@@ -235,17 +336,17 @@ let SniceTable = (() => {
|
|
|
235
336
|
this.dataRequestTimeout = setTimeout(() => {
|
|
236
337
|
this.getTableData();
|
|
237
338
|
this.dataRequestTimeout = null;
|
|
238
|
-
},
|
|
339
|
+
}, 150);
|
|
239
340
|
}
|
|
240
|
-
|
|
241
|
-
return /*css*/ `
|
|
341
|
+
componentStyles() {
|
|
342
|
+
return css /*css*/ `
|
|
242
343
|
:host {
|
|
243
344
|
display: block;
|
|
244
345
|
}
|
|
245
346
|
|
|
246
347
|
.snice-table {
|
|
247
|
-
border-collapse: collapse;
|
|
248
348
|
width: 100%;
|
|
349
|
+
overflow: auto;
|
|
249
350
|
}
|
|
250
351
|
|
|
251
352
|
table {
|
|
@@ -253,15 +354,29 @@ let SniceTable = (() => {
|
|
|
253
354
|
border-collapse: separate;
|
|
254
355
|
border-spacing: 0;
|
|
255
356
|
border-radius: var(--snice-border-radius-lg);
|
|
256
|
-
overflow: hidden;
|
|
257
357
|
border: 1px solid var(--snice-color-border);
|
|
258
358
|
}
|
|
259
359
|
|
|
260
360
|
th, td {
|
|
261
|
-
padding: var(--snice-spacing-
|
|
361
|
+
padding: var(--snice-spacing-xsm) var(--snice-spacing-xsm);
|
|
262
362
|
border: 1px solid var(--snice-color-border);
|
|
263
363
|
text-align: left;
|
|
264
364
|
color: var(--snice-color-text);
|
|
365
|
+
max-width: 0;
|
|
366
|
+
overflow: hidden;
|
|
367
|
+
text-overflow: ellipsis;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
th {
|
|
371
|
+
padding: var(--snice-spacing-sm) var(--snice-spacing-sm);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
th.select-column,
|
|
375
|
+
td.select-column {
|
|
376
|
+
width: 2.5rem;
|
|
377
|
+
max-width: 2.5rem;
|
|
378
|
+
text-align: center;
|
|
379
|
+
padding: var(--snice-spacing-xs);
|
|
265
380
|
}
|
|
266
381
|
|
|
267
382
|
th {
|
|
@@ -306,6 +421,28 @@ let SniceTable = (() => {
|
|
|
306
421
|
background-color: var(--snice-color-background-tertiary);
|
|
307
422
|
}
|
|
308
423
|
|
|
424
|
+
/* List mode - hide vertical borders */
|
|
425
|
+
:host([list]) th,
|
|
426
|
+
:host([list]) td {
|
|
427
|
+
border-left: none;
|
|
428
|
+
border-right: none;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
:host([list]) th:first-child,
|
|
432
|
+
:host([list]) td:first-child {
|
|
433
|
+
border-left: none;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
:host([list]) th:last-child,
|
|
437
|
+
:host([list]) td:last-child {
|
|
438
|
+
border-right: none;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
:host([list]) table {
|
|
442
|
+
border-left: none;
|
|
443
|
+
border-right: none;
|
|
444
|
+
}
|
|
445
|
+
|
|
309
446
|
[part="header"] {
|
|
310
447
|
background-color: var(--snice-color-background);
|
|
311
448
|
}
|
|
@@ -330,13 +467,19 @@ let SniceTable = (() => {
|
|
|
330
467
|
display: none;
|
|
331
468
|
}
|
|
332
469
|
|
|
470
|
+
.search-input,
|
|
471
|
+
.selector-input {
|
|
472
|
+
height: 2.5rem;
|
|
473
|
+
}
|
|
474
|
+
|
|
333
475
|
.search-input {
|
|
334
|
-
min-width:
|
|
476
|
+
min-width: 12.5rem;
|
|
335
477
|
flex: 1;
|
|
336
478
|
}
|
|
337
479
|
|
|
338
480
|
.selector-input {
|
|
339
|
-
min-width:
|
|
481
|
+
min-width: 9.375rem;
|
|
482
|
+
--snice-select-min-height: 2rem;
|
|
340
483
|
}
|
|
341
484
|
|
|
342
485
|
/* Sort indicators */
|
|
@@ -375,7 +518,7 @@ let SniceTable = (() => {
|
|
|
375
518
|
tbody {
|
|
376
519
|
transition: opacity var(--snice-transition-normal);
|
|
377
520
|
}
|
|
378
|
-
|
|
521
|
+
|
|
379
522
|
:host([loading]) tbody {
|
|
380
523
|
opacity: 0.5;
|
|
381
524
|
}
|
|
@@ -385,44 +528,160 @@ let SniceTable = (() => {
|
|
|
385
528
|
padding: var(--snice-spacing-lg);
|
|
386
529
|
color: var(--snice-color-text-secondary);
|
|
387
530
|
}
|
|
531
|
+
|
|
532
|
+
/* Slotted table layout */
|
|
533
|
+
.snice-table--slotted {
|
|
534
|
+
border: 1px solid var(--snice-color-border);
|
|
535
|
+
border-radius: var(--snice-border-radius-lg);
|
|
536
|
+
overflow: hidden;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.snice-table--slotted .table-header {
|
|
540
|
+
display: grid;
|
|
541
|
+
grid-auto-flow: column;
|
|
542
|
+
grid-auto-columns: 1fr;
|
|
543
|
+
background-color: var(--snice-color-background-secondary);
|
|
544
|
+
border-bottom: 2px solid var(--snice-color-border);
|
|
545
|
+
padding: var(--snice-spacing-sm);
|
|
546
|
+
font-weight: var(--snice-font-weight-semibold);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.snice-table--slotted .table-header::slotted(snice-column) {
|
|
550
|
+
padding: var(--snice-spacing-sm);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.snice-table--slotted .table-body {
|
|
554
|
+
display: flex;
|
|
555
|
+
flex-direction: column;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.snice-table--slotted .table-body::slotted(snice-row) {
|
|
559
|
+
border-bottom: 1px solid var(--snice-color-border);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.snice-table--slotted .table-body::slotted(snice-row:last-child) {
|
|
563
|
+
border-bottom: none;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
:host([striped]) .snice-table--slotted .table-body::slotted(snice-row:nth-child(even)) {
|
|
567
|
+
background-color: var(--snice-color-background-secondary);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
:host([hoverable]) .snice-table--slotted .table-body::slotted(snice-row:hover) {
|
|
571
|
+
background-color: var(--snice-color-background-tertiary);
|
|
572
|
+
}
|
|
388
573
|
`;
|
|
389
574
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
575
|
+
renderContent() {
|
|
576
|
+
// Check if we have slotted rows
|
|
577
|
+
const hasSlottedRows = this.querySelectorAll('snice-row[slot="rows"]').length > 0;
|
|
578
|
+
if (hasSlottedRows) {
|
|
579
|
+
// Use slotted rows layout
|
|
580
|
+
return html /*html*/ `
|
|
581
|
+
<div class="snice-table snice-table--slotted" @click=${this.handleClick} @change=${this.handleChange}>
|
|
582
|
+
<div class="table-controls-container"></div>
|
|
583
|
+
<div class="table-header" id="slotted-header"></div>
|
|
584
|
+
<div class="table-body">
|
|
585
|
+
<slot name="rows"></slot>
|
|
586
|
+
</div>
|
|
587
|
+
<slot name="columns" style="display: none;"></slot>
|
|
588
|
+
</div>
|
|
589
|
+
`;
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
// Use traditional table layout
|
|
593
|
+
return html /*html*/ `
|
|
594
|
+
<div class="snice-table" @click=${this.handleClick} @change=${this.handleChange}>
|
|
595
|
+
<div class="table-controls-container"></div>
|
|
596
|
+
<table>
|
|
597
|
+
<thead></thead>
|
|
598
|
+
<tbody></tbody>
|
|
599
|
+
</table>
|
|
600
|
+
</div>
|
|
601
|
+
`;
|
|
602
|
+
}
|
|
400
603
|
}
|
|
401
604
|
renderControls() {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
605
|
+
const container = this.shadowRoot?.querySelector('.table-controls-container');
|
|
606
|
+
if (!container)
|
|
607
|
+
return;
|
|
608
|
+
const showControls = this.searchable || this.filterable;
|
|
609
|
+
if (!showControls) {
|
|
610
|
+
container.innerHTML = '';
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
// Only render if container is empty (first time)
|
|
614
|
+
if (container.children.length === 0) {
|
|
615
|
+
const controlsDiv = document.createElement('div');
|
|
616
|
+
controlsDiv.className = 'table-controls';
|
|
617
|
+
controlsDiv.setAttribute('part', 'controls');
|
|
618
|
+
if (this.searchable) {
|
|
619
|
+
const searchInput = document.createElement('snice-input');
|
|
620
|
+
searchInput.className = 'search-input';
|
|
621
|
+
searchInput.setAttribute('type', 'search');
|
|
622
|
+
searchInput.setAttribute('placeholder', 'Search...');
|
|
623
|
+
searchInput.setAttribute('size', 'medium');
|
|
624
|
+
searchInput.addEventListener('input', this.handleSearchInput);
|
|
625
|
+
controlsDiv.appendChild(searchInput);
|
|
626
|
+
}
|
|
627
|
+
if (this.filterable) {
|
|
628
|
+
const select = document.createElement('snice-select');
|
|
629
|
+
select.className = 'selector-input';
|
|
630
|
+
select.setAttribute('multiple', '');
|
|
631
|
+
select.setAttribute('searchable', '');
|
|
632
|
+
select.setAttribute('clearable', '');
|
|
633
|
+
select.setAttribute('placeholder', 'Filter...');
|
|
634
|
+
select.setAttribute('size', 'medium');
|
|
635
|
+
this.selectorOptions.forEach(opt => {
|
|
636
|
+
const option = document.createElement('snice-option');
|
|
637
|
+
option.setAttribute('value', opt.value);
|
|
638
|
+
option.textContent = opt.label;
|
|
639
|
+
select.appendChild(option);
|
|
640
|
+
});
|
|
641
|
+
controlsDiv.appendChild(select);
|
|
642
|
+
}
|
|
643
|
+
container.appendChild(controlsDiv);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
async initialize() {
|
|
647
|
+
// Listen for controller attached event
|
|
648
|
+
this.addEventListener('@snice/controller-attached', this.onAttached);
|
|
649
|
+
// Listen for select change events from the filter dropdown
|
|
650
|
+
this.addEventListener('@snice/select-change', this.handleSelectorChange);
|
|
651
|
+
// Wait for snice-column to be defined
|
|
652
|
+
await customElements.whenDefined('snice-column');
|
|
653
|
+
await customElements.whenDefined('snice-row');
|
|
654
|
+
// Process slotted columns and rows
|
|
655
|
+
await this.processSlottedContent();
|
|
656
|
+
}
|
|
657
|
+
async processSlottedContent() {
|
|
658
|
+
// Get slotted column elements
|
|
659
|
+
const columnElements = Array.from(this.querySelectorAll('snice-column[slot="columns"]'));
|
|
660
|
+
if (columnElements.length > 0) {
|
|
661
|
+
// Extract column definitions from snice-column elements
|
|
662
|
+
this.columns = columnElements.map((col) => col.getColumnDefinition());
|
|
663
|
+
// Pass column definitions to slotted rows
|
|
664
|
+
const rowElements = Array.from(this.querySelectorAll('snice-row[slot="rows"]'));
|
|
665
|
+
rowElements.forEach((row, index) => {
|
|
666
|
+
row.columns = this.columns;
|
|
667
|
+
row.index = index;
|
|
668
|
+
row.hoverable = this.hoverable;
|
|
669
|
+
row.clickable = this.clickable;
|
|
670
|
+
row.selectable = this.selectable;
|
|
671
|
+
});
|
|
672
|
+
// Render the header for slotted mode (after next tick to ensure DOM is updated)
|
|
673
|
+
requestAnimationFrame(() => this.renderSlottedHeader());
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
renderSlottedHeader() {
|
|
677
|
+
const headerContainer = this.shadowRoot?.querySelector('#slotted-header');
|
|
678
|
+
if (!headerContainer || this.columns.length === 0)
|
|
679
|
+
return;
|
|
680
|
+
// Render column headers
|
|
681
|
+
headerContainer.innerHTML = this.columns.map(col => `<div class="header-cell">${col.label}</div>`).join('');
|
|
423
682
|
}
|
|
424
683
|
render() {
|
|
425
|
-
|
|
684
|
+
this.renderControls();
|
|
426
685
|
this.renderHeader();
|
|
427
686
|
this.renderBody();
|
|
428
687
|
}
|
|
@@ -460,6 +719,7 @@ let SniceTable = (() => {
|
|
|
460
719
|
const headerRow = document.createElement('tr');
|
|
461
720
|
if (this.selectable) {
|
|
462
721
|
const selectCell = document.createElement('th');
|
|
722
|
+
selectCell.className = 'select-column';
|
|
463
723
|
const allSelected = this.selectedRows.length === this.data.length && this.data.length > 0;
|
|
464
724
|
const someSelected = this.selectedRows.length > 0 && this.selectedRows.length < this.data.length;
|
|
465
725
|
selectCell.innerHTML = `<input type="checkbox" class="select-all" ${allSelected ? 'checked' : ''} />`;
|
|
@@ -505,10 +765,11 @@ let SniceTable = (() => {
|
|
|
505
765
|
orderNumber = `<span class="sort-order">${sortIndex + 1}</span>`;
|
|
506
766
|
}
|
|
507
767
|
}
|
|
768
|
+
const indicatorClasses = ['sort-indicator', isActive ? 'active' : ''].filter(Boolean).join(' ');
|
|
508
769
|
return `
|
|
509
770
|
<div class="sort-header">
|
|
510
771
|
<span>${column.label}</span>
|
|
511
|
-
<div class="
|
|
772
|
+
<div class="${indicatorClasses}">
|
|
512
773
|
${indicator}
|
|
513
774
|
${orderNumber}
|
|
514
775
|
</div>
|
|
@@ -518,7 +779,6 @@ let SniceTable = (() => {
|
|
|
518
779
|
renderBody() {
|
|
519
780
|
if (!this.tbody)
|
|
520
781
|
return;
|
|
521
|
-
console.log('renderBody called with data:', this.data.length, 'columns:', this.columns.length, 'loading:', this.loading);
|
|
522
782
|
this.tbody.innerHTML = '';
|
|
523
783
|
if (this.data.length === 0 && this.columns.length > 0) {
|
|
524
784
|
if (this.loading) {
|
|
@@ -546,6 +806,7 @@ let SniceTable = (() => {
|
|
|
546
806
|
return;
|
|
547
807
|
}
|
|
548
808
|
}
|
|
809
|
+
const fragment = document.createDocumentFragment();
|
|
549
810
|
this.data.forEach((rowData, index) => {
|
|
550
811
|
const tr = document.createElement('tr');
|
|
551
812
|
tr.setAttribute('data-index', String(index));
|
|
@@ -554,6 +815,7 @@ let SniceTable = (() => {
|
|
|
554
815
|
tr.setAttribute('data-selected', String(isSelected));
|
|
555
816
|
if (this.selectable) {
|
|
556
817
|
const selectCell = document.createElement('td');
|
|
818
|
+
selectCell.className = 'select-column';
|
|
557
819
|
selectCell.innerHTML = `<input type="checkbox" class="row-select" ${isSelected ? 'checked' : ''} data-row-index="${index}" />`;
|
|
558
820
|
tr.appendChild(selectCell);
|
|
559
821
|
}
|
|
@@ -566,8 +828,9 @@ let SniceTable = (() => {
|
|
|
566
828
|
td.innerHTML = `<${cellTagName} ${attributes}></${cellTagName}>`;
|
|
567
829
|
tr.appendChild(td);
|
|
568
830
|
});
|
|
569
|
-
|
|
831
|
+
fragment.appendChild(tr);
|
|
570
832
|
});
|
|
833
|
+
this.tbody.appendChild(fragment);
|
|
571
834
|
}
|
|
572
835
|
getCellAttributes(column, value) {
|
|
573
836
|
const attributes = [
|
|
@@ -626,91 +889,12 @@ let SniceTable = (() => {
|
|
|
626
889
|
return 'snice-cell-filesize';
|
|
627
890
|
case 'sparkline':
|
|
628
891
|
return 'snice-cell-sparkline';
|
|
892
|
+
case 'image':
|
|
893
|
+
return 'snice-cell-image';
|
|
629
894
|
default:
|
|
630
895
|
return 'snice-cell';
|
|
631
896
|
}
|
|
632
897
|
}
|
|
633
|
-
handleSort(e) {
|
|
634
|
-
const th = e.target.closest('th.sortable');
|
|
635
|
-
if (!th)
|
|
636
|
-
return;
|
|
637
|
-
const columnKey = th.getAttribute('data-key');
|
|
638
|
-
if (columnKey) {
|
|
639
|
-
console.log('Sorting column:', columnKey);
|
|
640
|
-
this.toggleSort(columnKey, true); // Always multi-sort
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
handleRowSelect(e) {
|
|
644
|
-
const checkbox = e.target;
|
|
645
|
-
const rowIndex = parseInt(checkbox.getAttribute('data-row-index') || '0');
|
|
646
|
-
if (checkbox.checked) {
|
|
647
|
-
if (!this.selectedRows.includes(rowIndex)) {
|
|
648
|
-
this.selectedRows = [...this.selectedRows, rowIndex];
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
else {
|
|
652
|
-
this.selectedRows = this.selectedRows.filter(i => i !== rowIndex);
|
|
653
|
-
}
|
|
654
|
-
this.updateRowSelectionState();
|
|
655
|
-
this.updateSelectAllState();
|
|
656
|
-
this.dispatchRowSelectionChanged(rowIndex, checkbox.checked);
|
|
657
|
-
}
|
|
658
|
-
handleSelectAll(e) {
|
|
659
|
-
const checkbox = e.target;
|
|
660
|
-
if (checkbox.checked) {
|
|
661
|
-
this.selectedRows = this.data.map((_, index) => index);
|
|
662
|
-
}
|
|
663
|
-
else {
|
|
664
|
-
this.selectedRows = [];
|
|
665
|
-
}
|
|
666
|
-
this.updateRowSelectionState();
|
|
667
|
-
this.dispatchSelectAllChanged(checkbox.checked);
|
|
668
|
-
}
|
|
669
|
-
handleRowClick(e) {
|
|
670
|
-
const tr = e.target.closest('tr');
|
|
671
|
-
if (!tr)
|
|
672
|
-
return;
|
|
673
|
-
const target = e.target;
|
|
674
|
-
// Don't trigger if clicking on checkbox or other interactive elements
|
|
675
|
-
if (target.matches('input[type="checkbox"], button, a, .interactive')) {
|
|
676
|
-
return;
|
|
677
|
-
}
|
|
678
|
-
const rowIndex = parseInt(tr.getAttribute('data-index') || '0');
|
|
679
|
-
const rowData = this.data[rowIndex];
|
|
680
|
-
// Handle row selection if selectable
|
|
681
|
-
if (this.selectable) {
|
|
682
|
-
const isCurrentlySelected = this.selectedRows.includes(rowIndex);
|
|
683
|
-
if (isCurrentlySelected) {
|
|
684
|
-
this.selectedRows = this.selectedRows.filter(i => i !== rowIndex);
|
|
685
|
-
}
|
|
686
|
-
else {
|
|
687
|
-
this.selectedRows = [...this.selectedRows, rowIndex];
|
|
688
|
-
}
|
|
689
|
-
this.updateRowSelectionState();
|
|
690
|
-
this.updateSelectAllState();
|
|
691
|
-
this.dispatchRowSelectionChanged(rowIndex, !isCurrentlySelected);
|
|
692
|
-
}
|
|
693
|
-
// Handle clickable row event
|
|
694
|
-
if (this.clickable) {
|
|
695
|
-
this.dispatchEvent(new CustomEvent('row-clicked', {
|
|
696
|
-
detail: { rowData, rowIndex }
|
|
697
|
-
}));
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
onAttached() {
|
|
701
|
-
console.log('Controller attached, loading config and data...');
|
|
702
|
-
this.getTableConfig();
|
|
703
|
-
this.getTableData();
|
|
704
|
-
}
|
|
705
|
-
handleSearchChange(e) {
|
|
706
|
-
const input = e.target;
|
|
707
|
-
this.searchText = input.value;
|
|
708
|
-
this.debouncedDataRequest();
|
|
709
|
-
}
|
|
710
|
-
handleSelectorChange(e) {
|
|
711
|
-
this.selector = Array.isArray(e.detail.value) ? e.detail.value.join(',') : e.detail.value;
|
|
712
|
-
this.debouncedDataRequest();
|
|
713
|
-
}
|
|
714
898
|
updateRowSelectionState() {
|
|
715
899
|
if (!this.tbody)
|
|
716
900
|
return;
|
|
@@ -734,7 +918,6 @@ let SniceTable = (() => {
|
|
|
734
918
|
selectAllCheckbox.indeterminate = someSelected;
|
|
735
919
|
}
|
|
736
920
|
toggleSort(columnKey, multiSort = false) {
|
|
737
|
-
console.log('toggleSort called:', { columnKey, multiSort, currentSort: this.currentSort });
|
|
738
921
|
if (!multiSort) {
|
|
739
922
|
// Single column sort - clear all other sorts
|
|
740
923
|
const existingSort = this.currentSort.find(s => s.column === columnKey);
|
|
@@ -767,7 +950,6 @@ let SniceTable = (() => {
|
|
|
767
950
|
}
|
|
768
951
|
}
|
|
769
952
|
}
|
|
770
|
-
console.log('New sort state:', this.currentSort);
|
|
771
953
|
this.renderHeader(); // Update sort indicators immediately
|
|
772
954
|
this.debouncedDataRequest(); // Show loading immediately, debounce the actual request
|
|
773
955
|
}
|