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,473 +0,0 @@
|
|
|
1
|
-
import { element, property, watch, ready, query } from 'snice';
|
|
2
|
-
import css from './snice-cell.css?inline';
|
|
3
|
-
import type {
|
|
4
|
-
SniceCellElement,
|
|
5
|
-
ColumnType,
|
|
6
|
-
ColumnAlign,
|
|
7
|
-
ColumnDefinition,
|
|
8
|
-
NumberFormat,
|
|
9
|
-
DateFormat,
|
|
10
|
-
BooleanFormat,
|
|
11
|
-
RatingFormat,
|
|
12
|
-
ProgressFormat,
|
|
13
|
-
SparklineFormat,
|
|
14
|
-
CellStyle,
|
|
15
|
-
ConditionalFormat
|
|
16
|
-
} from './snice-table.types';
|
|
17
|
-
|
|
18
|
-
@element('snice-cell')
|
|
19
|
-
export class SniceCell extends HTMLElement implements SniceCellElement {
|
|
20
|
-
@property({ reflect: true })
|
|
21
|
-
align: ColumnAlign = 'left';
|
|
22
|
-
|
|
23
|
-
@property({ reflect: true })
|
|
24
|
-
type: ColumnType = 'text';
|
|
25
|
-
|
|
26
|
-
@property()
|
|
27
|
-
value: any = '';
|
|
28
|
-
|
|
29
|
-
@property({ type: Object })
|
|
30
|
-
column: ColumnDefinition = {
|
|
31
|
-
key: '',
|
|
32
|
-
label: '',
|
|
33
|
-
type: 'text',
|
|
34
|
-
align: 'left'
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
@property({ type: Object })
|
|
38
|
-
rowData: any = null;
|
|
39
|
-
|
|
40
|
-
@query('.cell-content')
|
|
41
|
-
contentElement?: HTMLElement;
|
|
42
|
-
|
|
43
|
-
html() {
|
|
44
|
-
return `
|
|
45
|
-
<div class="cell-content" part="content">
|
|
46
|
-
${this.formatValue()}
|
|
47
|
-
</div>
|
|
48
|
-
`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
css() {
|
|
52
|
-
return css;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@ready()
|
|
56
|
-
init() {
|
|
57
|
-
this.applyAlignment();
|
|
58
|
-
this.applyConditionalFormatting();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@watch('align')
|
|
62
|
-
updateAlignment() {
|
|
63
|
-
this.applyAlignment();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@watch('value', 'column')
|
|
67
|
-
updateContent() {
|
|
68
|
-
if (this.contentElement) {
|
|
69
|
-
this.contentElement.innerHTML = this.formatValue();
|
|
70
|
-
}
|
|
71
|
-
this.applyConditionalFormatting();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
private applyAlignment() {
|
|
75
|
-
this.style.textAlign = this.align;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private applyConditionalFormatting() {
|
|
79
|
-
if (!this.column || !this.column.conditionalFormats) return;
|
|
80
|
-
|
|
81
|
-
// Reset any previous conditional formatting
|
|
82
|
-
this.removeAttribute('style');
|
|
83
|
-
this.className = 'snice-cell';
|
|
84
|
-
this.applyAlignment();
|
|
85
|
-
|
|
86
|
-
// Apply column base style if defined
|
|
87
|
-
if (this.column.style) {
|
|
88
|
-
this.applyStyle(this.column.style);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Check and apply conditional formats
|
|
92
|
-
for (const format of this.column.conditionalFormats) {
|
|
93
|
-
if (format.condition(this.value, this.rowData)) {
|
|
94
|
-
if (format.style) {
|
|
95
|
-
this.applyStyle(format.style);
|
|
96
|
-
}
|
|
97
|
-
if (format.className) {
|
|
98
|
-
this.classList.add(format.className);
|
|
99
|
-
}
|
|
100
|
-
break; // Apply only the first matching format
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
private applyStyle(style: CellStyle) {
|
|
106
|
-
if (style.backgroundColor) this.style.backgroundColor = style.backgroundColor;
|
|
107
|
-
if (style.color) this.style.color = style.color;
|
|
108
|
-
if (style.fontWeight) this.style.fontWeight = style.fontWeight;
|
|
109
|
-
if (style.fontStyle) this.style.fontStyle = style.fontStyle;
|
|
110
|
-
if (style.fontSize) this.style.fontSize = style.fontSize;
|
|
111
|
-
if (style.textDecoration) this.style.textDecoration = style.textDecoration;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
private formatValue(): string {
|
|
115
|
-
if (this.value === null || this.value === undefined) {
|
|
116
|
-
return '';
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Use custom formatter if provided
|
|
120
|
-
if (this.column.formatter) {
|
|
121
|
-
return this.column.formatter(this.value, this.rowData);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Apply type-specific formatting
|
|
125
|
-
switch (this.type) {
|
|
126
|
-
case 'text':
|
|
127
|
-
return this.formatText();
|
|
128
|
-
case 'number':
|
|
129
|
-
return this.formatNumber();
|
|
130
|
-
case 'currency':
|
|
131
|
-
return this.formatCurrency();
|
|
132
|
-
case 'percent':
|
|
133
|
-
return this.formatPercent();
|
|
134
|
-
case 'accounting':
|
|
135
|
-
return this.formatAccounting();
|
|
136
|
-
case 'scientific':
|
|
137
|
-
return this.formatScientific();
|
|
138
|
-
case 'fraction':
|
|
139
|
-
return this.formatFraction();
|
|
140
|
-
case 'date':
|
|
141
|
-
return this.formatDate();
|
|
142
|
-
case 'boolean':
|
|
143
|
-
return this.formatBoolean();
|
|
144
|
-
case 'rating':
|
|
145
|
-
return this.formatRating();
|
|
146
|
-
case 'progress':
|
|
147
|
-
return this.formatProgress();
|
|
148
|
-
case 'sparkline':
|
|
149
|
-
return this.formatSparkline();
|
|
150
|
-
case 'duration':
|
|
151
|
-
return this.formatDuration();
|
|
152
|
-
case 'filesize':
|
|
153
|
-
return this.formatFilesize();
|
|
154
|
-
case 'custom':
|
|
155
|
-
return String(this.value);
|
|
156
|
-
default:
|
|
157
|
-
return String(this.value);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
private formatText(): string {
|
|
162
|
-
return String(this.value);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
private formatNumber(): string {
|
|
166
|
-
const format = this.column.numberFormat || {};
|
|
167
|
-
const num = Number(this.value);
|
|
168
|
-
|
|
169
|
-
if (isNaN(num)) return String(this.value);
|
|
170
|
-
|
|
171
|
-
let formatted = num.toFixed(format.decimals ?? 0);
|
|
172
|
-
|
|
173
|
-
if (format.thousandsSeparator) {
|
|
174
|
-
const parts = formatted.split('.');
|
|
175
|
-
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
176
|
-
formatted = parts.join('.');
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (num < 0 && format.negativeStyle === 'parentheses') {
|
|
180
|
-
formatted = `(${formatted.replace('-', '')})`;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (format.prefix) formatted = format.prefix + formatted;
|
|
184
|
-
if (format.suffix) formatted = formatted + format.suffix;
|
|
185
|
-
|
|
186
|
-
return formatted;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
private formatCurrency(): string {
|
|
190
|
-
const format = this.column.numberFormat || {};
|
|
191
|
-
const num = Number(this.value);
|
|
192
|
-
|
|
193
|
-
if (isNaN(num)) return String(this.value);
|
|
194
|
-
|
|
195
|
-
const currencyFormat: Intl.NumberFormatOptions = {
|
|
196
|
-
style: 'currency',
|
|
197
|
-
currency: 'USD',
|
|
198
|
-
minimumFractionDigits: format.decimals ?? 2,
|
|
199
|
-
maximumFractionDigits: format.decimals ?? 2
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
return new Intl.NumberFormat('en-US', currencyFormat).format(num);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
private formatPercent(): string {
|
|
206
|
-
const format = this.column.numberFormat || {};
|
|
207
|
-
const num = Number(this.value);
|
|
208
|
-
|
|
209
|
-
if (isNaN(num)) return String(this.value);
|
|
210
|
-
|
|
211
|
-
const percentFormat: Intl.NumberFormatOptions = {
|
|
212
|
-
style: 'percent',
|
|
213
|
-
minimumFractionDigits: format.decimals ?? 1,
|
|
214
|
-
maximumFractionDigits: format.decimals ?? 1
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
return new Intl.NumberFormat('en-US', percentFormat).format(num);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
private formatAccounting(): string {
|
|
221
|
-
const format = this.column.numberFormat || {};
|
|
222
|
-
const num = Number(this.value);
|
|
223
|
-
|
|
224
|
-
if (isNaN(num)) return String(this.value);
|
|
225
|
-
|
|
226
|
-
let formatted = Math.abs(num).toFixed(format.decimals ?? 2);
|
|
227
|
-
|
|
228
|
-
if (format.thousandsSeparator) {
|
|
229
|
-
const parts = formatted.split('.');
|
|
230
|
-
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
231
|
-
formatted = parts.join('.');
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (num < 0) {
|
|
235
|
-
formatted = `(${formatted})`;
|
|
236
|
-
} else {
|
|
237
|
-
formatted = ` ${formatted} `;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return formatted;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
private formatScientific(): string {
|
|
244
|
-
const format = this.column.numberFormat || {};
|
|
245
|
-
const num = Number(this.value);
|
|
246
|
-
|
|
247
|
-
if (isNaN(num)) return String(this.value);
|
|
248
|
-
|
|
249
|
-
return num.toExponential(format.decimals ?? 2);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
private formatFraction(): string {
|
|
253
|
-
const num = Number(this.value);
|
|
254
|
-
if (isNaN(num)) return String(this.value);
|
|
255
|
-
|
|
256
|
-
// Simple fraction conversion
|
|
257
|
-
const tolerance = 1e-6;
|
|
258
|
-
let h1 = 1, h2 = 0, k1 = 0, k2 = 1;
|
|
259
|
-
let b = num;
|
|
260
|
-
|
|
261
|
-
do {
|
|
262
|
-
const a = Math.floor(b);
|
|
263
|
-
let aux = h1;
|
|
264
|
-
h1 = a * h1 + h2;
|
|
265
|
-
h2 = aux;
|
|
266
|
-
aux = k1;
|
|
267
|
-
k1 = a * k1 + k2;
|
|
268
|
-
k2 = aux;
|
|
269
|
-
b = 1 / (b - a);
|
|
270
|
-
} while (Math.abs(num - h1 / k1) > num * tolerance);
|
|
271
|
-
|
|
272
|
-
return `${h1}/${k1}`;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
private formatDate(): string {
|
|
276
|
-
const format = this.column.dateFormat || {};
|
|
277
|
-
const date = new Date(this.value);
|
|
278
|
-
|
|
279
|
-
if (isNaN(date.getTime())) return String(this.value);
|
|
280
|
-
|
|
281
|
-
if (format.customFormat) {
|
|
282
|
-
// Simple custom format implementation
|
|
283
|
-
return format.customFormat
|
|
284
|
-
.replace('YYYY', date.getFullYear().toString())
|
|
285
|
-
.replace('MM', (date.getMonth() + 1).toString().padStart(2, '0'))
|
|
286
|
-
.replace('DD', date.getDate().toString().padStart(2, '0'));
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const options: Intl.DateTimeFormatOptions = {};
|
|
290
|
-
switch (format.format) {
|
|
291
|
-
case 'short':
|
|
292
|
-
options.dateStyle = 'short';
|
|
293
|
-
break;
|
|
294
|
-
case 'medium':
|
|
295
|
-
options.dateStyle = 'medium';
|
|
296
|
-
break;
|
|
297
|
-
case 'long':
|
|
298
|
-
options.dateStyle = 'long';
|
|
299
|
-
break;
|
|
300
|
-
case 'full':
|
|
301
|
-
options.dateStyle = 'full';
|
|
302
|
-
break;
|
|
303
|
-
default:
|
|
304
|
-
options.dateStyle = 'short';
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
return new Intl.DateTimeFormat(format.locale || 'en-US', options).format(date);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
private formatBoolean(): string {
|
|
311
|
-
const format = this.column.booleanFormat || {};
|
|
312
|
-
const bool = Boolean(this.value);
|
|
313
|
-
|
|
314
|
-
if (format.useSymbols) {
|
|
315
|
-
return bool
|
|
316
|
-
? (format.trueSymbol || '✓')
|
|
317
|
-
: (format.falseSymbol || '✗');
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
return bool
|
|
321
|
-
? (format.trueValue || 'true')
|
|
322
|
-
: (format.falseValue || 'false');
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
private formatRating(): string {
|
|
326
|
-
const format = this.column.ratingFormat || {};
|
|
327
|
-
const rating = Number(this.value);
|
|
328
|
-
const max = format.max || 5;
|
|
329
|
-
const symbol = format.symbol || '★';
|
|
330
|
-
const emptySymbol = format.emptySymbol || '☆';
|
|
331
|
-
|
|
332
|
-
if (isNaN(rating)) return String(this.value);
|
|
333
|
-
|
|
334
|
-
let html = '';
|
|
335
|
-
for (let i = 0; i < max; i++) {
|
|
336
|
-
if (i < rating) {
|
|
337
|
-
html += `<span style="color: ${format.color || '#ffc107'}">${symbol}</span>`;
|
|
338
|
-
} else {
|
|
339
|
-
html += `<span style="color: #ddd">${emptySymbol}</span>`;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
return html;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
private formatProgress(): string {
|
|
346
|
-
const format = this.column.progressFormat || {};
|
|
347
|
-
const value = Number(this.value);
|
|
348
|
-
const max = format.max || 100;
|
|
349
|
-
const percentage = Math.min(100, Math.max(0, (value / max) * 100));
|
|
350
|
-
|
|
351
|
-
if (isNaN(value)) return String(this.value);
|
|
352
|
-
|
|
353
|
-
const color = format.color || '#007bff';
|
|
354
|
-
const bgColor = format.backgroundColor || '#e9ecef';
|
|
355
|
-
const height = format.height || '1rem'; // Using rem for height
|
|
356
|
-
|
|
357
|
-
let html = `
|
|
358
|
-
<div style="
|
|
359
|
-
width: 100%;
|
|
360
|
-
height: ${height};
|
|
361
|
-
background-color: ${bgColor};
|
|
362
|
-
border-radius: 0.25rem;
|
|
363
|
-
overflow: hidden;
|
|
364
|
-
position: relative;
|
|
365
|
-
">
|
|
366
|
-
<div style="
|
|
367
|
-
width: ${percentage}%;
|
|
368
|
-
height: 100%;
|
|
369
|
-
background-color: ${color};
|
|
370
|
-
transition: width 0.3s ease;
|
|
371
|
-
"></div>
|
|
372
|
-
`;
|
|
373
|
-
|
|
374
|
-
if (format.showPercentage) {
|
|
375
|
-
html += `
|
|
376
|
-
<span style="
|
|
377
|
-
position: absolute;
|
|
378
|
-
top: 50%;
|
|
379
|
-
left: 50%;
|
|
380
|
-
transform: translate(-50%, -50%);
|
|
381
|
-
font-size: 0.75rem;
|
|
382
|
-
font-weight: bold;
|
|
383
|
-
color: ${percentage > 50 ? 'white' : 'black'};
|
|
384
|
-
">${Math.round(percentage)}%</span>
|
|
385
|
-
`;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
html += '</div>';
|
|
389
|
-
return html;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
private formatSparkline(): string {
|
|
393
|
-
const format = this.column.sparklineFormat || {};
|
|
394
|
-
const data = Array.isArray(this.value) ? this.value : [];
|
|
395
|
-
|
|
396
|
-
if (data.length === 0) return '';
|
|
397
|
-
|
|
398
|
-
const width = format.width || 60;
|
|
399
|
-
const height = format.height || 20;
|
|
400
|
-
const color = format.color || '#007bff';
|
|
401
|
-
const type = format.type || 'line';
|
|
402
|
-
|
|
403
|
-
const max = Math.max(...data);
|
|
404
|
-
const min = Math.min(...data);
|
|
405
|
-
const range = max - min || 1;
|
|
406
|
-
|
|
407
|
-
if (type === 'line') {
|
|
408
|
-
const points = data.map((val, i) => {
|
|
409
|
-
const x = (i / (data.length - 1)) * width;
|
|
410
|
-
const y = height - ((val - min) / range) * height;
|
|
411
|
-
return `${x},${y}`;
|
|
412
|
-
}).join(' ');
|
|
413
|
-
|
|
414
|
-
return `
|
|
415
|
-
<svg width="${width}" height="${height}" style="display: block;">
|
|
416
|
-
<polyline
|
|
417
|
-
points="${points}"
|
|
418
|
-
fill="none"
|
|
419
|
-
stroke="${color}"
|
|
420
|
-
stroke-width="2"
|
|
421
|
-
/>
|
|
422
|
-
</svg>
|
|
423
|
-
`;
|
|
424
|
-
} else if (type === 'bar') {
|
|
425
|
-
const barWidth = width / data.length;
|
|
426
|
-
const bars = data.map((val, i) => {
|
|
427
|
-
const barHeight = ((val - min) / range) * height;
|
|
428
|
-
const x = i * barWidth;
|
|
429
|
-
const y = height - barHeight;
|
|
430
|
-
return `<rect x="${x}" y="${y}" width="${barWidth - 1}" height="${barHeight}" fill="${color}" />`;
|
|
431
|
-
}).join('');
|
|
432
|
-
|
|
433
|
-
return `
|
|
434
|
-
<svg width="${width}" height="${height}" style="display: block;">
|
|
435
|
-
${bars}
|
|
436
|
-
</svg>
|
|
437
|
-
`;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
return String(this.value);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
private formatDuration(): string {
|
|
444
|
-
const seconds = Number(this.value);
|
|
445
|
-
if (isNaN(seconds)) return String(this.value);
|
|
446
|
-
|
|
447
|
-
const hours = Math.floor(seconds / 3600);
|
|
448
|
-
const minutes = Math.floor((seconds % 3600) / 60);
|
|
449
|
-
const secs = seconds % 60;
|
|
450
|
-
|
|
451
|
-
if (hours > 0) {
|
|
452
|
-
return `${hours}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
|
|
453
|
-
} else {
|
|
454
|
-
return `${minutes}:${secs.toString().padStart(2, '0')}`;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
private formatFilesize(): string {
|
|
459
|
-
const bytes = Number(this.value);
|
|
460
|
-
if (isNaN(bytes)) return String(this.value);
|
|
461
|
-
|
|
462
|
-
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
463
|
-
let size = bytes;
|
|
464
|
-
let unitIndex = 0;
|
|
465
|
-
|
|
466
|
-
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
467
|
-
size /= 1024;
|
|
468
|
-
unitIndex++;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
return `${size.toFixed(unitIndex === 0 ? 0 : 1)} ${units[unitIndex]}`;
|
|
472
|
-
}
|
|
473
|
-
}
|