snice 2.1.5 → 2.2.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/dist/components/accordion/snice-accordion-item.d.ts +25 -0
- package/dist/components/accordion/snice-accordion-item.js +255 -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 +206 -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/alert/snice-alert.d.ts +26 -0
- package/dist/components/alert/snice-alert.js +180 -0
- package/dist/components/alert/snice-alert.js.map +1 -0
- package/{components/alert/snice-alert.types.ts → dist/components/alert/snice-alert.types.d.ts} +8 -9
- package/dist/components/avatar/snice-avatar.d.ts +24 -0
- package/dist/components/avatar/snice-avatar.js +180 -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/badge/snice-badge.d.ts +25 -0
- package/dist/components/badge/snice-badge.js +169 -0
- package/dist/components/badge/snice-badge.js.map +1 -0
- package/{components/badge/snice-badge.types.ts → dist/components/badge/snice-badge.types.d.ts} +11 -12
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +27 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +214 -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-crumb.d.ts +9 -0
- package/dist/components/breadcrumbs/snice-crumb.js +63 -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 +232 -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/card/snice-card.d.ts +19 -0
- package/dist/components/card/snice-card.js +136 -0
- package/dist/components/card/snice-card.js.map +1 -0
- package/{components/card/snice-card.types.ts → dist/components/card/snice-card.types.d.ts} +6 -7
- package/dist/components/checkbox/snice-checkbox.d.ts +34 -0
- package/dist/components/checkbox/snice-checkbox.js +286 -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/chip/snice-chip.d.ts +28 -0
- package/dist/components/chip/snice-chip.js +199 -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/date-picker/snice-date-picker.d.ts +82 -0
- package/dist/components/date-picker/snice-date-picker.js +847 -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/divider/snice-divider.d.ts +17 -0
- package/dist/components/divider/snice-divider.js +122 -0
- package/dist/components/divider/snice-divider.js.map +1 -0
- package/{components/divider/snice-divider.types.ts → dist/components/divider/snice-divider.types.d.ts} +9 -10
- package/dist/components/drawer/snice-drawer.d.ts +37 -0
- package/dist/components/drawer/snice-drawer.js +337 -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/input/snice-input.d.ts +65 -0
- package/dist/components/input/snice-input.js +567 -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/layout/snice-layout-blog.d.ts +4 -0
- package/dist/components/layout/snice-layout-blog.js +67 -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 +64 -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 +48 -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 +64 -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 +60 -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 +66 -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 +38 -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 +74 -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 +58 -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 +54 -0
- package/dist/components/layout/snice-layout.js.map +1 -0
- package/{components/layout/snice-layout.types.ts → dist/components/layout/snice-layout.types.d.ts} +1 -3
- package/dist/components/login/snice-login.d.ts +44 -0
- package/dist/components/login/snice-login.js +382 -0
- package/dist/components/login/snice-login.js.map +1 -0
- package/dist/components/login/snice-login.types.d.ts +26 -0
- package/dist/components/modal/snice-modal.d.ts +32 -0
- package/dist/components/modal/snice-modal.js +280 -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/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/progress/snice-progress.d.ts +35 -0
- package/dist/components/progress/snice-progress.js +305 -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/radio/snice-radio.d.ts +33 -0
- package/dist/components/radio/snice-radio.js +279 -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/select/snice-option.d.ts +17 -0
- package/dist/components/select/snice-option.js +88 -0
- package/dist/components/select/snice-option.js.map +1 -0
- package/{components/select/snice-option.types.ts → dist/components/select/snice-option.types.d.ts} +8 -8
- package/dist/components/select/snice-select.d.ts +89 -0
- package/dist/components/select/snice-select.js +864 -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/skeleton/snice-skeleton.d.ts +16 -0
- package/dist/components/skeleton/snice-skeleton.js +166 -0
- package/dist/components/skeleton/snice-skeleton.js.map +1 -0
- package/{components/skeleton/snice-skeleton.types.ts → dist/components/skeleton/snice-skeleton.types.d.ts} +7 -8
- package/dist/components/snice-cell-C8aBfN72.js +4 -0
- package/dist/components/snice-cell-C8aBfN72.js.map +1 -0
- package/dist/components/switch/snice-switch.d.ts +38 -0
- package/dist/components/switch/snice-switch.js +305 -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/symbols.d.ts +1 -0
- package/dist/components/symbols.js +22 -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 +164 -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 +253 -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 +130 -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 +126 -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 +215 -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 +121 -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 +120 -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 +306 -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 +161 -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 +458 -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 +506 -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 +289 -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 +105 -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 +81 -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 +353 -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 +792 -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/tabs/snice-tab-panel.d.ts +12 -0
- package/dist/components/tabs/snice-tab-panel.js +87 -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 +98 -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 +375 -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/toast/snice-toast-container.d.ts +25 -0
- package/dist/components/toast/snice-toast-container.js +252 -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 +321 -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/tooltip/snice-tooltip.d.ts +50 -0
- package/dist/components/tooltip/snice-tooltip.js +644 -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/transitions.d.ts +11 -0
- package/dist/components/transitions.js +72 -0
- package/dist/components/transitions.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.esm.js +1 -1
- package/package.json +10 -6
- package/components/accordion/demo.html +0 -403
- package/components/accordion/snice-accordion-item.css +0 -85
- package/components/accordion/snice-accordion-item.ts +0 -226
- package/components/accordion/snice-accordion.css +0 -31
- package/components/accordion/snice-accordion.ts +0 -182
- package/components/accordion/snice-accordion.types.ts +0 -32
- package/components/alert/demo.html +0 -445
- package/components/alert/snice-alert.css +0 -195
- package/components/alert/snice-alert.ts +0 -141
- package/components/avatar/demo.html +0 -598
- package/components/avatar/snice-avatar.css +0 -131
- package/components/avatar/snice-avatar.ts +0 -136
- package/components/avatar/snice-avatar.types.ts +0 -13
- package/components/badge/demo.html +0 -523
- package/components/badge/snice-badge.css +0 -161
- package/components/badge/snice-badge.ts +0 -117
- package/components/breadcrumbs/demo.html +0 -404
- package/components/breadcrumbs/snice-breadcrumbs.css +0 -133
- package/components/breadcrumbs/snice-breadcrumbs.ts +0 -191
- package/components/breadcrumbs/snice-breadcrumbs.types.ts +0 -26
- package/components/breadcrumbs/snice-crumb.ts +0 -26
- package/components/button/demo.html +0 -42
- package/components/button/snice-button.css +0 -230
- package/components/button/snice-button.ts +0 -169
- package/components/button/snice-button.types.ts +0 -25
- package/components/card/demo.html +0 -525
- package/components/card/snice-card.css +0 -140
- package/components/card/snice-card.ts +0 -102
- package/components/checkbox/demo.html +0 -253
- package/components/checkbox/snice-checkbox.css +0 -164
- package/components/checkbox/snice-checkbox.ts +0 -223
- package/components/checkbox/snice-checkbox.types.ts +0 -22
- package/components/chip/demo.html +0 -383
- package/components/chip/snice-chip.css +0 -195
- package/components/chip/snice-chip.ts +0 -139
- package/components/chip/snice-chip.types.ts +0 -15
- package/components/date-picker/README.md +0 -233
- package/components/date-picker/demo.html +0 -191
- package/components/date-picker/snice-date-picker.css +0 -330
- package/components/date-picker/snice-date-picker.ts +0 -777
- package/components/date-picker/snice-date-picker.types.ts +0 -83
- package/components/divider/demo.html +0 -233
- package/components/divider/snice-divider.css +0 -155
- package/components/divider/snice-divider.ts +0 -69
- package/components/drawer/demo.html +0 -328
- package/components/drawer/snice-drawer.css +0 -476
- package/components/drawer/snice-drawer.ts +0 -287
- package/components/drawer/snice-drawer.types.ts +0 -17
- package/components/global.d.ts +0 -14
- package/components/input/demo.html +0 -303
- package/components/input/snice-input.css +0 -257
- package/components/input/snice-input.ts +0 -442
- package/components/input/snice-input.types.ts +0 -59
- package/components/input/test.html +0 -77
- package/components/layout/README.md +0 -260
- package/components/layout/demo.html +0 -538
- package/components/layout/snice-layout-blog.css +0 -129
- package/components/layout/snice-layout-blog.ts +0 -48
- package/components/layout/snice-layout-card.css +0 -104
- package/components/layout/snice-layout-card.ts +0 -35
- package/components/layout/snice-layout-centered.css +0 -51
- package/components/layout/snice-layout-centered.ts +0 -22
- package/components/layout/snice-layout-dashboard.css +0 -98
- package/components/layout/snice-layout-dashboard.ts +0 -45
- package/components/layout/snice-layout-fullscreen.css +0 -72
- package/components/layout/snice-layout-fullscreen.ts +0 -34
- package/components/layout/snice-layout-landing.css +0 -92
- package/components/layout/snice-layout-landing.ts +0 -47
- package/components/layout/snice-layout-minimal.css +0 -16
- package/components/layout/snice-layout-minimal.ts +0 -19
- package/components/layout/snice-layout-sidebar.css +0 -117
- package/components/layout/snice-layout-sidebar.ts +0 -48
- package/components/layout/snice-layout-split.css +0 -103
- package/components/layout/snice-layout-split.ts +0 -29
- package/components/layout/snice-layout.css +0 -72
- package/components/layout/snice-layout.ts +0 -35
- package/components/login/demo-auth-controller.ts +0 -185
- package/components/login/demo.html +0 -470
- package/components/login/snice-login.css +0 -204
- package/components/login/snice-login.ts +0 -326
- package/components/login/snice-login.types.ts +0 -29
- package/components/modal/demo.html +0 -291
- package/components/modal/snice-modal.css +0 -203
- package/components/modal/snice-modal.ts +0 -233
- package/components/modal/snice-modal.types.ts +0 -21
- package/components/pagination/demo.html +0 -395
- package/components/pagination/snice-pagination.ts +0 -333
- package/components/pagination/snice-pagination.types.ts +0 -21
- package/components/progress/demo.html +0 -510
- package/components/progress/snice-progress.css +0 -267
- package/components/progress/snice-progress.ts +0 -247
- package/components/progress/snice-progress.types.ts +0 -19
- package/components/radio/demo.html +0 -287
- package/components/radio/snice-radio.css +0 -171
- package/components/radio/snice-radio.ts +0 -218
- package/components/radio/snice-radio.types.ts +0 -21
- package/components/select/demo.html +0 -511
- package/components/select/snice-option.ts +0 -52
- package/components/select/snice-select.css +0 -392
- package/components/select/snice-select.ts +0 -796
- package/components/select/snice-select.types.ts +0 -55
- package/components/skeleton/demo.html +0 -514
- package/components/skeleton/snice-skeleton.css +0 -109
- package/components/skeleton/snice-skeleton.ts +0 -126
- package/components/switch/demo.html +0 -284
- package/components/switch/snice-switch.css +0 -221
- package/components/switch/snice-switch.ts +0 -229
- package/components/switch/snice-switch.types.ts +0 -23
- package/components/symbols.ts +0 -23
- package/components/table/demo-table-controller.ts +0 -100
- package/components/table/demo.html +0 -480
- package/components/table/snice-cell-boolean.ts +0 -112
- package/components/table/snice-cell-date.ts +0 -210
- package/components/table/snice-cell-duration.ts +0 -91
- package/components/table/snice-cell-filesize.ts +0 -90
- package/components/table/snice-cell-number.ts +0 -165
- package/components/table/snice-cell-progress.ts +0 -83
- package/components/table/snice-cell-rating.ts +0 -82
- package/components/table/snice-cell-sparkline.ts +0 -253
- package/components/table/snice-cell-text.ts +0 -125
- package/components/table/snice-cell.css +0 -296
- package/components/table/snice-cell.ts +0 -473
- package/components/table/snice-column.ts +0 -353
- package/components/table/snice-header.css +0 -243
- package/components/table/snice-header.ts +0 -261
- package/components/table/snice-progress.ts +0 -66
- package/components/table/snice-rating.ts +0 -45
- package/components/table/snice-row.css +0 -255
- package/components/table/snice-row.ts +0 -331
- package/components/table/snice-table.css +0 -241
- package/components/table/snice-table.ts +0 -737
- package/components/table/snice-table.types.ts +0 -158
- package/components/tabs/demo.html +0 -487
- package/components/tabs/snice-tab-panel.css +0 -264
- package/components/tabs/snice-tab-panel.ts +0 -47
- package/components/tabs/snice-tab.css +0 -96
- package/components/tabs/snice-tab.ts +0 -65
- package/components/tabs/snice-tabs.css +0 -189
- package/components/tabs/snice-tabs.ts +0 -332
- package/components/tabs/snice-tabs.types.ts +0 -28
- package/components/theme/theme.css +0 -234
- package/components/toast/demo.html +0 -329
- package/components/toast/snice-toast-container.ts +0 -256
- package/components/toast/snice-toast.css +0 -213
- package/components/toast/snice-toast.ts +0 -276
- package/components/toast/snice-toast.types.ts +0 -35
- package/components/tooltip/demo.html +0 -350
- package/components/tooltip/snice-tooltip-portal.css +0 -79
- package/components/tooltip/snice-tooltip.css +0 -117
- package/components/tooltip/snice-tooltip.ts +0 -612
- package/components/tooltip/snice-tooltip.types.ts +0 -32
- package/components/transitions.ts +0 -94
- package/components/tsconfig.json +0 -18
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Snice Table Demo</title>
|
|
7
|
-
<link rel="stylesheet" href="../theme/theme.css">
|
|
8
|
-
<style>
|
|
9
|
-
body {
|
|
10
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
11
|
-
margin: 0;
|
|
12
|
-
padding: 2rem;
|
|
13
|
-
background: var(--snice-color-background-secondary);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.demo-container {
|
|
17
|
-
max-width: 1200px;
|
|
18
|
-
margin: 0 auto;
|
|
19
|
-
border-radius: 0.5rem;
|
|
20
|
-
padding: 2rem;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
h1 {
|
|
24
|
-
color: #333;
|
|
25
|
-
margin-bottom: 2rem;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.demo-section {
|
|
29
|
-
margin-bottom: 3rem;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.demo-section h2 {
|
|
33
|
-
color: #555;
|
|
34
|
-
border-bottom: 2px solid #e9ecef;
|
|
35
|
-
padding-bottom: 0.5rem;
|
|
36
|
-
margin-bottom: 1.5rem;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.demo-controls {
|
|
40
|
-
margin-bottom: 1rem;
|
|
41
|
-
display: flex;
|
|
42
|
-
gap: 1rem;
|
|
43
|
-
flex-wrap: wrap;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.demo-controls button {
|
|
47
|
-
padding: 0.5rem 1rem;
|
|
48
|
-
border: 1px solid #007bff;
|
|
49
|
-
background: #007bff;
|
|
50
|
-
color: white;
|
|
51
|
-
border-radius: 0.25rem;
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
font-size: 0.875rem;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.demo-controls button:hover {
|
|
57
|
-
background: #0056b3;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.demo-controls button.secondary {
|
|
61
|
-
background: white;
|
|
62
|
-
color: #007bff;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.demo-controls button.secondary:hover {
|
|
66
|
-
background: #f8f9fa;
|
|
67
|
-
}
|
|
68
|
-
</style>
|
|
69
|
-
</head>
|
|
70
|
-
<body>
|
|
71
|
-
<div class="demo-container">
|
|
72
|
-
<h1>🗂️ Snice Table Component Demo</h1>
|
|
73
|
-
|
|
74
|
-
<div class="demo-section">
|
|
75
|
-
<h2>Basic Table with Declarative Columns</h2>
|
|
76
|
-
<div class="demo-controls">
|
|
77
|
-
<button onclick="toggleSearch()">Toggle Search</button>
|
|
78
|
-
<button onclick="togglePagination()">Toggle Pagination</button>
|
|
79
|
-
<button onclick="toggleSorting()">Toggle Sorting</button>
|
|
80
|
-
<button onclick="toggleSelection()">Toggle Selection</button>
|
|
81
|
-
<button class="secondary" onclick="addRandomRow()">Add Random Row</button>
|
|
82
|
-
<button class="secondary" onclick="loadSampleData()">Load Sample Data</button>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<snice-table
|
|
86
|
-
id="demo-table"
|
|
87
|
-
searchable
|
|
88
|
-
sortable
|
|
89
|
-
selectable
|
|
90
|
-
controller="demo-table-controller">
|
|
91
|
-
</snice-table>
|
|
92
|
-
</div>
|
|
93
|
-
|
|
94
|
-
<div class="demo-section">
|
|
95
|
-
<h2>Advanced Table with Sparklines and Progress</h2>
|
|
96
|
-
|
|
97
|
-
<snice-table
|
|
98
|
-
id="analytics-table"
|
|
99
|
-
size="medium"
|
|
100
|
-
hoverable
|
|
101
|
-
sortable
|
|
102
|
-
striped>
|
|
103
|
-
|
|
104
|
-
<snice-column
|
|
105
|
-
slot="columns"
|
|
106
|
-
key="metric"
|
|
107
|
-
label="Metric"
|
|
108
|
-
type="text">
|
|
109
|
-
</snice-column>
|
|
110
|
-
|
|
111
|
-
<snice-column
|
|
112
|
-
slot="columns"
|
|
113
|
-
key="value"
|
|
114
|
-
label="Current Value"
|
|
115
|
-
type="number"
|
|
116
|
-
decimals="1"
|
|
117
|
-
thousands-separator="true">
|
|
118
|
-
</snice-column>
|
|
119
|
-
|
|
120
|
-
<snice-column
|
|
121
|
-
slot="columns"
|
|
122
|
-
key="progress"
|
|
123
|
-
label="Progress"
|
|
124
|
-
type="progress"
|
|
125
|
-
progress-max="100"
|
|
126
|
-
show-percentage="true">
|
|
127
|
-
</snice-column>
|
|
128
|
-
|
|
129
|
-
<snice-column
|
|
130
|
-
slot="columns"
|
|
131
|
-
key="trend"
|
|
132
|
-
label="Trend (7 days)"
|
|
133
|
-
type="sparkline"
|
|
134
|
-
sparkline-type="line"
|
|
135
|
-
sparkline-color="#007bff"
|
|
136
|
-
sparkline-width="80"
|
|
137
|
-
sparkline-height="30">
|
|
138
|
-
</snice-column>
|
|
139
|
-
|
|
140
|
-
<snice-row slot="rows"
|
|
141
|
-
data-metric="Revenue"
|
|
142
|
-
data-value="125340"
|
|
143
|
-
data-progress="78"
|
|
144
|
-
data-trend="[45000, 47000, 49000, 52000, 48000, 53000, 55000]">
|
|
145
|
-
</snice-row>
|
|
146
|
-
<snice-row slot="rows"
|
|
147
|
-
data-metric="Users"
|
|
148
|
-
data-value="8250"
|
|
149
|
-
data-progress="92"
|
|
150
|
-
data-trend="[7800, 7950, 8100, 8200, 8150, 8300, 8250]">
|
|
151
|
-
</snice-row>
|
|
152
|
-
<snice-row slot="rows"
|
|
153
|
-
data-metric="Conversion"
|
|
154
|
-
data-value="3.4"
|
|
155
|
-
data-progress="68"
|
|
156
|
-
data-trend="[3.1, 3.2, 3.3, 3.5, 3.3, 3.4, 3.4]">
|
|
157
|
-
</snice-row>
|
|
158
|
-
<snice-row slot="rows"
|
|
159
|
-
data-metric="Retention"
|
|
160
|
-
data-value="89.2"
|
|
161
|
-
data-progress="89"
|
|
162
|
-
data-trend="[87, 88, 89, 90, 89, 88, 89]">
|
|
163
|
-
</snice-row>
|
|
164
|
-
</snice-table>
|
|
165
|
-
</div>
|
|
166
|
-
|
|
167
|
-
<div class="demo-section">
|
|
168
|
-
<h2>Individual Cell Components</h2>
|
|
169
|
-
|
|
170
|
-
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem;">
|
|
171
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
172
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Text Cell</h3>
|
|
173
|
-
<snice-cell-text value="Hello World"></snice-cell-text>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
177
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Number Cell (Basic)</h3>
|
|
178
|
-
<snice-cell-number value="1234.56" thousands-separator="true" decimals="2"></snice-cell-number>
|
|
179
|
-
</div>
|
|
180
|
-
|
|
181
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
182
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Number Cell (Currency)</h3>
|
|
183
|
-
<snice-cell-number value="1234.56" prefix="$" thousands-separator="true" decimals="2"></snice-cell-number>
|
|
184
|
-
</div>
|
|
185
|
-
|
|
186
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
187
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Number Cell (Negative)</h3>
|
|
188
|
-
<snice-cell-number value="-456.78" negative-style="parentheses" thousands-separator="true" decimals="2"></snice-cell-number>
|
|
189
|
-
</div>
|
|
190
|
-
|
|
191
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
192
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Date Cell (Short)</h3>
|
|
193
|
-
<snice-cell-date value="2023-12-25" date-format="short"></snice-cell-date>
|
|
194
|
-
</div>
|
|
195
|
-
|
|
196
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
197
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Date Cell (Long)</h3>
|
|
198
|
-
<snice-cell-date value="2023-12-25" date-format="long"></snice-cell-date>
|
|
199
|
-
</div>
|
|
200
|
-
|
|
201
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
202
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Date Cell (Custom)</h3>
|
|
203
|
-
<snice-cell-date value="2023-12-25" date-format="custom" custom-format="DD/MM/YYYY"></snice-cell-date>
|
|
204
|
-
</div>
|
|
205
|
-
|
|
206
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
207
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Sparkline (Line)</h3>
|
|
208
|
-
<snice-cell-sparkline data="10,20,15,25,30,18,22" chart-type="line" width="80" height="30" color="#3b82f6"></snice-cell-sparkline>
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
212
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Sparkline (Bar)</h3>
|
|
213
|
-
<snice-cell-sparkline data="10,20,15,25,30,18,22" chart-type="bar" width="80" height="30" color="#10b981"></snice-cell-sparkline>
|
|
214
|
-
</div>
|
|
215
|
-
|
|
216
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
217
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Sparkline (Area)</h3>
|
|
218
|
-
<snice-cell-sparkline data="10,20,15,25,30,18,22" chart-type="area" width="80" height="30" color="#f59e0b"></snice-cell-sparkline>
|
|
219
|
-
</div>
|
|
220
|
-
|
|
221
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
222
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Boolean (Symbols)</h3>
|
|
223
|
-
<snice-cell-boolean value="true" use-symbols="true" true-symbol="✅" false-symbol="❌"></snice-cell-boolean>
|
|
224
|
-
</div>
|
|
225
|
-
|
|
226
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
227
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Boolean (Text)</h3>
|
|
228
|
-
<snice-cell-boolean value="false" use-symbols="false" true-value="Yes" false-value="No"></snice-cell-boolean>
|
|
229
|
-
</div>
|
|
230
|
-
|
|
231
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
232
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Rating (4/5 Stars)</h3>
|
|
233
|
-
<snice-cell-rating value="4"></snice-cell-rating>
|
|
234
|
-
</div>
|
|
235
|
-
|
|
236
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
237
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Rating (3/10 Custom)</h3>
|
|
238
|
-
<snice-cell-rating value="3"></snice-cell-rating>
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
242
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Progress (75%)</h3>
|
|
243
|
-
<snice-cell-progress value="75"></snice-cell-progress>
|
|
244
|
-
</div>
|
|
245
|
-
|
|
246
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
247
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Progress w/ %</h3>
|
|
248
|
-
<snice-cell-progress id="progress-with-percent" value="45"></snice-cell-progress>
|
|
249
|
-
</div>
|
|
250
|
-
|
|
251
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
252
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Duration (1h 1m 1s)</h3>
|
|
253
|
-
<snice-cell-duration value="3661"></snice-cell-duration>
|
|
254
|
-
</div>
|
|
255
|
-
|
|
256
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
257
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">Duration (5m 30s)</h3>
|
|
258
|
-
<snice-cell-duration value="330"></snice-cell-duration>
|
|
259
|
-
</div>
|
|
260
|
-
|
|
261
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
262
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">FileSize (2.0 MB)</h3>
|
|
263
|
-
<snice-cell-filesize value="2048576"></snice-cell-filesize>
|
|
264
|
-
</div>
|
|
265
|
-
|
|
266
|
-
<div style="padding: 1rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;">
|
|
267
|
-
<h3 style="margin-top: 0; font-size: 0.875rem; color: #666;">FileSize (1.5 GB)</h3>
|
|
268
|
-
<snice-cell-filesize value="1610612736"></snice-cell-filesize>
|
|
269
|
-
</div>
|
|
270
|
-
</div>
|
|
271
|
-
</div>
|
|
272
|
-
|
|
273
|
-
<div class="demo-section">
|
|
274
|
-
<h2>Individual Row Components</h2>
|
|
275
|
-
|
|
276
|
-
<div style="margin-bottom: 1rem;">
|
|
277
|
-
<h3 style="font-size: 1rem; color: #666; margin-bottom: 0.5rem;">Employee Row (Text, Number, Date, Boolean)</h3>
|
|
278
|
-
<snice-row id="employee-row" style="display: block; padding: 0.5rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;"></snice-row>
|
|
279
|
-
</div>
|
|
280
|
-
|
|
281
|
-
<div style="margin-bottom: 1rem;">
|
|
282
|
-
<h3 style="font-size: 1rem; color: #666; margin-bottom: 0.5rem;">Analytics Row (Text, Numbers, Progress, Sparkline)</h3>
|
|
283
|
-
<snice-row id="analytics-row" style="display: block; padding: 0.5rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;"></snice-row>
|
|
284
|
-
</div>
|
|
285
|
-
|
|
286
|
-
<div style="margin-bottom: 1rem;">
|
|
287
|
-
<h3 style="font-size: 1rem; color: #666; margin-bottom: 0.5rem;">System Row (Text, FileSize, Duration, Rating)</h3>
|
|
288
|
-
<snice-row id="system-row" style="display: block; padding: 0.5rem; border: 1px solid #e9ecef; border-radius: 0.5rem; background: #f8f9fa;"></snice-row>
|
|
289
|
-
</div>
|
|
290
|
-
</div>
|
|
291
|
-
</div>
|
|
292
|
-
|
|
293
|
-
<script type="module">
|
|
294
|
-
// Import controller first to register it
|
|
295
|
-
import './demo-table-controller.ts';
|
|
296
|
-
// Then import the table component
|
|
297
|
-
import './snice-table.ts';
|
|
298
|
-
|
|
299
|
-
const table = document.getElementById('demo-table');
|
|
300
|
-
|
|
301
|
-
// Demo functions
|
|
302
|
-
window.toggleSearch = () => {
|
|
303
|
-
table.showSearch = !table.showSearch;
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
window.togglePagination = () => {
|
|
307
|
-
table.showPagination = !table.showPagination;
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
window.toggleSorting = () => {
|
|
311
|
-
table.sortable = !table.sortable;
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
window.toggleSelection = () => {
|
|
315
|
-
table.selectable = !table.selectable;
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
window.addRandomRow = () => {
|
|
319
|
-
const names = ['Mike Davis', 'Sarah Connor', 'Tom Brady', 'Lisa Simpson', 'Jack Ryan'];
|
|
320
|
-
const roles = ['Developer', 'Designer', 'Manager', 'QA Engineer', 'DevOps'];
|
|
321
|
-
const domains = ['tech.com', 'design.io', 'startup.co', 'corp.net'];
|
|
322
|
-
|
|
323
|
-
const randomName = names[Math.floor(Math.random() * names.length)];
|
|
324
|
-
const randomRole = roles[Math.floor(Math.random() * roles.length)];
|
|
325
|
-
const randomDomain = domains[Math.floor(Math.random() * domains.length)];
|
|
326
|
-
const randomEmail = `${randomName.toLowerCase().replace(' ', '.')}@${randomDomain}`;
|
|
327
|
-
const randomSalary = Math.floor(Math.random() * 50000) + 50000;
|
|
328
|
-
const randomRating = Math.floor(Math.random() * 5) + 1;
|
|
329
|
-
|
|
330
|
-
const newData = {
|
|
331
|
-
id: Date.now(),
|
|
332
|
-
name: randomName,
|
|
333
|
-
email: randomEmail,
|
|
334
|
-
role: randomRole,
|
|
335
|
-
salary: randomSalary,
|
|
336
|
-
joinDate: new Date().toISOString().split('T')[0],
|
|
337
|
-
active: Math.random() > 0.2,
|
|
338
|
-
rating: randomRating
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
// Add to table data
|
|
342
|
-
const currentData = table.data || [];
|
|
343
|
-
table.setData([...currentData, newData]);
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
window.loadSampleData = () => {
|
|
347
|
-
const sampleData = [
|
|
348
|
-
{"id": 1, "name": "John Doe", "email": "john.doe@example.com", "role": "Developer", "salary": 75000, "joinDate": "2023-01-15", "active": true, "rating": 4},
|
|
349
|
-
{"id": 2, "name": "Jane Smith", "email": "jane.smith@example.com", "role": "Designer", "salary": 68000, "joinDate": "2023-03-20", "active": true, "rating": 5},
|
|
350
|
-
{"id": 3, "name": "Bob Johnson", "email": "bob.johnson@example.com", "role": "Manager", "salary": 95000, "joinDate": "2022-11-10", "active": false, "rating": 3},
|
|
351
|
-
{"id": 4, "name": "Alice Brown", "email": "alice.brown@example.com", "role": "Developer", "salary": 72000, "joinDate": "2023-06-05", "active": true, "rating": 4},
|
|
352
|
-
{"id": 5, "name": "Charlie Wilson", "email": "charlie.wilson@example.com", "role": "QA Engineer", "salary": 65000, "joinDate": "2023-02-28", "active": true, "rating": 4},
|
|
353
|
-
{"id": 6, "name": "Diana Prince", "email": "diana.prince@example.com", "role": "Developer", "salary": 78000, "joinDate": "2023-04-12", "active": true, "rating": 5},
|
|
354
|
-
{"id": 7, "name": "Clark Kent", "email": "clark.kent@example.com", "role": "Manager", "salary": 92000, "joinDate": "2022-08-22", "active": true, "rating": 4},
|
|
355
|
-
{"id": 8, "name": "Bruce Wayne", "email": "bruce.wayne@example.com", "role": "CEO", "salary": 150000, "joinDate": "2020-01-01", "active": true, "rating": 5}
|
|
356
|
-
];
|
|
357
|
-
|
|
358
|
-
table.setData(sampleData);
|
|
359
|
-
table.totalItems = sampleData.length;
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
// Event listeners
|
|
363
|
-
table.addEventListener('@snice/table-sort-change', (e) => {
|
|
364
|
-
console.log('Sort changed:', e.detail);
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
table.addEventListener('@snice/table-selection-change', (e) => {
|
|
368
|
-
console.log('Selection changed:', e.detail);
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
table.addEventListener('@snice/row-click', (e) => {
|
|
372
|
-
console.log('Row clicked:', e.detail);
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
// Configure individual row components
|
|
376
|
-
const configureIndividualRows = async () => {
|
|
377
|
-
// Wait for components to be defined
|
|
378
|
-
await Promise.all([
|
|
379
|
-
customElements.whenDefined('snice-row'),
|
|
380
|
-
customElements.whenDefined('snice-cell-text'),
|
|
381
|
-
customElements.whenDefined('snice-cell-number'),
|
|
382
|
-
customElements.whenDefined('snice-cell-date'),
|
|
383
|
-
customElements.whenDefined('snice-cell-sparkline')
|
|
384
|
-
]);
|
|
385
|
-
|
|
386
|
-
// Configure employee row
|
|
387
|
-
const employeeRow = document.getElementById('employee-row');
|
|
388
|
-
if (employeeRow) {
|
|
389
|
-
employeeRow.columns = [
|
|
390
|
-
{ key: 'name', label: 'Name', type: 'text', align: 'left' },
|
|
391
|
-
{ key: 'salary', label: 'Salary', type: 'number', align: 'right', numberFormat: { prefix: '$', thousandsSeparator: true, decimals: 0 } },
|
|
392
|
-
{ key: 'joinDate', label: 'Join Date', type: 'date', align: 'center', dateFormat: { format: 'medium' } },
|
|
393
|
-
{ key: 'active', label: 'Active', type: 'boolean', align: 'center', booleanFormat: { useSymbols: true, trueSymbol: '✅', falseSymbol: '❌' } }
|
|
394
|
-
];
|
|
395
|
-
employeeRow.data = {
|
|
396
|
-
name: 'John Doe',
|
|
397
|
-
salary: 75000,
|
|
398
|
-
joinDate: '2022-03-15',
|
|
399
|
-
active: true
|
|
400
|
-
};
|
|
401
|
-
// Trigger update manually
|
|
402
|
-
if (typeof employeeRow.updateCells === 'function') {
|
|
403
|
-
employeeRow.updateCells();
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// Configure analytics row
|
|
408
|
-
const analyticsRow = document.getElementById('analytics-row');
|
|
409
|
-
if (analyticsRow) {
|
|
410
|
-
analyticsRow.columns = [
|
|
411
|
-
{ key: 'metric', label: 'Metric', type: 'text', align: 'left' },
|
|
412
|
-
{ key: 'current', label: 'Current', type: 'number', align: 'right', numberFormat: { prefix: '$', thousandsSeparator: true, decimals: 0 } },
|
|
413
|
-
{ key: 'progress', label: 'Progress', type: 'progress', align: 'left', progressFormat: { showPercentage: true, color: '#10b981' } },
|
|
414
|
-
{ key: 'trend', label: 'Trend', type: 'sparkline', align: 'center', sparklineFormat: { type: 'line', color: '#3b82f6', width: 80, height: 30 } }
|
|
415
|
-
];
|
|
416
|
-
analyticsRow.data = {
|
|
417
|
-
metric: 'Revenue',
|
|
418
|
-
current: 125340,
|
|
419
|
-
progress: 78,
|
|
420
|
-
trend: [45000, 47000, 49000, 52000, 48000, 53000, 55000]
|
|
421
|
-
};
|
|
422
|
-
// Trigger update manually
|
|
423
|
-
if (typeof analyticsRow.updateCells === 'function') {
|
|
424
|
-
analyticsRow.updateCells();
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
// Configure system row
|
|
429
|
-
const systemRow = document.getElementById('system-row');
|
|
430
|
-
if (systemRow) {
|
|
431
|
-
systemRow.columns = [
|
|
432
|
-
{ key: 'process', label: 'Process', type: 'text', align: 'left' },
|
|
433
|
-
{ key: 'memory', label: 'Memory', type: 'filesize', align: 'right' },
|
|
434
|
-
{ key: 'uptime', label: 'Uptime', type: 'duration', align: 'right' },
|
|
435
|
-
{ key: 'rating', label: 'Health', type: 'rating', align: 'center', ratingFormat: { max: 5, symbol: '●', emptySymbol: '○', color: '#10b981' } }
|
|
436
|
-
];
|
|
437
|
-
systemRow.data = {
|
|
438
|
-
process: 'nginx',
|
|
439
|
-
memory: 52428800, // 50MB
|
|
440
|
-
uptime: 86461, // 1 day 1 minute 1 second
|
|
441
|
-
rating: 4
|
|
442
|
-
};
|
|
443
|
-
// Trigger update manually
|
|
444
|
-
if (typeof systemRow.updateCells === 'function') {
|
|
445
|
-
systemRow.updateCells();
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
// Initialize individual rows
|
|
451
|
-
configureIndividualRows();
|
|
452
|
-
|
|
453
|
-
// Configure individual progress cell with percentage
|
|
454
|
-
const configureProgressCells = async () => {
|
|
455
|
-
await customElements.whenDefined('snice-cell-progress');
|
|
456
|
-
|
|
457
|
-
const progressWithPercent = document.getElementById('progress-with-percent');
|
|
458
|
-
if (progressWithPercent) {
|
|
459
|
-
progressWithPercent.column = {
|
|
460
|
-
key: 'progress',
|
|
461
|
-
label: 'Progress',
|
|
462
|
-
type: 'progress',
|
|
463
|
-
align: 'left',
|
|
464
|
-
progressFormat: {
|
|
465
|
-
showPercentage: true,
|
|
466
|
-
color: '#10b981'
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
configureProgressCells();
|
|
473
|
-
|
|
474
|
-
// Uncomment to load sample data programmatically:
|
|
475
|
-
// setTimeout(() => {
|
|
476
|
-
// window.loadSampleData();
|
|
477
|
-
// }, 100);
|
|
478
|
-
</script>
|
|
479
|
-
</body>
|
|
480
|
-
</html>
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { element, property, watch, ready, query } from 'snice';
|
|
2
|
-
import css from './snice-cell.css?inline';
|
|
3
|
-
import type { BooleanFormat, SniceCellElement, ColumnType, ColumnAlign, ColumnDefinition } from './snice-table.types';
|
|
4
|
-
|
|
5
|
-
@element('snice-cell-boolean')
|
|
6
|
-
export class SniceCellBoolean extends HTMLElement implements SniceCellElement {
|
|
7
|
-
@property({ reflect: true })
|
|
8
|
-
align: ColumnAlign = 'center';
|
|
9
|
-
|
|
10
|
-
@property({ reflect: true })
|
|
11
|
-
type: ColumnType = 'boolean';
|
|
12
|
-
|
|
13
|
-
@property({ reflect: true })
|
|
14
|
-
value: any = false;
|
|
15
|
-
|
|
16
|
-
@property({ type: Object })
|
|
17
|
-
column: ColumnDefinition = {
|
|
18
|
-
key: '',
|
|
19
|
-
label: '',
|
|
20
|
-
type: 'boolean',
|
|
21
|
-
align: 'center'
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
@property({ type: Object })
|
|
25
|
-
rowData: any = null;
|
|
26
|
-
|
|
27
|
-
@query('.cell-content')
|
|
28
|
-
contentElement?: HTMLElement;
|
|
29
|
-
|
|
30
|
-
@property({ reflect: true, attribute: 'true-value' })
|
|
31
|
-
trueValue: string = 'true';
|
|
32
|
-
|
|
33
|
-
@property({ reflect: true, attribute: 'false-value' })
|
|
34
|
-
falseValue: string = 'false';
|
|
35
|
-
|
|
36
|
-
@property({ type: Boolean, reflect: true, attribute: 'use-symbols' })
|
|
37
|
-
useSymbols: boolean = true;
|
|
38
|
-
|
|
39
|
-
@property({ reflect: true, attribute: 'true-symbol' })
|
|
40
|
-
trueSymbol: string = '✓';
|
|
41
|
-
|
|
42
|
-
@property({ reflect: true, attribute: 'false-symbol' })
|
|
43
|
-
falseSymbol: string = '✗';
|
|
44
|
-
|
|
45
|
-
html() {
|
|
46
|
-
const content = this.formatBooleanContent();
|
|
47
|
-
|
|
48
|
-
return `
|
|
49
|
-
<div class="cell-content cell-content--boolean" part="content">
|
|
50
|
-
${content}
|
|
51
|
-
</div>
|
|
52
|
-
`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
css() {
|
|
56
|
-
return css;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@ready()
|
|
60
|
-
init() {
|
|
61
|
-
this.applyAlignment();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
private applyAlignment() {
|
|
65
|
-
this.style.textAlign = this.align;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@watch('align')
|
|
69
|
-
updateAlignment() {
|
|
70
|
-
this.applyAlignment();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@watch('value', 'column')
|
|
74
|
-
updateContent() {
|
|
75
|
-
if (this.contentElement) {
|
|
76
|
-
const content = this.formatBooleanContent();
|
|
77
|
-
this.contentElement.innerHTML = content;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
private formatBooleanContent(): string {
|
|
82
|
-
if (this.value === null || this.value === undefined) {
|
|
83
|
-
return '';
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Use custom formatter if provided
|
|
87
|
-
if (this.column.formatter) {
|
|
88
|
-
return this.column.formatter(this.value, this.rowData);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Use column boolean format or component properties
|
|
92
|
-
const format: BooleanFormat = this.column.booleanFormat || {
|
|
93
|
-
trueValue: this.trueValue,
|
|
94
|
-
falseValue: this.falseValue,
|
|
95
|
-
useSymbols: this.useSymbols,
|
|
96
|
-
trueSymbol: this.trueSymbol,
|
|
97
|
-
falseSymbol: this.falseSymbol
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const isTrue = Boolean(this.value);
|
|
101
|
-
|
|
102
|
-
if (format.useSymbols ?? this.useSymbols) {
|
|
103
|
-
const symbol = isTrue ? (format.trueSymbol ?? this.trueSymbol) : (format.falseSymbol ?? this.falseSymbol);
|
|
104
|
-
const colorClass = isTrue ? 'boolean--true' : 'boolean--false';
|
|
105
|
-
return `<span class="${colorClass}">${symbol}</span>`;
|
|
106
|
-
} else {
|
|
107
|
-
const text = isTrue ? (format.trueValue ?? this.trueValue) : (format.falseValue ?? this.falseValue);
|
|
108
|
-
const colorClass = isTrue ? 'boolean--true' : 'boolean--false';
|
|
109
|
-
return `<span class="${colorClass}">${text}</span>`;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|