snice 4.27.0 → 4.29.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/adapters/react/action-bar.d.ts +30 -0
- package/adapters/react/action-bar.d.ts.map +1 -0
- package/adapters/react/action-bar.js +24 -0
- package/adapters/react/action-bar.js.map +1 -0
- package/adapters/react/action-bar.tsx +38 -0
- package/adapters/react/binpack.d.ts +35 -0
- package/adapters/react/binpack.d.ts.map +1 -0
- package/adapters/react/binpack.js +24 -0
- package/adapters/react/binpack.js.map +1 -0
- package/adapters/react/binpack.tsx +43 -0
- package/adapters/react/components.d.ts +4 -0
- package/adapters/react/components.d.ts.map +1 -1
- package/adapters/react/components.js +2 -0
- package/adapters/react/components.js.map +1 -1
- package/adapters/react/components.ts +4 -0
- package/adapters/react/useRequestHandler.d.ts +56 -0
- package/adapters/react/useRequestHandler.js +103 -0
- package/adapters/react/useRequestHandler.js.map +1 -0
- package/dist/cdn/accordion/snice-accordion.js +1 -1
- package/dist/cdn/accordion/snice-accordion.min.js +1 -1
- package/dist/cdn/action-bar/README.md +27 -0
- package/dist/cdn/action-bar/snice-action-bar.js +249 -0
- package/dist/cdn/action-bar/snice-action-bar.js.map +1 -0
- package/dist/cdn/action-bar/snice-action-bar.min.js +12 -0
- package/dist/cdn/action-bar/snice-action-bar.min.js.map +1 -0
- package/dist/cdn/activity-feed/snice-activity-feed.js +1 -1
- package/dist/cdn/activity-feed/snice-activity-feed.min.js +1 -1
- package/dist/cdn/alert/snice-alert.js +1 -1
- package/dist/cdn/alert/snice-alert.min.js +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.js +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.min.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.min.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.min.js +1 -1
- package/dist/cdn/availability/snice-availability.js +1 -1
- package/dist/cdn/availability/snice-availability.min.js +1 -1
- package/dist/cdn/avatar/snice-avatar.js +1 -1
- package/dist/cdn/avatar/snice-avatar.min.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.min.js +1 -1
- package/dist/cdn/badge/snice-badge.js +2 -2
- package/dist/cdn/badge/snice-badge.js.map +1 -1
- package/dist/cdn/badge/snice-badge.min.js +2 -2
- package/dist/cdn/badge/snice-badge.min.js.map +1 -1
- package/dist/cdn/banner/snice-banner.js +1 -1
- package/dist/cdn/banner/snice-banner.min.js +1 -1
- package/dist/cdn/binpack/README.md +27 -0
- package/dist/cdn/binpack/snice-binpack.js +1037 -0
- package/dist/cdn/binpack/snice-binpack.js.map +1 -0
- package/dist/cdn/binpack/snice-binpack.min.js +13 -0
- package/dist/cdn/binpack/snice-binpack.min.js.map +1 -0
- package/dist/cdn/book/snice-book.js +1 -1
- package/dist/cdn/book/snice-book.min.js +1 -1
- package/dist/cdn/booking/snice-booking.js +1 -1
- package/dist/cdn/booking/snice-booking.min.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +1 -1
- package/dist/cdn/button/README.md +1 -1
- package/dist/cdn/button/snice-button.js +11 -10
- package/dist/cdn/button/snice-button.js.map +1 -1
- package/dist/cdn/button/snice-button.min.js +3 -3
- package/dist/cdn/button/snice-button.min.js.map +1 -1
- package/dist/cdn/calendar/snice-calendar.js +1 -1
- package/dist/cdn/calendar/snice-calendar.min.js +1 -1
- package/dist/cdn/camera/snice-camera.js +1 -1
- package/dist/cdn/camera/snice-camera.min.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.min.js +1 -1
- package/dist/cdn/card/snice-card.js +1 -1
- package/dist/cdn/card/snice-card.min.js +1 -1
- package/dist/cdn/carousel/snice-carousel.js +1 -1
- package/dist/cdn/carousel/snice-carousel.min.js +1 -1
- package/dist/cdn/cart/snice-cart.js +1 -1
- package/dist/cdn/cart/snice-cart.min.js +1 -1
- package/dist/cdn/chart/snice-chart.js +1 -1
- package/dist/cdn/chart/snice-chart.min.js +1 -1
- package/dist/cdn/chat/snice-chat.js +1 -1
- package/dist/cdn/chat/snice-chat.min.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.min.js +1 -1
- package/dist/cdn/chip/snice-chip.js +1 -1
- package/dist/cdn/chip/snice-chip.min.js +1 -1
- package/dist/cdn/code-block/snice-code-block.js +1 -1
- package/dist/cdn/code-block/snice-code-block.min.js +1 -1
- package/dist/cdn/color-display/snice-color-display.js +1 -1
- package/dist/cdn/color-display/snice-color-display.min.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.min.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.min.js +1 -1
- package/dist/cdn/comments/snice-comments.js +1 -1
- package/dist/cdn/comments/snice-comments.min.js +1 -1
- package/dist/cdn/countdown/snice-countdown.js +1 -1
- package/dist/cdn/countdown/snice-countdown.min.js +1 -1
- package/dist/cdn/cropper/snice-cropper.js +1 -1
- package/dist/cdn/cropper/snice-cropper.min.js +1 -1
- package/dist/cdn/data-card/snice-data-card.js +1 -1
- package/dist/cdn/data-card/snice-data-card.min.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.min.js +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.js +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.min.js +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.js +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.min.js +1 -1
- package/dist/cdn/diff/snice-diff.js +1 -1
- package/dist/cdn/diff/snice-diff.min.js +1 -1
- package/dist/cdn/divider/snice-divider.js +1 -1
- package/dist/cdn/divider/snice-divider.min.js +1 -1
- package/dist/cdn/doc/snice-doc.js +1 -1
- package/dist/cdn/doc/snice-doc.min.js +1 -1
- package/dist/cdn/draw/snice-draw.js +1 -1
- package/dist/cdn/draw/snice-draw.min.js +1 -1
- package/dist/cdn/drawer/snice-drawer.js +1 -1
- package/dist/cdn/drawer/snice-drawer.min.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.min.js +1 -1
- package/dist/cdn/estimate/snice-estimate.js +1 -1
- package/dist/cdn/estimate/snice-estimate.min.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.min.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.min.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.min.js +1 -1
- package/dist/cdn/flow/snice-flow.js +1 -1
- package/dist/cdn/flow/snice-flow.min.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.min.js +1 -1
- package/dist/cdn/funnel/snice-funnel.js +1 -1
- package/dist/cdn/funnel/snice-funnel.min.js +1 -1
- package/dist/cdn/gantt/snice-gantt.js +1 -1
- package/dist/cdn/gantt/snice-gantt.min.js +1 -1
- package/dist/cdn/gauge/snice-gauge.js +1 -1
- package/dist/cdn/gauge/snice-gauge.min.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.min.js +1 -1
- package/dist/cdn/image/snice-image.js +1 -1
- package/dist/cdn/image/snice-image.min.js +1 -1
- package/dist/cdn/input/snice-input.js +1 -1
- package/dist/cdn/input/snice-input.min.js +1 -1
- package/dist/cdn/invoice/snice-invoice.js +1 -1
- package/dist/cdn/invoice/snice-invoice.min.js +1 -1
- package/dist/cdn/kanban/snice-kanban.js +1 -1
- package/dist/cdn/kanban/snice-kanban.min.js +1 -1
- package/dist/cdn/key-value/snice-key-value.js +1 -1
- package/dist/cdn/key-value/snice-key-value.min.js +1 -1
- package/dist/cdn/kpi/snice-kpi.js +1 -1
- package/dist/cdn/kpi/snice-kpi.min.js +1 -1
- package/dist/cdn/layout/snice-layout.js +1 -1
- package/dist/cdn/layout/snice-layout.min.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.min.js +1 -1
- package/dist/cdn/link/snice-link.js +1 -1
- package/dist/cdn/link/snice-link.min.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.min.js +1 -1
- package/dist/cdn/list/snice-list.js +1 -1
- package/dist/cdn/list/snice-list.min.js +1 -1
- package/dist/cdn/location/snice-location.js +1 -1
- package/dist/cdn/location/snice-location.min.js +1 -1
- package/dist/cdn/login/README.md +2 -2
- package/dist/cdn/login/snice-login.js +11 -10
- package/dist/cdn/login/snice-login.js.map +1 -1
- package/dist/cdn/login/snice-login.min.js +5 -5
- package/dist/cdn/login/snice-login.min.js.map +1 -1
- package/dist/cdn/map/snice-map.js +1 -1
- package/dist/cdn/map/snice-map.min.js +1 -1
- package/dist/cdn/markdown/snice-markdown.js +1 -1
- package/dist/cdn/markdown/snice-markdown.min.js +1 -1
- package/dist/cdn/masonry/snice-masonry.js +1 -1
- package/dist/cdn/masonry/snice-masonry.min.js +1 -1
- package/dist/cdn/menu/snice-menu.js +1 -1
- package/dist/cdn/menu/snice-menu.min.js +1 -1
- package/dist/cdn/message-strip/snice-message-strip.js +1 -1
- package/dist/cdn/message-strip/snice-message-strip.min.js +1 -1
- package/dist/cdn/metric-table/snice-metric-table.js +1 -1
- package/dist/cdn/metric-table/snice-metric-table.min.js +1 -1
- package/dist/cdn/modal/snice-modal.js +1 -1
- package/dist/cdn/modal/snice-modal.min.js +1 -1
- package/dist/cdn/music-player/snice-music-player.js +1 -1
- package/dist/cdn/music-player/snice-music-player.min.js +1 -1
- package/dist/cdn/nav/snice-nav.js +1 -1
- package/dist/cdn/nav/snice-nav.min.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.min.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.min.js +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.js +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.min.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.min.js +1 -1
- package/dist/cdn/pagination/snice-pagination.js +1 -1
- package/dist/cdn/pagination/snice-pagination.min.js +1 -1
- package/dist/cdn/paint/snice-paint.js +1 -1
- package/dist/cdn/paint/snice-paint.min.js +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.js +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.min.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.min.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.min.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.min.js +1 -1
- package/dist/cdn/product-card/snice-product-card.js +1 -1
- package/dist/cdn/product-card/snice-product-card.min.js +1 -1
- package/dist/cdn/progress/snice-progress.js +1 -1
- package/dist/cdn/progress/snice-progress.min.js +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.js +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.min.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.min.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.min.js +1 -1
- package/dist/cdn/radio/snice-radio.js +1 -1
- package/dist/cdn/radio/snice-radio.min.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.min.js +1 -1
- package/dist/cdn/rating/snice-rating.js +1 -1
- package/dist/cdn/rating/snice-rating.min.js +1 -1
- package/dist/cdn/receipt/snice-receipt.js +1 -1
- package/dist/cdn/receipt/snice-receipt.min.js +1 -1
- package/dist/cdn/recipe/snice-recipe.js +1 -1
- package/dist/cdn/recipe/snice-recipe.min.js +1 -1
- package/dist/cdn/runtime/README.md +2 -2
- package/dist/cdn/runtime/snice-runtime.esm.js +152 -62
- package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.min.js +8 -8
- package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.js +152 -61
- package/dist/cdn/runtime/snice-runtime.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.min.js +8 -8
- package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
- package/dist/cdn/sankey/snice-sankey.js +1 -1
- package/dist/cdn/sankey/snice-sankey.min.js +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.js +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.min.js +1 -1
- package/dist/cdn/select/snice-select.js +1 -1
- package/dist/cdn/select/snice-select.min.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.min.js +1 -1
- package/dist/cdn/slider/snice-slider.js +1 -1
- package/dist/cdn/slider/snice-slider.min.js +1 -1
- package/dist/cdn/sortable/snice-sortable.js +1 -1
- package/dist/cdn/sortable/snice-sortable.min.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.min.js +1 -1
- package/dist/cdn/spinner/snice-spinner.js +1 -1
- package/dist/cdn/spinner/snice-spinner.min.js +1 -1
- package/dist/cdn/split-button/snice-split-button.js +1 -1
- package/dist/cdn/split-button/snice-split-button.min.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.min.js +1 -1
- package/dist/cdn/spreadsheet/snice-spreadsheet.js +1 -1
- package/dist/cdn/spreadsheet/snice-spreadsheet.min.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.min.js +1 -1
- package/dist/cdn/step-input/snice-step-input.js +1 -1
- package/dist/cdn/step-input/snice-step-input.min.js +1 -1
- package/dist/cdn/stepper/snice-stepper.js +1 -1
- package/dist/cdn/stepper/snice-stepper.min.js +1 -1
- package/dist/cdn/switch/snice-switch.js +1 -1
- package/dist/cdn/switch/snice-switch.min.js +1 -1
- package/dist/cdn/table/README.md +1 -1
- package/dist/cdn/table/snice-table.js +11 -10
- package/dist/cdn/table/snice-table.js.map +1 -1
- package/dist/cdn/table/snice-table.min.js +73 -73
- package/dist/cdn/table/snice-table.min.js.map +1 -1
- package/dist/cdn/tabs/snice-tabs.js +1 -1
- package/dist/cdn/tabs/snice-tabs.min.js +1 -1
- package/dist/cdn/tag/snice-tag.js +1 -1
- package/dist/cdn/tag/snice-tag.min.js +1 -1
- package/dist/cdn/tag-input/snice-tag-input.js +1 -1
- package/dist/cdn/tag-input/snice-tag-input.min.js +1 -1
- package/dist/cdn/terminal/snice-terminal.js +1 -1
- package/dist/cdn/terminal/snice-terminal.min.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.min.js +1 -1
- package/dist/cdn/textarea/snice-textarea.js +1 -1
- package/dist/cdn/textarea/snice-textarea.min.js +1 -1
- package/dist/cdn/time-picker/snice-time-picker.js +1 -1
- package/dist/cdn/time-picker/snice-time-picker.min.js +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.js +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +1 -1
- package/dist/cdn/timeline/snice-timeline.js +1 -1
- package/dist/cdn/timeline/snice-timeline.min.js +1 -1
- package/dist/cdn/timer/snice-timer.js +1 -1
- package/dist/cdn/timer/snice-timer.min.js +1 -1
- package/dist/cdn/toast/snice-toast.js +1 -1
- package/dist/cdn/toast/snice-toast.min.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.min.js +1 -1
- package/dist/cdn/tree/snice-tree.js +1 -1
- package/dist/cdn/tree/snice-tree.min.js +1 -1
- package/dist/cdn/treemap/snice-treemap.js +1 -1
- package/dist/cdn/treemap/snice-treemap.min.js +1 -1
- package/dist/cdn/user-card/snice-user-card.js +1 -1
- package/dist/cdn/user-card/snice-user-card.min.js +1 -1
- package/dist/cdn/video-player/snice-video-player.js +1 -1
- package/dist/cdn/video-player/snice-video-player.min.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +1 -1
- package/dist/cdn/waterfall/snice-waterfall.js +1 -1
- package/dist/cdn/waterfall/snice-waterfall.min.js +1 -1
- package/dist/cdn/weather/snice-weather.js +1 -1
- package/dist/cdn/weather/snice-weather.min.js +1 -1
- package/dist/cdn/work-order/snice-work-order.js +1 -1
- package/dist/cdn/work-order/snice-work-order.min.js +1 -1
- package/dist/components/action-bar/snice-action-bar.d.ts +22 -0
- package/dist/components/action-bar/snice-action-bar.js +182 -0
- package/dist/components/action-bar/snice-action-bar.js.map +1 -0
- package/dist/components/action-bar/snice-action-bar.types.d.ts +17 -0
- package/dist/components/badge/snice-badge.js +1 -1
- package/dist/components/badge/snice-badge.js.map +1 -1
- package/dist/components/binpack/snice-binpack.d.ts +82 -0
- package/dist/components/binpack/snice-binpack.js +970 -0
- package/dist/components/binpack/snice-binpack.js.map +1 -0
- package/dist/components/binpack/snice-binpack.types.d.ts +52 -0
- package/dist/components/button/snice-button.d.ts +2 -2
- package/dist/components/button/snice-button.js +11 -10
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/create-request-handler.d.ts +42 -0
- package/dist/index.cjs +149 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +149 -59
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +149 -58
- package/dist/index.iife.js.map +1 -1
- package/dist/parts.d.ts +9 -7
- package/dist/react/useRequestHandler.d.ts +56 -0
- package/dist/react/useRequestHandler.js +103 -0
- package/dist/react/useRequestHandler.js.map +1 -0
- package/dist/symbols.cjs +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/docs/ai/DEVELOPMENT.md +1 -1
- package/docs/ai/components/accordion.md +46 -80
- package/docs/ai/components/action-bar.md +75 -0
- package/docs/ai/components/activity-feed.md +7 -7
- package/docs/ai/components/alert.md +26 -44
- package/docs/ai/components/app-tiles.md +34 -39
- package/docs/ai/components/approval-flow.md +1 -1
- package/docs/ai/components/audio-recorder.md +35 -67
- package/docs/ai/components/availability.md +13 -34
- package/docs/ai/components/avatar-group.md +26 -13
- package/docs/ai/components/avatar.md +52 -36
- package/docs/ai/components/badge.md +21 -32
- package/docs/ai/components/banner.md +21 -43
- package/docs/ai/components/binpack.md +89 -0
- package/docs/ai/components/book.md +25 -23
- package/docs/ai/components/booking.md +31 -36
- package/docs/ai/components/breadcrumbs.md +36 -11
- package/docs/ai/components/button.md +33 -44
- package/docs/ai/components/calendar.md +37 -70
- package/docs/ai/components/camera-annotate.md +31 -64
- package/docs/ai/components/camera.md +38 -120
- package/docs/ai/components/candlestick.md +32 -52
- package/docs/ai/components/card.md +20 -30
- package/docs/ai/components/carousel.md +32 -32
- package/docs/ai/components/cart.md +24 -29
- package/docs/ai/components/chart.md +29 -114
- package/docs/ai/components/chat.md +38 -75
- package/docs/ai/components/checkbox.md +22 -41
- package/docs/ai/components/chip.md +18 -54
- package/docs/ai/components/code-block.md +57 -178
- package/docs/ai/components/color-display.md +12 -32
- package/docs/ai/components/color-picker.md +17 -39
- package/docs/ai/components/command-palette.md +49 -71
- package/docs/ai/components/comments.md +55 -36
- package/docs/ai/components/countdown.md +28 -30
- package/docs/ai/components/cropper.md +33 -33
- package/docs/ai/components/data-card.md +20 -14
- package/docs/ai/components/date-picker.md +40 -47
- package/docs/ai/components/date-range-picker.md +31 -15
- package/docs/ai/components/date-time-picker.md +23 -46
- package/docs/ai/components/diff.md +30 -31
- package/docs/ai/components/divider.md +17 -47
- package/docs/ai/components/doc.md +43 -68
- package/docs/ai/components/draw.md +35 -87
- package/docs/ai/components/drawer.md +48 -77
- package/docs/ai/components/empty-state.md +10 -44
- package/docs/ai/components/estimate.md +33 -58
- package/docs/ai/components/file-gallery.md +48 -100
- package/docs/ai/components/file-upload.md +17 -53
- package/docs/ai/components/flip-card.md +31 -23
- package/docs/ai/components/flow.md +37 -65
- package/docs/ai/components/form-builder.md +35 -75
- package/docs/ai/components/form-layout.md +10 -20
- package/docs/ai/components/funnel.md +33 -48
- package/docs/ai/components/gantt.md +27 -23
- package/docs/ai/components/gauge.md +16 -17
- package/docs/ai/components/heatmap.md +21 -21
- package/docs/ai/components/image.md +7 -13
- package/docs/ai/components/input.md +38 -70
- package/docs/ai/components/invoice.md +35 -36
- package/docs/ai/components/kanban.md +32 -61
- package/docs/ai/components/key-value.md +32 -16
- package/docs/ai/components/kpi.md +38 -73
- package/docs/ai/components/layout.md +29 -23
- package/docs/ai/components/leaderboard.md +28 -37
- package/docs/ai/components/link-preview.md +12 -18
- package/docs/ai/components/link.md +10 -7
- package/docs/ai/components/list.md +21 -5
- package/docs/ai/components/location.md +21 -25
- package/docs/ai/components/login.md +14 -9
- package/docs/ai/components/map.md +27 -33
- package/docs/ai/components/markdown.md +20 -24
- package/docs/ai/components/masonry.md +10 -14
- package/docs/ai/components/mentions.md +26 -12
- package/docs/ai/components/menu.md +54 -52
- package/docs/ai/components/message-strip.md +20 -20
- package/docs/ai/components/metric-table.md +14 -21
- package/docs/ai/components/modal.md +27 -18
- package/docs/ai/components/music-player.md +49 -41
- package/docs/ai/components/nav.md +34 -31
- package/docs/ai/components/network-graph.md +27 -42
- package/docs/ai/components/notification-center.md +31 -33
- package/docs/ai/components/order-tracker.md +36 -27
- package/docs/ai/components/org-chart.md +36 -31
- package/docs/ai/components/pagination.md +34 -26
- package/docs/ai/components/paint.md +53 -91
- package/docs/ai/components/pdf-viewer.md +35 -36
- package/docs/ai/components/permission-matrix.md +26 -31
- package/docs/ai/components/podcast-player.md +64 -70
- package/docs/ai/components/pricing-table.md +37 -48
- package/docs/ai/components/product-card.md +58 -41
- package/docs/ai/components/progress-ring.md +20 -24
- package/docs/ai/components/progress.md +28 -45
- package/docs/ai/components/qr-code.md +25 -27
- package/docs/ai/components/qr-reader.md +20 -23
- package/docs/ai/components/radio.md +17 -15
- package/docs/ai/components/range-slider.md +22 -11
- package/docs/ai/components/rating.md +29 -33
- package/docs/ai/components/receipt.md +50 -127
- package/docs/ai/components/recipe.md +44 -42
- package/docs/ai/components/sankey.md +21 -30
- package/docs/ai/components/scheduler.md +29 -41
- package/docs/ai/components/segmented-control.md +11 -15
- package/docs/ai/components/select.md +58 -102
- package/docs/ai/components/skeleton.md +16 -30
- package/docs/ai/components/slider.md +26 -20
- package/docs/ai/components/sortable.md +25 -27
- package/docs/ai/components/sparkline.md +21 -17
- package/docs/ai/components/spinner.md +9 -5
- package/docs/ai/components/split-button.md +10 -13
- package/docs/ai/components/split-pane.md +19 -14
- package/docs/ai/components/spotlight.md +31 -26
- package/docs/ai/components/spreadsheet.md +51 -97
- package/docs/ai/components/stat-group.md +9 -19
- package/docs/ai/components/step-input.md +17 -15
- package/docs/ai/components/stepper.md +14 -15
- package/docs/ai/components/switch.md +15 -9
- package/docs/ai/components/table.md +24 -84
- package/docs/ai/components/tabs.md +18 -10
- package/docs/ai/components/tag-input.md +18 -29
- package/docs/ai/components/tag.md +10 -22
- package/docs/ai/components/terminal.md +9 -9
- package/docs/ai/components/testimonial.md +9 -19
- package/docs/ai/components/textarea.md +15 -16
- package/docs/ai/components/theme.md +3 -3
- package/docs/ai/components/time-picker.md +30 -49
- package/docs/ai/components/time-range-picker.md +16 -15
- package/docs/ai/components/timeline.md +5 -4
- package/docs/ai/components/timer.md +8 -8
- package/docs/ai/components/toast.md +24 -18
- package/docs/ai/components/tooltip.md +11 -22
- package/docs/ai/components/tree.md +9 -9
- package/docs/ai/components/treemap.md +14 -13
- package/docs/ai/components/user-card.md +21 -27
- package/docs/ai/components/video-player.md +35 -52
- package/docs/ai/components/virtual-scroller.md +1 -1
- package/docs/ai/components/waterfall.md +17 -16
- package/docs/ai/components/weather.md +19 -34
- package/docs/ai/components/work-order.md +58 -134
- package/docs/ai/patterns.md +63 -0
- package/docs/components/accordion.md +72 -151
- package/docs/components/action-bar.md +185 -0
- package/docs/components/activity-feed.md +9 -14
- package/docs/components/alert.md +17 -109
- package/docs/components/app-tiles.md +58 -43
- package/docs/components/approval-flow.md +8 -14
- package/docs/components/audio-recorder.md +45 -51
- package/docs/components/availability.md +30 -45
- package/docs/components/avatar-group.md +34 -14
- package/docs/components/avatar.md +20 -55
- package/docs/components/badge.md +53 -470
- package/docs/components/banner.md +44 -30
- package/docs/components/binpack.md +208 -0
- package/docs/components/book.md +78 -57
- package/docs/components/booking.md +35 -87
- package/docs/components/breadcrumbs.md +74 -448
- package/docs/components/button.md +72 -603
- package/docs/components/calendar.md +77 -261
- package/docs/components/camera-annotate.md +44 -96
- package/docs/components/camera.md +94 -333
- package/docs/components/candlestick.md +79 -116
- package/docs/components/card.md +51 -689
- package/docs/components/carousel.md +29 -76
- package/docs/components/cart.md +44 -136
- package/docs/components/chart.md +95 -438
- package/docs/components/chat.md +175 -439
- package/docs/components/checkbox.md +52 -609
- package/docs/components/chip.md +45 -574
- package/docs/components/code-block.md +157 -421
- package/docs/components/color-display.md +45 -54
- package/docs/components/color-picker.md +103 -36
- package/docs/components/command-palette.md +98 -92
- package/docs/components/comments.md +16 -10
- package/docs/components/countdown.md +15 -20
- package/docs/components/cropper.md +14 -16
- package/docs/components/data-card.md +16 -15
- package/docs/components/date-picker.md +45 -25
- package/docs/components/date-range-picker.md +140 -87
- package/docs/components/date-time-picker.md +25 -28
- package/docs/components/diff.md +22 -17
- package/docs/components/divider.md +18 -20
- package/docs/components/doc.md +105 -197
- package/docs/components/draw.md +117 -223
- package/docs/components/drawer.md +113 -478
- package/docs/components/empty-state.md +13 -29
- package/docs/components/estimate.md +58 -118
- package/docs/components/file-gallery.md +123 -495
- package/docs/components/file-upload.md +36 -123
- package/docs/components/flip-card.md +30 -34
- package/docs/components/flow.md +74 -89
- package/docs/components/form-builder.md +59 -86
- package/docs/components/form-layout.md +21 -31
- package/docs/components/funnel.md +21 -22
- package/docs/components/gantt.md +5 -5
- package/docs/components/gauge.md +5 -23
- package/docs/components/heatmap.md +13 -55
- package/docs/components/image.md +28 -32
- package/docs/components/input.md +25 -14
- package/docs/components/invoice.md +34 -33
- package/docs/components/kanban.md +99 -394
- package/docs/components/key-value.md +22 -12
- package/docs/components/kpi.md +41 -112
- package/docs/components/layout.md +7 -13
- package/docs/components/leaderboard.md +52 -76
- package/docs/components/link-preview.md +20 -16
- package/docs/components/link.md +22 -19
- package/docs/components/list.md +44 -26
- package/docs/components/location.md +9 -13
- package/docs/components/login.md +42 -36
- package/docs/components/map.md +24 -46
- package/docs/components/markdown.md +14 -25
- package/docs/components/masonry.md +15 -13
- package/docs/components/mentions.md +36 -25
- package/docs/components/menu.md +39 -46
- package/docs/components/message-strip.md +15 -51
- package/docs/components/metric-table.md +50 -72
- package/docs/components/modal.md +32 -43
- package/docs/components/music-player.md +41 -49
- package/docs/components/nav.md +23 -13
- package/docs/components/network-graph.md +14 -13
- package/docs/components/notification-center.md +68 -172
- package/docs/components/order-tracker.md +72 -117
- package/docs/components/org-chart.md +58 -207
- package/docs/components/pagination.md +67 -89
- package/docs/components/paint.md +86 -172
- package/docs/components/pdf-viewer.md +46 -151
- package/docs/components/permission-matrix.md +61 -112
- package/docs/components/podcast-player.md +41 -119
- package/docs/components/pricing-table.md +104 -147
- package/docs/components/product-card.md +94 -197
- package/docs/components/progress-ring.md +29 -32
- package/docs/components/progress.md +30 -61
- package/docs/components/qr-code.md +53 -61
- package/docs/components/qr-reader.md +53 -42
- package/docs/components/radio.md +42 -40
- package/docs/components/range-slider.md +41 -30
- package/docs/components/rating.md +50 -84
- package/docs/components/receipt.md +91 -129
- package/docs/components/recipe.md +107 -216
- package/docs/components/sankey.md +47 -83
- package/docs/components/scheduler.md +81 -184
- package/docs/components/segmented-control.md +48 -40
- package/docs/components/select.md +107 -129
- package/docs/components/skeleton.md +33 -47
- package/docs/components/slider.md +49 -53
- package/docs/components/sortable.md +43 -186
- package/docs/components/sparkline.md +26 -25
- package/docs/components/spinner.md +32 -37
- package/docs/components/split-button.md +43 -23
- package/docs/components/split-pane.md +41 -58
- package/docs/components/spotlight.md +53 -145
- package/docs/components/spreadsheet.md +84 -307
- package/docs/components/stat-group.md +27 -61
- package/docs/components/step-input.md +44 -41
- package/docs/components/stepper.md +55 -89
- package/docs/components/switch.md +39 -39
- package/docs/components/table.md +27 -32
- package/docs/components/tabs.md +36 -27
- package/docs/components/tag-input.md +50 -176
- package/docs/components/tag.md +12 -50
- package/docs/components/terminal.md +32 -37
- package/docs/components/testimonial.md +24 -81
- package/docs/components/textarea.md +9 -14
- package/docs/components/theme.md +10 -23
- package/docs/components/time-picker.md +48 -72
- package/docs/components/time-range-picker.md +22 -41
- package/docs/components/timeline.md +7 -14
- package/docs/components/timer.md +16 -32
- package/docs/components/toast.md +19 -45
- package/docs/components/tooltip.md +13 -115
- package/docs/components/tree.md +2 -19
- package/docs/components/treemap.md +19 -43
- package/docs/components/user-card.md +13 -22
- package/docs/components/video-player.md +53 -227
- package/docs/components/virtual-scroller.md +11 -44
- package/docs/components/waterfall.md +58 -137
- package/docs/components/weather.md +94 -153
- package/docs/components/work-order.md +56 -143
- package/docs/plans/2026-03-09-action-bar-design.md +104 -0
- package/docs/plans/2026-03-09-action-bar-plan.md +676 -0
- package/docs/plans/2026-03-10-react-integration-design.md +166 -0
- package/docs/request-response.md +77 -0
- package/package.json +20 -10
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice v4.
|
|
2
|
+
* snice v4.29.0
|
|
3
3
|
* A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be loaded before snice-table.min.js");var SniceTable=function(e,t){"use strict";function a(e,t,a,i,s,n){function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var r,o=i.kind,c="getter"===o?"get":"setter"===o?"set":"value",d=!t&&e?i.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,i.name):{}),u=!1,p=a.length-1;p>=0;p--){var m={};for(var g in i)m[g]="access"===g?{}:i[g];for(var g in i.access)m.access[g]=i.access[g];m.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");n.push(l(e||null))};var b=(0,a[p])("accessor"===o?{get:h.get,set:h.set}:h[c],m);if("accessor"===o){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(r=l(b.get))&&(h.get=r),(r=l(b.set))&&(h.set=r),(r=l(b.init))&&s.unshift(r)}else(r=l(b))&&("field"===o?s.unshift(r):h[c]=r)}d&&Object.defineProperty(d,i.name,h),u=!0}function i(e,t,a){for(var i=arguments.length>2,s=0;s<t.length;s++)a=i?t[s].call(e,a):t[s].call(e);return i?a:void 0}function s(e,a="icon"){if(!e)return t.html``;if(e.startsWith("img://")){const i=e.slice(6);return t.html`<img class="${a}" src="${i}" alt="" part="icon" />`}if(e.startsWith("text://")){const i=e.slice(7);return t.html`<span class="${a}" part="icon">${i}</span>`}return/^(https?:\/\/|\/|\.\/|\.\.\/|data:)/.test(e)||/^[^:]*\w\.(svg|png|jpe?g|jfif|pjp|gif|webp|avif|jxl|ico|cur|bmp|tiff?|heic|heif|apng)$/i.test(e)?t.html`<img class="${a}" src="${e}" alt="" part="icon" />`:t.html`<span class="${a}" part="icon">${e}</span>`}"function"==typeof SuppressedError&&SuppressedError;(()=>{let e,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C,E,D,z,A,$,F,T,L,M,R,B,j,I,O,P,V,H,N,q,_,W,K,Y,U,G,J,X,Q,Z,ee,te,ae,ie,se,ne=[t.element("snice-input",{formAssociated:!0})],le=[],re=HTMLElement,oe=[],ce=[],de=[],he=[],ue=[],pe=[],me=[],ge=[],be=[],ve=[],ye=[],fe=[],we=[],ke=[],xe=[],Se=[],Ce=[],Ee=[],De=[],ze=[],Ae=[],$e=[],Fe=[],Te=[],Le=[],Me=[],Re=[],Be=[],je=[],Ie=[],Oe=[],Pe=[],Ve=[],He=[],Ne=[],qe=[],_e=[],We=[],Ke=[],Ye=[],Ue=[],Ge=[],Je=[],Xe=[],Qe=[],Ze=[],et=[],tt=[],at=[],it=[],st=[],nt=[],lt=[],rt=[],ot=[],ct=[],dt=[],ht=[],ut=[],pt=[],mt=[],gt=[],bt=[];(class extends re{static{n=this}static{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(re[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({})],d=[t.property({})],h=[t.property({})],u=[t.property({attribute:"helper-text"})],p=[t.property({attribute:"error-text"})],m=[t.property({type:Boolean})],g=[t.property({type:Boolean})],b=[t.property({type:Boolean})],v=[t.property({type:Boolean})],y=[t.property({type:Boolean})],f=[t.property({type:Boolean})],w=[t.property({type:Boolean})],k=[t.property({})],x=[t.property({})],S=[t.property({})],C=[t.property({})],E=[t.property({type:Number})],D=[t.property({type:Number})],z=[t.property({})],A=[t.property({})],$=[t.property({})],F=[t.property({attribute:"label-align"})],T=[t.property({type:Boolean})],L=[t.property({attribute:"prefix-icon"})],M=[t.property({attribute:"suffix-icon"})],R=[t.query(".input")],B=[t.query(".clear-button")],j=[t.query(".password-toggle")],I=[t.render()],O=[t.styles()],P=[t.ready()],V=[t.watch("value")],H=[t.watch("invalid")],N=[t.watch("disabled")],q=[t.watch("loading")],_=[t.watch("readonly")],W=[t.watch("placeholder")],K=[t.watch("min")],Y=[t.watch("max")],U=[t.watch("step")],G=[t.watch("maxlength")],J=[t.watch("minlength")],X=[t.watch("pattern")],Q=[t.watch("type")],Z=[t.watch("label")],ee=[t.dispatch("input-input",{bubbles:!0,composed:!0})],te=[t.dispatch("input-change",{bubbles:!0,composed:!0})],ae=[t.dispatch("input-focus",{bubbles:!0,composed:!0})],ie=[t.dispatch("input-blur",{bubbles:!0,composed:!0})],se=[t.dispatch("input-clear",{bubbles:!0,composed:!0})],a(this,null,I,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:s},null,oe),a(this,null,O,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:s},null,oe),a(this,null,P,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:s},null,oe),a(this,null,V,{kind:"method",name:"handleValueChange",static:!1,private:!1,access:{has:e=>"handleValueChange"in e,get:e=>e.handleValueChange},metadata:s},null,oe),a(this,null,H,{kind:"method",name:"handleInvalidChange",static:!1,private:!1,access:{has:e=>"handleInvalidChange"in e,get:e=>e.handleInvalidChange},metadata:s},null,oe),a(this,null,N,{kind:"method",name:"handleDisabledChange",static:!1,private:!1,access:{has:e=>"handleDisabledChange"in e,get:e=>e.handleDisabledChange},metadata:s},null,oe),a(this,null,q,{kind:"method",name:"handleLoadingChange",static:!1,private:!1,access:{has:e=>"handleLoadingChange"in e,get:e=>e.handleLoadingChange},metadata:s},null,oe),a(this,null,_,{kind:"method",name:"handleReadonlyChange",static:!1,private:!1,access:{has:e=>"handleReadonlyChange"in e,get:e=>e.handleReadonlyChange},metadata:s},null,oe),a(this,null,W,{kind:"method",name:"handlePlaceholderChange",static:!1,private:!1,access:{has:e=>"handlePlaceholderChange"in e,get:e=>e.handlePlaceholderChange},metadata:s},null,oe),a(this,null,K,{kind:"method",name:"handleMinChange",static:!1,private:!1,access:{has:e=>"handleMinChange"in e,get:e=>e.handleMinChange},metadata:s},null,oe),a(this,null,Y,{kind:"method",name:"handleMaxChange",static:!1,private:!1,access:{has:e=>"handleMaxChange"in e,get:e=>e.handleMaxChange},metadata:s},null,oe),a(this,null,U,{kind:"method",name:"handleStepChange",static:!1,private:!1,access:{has:e=>"handleStepChange"in e,get:e=>e.handleStepChange},metadata:s},null,oe),a(this,null,G,{kind:"method",name:"handleMaxLengthChange",static:!1,private:!1,access:{has:e=>"handleMaxLengthChange"in e,get:e=>e.handleMaxLengthChange},metadata:s},null,oe),a(this,null,J,{kind:"method",name:"handleMinLengthChange",static:!1,private:!1,access:{has:e=>"handleMinLengthChange"in e,get:e=>e.handleMinLengthChange},metadata:s},null,oe),a(this,null,X,{kind:"method",name:"handlePatternChange",static:!1,private:!1,access:{has:e=>"handlePatternChange"in e,get:e=>e.handlePatternChange},metadata:s},null,oe),a(this,null,Q,{kind:"method",name:"handleTypeChange",static:!1,private:!1,access:{has:e=>"handleTypeChange"in e,get:e=>e.handleTypeChange},metadata:s},null,oe),a(this,null,Z,{kind:"method",name:"handleLabelChange",static:!1,private:!1,access:{has:e=>"handleLabelChange"in e,get:e=>e.handleLabelChange},metadata:s},null,oe),a(this,null,ee,{kind:"method",name:"dispatchInputEvent",static:!1,private:!1,access:{has:e=>"dispatchInputEvent"in e,get:e=>e.dispatchInputEvent},metadata:s},null,oe),a(this,null,te,{kind:"method",name:"dispatchChangeEvent",static:!1,private:!1,access:{has:e=>"dispatchChangeEvent"in e,get:e=>e.dispatchChangeEvent},metadata:s},null,oe),a(this,null,ae,{kind:"method",name:"dispatchFocusEvent",static:!1,private:!1,access:{has:e=>"dispatchFocusEvent"in e,get:e=>e.dispatchFocusEvent},metadata:s},null,oe),a(this,null,ie,{kind:"method",name:"dispatchBlurEvent",static:!1,private:!1,access:{has:e=>"dispatchBlurEvent"in e,get:e=>e.dispatchBlurEvent},metadata:s},null,oe),a(this,null,se,{kind:"method",name:"dispatchClearEvent",static:!1,private:!1,access:{has:e=>"dispatchClearEvent"in e,get:e=>e.dispatchClearEvent},metadata:s},null,oe),a(null,null,l,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:s},ce,de),a(null,null,r,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:s},he,ue),a(null,null,o,{kind:"field",name:"variant",static:!1,private:!1,access:{has:e=>"variant"in e,get:e=>e.variant,set:(e,t)=>{e.variant=t}},metadata:s},pe,me),a(null,null,c,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:s},ge,be),a(null,null,d,{kind:"field",name:"placeholder",static:!1,private:!1,access:{has:e=>"placeholder"in e,get:e=>e.placeholder,set:(e,t)=>{e.placeholder=t}},metadata:s},ve,ye),a(null,null,h,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:s},fe,we),a(null,null,u,{kind:"field",name:"helperText",static:!1,private:!1,access:{has:e=>"helperText"in e,get:e=>e.helperText,set:(e,t)=>{e.helperText=t}},metadata:s},ke,xe),a(null,null,p,{kind:"field",name:"errorText",static:!1,private:!1,access:{has:e=>"errorText"in e,get:e=>e.errorText,set:(e,t)=>{e.errorText=t}},metadata:s},Se,Ce),a(null,null,m,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:s},Ee,De),a(null,null,g,{kind:"field",name:"readonly",static:!1,private:!1,access:{has:e=>"readonly"in e,get:e=>e.readonly,set:(e,t)=>{e.readonly=t}},metadata:s},ze,Ae),a(null,null,b,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:s},$e,Fe),a(null,null,v,{kind:"field",name:"required",static:!1,private:!1,access:{has:e=>"required"in e,get:e=>e.required,set:(e,t)=>{e.required=t}},metadata:s},Te,Le),a(null,null,y,{kind:"field",name:"invalid",static:!1,private:!1,access:{has:e=>"invalid"in e,get:e=>e.invalid,set:(e,t)=>{e.invalid=t}},metadata:s},Me,Re),a(null,null,f,{kind:"field",name:"clearable",static:!1,private:!1,access:{has:e=>"clearable"in e,get:e=>e.clearable,set:(e,t)=>{e.clearable=t}},metadata:s},Be,je),a(null,null,w,{kind:"field",name:"password",static:!1,private:!1,access:{has:e=>"password"in e,get:e=>e.password,set:(e,t)=>{e.password=t}},metadata:s},Ie,Oe),a(null,null,k,{kind:"field",name:"min",static:!1,private:!1,access:{has:e=>"min"in e,get:e=>e.min,set:(e,t)=>{e.min=t}},metadata:s},Pe,Ve),a(null,null,x,{kind:"field",name:"max",static:!1,private:!1,access:{has:e=>"max"in e,get:e=>e.max,set:(e,t)=>{e.max=t}},metadata:s},He,Ne),a(null,null,S,{kind:"field",name:"step",static:!1,private:!1,access:{has:e=>"step"in e,get:e=>e.step,set:(e,t)=>{e.step=t}},metadata:s},qe,_e),a(null,null,C,{kind:"field",name:"pattern",static:!1,private:!1,access:{has:e=>"pattern"in e,get:e=>e.pattern,set:(e,t)=>{e.pattern=t}},metadata:s},We,Ke),a(null,null,E,{kind:"field",name:"maxlength",static:!1,private:!1,access:{has:e=>"maxlength"in e,get:e=>e.maxlength,set:(e,t)=>{e.maxlength=t}},metadata:s},Ye,Ue),a(null,null,D,{kind:"field",name:"minlength",static:!1,private:!1,access:{has:e=>"minlength"in e,get:e=>e.minlength,set:(e,t)=>{e.minlength=t}},metadata:s},Ge,Je),a(null,null,z,{kind:"field",name:"autocomplete",static:!1,private:!1,access:{has:e=>"autocomplete"in e,get:e=>e.autocomplete,set:(e,t)=>{e.autocomplete=t}},metadata:s},Xe,Qe),a(null,null,A,{kind:"field",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:s},Ze,et),a(null,null,$,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:s},tt,at),a(null,null,F,{kind:"field",name:"labelAlign",static:!1,private:!1,access:{has:e=>"labelAlign"in e,get:e=>e.labelAlign,set:(e,t)=>{e.labelAlign=t}},metadata:s},it,st),a(null,null,T,{kind:"field",name:"stretch",static:!1,private:!1,access:{has:e=>"stretch"in e,get:e=>e.stretch,set:(e,t)=>{e.stretch=t}},metadata:s},nt,lt),a(null,null,L,{kind:"field",name:"prefixIcon",static:!1,private:!1,access:{has:e=>"prefixIcon"in e,get:e=>e.prefixIcon,set:(e,t)=>{e.prefixIcon=t}},metadata:s},rt,ot),a(null,null,M,{kind:"field",name:"suffixIcon",static:!1,private:!1,access:{has:e=>"suffixIcon"in e,get:e=>e.suffixIcon,set:(e,t)=>{e.suffixIcon=t}},metadata:s},ct,dt),a(null,null,R,{kind:"field",name:"input",static:!1,private:!1,access:{has:e=>"input"in e,get:e=>e.input,set:(e,t)=>{e.input=t}},metadata:s},ht,ut),a(null,null,B,{kind:"field",name:"clearButton",static:!1,private:!1,access:{has:e=>"clearButton"in e,get:e=>e.clearButton,set:(e,t)=>{e.clearButton=t}},metadata:s},pt,mt),a(null,null,j,{kind:"field",name:"passwordToggle",static:!1,private:!1,access:{has:e=>"passwordToggle"in e,get:e=>e.passwordToggle,set:(e,t)=>{e.passwordToggle=t}},metadata:s},gt,bt),a(null,e={value:n},ne,{kind:"class",name:n.name,metadata:s},null,le),n=e.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),i(n,le)}constructor(){super(),this.internals=i(this,oe),this.type=i(this,ce,"text"),this.size=(i(this,de),i(this,he,"medium")),this.variant=(i(this,ue),i(this,pe,"outlined")),this.value=(i(this,me),i(this,ge,"")),this.placeholder=(i(this,be),i(this,ve,"")),this.label=(i(this,ye),i(this,fe,"")),this.helperText=(i(this,we),i(this,ke,"")),this.errorText=(i(this,xe),i(this,Se,"")),this.disabled=(i(this,Ce),i(this,Ee,!1)),this.readonly=(i(this,De),i(this,ze,!1)),this.loading=(i(this,Ae),i(this,$e,!1)),this.required=(i(this,Fe),i(this,Te,!1)),this.invalid=(i(this,Le),i(this,Me,!1)),this.clearable=(i(this,Re),i(this,Be,!1)),this.password=(i(this,je),i(this,Ie,!1)),this.min=(i(this,Oe),i(this,Pe,"")),this.max=(i(this,Ve),i(this,He,"")),this.step=(i(this,Ne),i(this,qe,"")),this.pattern=(i(this,_e),i(this,We,"")),this.maxlength=(i(this,Ke),i(this,Ye,-1)),this.minlength=(i(this,Ue),i(this,Ge,-1)),this.autocomplete=(i(this,Je),i(this,Xe,"")),this.name=(i(this,Qe),i(this,Ze,"")),this.align=(i(this,et),i(this,tt,"")),this.labelAlign=(i(this,at),i(this,it,"left")),this.stretch=(i(this,st),i(this,nt,!1)),this.prefixIcon=(i(this,lt),i(this,rt,"")),this.suffixIcon=(i(this,ot),i(this,ct,"")),this.input=(i(this,dt),i(this,ht,void 0)),this.clearButton=(i(this,ut),i(this,pt,void 0)),this.passwordToggle=(i(this,mt),i(this,gt,void 0)),this.showPassword=(i(this,bt),!1),"function"==typeof this.attachInternals&&(this.internals=this.attachInternals())}render(){const e=["input",`input--${this.size}`,`input--${this.variant}`,this.invalid?"input--invalid":"",this.loading?"input--loading":"",this.prefixIcon?"input--with-prefix-icon":"",this.suffixIcon||"password"===this.type&&this.password||this.loading?"input--with-suffix-icon":"",this.clearable?"input--clearable":""].filter(Boolean).join(" "),a=["label",this.required?"label--required":""].filter(Boolean).join(" "),i=["clear-button",this.suffixIcon||"password"===this.type&&this.password?"clear-button--with-suffix":""].filter(Boolean).join(" ");return t.html`
|
|
7
|
+
void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be loaded before snice-table.min.js");var SniceTable=function(e,t){"use strict";function i(e,t,i,a,s,n){function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var r,o=a.kind,c="getter"===o?"get":"setter"===o?"set":"value",d=!t&&e?a.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,a.name):{}),u=!1,p=i.length-1;p>=0;p--){var m={};for(var g in a)m[g]="access"===g?{}:a[g];for(var g in a.access)m.access[g]=a.access[g];m.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");n.push(l(e||null))};var b=(0,i[p])("accessor"===o?{get:h.get,set:h.set}:h[c],m);if("accessor"===o){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(r=l(b.get))&&(h.get=r),(r=l(b.set))&&(h.set=r),(r=l(b.init))&&s.unshift(r)}else(r=l(b))&&("field"===o?s.unshift(r):h[c]=r)}d&&Object.defineProperty(d,a.name,h),u=!0}function a(e,t,i){for(var a=arguments.length>2,s=0;s<t.length;s++)i=a?t[s].call(e,i):t[s].call(e);return a?i:void 0}function s(e,i="icon"){if(!e)return t.html``;if(e.startsWith("img://")){const a=e.slice(6);return t.html`<img class="${i}" src="${a}" alt="" part="icon" />`}if(e.startsWith("text://")){const a=e.slice(7);return t.html`<span class="${i}" part="icon">${a}</span>`}return/^(https?:\/\/|\/|\.\/|\.\.\/|data:)/.test(e)||/^[^:]*\w\.(svg|png|jpe?g|jfif|pjp|gif|webp|avif|jxl|ico|cur|bmp|tiff?|heic|heif|apng)$/i.test(e)?t.html`<img class="${i}" src="${e}" alt="" part="icon" />`:t.html`<span class="${i}" part="icon">${e}</span>`}"function"==typeof SuppressedError&&SuppressedError;(()=>{let e,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C,E,D,z,A,$,F,T,L,M,R,B,j,I,O,P,V,H,N,q,_,W,K,Y,U,G,J,X,Q,Z,ee,te,ie,ae,se,ne=[t.element("snice-input",{formAssociated:!0})],le=[],re=HTMLElement,oe=[],ce=[],de=[],he=[],ue=[],pe=[],me=[],ge=[],be=[],ve=[],ye=[],fe=[],we=[],ke=[],xe=[],Se=[],Ce=[],Ee=[],De=[],ze=[],Ae=[],$e=[],Fe=[],Te=[],Le=[],Me=[],Re=[],Be=[],je=[],Ie=[],Oe=[],Pe=[],Ve=[],He=[],Ne=[],qe=[],_e=[],We=[],Ke=[],Ye=[],Ue=[],Ge=[],Je=[],Xe=[],Qe=[],Ze=[],et=[],tt=[],it=[],at=[],st=[],nt=[],lt=[],rt=[],ot=[],ct=[],dt=[],ht=[],ut=[],pt=[],mt=[],gt=[],bt=[];(class extends re{static{n=this}static{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(re[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({})],d=[t.property({})],h=[t.property({})],u=[t.property({attribute:"helper-text"})],p=[t.property({attribute:"error-text"})],m=[t.property({type:Boolean})],g=[t.property({type:Boolean})],b=[t.property({type:Boolean})],v=[t.property({type:Boolean})],y=[t.property({type:Boolean})],f=[t.property({type:Boolean})],w=[t.property({type:Boolean})],k=[t.property({})],x=[t.property({})],S=[t.property({})],C=[t.property({})],E=[t.property({type:Number})],D=[t.property({type:Number})],z=[t.property({})],A=[t.property({})],$=[t.property({})],F=[t.property({attribute:"label-align"})],T=[t.property({type:Boolean})],L=[t.property({attribute:"prefix-icon"})],M=[t.property({attribute:"suffix-icon"})],R=[t.query(".input")],B=[t.query(".clear-button")],j=[t.query(".password-toggle")],I=[t.render()],O=[t.styles()],P=[t.ready()],V=[t.watch("value")],H=[t.watch("invalid")],N=[t.watch("disabled")],q=[t.watch("loading")],_=[t.watch("readonly")],W=[t.watch("placeholder")],K=[t.watch("min")],Y=[t.watch("max")],U=[t.watch("step")],G=[t.watch("maxlength")],J=[t.watch("minlength")],X=[t.watch("pattern")],Q=[t.watch("type")],Z=[t.watch("label")],ee=[t.dispatch("input-input",{bubbles:!0,composed:!0})],te=[t.dispatch("input-change",{bubbles:!0,composed:!0})],ie=[t.dispatch("input-focus",{bubbles:!0,composed:!0})],ae=[t.dispatch("input-blur",{bubbles:!0,composed:!0})],se=[t.dispatch("input-clear",{bubbles:!0,composed:!0})],i(this,null,I,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:s},null,oe),i(this,null,O,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:s},null,oe),i(this,null,P,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:s},null,oe),i(this,null,V,{kind:"method",name:"handleValueChange",static:!1,private:!1,access:{has:e=>"handleValueChange"in e,get:e=>e.handleValueChange},metadata:s},null,oe),i(this,null,H,{kind:"method",name:"handleInvalidChange",static:!1,private:!1,access:{has:e=>"handleInvalidChange"in e,get:e=>e.handleInvalidChange},metadata:s},null,oe),i(this,null,N,{kind:"method",name:"handleDisabledChange",static:!1,private:!1,access:{has:e=>"handleDisabledChange"in e,get:e=>e.handleDisabledChange},metadata:s},null,oe),i(this,null,q,{kind:"method",name:"handleLoadingChange",static:!1,private:!1,access:{has:e=>"handleLoadingChange"in e,get:e=>e.handleLoadingChange},metadata:s},null,oe),i(this,null,_,{kind:"method",name:"handleReadonlyChange",static:!1,private:!1,access:{has:e=>"handleReadonlyChange"in e,get:e=>e.handleReadonlyChange},metadata:s},null,oe),i(this,null,W,{kind:"method",name:"handlePlaceholderChange",static:!1,private:!1,access:{has:e=>"handlePlaceholderChange"in e,get:e=>e.handlePlaceholderChange},metadata:s},null,oe),i(this,null,K,{kind:"method",name:"handleMinChange",static:!1,private:!1,access:{has:e=>"handleMinChange"in e,get:e=>e.handleMinChange},metadata:s},null,oe),i(this,null,Y,{kind:"method",name:"handleMaxChange",static:!1,private:!1,access:{has:e=>"handleMaxChange"in e,get:e=>e.handleMaxChange},metadata:s},null,oe),i(this,null,U,{kind:"method",name:"handleStepChange",static:!1,private:!1,access:{has:e=>"handleStepChange"in e,get:e=>e.handleStepChange},metadata:s},null,oe),i(this,null,G,{kind:"method",name:"handleMaxLengthChange",static:!1,private:!1,access:{has:e=>"handleMaxLengthChange"in e,get:e=>e.handleMaxLengthChange},metadata:s},null,oe),i(this,null,J,{kind:"method",name:"handleMinLengthChange",static:!1,private:!1,access:{has:e=>"handleMinLengthChange"in e,get:e=>e.handleMinLengthChange},metadata:s},null,oe),i(this,null,X,{kind:"method",name:"handlePatternChange",static:!1,private:!1,access:{has:e=>"handlePatternChange"in e,get:e=>e.handlePatternChange},metadata:s},null,oe),i(this,null,Q,{kind:"method",name:"handleTypeChange",static:!1,private:!1,access:{has:e=>"handleTypeChange"in e,get:e=>e.handleTypeChange},metadata:s},null,oe),i(this,null,Z,{kind:"method",name:"handleLabelChange",static:!1,private:!1,access:{has:e=>"handleLabelChange"in e,get:e=>e.handleLabelChange},metadata:s},null,oe),i(this,null,ee,{kind:"method",name:"dispatchInputEvent",static:!1,private:!1,access:{has:e=>"dispatchInputEvent"in e,get:e=>e.dispatchInputEvent},metadata:s},null,oe),i(this,null,te,{kind:"method",name:"dispatchChangeEvent",static:!1,private:!1,access:{has:e=>"dispatchChangeEvent"in e,get:e=>e.dispatchChangeEvent},metadata:s},null,oe),i(this,null,ie,{kind:"method",name:"dispatchFocusEvent",static:!1,private:!1,access:{has:e=>"dispatchFocusEvent"in e,get:e=>e.dispatchFocusEvent},metadata:s},null,oe),i(this,null,ae,{kind:"method",name:"dispatchBlurEvent",static:!1,private:!1,access:{has:e=>"dispatchBlurEvent"in e,get:e=>e.dispatchBlurEvent},metadata:s},null,oe),i(this,null,se,{kind:"method",name:"dispatchClearEvent",static:!1,private:!1,access:{has:e=>"dispatchClearEvent"in e,get:e=>e.dispatchClearEvent},metadata:s},null,oe),i(null,null,l,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:s},ce,de),i(null,null,r,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:s},he,ue),i(null,null,o,{kind:"field",name:"variant",static:!1,private:!1,access:{has:e=>"variant"in e,get:e=>e.variant,set:(e,t)=>{e.variant=t}},metadata:s},pe,me),i(null,null,c,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:s},ge,be),i(null,null,d,{kind:"field",name:"placeholder",static:!1,private:!1,access:{has:e=>"placeholder"in e,get:e=>e.placeholder,set:(e,t)=>{e.placeholder=t}},metadata:s},ve,ye),i(null,null,h,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:s},fe,we),i(null,null,u,{kind:"field",name:"helperText",static:!1,private:!1,access:{has:e=>"helperText"in e,get:e=>e.helperText,set:(e,t)=>{e.helperText=t}},metadata:s},ke,xe),i(null,null,p,{kind:"field",name:"errorText",static:!1,private:!1,access:{has:e=>"errorText"in e,get:e=>e.errorText,set:(e,t)=>{e.errorText=t}},metadata:s},Se,Ce),i(null,null,m,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:s},Ee,De),i(null,null,g,{kind:"field",name:"readonly",static:!1,private:!1,access:{has:e=>"readonly"in e,get:e=>e.readonly,set:(e,t)=>{e.readonly=t}},metadata:s},ze,Ae),i(null,null,b,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:s},$e,Fe),i(null,null,v,{kind:"field",name:"required",static:!1,private:!1,access:{has:e=>"required"in e,get:e=>e.required,set:(e,t)=>{e.required=t}},metadata:s},Te,Le),i(null,null,y,{kind:"field",name:"invalid",static:!1,private:!1,access:{has:e=>"invalid"in e,get:e=>e.invalid,set:(e,t)=>{e.invalid=t}},metadata:s},Me,Re),i(null,null,f,{kind:"field",name:"clearable",static:!1,private:!1,access:{has:e=>"clearable"in e,get:e=>e.clearable,set:(e,t)=>{e.clearable=t}},metadata:s},Be,je),i(null,null,w,{kind:"field",name:"password",static:!1,private:!1,access:{has:e=>"password"in e,get:e=>e.password,set:(e,t)=>{e.password=t}},metadata:s},Ie,Oe),i(null,null,k,{kind:"field",name:"min",static:!1,private:!1,access:{has:e=>"min"in e,get:e=>e.min,set:(e,t)=>{e.min=t}},metadata:s},Pe,Ve),i(null,null,x,{kind:"field",name:"max",static:!1,private:!1,access:{has:e=>"max"in e,get:e=>e.max,set:(e,t)=>{e.max=t}},metadata:s},He,Ne),i(null,null,S,{kind:"field",name:"step",static:!1,private:!1,access:{has:e=>"step"in e,get:e=>e.step,set:(e,t)=>{e.step=t}},metadata:s},qe,_e),i(null,null,C,{kind:"field",name:"pattern",static:!1,private:!1,access:{has:e=>"pattern"in e,get:e=>e.pattern,set:(e,t)=>{e.pattern=t}},metadata:s},We,Ke),i(null,null,E,{kind:"field",name:"maxlength",static:!1,private:!1,access:{has:e=>"maxlength"in e,get:e=>e.maxlength,set:(e,t)=>{e.maxlength=t}},metadata:s},Ye,Ue),i(null,null,D,{kind:"field",name:"minlength",static:!1,private:!1,access:{has:e=>"minlength"in e,get:e=>e.minlength,set:(e,t)=>{e.minlength=t}},metadata:s},Ge,Je),i(null,null,z,{kind:"field",name:"autocomplete",static:!1,private:!1,access:{has:e=>"autocomplete"in e,get:e=>e.autocomplete,set:(e,t)=>{e.autocomplete=t}},metadata:s},Xe,Qe),i(null,null,A,{kind:"field",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:s},Ze,et),i(null,null,$,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:s},tt,it),i(null,null,F,{kind:"field",name:"labelAlign",static:!1,private:!1,access:{has:e=>"labelAlign"in e,get:e=>e.labelAlign,set:(e,t)=>{e.labelAlign=t}},metadata:s},at,st),i(null,null,T,{kind:"field",name:"stretch",static:!1,private:!1,access:{has:e=>"stretch"in e,get:e=>e.stretch,set:(e,t)=>{e.stretch=t}},metadata:s},nt,lt),i(null,null,L,{kind:"field",name:"prefixIcon",static:!1,private:!1,access:{has:e=>"prefixIcon"in e,get:e=>e.prefixIcon,set:(e,t)=>{e.prefixIcon=t}},metadata:s},rt,ot),i(null,null,M,{kind:"field",name:"suffixIcon",static:!1,private:!1,access:{has:e=>"suffixIcon"in e,get:e=>e.suffixIcon,set:(e,t)=>{e.suffixIcon=t}},metadata:s},ct,dt),i(null,null,R,{kind:"field",name:"input",static:!1,private:!1,access:{has:e=>"input"in e,get:e=>e.input,set:(e,t)=>{e.input=t}},metadata:s},ht,ut),i(null,null,B,{kind:"field",name:"clearButton",static:!1,private:!1,access:{has:e=>"clearButton"in e,get:e=>e.clearButton,set:(e,t)=>{e.clearButton=t}},metadata:s},pt,mt),i(null,null,j,{kind:"field",name:"passwordToggle",static:!1,private:!1,access:{has:e=>"passwordToggle"in e,get:e=>e.passwordToggle,set:(e,t)=>{e.passwordToggle=t}},metadata:s},gt,bt),i(null,e={value:n},ne,{kind:"class",name:n.name,metadata:s},null,le),n=e.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),a(n,le)}constructor(){super(),this.internals=a(this,oe),this.type=a(this,ce,"text"),this.size=(a(this,de),a(this,he,"medium")),this.variant=(a(this,ue),a(this,pe,"outlined")),this.value=(a(this,me),a(this,ge,"")),this.placeholder=(a(this,be),a(this,ve,"")),this.label=(a(this,ye),a(this,fe,"")),this.helperText=(a(this,we),a(this,ke,"")),this.errorText=(a(this,xe),a(this,Se,"")),this.disabled=(a(this,Ce),a(this,Ee,!1)),this.readonly=(a(this,De),a(this,ze,!1)),this.loading=(a(this,Ae),a(this,$e,!1)),this.required=(a(this,Fe),a(this,Te,!1)),this.invalid=(a(this,Le),a(this,Me,!1)),this.clearable=(a(this,Re),a(this,Be,!1)),this.password=(a(this,je),a(this,Ie,!1)),this.min=(a(this,Oe),a(this,Pe,"")),this.max=(a(this,Ve),a(this,He,"")),this.step=(a(this,Ne),a(this,qe,"")),this.pattern=(a(this,_e),a(this,We,"")),this.maxlength=(a(this,Ke),a(this,Ye,-1)),this.minlength=(a(this,Ue),a(this,Ge,-1)),this.autocomplete=(a(this,Je),a(this,Xe,"")),this.name=(a(this,Qe),a(this,Ze,"")),this.align=(a(this,et),a(this,tt,"")),this.labelAlign=(a(this,it),a(this,at,"left")),this.stretch=(a(this,st),a(this,nt,!1)),this.prefixIcon=(a(this,lt),a(this,rt,"")),this.suffixIcon=(a(this,ot),a(this,ct,"")),this.input=(a(this,dt),a(this,ht,void 0)),this.clearButton=(a(this,ut),a(this,pt,void 0)),this.passwordToggle=(a(this,mt),a(this,gt,void 0)),this.showPassword=(a(this,bt),!1),"function"==typeof this.attachInternals&&(this.internals=this.attachInternals())}render(){const e=["input",`input--${this.size}`,`input--${this.variant}`,this.invalid?"input--invalid":"",this.loading?"input--loading":"",this.prefixIcon?"input--with-prefix-icon":"",this.suffixIcon||"password"===this.type&&this.password||this.loading?"input--with-suffix-icon":"",this.clearable?"input--clearable":""].filter(Boolean).join(" "),i=["label",this.required?"label--required":""].filter(Boolean).join(" "),a=["clear-button",this.suffixIcon||"password"===this.type&&this.password?"clear-button--with-suffix":""].filter(Boolean).join(" ");return t.html`
|
|
8
8
|
<div class="input-wrapper" part="wrapper">
|
|
9
9
|
<if ${this.label}>
|
|
10
|
-
<label class="${
|
|
10
|
+
<label class="${i}" part="label">
|
|
11
11
|
${this.label}
|
|
12
12
|
</label>
|
|
13
13
|
</if>
|
|
@@ -45,7 +45,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
45
45
|
/>
|
|
46
46
|
|
|
47
47
|
<button
|
|
48
|
-
class="${
|
|
48
|
+
class="${a}"
|
|
49
49
|
type="button"
|
|
50
50
|
aria-label="Clear"
|
|
51
51
|
tabindex="-1"
|
|
@@ -101,7 +101,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
101
101
|
</default>
|
|
102
102
|
</case>
|
|
103
103
|
</div>
|
|
104
|
-
`}styles(){return t.css`${":host{display:inline-block;width:100%;max-width:100%;box-sizing:border-box;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);color-scheme:light dark}.input-wrapper{position:relative;width:100%;max-width:100%;height:100%;box-sizing:border-box}:host([align]) .input-wrapper{display:flex;flex-direction:column}:host([align=top]) .input-wrapper{justify-content:flex-start}:host([align=center]) .input-wrapper{justify-content:center}:host([align=bottom]) .input-wrapper{justify-content:flex-end}.input-container{position:relative;display:flex;align-items:center;width:100%;max-width:100%;box-sizing:border-box;transition:all var(--snice-transition-fast, 150ms) ease}:host([stretch]) .input-wrapper{display:flex;flex-direction:column}:host([stretch]) .input-container{flex:1}:host([stretch]) .input{height:100%}.input{flex:1;min-width:0;box-sizing:border-box;font-family:inherit;font-size:var(--snice-font-size-md, 1rem);background:var(--snice-color-background-input,rgb(248 247 245));color:var(--snice-color-text,rgb(23 23 23));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transition:all var(--snice-transition-fast, 150ms) ease;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.input:focus{border-color:var(--snice-color-primary,rgb(37 99 235));box-shadow:0 0 0 var(--snice-focus-ring-width,2px) var(--snice-focus-ring-color,rgb(59 130 246 / .5)),var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05))}.input:disabled{background:var(--snice-color-background-secondary,rgb(250 250 250));color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:not-allowed;opacity:.6}.input::placeholder{color:var(--snice-color-text-secondary,rgb(82 82 82));opacity:.7}.input--small{padding:.375rem .625rem;font-size:var(--snice-font-size-sm, .875rem);min-height:2rem}.input--medium{padding:.5rem .75rem;font-size:var(--snice-font-size-md, 1rem);min-height:2.5rem}.input--large{padding:.625rem .875rem;font-size:var(--snice-font-size-lg, 1.125rem);min-height:3rem}.input--outlined{background:var(--snice-color-background-input,rgb(248 247 245));border:1px solid var(--snice-color-border,rgb(226 226 226))}.input--filled{background:var(--snice-color-background-secondary,rgb(250 250 250));border:1px solid transparent;border-bottom-color:var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem) var(--snice-border-radius-md,.25rem) 0 0}.input--filled:focus{background:var(--snice-color-background-hover,rgb(245 245 245));border-bottom-color:var(--snice-color-primary,rgb(37 99 235))}.input--underlined{background:0 0;border:none;border-bottom:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:0;padding-left:0;padding-right:0}.input--underlined:focus{border-bottom-color:var(--snice-color-primary,rgb(37 99 235));box-shadow:none}.input--invalid{border-color:var(--snice-color-danger,rgb(220 38 38))}.input--invalid:focus{border-color:var(--snice-color-danger,rgb(220 38 38));box-shadow:0 0 0 var(--snice-focus-ring-width,2px) var(--snice-color-danger-alpha,rgb(220 38 38 / .4)),var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05))}.input::-webkit-calendar-picker-indicator{cursor:pointer;opacity:.7}.input::-webkit-calendar-picker-indicator:hover{opacity:1}.input--with-prefix-icon{padding-left:2.5rem}.input--clearable,.input--with-suffix-icon{padding-right:2.5rem}.input--with-suffix-icon.input--clearable{padding-right:4rem}.label{display:block;margin-bottom:.25rem;font-size:var(--snice-font-size-sm, .875rem);font-weight:var(--snice-font-weight-medium,500);line-height:var(--snice-line-height-normal, 1.5);color:var(--snice-color-text,rgb(23 23 23));text-align:left}:host([label-align=center]) .label{text-align:center}:host([label-align=right]) .label{text-align:right}.label--required::after{content:' *';color:var(--snice-color-danger,rgb(220 38 38))}.error-text,.helper-text{display:block;margin-top:.25rem;font-size:var(--snice-font-size-xs, .75rem)}.helper-text{color:var(--snice-color-text-secondary,rgb(82 82 82))}.error-text{color:var(--snice-color-danger,rgb(220 38 38))}.icon-slot{position:absolute;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;color:var(--snice-color-text-secondary,rgb(82 82 82));pointer-events:none;opacity:.7}.icon-slot:empty{display:none}.icon-slot--prefix{left:.625rem}.icon-slot--suffix{right:.625rem}.icon{display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;font-size:1.25rem;line-height:1;color:var(--snice-color-text-secondary,rgb(82 82 82));pointer-events:none}.icon-slot ::slotted(*){display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;font-size:1.25rem;line-height:1}.icon-slot ::slotted(svg){width:1.5rem;height:1.5rem}.icon-slot ::slotted(img){width:1.5rem;height:1.5rem;object-fit:contain}.clear-button{position:absolute;right:.5rem;display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.25rem;background:0 0;border:none;border-radius:var(--snice-border-radius-sm,.125rem);color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:pointer;transition:all var(--snice-transition-fast, 150ms) ease;opacity:0;visibility:hidden}.clear-button:hover{background:var(--snice-color-background-hover,rgb(245 245 245));color:var(--snice-color-text,rgb(23 23 23))}.input-container:hover .clear-button--visible,.input:focus~.clear-button--visible{opacity:1;visibility:visible}.clear-button--with-suffix{right:2rem}.password-toggle{position:absolute;right:.5rem;display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.25rem;background:0 0;border:none;border-radius:var(--snice-border-radius-sm,.125rem);color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:pointer;transition:all var(--snice-transition-fast, 150ms) ease}.password-toggle:hover{background:var(--snice-color-background-hover,rgb(245 245 245));color:var(--snice-color-text,rgb(23 23 23))}.input[type=number]::-webkit-inner-spin-button,.input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input[type=number]{-moz-appearance:textfield}.input[type=search]::-webkit-search-cancel-button,.input[type=search]::-webkit-search-decoration,.input[type=search]::-webkit-search-results-button,.input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}.input-container:focus-within{z-index:1}.input--loading{cursor:wait}.spinner{position:absolute;right:.75rem;width:1em;height:1em;pointer-events:none}.input--with-suffix-icon .spinner{right:2.5rem}.spinner::after{content:'';display:block;width:100%;height:100%;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:.6s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}"}`}init(){if(this.internals&&this.internals.setFormValue(this.value),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}this.input&&this.invalid&&(this.input.setAttribute("aria-invalid","true"),this.input.classList.add("input--invalid")),this.input&&("number"===this.type&&(this.min&&(this.input.min=this.min),this.max&&(this.input.max=this.max),this.step&&(this.input.step=this.step)),this.maxlength>0&&(this.input.maxLength=this.maxlength),this.minlength>0&&(this.input.minLength=this.minlength),this.pattern&&(this.input.pattern=this.pattern),this.placeholder&&(this.input.placeholder=this.placeholder),this.value&&(this.input.value=this.value),this.input.disabled=this.disabled,this.input.readOnly=this.readonly,this.input.required=this.required)}handleInput(e){const t=e.target;this.value=t.value,this.dispatchInputEvent()}handleChange(e){const t=e.target;this.value=t.value,this.dispatchChangeEvent()}handleFocus(e){this.dispatchFocusEvent()}handleBlur(e){this.dispatchBlurEvent()}handleClear(e){this.clear()}handlePasswordToggle(e){if(this.showPassword=!this.showPassword,this.input&&(this.input.type=this.showPassword?"text":"password"),this.passwordToggle){const e=this.passwordToggle.querySelector(".password-icon--hidden"),t=this.passwordToggle.querySelector(".password-icon--visible");e&&t&&(e.style.display=this.showPassword?"none":"",t.style.display=this.showPassword?"":"none",this.passwordToggle.setAttribute("aria-label",this.showPassword?"Hide password":"Show password"))}}handleValueChange(){if(this.input&&this.input.value!==this.value&&(this.input.value=this.value),this.internals&&this.internals.setFormValue(this.value),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}}handleInvalidChange(){this.input&&(this.input.setAttribute("aria-invalid",String(this.invalid)),this.invalid?this.input.classList.add("input--invalid"):this.input.classList.remove("input--invalid"))}handleDisabledChange(){if(this.input&&(this.input.disabled=this.disabled||this.loading),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}}handleLoadingChange(){if(this.input&&(this.input.disabled=this.disabled||this.loading),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}}handleReadonlyChange(){if(this.input&&(this.input.readOnly=this.readonly),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}}handlePlaceholderChange(){this.input&&(this.input.placeholder=this.placeholder)}handleMinChange(){this.input&&"number"===this.type&&(this.input.min=this.min)}handleMaxChange(){this.input&&"number"===this.type&&(this.input.max=this.max)}handleStepChange(){this.input&&"number"===this.type&&(this.input.step=this.step)}handleMaxLengthChange(){this.input&&this.maxlength>0&&(this.input.maxLength=this.maxlength)}handleMinLengthChange(){this.input&&this.minlength>0&&(this.input.minLength=this.minlength)}handlePatternChange(){this.input&&(this.input.pattern=this.pattern)}handleTypeChange(){this.input&&"password"!==this.type&&(this.input.type=this.type)}handleLabelChange(){const e=this.shadowRoot?.querySelector(".label");if(e){e.textContent=this.label;const t=e.parentElement;t&&(t.style.display=this.label?"":"none")}}dispatchInputEvent(){return{value:this.value,input:this}}dispatchChangeEvent(){return{value:this.value,input:this}}dispatchFocusEvent(){return{input:this}}dispatchBlurEvent(){return{input:this}}dispatchClearEvent(){return{input:this}}focus(){this.input?.focus()}blur(){this.input?.blur()}select(){this.input?.select()}clear(){this.value="",this.input&&(this.input.value=""),this.dispatchClearEvent(),this.dispatchInputEvent(),this.dispatchChangeEvent(),this.focus()}checkValidity(){return this.input?.checkValidity()??!0}reportValidity(){return this.input?.reportValidity()??!0}setCustomValidity(e){this.input?.setCustomValidity(e)}})})(),(()=>{let e,s,n,l,r,o,c,d,h,u,p=[t.element("snice-option")],m=[],g=HTMLElement,b=[],v=[],y=[],f=[],w=[],k=[],x=[],S=[],C=[],E=[],D=[];(class extends g{static{s=this}static{const z="function"==typeof Symbol&&Symbol.metadata?Object.create(g[Symbol.metadata]??null):void 0;n=[t.property({})],l=[t.property({})],r=[t.property({type:Boolean})],o=[t.property({type:Boolean})],c=[t.property({})],d=[t.render()],h=[t.styles()],u=[t.ready()],a(this,null,d,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:z},null,b),a(this,null,h,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:z},null,b),a(this,null,u,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:z},null,b),a(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:z},v,y),a(null,null,l,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:z},f,w),a(null,null,r,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:z},k,x),a(null,null,o,{kind:"field",name:"selected",static:!1,private:!1,access:{has:e=>"selected"in e,get:e=>e.selected,set:(e,t)=>{e.selected=t}},metadata:z},S,C),a(null,null,c,{kind:"field",name:"icon",static:!1,private:!1,access:{has:e=>"icon"in e,get:e=>e.icon,set:(e,t)=>{e.icon=t}},metadata:z},E,D),a(null,e={value:s},p,{kind:"class",name:s.name,metadata:z},null,m),s=e.value,z&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:z}),i(s,m)}render(){return t.html``}styles(){return t.css`:host { display: none; }`}init(){!this.label&&this.textContent&&(this.label=this.textContent.trim()),!this.value&&this.label&&(this.value=this.label)}get optionData(){return{value:this.value,label:this.label||this.textContent?.trim()||this.value,disabled:this.disabled,selected:this.selected,icon:this.icon}}constructor(){super(...arguments),this.value=(i(this,b),i(this,v,"")),this.label=(i(this,y),i(this,f,"")),this.disabled=(i(this,w),i(this,k,!1)),this.selected=(i(this,x),i(this,S,!1)),this.icon=(i(this,C),i(this,E,"")),i(this,D)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C,E,D,z,A,$,F,T,L,M,R,B,j,I,O,P,V,H,N,q,_,W,K,Y,U,G=[t.element("snice-select",{formAssociated:!0})],J=[],X=HTMLElement,Q=[],Z=[],ee=[],te=[],ae=[],ie=[],se=[],ne=[],le=[],re=[],oe=[],ce=[],de=[],he=[],ue=[],pe=[],me=[],ge=[],be=[],ve=[],ye=[],fe=[],we=[],ke=[],xe=[],Se=[],Ce=[],Ee=[],De=[],ze=[],Ae=[],$e=[],Fe=[],Te=[],Le=[],Me=[],Re=[],Be=[],je=[],Ie=[],Oe=[],Pe=[],Ve=[],He=[],Ne=[],qe=[],_e=[],We=[],Ke=[],Ye=[],Ue=[],Ge=[],Je=[],Xe=[],Qe=[],Ze=[],et=[],tt=[],at=[],it=[],st=[],nt=[],lt=[];(class extends X{static{s=this}static{const rt="function"==typeof Symbol&&Symbol.metadata?Object.create(X[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean})],l=[t.property({type:Boolean})],r=[t.property({type:Boolean})],o=[t.property({type:Boolean})],c=[t.property({type:Boolean})],d=[t.property({type:Boolean})],h=[t.property({type:Boolean})],u=[t.property({type:Boolean})],p=[t.property({type:Boolean,attribute:"allow-free-text"})],m=[t.property({type:Boolean})],g=[t.property({type:Boolean})],b=[t.property({type:Number,attribute:"search-debounce"})],v=[t.property({type:Boolean})],y=[t.property({})],f=[t.property({})],w=[t.property({})],k=[t.property({})],x=[t.property({})],S=[t.property({attribute:"max-height"})],C=[t.property({type:Array,attribute:!1})],E=[t.query(".select-trigger")],D=[t.query(".select-dropdown")],z=[t.query(".select-value")],A=[t.query(".select-label")],$=[t.query(".select-search-input")],F=[t.query(".select-options")],T=[t.query(".select-clear")],L=[t.query(".select-arrow")],M=[t.query(".select-search")],R=[t.query(".select-editable-input")],B=[t.queryAll(".select-option")],j=[t.request("select/search")],I=[t.render()],O=[t.styles()],P=[t.ready()],V=[t.dispose()],H=[t.watch("value")],N=[t.watch("options")],q=[t.watch("disabled")],_=[t.watch("loading")],W=[t.watch("open")],K=[t.dispatch("select-change",{bubbles:!0,composed:!0})],Y=[t.dispatch("select-open",{bubbles:!0,composed:!0})],U=[t.dispatch("select-close",{bubbles:!0,composed:!0})],a(this,null,j,{kind:"method",name:"performRemoteSearch",static:!1,private:!1,access:{has:e=>"performRemoteSearch"in e,get:e=>e.performRemoteSearch},metadata:rt},null,Q),a(this,null,I,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:rt},null,Q),a(this,null,O,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:rt},null,Q),a(this,null,P,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:rt},null,Q),a(this,null,V,{kind:"method",name:"cleanup",static:!1,private:!1,access:{has:e=>"cleanup"in e,get:e=>e.cleanup},metadata:rt},null,Q),a(this,null,H,{kind:"method",name:"handleValueChange",static:!1,private:!1,access:{has:e=>"handleValueChange"in e,get:e=>e.handleValueChange},metadata:rt},null,Q),a(this,null,N,{kind:"method",name:"handleOptionsPropertyChange",static:!1,private:!1,access:{has:e=>"handleOptionsPropertyChange"in e,get:e=>e.handleOptionsPropertyChange},metadata:rt},null,Q),a(this,null,q,{kind:"method",name:"handleDisabledChange",static:!1,private:!1,access:{has:e=>"handleDisabledChange"in e,get:e=>e.handleDisabledChange},metadata:rt},null,Q),a(this,null,_,{kind:"method",name:"handleLoadingChange",static:!1,private:!1,access:{has:e=>"handleLoadingChange"in e,get:e=>e.handleLoadingChange},metadata:rt},null,Q),a(this,null,W,{kind:"method",name:"handleOpenChange",static:!1,private:!1,access:{has:e=>"handleOpenChange"in e,get:e=>e.handleOpenChange},metadata:rt},null,Q),a(this,null,K,{kind:"method",name:"dispatchChangeEvent",static:!1,private:!1,access:{has:e=>"dispatchChangeEvent"in e,get:e=>e.dispatchChangeEvent},metadata:rt},null,Q),a(this,null,Y,{kind:"method",name:"dispatchOpenEvent",static:!1,private:!1,access:{has:e=>"dispatchOpenEvent"in e,get:e=>e.dispatchOpenEvent},metadata:rt},null,Q),a(this,null,U,{kind:"method",name:"dispatchCloseEvent",static:!1,private:!1,access:{has:e=>"dispatchCloseEvent"in e,get:e=>e.dispatchCloseEvent},metadata:rt},null,Q),a(null,null,n,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:rt},Z,ee),a(null,null,l,{kind:"field",name:"required",static:!1,private:!1,access:{has:e=>"required"in e,get:e=>e.required,set:(e,t)=>{e.required=t}},metadata:rt},te,ae),a(null,null,r,{kind:"field",name:"invalid",static:!1,private:!1,access:{has:e=>"invalid"in e,get:e=>e.invalid,set:(e,t)=>{e.invalid=t}},metadata:rt},ie,se),a(null,null,o,{kind:"field",name:"readonly",static:!1,private:!1,access:{has:e=>"readonly"in e,get:e=>e.readonly,set:(e,t)=>{e.readonly=t}},metadata:rt},ne,le),a(null,null,c,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:rt},re,oe),a(null,null,d,{kind:"field",name:"multiple",static:!1,private:!1,access:{has:e=>"multiple"in e,get:e=>e.multiple,set:(e,t)=>{e.multiple=t}},metadata:rt},ce,de),a(null,null,h,{kind:"field",name:"searchable",static:!1,private:!1,access:{has:e=>"searchable"in e,get:e=>e.searchable,set:(e,t)=>{e.searchable=t}},metadata:rt},he,ue),a(null,null,u,{kind:"field",name:"clearable",static:!1,private:!1,access:{has:e=>"clearable"in e,get:e=>e.clearable,set:(e,t)=>{e.clearable=t}},metadata:rt},pe,me),a(null,null,p,{kind:"field",name:"allowFreeText",static:!1,private:!1,access:{has:e=>"allowFreeText"in e,get:e=>e.allowFreeText,set:(e,t)=>{e.allowFreeText=t}},metadata:rt},ge,be),a(null,null,m,{kind:"field",name:"editable",static:!1,private:!1,access:{has:e=>"editable"in e,get:e=>e.editable,set:(e,t)=>{e.editable=t}},metadata:rt},ve,ye),a(null,null,g,{kind:"field",name:"remote",static:!1,private:!1,access:{has:e=>"remote"in e,get:e=>e.remote,set:(e,t)=>{e.remote=t}},metadata:rt},fe,we),a(null,null,b,{kind:"field",name:"searchDebounce",static:!1,private:!1,access:{has:e=>"searchDebounce"in e,get:e=>e.searchDebounce,set:(e,t)=>{e.searchDebounce=t}},metadata:rt},ke,xe),a(null,null,v,{kind:"field",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:rt},Se,Ce),a(null,null,y,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:rt},Ee,De),a(null,null,f,{kind:"field",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:rt},ze,Ae),a(null,null,w,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:rt},$e,Fe),a(null,null,k,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:rt},Te,Le),a(null,null,x,{kind:"field",name:"placeholder",static:!1,private:!1,access:{has:e=>"placeholder"in e,get:e=>e.placeholder,set:(e,t)=>{e.placeholder=t}},metadata:rt},Me,Re),a(null,null,S,{kind:"field",name:"maxHeight",static:!1,private:!1,access:{has:e=>"maxHeight"in e,get:e=>e.maxHeight,set:(e,t)=>{e.maxHeight=t}},metadata:rt},Be,je),a(null,null,C,{kind:"field",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:rt},Ie,Oe),a(null,null,E,{kind:"field",name:"trigger",static:!1,private:!1,access:{has:e=>"trigger"in e,get:e=>e.trigger,set:(e,t)=>{e.trigger=t}},metadata:rt},Pe,Ve),a(null,null,D,{kind:"field",name:"dropdown",static:!1,private:!1,access:{has:e=>"dropdown"in e,get:e=>e.dropdown,set:(e,t)=>{e.dropdown=t}},metadata:rt},He,Ne),a(null,null,z,{kind:"field",name:"valueDisplay",static:!1,private:!1,access:{has:e=>"valueDisplay"in e,get:e=>e.valueDisplay,set:(e,t)=>{e.valueDisplay=t}},metadata:rt},qe,_e),a(null,null,A,{kind:"field",name:"labelElement",static:!1,private:!1,access:{has:e=>"labelElement"in e,get:e=>e.labelElement,set:(e,t)=>{e.labelElement=t}},metadata:rt},We,Ke),a(null,null,$,{kind:"field",name:"searchInput",static:!1,private:!1,access:{has:e=>"searchInput"in e,get:e=>e.searchInput,set:(e,t)=>{e.searchInput=t}},metadata:rt},Ye,Ue),a(null,null,F,{kind:"field",name:"optionsList",static:!1,private:!1,access:{has:e=>"optionsList"in e,get:e=>e.optionsList,set:(e,t)=>{e.optionsList=t}},metadata:rt},Ge,Je),a(null,null,T,{kind:"field",name:"clearButton",static:!1,private:!1,access:{has:e=>"clearButton"in e,get:e=>e.clearButton,set:(e,t)=>{e.clearButton=t}},metadata:rt},Xe,Qe),a(null,null,L,{kind:"field",name:"arrow",static:!1,private:!1,access:{has:e=>"arrow"in e,get:e=>e.arrow,set:(e,t)=>{e.arrow=t}},metadata:rt},Ze,et),a(null,null,M,{kind:"field",name:"searchContainer",static:!1,private:!1,access:{has:e=>"searchContainer"in e,get:e=>e.searchContainer,set:(e,t)=>{e.searchContainer=t}},metadata:rt},tt,at),a(null,null,R,{kind:"field",name:"editableInput",static:!1,private:!1,access:{has:e=>"editableInput"in e,get:e=>e.editableInput,set:(e,t)=>{e.editableInput=t}},metadata:rt},it,st),a(null,null,B,{kind:"field",name:"optionElements",static:!1,private:!1,access:{has:e=>"optionElements"in e,get:e=>e.optionElements,set:(e,t)=>{e.optionElements=t}},metadata:rt},nt,lt),a(null,e={value:s},G,{kind:"class",name:s.name,metadata:rt},null,J),s=e.value,rt&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:rt}),i(s,J)}constructor(){super(),this.internals=i(this,Q),this.disabled=i(this,Z,!1),this.required=(i(this,ee),i(this,te,!1)),this.invalid=(i(this,ae),i(this,ie,!1)),this.readonly=(i(this,se),i(this,ne,!1)),this.loading=(i(this,le),i(this,re,!1)),this.multiple=(i(this,oe),i(this,ce,!1)),this.searchable=(i(this,de),i(this,he,!1)),this.clearable=(i(this,ue),i(this,pe,!1)),this.allowFreeText=(i(this,me),i(this,ge,!1)),this.editable=(i(this,be),i(this,ve,!1)),this.remote=(i(this,ye),i(this,fe,!1)),this.searchDebounce=(i(this,we),i(this,ke,300)),this.open=(i(this,xe),i(this,Se,!1)),this.size=(i(this,Ce),i(this,Ee,"medium")),this.name=(i(this,De),i(this,ze,"")),this.value=(i(this,Ae),i(this,$e,"")),this.label=(i(this,Fe),i(this,Te,"")),this.placeholder=(i(this,Le),i(this,Me,"Select an option")),this.maxHeight=(i(this,Re),i(this,Be,"200px")),this.options=(i(this,je),i(this,Ie,[])),this.childOptions=(i(this,Oe),[]),this.trigger=i(this,Pe,void 0),this.dropdown=(i(this,Ve),i(this,He,void 0)),this.valueDisplay=(i(this,Ne),i(this,qe,void 0)),this.labelElement=(i(this,_e),i(this,We,void 0)),this.searchInput=(i(this,Ke),i(this,Ye,void 0)),this.optionsList=(i(this,Ue),i(this,Ge,void 0)),this.clearButton=(i(this,Je),i(this,Xe,void 0)),this.arrow=(i(this,Qe),i(this,Ze,void 0)),this.searchContainer=(i(this,et),i(this,tt,void 0)),this.editableInput=(i(this,at),i(this,it,void 0)),this.optionElements=(i(this,st),i(this,nt,void 0)),this.filteredOptions=(i(this,lt),[]),this.selectedValues=new Set,this.focusedIndex=-1,this.editableInputValue="",this.remoteSearchTimeout=0,this.remoteSearching=!1,"function"==typeof this.attachInternals&&(this.internals=this.attachInternals())}get mergedOptions(){if(this.childOptions.length>0&&this.options.length>0){const e=new Set(this.childOptions.map(e=>e.value));return[...this.childOptions,...this.options.filter(t=>!e.has(t.value))]}return this.childOptions.length>0?this.childOptions:this.options}async*performRemoteSearch(e){this.remoteSearching=!0,this.updateDropdownContent();try{const t={query:e,select:this},a=await(yield t);this.remoteSearching=!1,this.filteredOptions=a||[],this.focusedIndex=-1,this.updateDropdownContent()}catch{this.remoteSearching=!1,this.filteredOptions=[],this.updateDropdownContent()}}scheduleRemoteSearch(e){clearTimeout(this.remoteSearchTimeout),this.remoteSearchTimeout=window.setTimeout(()=>{this.performRemoteSearch(e)},this.searchDebounce)}render(){const e=`select-label select-label--${this.size} ${this.required?"select-label--required":""}`,a=`select-trigger select-trigger--${this.size} ${this.loading?"select-trigger--loading":""} ${this.editable?"select-trigger--editable":""}`,i=!this.searchable||this.editable;return t.html`
|
|
104
|
+
`}styles(){return t.css`${":host{display:inline-block;width:100%;max-width:100%;box-sizing:border-box;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);color-scheme:light dark}.input-wrapper{position:relative;width:100%;max-width:100%;height:100%;box-sizing:border-box}:host([align]) .input-wrapper{display:flex;flex-direction:column}:host([align=top]) .input-wrapper{justify-content:flex-start}:host([align=center]) .input-wrapper{justify-content:center}:host([align=bottom]) .input-wrapper{justify-content:flex-end}.input-container{position:relative;display:flex;align-items:center;width:100%;max-width:100%;box-sizing:border-box;transition:all var(--snice-transition-fast, 150ms) ease}:host([stretch]) .input-wrapper{display:flex;flex-direction:column}:host([stretch]) .input-container{flex:1}:host([stretch]) .input{height:100%}.input{flex:1;min-width:0;box-sizing:border-box;font-family:inherit;font-size:var(--snice-font-size-md, 1rem);background:var(--snice-color-background-input,rgb(248 247 245));color:var(--snice-color-text,rgb(23 23 23));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transition:all var(--snice-transition-fast, 150ms) ease;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.input:focus{border-color:var(--snice-color-primary,rgb(37 99 235));box-shadow:0 0 0 var(--snice-focus-ring-width,2px) var(--snice-focus-ring-color,rgb(59 130 246 / .5)),var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05))}.input:disabled{background:var(--snice-color-background-secondary,rgb(250 250 250));color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:not-allowed;opacity:.6}.input::placeholder{color:var(--snice-color-text-secondary,rgb(82 82 82));opacity:.7}.input--small{padding:.375rem .625rem;font-size:var(--snice-font-size-sm, .875rem);min-height:2rem}.input--medium{padding:.5rem .75rem;font-size:var(--snice-font-size-md, 1rem);min-height:2.5rem}.input--large{padding:.625rem .875rem;font-size:var(--snice-font-size-lg, 1.125rem);min-height:3rem}.input--outlined{background:var(--snice-color-background-input,rgb(248 247 245));border:1px solid var(--snice-color-border,rgb(226 226 226))}.input--filled{background:var(--snice-color-background-secondary,rgb(250 250 250));border:1px solid transparent;border-bottom-color:var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem) var(--snice-border-radius-md,.25rem) 0 0}.input--filled:focus{background:var(--snice-color-background-hover,rgb(245 245 245));border-bottom-color:var(--snice-color-primary,rgb(37 99 235))}.input--underlined{background:0 0;border:none;border-bottom:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:0;padding-left:0;padding-right:0}.input--underlined:focus{border-bottom-color:var(--snice-color-primary,rgb(37 99 235));box-shadow:none}.input--invalid{border-color:var(--snice-color-danger,rgb(220 38 38))}.input--invalid:focus{border-color:var(--snice-color-danger,rgb(220 38 38));box-shadow:0 0 0 var(--snice-focus-ring-width,2px) var(--snice-color-danger-alpha,rgb(220 38 38 / .4)),var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05))}.input::-webkit-calendar-picker-indicator{cursor:pointer;opacity:.7}.input::-webkit-calendar-picker-indicator:hover{opacity:1}.input--with-prefix-icon{padding-left:2.5rem}.input--clearable,.input--with-suffix-icon{padding-right:2.5rem}.input--with-suffix-icon.input--clearable{padding-right:4rem}.label{display:block;margin-bottom:.25rem;font-size:var(--snice-font-size-sm, .875rem);font-weight:var(--snice-font-weight-medium,500);line-height:var(--snice-line-height-normal, 1.5);color:var(--snice-color-text,rgb(23 23 23));text-align:left}:host([label-align=center]) .label{text-align:center}:host([label-align=right]) .label{text-align:right}.label--required::after{content:' *';color:var(--snice-color-danger,rgb(220 38 38))}.error-text,.helper-text{display:block;margin-top:.25rem;font-size:var(--snice-font-size-xs, .75rem)}.helper-text{color:var(--snice-color-text-secondary,rgb(82 82 82))}.error-text{color:var(--snice-color-danger,rgb(220 38 38))}.icon-slot{position:absolute;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;color:var(--snice-color-text-secondary,rgb(82 82 82));pointer-events:none;opacity:.7}.icon-slot:empty{display:none}.icon-slot--prefix{left:.625rem}.icon-slot--suffix{right:.625rem}.icon{display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;font-size:1.25rem;line-height:1;color:var(--snice-color-text-secondary,rgb(82 82 82));pointer-events:none}.icon-slot ::slotted(*){display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;font-size:1.25rem;line-height:1}.icon-slot ::slotted(svg){width:1.5rem;height:1.5rem}.icon-slot ::slotted(img){width:1.5rem;height:1.5rem;object-fit:contain}.clear-button{position:absolute;right:.5rem;display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.25rem;background:0 0;border:none;border-radius:var(--snice-border-radius-sm,.125rem);color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:pointer;transition:all var(--snice-transition-fast, 150ms) ease;opacity:0;visibility:hidden}.clear-button:hover{background:var(--snice-color-background-hover,rgb(245 245 245));color:var(--snice-color-text,rgb(23 23 23))}.input-container:hover .clear-button--visible,.input:focus~.clear-button--visible{opacity:1;visibility:visible}.clear-button--with-suffix{right:2rem}.password-toggle{position:absolute;right:.5rem;display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;padding:.25rem;background:0 0;border:none;border-radius:var(--snice-border-radius-sm,.125rem);color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:pointer;transition:all var(--snice-transition-fast, 150ms) ease}.password-toggle:hover{background:var(--snice-color-background-hover,rgb(245 245 245));color:var(--snice-color-text,rgb(23 23 23))}.input[type=number]::-webkit-inner-spin-button,.input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input[type=number]{-moz-appearance:textfield}.input[type=search]::-webkit-search-cancel-button,.input[type=search]::-webkit-search-decoration,.input[type=search]::-webkit-search-results-button,.input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}.input-container:focus-within{z-index:1}.input--loading{cursor:wait}.spinner{position:absolute;right:.75rem;width:1em;height:1em;pointer-events:none}.input--with-suffix-icon .spinner{right:2.5rem}.spinner::after{content:'';display:block;width:100%;height:100%;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:.6s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}"}`}init(){if(this.internals&&this.internals.setFormValue(this.value),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}this.input&&this.invalid&&(this.input.setAttribute("aria-invalid","true"),this.input.classList.add("input--invalid")),this.input&&("number"===this.type&&(this.min&&(this.input.min=this.min),this.max&&(this.input.max=this.max),this.step&&(this.input.step=this.step)),this.maxlength>0&&(this.input.maxLength=this.maxlength),this.minlength>0&&(this.input.minLength=this.minlength),this.pattern&&(this.input.pattern=this.pattern),this.placeholder&&(this.input.placeholder=this.placeholder),this.value&&(this.input.value=this.value),this.input.disabled=this.disabled,this.input.readOnly=this.readonly,this.input.required=this.required)}handleInput(e){const t=e.target;this.value=t.value,this.dispatchInputEvent()}handleChange(e){const t=e.target;this.value=t.value,this.dispatchChangeEvent()}handleFocus(e){this.dispatchFocusEvent()}handleBlur(e){this.dispatchBlurEvent()}handleClear(e){this.clear()}handlePasswordToggle(e){if(this.showPassword=!this.showPassword,this.input&&(this.input.type=this.showPassword?"text":"password"),this.passwordToggle){const e=this.passwordToggle.querySelector(".password-icon--hidden"),t=this.passwordToggle.querySelector(".password-icon--visible");e&&t&&(e.style.display=this.showPassword?"none":"",t.style.display=this.showPassword?"":"none",this.passwordToggle.setAttribute("aria-label",this.showPassword?"Hide password":"Show password"))}}handleValueChange(){if(this.input&&this.input.value!==this.value&&(this.input.value=this.value),this.internals&&this.internals.setFormValue(this.value),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}}handleInvalidChange(){this.input&&(this.input.setAttribute("aria-invalid",String(this.invalid)),this.invalid?this.input.classList.add("input--invalid"):this.input.classList.remove("input--invalid"))}handleDisabledChange(){if(this.input&&(this.input.disabled=this.disabled||this.loading),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}}handleLoadingChange(){if(this.input&&(this.input.disabled=this.disabled||this.loading),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}}handleReadonlyChange(){if(this.input&&(this.input.readOnly=this.readonly),this.clearButton&&this.clearable){const e=this.value&&!this.disabled&&!this.readonly&&!this.loading;this.clearButton.style.display=e?"":"none",this.clearButton.classList.toggle("clear-button--visible",!!e)}}handlePlaceholderChange(){this.input&&(this.input.placeholder=this.placeholder)}handleMinChange(){this.input&&"number"===this.type&&(this.input.min=this.min)}handleMaxChange(){this.input&&"number"===this.type&&(this.input.max=this.max)}handleStepChange(){this.input&&"number"===this.type&&(this.input.step=this.step)}handleMaxLengthChange(){this.input&&this.maxlength>0&&(this.input.maxLength=this.maxlength)}handleMinLengthChange(){this.input&&this.minlength>0&&(this.input.minLength=this.minlength)}handlePatternChange(){this.input&&(this.input.pattern=this.pattern)}handleTypeChange(){this.input&&"password"!==this.type&&(this.input.type=this.type)}handleLabelChange(){const e=this.shadowRoot?.querySelector(".label");if(e){e.textContent=this.label;const t=e.parentElement;t&&(t.style.display=this.label?"":"none")}}dispatchInputEvent(){return{value:this.value,input:this}}dispatchChangeEvent(){return{value:this.value,input:this}}dispatchFocusEvent(){return{input:this}}dispatchBlurEvent(){return{input:this}}dispatchClearEvent(){return{input:this}}focus(){this.input?.focus()}blur(){this.input?.blur()}select(){this.input?.select()}clear(){this.value="",this.input&&(this.input.value=""),this.dispatchClearEvent(),this.dispatchInputEvent(),this.dispatchChangeEvent(),this.focus()}checkValidity(){return this.input?.checkValidity()??!0}reportValidity(){return this.input?.reportValidity()??!0}setCustomValidity(e){this.input?.setCustomValidity(e)}})})(),(()=>{let e,s,n,l,r,o,c,d,h,u,p=[t.element("snice-option")],m=[],g=HTMLElement,b=[],v=[],y=[],f=[],w=[],k=[],x=[],S=[],C=[],E=[],D=[];(class extends g{static{s=this}static{const z="function"==typeof Symbol&&Symbol.metadata?Object.create(g[Symbol.metadata]??null):void 0;n=[t.property({})],l=[t.property({})],r=[t.property({type:Boolean})],o=[t.property({type:Boolean})],c=[t.property({})],d=[t.render()],h=[t.styles()],u=[t.ready()],i(this,null,d,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:z},null,b),i(this,null,h,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:z},null,b),i(this,null,u,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:z},null,b),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:z},v,y),i(null,null,l,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:z},f,w),i(null,null,r,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:z},k,x),i(null,null,o,{kind:"field",name:"selected",static:!1,private:!1,access:{has:e=>"selected"in e,get:e=>e.selected,set:(e,t)=>{e.selected=t}},metadata:z},S,C),i(null,null,c,{kind:"field",name:"icon",static:!1,private:!1,access:{has:e=>"icon"in e,get:e=>e.icon,set:(e,t)=>{e.icon=t}},metadata:z},E,D),i(null,e={value:s},p,{kind:"class",name:s.name,metadata:z},null,m),s=e.value,z&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:z}),a(s,m)}render(){return t.html``}styles(){return t.css`:host { display: none; }`}init(){!this.label&&this.textContent&&(this.label=this.textContent.trim()),!this.value&&this.label&&(this.value=this.label)}get optionData(){return{value:this.value,label:this.label||this.textContent?.trim()||this.value,disabled:this.disabled,selected:this.selected,icon:this.icon}}constructor(){super(...arguments),this.value=(a(this,b),a(this,v,"")),this.label=(a(this,y),a(this,f,"")),this.disabled=(a(this,w),a(this,k,!1)),this.selected=(a(this,x),a(this,S,!1)),this.icon=(a(this,C),a(this,E,"")),a(this,D)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C,E,D,z,A,$,F,T,L,M,R,B,j,I,O,P,V,H,N,q,_,W,K,Y,U,G=[t.element("snice-select",{formAssociated:!0})],J=[],X=HTMLElement,Q=[],Z=[],ee=[],te=[],ie=[],ae=[],se=[],ne=[],le=[],re=[],oe=[],ce=[],de=[],he=[],ue=[],pe=[],me=[],ge=[],be=[],ve=[],ye=[],fe=[],we=[],ke=[],xe=[],Se=[],Ce=[],Ee=[],De=[],ze=[],Ae=[],$e=[],Fe=[],Te=[],Le=[],Me=[],Re=[],Be=[],je=[],Ie=[],Oe=[],Pe=[],Ve=[],He=[],Ne=[],qe=[],_e=[],We=[],Ke=[],Ye=[],Ue=[],Ge=[],Je=[],Xe=[],Qe=[],Ze=[],et=[],tt=[],it=[],at=[],st=[],nt=[],lt=[];(class extends X{static{s=this}static{const rt="function"==typeof Symbol&&Symbol.metadata?Object.create(X[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean})],l=[t.property({type:Boolean})],r=[t.property({type:Boolean})],o=[t.property({type:Boolean})],c=[t.property({type:Boolean})],d=[t.property({type:Boolean})],h=[t.property({type:Boolean})],u=[t.property({type:Boolean})],p=[t.property({type:Boolean,attribute:"allow-free-text"})],m=[t.property({type:Boolean})],g=[t.property({type:Boolean})],b=[t.property({type:Number,attribute:"search-debounce"})],v=[t.property({type:Boolean})],y=[t.property({})],f=[t.property({})],w=[t.property({})],k=[t.property({})],x=[t.property({})],S=[t.property({attribute:"max-height"})],C=[t.property({type:Array,attribute:!1})],E=[t.query(".select-trigger")],D=[t.query(".select-dropdown")],z=[t.query(".select-value")],A=[t.query(".select-label")],$=[t.query(".select-search-input")],F=[t.query(".select-options")],T=[t.query(".select-clear")],L=[t.query(".select-arrow")],M=[t.query(".select-search")],R=[t.query(".select-editable-input")],B=[t.queryAll(".select-option")],j=[t.request("select/search")],I=[t.render()],O=[t.styles()],P=[t.ready()],V=[t.dispose()],H=[t.watch("value")],N=[t.watch("options")],q=[t.watch("disabled")],_=[t.watch("loading")],W=[t.watch("open")],K=[t.dispatch("select-change",{bubbles:!0,composed:!0})],Y=[t.dispatch("select-open",{bubbles:!0,composed:!0})],U=[t.dispatch("select-close",{bubbles:!0,composed:!0})],i(this,null,j,{kind:"method",name:"performRemoteSearch",static:!1,private:!1,access:{has:e=>"performRemoteSearch"in e,get:e=>e.performRemoteSearch},metadata:rt},null,Q),i(this,null,I,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:rt},null,Q),i(this,null,O,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:rt},null,Q),i(this,null,P,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:rt},null,Q),i(this,null,V,{kind:"method",name:"cleanup",static:!1,private:!1,access:{has:e=>"cleanup"in e,get:e=>e.cleanup},metadata:rt},null,Q),i(this,null,H,{kind:"method",name:"handleValueChange",static:!1,private:!1,access:{has:e=>"handleValueChange"in e,get:e=>e.handleValueChange},metadata:rt},null,Q),i(this,null,N,{kind:"method",name:"handleOptionsPropertyChange",static:!1,private:!1,access:{has:e=>"handleOptionsPropertyChange"in e,get:e=>e.handleOptionsPropertyChange},metadata:rt},null,Q),i(this,null,q,{kind:"method",name:"handleDisabledChange",static:!1,private:!1,access:{has:e=>"handleDisabledChange"in e,get:e=>e.handleDisabledChange},metadata:rt},null,Q),i(this,null,_,{kind:"method",name:"handleLoadingChange",static:!1,private:!1,access:{has:e=>"handleLoadingChange"in e,get:e=>e.handleLoadingChange},metadata:rt},null,Q),i(this,null,W,{kind:"method",name:"handleOpenChange",static:!1,private:!1,access:{has:e=>"handleOpenChange"in e,get:e=>e.handleOpenChange},metadata:rt},null,Q),i(this,null,K,{kind:"method",name:"dispatchChangeEvent",static:!1,private:!1,access:{has:e=>"dispatchChangeEvent"in e,get:e=>e.dispatchChangeEvent},metadata:rt},null,Q),i(this,null,Y,{kind:"method",name:"dispatchOpenEvent",static:!1,private:!1,access:{has:e=>"dispatchOpenEvent"in e,get:e=>e.dispatchOpenEvent},metadata:rt},null,Q),i(this,null,U,{kind:"method",name:"dispatchCloseEvent",static:!1,private:!1,access:{has:e=>"dispatchCloseEvent"in e,get:e=>e.dispatchCloseEvent},metadata:rt},null,Q),i(null,null,n,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:rt},Z,ee),i(null,null,l,{kind:"field",name:"required",static:!1,private:!1,access:{has:e=>"required"in e,get:e=>e.required,set:(e,t)=>{e.required=t}},metadata:rt},te,ie),i(null,null,r,{kind:"field",name:"invalid",static:!1,private:!1,access:{has:e=>"invalid"in e,get:e=>e.invalid,set:(e,t)=>{e.invalid=t}},metadata:rt},ae,se),i(null,null,o,{kind:"field",name:"readonly",static:!1,private:!1,access:{has:e=>"readonly"in e,get:e=>e.readonly,set:(e,t)=>{e.readonly=t}},metadata:rt},ne,le),i(null,null,c,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:rt},re,oe),i(null,null,d,{kind:"field",name:"multiple",static:!1,private:!1,access:{has:e=>"multiple"in e,get:e=>e.multiple,set:(e,t)=>{e.multiple=t}},metadata:rt},ce,de),i(null,null,h,{kind:"field",name:"searchable",static:!1,private:!1,access:{has:e=>"searchable"in e,get:e=>e.searchable,set:(e,t)=>{e.searchable=t}},metadata:rt},he,ue),i(null,null,u,{kind:"field",name:"clearable",static:!1,private:!1,access:{has:e=>"clearable"in e,get:e=>e.clearable,set:(e,t)=>{e.clearable=t}},metadata:rt},pe,me),i(null,null,p,{kind:"field",name:"allowFreeText",static:!1,private:!1,access:{has:e=>"allowFreeText"in e,get:e=>e.allowFreeText,set:(e,t)=>{e.allowFreeText=t}},metadata:rt},ge,be),i(null,null,m,{kind:"field",name:"editable",static:!1,private:!1,access:{has:e=>"editable"in e,get:e=>e.editable,set:(e,t)=>{e.editable=t}},metadata:rt},ve,ye),i(null,null,g,{kind:"field",name:"remote",static:!1,private:!1,access:{has:e=>"remote"in e,get:e=>e.remote,set:(e,t)=>{e.remote=t}},metadata:rt},fe,we),i(null,null,b,{kind:"field",name:"searchDebounce",static:!1,private:!1,access:{has:e=>"searchDebounce"in e,get:e=>e.searchDebounce,set:(e,t)=>{e.searchDebounce=t}},metadata:rt},ke,xe),i(null,null,v,{kind:"field",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:rt},Se,Ce),i(null,null,y,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:rt},Ee,De),i(null,null,f,{kind:"field",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:rt},ze,Ae),i(null,null,w,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:rt},$e,Fe),i(null,null,k,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:rt},Te,Le),i(null,null,x,{kind:"field",name:"placeholder",static:!1,private:!1,access:{has:e=>"placeholder"in e,get:e=>e.placeholder,set:(e,t)=>{e.placeholder=t}},metadata:rt},Me,Re),i(null,null,S,{kind:"field",name:"maxHeight",static:!1,private:!1,access:{has:e=>"maxHeight"in e,get:e=>e.maxHeight,set:(e,t)=>{e.maxHeight=t}},metadata:rt},Be,je),i(null,null,C,{kind:"field",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:rt},Ie,Oe),i(null,null,E,{kind:"field",name:"trigger",static:!1,private:!1,access:{has:e=>"trigger"in e,get:e=>e.trigger,set:(e,t)=>{e.trigger=t}},metadata:rt},Pe,Ve),i(null,null,D,{kind:"field",name:"dropdown",static:!1,private:!1,access:{has:e=>"dropdown"in e,get:e=>e.dropdown,set:(e,t)=>{e.dropdown=t}},metadata:rt},He,Ne),i(null,null,z,{kind:"field",name:"valueDisplay",static:!1,private:!1,access:{has:e=>"valueDisplay"in e,get:e=>e.valueDisplay,set:(e,t)=>{e.valueDisplay=t}},metadata:rt},qe,_e),i(null,null,A,{kind:"field",name:"labelElement",static:!1,private:!1,access:{has:e=>"labelElement"in e,get:e=>e.labelElement,set:(e,t)=>{e.labelElement=t}},metadata:rt},We,Ke),i(null,null,$,{kind:"field",name:"searchInput",static:!1,private:!1,access:{has:e=>"searchInput"in e,get:e=>e.searchInput,set:(e,t)=>{e.searchInput=t}},metadata:rt},Ye,Ue),i(null,null,F,{kind:"field",name:"optionsList",static:!1,private:!1,access:{has:e=>"optionsList"in e,get:e=>e.optionsList,set:(e,t)=>{e.optionsList=t}},metadata:rt},Ge,Je),i(null,null,T,{kind:"field",name:"clearButton",static:!1,private:!1,access:{has:e=>"clearButton"in e,get:e=>e.clearButton,set:(e,t)=>{e.clearButton=t}},metadata:rt},Xe,Qe),i(null,null,L,{kind:"field",name:"arrow",static:!1,private:!1,access:{has:e=>"arrow"in e,get:e=>e.arrow,set:(e,t)=>{e.arrow=t}},metadata:rt},Ze,et),i(null,null,M,{kind:"field",name:"searchContainer",static:!1,private:!1,access:{has:e=>"searchContainer"in e,get:e=>e.searchContainer,set:(e,t)=>{e.searchContainer=t}},metadata:rt},tt,it),i(null,null,R,{kind:"field",name:"editableInput",static:!1,private:!1,access:{has:e=>"editableInput"in e,get:e=>e.editableInput,set:(e,t)=>{e.editableInput=t}},metadata:rt},at,st),i(null,null,B,{kind:"field",name:"optionElements",static:!1,private:!1,access:{has:e=>"optionElements"in e,get:e=>e.optionElements,set:(e,t)=>{e.optionElements=t}},metadata:rt},nt,lt),i(null,e={value:s},G,{kind:"class",name:s.name,metadata:rt},null,J),s=e.value,rt&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:rt}),a(s,J)}constructor(){super(),this.internals=a(this,Q),this.disabled=a(this,Z,!1),this.required=(a(this,ee),a(this,te,!1)),this.invalid=(a(this,ie),a(this,ae,!1)),this.readonly=(a(this,se),a(this,ne,!1)),this.loading=(a(this,le),a(this,re,!1)),this.multiple=(a(this,oe),a(this,ce,!1)),this.searchable=(a(this,de),a(this,he,!1)),this.clearable=(a(this,ue),a(this,pe,!1)),this.allowFreeText=(a(this,me),a(this,ge,!1)),this.editable=(a(this,be),a(this,ve,!1)),this.remote=(a(this,ye),a(this,fe,!1)),this.searchDebounce=(a(this,we),a(this,ke,300)),this.open=(a(this,xe),a(this,Se,!1)),this.size=(a(this,Ce),a(this,Ee,"medium")),this.name=(a(this,De),a(this,ze,"")),this.value=(a(this,Ae),a(this,$e,"")),this.label=(a(this,Fe),a(this,Te,"")),this.placeholder=(a(this,Le),a(this,Me,"Select an option")),this.maxHeight=(a(this,Re),a(this,Be,"200px")),this.options=(a(this,je),a(this,Ie,[])),this.childOptions=(a(this,Oe),[]),this.trigger=a(this,Pe,void 0),this.dropdown=(a(this,Ve),a(this,He,void 0)),this.valueDisplay=(a(this,Ne),a(this,qe,void 0)),this.labelElement=(a(this,_e),a(this,We,void 0)),this.searchInput=(a(this,Ke),a(this,Ye,void 0)),this.optionsList=(a(this,Ue),a(this,Ge,void 0)),this.clearButton=(a(this,Je),a(this,Xe,void 0)),this.arrow=(a(this,Qe),a(this,Ze,void 0)),this.searchContainer=(a(this,et),a(this,tt,void 0)),this.editableInput=(a(this,it),a(this,at,void 0)),this.optionElements=(a(this,st),a(this,nt,void 0)),this.filteredOptions=(a(this,lt),[]),this.selectedValues=new Set,this.focusedIndex=-1,this.editableInputValue="",this.remoteSearchTimeout=0,this.remoteSearching=!1,"function"==typeof this.attachInternals&&(this.internals=this.attachInternals())}get mergedOptions(){if(this.childOptions.length>0&&this.options.length>0){const e=new Set(this.childOptions.map(e=>e.value));return[...this.childOptions,...this.options.filter(t=>!e.has(t.value))]}return this.childOptions.length>0?this.childOptions:this.options}async*performRemoteSearch(e){this.remoteSearching=!0,this.updateDropdownContent();try{const t={query:e,select:this},i=await(yield t);this.remoteSearching=!1,this.filteredOptions=i||[],this.focusedIndex=-1,this.updateDropdownContent()}catch{this.remoteSearching=!1,this.filteredOptions=[],this.updateDropdownContent()}}scheduleRemoteSearch(e){clearTimeout(this.remoteSearchTimeout),this.remoteSearchTimeout=window.setTimeout(()=>{this.performRemoteSearch(e)},this.searchDebounce)}render(){const e=`select-label select-label--${this.size} ${this.required?"select-label--required":""}`,i=`select-trigger select-trigger--${this.size} ${this.loading?"select-trigger--loading":""} ${this.editable?"select-trigger--editable":""}`,a=!this.searchable||this.editable;return t.html`
|
|
105
105
|
<div class="select-wrapper">
|
|
106
106
|
<label class="${e}" part="label" ?hidden="${!this.label}">
|
|
107
107
|
${this.label}
|
|
@@ -139,7 +139,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
139
139
|
<if ${!this.editable}>
|
|
140
140
|
<button
|
|
141
141
|
type="button"
|
|
142
|
-
class="${
|
|
142
|
+
class="${i}"
|
|
143
143
|
aria-haspopup="listbox"
|
|
144
144
|
aria-expanded="false"
|
|
145
145
|
aria-label="${this.label||"Select"}"
|
|
@@ -178,7 +178,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
178
178
|
@mousedown="${e=>this.handleDropdownMousedown(e)}"
|
|
179
179
|
@click="${e=>this.handleOptionsClick(e)}">
|
|
180
180
|
|
|
181
|
-
<div class="select-search" part="search" ?hidden="${
|
|
181
|
+
<div class="select-search" part="search" ?hidden="${a}">
|
|
182
182
|
<input
|
|
183
183
|
type="text"
|
|
184
184
|
class="select-search-input"
|
|
@@ -195,10 +195,10 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
195
195
|
</div>
|
|
196
196
|
|
|
197
197
|
</div>
|
|
198
|
-
`}renderOptions(){if(this.remoteSearching)return'\n <div class="select-loading-indicator">\n <span class="select-loading-spinner"></span>\n <span>Searching...</span>\n </div>\n ';const e=this.searchable||this.editable||this.remote?this.filteredOptions:this.mergedOptions;return 0===e.length?`\n <div class="select-no-options">\n <span class="select-no-options-text" data-search="true" ${!(this.searchable||this.editable||this.remote)||this.filteredOptions.length>0?"hidden":""}>No matches found</span>\n <span class="select-no-options-text" data-search="false" ${(this.searchable||this.editable||this.remote)&&0===this.filteredOptions.length?"hidden":""}>No options available</span>\n </div>\n `:e.map((e,t)=>{const a=this.multiple?this.selectedValues.has(e.value):e.value===this.value;return`\n <div class="select-option\n ${a?"select-option--selected":""}\n ${e.disabled?"select-option--disabled":""}\n ${t===this.focusedIndex?"select-option--focused":""}\n ${e.icon?"select-option--has-icon":""}"\n data-value="${e.value}"\n role="option"\n aria-selected="${a}"\n aria-disabled="${e.disabled}"\n part="option">\n <span class="select-option-check" ${this.multiple?"":"hidden"}>\n <span class="select-option-check-mark" ${a?"":"hidden"}>✓</span>\n </span>\n <img class="select-option-icon" src="${e.icon||""}" alt="" ${e.icon?"":"hidden"} />\n <span class="select-option-label">${e.label}</span>\n </div>\n `}).join("")}styles(){return t.css`${":host{display:inline-block;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);position:relative;width:100%;max-width:18.75rem}[hidden]{display:none!important}img[src=\"\"]{display:none}.select-wrapper{position:relative;width:100%}.select-label{display:block;margin-bottom:.25rem;font-size:var(--snice-font-size-sm, .875rem);font-weight:500;line-height:var(--snice-line-height-normal, 1.5);color:var(--snice-color-text,rgb(23 23 23));text-align:left}.select-label--required::after{content:' *';color:var(--snice-color-danger,rgb(220 38 38))}.select-trigger{width:100%;display:flex;align-items:center;justify-content:space-between;background:var(--snice-color-background-input,rgb(248 247 245));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem);cursor:pointer;transition:all var(--snice-transition-fast, 150ms) ease;position:relative;text-align:left;font-family:inherit;color:var(--snice-color-text,rgb(23 23 23))}.select-trigger--small{padding:.375rem 2rem .375rem .625rem;font-size:var(--snice-font-size-sm, .875rem);min-height:2rem}.select-trigger--medium{padding:.5rem 2.25rem .5rem .75rem;font-size:var(--snice-font-size-md, 1rem);min-height:var(--snice-select-min-height,2.5rem)}.select-trigger--large{padding:.625rem 2.5rem .625rem .875rem;font-size:var(--snice-font-size-lg, 1.125rem);min-height:3rem}.select-trigger:hover:not(.select-trigger--disabled){border-color:var(--snice-color-border-hover,rgb(180 180 180))}.select-trigger:focus-visible{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-color:var(--snice-color-primary,rgb(37 99 235))}.select-trigger--open{border-color:var(--snice-color-primary,rgb(37 99 235))}.select-trigger--disabled{background:var(--snice-color-background-secondary,rgb(245 245 245));cursor:not-allowed;opacity:.6}.select-trigger--readonly{background:var(--snice-color-background-secondary,rgb(245 245 245));cursor:default}.select-trigger--invalid{border-color:var(--snice-color-danger,rgb(220 38 38))}.select-placeholder{color:var(--snice-color-text-secondary,rgb(82 82 82))}.select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-value--single{display:flex;align-items:center;gap:.5rem}.select-value-icon{width:1rem;height:1rem;object-fit:contain;flex-shrink:0}.select-value--multiple{display:flex;gap:.25rem;flex-wrap:wrap}.select-tag{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .375rem;background:var(--snice-color-primary-subtle,rgb(219 234 254));color:var(--snice-color-primary,rgb(37 99 235));border-radius:var(--snice-border-radius-sm,.125rem);font-size:var(--snice-font-size-xs, .75rem)}.select-tag-icon{width:.75rem;height:.75rem;object-fit:contain;flex-shrink:0}.select-tag-remove{cursor:pointer;padding:0;background:0 0;border:none;color:inherit;font-size:.75rem;line-height:1}.select-tag-remove:hover{opacity:.7}.select-icons{position:absolute;right:.5rem;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:.25rem;pointer-events:none;z-index:1}.select-clear{padding:.125rem;background:0 0;border:none;cursor:pointer;color:var(--snice-color-text-secondary,rgb(82 82 82));display:flex;align-items:center;justify-content:center;border-radius:var(--snice-border-radius-sm,.125rem);pointer-events:auto}.select-clear:hover{background:var(--snice-color-background-secondary,rgb(245 245 245));color:var(--snice-color-text,rgb(23 23 23))}.select-arrow{transition:transform var(--snice-transition-fast, 150ms) ease;color:var(--snice-color-text-secondary,rgb(82 82 82));pointer-events:none}.select-arrow--open{transform:rotate(180deg)}.select-dropdown{position:absolute;top:100%;margin-top:.25rem;left:0;right:0;background:var(--snice-color-background-element,rgb(252 251 249));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem);box-shadow:var(--snice-shadow-lg,0 10px 15px -3px rgb(0 0 0 / .1),0 4px 6px -4px rgb(0 0 0 / .1));z-index:1000;opacity:0;transform:translateY(-8px) scaleY(.95);transform-origin:top;pointer-events:none;transition:opacity var(--snice-transition-fast, 150ms) ease,transform var(--snice-transition-fast, 150ms) ease;display:flex;flex-direction:column;overflow:hidden}.select-dropdown--open{opacity:1;transform:translateY(0) scaleY(1);pointer-events:auto}.select-search{padding:.5rem;border-bottom:1px solid var(--snice-color-border,rgb(226 226 226));flex-shrink:0}.select-search-input{width:100%;padding:.375rem .625rem;background:var(--snice-color-background-input,rgb(248 247 245));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-sm,.125rem);font-size:var(--snice-font-size-sm, .875rem);font-family:inherit;color:var(--snice-color-text,rgb(23 23 23));box-sizing:border-box}.select-search-input:focus{outline:0;border-color:var(--snice-color-primary,rgb(37 99 235))}.select-options{max-height:12.5rem;overflow-y:auto;overflow-x:hidden;padding:.25rem;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--snice-color-border,rgb(226 226 226)) var(--snice-color-background-secondary,rgb(245 245 245))}.select-options::-webkit-scrollbar-track{background:var(--snice-color-background-secondary,rgb(245 245 245));margin:.25rem 0}.select-options::-webkit-scrollbar-thumb{background:var(--snice-color-border,rgb(226 226 226));border:2px solid var(--snice-color-background,rgb(255 255 255))}.select-option{padding:.5rem .75rem;cursor:pointer;border-radius:var(--snice-border-radius-sm,.125rem);transition:background var(--snice-transition-fast, 150ms) ease;display:flex;align-items:center;gap:.5rem}.select-option:hover:not(.select-option--disabled){background:var(--snice-color-background-secondary,rgb(245 245 245))}.select-option--selected{background:var(--snice-color-primary-subtle,rgb(219 234 254));color:var(--snice-color-primary,rgb(37 99 235));font-weight:500}.select-option--focused{background:var(--snice-color-background-secondary,rgb(245 245 245));outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:-2px}.select-option--disabled{opacity:.5;cursor:not-allowed}.select-option-icon{width:1rem;height:1rem;object-fit:contain;flex-shrink:0}.select-option-check{width:1rem;height:1rem;display:flex;align-items:center;justify-content:center;flex-shrink:0}.select-option-label{flex:1}.select-no-options{padding:1rem;text-align:center;color:var(--snice-color-text-secondary,rgb(82 82 82));font-size:var(--snice-font-size-sm, .875rem)}.select-native{position:absolute;opacity:0;pointer-events:none;width:0;height:0}.select-options::-webkit-scrollbar{width:6px}.select-options::-webkit-scrollbar-track{background:var(--snice-color-background-secondary,rgb(245 245 245));border-radius:3px}.select-options::-webkit-scrollbar-thumb{background:var(--snice-color-border,rgb(226 226 226));border-radius:3px}.select-options::-webkit-scrollbar-thumb:hover{background:var(--snice-color-border-hover,rgb(180 180 180))}.select-trigger--loading{cursor:wait;opacity:.7}.select-spinner{display:inline-block;width:.875rem;height:.875rem;margin-right:.25rem}.select-spinner::after{content:'';display:block;width:100%;height:100%;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:.6s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.select-freetext-input{flex:1;border:none;outline:0;background:0 0;font-family:inherit;font-size:inherit;color:var(--snice-color-text,rgb(23 23 23));padding:0;min-width:0;width:100%}.select-freetext-input::placeholder{color:var(--snice-color-text-secondary,rgb(82 82 82))}.select-editable-container{position:relative;display:flex;align-items:center;width:100%}.select-editable-input{width:100%;box-sizing:border-box;font-family:inherit;background:var(--snice-color-background-input,rgb(248 247 245));color:var(--snice-color-text,rgb(23 23 23));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem);transition:all var(--snice-transition-fast, 150ms) ease;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.select-editable-input--small{padding:.375rem 2rem .375rem .625rem;font-size:var(--snice-font-size-sm, .875rem);min-height:2rem}.select-editable-input--medium{padding:.5rem 2.25rem .5rem .75rem;font-size:var(--snice-font-size-md, 1rem);min-height:2.5rem}.select-editable-input--large{padding:.625rem 2.5rem .625rem .875rem;font-size:var(--snice-font-size-lg, 1.125rem);min-height:3rem}.select-editable-input:hover:not(:disabled){border-color:var(--snice-color-border-hover,rgb(180 180 180))}.select-editable-input:focus{border-color:var(--snice-color-primary,rgb(37 99 235));box-shadow:0 0 0 var(--snice-focus-ring-width,2px) var(--snice-focus-ring-color,rgb(59 130 246 / .5))}.select-editable-input--open{border-color:var(--snice-color-primary,rgb(37 99 235))}.select-editable-input:disabled{background:var(--snice-color-background-secondary,rgb(245 245 245));color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:not-allowed;opacity:.6}.select-editable-input:read-only{background:var(--snice-color-background-secondary,rgb(245 245 245));cursor:default}.select-editable-input::placeholder{color:var(--snice-color-text-secondary,rgb(82 82 82));opacity:.7}.select-editable-arrow{position:absolute;right:.5rem;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;color:var(--snice-color-text-secondary,rgb(82 82 82));pointer-events:none;transition:transform var(--snice-transition-fast, 150ms) ease}.select-editable-arrow--open{transform:translateY(-50%) rotate(180deg)}.select-loading-indicator{display:flex;align-items:center;justify-content:center;gap:.5rem;padding:.75rem 1rem;color:var(--snice-color-text-secondary,rgb(82 82 82));font-size:var(--snice-font-size-sm, .875rem)}.select-loading-spinner{display:inline-block;width:1rem;height:1rem;flex-shrink:0}.select-loading-spinner::after{content:'';display:block;width:100%;height:100%;border:2px solid var(--snice-color-border,rgb(226 226 226));border-top-color:var(--snice-color-primary,rgb(37 99 235));border-radius:50%;animation:.6s linear infinite spin}"}`}init(){this.readOptionsFromChildren(),this.multiple&&this.value&&(this.selectedValues=new Set(this.value.split(",").map(e=>e.trim()))),this.filteredOptions=[...this.mergedOptions],this.internals&&this.internals.setFormValue(this.value),this.editable?(this.syncEditableInputToValue(),this.updateEditableState()):(this.updateTriggerState(),this.updateValueDisplay(),this.updateClearButton()),this.updateDropdownState(),this.updateDropdownContent(),this.observeChildren(),this.setupGlobalListeners()}cleanup(){this.removeGlobalListeners(),this.childObserver?.disconnect()}setupGlobalListeners(){this.outsideClickHandler=e=>{!this.contains(e.target)&&this.open&&(this.editable&&this.commitEditableValue(),this.closeDropdown())},this.globalKeyHandler=e=>{if(this.open&&!this.editable)switch(e.key){case"Escape":this.closeDropdown(),this.trigger?.focus();break;case"ArrowDown":e.preventDefault(),this.focusNextOption();break;case"ArrowUp":e.preventDefault(),this.focusPreviousOption();break;case"Enter":case" ":if(e.preventDefault(),this.focusedIndex>=0){const e=(this.searchable?this.filteredOptions:this.mergedOptions)[this.focusedIndex];e&&!e.disabled&&this.handleOptionSelect(e)}}},document.addEventListener("click",this.outsideClickHandler),document.addEventListener("keydown",this.globalKeyHandler)}removeGlobalListeners(){this.outsideClickHandler&&document.removeEventListener("click",this.outsideClickHandler),this.globalKeyHandler&&document.removeEventListener("keydown",this.globalKeyHandler)}observeChildren(){const e=new MutationObserver(e=>{this.handleChildrenChange(e)});e.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),this.childObserver=e}handleChildrenChange(e){e.some(e=>"childList"===e.type||!("attributes"!==e.type||!["value","label","disabled","selected"].includes(e.attributeName))&&"SNICE-OPTION"===e.target.nodeName)&&(this.readOptionsFromChildren(),this.filteredOptions=[...this.mergedOptions],this.editable||(this.updateValueDisplay(),this.updateClearButton()),this.updateDropdownContent())}readOptionsFromChildren(){const e=Array.from(this.querySelectorAll("snice-option"));this.childOptions=e.map(e=>{const t=e;return t.optionData?t.optionData:{value:e.getAttribute("value")||"",label:e.getAttribute("label")||e.textContent?.trim()||"",disabled:e.hasAttribute("disabled"),selected:e.hasAttribute("selected")}})}handleEditableInput(e){const t=e.target;this.editableInputValue=t.value,this.filterEditableOptions(this.editableInputValue),this.open||this.openDropdown()}handleEditableFocus(){this.open||this.readonly||this.openDropdown()}handleEditableBlur(e){setTimeout(()=>{this.open&&(this.commitEditableValue(),this.closeDropdown())},200)}handleEditableClick(){this.open||this.disabled||this.readonly||this.openDropdown()}handleEditableArrowClick(e){e.preventDefault(),e.stopPropagation(),this.disabled||this.readonly||(this.open?this.closeDropdown():(this.openDropdown(),this.editableInput?.focus()))}handleEditableKeydown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this.open?this.focusNextOption():this.openDropdown();break;case"ArrowUp":e.preventDefault(),this.open&&this.focusPreviousOption();break;case"Enter":if(e.preventDefault(),this.open&&this.focusedIndex>=0){const e=this.filteredOptions[this.focusedIndex];e&&!e.disabled&&this.handleEditableOptionSelect(e)}else this.open&&(this.commitEditableValue(),this.closeDropdown());break;case"Escape":this.open&&(this.closeDropdown(),this.syncEditableInputToValue());break;case"Tab":this.open&&(this.commitEditableValue(),this.closeDropdown())}}handleEditableOptionSelect(e){this.value=e.value,this.editableInputValue=e.label,this.editableInput&&(this.editableInput.value=e.label),this.closeDropdown(),this.dispatchChangeEvent(e),this.editableInput?.focus()}commitEditableValue(){if(!this.editableInput)return;const e=this.editableInput.value.trim(),t=this.mergedOptions.find(t=>t.label.toLowerCase()===e.toLowerCase());t?(this.value=t.value,this.editableInputValue=t.label,this.editableInput.value=t.label,this.dispatchChangeEvent(t)):this.allowFreeText&&e?(this.value=e,this.editableInputValue=e,this.dispatchChangeEvent()):this.syncEditableInputToValue()}filterEditableOptions(e){if(this.remote)return void this.scheduleRemoteSearch(e);const t=this.mergedOptions;if(e){const a=e.toLowerCase();this.filteredOptions=t.filter(e=>e.label.toLowerCase().includes(a))}else this.filteredOptions=[...t];this.focusedIndex=-1,this.updateDropdownContent()}syncEditableInputToValue(){if(this.editableInput)if(this.value){const e=this.mergedOptions.find(e=>e.value===this.value);e?(this.editableInput.value=e.label,this.editableInputValue=e.label):this.allowFreeText?(this.editableInput.value=this.value,this.editableInputValue=this.value):(this.editableInput.value="",this.editableInputValue="")}else this.editableInput.value="",this.editableInputValue=""}updateEditableState(){this.editableInput&&(this.editableInput.setAttribute("aria-expanded",String(this.open)),this.editableInput.classList.toggle("select-editable-input--open",this.open))}handleDropdownMousedown(e){this.editable&&e.preventDefault()}handleTriggerOpen(e){["Enter"," ","ArrowDown","ArrowUp"].includes(e.key)&&(e.preventDefault(),this.open||this.openDropdown())}handleSearchKeydown(e){switch(e.key){case"Escape":this.closeDropdown(),this.trigger?.focus();break;case"ArrowDown":e.preventDefault(),this.focusNextOption();break;case"ArrowUp":e.preventDefault(),this.focusPreviousOption();break;case"Enter":if(e.preventDefault(),this.focusedIndex>=0){const e=(this.searchable?this.filteredOptions:this.mergedOptions)[this.focusedIndex];e&&!e.disabled&&this.handleOptionSelect(e)}}}focusNextOption(){const e=this.searchable||this.editable?this.filteredOptions:this.mergedOptions;if(0!==e.filter(e=>!e.disabled).length){for(this.focusedIndex++,this.focusedIndex>=e.length&&(this.focusedIndex=0);e[this.focusedIndex]?.disabled;)this.focusedIndex++,this.focusedIndex>=e.length&&(this.focusedIndex=0);this.updateOptionFocus()}}focusPreviousOption(){const e=this.searchable||this.editable?this.filteredOptions:this.mergedOptions;if(0!==e.filter(e=>!e.disabled).length){for(this.focusedIndex--,this.focusedIndex<0&&(this.focusedIndex=e.length-1);e[this.focusedIndex]?.disabled;)this.focusedIndex--,this.focusedIndex<0&&(this.focusedIndex=e.length-1);this.updateOptionFocus()}}updateOptionFocus(){if(this.optionElements){this.optionElements.forEach((e,t)=>{e.classList.toggle("select-option--focused",t===this.focusedIndex)});const e=this.optionElements?.[this.focusedIndex];e&&e.scrollIntoView({block:"nearest"})}}handleClearClick(e){e.preventDefault(),e.stopPropagation(),this.clear()}handleTriggerClick(e){e.target.closest(".select-clear")||(e.stopPropagation(),this.disabled||this.readonly||this.toggleDropdown())}handleOptionsClick(e){const t=e.target;if(t.closest(".select-tag-remove")){e.stopPropagation();const a=t.closest(".select-tag-remove").getAttribute("data-value");return void(a&&this.multiple&&(this.selectedValues.delete(a),this.value=Array.from(this.selectedValues).join(","),this.updateValueDisplay(),this.updateClearButton(),this.dispatchChangeEvent()))}const a=t.closest(".select-option");if(!a)return;e.stopPropagation();const i=a.getAttribute("data-value");if(!i)return;const s=this.mergedOptions.find(e=>e.value===i);s&&!s.disabled&&(this.editable?this.handleEditableOptionSelect(s):this.handleOptionSelect(s))}handleSearchInput(e){const t=e.target.value;if(this.remote)return void this.scheduleRemoteSearch(t);const a=t.toLowerCase();this.filteredOptions=a?this.mergedOptions.filter(e=>e.label.toLowerCase().includes(a)):[...this.mergedOptions],this.focusedIndex=-1,this.updateDropdownContent()}handleOptionSelect(e){this.multiple?(this.selectedValues.has(e.value)?this.selectedValues.delete(e.value):this.selectedValues.add(e.value),this.value=Array.from(this.selectedValues).join(","),this.updateDropdownContent()):(this.value=e.value,this.closeDropdown()),this.updateValueDisplay(),this.updateClearButton(),this.dispatchChangeEvent(e)}handleValueChange(){this.multiple&&(this.selectedValues=new Set(this.value?this.value.split(",").map(e=>e.trim()):[])),this.editable?this.syncEditableInputToValue():(this.updateValueDisplay(),this.updateClearButton()),this.internals&&this.internals.setFormValue(this.value)}handleOptionsPropertyChange(){this.filteredOptions=[...this.mergedOptions],this.updateDropdownContent(),this.editable&&this.syncEditableInputToValue()}handleDisabledChange(){this.editable||(this.updateTriggerState(),this.updateClearButton()),this.disabled&&this.open&&this.closeDropdown()}handleLoadingChange(){this.editable||(this.updateTriggerState(),this.updateClearButton()),this.loading&&this.open&&!this.remote&&this.closeDropdown()}handleOpenChange(){if(this.updateDropdownState(),this.editable){if(this.updateEditableState(),this.open)if(this.remote){const e=this.editableInput?.value||"";this.scheduleRemoteSearch(e)}else this.filteredOptions=[...this.mergedOptions],this.focusedIndex=-1,this.updateDropdownContent();this.open||(this.focusedIndex=-1)}else{if(this.updateTriggerState(),this.open&&this.searchable&&this.searchInput&&setTimeout(()=>this.searchInput?.focus(),100),this.open&&this.remote&&this.searchable){const e=this.searchInput?.value||"";this.scheduleRemoteSearch(e)}this.open||(this.focusedIndex=-1,this.searchInput&&(this.searchInput.value="",this.filteredOptions=[...this.mergedOptions],this.updateDropdownContent()))}}updateValueDisplay(){if(!this.valueDisplay)return;const e=this.mergedOptions.filter(e=>this.multiple?this.selectedValues.has(e.value):e.value===this.value);if(this.multiple&&e.length>0)this.valueDisplay.innerHTML=`\n <div class="select-value--multiple">\n ${e.map(e=>`\n <span class="select-tag">\n <img class="select-tag-icon" src="${e.icon||""}" alt="" ${e.icon?"":"hidden"} />\n ${e.label}\n <span class="select-tag-remove" data-value="${e.value}" aria-label="Remove ${e.label}" ${this.disabled||this.readonly?"hidden":""}>×</span>\n </span>\n `).join("")}\n </div>\n `;else if(e.length>0){const t=e[0];this.valueDisplay.innerHTML=`\n <div class="select-value--single">\n <img class="select-value-icon" src="${t.icon||""}" alt="" ${t.icon?"":"hidden"} />\n <span>${t.label}</span>\n </div>\n `}else this.valueDisplay.innerHTML=`<span class="select-placeholder">${this.placeholder}</span>`}updateClearButton(){if(!this.clearButton)return;const e=this.mergedOptions.filter(e=>this.multiple?this.selectedValues.has(e.value):e.value===this.value),t=this.clearable&&e.length>0&&!this.disabled&&!this.readonly;this.clearButton.style.display=t?"":"none"}updateDropdownContent(){this.optionsList&&(this.optionsList.innerHTML=this.renderOptions())}dispatchChangeEvent(e){return{value:this.multiple?Array.from(this.selectedValues):this.value,option:e,select:this}}dispatchOpenEvent(){return{select:this}}dispatchCloseEvent(){return{select:this}}focus(){this.editable?this.editableInput?.focus():this.trigger?.focus()}blur(){this.editable?this.editableInput?.blur():this.trigger?.blur(),this.open&&this.closeDropdown()}clear(){this.multiple?(this.selectedValues.clear(),this.value=""):this.value="",this.editable?this.syncEditableInputToValue():(this.updateValueDisplay(),this.updateClearButton()),this.dispatchChangeEvent()}openDropdown(){this.open||this.disabled||this.readonly||(this.open=!0,this.dispatchOpenEvent())}closeDropdown(){this.open&&(this.open=!1,this.dispatchCloseEvent())}toggleDropdown(){this.open?this.closeDropdown():this.openDropdown()}selectOption(e){const t=this.mergedOptions.find(t=>t.value===e);t&&!t.disabled&&(this.editable?this.handleEditableOptionSelect(t):this.handleOptionSelect(t))}updateTriggerState(){this.trigger&&(this.trigger.classList.toggle("select-trigger--open",this.open),this.trigger.classList.toggle("select-trigger--disabled",this.disabled),this.trigger.classList.toggle("select-trigger--readonly",this.readonly),this.trigger.classList.toggle("select-trigger--invalid",this.invalid),this.trigger.classList.toggle("select-trigger--loading",this.loading),this.trigger.setAttribute("aria-expanded",String(this.open)),this.trigger.disabled=this.disabled||this.loading)}updateDropdownState(){this.dropdown&&(this.dropdown.classList.toggle("select-dropdown--open",this.open),this.arrow&&this.arrow.classList.toggle("select-arrow--open",this.open))}})})();(()=>{let e,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C,E,D=[t.element("snice-button",{formAssociated:!0})],z=[],A=HTMLElement,$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[],G=[],J=[],X=[],Q=[],Z=[],ee=[],te=[],ae=[],ie=[],se=[],ne=[],le=[],re=[],oe=[],ce=[];(class extends A{static{n=this}static{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(A[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Boolean})],d=[t.property({type:Boolean})],h=[t.property({type:Boolean})],u=[t.property({type:Boolean})],p=[t.property({type:Boolean})],m=[t.property({type:String})],g=[t.property({type:String})],b=[t.property({type:String})],v=[t.property({type:String})],y=[t.property({attribute:"icon-placement"})],f=[t.query(".button")],w=[t.query(".spinner")],k=[t.query(".label")],x=[t.query(".icon")],S=[t.on("slotchange",{target:'slot[name="icon"]'})],C=[t.render()],E=[t.styles()],a(this,null,S,{kind:"method",name:"handleIconSlotChange",static:!1,private:!1,access:{has:e=>"handleIconSlotChange"in e,get:e=>e.handleIconSlotChange},metadata:s},null,$),a(this,null,C,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:s},null,$),a(this,null,E,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:s},null,$),a(null,null,l,{kind:"field",name:"variant",static:!1,private:!1,access:{has:e=>"variant"in e,get:e=>e.variant,set:(e,t)=>{e.variant=t}},metadata:s},F,T),a(null,null,r,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:s},L,M),a(null,null,o,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:s},R,B),a(null,null,c,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:s},j,I),a(null,null,d,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:s},O,P),a(null,null,h,{kind:"field",name:"outline",static:!1,private:!1,access:{has:e=>"outline"in e,get:e=>e.outline,set:(e,t)=>{e.outline=t}},metadata:s},V,H),a(null,null,u,{kind:"field",name:"pill",static:!1,private:!1,access:{has:e=>"pill"in e,get:e=>e.pill,set:(e,t)=>{e.pill=t}},metadata:s},N,q),a(null,null,p,{kind:"field",name:"circle",static:!1,private:!1,access:{has:e=>"circle"in e,get:e=>e.circle,set:(e,t)=>{e.circle=t}},metadata:s},_,W),a(null,null,m,{kind:"field",name:"href",static:!1,private:!1,access:{has:e=>"href"in e,get:e=>e.href,set:(e,t)=>{e.href=t}},metadata:s},K,Y),a(null,null,g,{kind:"field",name:"target",static:!1,private:!1,access:{has:e=>"target"in e,get:e=>e.target,set:(e,t)=>{e.target=t}},metadata:s},U,G),a(null,null,b,{kind:"field",name:"download",static:!1,private:!1,access:{has:e=>"download"in e,get:e=>e.download,set:(e,t)=>{e.download=t}},metadata:s},J,X),a(null,null,v,{kind:"field",name:"icon",static:!1,private:!1,access:{has:e=>"icon"in e,get:e=>e.icon,set:(e,t)=>{e.icon=t}},metadata:s},Q,Z),a(null,null,y,{kind:"field",name:"iconPlacement",static:!1,private:!1,access:{has:e=>"iconPlacement"in e,get:e=>e.iconPlacement,set:(e,t)=>{e.iconPlacement=t}},metadata:s},ee,te),a(null,null,f,{kind:"field",name:"button",static:!1,private:!1,access:{has:e=>"button"in e,get:e=>e.button,set:(e,t)=>{e.button=t}},metadata:s},ae,ie),a(null,null,w,{kind:"field",name:"spinner",static:!1,private:!1,access:{has:e=>"spinner"in e,get:e=>e.spinner,set:(e,t)=>{e.spinner=t}},metadata:s},se,ne),a(null,null,k,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:s},le,re),a(null,null,x,{kind:"field",name:"iconElement",static:!1,private:!1,access:{has:e=>"iconElement"in e,get:e=>e.iconElement,set:(e,t)=>{e.iconElement=t}},metadata:s},oe,ce),a(null,e={value:n},D,{kind:"class",name:n.name,metadata:s},null,z),n=e.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),i(n,z)}constructor(){super(),this.internals=i(this,$),this.variant=i(this,F,"default"),this.size=(i(this,T),i(this,L,"medium")),this.type=(i(this,M),i(this,R,"button")),this.disabled=(i(this,B),i(this,j,!1)),this.loading=(i(this,I),i(this,O,!1)),this.outline=(i(this,P),i(this,V,!1)),this.pill=(i(this,H),i(this,N,!1)),this.circle=(i(this,q),i(this,_,!1)),this.href=(i(this,W),i(this,K,"")),this.target=(i(this,Y),i(this,U,"")),this.download=(i(this,G),i(this,J,"")),this.icon=(i(this,X),i(this,Q,"")),this.iconPlacement=(i(this,Z),i(this,ee,"start")),this.hasIconSlot=(i(this,te),!1),this.button=i(this,ae,void 0),this.spinner=(i(this,ie),i(this,se,void 0)),this.label=(i(this,ne),i(this,le,void 0)),this.iconElement=(i(this,re),i(this,oe,void 0)),i(this,ce),"function"==typeof this.attachInternals&&(this.internals=this.attachInternals())}handleIconSlotChange(){const e=this.shadowRoot?.querySelector('slot[name="icon"]');this.hasIconSlot=(e?.assignedNodes().length??0)>0}render(){const e=this.icon||this.hasIconSlot,a=e&&"start"===this.iconPlacement,i=e&&"end"===this.iconPlacement,n=["button",`button--${this.variant||"default"}`,`button--${this.size||"medium"}`,this.outline?"button--outline":"",this.pill?"button--pill":"",this.circle?"button--circle":"",this.loading?"button--loading":"",this.disabled?"button--disabled":"",e?"button--has-icon":"",e?`button--icon-${this.iconPlacement}`:""].filter(Boolean).join(" ");return t.html`
|
|
198
|
+
`}renderOptions(){if(this.remoteSearching)return'\n <div class="select-loading-indicator">\n <span class="select-loading-spinner"></span>\n <span>Searching...</span>\n </div>\n ';const e=this.searchable||this.editable||this.remote?this.filteredOptions:this.mergedOptions;return 0===e.length?`\n <div class="select-no-options">\n <span class="select-no-options-text" data-search="true" ${!(this.searchable||this.editable||this.remote)||this.filteredOptions.length>0?"hidden":""}>No matches found</span>\n <span class="select-no-options-text" data-search="false" ${(this.searchable||this.editable||this.remote)&&0===this.filteredOptions.length?"hidden":""}>No options available</span>\n </div>\n `:e.map((e,t)=>{const i=this.multiple?this.selectedValues.has(e.value):e.value===this.value;return`\n <div class="select-option\n ${i?"select-option--selected":""}\n ${e.disabled?"select-option--disabled":""}\n ${t===this.focusedIndex?"select-option--focused":""}\n ${e.icon?"select-option--has-icon":""}"\n data-value="${e.value}"\n role="option"\n aria-selected="${i}"\n aria-disabled="${e.disabled}"\n part="option">\n <span class="select-option-check" ${this.multiple?"":"hidden"}>\n <span class="select-option-check-mark" ${i?"":"hidden"}>✓</span>\n </span>\n <img class="select-option-icon" src="${e.icon||""}" alt="" ${e.icon?"":"hidden"} />\n <span class="select-option-label">${e.label}</span>\n </div>\n `}).join("")}styles(){return t.css`${":host{display:inline-block;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);position:relative;width:100%;max-width:18.75rem}[hidden]{display:none!important}img[src=\"\"]{display:none}.select-wrapper{position:relative;width:100%}.select-label{display:block;margin-bottom:.25rem;font-size:var(--snice-font-size-sm, .875rem);font-weight:500;line-height:var(--snice-line-height-normal, 1.5);color:var(--snice-color-text,rgb(23 23 23));text-align:left}.select-label--required::after{content:' *';color:var(--snice-color-danger,rgb(220 38 38))}.select-trigger{width:100%;display:flex;align-items:center;justify-content:space-between;background:var(--snice-color-background-input,rgb(248 247 245));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem);cursor:pointer;transition:all var(--snice-transition-fast, 150ms) ease;position:relative;text-align:left;font-family:inherit;color:var(--snice-color-text,rgb(23 23 23))}.select-trigger--small{padding:.375rem 2rem .375rem .625rem;font-size:var(--snice-font-size-sm, .875rem);min-height:2rem}.select-trigger--medium{padding:.5rem 2.25rem .5rem .75rem;font-size:var(--snice-font-size-md, 1rem);min-height:var(--snice-select-min-height,2.5rem)}.select-trigger--large{padding:.625rem 2.5rem .625rem .875rem;font-size:var(--snice-font-size-lg, 1.125rem);min-height:3rem}.select-trigger:hover:not(.select-trigger--disabled){border-color:var(--snice-color-border-hover,rgb(180 180 180))}.select-trigger:focus-visible{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-color:var(--snice-color-primary,rgb(37 99 235))}.select-trigger--open{border-color:var(--snice-color-primary,rgb(37 99 235))}.select-trigger--disabled{background:var(--snice-color-background-secondary,rgb(245 245 245));cursor:not-allowed;opacity:.6}.select-trigger--readonly{background:var(--snice-color-background-secondary,rgb(245 245 245));cursor:default}.select-trigger--invalid{border-color:var(--snice-color-danger,rgb(220 38 38))}.select-placeholder{color:var(--snice-color-text-secondary,rgb(82 82 82))}.select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-value--single{display:flex;align-items:center;gap:.5rem}.select-value-icon{width:1rem;height:1rem;object-fit:contain;flex-shrink:0}.select-value--multiple{display:flex;gap:.25rem;flex-wrap:wrap}.select-tag{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .375rem;background:var(--snice-color-primary-subtle,rgb(219 234 254));color:var(--snice-color-primary,rgb(37 99 235));border-radius:var(--snice-border-radius-sm,.125rem);font-size:var(--snice-font-size-xs, .75rem)}.select-tag-icon{width:.75rem;height:.75rem;object-fit:contain;flex-shrink:0}.select-tag-remove{cursor:pointer;padding:0;background:0 0;border:none;color:inherit;font-size:.75rem;line-height:1}.select-tag-remove:hover{opacity:.7}.select-icons{position:absolute;right:.5rem;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:.25rem;pointer-events:none;z-index:1}.select-clear{padding:.125rem;background:0 0;border:none;cursor:pointer;color:var(--snice-color-text-secondary,rgb(82 82 82));display:flex;align-items:center;justify-content:center;border-radius:var(--snice-border-radius-sm,.125rem);pointer-events:auto}.select-clear:hover{background:var(--snice-color-background-secondary,rgb(245 245 245));color:var(--snice-color-text,rgb(23 23 23))}.select-arrow{transition:transform var(--snice-transition-fast, 150ms) ease;color:var(--snice-color-text-secondary,rgb(82 82 82));pointer-events:none}.select-arrow--open{transform:rotate(180deg)}.select-dropdown{position:absolute;top:100%;margin-top:.25rem;left:0;right:0;background:var(--snice-color-background-element,rgb(252 251 249));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem);box-shadow:var(--snice-shadow-lg,0 10px 15px -3px rgb(0 0 0 / .1),0 4px 6px -4px rgb(0 0 0 / .1));z-index:1000;opacity:0;transform:translateY(-8px) scaleY(.95);transform-origin:top;pointer-events:none;transition:opacity var(--snice-transition-fast, 150ms) ease,transform var(--snice-transition-fast, 150ms) ease;display:flex;flex-direction:column;overflow:hidden}.select-dropdown--open{opacity:1;transform:translateY(0) scaleY(1);pointer-events:auto}.select-search{padding:.5rem;border-bottom:1px solid var(--snice-color-border,rgb(226 226 226));flex-shrink:0}.select-search-input{width:100%;padding:.375rem .625rem;background:var(--snice-color-background-input,rgb(248 247 245));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-sm,.125rem);font-size:var(--snice-font-size-sm, .875rem);font-family:inherit;color:var(--snice-color-text,rgb(23 23 23));box-sizing:border-box}.select-search-input:focus{outline:0;border-color:var(--snice-color-primary,rgb(37 99 235))}.select-options{max-height:12.5rem;overflow-y:auto;overflow-x:hidden;padding:.25rem;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--snice-color-border,rgb(226 226 226)) var(--snice-color-background-secondary,rgb(245 245 245))}.select-options::-webkit-scrollbar-track{background:var(--snice-color-background-secondary,rgb(245 245 245));margin:.25rem 0}.select-options::-webkit-scrollbar-thumb{background:var(--snice-color-border,rgb(226 226 226));border:2px solid var(--snice-color-background,rgb(255 255 255))}.select-option{padding:.5rem .75rem;cursor:pointer;border-radius:var(--snice-border-radius-sm,.125rem);transition:background var(--snice-transition-fast, 150ms) ease;display:flex;align-items:center;gap:.5rem}.select-option:hover:not(.select-option--disabled){background:var(--snice-color-background-secondary,rgb(245 245 245))}.select-option--selected{background:var(--snice-color-primary-subtle,rgb(219 234 254));color:var(--snice-color-primary,rgb(37 99 235));font-weight:500}.select-option--focused{background:var(--snice-color-background-secondary,rgb(245 245 245));outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:-2px}.select-option--disabled{opacity:.5;cursor:not-allowed}.select-option-icon{width:1rem;height:1rem;object-fit:contain;flex-shrink:0}.select-option-check{width:1rem;height:1rem;display:flex;align-items:center;justify-content:center;flex-shrink:0}.select-option-label{flex:1}.select-no-options{padding:1rem;text-align:center;color:var(--snice-color-text-secondary,rgb(82 82 82));font-size:var(--snice-font-size-sm, .875rem)}.select-native{position:absolute;opacity:0;pointer-events:none;width:0;height:0}.select-options::-webkit-scrollbar{width:6px}.select-options::-webkit-scrollbar-track{background:var(--snice-color-background-secondary,rgb(245 245 245));border-radius:3px}.select-options::-webkit-scrollbar-thumb{background:var(--snice-color-border,rgb(226 226 226));border-radius:3px}.select-options::-webkit-scrollbar-thumb:hover{background:var(--snice-color-border-hover,rgb(180 180 180))}.select-trigger--loading{cursor:wait;opacity:.7}.select-spinner{display:inline-block;width:.875rem;height:.875rem;margin-right:.25rem}.select-spinner::after{content:'';display:block;width:100%;height:100%;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:.6s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.select-freetext-input{flex:1;border:none;outline:0;background:0 0;font-family:inherit;font-size:inherit;color:var(--snice-color-text,rgb(23 23 23));padding:0;min-width:0;width:100%}.select-freetext-input::placeholder{color:var(--snice-color-text-secondary,rgb(82 82 82))}.select-editable-container{position:relative;display:flex;align-items:center;width:100%}.select-editable-input{width:100%;box-sizing:border-box;font-family:inherit;background:var(--snice-color-background-input,rgb(248 247 245));color:var(--snice-color-text,rgb(23 23 23));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,.25rem);transition:all var(--snice-transition-fast, 150ms) ease;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.select-editable-input--small{padding:.375rem 2rem .375rem .625rem;font-size:var(--snice-font-size-sm, .875rem);min-height:2rem}.select-editable-input--medium{padding:.5rem 2.25rem .5rem .75rem;font-size:var(--snice-font-size-md, 1rem);min-height:2.5rem}.select-editable-input--large{padding:.625rem 2.5rem .625rem .875rem;font-size:var(--snice-font-size-lg, 1.125rem);min-height:3rem}.select-editable-input:hover:not(:disabled){border-color:var(--snice-color-border-hover,rgb(180 180 180))}.select-editable-input:focus{border-color:var(--snice-color-primary,rgb(37 99 235));box-shadow:0 0 0 var(--snice-focus-ring-width,2px) var(--snice-focus-ring-color,rgb(59 130 246 / .5))}.select-editable-input--open{border-color:var(--snice-color-primary,rgb(37 99 235))}.select-editable-input:disabled{background:var(--snice-color-background-secondary,rgb(245 245 245));color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:not-allowed;opacity:.6}.select-editable-input:read-only{background:var(--snice-color-background-secondary,rgb(245 245 245));cursor:default}.select-editable-input::placeholder{color:var(--snice-color-text-secondary,rgb(82 82 82));opacity:.7}.select-editable-arrow{position:absolute;right:.5rem;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;color:var(--snice-color-text-secondary,rgb(82 82 82));pointer-events:none;transition:transform var(--snice-transition-fast, 150ms) ease}.select-editable-arrow--open{transform:translateY(-50%) rotate(180deg)}.select-loading-indicator{display:flex;align-items:center;justify-content:center;gap:.5rem;padding:.75rem 1rem;color:var(--snice-color-text-secondary,rgb(82 82 82));font-size:var(--snice-font-size-sm, .875rem)}.select-loading-spinner{display:inline-block;width:1rem;height:1rem;flex-shrink:0}.select-loading-spinner::after{content:'';display:block;width:100%;height:100%;border:2px solid var(--snice-color-border,rgb(226 226 226));border-top-color:var(--snice-color-primary,rgb(37 99 235));border-radius:50%;animation:.6s linear infinite spin}"}`}init(){this.readOptionsFromChildren(),this.multiple&&this.value&&(this.selectedValues=new Set(this.value.split(",").map(e=>e.trim()))),this.filteredOptions=[...this.mergedOptions],this.internals&&this.internals.setFormValue(this.value),this.editable?(this.syncEditableInputToValue(),this.updateEditableState()):(this.updateTriggerState(),this.updateValueDisplay(),this.updateClearButton()),this.updateDropdownState(),this.updateDropdownContent(),this.observeChildren(),this.setupGlobalListeners()}cleanup(){this.removeGlobalListeners(),this.childObserver?.disconnect()}setupGlobalListeners(){this.outsideClickHandler=e=>{!this.contains(e.target)&&this.open&&(this.editable&&this.commitEditableValue(),this.closeDropdown())},this.globalKeyHandler=e=>{if(this.open&&!this.editable)switch(e.key){case"Escape":this.closeDropdown(),this.trigger?.focus();break;case"ArrowDown":e.preventDefault(),this.focusNextOption();break;case"ArrowUp":e.preventDefault(),this.focusPreviousOption();break;case"Enter":case" ":if(e.preventDefault(),this.focusedIndex>=0){const e=(this.searchable?this.filteredOptions:this.mergedOptions)[this.focusedIndex];e&&!e.disabled&&this.handleOptionSelect(e)}}},document.addEventListener("click",this.outsideClickHandler),document.addEventListener("keydown",this.globalKeyHandler)}removeGlobalListeners(){this.outsideClickHandler&&document.removeEventListener("click",this.outsideClickHandler),this.globalKeyHandler&&document.removeEventListener("keydown",this.globalKeyHandler)}observeChildren(){const e=new MutationObserver(e=>{this.handleChildrenChange(e)});e.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),this.childObserver=e}handleChildrenChange(e){e.some(e=>"childList"===e.type||!("attributes"!==e.type||!["value","label","disabled","selected"].includes(e.attributeName))&&"SNICE-OPTION"===e.target.nodeName)&&(this.readOptionsFromChildren(),this.filteredOptions=[...this.mergedOptions],this.editable||(this.updateValueDisplay(),this.updateClearButton()),this.updateDropdownContent())}readOptionsFromChildren(){const e=Array.from(this.querySelectorAll("snice-option"));this.childOptions=e.map(e=>{const t=e;return t.optionData?t.optionData:{value:e.getAttribute("value")||"",label:e.getAttribute("label")||e.textContent?.trim()||"",disabled:e.hasAttribute("disabled"),selected:e.hasAttribute("selected")}})}handleEditableInput(e){const t=e.target;this.editableInputValue=t.value,this.filterEditableOptions(this.editableInputValue),this.open||this.openDropdown()}handleEditableFocus(){this.open||this.readonly||this.openDropdown()}handleEditableBlur(e){setTimeout(()=>{this.open&&(this.commitEditableValue(),this.closeDropdown())},200)}handleEditableClick(){this.open||this.disabled||this.readonly||this.openDropdown()}handleEditableArrowClick(e){e.preventDefault(),e.stopPropagation(),this.disabled||this.readonly||(this.open?this.closeDropdown():(this.openDropdown(),this.editableInput?.focus()))}handleEditableKeydown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this.open?this.focusNextOption():this.openDropdown();break;case"ArrowUp":e.preventDefault(),this.open&&this.focusPreviousOption();break;case"Enter":if(e.preventDefault(),this.open&&this.focusedIndex>=0){const e=this.filteredOptions[this.focusedIndex];e&&!e.disabled&&this.handleEditableOptionSelect(e)}else this.open&&(this.commitEditableValue(),this.closeDropdown());break;case"Escape":this.open&&(this.closeDropdown(),this.syncEditableInputToValue());break;case"Tab":this.open&&(this.commitEditableValue(),this.closeDropdown())}}handleEditableOptionSelect(e){this.value=e.value,this.editableInputValue=e.label,this.editableInput&&(this.editableInput.value=e.label),this.closeDropdown(),this.dispatchChangeEvent(e),this.editableInput?.focus()}commitEditableValue(){if(!this.editableInput)return;const e=this.editableInput.value.trim(),t=this.mergedOptions.find(t=>t.label.toLowerCase()===e.toLowerCase());t?(this.value=t.value,this.editableInputValue=t.label,this.editableInput.value=t.label,this.dispatchChangeEvent(t)):this.allowFreeText&&e?(this.value=e,this.editableInputValue=e,this.dispatchChangeEvent()):this.syncEditableInputToValue()}filterEditableOptions(e){if(this.remote)return void this.scheduleRemoteSearch(e);const t=this.mergedOptions;if(e){const i=e.toLowerCase();this.filteredOptions=t.filter(e=>e.label.toLowerCase().includes(i))}else this.filteredOptions=[...t];this.focusedIndex=-1,this.updateDropdownContent()}syncEditableInputToValue(){if(this.editableInput)if(this.value){const e=this.mergedOptions.find(e=>e.value===this.value);e?(this.editableInput.value=e.label,this.editableInputValue=e.label):this.allowFreeText?(this.editableInput.value=this.value,this.editableInputValue=this.value):(this.editableInput.value="",this.editableInputValue="")}else this.editableInput.value="",this.editableInputValue=""}updateEditableState(){this.editableInput&&(this.editableInput.setAttribute("aria-expanded",String(this.open)),this.editableInput.classList.toggle("select-editable-input--open",this.open))}handleDropdownMousedown(e){this.editable&&e.preventDefault()}handleTriggerOpen(e){["Enter"," ","ArrowDown","ArrowUp"].includes(e.key)&&(e.preventDefault(),this.open||this.openDropdown())}handleSearchKeydown(e){switch(e.key){case"Escape":this.closeDropdown(),this.trigger?.focus();break;case"ArrowDown":e.preventDefault(),this.focusNextOption();break;case"ArrowUp":e.preventDefault(),this.focusPreviousOption();break;case"Enter":if(e.preventDefault(),this.focusedIndex>=0){const e=(this.searchable?this.filteredOptions:this.mergedOptions)[this.focusedIndex];e&&!e.disabled&&this.handleOptionSelect(e)}}}focusNextOption(){const e=this.searchable||this.editable?this.filteredOptions:this.mergedOptions;if(0!==e.filter(e=>!e.disabled).length){for(this.focusedIndex++,this.focusedIndex>=e.length&&(this.focusedIndex=0);e[this.focusedIndex]?.disabled;)this.focusedIndex++,this.focusedIndex>=e.length&&(this.focusedIndex=0);this.updateOptionFocus()}}focusPreviousOption(){const e=this.searchable||this.editable?this.filteredOptions:this.mergedOptions;if(0!==e.filter(e=>!e.disabled).length){for(this.focusedIndex--,this.focusedIndex<0&&(this.focusedIndex=e.length-1);e[this.focusedIndex]?.disabled;)this.focusedIndex--,this.focusedIndex<0&&(this.focusedIndex=e.length-1);this.updateOptionFocus()}}updateOptionFocus(){if(this.optionElements){this.optionElements.forEach((e,t)=>{e.classList.toggle("select-option--focused",t===this.focusedIndex)});const e=this.optionElements?.[this.focusedIndex];e&&e.scrollIntoView({block:"nearest"})}}handleClearClick(e){e.preventDefault(),e.stopPropagation(),this.clear()}handleTriggerClick(e){e.target.closest(".select-clear")||(e.stopPropagation(),this.disabled||this.readonly||this.toggleDropdown())}handleOptionsClick(e){const t=e.target;if(t.closest(".select-tag-remove")){e.stopPropagation();const i=t.closest(".select-tag-remove").getAttribute("data-value");return void(i&&this.multiple&&(this.selectedValues.delete(i),this.value=Array.from(this.selectedValues).join(","),this.updateValueDisplay(),this.updateClearButton(),this.dispatchChangeEvent()))}const i=t.closest(".select-option");if(!i)return;e.stopPropagation();const a=i.getAttribute("data-value");if(!a)return;const s=this.mergedOptions.find(e=>e.value===a);s&&!s.disabled&&(this.editable?this.handleEditableOptionSelect(s):this.handleOptionSelect(s))}handleSearchInput(e){const t=e.target.value;if(this.remote)return void this.scheduleRemoteSearch(t);const i=t.toLowerCase();this.filteredOptions=i?this.mergedOptions.filter(e=>e.label.toLowerCase().includes(i)):[...this.mergedOptions],this.focusedIndex=-1,this.updateDropdownContent()}handleOptionSelect(e){this.multiple?(this.selectedValues.has(e.value)?this.selectedValues.delete(e.value):this.selectedValues.add(e.value),this.value=Array.from(this.selectedValues).join(","),this.updateDropdownContent()):(this.value=e.value,this.closeDropdown()),this.updateValueDisplay(),this.updateClearButton(),this.dispatchChangeEvent(e)}handleValueChange(){this.multiple&&(this.selectedValues=new Set(this.value?this.value.split(",").map(e=>e.trim()):[])),this.editable?this.syncEditableInputToValue():(this.updateValueDisplay(),this.updateClearButton()),this.internals&&this.internals.setFormValue(this.value)}handleOptionsPropertyChange(){this.filteredOptions=[...this.mergedOptions],this.updateDropdownContent(),this.editable&&this.syncEditableInputToValue()}handleDisabledChange(){this.editable||(this.updateTriggerState(),this.updateClearButton()),this.disabled&&this.open&&this.closeDropdown()}handleLoadingChange(){this.editable||(this.updateTriggerState(),this.updateClearButton()),this.loading&&this.open&&!this.remote&&this.closeDropdown()}handleOpenChange(){if(this.updateDropdownState(),this.editable){if(this.updateEditableState(),this.open)if(this.remote){const e=this.editableInput?.value||"";this.scheduleRemoteSearch(e)}else this.filteredOptions=[...this.mergedOptions],this.focusedIndex=-1,this.updateDropdownContent();this.open||(this.focusedIndex=-1)}else{if(this.updateTriggerState(),this.open&&this.searchable&&this.searchInput&&setTimeout(()=>this.searchInput?.focus(),100),this.open&&this.remote&&this.searchable){const e=this.searchInput?.value||"";this.scheduleRemoteSearch(e)}this.open||(this.focusedIndex=-1,this.searchInput&&(this.searchInput.value="",this.filteredOptions=[...this.mergedOptions],this.updateDropdownContent()))}}updateValueDisplay(){if(!this.valueDisplay)return;const e=this.mergedOptions.filter(e=>this.multiple?this.selectedValues.has(e.value):e.value===this.value);if(this.multiple&&e.length>0)this.valueDisplay.innerHTML=`\n <div class="select-value--multiple">\n ${e.map(e=>`\n <span class="select-tag">\n <img class="select-tag-icon" src="${e.icon||""}" alt="" ${e.icon?"":"hidden"} />\n ${e.label}\n <span class="select-tag-remove" data-value="${e.value}" aria-label="Remove ${e.label}" ${this.disabled||this.readonly?"hidden":""}>×</span>\n </span>\n `).join("")}\n </div>\n `;else if(e.length>0){const t=e[0];this.valueDisplay.innerHTML=`\n <div class="select-value--single">\n <img class="select-value-icon" src="${t.icon||""}" alt="" ${t.icon?"":"hidden"} />\n <span>${t.label}</span>\n </div>\n `}else this.valueDisplay.innerHTML=`<span class="select-placeholder">${this.placeholder}</span>`}updateClearButton(){if(!this.clearButton)return;const e=this.mergedOptions.filter(e=>this.multiple?this.selectedValues.has(e.value):e.value===this.value),t=this.clearable&&e.length>0&&!this.disabled&&!this.readonly;this.clearButton.style.display=t?"":"none"}updateDropdownContent(){this.optionsList&&(this.optionsList.innerHTML=this.renderOptions())}dispatchChangeEvent(e){return{value:this.multiple?Array.from(this.selectedValues):this.value,option:e,select:this}}dispatchOpenEvent(){return{select:this}}dispatchCloseEvent(){return{select:this}}focus(){this.editable?this.editableInput?.focus():this.trigger?.focus()}blur(){this.editable?this.editableInput?.blur():this.trigger?.blur(),this.open&&this.closeDropdown()}clear(){this.multiple?(this.selectedValues.clear(),this.value=""):this.value="",this.editable?this.syncEditableInputToValue():(this.updateValueDisplay(),this.updateClearButton()),this.dispatchChangeEvent()}openDropdown(){this.open||this.disabled||this.readonly||(this.open=!0,this.dispatchOpenEvent())}closeDropdown(){this.open&&(this.open=!1,this.dispatchCloseEvent())}toggleDropdown(){this.open?this.closeDropdown():this.openDropdown()}selectOption(e){const t=this.mergedOptions.find(t=>t.value===e);t&&!t.disabled&&(this.editable?this.handleEditableOptionSelect(t):this.handleOptionSelect(t))}updateTriggerState(){this.trigger&&(this.trigger.classList.toggle("select-trigger--open",this.open),this.trigger.classList.toggle("select-trigger--disabled",this.disabled),this.trigger.classList.toggle("select-trigger--readonly",this.readonly),this.trigger.classList.toggle("select-trigger--invalid",this.invalid),this.trigger.classList.toggle("select-trigger--loading",this.loading),this.trigger.setAttribute("aria-expanded",String(this.open)),this.trigger.disabled=this.disabled||this.loading)}updateDropdownState(){this.dropdown&&(this.dropdown.classList.toggle("select-dropdown--open",this.open),this.arrow&&this.arrow.classList.toggle("select-arrow--open",this.open))}})})();(()=>{let e,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C,E,D=[t.element("snice-button",{formAssociated:!0})],z=[],A=HTMLElement,$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[],G=[],J=[],X=[],Q=[],Z=[],ee=[],te=[],ie=[],ae=[],se=[],ne=[],le=[],re=[],oe=[],ce=[],de=[],he=[];(class extends A{static{n=this}static{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(A[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Boolean})],d=[t.property({type:Boolean})],h=[t.property({type:Boolean})],u=[t.property({type:Boolean})],p=[t.property({type:Boolean})],m=[t.property({type:String})],g=[t.property({type:String})],b=[t.property({type:String})],v=[t.property({type:String})],y=[t.property({attribute:"icon-placement"})],f=[t.query('[slot="icon"]',{light:!0})],w=[t.query(".button")],k=[t.query(".spinner")],x=[t.query(".label")],S=[t.query(".icon")],C=[t.render()],E=[t.styles()],i(this,null,C,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:s},null,$),i(this,null,E,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:s},null,$),i(null,null,l,{kind:"field",name:"variant",static:!1,private:!1,access:{has:e=>"variant"in e,get:e=>e.variant,set:(e,t)=>{e.variant=t}},metadata:s},F,T),i(null,null,r,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:s},L,M),i(null,null,o,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:s},R,B),i(null,null,c,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:s},j,I),i(null,null,d,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:s},O,P),i(null,null,h,{kind:"field",name:"outline",static:!1,private:!1,access:{has:e=>"outline"in e,get:e=>e.outline,set:(e,t)=>{e.outline=t}},metadata:s},V,H),i(null,null,u,{kind:"field",name:"pill",static:!1,private:!1,access:{has:e=>"pill"in e,get:e=>e.pill,set:(e,t)=>{e.pill=t}},metadata:s},N,q),i(null,null,p,{kind:"field",name:"circle",static:!1,private:!1,access:{has:e=>"circle"in e,get:e=>e.circle,set:(e,t)=>{e.circle=t}},metadata:s},_,W),i(null,null,m,{kind:"field",name:"href",static:!1,private:!1,access:{has:e=>"href"in e,get:e=>e.href,set:(e,t)=>{e.href=t}},metadata:s},K,Y),i(null,null,g,{kind:"field",name:"target",static:!1,private:!1,access:{has:e=>"target"in e,get:e=>e.target,set:(e,t)=>{e.target=t}},metadata:s},U,G),i(null,null,b,{kind:"field",name:"download",static:!1,private:!1,access:{has:e=>"download"in e,get:e=>e.download,set:(e,t)=>{e.download=t}},metadata:s},J,X),i(null,null,v,{kind:"field",name:"icon",static:!1,private:!1,access:{has:e=>"icon"in e,get:e=>e.icon,set:(e,t)=>{e.icon=t}},metadata:s},Q,Z),i(null,null,y,{kind:"field",name:"iconPlacement",static:!1,private:!1,access:{has:e=>"iconPlacement"in e,get:e=>e.iconPlacement,set:(e,t)=>{e.iconPlacement=t}},metadata:s},ee,te),i(null,null,f,{kind:"field",name:"iconSlotChild",static:!1,private:!1,access:{has:e=>"iconSlotChild"in e,get:e=>e.iconSlotChild,set:(e,t)=>{e.iconSlotChild=t}},metadata:s},ie,ae),i(null,null,w,{kind:"field",name:"button",static:!1,private:!1,access:{has:e=>"button"in e,get:e=>e.button,set:(e,t)=>{e.button=t}},metadata:s},se,ne),i(null,null,k,{kind:"field",name:"spinner",static:!1,private:!1,access:{has:e=>"spinner"in e,get:e=>e.spinner,set:(e,t)=>{e.spinner=t}},metadata:s},le,re),i(null,null,x,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:s},oe,ce),i(null,null,S,{kind:"field",name:"iconElement",static:!1,private:!1,access:{has:e=>"iconElement"in e,get:e=>e.iconElement,set:(e,t)=>{e.iconElement=t}},metadata:s},de,he),i(null,e={value:n},D,{kind:"class",name:n.name,metadata:s},null,z),n=e.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),a(n,z)}constructor(){super(),this.internals=a(this,$),this.variant=a(this,F,"default"),this.size=(a(this,T),a(this,L,"medium")),this.type=(a(this,M),a(this,R,"button")),this.disabled=(a(this,B),a(this,j,!1)),this.loading=(a(this,I),a(this,O,!1)),this.outline=(a(this,P),a(this,V,!1)),this.pill=(a(this,H),a(this,N,!1)),this.circle=(a(this,q),a(this,_,!1)),this.href=(a(this,W),a(this,K,"")),this.target=(a(this,Y),a(this,U,"")),this.download=(a(this,G),a(this,J,"")),this.icon=(a(this,X),a(this,Q,"")),this.iconPlacement=(a(this,Z),a(this,ee,"start")),this.iconSlotChild=(a(this,te),a(this,ie,void 0)),this.button=(a(this,ae),a(this,se,void 0)),this.spinner=(a(this,ne),a(this,le,void 0)),this.label=(a(this,re),a(this,oe,void 0)),this.iconElement=(a(this,ce),a(this,de,void 0)),a(this,he),"function"==typeof this.attachInternals&&(this.internals=this.attachInternals())}get hasIconSlot(){return!!this.iconSlotChild}render(){const e=this.icon||this.hasIconSlot,i=e&&"start"===this.iconPlacement,a=e&&"end"===this.iconPlacement,n=["button",`button--${this.variant||"default"}`,`button--${this.size||"medium"}`,this.outline?"button--outline":"",this.pill?"button--pill":"",this.circle?"button--circle":"",this.loading?"button--loading":"",this.disabled?"button--disabled":"",e?"button--has-icon":"",e?`button--icon-${this.iconPlacement}`:""].filter(Boolean).join(" ");return t.html`
|
|
199
199
|
<button class="${n}" type="${this.type}" ?disabled="${this.disabled}" part="base" @click="${e=>this.handleInternalClick(e)}">
|
|
200
200
|
<span class="spinner" part="spinner"></span>
|
|
201
|
-
<if ${
|
|
201
|
+
<if ${i}>
|
|
202
202
|
<span class="icon-slot" part="icon">
|
|
203
203
|
<slot name="icon">
|
|
204
204
|
<if ${this.icon}>
|
|
@@ -210,7 +210,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
210
210
|
<span class="label" part="label">
|
|
211
211
|
<slot></slot>
|
|
212
212
|
</span>
|
|
213
|
-
<if ${
|
|
213
|
+
<if ${a}>
|
|
214
214
|
<span class="icon-slot" part="icon">
|
|
215
215
|
<slot name="icon">
|
|
216
216
|
<if ${this.icon}>
|
|
@@ -220,7 +220,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
220
220
|
</span>
|
|
221
221
|
</if>
|
|
222
222
|
</button>
|
|
223
|
-
`}handleInternalClick(e){if(this.disabled||this.loading)return e.preventDefault(),void e.stopPropagation();if(this.href)if(this.download){const e=document.createElement("a");e.href=this.href,e.download=this.download,e.click()}else this.target?window.open(this.href,this.target):window.location.href=this.href;const t=this.internals?.form||this.closest("form");if(t)switch(this.type){case"submit":t.requestSubmit();break;case"reset":t.reset()}this.dispatchEvent(new CustomEvent("button-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}styles(){return t.css`${":host{display:inline-block;position:relative;width:auto;cursor:pointer}:host([disabled]){cursor:not-allowed}.button{display:inline-flex;align-items:center;justify-content:center;width:100%;border:1px solid;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);font-weight:var(--snice-font-weight-medium,500);text-decoration:none;user-select:none;white-space:nowrap;vertical-align:middle;padding:0;box-shadow:var(--snice-shadow-xs,0 1px 2px 0 rgb(0 0 0 / .03));transition:color var(--snice-transition-fast, 150ms) ease,background-color var(--snice-transition-fast, 150ms) ease,border-color var(--snice-transition-fast, 150ms) ease,box-shadow var(--snice-transition-fast, 150ms) ease,transform var(--snice-transition-fast, 150ms) cubic-bezier(.3, 0, .2, 1);cursor:inherit;position:relative}.button::before{content:'';position:absolute;inset:0;border-radius:inherit;background:var(--snice-gradient-button,none);pointer-events:none}.button:active{transition:color 50ms,background-color 50ms,border-color 50ms,box-shadow 50ms}.button:focus-visible{outline:0;box-shadow:0 0 0 var(--snice-focus-ring-width,2px) var(--snice-focus-ring-color,rgb(59 130 246 / .5))}.button--disabled{opacity:.5;cursor:not-allowed;box-shadow:none}.button--small{font-size:var(--snice-font-size-sm, .875rem);height:1.875rem;padding:0 var(--snice-spacing-sm,.75rem);border-radius:var(--snice-border-radius-md,.25rem)}.button--medium{font-size:var(--snice-font-size-md, 1rem);height:2.5rem;padding:0 var(--snice-spacing-md,1rem);border-radius:var(--snice-border-radius-md,.25rem)}.button--large{font-size:var(--snice-font-size-lg, 1.125rem);height:3.125rem;padding:0 var(--snice-spacing-lg,1.5rem);border-radius:var(--snice-border-radius-md,.25rem)}.button--default{background-color:var(--snice-color-background,rgb(255 255 255));color:var(--snice-color-text,rgb(23 23 23));border-color:var(--snice-color-border,rgb(226 226 226))}.button--default:hover:not(.button--disabled){background-color:var(--snice-color-background-secondary,rgb(250 250 250));border-color:var(--snice-color-border-hover,rgb(204 204 204));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--default:active:not(.button--disabled){background-color:var(--snice-color-background-tertiary,rgb(248 248 248));border-color:var(--snice-color-border-hover,rgb(204 204 204));box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--primary{background-color:var(--snice-color-primary,rgb(37 99 235));color:var(--snice-color-text-inverse,rgb(250 250 250));border-color:var(--snice-color-primary,rgb(37 99 235))}.button--primary:hover:not(.button--disabled){background-color:var(--snice-color-primary-hover,rgb(29 78 216));border-color:var(--snice-color-primary-hover,rgb(29 78 216));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--primary:active:not(.button--disabled){background-color:color-mix(in srgb,var(--snice-color-primary,rgb(37 99 235)) 85%,#fff);border-color:color-mix(in srgb,var(--snice-color-primary,rgb(37 99 235)) 85%,#fff);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--success{background-color:var(--snice-color-success,rgb(22 163 74));color:var(--snice-color-text-inverse,rgb(250 250 250));border-color:var(--snice-color-success,rgb(22 163 74))}.button--success:hover:not(.button--disabled){background-color:var(--snice-color-success-hover,rgb(21 128 61));border-color:var(--snice-color-success-hover,rgb(21 128 61));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--success:active:not(.button--disabled){background-color:color-mix(in srgb,var(--snice-color-success,rgb(22 163 74)) 85%,#fff);border-color:color-mix(in srgb,var(--snice-color-success,rgb(22 163 74)) 85%,#fff);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--warning{background-color:var(--snice-color-warning,rgb(202 138 4));color:var(--snice-color-text-inverse,rgb(250 250 250));border-color:var(--snice-color-warning,rgb(202 138 4))}.button--warning:hover:not(.button--disabled){background-color:var(--snice-color-warning-hover,rgb(161 98 7));border-color:var(--snice-color-warning-hover,rgb(161 98 7));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--warning:active:not(.button--disabled){background-color:color-mix(in srgb,var(--snice-color-warning,rgb(202 138 4)) 85%,#fff);border-color:color-mix(in srgb,var(--snice-color-warning,rgb(202 138 4)) 85%,#fff);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--danger{background-color:var(--snice-color-danger,rgb(220 38 38));color:var(--snice-color-text-inverse,rgb(250 250 250));border-color:var(--snice-color-danger,rgb(220 38 38))}.button--danger:hover:not(.button--disabled){background-color:var(--snice-color-danger-hover,rgb(185 28 28));border-color:var(--snice-color-danger-hover,rgb(185 28 28));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--danger:active:not(.button--disabled){background-color:color-mix(in srgb,var(--snice-color-danger,rgb(220 38 38)) 85%,#fff);border-color:color-mix(in srgb,var(--snice-color-danger,rgb(220 38 38)) 85%,#fff);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--text{background-color:transparent;color:var(--snice-color-primary,rgb(37 99 235));border-color:transparent;box-shadow:none}.button--text::before{display:none}.button--text:hover:not(.button--disabled){background-color:var(--snice-color-primary-alpha,rgb(37 99 235 / .1));color:var(--snice-color-primary-hover,rgb(29 78 216));box-shadow:none;transform:none}.button--text:active:not(.button--disabled){background-color:var(--snice-color-primary-alpha-strong,rgb(37 99 235 / .15));box-shadow:none;transform:none}.button--outline{box-shadow:none}.button--outline::before{display:none}.button--outline.button--default{background-color:transparent;color:var(--snice-color-text,rgb(23 23 23))}.button--outline.button--primary{background-color:transparent;color:var(--snice-color-primary,rgb(37 99 235))}.button--outline.button--success{background-color:transparent;color:var(--snice-color-success,rgb(22 163 74))}.button--outline.button--warning{background-color:transparent;color:var(--snice-color-warning,rgb(202 138 4))}.button--outline.button--danger{background-color:transparent;color:var(--snice-color-danger,rgb(220 38 38))}.button--outline:hover:not(.button--disabled){background-color:var(--snice-color-border-alpha,rgb(82 82 82 / .1));box-shadow:none;transform:none}.button--outline:active:not(.button--disabled){background-color:var(--snice-color-border-alpha-strong,rgb(82 82 82 / .15));box-shadow:none;transform:none}.button--pill{border-radius:var(--snice-border-radius-pill,9999px)}.button--circle{border-radius:var(--snice-border-radius-circle,50%);width:var(--size);padding:0}.button--small.button--circle{--size:1.875rem}.button--medium.button--circle{--size:2.5rem}.button--large.button--circle{--size:3.125rem}.button--loading{position:relative;cursor:wait}.button--loading .label{visibility:hidden}.spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:1em;height:1em}.button--loading .spinner{display:block}.spinner::after{content:'';display:block;width:100%;height:100%;box-sizing:border-box;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:.6s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.icon-slot{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:1.25em;height:1.25em;line-height:1}.icon-slot:empty{display:none}.icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:1.25em;height:1.25em;line-height:1}.icon img{width:100%;height:100%;object-fit:contain}.icon svg{width:100%;height:100%}.icon-slot ::slotted(*){display:flex;align-items:center;justify-content:center;width:1.25em;height:1.25em;font-size:1.25em;line-height:1}.icon-slot ::slotted(svg){width:1.25em;height:1.25em}.icon-slot ::slotted(img){width:1.25em;height:1.25em;object-fit:contain}.button--icon-start .icon,.button--icon-start .icon-slot{margin-right:.5em}.button--icon-end .icon,.button--icon-end .icon-slot{margin-left:.5em}.button--circle .icon,.button--circle .icon-slot{margin:0}"}`}setLoading(e){this.loading=e}setDisabled(e){this.disabled=e}setVariant(e){this.variant=e}focus(e){this.button?.focus(e)}blur(){this.button?.blur()}click(){this.button?.click()}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C=[t.element("snice-checkbox")],E=[],D=HTMLElement,z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[],G=[],J=[],X=[],Q=[],Z=[],ee=[],te=[];(class extends D{static{s=this}static{const ae="function"==typeof Symbol&&Symbol.metadata?Object.create(D[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean})],l=[t.property({type:Boolean})],r=[t.property({type:Boolean})],o=[t.property({type:Boolean})],c=[t.property({type:Boolean})],d=[t.property({type:Boolean})],h=[t.property({})],u=[t.property({})],p=[t.property({})],m=[t.property({})],g=[t.query(".checkbox-input")],b=[t.query(".checkbox")],v=[t.query(".checkbox-label")],y=[t.query(".checkbox-wrapper")],f=[t.on("click")],w=[t.render()],k=[t.watch("checked")],x=[t.watch("indeterminate")],S=[t.styles()],a(this,null,f,{kind:"method",name:"handleCheckboxClick",static:!1,private:!1,access:{has:e=>"handleCheckboxClick"in e,get:e=>e.handleCheckboxClick},metadata:ae},null,z),a(this,null,w,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:ae},null,z),a(this,null,k,{kind:"method",name:"handleCheckedChange",static:!1,private:!1,access:{has:e=>"handleCheckedChange"in e,get:e=>e.handleCheckedChange},metadata:ae},null,z),a(this,null,x,{kind:"method",name:"handleIndeterminateChange",static:!1,private:!1,access:{has:e=>"handleIndeterminateChange"in e,get:e=>e.handleIndeterminateChange},metadata:ae},null,z),a(this,null,S,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:ae},null,z),a(null,null,n,{kind:"field",name:"checked",static:!1,private:!1,access:{has:e=>"checked"in e,get:e=>e.checked,set:(e,t)=>{e.checked=t}},metadata:ae},A,$),a(null,null,l,{kind:"field",name:"indeterminate",static:!1,private:!1,access:{has:e=>"indeterminate"in e,get:e=>e.indeterminate,set:(e,t)=>{e.indeterminate=t}},metadata:ae},F,T),a(null,null,r,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:ae},L,M),a(null,null,o,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:ae},R,B),a(null,null,c,{kind:"field",name:"required",static:!1,private:!1,access:{has:e=>"required"in e,get:e=>e.required,set:(e,t)=>{e.required=t}},metadata:ae},j,I),a(null,null,d,{kind:"field",name:"invalid",static:!1,private:!1,access:{has:e=>"invalid"in e,get:e=>e.invalid,set:(e,t)=>{e.invalid=t}},metadata:ae},O,P),a(null,null,h,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:ae},V,H),a(null,null,u,{kind:"field",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:ae},N,q),a(null,null,p,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:ae},_,W),a(null,null,m,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:ae},K,Y),a(null,null,g,{kind:"field",name:"input",static:!1,private:!1,access:{has:e=>"input"in e,get:e=>e.input,set:(e,t)=>{e.input=t}},metadata:ae},U,G),a(null,null,b,{kind:"field",name:"checkbox",static:!1,private:!1,access:{has:e=>"checkbox"in e,get:e=>e.checkbox,set:(e,t)=>{e.checkbox=t}},metadata:ae},J,X),a(null,null,v,{kind:"field",name:"labelElement",static:!1,private:!1,access:{has:e=>"labelElement"in e,get:e=>e.labelElement,set:(e,t)=>{e.labelElement=t}},metadata:ae},Q,Z),a(null,null,y,{kind:"field",name:"wrapper",static:!1,private:!1,access:{has:e=>"wrapper"in e,get:e=>e.wrapper,set:(e,t)=>{e.wrapper=t}},metadata:ae},ee,te),a(null,e={value:s},C,{kind:"class",name:s.name,metadata:ae},null,E),s=e.value,ae&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:ae}),i(s,E)}handleCheckboxClick(){this.disabled||this.loading||this.toggle()}render(){const e=`checkbox-wrapper${this.disabled?" checkbox-wrapper--disabled":""}${this.loading?" checkbox-wrapper--loading":""}`,a=`checkbox checkbox--${this.size}${this.invalid?" checkbox--invalid":""}${this.indeterminate?" checkbox--indeterminate":""}${this.loading?" checkbox--loading":""}`,i=`checkbox-label checkbox-label--${this.size}${this.required?" checkbox-label--required":""}`;return t.html`
|
|
223
|
+
`}handleInternalClick(e){if(this.disabled||this.loading)return e.preventDefault(),void e.stopPropagation();if(this.href)if(this.download){const e=document.createElement("a");e.href=this.href,e.download=this.download,e.click()}else this.target?window.open(this.href,this.target):window.location.href=this.href;const t=this.internals?.form||this.closest("form");if(t)switch(this.type){case"submit":t.requestSubmit();break;case"reset":t.reset()}this.dispatchEvent(new CustomEvent("button-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}styles(){return t.css`${":host{display:inline-block;position:relative;width:auto;cursor:pointer}:host([disabled]){cursor:not-allowed}.button{display:inline-flex;align-items:center;justify-content:center;width:100%;border:1px solid;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);font-weight:var(--snice-font-weight-medium,500);text-decoration:none;user-select:none;white-space:nowrap;vertical-align:middle;padding:0;box-shadow:var(--snice-shadow-xs,0 1px 2px 0 rgb(0 0 0 / .03));transition:color var(--snice-transition-fast, 150ms) ease,background-color var(--snice-transition-fast, 150ms) ease,border-color var(--snice-transition-fast, 150ms) ease,box-shadow var(--snice-transition-fast, 150ms) ease,transform var(--snice-transition-fast, 150ms) cubic-bezier(.3, 0, .2, 1);cursor:inherit;position:relative}.button::before{content:'';position:absolute;inset:0;border-radius:inherit;background:var(--snice-gradient-button,none);pointer-events:none}.button:active{transition:color 50ms,background-color 50ms,border-color 50ms,box-shadow 50ms}.button:focus-visible{outline:0;box-shadow:0 0 0 var(--snice-focus-ring-width,2px) var(--snice-focus-ring-color,rgb(59 130 246 / .5))}.button--disabled{opacity:.5;cursor:not-allowed;box-shadow:none}.button--small{font-size:var(--snice-font-size-sm, .875rem);height:1.875rem;padding:0 var(--snice-spacing-sm,.75rem);border-radius:var(--snice-border-radius-md,.25rem)}.button--medium{font-size:var(--snice-font-size-md, 1rem);height:2.5rem;padding:0 var(--snice-spacing-md,1rem);border-radius:var(--snice-border-radius-md,.25rem)}.button--large{font-size:var(--snice-font-size-lg, 1.125rem);height:3.125rem;padding:0 var(--snice-spacing-lg,1.5rem);border-radius:var(--snice-border-radius-md,.25rem)}.button--default{background-color:var(--snice-color-background,rgb(255 255 255));color:var(--snice-color-text,rgb(23 23 23));border-color:var(--snice-color-border,rgb(226 226 226))}.button--default:hover:not(.button--disabled){background-color:var(--snice-color-background-secondary,rgb(250 250 250));border-color:var(--snice-color-border-hover,rgb(204 204 204));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--default:active:not(.button--disabled){background-color:var(--snice-color-background-tertiary,rgb(248 248 248));border-color:var(--snice-color-border-hover,rgb(204 204 204));box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--primary{background-color:var(--snice-color-primary,rgb(37 99 235));color:var(--snice-color-text-inverse,rgb(250 250 250));border-color:var(--snice-color-primary,rgb(37 99 235))}.button--primary:hover:not(.button--disabled){background-color:var(--snice-color-primary-hover,rgb(29 78 216));border-color:var(--snice-color-primary-hover,rgb(29 78 216));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--primary:active:not(.button--disabled){background-color:color-mix(in srgb,var(--snice-color-primary,rgb(37 99 235)) 85%,#fff);border-color:color-mix(in srgb,var(--snice-color-primary,rgb(37 99 235)) 85%,#fff);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--success{background-color:var(--snice-color-success,rgb(22 163 74));color:var(--snice-color-text-inverse,rgb(250 250 250));border-color:var(--snice-color-success,rgb(22 163 74))}.button--success:hover:not(.button--disabled){background-color:var(--snice-color-success-hover,rgb(21 128 61));border-color:var(--snice-color-success-hover,rgb(21 128 61));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--success:active:not(.button--disabled){background-color:color-mix(in srgb,var(--snice-color-success,rgb(22 163 74)) 85%,#fff);border-color:color-mix(in srgb,var(--snice-color-success,rgb(22 163 74)) 85%,#fff);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--warning{background-color:var(--snice-color-warning,rgb(202 138 4));color:var(--snice-color-text-inverse,rgb(250 250 250));border-color:var(--snice-color-warning,rgb(202 138 4))}.button--warning:hover:not(.button--disabled){background-color:var(--snice-color-warning-hover,rgb(161 98 7));border-color:var(--snice-color-warning-hover,rgb(161 98 7));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--warning:active:not(.button--disabled){background-color:color-mix(in srgb,var(--snice-color-warning,rgb(202 138 4)) 85%,#fff);border-color:color-mix(in srgb,var(--snice-color-warning,rgb(202 138 4)) 85%,#fff);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--danger{background-color:var(--snice-color-danger,rgb(220 38 38));color:var(--snice-color-text-inverse,rgb(250 250 250));border-color:var(--snice-color-danger,rgb(220 38 38))}.button--danger:hover:not(.button--disabled){background-color:var(--snice-color-danger-hover,rgb(185 28 28));border-color:var(--snice-color-danger-hover,rgb(185 28 28));box-shadow:var(--snice-shadow-sm,0 1px 2px 0 rgb(0 0 0 / .05));transform:translateY(-1px)}.button--danger:active:not(.button--disabled){background-color:color-mix(in srgb,var(--snice-color-danger,rgb(220 38 38)) 85%,#fff);border-color:color-mix(in srgb,var(--snice-color-danger,rgb(220 38 38)) 85%,#fff);box-shadow:var(--snice-shadow-inset-sm,inset 0 1px 2px rgb(0 0 0 / .05));transform:translateY(0)}.button--text{background-color:transparent;color:var(--snice-color-primary,rgb(37 99 235));border-color:transparent;box-shadow:none}.button--text::before{display:none}.button--text:hover:not(.button--disabled){background-color:var(--snice-color-primary-alpha,rgb(37 99 235 / .1));color:var(--snice-color-primary-hover,rgb(29 78 216));box-shadow:none;transform:none}.button--text:active:not(.button--disabled){background-color:var(--snice-color-primary-alpha-strong,rgb(37 99 235 / .15));box-shadow:none;transform:none}.button--outline{box-shadow:none}.button--outline::before{display:none}.button--outline.button--default{background-color:transparent;color:var(--snice-color-text,rgb(23 23 23))}.button--outline.button--primary{background-color:transparent;color:var(--snice-color-primary,rgb(37 99 235))}.button--outline.button--success{background-color:transparent;color:var(--snice-color-success,rgb(22 163 74))}.button--outline.button--warning{background-color:transparent;color:var(--snice-color-warning,rgb(202 138 4))}.button--outline.button--danger{background-color:transparent;color:var(--snice-color-danger,rgb(220 38 38))}.button--outline:hover:not(.button--disabled){background-color:var(--snice-color-border-alpha,rgb(82 82 82 / .1));box-shadow:none;transform:none}.button--outline:active:not(.button--disabled){background-color:var(--snice-color-border-alpha-strong,rgb(82 82 82 / .15));box-shadow:none;transform:none}.button--pill{border-radius:var(--snice-border-radius-pill,9999px)}.button--circle{border-radius:var(--snice-border-radius-circle,50%);width:var(--size);padding:0}.button--small.button--circle{--size:1.875rem}.button--medium.button--circle{--size:2.5rem}.button--large.button--circle{--size:3.125rem}.button--loading{position:relative;cursor:wait}.button--loading .label{visibility:hidden}.spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:1em;height:1em}.button--loading .spinner{display:block}.spinner::after{content:'';display:block;width:100%;height:100%;box-sizing:border-box;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:.6s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.icon-slot{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:1.25em;height:1.25em;line-height:1;transform:translateY(1px)}.icon-slot:empty{display:none}.icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:1.25em;height:1.25em;line-height:1}.icon img{width:100%;height:100%;object-fit:contain}.icon svg{width:100%;height:100%}.icon-slot ::slotted(*){display:flex;align-items:center;justify-content:center;width:1.25em;height:1.25em;font-size:1.25em;line-height:1}.icon-slot ::slotted(svg){width:1.25em;height:1.25em}.icon-slot ::slotted(img){width:1.25em;height:1.25em;object-fit:contain}.button--icon-start .icon,.button--icon-start .icon-slot{margin-right:.5em}.button--icon-end .icon,.button--icon-end .icon-slot{margin-left:.5em}.button--circle .icon,.button--circle .icon-slot{margin:0;transform:none;width:auto;height:auto}.button--circle .icon-slot ::slotted(*){width:auto;height:auto;font-size:1.25em;line-height:1;display:flex;align-items:center;justify-content:center}"}`}setLoading(e){this.loading=e}setDisabled(e){this.disabled=e}setVariant(e){this.variant=e}focus(e){this.button?.focus(e)}blur(){this.button?.blur()}click(){this.button?.click()}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C=[t.element("snice-checkbox")],E=[],D=HTMLElement,z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[],G=[],J=[],X=[],Q=[],Z=[],ee=[],te=[];(class extends D{static{s=this}static{const ie="function"==typeof Symbol&&Symbol.metadata?Object.create(D[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean})],l=[t.property({type:Boolean})],r=[t.property({type:Boolean})],o=[t.property({type:Boolean})],c=[t.property({type:Boolean})],d=[t.property({type:Boolean})],h=[t.property({})],u=[t.property({})],p=[t.property({})],m=[t.property({})],g=[t.query(".checkbox-input")],b=[t.query(".checkbox")],v=[t.query(".checkbox-label")],y=[t.query(".checkbox-wrapper")],f=[t.on("click")],w=[t.render()],k=[t.watch("checked")],x=[t.watch("indeterminate")],S=[t.styles()],i(this,null,f,{kind:"method",name:"handleCheckboxClick",static:!1,private:!1,access:{has:e=>"handleCheckboxClick"in e,get:e=>e.handleCheckboxClick},metadata:ie},null,z),i(this,null,w,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:ie},null,z),i(this,null,k,{kind:"method",name:"handleCheckedChange",static:!1,private:!1,access:{has:e=>"handleCheckedChange"in e,get:e=>e.handleCheckedChange},metadata:ie},null,z),i(this,null,x,{kind:"method",name:"handleIndeterminateChange",static:!1,private:!1,access:{has:e=>"handleIndeterminateChange"in e,get:e=>e.handleIndeterminateChange},metadata:ie},null,z),i(this,null,S,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:ie},null,z),i(null,null,n,{kind:"field",name:"checked",static:!1,private:!1,access:{has:e=>"checked"in e,get:e=>e.checked,set:(e,t)=>{e.checked=t}},metadata:ie},A,$),i(null,null,l,{kind:"field",name:"indeterminate",static:!1,private:!1,access:{has:e=>"indeterminate"in e,get:e=>e.indeterminate,set:(e,t)=>{e.indeterminate=t}},metadata:ie},F,T),i(null,null,r,{kind:"field",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:ie},L,M),i(null,null,o,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:ie},R,B),i(null,null,c,{kind:"field",name:"required",static:!1,private:!1,access:{has:e=>"required"in e,get:e=>e.required,set:(e,t)=>{e.required=t}},metadata:ie},j,I),i(null,null,d,{kind:"field",name:"invalid",static:!1,private:!1,access:{has:e=>"invalid"in e,get:e=>e.invalid,set:(e,t)=>{e.invalid=t}},metadata:ie},O,P),i(null,null,h,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:ie},V,H),i(null,null,u,{kind:"field",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:ie},N,q),i(null,null,p,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:ie},_,W),i(null,null,m,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:ie},K,Y),i(null,null,g,{kind:"field",name:"input",static:!1,private:!1,access:{has:e=>"input"in e,get:e=>e.input,set:(e,t)=>{e.input=t}},metadata:ie},U,G),i(null,null,b,{kind:"field",name:"checkbox",static:!1,private:!1,access:{has:e=>"checkbox"in e,get:e=>e.checkbox,set:(e,t)=>{e.checkbox=t}},metadata:ie},J,X),i(null,null,v,{kind:"field",name:"labelElement",static:!1,private:!1,access:{has:e=>"labelElement"in e,get:e=>e.labelElement,set:(e,t)=>{e.labelElement=t}},metadata:ie},Q,Z),i(null,null,y,{kind:"field",name:"wrapper",static:!1,private:!1,access:{has:e=>"wrapper"in e,get:e=>e.wrapper,set:(e,t)=>{e.wrapper=t}},metadata:ie},ee,te),i(null,e={value:s},C,{kind:"class",name:s.name,metadata:ie},null,E),s=e.value,ie&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:ie}),a(s,E)}handleCheckboxClick(){this.disabled||this.loading||this.toggle()}render(){const e=`checkbox-wrapper${this.disabled?" checkbox-wrapper--disabled":""}${this.loading?" checkbox-wrapper--loading":""}`,i=`checkbox checkbox--${this.size}${this.invalid?" checkbox--invalid":""}${this.indeterminate?" checkbox--indeterminate":""}${this.loading?" checkbox--loading":""}`,a=`checkbox-label checkbox-label--${this.size}${this.required?" checkbox-label--required":""}`;return t.html`
|
|
224
224
|
<label class="${e}" @change="${e=>this.handleInternalChange(e)}">
|
|
225
225
|
<input
|
|
226
226
|
type="checkbox"
|
|
@@ -235,7 +235,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
235
235
|
part="input"
|
|
236
236
|
/>
|
|
237
237
|
|
|
238
|
-
<span class="${
|
|
238
|
+
<span class="${i}" part="checkbox">
|
|
239
239
|
<if ${!this.loading}>
|
|
240
240
|
<svg class="checkbox-icon checkbox-icon--check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
|
|
241
241
|
<polyline points="20 6 9 17 4 12"></polyline>
|
|
@@ -251,21 +251,21 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
251
251
|
</span>
|
|
252
252
|
|
|
253
253
|
<if ${this.label}>
|
|
254
|
-
<span class="${
|
|
254
|
+
<span class="${a}" part="label">
|
|
255
255
|
${this.label}
|
|
256
256
|
</span>
|
|
257
257
|
</if>
|
|
258
258
|
</label>
|
|
259
|
-
`}handleInternalChange(e){const t=e.target;"checkbox"===t.type&&(this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new CustomEvent("checkbox-change",{bubbles:!0,composed:!0,detail:{checked:this.checked,indeterminate:this.indeterminate,checkbox:this}})))}handleCheckedChange(){this.input&&(this.input.checked=this.checked)}handleIndeterminateChange(){this.input&&(this.input.indeterminate=this.indeterminate)}styles(){return t.css`${":host{display:inline-flex;align-items:center;align-self:flex-end;min-height:2.5rem;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif)}:host([size=small]){min-height:2rem;align-self:center}:host([compact]){min-height:0;align-self:center}.checkbox-wrapper{display:inline-flex;align-items:center;position:relative;cursor:pointer;user-select:none;min-height:1.25rem}.checkbox-wrapper--disabled{cursor:not-allowed;opacity:.6}.checkbox-input{position:absolute;opacity:0;left:0;top:0;width:100%;height:100%;margin:0;cursor:pointer;z-index:1;pointer-events:all}.checkbox{position:relative;display:inline-flex;align-items:center;justify-content:center;background:var(--snice-color-background-input,rgb(248 247 245));border:2px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-sm,.125rem);transition:all var(--snice-transition-fast, 150ms) ease}.checkbox--small{width:1rem;height:1rem}.checkbox--medium{width:1.25rem;height:1.25rem}.checkbox--large{width:1.5rem;height:1.5rem}.checkbox-input:checked~.checkbox{background:var(--snice-color-primary,rgb(37 99 235));border-color:var(--snice-color-primary,rgb(37 99 235))}.checkbox-input:focus-visible~.checkbox{box-shadow:0 0 0 3px var(--snice-focus-ring-color,rgb(59 130 246 / .5));outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px}.checkbox-input:disabled~.checkbox{background:var(--snice-color-background-secondary,rgb(250 250 250));border-color:var(--snice-color-border,rgb(226 226 226))}.checkbox-input:disabled:checked~.checkbox{background:var(--snice-color-text-secondary,rgb(82 82 82));border-color:var(--snice-color-text-secondary,rgb(82 82 82))}.checkbox--invalid{border-color:var(--snice-color-danger,rgb(220 38 38))}.checkbox-input:checked~.checkbox--invalid{background:var(--snice-color-danger,rgb(220 38 38));border-color:var(--snice-color-danger,rgb(220 38 38))}.checkbox-icon{position:absolute;display:none;color:var(--snice-color-text-inverse,rgb(250 250 250))}.checkbox-input:checked~.checkbox .checkbox-icon--check{display:block}.checkbox--indeterminate .checkbox-icon--check{display:none!important}.checkbox--indeterminate .checkbox-icon--indeterminate{display:block!important}.checkbox--small .checkbox-icon{width:.75rem;height:.75rem}.checkbox--medium .checkbox-icon{width:.875rem;height:.875rem}.checkbox--large .checkbox-icon{width:1.125rem;height:1.125rem}.checkbox-label{margin-left:.5rem;color:var(--snice-color-text,rgb(23 23 23));cursor:pointer}.checkbox-label--small{font-size:var(--snice-font-size-sm, .875rem)}.checkbox-label--medium{font-size:var(--snice-font-size-md, 1rem)}.checkbox-label--large{font-size:var(--snice-font-size-lg, 1.125rem)}.checkbox-wrapper--disabled .checkbox-label{color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:not-allowed}.checkbox-label--required::after{content:' *';color:var(--snice-color-danger,rgb(220 38 38))}.checkbox-wrapper:not(.checkbox-wrapper--disabled):hover .checkbox{border-color:var(--snice-color-primary,rgb(37 99 235))}.checkbox-wrapper:not(.checkbox-wrapper--disabled):hover .checkbox-input:checked~.checkbox{background:var(--snice-color-primary-hover,rgb(29 78 216));border-color:var(--snice-color-primary-hover,rgb(29 78 216))}.checkbox-wrapper--loading{cursor:wait;opacity:.7}.checkbox--loading{cursor:wait}.checkbox-spinner{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;pointer-events:none}.checkbox-spinner::after{content:'';display:block;width:.75em;height:.75em;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:.6s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}"}`}focus(){this.input?.focus()}blur(){this.input?.blur()}click(){this.input?.click()}toggle(){this.checked=!this.checked,this.indeterminate=!1,this.dispatchEvent(new CustomEvent("checkbox-change",{bubbles:!0,composed:!0,detail:{checked:this.checked,indeterminate:this.indeterminate,checkbox:this}}))}setIndeterminate(){this.indeterminate=!0,this.checked=!1,this.dispatchEvent(new CustomEvent("checkbox-change",{bubbles:!0,composed:!0,detail:{checked:this.checked,indeterminate:this.indeterminate,checkbox:this}}))}constructor(){super(...arguments),this.checked=(i(this,z),i(this,A,!1)),this.indeterminate=(i(this,$),i(this,F,!1)),this.disabled=(i(this,T),i(this,L,!1)),this.loading=(i(this,M),i(this,R,!1)),this.required=(i(this,B),i(this,j,!1)),this.invalid=(i(this,I),i(this,O,!1)),this.size=(i(this,P),i(this,V,"medium")),this.name=(i(this,H),i(this,N,"")),this.value=(i(this,q),i(this,_,"on")),this.label=(i(this,W),i(this,K,"")),this.input=(i(this,Y),i(this,U,void 0)),this.checkbox=(i(this,G),i(this,J,void 0)),this.labelElement=(i(this,X),i(this,Q,void 0)),this.wrapper=(i(this,Z),i(this,ee,void 0)),i(this,te)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S=[t.element("snice-modal")],C=[],E=HTMLElement,D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[],G=[],J=[];(class extends E{static{s=this}constructor(){super(...arguments),this.open=(i(this,D),i(this,z,!1)),this.size=(i(this,A),i(this,$,"medium")),this.noBackdropDismiss=(i(this,F),i(this,T,!1)),this.noEscapeDismiss=(i(this,L),i(this,M,!1)),this.noFocusTrap=(i(this,R),i(this,B,!1)),this.noCloseButton=(i(this,j),i(this,I,!1)),this.noHeader=(i(this,O),i(this,P,!1)),this.noFooter=(i(this,V),i(this,H,!1)),this.label=(i(this,N),i(this,q,"")),this.modal=(i(this,_),i(this,W,void 0)),this.panel=(i(this,K),i(this,Y,void 0)),this.backdrop=(i(this,U),i(this,G,void 0)),this.previousFocus=(i(this,J),null)}static{const X="function"==typeof Symbol&&Symbol.metadata?Object.create(E[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean})],l=[t.property({})],r=[t.property({type:Boolean,attribute:"no-backdrop-dismiss"})],o=[t.property({type:Boolean,attribute:"no-escape-dismiss"})],c=[t.property({type:Boolean,attribute:"no-focus-trap"})],d=[t.property({type:Boolean,attribute:"no-close-button"})],h=[t.property({type:Boolean,attribute:"no-header"})],u=[t.property({type:Boolean,attribute:"no-footer"})],p=[t.property({})],m=[t.query(".modal")],g=[t.query(".modal__panel")],b=[t.query(".modal__backdrop")],v=[t.render()],y=[t.styles()],f=[t.ready()],w=[t.watch("open")],k=[t.dispatch("modal-open",{bubbles:!0,composed:!0})],x=[t.dispatch("modal-close",{bubbles:!0,composed:!0})],a(this,null,v,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:X},null,D),a(this,null,y,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:X},null,D),a(this,null,f,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:X},null,D),a(this,null,w,{kind:"method",name:"handleOpenChange",static:!1,private:!1,access:{has:e=>"handleOpenChange"in e,get:e=>e.handleOpenChange},metadata:X},null,D),a(this,null,k,{kind:"method",name:"dispatchOpenEvent",static:!1,private:!1,access:{has:e=>"dispatchOpenEvent"in e,get:e=>e.dispatchOpenEvent},metadata:X},null,D),a(this,null,x,{kind:"method",name:"dispatchCloseEvent",static:!1,private:!1,access:{has:e=>"dispatchCloseEvent"in e,get:e=>e.dispatchCloseEvent},metadata:X},null,D),a(null,null,n,{kind:"field",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:X},z,A),a(null,null,l,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:X},$,F),a(null,null,r,{kind:"field",name:"noBackdropDismiss",static:!1,private:!1,access:{has:e=>"noBackdropDismiss"in e,get:e=>e.noBackdropDismiss,set:(e,t)=>{e.noBackdropDismiss=t}},metadata:X},T,L),a(null,null,o,{kind:"field",name:"noEscapeDismiss",static:!1,private:!1,access:{has:e=>"noEscapeDismiss"in e,get:e=>e.noEscapeDismiss,set:(e,t)=>{e.noEscapeDismiss=t}},metadata:X},M,R),a(null,null,c,{kind:"field",name:"noFocusTrap",static:!1,private:!1,access:{has:e=>"noFocusTrap"in e,get:e=>e.noFocusTrap,set:(e,t)=>{e.noFocusTrap=t}},metadata:X},B,j),a(null,null,d,{kind:"field",name:"noCloseButton",static:!1,private:!1,access:{has:e=>"noCloseButton"in e,get:e=>e.noCloseButton,set:(e,t)=>{e.noCloseButton=t}},metadata:X},I,O),a(null,null,h,{kind:"field",name:"noHeader",static:!1,private:!1,access:{has:e=>"noHeader"in e,get:e=>e.noHeader,set:(e,t)=>{e.noHeader=t}},metadata:X},P,V),a(null,null,u,{kind:"field",name:"noFooter",static:!1,private:!1,access:{has:e=>"noFooter"in e,get:e=>e.noFooter,set:(e,t)=>{e.noFooter=t}},metadata:X},H,N),a(null,null,p,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:X},q,_),a(null,null,m,{kind:"field",name:"modal",static:!1,private:!1,access:{has:e=>"modal"in e,get:e=>e.modal,set:(e,t)=>{e.modal=t}},metadata:X},W,K),a(null,null,g,{kind:"field",name:"panel",static:!1,private:!1,access:{has:e=>"panel"in e,get:e=>e.panel,set:(e,t)=>{e.panel=t}},metadata:X},Y,U),a(null,null,b,{kind:"field",name:"backdrop",static:!1,private:!1,access:{has:e=>"backdrop"in e,get:e=>e.backdrop,set:(e,t)=>{e.backdrop=t}},metadata:X},G,J),a(null,e={value:s},S,{kind:"class",name:s.name,metadata:X},null,C),s=e.value,X&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:X}),i(s,C)}render(){const e="modal"+(this.open?" modal--open":""),a=`modal__panel modal__panel--${this.size}`,i=this.open?"false":"true";return t.html`
|
|
259
|
+
`}handleInternalChange(e){const t=e.target;"checkbox"===t.type&&(this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new CustomEvent("checkbox-change",{bubbles:!0,composed:!0,detail:{checked:this.checked,indeterminate:this.indeterminate,checkbox:this}})))}handleCheckedChange(){this.input&&(this.input.checked=this.checked)}handleIndeterminateChange(){this.input&&(this.input.indeterminate=this.indeterminate)}styles(){return t.css`${":host{display:inline-flex;align-items:center;align-self:flex-end;min-height:2.5rem;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif)}:host([size=small]){min-height:2rem;align-self:center}:host([compact]){min-height:0;align-self:center}.checkbox-wrapper{display:inline-flex;align-items:center;position:relative;cursor:pointer;user-select:none;min-height:1.25rem}.checkbox-wrapper--disabled{cursor:not-allowed;opacity:.6}.checkbox-input{position:absolute;opacity:0;left:0;top:0;width:100%;height:100%;margin:0;cursor:pointer;z-index:1;pointer-events:all}.checkbox{position:relative;display:inline-flex;align-items:center;justify-content:center;background:var(--snice-color-background-input,rgb(248 247 245));border:2px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-sm,.125rem);transition:all var(--snice-transition-fast, 150ms) ease}.checkbox--small{width:1rem;height:1rem}.checkbox--medium{width:1.25rem;height:1.25rem}.checkbox--large{width:1.5rem;height:1.5rem}.checkbox-input:checked~.checkbox{background:var(--snice-color-primary,rgb(37 99 235));border-color:var(--snice-color-primary,rgb(37 99 235))}.checkbox-input:focus-visible~.checkbox{box-shadow:0 0 0 3px var(--snice-focus-ring-color,rgb(59 130 246 / .5));outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px}.checkbox-input:disabled~.checkbox{background:var(--snice-color-background-secondary,rgb(250 250 250));border-color:var(--snice-color-border,rgb(226 226 226))}.checkbox-input:disabled:checked~.checkbox{background:var(--snice-color-text-secondary,rgb(82 82 82));border-color:var(--snice-color-text-secondary,rgb(82 82 82))}.checkbox--invalid{border-color:var(--snice-color-danger,rgb(220 38 38))}.checkbox-input:checked~.checkbox--invalid{background:var(--snice-color-danger,rgb(220 38 38));border-color:var(--snice-color-danger,rgb(220 38 38))}.checkbox-icon{position:absolute;display:none;color:var(--snice-color-text-inverse,rgb(250 250 250))}.checkbox-input:checked~.checkbox .checkbox-icon--check{display:block}.checkbox--indeterminate .checkbox-icon--check{display:none!important}.checkbox--indeterminate .checkbox-icon--indeterminate{display:block!important}.checkbox--small .checkbox-icon{width:.75rem;height:.75rem}.checkbox--medium .checkbox-icon{width:.875rem;height:.875rem}.checkbox--large .checkbox-icon{width:1.125rem;height:1.125rem}.checkbox-label{margin-left:.5rem;color:var(--snice-color-text,rgb(23 23 23));cursor:pointer}.checkbox-label--small{font-size:var(--snice-font-size-sm, .875rem)}.checkbox-label--medium{font-size:var(--snice-font-size-md, 1rem)}.checkbox-label--large{font-size:var(--snice-font-size-lg, 1.125rem)}.checkbox-wrapper--disabled .checkbox-label{color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:not-allowed}.checkbox-label--required::after{content:' *';color:var(--snice-color-danger,rgb(220 38 38))}.checkbox-wrapper:not(.checkbox-wrapper--disabled):hover .checkbox{border-color:var(--snice-color-primary,rgb(37 99 235))}.checkbox-wrapper:not(.checkbox-wrapper--disabled):hover .checkbox-input:checked~.checkbox{background:var(--snice-color-primary-hover,rgb(29 78 216));border-color:var(--snice-color-primary-hover,rgb(29 78 216))}.checkbox-wrapper--loading{cursor:wait;opacity:.7}.checkbox--loading{cursor:wait}.checkbox-spinner{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;pointer-events:none}.checkbox-spinner::after{content:'';display:block;width:.75em;height:.75em;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:.6s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}"}`}focus(){this.input?.focus()}blur(){this.input?.blur()}click(){this.input?.click()}toggle(){this.checked=!this.checked,this.indeterminate=!1,this.dispatchEvent(new CustomEvent("checkbox-change",{bubbles:!0,composed:!0,detail:{checked:this.checked,indeterminate:this.indeterminate,checkbox:this}}))}setIndeterminate(){this.indeterminate=!0,this.checked=!1,this.dispatchEvent(new CustomEvent("checkbox-change",{bubbles:!0,composed:!0,detail:{checked:this.checked,indeterminate:this.indeterminate,checkbox:this}}))}constructor(){super(...arguments),this.checked=(a(this,z),a(this,A,!1)),this.indeterminate=(a(this,$),a(this,F,!1)),this.disabled=(a(this,T),a(this,L,!1)),this.loading=(a(this,M),a(this,R,!1)),this.required=(a(this,B),a(this,j,!1)),this.invalid=(a(this,I),a(this,O,!1)),this.size=(a(this,P),a(this,V,"medium")),this.name=(a(this,H),a(this,N,"")),this.value=(a(this,q),a(this,_,"on")),this.label=(a(this,W),a(this,K,"")),this.input=(a(this,Y),a(this,U,void 0)),this.checkbox=(a(this,G),a(this,J,void 0)),this.labelElement=(a(this,X),a(this,Q,void 0)),this.wrapper=(a(this,Z),a(this,ee,void 0)),a(this,te)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S=[t.element("snice-modal")],C=[],E=HTMLElement,D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[],G=[],J=[];(class extends E{static{s=this}constructor(){super(...arguments),this.open=(a(this,D),a(this,z,!1)),this.size=(a(this,A),a(this,$,"medium")),this.noBackdropDismiss=(a(this,F),a(this,T,!1)),this.noEscapeDismiss=(a(this,L),a(this,M,!1)),this.noFocusTrap=(a(this,R),a(this,B,!1)),this.noCloseButton=(a(this,j),a(this,I,!1)),this.noHeader=(a(this,O),a(this,P,!1)),this.noFooter=(a(this,V),a(this,H,!1)),this.label=(a(this,N),a(this,q,"")),this.modal=(a(this,_),a(this,W,void 0)),this.panel=(a(this,K),a(this,Y,void 0)),this.backdrop=(a(this,U),a(this,G,void 0)),this.previousFocus=(a(this,J),null)}static{const X="function"==typeof Symbol&&Symbol.metadata?Object.create(E[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean})],l=[t.property({})],r=[t.property({type:Boolean,attribute:"no-backdrop-dismiss"})],o=[t.property({type:Boolean,attribute:"no-escape-dismiss"})],c=[t.property({type:Boolean,attribute:"no-focus-trap"})],d=[t.property({type:Boolean,attribute:"no-close-button"})],h=[t.property({type:Boolean,attribute:"no-header"})],u=[t.property({type:Boolean,attribute:"no-footer"})],p=[t.property({})],m=[t.query(".modal")],g=[t.query(".modal__panel")],b=[t.query(".modal__backdrop")],v=[t.render()],y=[t.styles()],f=[t.ready()],w=[t.watch("open")],k=[t.dispatch("modal-open",{bubbles:!0,composed:!0})],x=[t.dispatch("modal-close",{bubbles:!0,composed:!0})],i(this,null,v,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:X},null,D),i(this,null,y,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:X},null,D),i(this,null,f,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:X},null,D),i(this,null,w,{kind:"method",name:"handleOpenChange",static:!1,private:!1,access:{has:e=>"handleOpenChange"in e,get:e=>e.handleOpenChange},metadata:X},null,D),i(this,null,k,{kind:"method",name:"dispatchOpenEvent",static:!1,private:!1,access:{has:e=>"dispatchOpenEvent"in e,get:e=>e.dispatchOpenEvent},metadata:X},null,D),i(this,null,x,{kind:"method",name:"dispatchCloseEvent",static:!1,private:!1,access:{has:e=>"dispatchCloseEvent"in e,get:e=>e.dispatchCloseEvent},metadata:X},null,D),i(null,null,n,{kind:"field",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:X},z,A),i(null,null,l,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:X},$,F),i(null,null,r,{kind:"field",name:"noBackdropDismiss",static:!1,private:!1,access:{has:e=>"noBackdropDismiss"in e,get:e=>e.noBackdropDismiss,set:(e,t)=>{e.noBackdropDismiss=t}},metadata:X},T,L),i(null,null,o,{kind:"field",name:"noEscapeDismiss",static:!1,private:!1,access:{has:e=>"noEscapeDismiss"in e,get:e=>e.noEscapeDismiss,set:(e,t)=>{e.noEscapeDismiss=t}},metadata:X},M,R),i(null,null,c,{kind:"field",name:"noFocusTrap",static:!1,private:!1,access:{has:e=>"noFocusTrap"in e,get:e=>e.noFocusTrap,set:(e,t)=>{e.noFocusTrap=t}},metadata:X},B,j),i(null,null,d,{kind:"field",name:"noCloseButton",static:!1,private:!1,access:{has:e=>"noCloseButton"in e,get:e=>e.noCloseButton,set:(e,t)=>{e.noCloseButton=t}},metadata:X},I,O),i(null,null,h,{kind:"field",name:"noHeader",static:!1,private:!1,access:{has:e=>"noHeader"in e,get:e=>e.noHeader,set:(e,t)=>{e.noHeader=t}},metadata:X},P,V),i(null,null,u,{kind:"field",name:"noFooter",static:!1,private:!1,access:{has:e=>"noFooter"in e,get:e=>e.noFooter,set:(e,t)=>{e.noFooter=t}},metadata:X},H,N),i(null,null,p,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:X},q,_),i(null,null,m,{kind:"field",name:"modal",static:!1,private:!1,access:{has:e=>"modal"in e,get:e=>e.modal,set:(e,t)=>{e.modal=t}},metadata:X},W,K),i(null,null,g,{kind:"field",name:"panel",static:!1,private:!1,access:{has:e=>"panel"in e,get:e=>e.panel,set:(e,t)=>{e.panel=t}},metadata:X},Y,U),i(null,null,b,{kind:"field",name:"backdrop",static:!1,private:!1,access:{has:e=>"backdrop"in e,get:e=>e.backdrop,set:(e,t)=>{e.backdrop=t}},metadata:X},G,J),i(null,e={value:s},S,{kind:"class",name:s.name,metadata:X},null,C),s=e.value,X&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:X}),a(s,C)}render(){const e="modal"+(this.open?" modal--open":""),i=`modal__panel modal__panel--${this.size}`,a=this.open?"false":"true";return t.html`
|
|
260
260
|
<div class="${e}"
|
|
261
261
|
role="dialog"
|
|
262
262
|
aria-modal="true"
|
|
263
263
|
aria-label="${this.label}"
|
|
264
|
-
aria-hidden="${
|
|
264
|
+
aria-hidden="${a}"
|
|
265
265
|
@click=${this.handleBackdropClick}
|
|
266
266
|
@keydown=${this.handleKeydown}>
|
|
267
267
|
<div class="modal__backdrop" part="backdrop"></div>
|
|
268
|
-
<div class="${
|
|
268
|
+
<div class="${i}" part="panel">
|
|
269
269
|
<if ${!this.noHeader}>
|
|
270
270
|
<div class="modal__header" part="header">
|
|
271
271
|
<slot name="header"></slot>
|
|
@@ -291,7 +291,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
291
291
|
</if>
|
|
292
292
|
</div>
|
|
293
293
|
</div>
|
|
294
|
-
`}styles(){return t.css`${":host{--modal-z-index:1000;--modal-backdrop-bg:var(--snice-modal-backdrop, rgb(0 0 0 / 0.5));--modal-panel-bg:var(--snice-color-background, rgb(255 255 255));--modal-panel-shadow:var(--snice-shadow-2xl, 0 25px 50px -12px rgb(0 0 0 / 0.25));--modal-border-radius:var(--snice-border-radius-lg, 8px);--modal-padding:var(--snice-spacing-lg, 1.5rem);--modal-transition-duration:200ms}.modal{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--modal-z-index);display:flex;align-items:center;justify-content:center;padding:var(--modal-padding);pointer-events:none;opacity:0;visibility:hidden}.modal--open{pointer-events:auto;opacity:1;visibility:visible}.modal__backdrop{position:absolute;top:0;left:0;right:0;bottom:0;background:var(--modal-backdrop-bg);opacity:0;transition:opacity var(--modal-transition-duration) ease}.modal--open .modal__backdrop{opacity:1}.modal__panel{position:relative;background:var(--modal-panel-bg);border-radius:var(--modal-border-radius);box-shadow:var(--modal-panel-shadow);display:flex;flex-direction:column;max-height:calc(100vh - 2 * var(--modal-padding));opacity:0;transform:scale(.95) translateY(1.25rem);transition:opacity var(--modal-transition-duration) ease,transform var(--modal-transition-duration) ease;z-index:1}.modal--open .modal__panel{opacity:1;transform:scale(1) translateY(0)}.modal__panel--small{width:100%;max-width:25rem}.modal__panel--medium{width:100%;max-width:37.5rem}.modal__panel--large{width:100%;max-width:56.25rem}.modal__panel--fullscreen{width:calc(100vw - 2 * var(--modal-padding));height:calc(100vh - 2 * var(--modal-padding));max-width:none}.modal__header{display:flex;align-items:center;justify-content:space-between;padding:var(--modal-padding);border-bottom:1px solid var(--snice-color-border,rgb(226 226 226))}.modal__header:empty{display:none}::slotted([slot=header]){flex:1;margin:0;font-size:var(--snice-font-size-lg, 1.125rem);font-weight:600;color:var(--snice-color-text,rgb(23 23 23))}.modal__close{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;margin-left:auto;background:0 0;border:none;border-radius:var(--snice-border-radius-md,6px);color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:pointer;transition:background-color var(--snice-transition-fast, 150ms) ease,color var(--snice-transition-fast, 150ms) ease}.modal__close:hover{background:var(--snice-color-background-hover,rgb(241 241 241));color:var(--snice-color-text,rgb(23 23 23))}.modal__close:focus-visible{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px}.modal__body{flex:1;padding:var(--modal-padding);overflow-y:auto;color:var(--snice-color-text,rgb(23 23 23))}.modal__footer{display:flex;align-items:center;justify-content:flex-end;gap:var(--snice-spacing-sm,.5rem);padding:var(--modal-padding);border-top:1px solid var(--snice-color-border,rgb(226 226 226))}.modal__footer:empty{display:none}.modal__header:empty+.modal__body{padding-top:var(--modal-padding)}.modal__body:has(+ .modal__footer:empty){padding-bottom:var(--modal-padding)}@keyframes slideUp{from{opacity:0;transform:translateY(6.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}@media (max-width:640px){.modal{padding:0}.modal__panel:not(.modal__panel--fullscreen){width:100%;height:100%;max-width:none;max-height:none;border-radius:0}}"}`}init(){this.open&&this.showModal()}handleOpenChange(){this.open?this.showModal():this.hideModal()}handleBackdropClick(e){e.target.classList.contains("modal__backdrop")&&(this.noBackdropDismiss||this.close())}handleCloseClick(e){e.stopPropagation(),this.close()}handleKeydown(e){this.open&&("Escape"!==e.key||this.noEscapeDismiss||(e.stopPropagation(),this.close()),"Tab"!==e.key||this.noFocusTrap||this.trapFocus(e))}showModal(){this.previousFocus=document.activeElement,document.body.style.overflow="hidden",requestAnimationFrame(()=>{const e=this.panel?.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');e?e.focus():this.panel?.focus()}),this.dispatchOpenEvent()}hideModal(){document.body.style.overflow="",this.previousFocus&&(this.previousFocus.focus(),this.previousFocus=null),this.dispatchCloseEvent()}trapFocus(e){if(!this.panel)return;const t=this.panel.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),
|
|
294
|
+
`}styles(){return t.css`${":host{--modal-z-index:1000;--modal-backdrop-bg:var(--snice-modal-backdrop, rgb(0 0 0 / 0.5));--modal-panel-bg:var(--snice-color-background, rgb(255 255 255));--modal-panel-shadow:var(--snice-shadow-2xl, 0 25px 50px -12px rgb(0 0 0 / 0.25));--modal-border-radius:var(--snice-border-radius-lg, 8px);--modal-padding:var(--snice-spacing-lg, 1.5rem);--modal-transition-duration:200ms}.modal{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--modal-z-index);display:flex;align-items:center;justify-content:center;padding:var(--modal-padding);pointer-events:none;opacity:0;visibility:hidden}.modal--open{pointer-events:auto;opacity:1;visibility:visible}.modal__backdrop{position:absolute;top:0;left:0;right:0;bottom:0;background:var(--modal-backdrop-bg);opacity:0;transition:opacity var(--modal-transition-duration) ease}.modal--open .modal__backdrop{opacity:1}.modal__panel{position:relative;background:var(--modal-panel-bg);border-radius:var(--modal-border-radius);box-shadow:var(--modal-panel-shadow);display:flex;flex-direction:column;max-height:calc(100vh - 2 * var(--modal-padding));opacity:0;transform:scale(.95) translateY(1.25rem);transition:opacity var(--modal-transition-duration) ease,transform var(--modal-transition-duration) ease;z-index:1}.modal--open .modal__panel{opacity:1;transform:scale(1) translateY(0)}.modal__panel--small{width:100%;max-width:25rem}.modal__panel--medium{width:100%;max-width:37.5rem}.modal__panel--large{width:100%;max-width:56.25rem}.modal__panel--fullscreen{width:calc(100vw - 2 * var(--modal-padding));height:calc(100vh - 2 * var(--modal-padding));max-width:none}.modal__header{display:flex;align-items:center;justify-content:space-between;padding:var(--modal-padding);border-bottom:1px solid var(--snice-color-border,rgb(226 226 226))}.modal__header:empty{display:none}::slotted([slot=header]){flex:1;margin:0;font-size:var(--snice-font-size-lg, 1.125rem);font-weight:600;color:var(--snice-color-text,rgb(23 23 23))}.modal__close{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;margin-left:auto;background:0 0;border:none;border-radius:var(--snice-border-radius-md,6px);color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:pointer;transition:background-color var(--snice-transition-fast, 150ms) ease,color var(--snice-transition-fast, 150ms) ease}.modal__close:hover{background:var(--snice-color-background-hover,rgb(241 241 241));color:var(--snice-color-text,rgb(23 23 23))}.modal__close:focus-visible{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px}.modal__body{flex:1;padding:var(--modal-padding);overflow-y:auto;color:var(--snice-color-text,rgb(23 23 23))}.modal__footer{display:flex;align-items:center;justify-content:flex-end;gap:var(--snice-spacing-sm,.5rem);padding:var(--modal-padding);border-top:1px solid var(--snice-color-border,rgb(226 226 226))}.modal__footer:empty{display:none}.modal__header:empty+.modal__body{padding-top:var(--modal-padding)}.modal__body:has(+ .modal__footer:empty){padding-bottom:var(--modal-padding)}@keyframes slideUp{from{opacity:0;transform:translateY(6.25rem)}to{opacity:1;transform:translateY(0)}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}@media (max-width:640px){.modal{padding:0}.modal__panel:not(.modal__panel--fullscreen){width:100%;height:100%;max-width:none;max-height:none;border-radius:0}}"}`}init(){this.open&&this.showModal()}handleOpenChange(){this.open?this.showModal():this.hideModal()}handleBackdropClick(e){e.target.classList.contains("modal__backdrop")&&(this.noBackdropDismiss||this.close())}handleCloseClick(e){e.stopPropagation(),this.close()}handleKeydown(e){this.open&&("Escape"!==e.key||this.noEscapeDismiss||(e.stopPropagation(),this.close()),"Tab"!==e.key||this.noFocusTrap||this.trapFocus(e))}showModal(){this.previousFocus=document.activeElement,document.body.style.overflow="hidden",requestAnimationFrame(()=>{const e=this.panel?.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');e?e.focus():this.panel?.focus()}),this.dispatchOpenEvent()}hideModal(){document.body.style.overflow="",this.previousFocus&&(this.previousFocus.focus(),this.previousFocus=null),this.dispatchCloseEvent()}trapFocus(e){if(!this.panel)return;const t=this.panel.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),i=Array.from(t),a=i[0],s=i[i.length-1];e.shiftKey?document.activeElement===a&&(s?.focus(),e.preventDefault()):document.activeElement===s&&(a?.focus(),e.preventDefault())}dispatchOpenEvent(){return{modal:this}}dispatchCloseEvent(){return{modal:this}}show(){this.open=!0}close(){this.open=!1}})})();(()=>{let e,n,l,r,o,c,d,h,u,p,m,g=[t.element("snice-empty-state")],b=[],v=HTMLElement,y=[],f=[],w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[];(class extends v{static{n=this}static{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(v[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({})],d=[t.property({attribute:"action-text"})],h=[t.property({attribute:"action-href"})],u=[t.render()],p=[t.styles()],m=[t.dispatch("empty-state-action",{bubbles:!0,composed:!0})],i(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:s},null,y),i(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:s},null,y),i(this,null,m,{kind:"method",name:"dispatchActionEvent",static:!1,private:!1,access:{has:e=>"dispatchActionEvent"in e,get:e=>e.dispatchActionEvent},metadata:s},null,y),i(null,null,l,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:s},f,w),i(null,null,r,{kind:"field",name:"icon",static:!1,private:!1,access:{has:e=>"icon"in e,get:e=>e.icon,set:(e,t)=>{e.icon=t}},metadata:s},k,x),i(null,null,o,{kind:"field",name:"title",static:!1,private:!1,access:{has:e=>"title"in e,get:e=>e.title,set:(e,t)=>{e.title=t}},metadata:s},S,C),i(null,null,c,{kind:"field",name:"description",static:!1,private:!1,access:{has:e=>"description"in e,get:e=>e.description,set:(e,t)=>{e.description=t}},metadata:s},E,D),i(null,null,d,{kind:"field",name:"actionText",static:!1,private:!1,access:{has:e=>"actionText"in e,get:e=>e.actionText,set:(e,t)=>{e.actionText=t}},metadata:s},z,A),i(null,null,h,{kind:"field",name:"actionHref",static:!1,private:!1,access:{has:e=>"actionHref"in e,get:e=>e.actionHref,set:(e,t)=>{e.actionHref=t}},metadata:s},$,F),i(null,e={value:n},g,{kind:"class",name:n.name,metadata:s},null,b),n=e.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),a(n,b)}render(){const e=["empty-state",`empty-state--${this.size}`].filter(Boolean).join(" ");return t.html`
|
|
295
295
|
<div class="${e}" part="container">
|
|
296
296
|
<div class="empty-state__icon-wrapper" part="icon">
|
|
297
297
|
<slot name="icon">
|
|
@@ -324,28 +324,28 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
324
324
|
</if>
|
|
325
325
|
<slot></slot>
|
|
326
326
|
</div>
|
|
327
|
-
`}styles(){return t.css`${":host{display:block;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif)}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:var(--snice-spacing-2xl,3rem) var(--snice-spacing-xl,2rem);color:var(--snice-color-text-secondary,rgb(82 82 82))}.empty-state--small{padding:var(--snice-spacing-xl,2rem) var(--snice-spacing-lg,1.5rem)}.empty-state--medium{padding:var(--snice-spacing-2xl,3rem) var(--snice-spacing-xl,2rem)}.empty-state--large{padding:var(--snice-spacing-3xl,4rem) var(--snice-spacing-2xl,2.5rem)}.empty-state__icon-wrapper{display:flex;align-items:center;justify-content:center;margin-bottom:var(--snice-spacing-lg,1.5rem)}.empty-state__icon{font-size:var(--snice-font-size-4xl, 4rem);opacity:.5;line-height:1}.empty-state__icon-wrapper ::slotted(*){display:flex;align-items:center;justify-content:center;font-size:var(--snice-font-size-4xl, 4rem);opacity:.5;line-height:1}.empty-state__icon-wrapper ::slotted(svg){width:var(--snice-font-size-4xl,4rem);height:var(--snice-font-size-4xl,4rem)}.empty-state__icon-wrapper ::slotted(img){width:var(--snice-font-size-4xl,4rem);height:var(--snice-font-size-4xl,4rem);object-fit:contain}.empty-state--small .empty-state__icon-wrapper{margin-bottom:var(--snice-spacing-md,1rem)}.empty-state--small .empty-state__icon{font-size:var(--snice-font-size-3xl, 3rem)}.empty-state--small .empty-state__icon-wrapper ::slotted(*){font-size:var(--snice-font-size-3xl, 3rem)}.empty-state--small .empty-state__icon-wrapper ::slotted(img),.empty-state--small .empty-state__icon-wrapper ::slotted(svg){width:var(--snice-font-size-3xl,3rem);height:var(--snice-font-size-3xl,3rem)}.empty-state--large .empty-state__icon-wrapper{margin-bottom:var(--snice-spacing-xl,2rem)}.empty-state--large .empty-state__icon{font-size:var(--snice-font-size-5xl, 5rem)}.empty-state--large .empty-state__icon-wrapper ::slotted(*){font-size:var(--snice-font-size-5xl, 5rem)}.empty-state--large .empty-state__icon-wrapper ::slotted(img),.empty-state--large .empty-state__icon-wrapper ::slotted(svg){width:var(--snice-font-size-5xl,5rem);height:var(--snice-font-size-5xl,5rem)}.empty-state__title{font-size:var(--snice-font-size-xl, 1.25rem);font-weight:var(--snice-font-weight-semibold,600);color:var(--snice-color-text,rgb(23 23 23));margin:0 0 var(--snice-spacing-xs,.5rem) 0}.empty-state--small .empty-state__title{font-size:var(--snice-font-size-lg, 1.125rem);margin-bottom:var(--snice-spacing-2xs,.375rem)}.empty-state--large .empty-state__title{font-size:var(--snice-font-size-2xl, 1.5rem);margin-bottom:var(--snice-spacing-sm,.75rem)}.empty-state__description{font-size:var(--snice-font-size-sm, .875rem);color:var(--snice-color-text-secondary,rgb(82 82 82));margin:0 0 var(--snice-spacing-lg,1.5rem) 0;max-width:32rem;line-height:var(--snice-line-height-normal, 1.5)}.empty-state--small .empty-state__description{font-size:var(--snice-font-size-xs, .8125rem);margin-bottom:var(--snice-spacing-md,1rem)}.empty-state--large .empty-state__description{font-size:var(--snice-font-size-md, 1rem);margin-bottom:var(--snice-spacing-xl,2rem)}.empty-state__action{display:inline-flex;align-items:center;justify-content:center;padding:var(--snice-spacing-xs,.5rem) var(--snice-spacing-md,1rem);font-size:var(--snice-font-size-sm, .875rem);font-weight:var(--snice-font-weight-medium,500);color:var(--snice-color-text-inverse,rgb(250 250 250));background:var(--snice-color-primary,rgb(37 99 235));border:none;border-radius:var(--snice-border-radius-md,.375rem);text-decoration:none;cursor:pointer;transition:background var(--snice-transition-fast, 150ms)}.empty-state__action:hover{background:var(--snice-color-primary-dark,rgb(29 78 216))}.empty-state--small .empty-state__action{padding:var(--snice-spacing-2xs,.375rem) var(--snice-spacing-sm,.75rem);font-size:var(--snice-font-size-xs, .8125rem)}.empty-state--large .empty-state__action{padding:var(--snice-spacing-sm,.625rem) var(--snice-spacing-lg,1.25rem);font-size:var(--snice-font-size-md, 1rem)}::slotted(*){margin-top:var(--snice-spacing-md,1rem)}"}`}handleActionClick(e){this.actionHref||e.preventDefault(),this.dispatchActionEvent()}dispatchActionEvent(){return{emptyState:this}}constructor(){super(...arguments),this.size=(i(this,y),i(this,f,"medium")),this.icon=(i(this,w),i(this,k,"📭")),this.title=(i(this,x),i(this,S,"No data")),this.description=(i(this,C),i(this,E,"")),this.actionText=(i(this,D),i(this,z,"")),this.actionHref=(i(this,A),i(this,$,"")),i(this,F)}})})();var n=":host{display:flex;align-items:center;padding:0 var(--snice-table-cell-padding,var(--snice-spacing-md,.75rem));min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem;color:var(--snice-color-text,rgb(23 23 23))}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;word-wrap:break-word}:host([align=left]){text-align:left}:host([align=center]){text-align:center}:host([align=right]){text-align:right}:host([type=accounting]),:host([type=currency]),:host([type=fraction]),:host([type=number]),:host([type=percent]),:host([type=scientific]){font-variant-numeric:tabular-nums;text-align:right}:host([type=date]){font-variant-numeric:tabular-nums}:host([type=boolean]){text-align:center;font-size:1rem}.boolean--true{color:var(--snice-color-success,rgb(22 163 74))}.boolean--false{color:var(--snice-color-danger,rgb(220 38 38))}:host([type=rating]){text-align:center}:host([type=sparkline]){text-align:center}.cell-content--text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell-content--text[data-multiline=true]{white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word}.cell-content--date,.cell-content--number{font-feature-settings:'tnum'}:host([type=boolean]) .cell-content{display:inline-flex;align-items:center;justify-content:center}:host([type=rating]) .cell-content{display:inline-flex;align-items:center;justify-content:center;gap:.125rem}.cell-content--progress{width:100%;min-width:4rem}.cell-content--sparkline{display:flex;align-items:center;justify-content:center;min-width:3rem}:host(.positive){color:var(--snice-color-success,rgb(22 163 74))}:host(.negative){color:var(--snice-color-danger,rgb(220 38 38))}:host(.warning){color:var(--snice-color-warning,rgb(234 179 8));background-color:rgb(254 249 195 / .3)}:host(.danger){color:var(--snice-color-danger,rgb(220 38 38));background-color:rgb(254 226 226 / .3)}:host(.success){color:var(--snice-color-success,rgb(22 163 74));background-color:rgb(220 252 231 / .3)}:host(.info){color:var(--snice-color-primary,rgb(37 99 235));background-color:rgb(219 234 254 / .3)}:host(.date--today){font-weight:var(--snice-font-weight-semibold,600);color:var(--snice-color-primary,rgb(37 99 235))}:host(.date--past){color:var(--snice-color-text-secondary,rgb(82 82 82))}:host(.date--future){color:var(--snice-color-success,rgb(22 163 74))}:host(.number--negative.number--negative-red){color:var(--snice-color-danger,rgb(220 38 38))}:host(.number--positive.number--highlighted){color:var(--snice-color-success,rgb(22 163 74));font-weight:var(--snice-font-weight-semibold,600)}:host(.number--zero){color:var(--snice-color-text-secondary,rgb(82 82 82))}:host([truncate]) .cell-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([wrap]) .cell-content{white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word}:host(:not([value])) .cell-content,:host([value=\"\"]) .cell-content{color:var(--snice-color-text-secondary,rgb(82 82 82))}:host(.loading){position:relative;overflow:hidden}:host(.loading) .cell-content{opacity:.6}:host(.loading)::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent,var(--snice-color-background,rgb(255 255 255 / .6)),transparent);animation:1.5s infinite cell-shimmer}@keyframes cell-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}:host(:focus-within){outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:-2px}.cell-content button,.cell-content input,.cell-content select{font-size:inherit;line-height:inherit}.cell-content a{color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none}.cell-content a:hover{text-decoration:underline}@media (max-width:768px){:host{font-size:.75rem;line-height:1rem}:host([type=boolean]){font-size:.875rem}}@media (prefers-reduced-motion:reduce){:host(.loading)::after{animation:none}}@media (prefers-contrast:high){:host(.positive){background-color:rgb(220 252 231 / .3)}:host(.negative){background-color:rgb(254 226 226 / .3)}.cell-content a{text-decoration:underline}}@media print{:host{font-size:.75rem}:host(.loading)::after{display:none}.cell-content a{text-decoration:underline}}";(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v=[t.element("snice-cell")],y=[],f=HTMLElement,w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[];(class extends f{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property()],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.render()],p=[t.styles()],m=[t.ready()],g=[t.watch("align")],b=[t.watch("value","column")],a(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,w),a(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,w),a(this,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,w),a(this,null,g,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,w),a(this,null,b,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,w),a(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},k,x),a(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},S,C),a(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},E,D),a(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},z,A),a(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},$,F),a(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},T,L),a(null,e={value:s},v,{kind:"class",name:s.name,metadata:n},null,y),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),i(s,y)}render(){return t.html`
|
|
327
|
+
`}styles(){return t.css`${":host{display:block;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif)}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:var(--snice-spacing-2xl,3rem) var(--snice-spacing-xl,2rem);color:var(--snice-color-text-secondary,rgb(82 82 82))}.empty-state--small{padding:var(--snice-spacing-xl,2rem) var(--snice-spacing-lg,1.5rem)}.empty-state--medium{padding:var(--snice-spacing-2xl,3rem) var(--snice-spacing-xl,2rem)}.empty-state--large{padding:var(--snice-spacing-3xl,4rem) var(--snice-spacing-2xl,2.5rem)}.empty-state__icon-wrapper{display:flex;align-items:center;justify-content:center;margin-bottom:var(--snice-spacing-lg,1.5rem)}.empty-state__icon{font-size:var(--snice-font-size-4xl, 4rem);opacity:.5;line-height:1}.empty-state__icon-wrapper ::slotted(*){display:flex;align-items:center;justify-content:center;font-size:var(--snice-font-size-4xl, 4rem);opacity:.5;line-height:1}.empty-state__icon-wrapper ::slotted(svg){width:var(--snice-font-size-4xl,4rem);height:var(--snice-font-size-4xl,4rem)}.empty-state__icon-wrapper ::slotted(img){width:var(--snice-font-size-4xl,4rem);height:var(--snice-font-size-4xl,4rem);object-fit:contain}.empty-state--small .empty-state__icon-wrapper{margin-bottom:var(--snice-spacing-md,1rem)}.empty-state--small .empty-state__icon{font-size:var(--snice-font-size-3xl, 3rem)}.empty-state--small .empty-state__icon-wrapper ::slotted(*){font-size:var(--snice-font-size-3xl, 3rem)}.empty-state--small .empty-state__icon-wrapper ::slotted(img),.empty-state--small .empty-state__icon-wrapper ::slotted(svg){width:var(--snice-font-size-3xl,3rem);height:var(--snice-font-size-3xl,3rem)}.empty-state--large .empty-state__icon-wrapper{margin-bottom:var(--snice-spacing-xl,2rem)}.empty-state--large .empty-state__icon{font-size:var(--snice-font-size-5xl, 5rem)}.empty-state--large .empty-state__icon-wrapper ::slotted(*){font-size:var(--snice-font-size-5xl, 5rem)}.empty-state--large .empty-state__icon-wrapper ::slotted(img),.empty-state--large .empty-state__icon-wrapper ::slotted(svg){width:var(--snice-font-size-5xl,5rem);height:var(--snice-font-size-5xl,5rem)}.empty-state__title{font-size:var(--snice-font-size-xl, 1.25rem);font-weight:var(--snice-font-weight-semibold,600);color:var(--snice-color-text,rgb(23 23 23));margin:0 0 var(--snice-spacing-xs,.5rem) 0}.empty-state--small .empty-state__title{font-size:var(--snice-font-size-lg, 1.125rem);margin-bottom:var(--snice-spacing-2xs,.375rem)}.empty-state--large .empty-state__title{font-size:var(--snice-font-size-2xl, 1.5rem);margin-bottom:var(--snice-spacing-sm,.75rem)}.empty-state__description{font-size:var(--snice-font-size-sm, .875rem);color:var(--snice-color-text-secondary,rgb(82 82 82));margin:0 0 var(--snice-spacing-lg,1.5rem) 0;max-width:32rem;line-height:var(--snice-line-height-normal, 1.5)}.empty-state--small .empty-state__description{font-size:var(--snice-font-size-xs, .8125rem);margin-bottom:var(--snice-spacing-md,1rem)}.empty-state--large .empty-state__description{font-size:var(--snice-font-size-md, 1rem);margin-bottom:var(--snice-spacing-xl,2rem)}.empty-state__action{display:inline-flex;align-items:center;justify-content:center;padding:var(--snice-spacing-xs,.5rem) var(--snice-spacing-md,1rem);font-size:var(--snice-font-size-sm, .875rem);font-weight:var(--snice-font-weight-medium,500);color:var(--snice-color-text-inverse,rgb(250 250 250));background:var(--snice-color-primary,rgb(37 99 235));border:none;border-radius:var(--snice-border-radius-md,.375rem);text-decoration:none;cursor:pointer;transition:background var(--snice-transition-fast, 150ms)}.empty-state__action:hover{background:var(--snice-color-primary-dark,rgb(29 78 216))}.empty-state--small .empty-state__action{padding:var(--snice-spacing-2xs,.375rem) var(--snice-spacing-sm,.75rem);font-size:var(--snice-font-size-xs, .8125rem)}.empty-state--large .empty-state__action{padding:var(--snice-spacing-sm,.625rem) var(--snice-spacing-lg,1.25rem);font-size:var(--snice-font-size-md, 1rem)}::slotted(*){margin-top:var(--snice-spacing-md,1rem)}"}`}handleActionClick(e){this.actionHref||e.preventDefault(),this.dispatchActionEvent()}dispatchActionEvent(){return{emptyState:this}}constructor(){super(...arguments),this.size=(a(this,y),a(this,f,"medium")),this.icon=(a(this,w),a(this,k,"📭")),this.title=(a(this,x),a(this,S,"No data")),this.description=(a(this,C),a(this,E,"")),this.actionText=(a(this,D),a(this,z,"")),this.actionHref=(a(this,A),a(this,$,"")),a(this,F)}})})();var n=":host{display:flex;align-items:center;padding:0 var(--snice-table-cell-padding,var(--snice-spacing-md,.75rem));min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem;color:var(--snice-color-text,rgb(23 23 23))}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;word-wrap:break-word}:host([align=left]){text-align:left}:host([align=center]){text-align:center}:host([align=right]){text-align:right}:host([type=accounting]),:host([type=currency]),:host([type=fraction]),:host([type=number]),:host([type=percent]),:host([type=scientific]){font-variant-numeric:tabular-nums;text-align:right}:host([type=date]){font-variant-numeric:tabular-nums}:host([type=boolean]){text-align:center;font-size:1rem}.boolean--true{color:var(--snice-color-success,rgb(22 163 74))}.boolean--false{color:var(--snice-color-danger,rgb(220 38 38))}:host([type=rating]){text-align:center}:host([type=sparkline]){text-align:center}.cell-content--text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell-content--text[data-multiline=true]{white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word}.cell-content--date,.cell-content--number{font-feature-settings:'tnum'}:host([type=boolean]) .cell-content{display:inline-flex;align-items:center;justify-content:center}:host([type=rating]) .cell-content{display:inline-flex;align-items:center;justify-content:center;gap:.125rem}.cell-content--progress{width:100%;min-width:4rem}.cell-content--sparkline{display:flex;align-items:center;justify-content:center;min-width:3rem}:host(.positive){color:var(--snice-color-success,rgb(22 163 74))}:host(.negative){color:var(--snice-color-danger,rgb(220 38 38))}:host(.warning){color:var(--snice-color-warning,rgb(234 179 8));background-color:rgb(254 249 195 / .3)}:host(.danger){color:var(--snice-color-danger,rgb(220 38 38));background-color:rgb(254 226 226 / .3)}:host(.success){color:var(--snice-color-success,rgb(22 163 74));background-color:rgb(220 252 231 / .3)}:host(.info){color:var(--snice-color-primary,rgb(37 99 235));background-color:rgb(219 234 254 / .3)}:host(.date--today){font-weight:var(--snice-font-weight-semibold,600);color:var(--snice-color-primary,rgb(37 99 235))}:host(.date--past){color:var(--snice-color-text-secondary,rgb(82 82 82))}:host(.date--future){color:var(--snice-color-success,rgb(22 163 74))}:host(.number--negative.number--negative-red){color:var(--snice-color-danger,rgb(220 38 38))}:host(.number--positive.number--highlighted){color:var(--snice-color-success,rgb(22 163 74));font-weight:var(--snice-font-weight-semibold,600)}:host(.number--zero){color:var(--snice-color-text-secondary,rgb(82 82 82))}:host([truncate]) .cell-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([wrap]) .cell-content{white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word}:host(:not([value])) .cell-content,:host([value=\"\"]) .cell-content{color:var(--snice-color-text-secondary,rgb(82 82 82))}:host(.loading){position:relative;overflow:hidden}:host(.loading) .cell-content{opacity:.6}:host(.loading)::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent,var(--snice-color-background,rgb(255 255 255 / .6)),transparent);animation:1.5s infinite cell-shimmer}@keyframes cell-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}:host(:focus-within){outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:-2px}.cell-content button,.cell-content input,.cell-content select{font-size:inherit;line-height:inherit}.cell-content a{color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none}.cell-content a:hover{text-decoration:underline}@media (max-width:768px){:host{font-size:.75rem;line-height:1rem}:host([type=boolean]){font-size:.875rem}}@media (prefers-reduced-motion:reduce){:host(.loading)::after{animation:none}}@media (prefers-contrast:high){:host(.positive){background-color:rgb(220 252 231 / .3)}:host(.negative){background-color:rgb(254 226 226 / .3)}.cell-content a{text-decoration:underline}}@media print{:host{font-size:.75rem}:host(.loading)::after{display:none}.cell-content a{text-decoration:underline}}";(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v=[t.element("snice-cell")],y=[],f=HTMLElement,w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[];(class extends f{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property()],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.render()],p=[t.styles()],m=[t.ready()],g=[t.watch("align")],b=[t.watch("value","column")],i(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,w),i(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,w),i(this,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,w),i(this,null,g,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,w),i(this,null,b,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,w),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},k,x),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},S,C),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},E,D),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},z,A),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},$,F),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},T,L),i(null,e={value:s},v,{kind:"class",name:s.name,metadata:n},null,y),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,y)}render(){return t.html`
|
|
328
328
|
<div class="cell-content" part="content">
|
|
329
329
|
${this.formatValue()}
|
|
330
330
|
</div>
|
|
331
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment(),this.applyConditionalFormatting()}updateAlignment(){this.applyAlignment()}updateContent(){this.contentElement&&(this.contentElement.innerHTML=this.formatValue()),this.applyConditionalFormatting()}applyAlignment(){this.style.textAlign=this.align}applyConditionalFormatting(){if(this.column&&this.column.conditionalFormats){this.removeAttribute("style"),this.className="snice-cell",this.applyAlignment(),this.column.style&&this.applyStyle(this.column.style);for(const e of this.column.conditionalFormats)if(e.condition(this.value,this.rowData)){e.style&&this.applyStyle(e.style),e.className&&this.classList.add(e.className);break}}}applyStyle(e){e.backgroundColor&&(this.style.backgroundColor=e.backgroundColor),e.color&&(this.style.color=e.color),e.fontWeight&&(this.style.fontWeight=e.fontWeight),e.fontStyle&&(this.style.fontStyle=e.fontStyle),e.fontSize&&(this.style.fontSize=e.fontSize),e.textDecoration&&(this.style.textDecoration=e.textDecoration)}formatValue(){if(null===this.value||void 0===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);switch(this.type){case"text":return this.formatText();case"number":return this.formatNumber();case"currency":return this.formatCurrency();case"percent":return this.formatPercent();case"accounting":return this.formatAccounting();case"scientific":return this.formatScientific();case"fraction":return this.formatFraction();case"date":return this.formatDate();case"boolean":return this.formatBoolean();case"rating":return this.formatRating();case"progress":return this.formatProgress();case"sparkline":return this.formatSparkline();case"duration":return this.formatDuration();case"filesize":return this.formatFilesize();default:return String(this.value)}}formatText(){return String(this.value)}formatNumber(){const e=this.column.numberFormat||{},t=Number(this.value);if(isNaN(t))return String(this.value);let a=t.toFixed(e.decimals??0);if(e.thousandsSeparator){const e=a.split(".");e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),a=e.join(".")}return t<0&&"parentheses"===e.negativeStyle&&(a=`(${a.replace("-","")})`),e.prefix&&(a=e.prefix+a),e.suffix&&(a+=e.suffix),a}formatCurrency(){const e=this.column.numberFormat||{},t=Number(this.value);if(isNaN(t))return String(this.value);const a={style:"currency",currency:"USD",minimumFractionDigits:e.decimals??2,maximumFractionDigits:e.decimals??2};return new Intl.NumberFormat("en-US",a).format(t)}formatPercent(){const e=this.column.numberFormat||{},t=Number(this.value);if(isNaN(t))return String(this.value);const a={style:"percent",minimumFractionDigits:e.decimals??1,maximumFractionDigits:e.decimals??1};return new Intl.NumberFormat("en-US",a).format(t)}formatAccounting(){const e=this.column.numberFormat||{},t=Number(this.value);if(isNaN(t))return String(this.value);let a=Math.abs(t).toFixed(e.decimals??2);if(e.thousandsSeparator){const e=a.split(".");e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),a=e.join(".")}return a=t<0?`(${a})`:` ${a} `,a}formatScientific(){const e=this.column.numberFormat||{},t=Number(this.value);return isNaN(t)?String(this.value):t.toExponential(e.decimals??2)}formatFraction(){const e=Number(this.value);if(isNaN(e))return String(this.value);let t=1,a=0,i=0,s=1,n=e;do{const e=Math.floor(n);let l=t;t=e*t+a,a=l,l=i,i=e*i+s,s=l,n=1/(n-e)}while(Math.abs(e-t/i)>1e-6*e);return`${t}/${i}`}formatDate(){const e=this.column.dateFormat||{},t=new Date(this.value);if(isNaN(t.getTime()))return String(this.value);if(e.customFormat)return e.customFormat.replace("YYYY",t.getFullYear().toString()).replace("MM",(t.getMonth()+1).toString().padStart(2,"0")).replace("DD",t.getDate().toString().padStart(2,"0"));const a={};switch(e.format){case"short":default:a.dateStyle="short";break;case"medium":a.dateStyle="medium";break;case"long":a.dateStyle="long";break;case"full":a.dateStyle="full"}return new Intl.DateTimeFormat(e.locale||"en-US",a).format(t)}formatBoolean(){const e=this.column.booleanFormat||{},t=Boolean(this.value);return e.useSymbols?t?e.trueSymbol||"✓":e.falseSymbol||"✗":t?e.trueValue||"true":e.falseValue||"false"}formatRating(){const e=this.column.ratingFormat||{},t=Number(this.value),a=e.max||5,i=e.symbol||"★",s=e.emptySymbol||"☆";if(isNaN(t))return String(this.value);let n="";const l=e.color||getComputedStyle(this).getPropertyValue("--snice-color-warning").trim(),r=getComputedStyle(this).getPropertyValue("--snice-color-border").trim();for(let e=0;e<a;e++)n+=e<t?`<span style="color: ${l}">${i}</span>`:`<span style="color: ${r}">${s}</span>`;return n}formatProgress(){const e=this.column.progressFormat||{},t=Number(this.value),a=e.max||100,i=Math.min(100,Math.max(0,t/a*100));if(isNaN(t))return String(this.value);const s=e.color||getComputedStyle(this).getPropertyValue("--snice-color-primary").trim(),n=e.backgroundColor||getComputedStyle(this).getPropertyValue("--snice-color-border").trim();let l=`\n <div style="\n width: 100%; \n height: ${e.height||"1rem"}; \n background-color: ${n}; \n border-radius: 0.25rem; \n overflow: hidden;\n position: relative;\n ">\n <div style="\n width: ${i}%; \n height: 100%; \n background-color: ${s}; \n transition: width 0.3s ease;\n "></div>\n `;if(e.showPercentage){l+=`\n <span style="\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-size: 0.75rem;\n font-weight: bold;\n color: ${i>50?getComputedStyle(this).getPropertyValue("--snice-color-text-inverse").trim():getComputedStyle(this).getPropertyValue("--snice-color-text").trim()};\n ">${Math.round(i)}%</span>\n `}return l+="</div>",l}formatSparkline(){const e=this.column.sparklineFormat||{},t=Array.isArray(this.value)?this.value:[];if(0===t.length)return"";const a=e.width||60,i=e.height||20,s=e.color||getComputedStyle(this).getPropertyValue("--snice-color-primary").trim(),n=e.type||"line",l=Math.max(...t),r=Math.min(...t),o=l-r||1;if("line"===n){const e=t.map((e,s)=>`${s/(t.length-1)*a},${i-(e-r)/o*i}`).join(" ");return`\n <svg width="${a}" height="${i}" style="display: block;">\n <polyline \n points="${e}" \n fill="none" \n stroke="${s}" \n stroke-width="2"\n />\n </svg>\n `}if("bar"===n){const e=a/t.length,n=t.map((t,a)=>{const n=(t-r)/o*i;return`<rect x="${a*e}" y="${i-n}" width="${e-1}" height="${n}" fill="${s}" />`}).join("");return`\n <svg width="${a}" height="${i}" style="display: block;">\n ${n}\n </svg>\n `}return String(this.value)}formatDuration(){const e=Number(this.value);if(isNaN(e))return String(this.value);const t=Math.floor(e/3600),a=Math.floor(e%3600/60),i=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`:`${a}:${i.toString().padStart(2,"0")}`}formatFilesize(){const e=Number(this.value);if(isNaN(e))return String(this.value);const t=["B","KB","MB","GB","TB"];let a=e,i=0;for(;a>=1024&&i<t.length-1;)a/=1024,i++;return`${a.toFixed(0===i?0:1)} ${t[i]}`}constructor(){super(...arguments),this.align=(i(this,w),i(this,k,"left")),this.type=(i(this,x),i(this,S,"text")),this.value=(i(this,C),i(this,E,"")),this.column=(i(this,D),i(this,z,{key:"",label:"",type:"text",align:"left"})),this.rowData=(i(this,A),i(this,$,null)),this.contentElement=(i(this,F),i(this,T,void 0)),i(this,L)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v,y,f=[t.element("snice-cell-text")],w=[],k=HTMLElement,x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[];(class extends k{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(k[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.property({type:Boolean})],p=[t.property({type:Number,attribute:"max-lines"})],m=[t.render()],g=[t.styles()],b=[t.ready()],v=[t.watch("align")],y=[t.watch("value","column")],a(this,null,m,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,x),a(this,null,g,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,x),a(this,null,b,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,x),a(this,null,v,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,x),a(this,null,y,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,x),a(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},S,C),a(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},E,D),a(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},z,A),a(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},$,F),a(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},T,L),a(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},M,R),a(null,null,u,{kind:"field",name:"multiline",static:!1,private:!1,access:{has:e=>"multiline"in e,get:e=>e.multiline,set:(e,t)=>{e.multiline=t}},metadata:n},B,j),a(null,null,p,{kind:"field",name:"maxLines",static:!1,private:!1,access:{has:e=>"maxLines"in e,get:e=>e.maxLines,set:(e,t)=>{e.maxLines=t}},metadata:n},I,O),a(null,e={value:s},f,{kind:"class",name:s.name,metadata:n},null,w),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),i(s,w)}render(){const e=this.formatTextContent(),a=this.getTextStyles();return t.html`
|
|
332
|
-
<div class="cell-content cell-content--text" part="content" style="${
|
|
331
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment(),this.applyConditionalFormatting()}updateAlignment(){this.applyAlignment()}updateContent(){this.contentElement&&(this.contentElement.innerHTML=this.formatValue()),this.applyConditionalFormatting()}applyAlignment(){this.style.textAlign=this.align}applyConditionalFormatting(){if(this.column&&this.column.conditionalFormats){this.removeAttribute("style"),this.className="snice-cell",this.applyAlignment(),this.column.style&&this.applyStyle(this.column.style);for(const e of this.column.conditionalFormats)if(e.condition(this.value,this.rowData)){e.style&&this.applyStyle(e.style),e.className&&this.classList.add(e.className);break}}}applyStyle(e){e.backgroundColor&&(this.style.backgroundColor=e.backgroundColor),e.color&&(this.style.color=e.color),e.fontWeight&&(this.style.fontWeight=e.fontWeight),e.fontStyle&&(this.style.fontStyle=e.fontStyle),e.fontSize&&(this.style.fontSize=e.fontSize),e.textDecoration&&(this.style.textDecoration=e.textDecoration)}formatValue(){if(null===this.value||void 0===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);switch(this.type){case"text":return this.formatText();case"number":return this.formatNumber();case"currency":return this.formatCurrency();case"percent":return this.formatPercent();case"accounting":return this.formatAccounting();case"scientific":return this.formatScientific();case"fraction":return this.formatFraction();case"date":return this.formatDate();case"boolean":return this.formatBoolean();case"rating":return this.formatRating();case"progress":return this.formatProgress();case"sparkline":return this.formatSparkline();case"duration":return this.formatDuration();case"filesize":return this.formatFilesize();default:return String(this.value)}}formatText(){return String(this.value)}formatNumber(){const e=this.column.numberFormat||{},t=Number(this.value);if(isNaN(t))return String(this.value);let i=t.toFixed(e.decimals??0);if(e.thousandsSeparator){const e=i.split(".");e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),i=e.join(".")}return t<0&&"parentheses"===e.negativeStyle&&(i=`(${i.replace("-","")})`),e.prefix&&(i=e.prefix+i),e.suffix&&(i+=e.suffix),i}formatCurrency(){const e=this.column.numberFormat||{},t=Number(this.value);if(isNaN(t))return String(this.value);const i={style:"currency",currency:"USD",minimumFractionDigits:e.decimals??2,maximumFractionDigits:e.decimals??2};return new Intl.NumberFormat("en-US",i).format(t)}formatPercent(){const e=this.column.numberFormat||{},t=Number(this.value);if(isNaN(t))return String(this.value);const i={style:"percent",minimumFractionDigits:e.decimals??1,maximumFractionDigits:e.decimals??1};return new Intl.NumberFormat("en-US",i).format(t)}formatAccounting(){const e=this.column.numberFormat||{},t=Number(this.value);if(isNaN(t))return String(this.value);let i=Math.abs(t).toFixed(e.decimals??2);if(e.thousandsSeparator){const e=i.split(".");e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),i=e.join(".")}return i=t<0?`(${i})`:` ${i} `,i}formatScientific(){const e=this.column.numberFormat||{},t=Number(this.value);return isNaN(t)?String(this.value):t.toExponential(e.decimals??2)}formatFraction(){const e=Number(this.value);if(isNaN(e))return String(this.value);let t=1,i=0,a=0,s=1,n=e;do{const e=Math.floor(n);let l=t;t=e*t+i,i=l,l=a,a=e*a+s,s=l,n=1/(n-e)}while(Math.abs(e-t/a)>1e-6*e);return`${t}/${a}`}formatDate(){const e=this.column.dateFormat||{},t=new Date(this.value);if(isNaN(t.getTime()))return String(this.value);if(e.customFormat)return e.customFormat.replace("YYYY",t.getFullYear().toString()).replace("MM",(t.getMonth()+1).toString().padStart(2,"0")).replace("DD",t.getDate().toString().padStart(2,"0"));const i={};switch(e.format){case"short":default:i.dateStyle="short";break;case"medium":i.dateStyle="medium";break;case"long":i.dateStyle="long";break;case"full":i.dateStyle="full"}return new Intl.DateTimeFormat(e.locale||"en-US",i).format(t)}formatBoolean(){const e=this.column.booleanFormat||{},t=Boolean(this.value);return e.useSymbols?t?e.trueSymbol||"✓":e.falseSymbol||"✗":t?e.trueValue||"true":e.falseValue||"false"}formatRating(){const e=this.column.ratingFormat||{},t=Number(this.value),i=e.max||5,a=e.symbol||"★",s=e.emptySymbol||"☆";if(isNaN(t))return String(this.value);let n="";const l=e.color||getComputedStyle(this).getPropertyValue("--snice-color-warning").trim(),r=getComputedStyle(this).getPropertyValue("--snice-color-border").trim();for(let e=0;e<i;e++)n+=e<t?`<span style="color: ${l}">${a}</span>`:`<span style="color: ${r}">${s}</span>`;return n}formatProgress(){const e=this.column.progressFormat||{},t=Number(this.value),i=e.max||100,a=Math.min(100,Math.max(0,t/i*100));if(isNaN(t))return String(this.value);const s=e.color||getComputedStyle(this).getPropertyValue("--snice-color-primary").trim(),n=e.backgroundColor||getComputedStyle(this).getPropertyValue("--snice-color-border").trim();let l=`\n <div style="\n width: 100%; \n height: ${e.height||"1rem"}; \n background-color: ${n}; \n border-radius: 0.25rem; \n overflow: hidden;\n position: relative;\n ">\n <div style="\n width: ${a}%; \n height: 100%; \n background-color: ${s}; \n transition: width 0.3s ease;\n "></div>\n `;if(e.showPercentage){l+=`\n <span style="\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-size: 0.75rem;\n font-weight: bold;\n color: ${a>50?getComputedStyle(this).getPropertyValue("--snice-color-text-inverse").trim():getComputedStyle(this).getPropertyValue("--snice-color-text").trim()};\n ">${Math.round(a)}%</span>\n `}return l+="</div>",l}formatSparkline(){const e=this.column.sparklineFormat||{},t=Array.isArray(this.value)?this.value:[];if(0===t.length)return"";const i=e.width||60,a=e.height||20,s=e.color||getComputedStyle(this).getPropertyValue("--snice-color-primary").trim(),n=e.type||"line",l=Math.max(...t),r=Math.min(...t),o=l-r||1;if("line"===n){const e=t.map((e,s)=>`${s/(t.length-1)*i},${a-(e-r)/o*a}`).join(" ");return`\n <svg width="${i}" height="${a}" style="display: block;">\n <polyline \n points="${e}" \n fill="none" \n stroke="${s}" \n stroke-width="2"\n />\n </svg>\n `}if("bar"===n){const e=i/t.length,n=t.map((t,i)=>{const n=(t-r)/o*a;return`<rect x="${i*e}" y="${a-n}" width="${e-1}" height="${n}" fill="${s}" />`}).join("");return`\n <svg width="${i}" height="${a}" style="display: block;">\n ${n}\n </svg>\n `}return String(this.value)}formatDuration(){const e=Number(this.value);if(isNaN(e))return String(this.value);const t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${i.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${i}:${a.toString().padStart(2,"0")}`}formatFilesize(){const e=Number(this.value);if(isNaN(e))return String(this.value);const t=["B","KB","MB","GB","TB"];let i=e,a=0;for(;i>=1024&&a<t.length-1;)i/=1024,a++;return`${i.toFixed(0===a?0:1)} ${t[a]}`}constructor(){super(...arguments),this.align=(a(this,w),a(this,k,"left")),this.type=(a(this,x),a(this,S,"text")),this.value=(a(this,C),a(this,E,"")),this.column=(a(this,D),a(this,z,{key:"",label:"",type:"text",align:"left"})),this.rowData=(a(this,A),a(this,$,null)),this.contentElement=(a(this,F),a(this,T,void 0)),a(this,L)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v,y,f=[t.element("snice-cell-text")],w=[],k=HTMLElement,x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[];(class extends k{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(k[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.property({type:Boolean})],p=[t.property({type:Number,attribute:"max-lines"})],m=[t.render()],g=[t.styles()],b=[t.ready()],v=[t.watch("align")],y=[t.watch("value","column")],i(this,null,m,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,x),i(this,null,g,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,x),i(this,null,b,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,x),i(this,null,v,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,x),i(this,null,y,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,x),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},S,C),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},E,D),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},z,A),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},$,F),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},T,L),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},M,R),i(null,null,u,{kind:"field",name:"multiline",static:!1,private:!1,access:{has:e=>"multiline"in e,get:e=>e.multiline,set:(e,t)=>{e.multiline=t}},metadata:n},B,j),i(null,null,p,{kind:"field",name:"maxLines",static:!1,private:!1,access:{has:e=>"maxLines"in e,get:e=>e.maxLines,set:(e,t)=>{e.maxLines=t}},metadata:n},I,O),i(null,e={value:s},f,{kind:"class",name:s.name,metadata:n},null,w),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,w)}render(){const e=this.formatTextContent(),i=this.getTextStyles();return t.html`
|
|
332
|
+
<div class="cell-content cell-content--text" part="content" style="${i}">
|
|
333
333
|
${e}
|
|
334
334
|
</div>
|
|
335
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatTextContent(),t=this.getTextStyles();this.contentElement.innerHTML=e,this.contentElement.setAttribute("style",t)}}formatTextContent(){if(null===this.value||void 0===this.value)return"";let e=String(this.value);return this.column.formatter&&(e=this.column.formatter(this.value,this.rowData)),this.multiline&&(e=e.replace(/\n/g,"<br>")),!this.multiline&&this.column.ellipsis,e}getTextStyles(){let e=[];return this.multiline?(this.column.wrap&&(e.push("white-space: pre-wrap"),e.push("word-wrap: break-word")),this.maxLines&&(e.push("display: -webkit-box"),e.push("-webkit-box-orient: vertical"),e.push(`-webkit-line-clamp: ${this.maxLines}`),e.push("overflow: hidden"))):(e.push("white-space: nowrap"),this.column.ellipsis&&(e.push("overflow: hidden"),e.push("text-overflow: ellipsis"))),e.join("; ")}constructor(){super(...arguments),this.align=(
|
|
336
|
-
<div class="cell-content cell-content--number" part="content" style="${
|
|
335
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatTextContent(),t=this.getTextStyles();this.contentElement.innerHTML=e,this.contentElement.setAttribute("style",t)}}formatTextContent(){if(null===this.value||void 0===this.value)return"";let e=String(this.value);return this.column.formatter&&(e=this.column.formatter(this.value,this.rowData)),this.multiline&&(e=e.replace(/\n/g,"<br>")),!this.multiline&&this.column.ellipsis,e}getTextStyles(){let e=[];return this.multiline?(this.column.wrap&&(e.push("white-space: pre-wrap"),e.push("word-wrap: break-word")),this.maxLines&&(e.push("display: -webkit-box"),e.push("-webkit-box-orient: vertical"),e.push(`-webkit-line-clamp: ${this.maxLines}`),e.push("overflow: hidden"))):(e.push("white-space: nowrap"),this.column.ellipsis&&(e.push("overflow: hidden"),e.push("text-overflow: ellipsis"))),e.join("; ")}constructor(){super(...arguments),this.align=(a(this,x),a(this,S,"left")),this.type=(a(this,C),a(this,E,"text")),this.value=(a(this,D),a(this,z,"")),this.column=(a(this,A),a(this,$,{key:"",label:"",type:"text",align:"left"})),this.rowData=(a(this,F),a(this,T,null)),this.contentElement=(a(this,L),a(this,M,void 0)),this.multiline=(a(this,R),a(this,B,!1)),this.maxLines=(a(this,j),a(this,I,void 0)),a(this,O)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S=[t.element("snice-cell-number")],C=[],E=HTMLElement,D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[],G=[],J=[];(class extends E{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(E[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.property({type:Number})],p=[t.property({type:Boolean,attribute:"thousands-separator"})],m=[t.property({})],g=[t.property({})],b=[t.property({attribute:"negative-style"})],v=[t.property({type:Boolean})],y=[t.render()],f=[t.styles()],w=[t.ready()],k=[t.watch("align")],x=[t.watch("value","column")],i(this,null,y,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,D),i(this,null,f,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,D),i(this,null,w,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,D),i(this,null,k,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,D),i(this,null,x,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,D),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},z,A),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},$,F),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},T,L),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},M,R),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},B,j),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},I,O),i(null,null,u,{kind:"field",name:"decimals",static:!1,private:!1,access:{has:e=>"decimals"in e,get:e=>e.decimals,set:(e,t)=>{e.decimals=t}},metadata:n},P,V),i(null,null,p,{kind:"field",name:"thousandsSeparator",static:!1,private:!1,access:{has:e=>"thousandsSeparator"in e,get:e=>e.thousandsSeparator,set:(e,t)=>{e.thousandsSeparator=t}},metadata:n},H,N),i(null,null,m,{kind:"field",name:"prefix",static:!1,private:!1,access:{has:e=>"prefix"in e,get:e=>e.prefix,set:(e,t)=>{e.prefix=t}},metadata:n},q,_),i(null,null,g,{kind:"field",name:"suffix",static:!1,private:!1,access:{has:e=>"suffix"in e,get:e=>e.suffix,set:(e,t)=>{e.suffix=t}},metadata:n},W,K),i(null,null,b,{kind:"field",name:"negativeStyle",static:!1,private:!1,access:{has:e=>"negativeStyle"in e,get:e=>e.negativeStyle,set:(e,t)=>{e.negativeStyle=t}},metadata:n},Y,U),i(null,null,v,{kind:"field",name:"highlight",static:!1,private:!1,access:{has:e=>"highlight"in e,get:e=>e.highlight,set:(e,t)=>{e.highlight=t}},metadata:n},G,J),i(null,e={value:s},S,{kind:"class",name:s.name,metadata:n},null,C),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,C)}render(){const e=this.formatNumberValue(),i=this.getNumberStyles();return t.html`
|
|
336
|
+
<div class="cell-content cell-content--number" part="content" style="${i}">
|
|
337
337
|
${e}
|
|
338
338
|
</div>
|
|
339
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatNumberValue(),t=this.getNumberStyles();this.contentElement.innerHTML=e,this.contentElement.setAttribute("style",t)}}formatNumberValue(){if(null===this.value||void 0===this.value||""===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=this.column.numberFormat||{decimals:this.decimals,thousandsSeparator:this.thousandsSeparator,prefix:this.prefix,suffix:this.suffix,negativeStyle:this.negativeStyle},t=Number(this.value);if(isNaN(t))return String(this.value);let
|
|
340
|
-
<div class="cell-content cell-content--date" part="content" style="${
|
|
339
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatNumberValue(),t=this.getNumberStyles();this.contentElement.innerHTML=e,this.contentElement.setAttribute("style",t)}}formatNumberValue(){if(null===this.value||void 0===this.value||""===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=this.column.numberFormat||{decimals:this.decimals,thousandsSeparator:this.thousandsSeparator,prefix:this.prefix,suffix:this.suffix,negativeStyle:this.negativeStyle},t=Number(this.value);if(isNaN(t))return String(this.value);let i=t.toFixed(e.decimals??this.decimals);if(e.thousandsSeparator??this.thousandsSeparator){const e=i.split(".");e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),i=e.join(".")}if(t<0){const t=e.negativeStyle??this.negativeStyle;"parentheses"===t?i=`(${i.replace("-","")})`:"red"===t&&(i=i.replace("-",""))}const a=e.prefix??this.prefix,s=e.suffix??this.suffix;return a&&(i=a+i),s&&(i+=s),i}getNumberStyles(){const e=Number(this.value);if(this.classList.remove("number--negative","number--positive","number--zero","number--highlighted"),e<0){this.classList.add("number--negative");"red"===(this.column.numberFormat?.negativeStyle??this.negativeStyle)&&this.classList.add("number--negative-red")}else e>0?(this.classList.add("number--positive"),this.highlight&&this.classList.add("number--highlighted")):0===e&&this.classList.add("number--zero");return"text-align: right"}constructor(){super(...arguments),this.align=(a(this,D),a(this,z,"right")),this.type=(a(this,A),a(this,$,"number")),this.value=(a(this,F),a(this,T,"")),this.column=(a(this,L),a(this,M,{key:"",label:"",type:"number",align:"right"})),this.rowData=(a(this,R),a(this,B,null)),this.contentElement=(a(this,j),a(this,I,void 0)),this.decimals=(a(this,O),a(this,P,0)),this.thousandsSeparator=(a(this,V),a(this,H,!1)),this.prefix=(a(this,N),a(this,q,"")),this.suffix=(a(this,_),a(this,W,"")),this.negativeStyle=(a(this,K),a(this,Y,"minus")),this.highlight=(a(this,U),a(this,G,!1)),a(this,J)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x=[t.element("snice-cell-date")],S=[],C=HTMLElement,E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[];(class extends C{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(C[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.property({attribute:"date-format"})],p=[t.property({attribute:"custom-format"})],m=[t.property({})],g=[t.property({type:Boolean,attribute:"relative-time"})],b=[t.property({type:Boolean,attribute:"show-time"})],v=[t.render()],y=[t.styles()],f=[t.ready()],w=[t.watch("align")],k=[t.watch("value","column")],i(this,null,v,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,E),i(this,null,y,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,E),i(this,null,f,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,E),i(this,null,w,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,E),i(this,null,k,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,E),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},D,z),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},A,$),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},F,T),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},L,M),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},R,B),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},j,I),i(null,null,u,{kind:"field",name:"dateFormat",static:!1,private:!1,access:{has:e=>"dateFormat"in e,get:e=>e.dateFormat,set:(e,t)=>{e.dateFormat=t}},metadata:n},O,P),i(null,null,p,{kind:"field",name:"customFormat",static:!1,private:!1,access:{has:e=>"customFormat"in e,get:e=>e.customFormat,set:(e,t)=>{e.customFormat=t}},metadata:n},V,H),i(null,null,m,{kind:"field",name:"locale",static:!1,private:!1,access:{has:e=>"locale"in e,get:e=>e.locale,set:(e,t)=>{e.locale=t}},metadata:n},N,q),i(null,null,g,{kind:"field",name:"relativeTime",static:!1,private:!1,access:{has:e=>"relativeTime"in e,get:e=>e.relativeTime,set:(e,t)=>{e.relativeTime=t}},metadata:n},_,W),i(null,null,b,{kind:"field",name:"showTime",static:!1,private:!1,access:{has:e=>"showTime"in e,get:e=>e.showTime,set:(e,t)=>{e.showTime=t}},metadata:n},K,Y),i(null,e={value:s},x,{kind:"class",name:s.name,metadata:n},null,S),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,S)}render(){const e=this.formatDateValue(),i=this.getDateStyles();return t.html`
|
|
340
|
+
<div class="cell-content cell-content--date" part="content" style="${i}">
|
|
341
341
|
${e}
|
|
342
342
|
</div>
|
|
343
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatDateValue(),t=this.getDateStyles();this.contentElement.innerHTML=e,this.contentElement.setAttribute("style",t)}}formatDateValue(){if(null===this.value||void 0===this.value||""===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=new Date(this.value);if(isNaN(e.getTime()))return String(this.value);if(this.relativeTime)return this.formatRelativeTime(e);const t=this.column.dateFormat||{format:this.dateFormat,customFormat:this.customFormat,locale:this.locale};if(t.customFormat||this.customFormat)return this.formatCustomDate(e,t.customFormat||this.customFormat);const
|
|
343
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatDateValue(),t=this.getDateStyles();this.contentElement.innerHTML=e,this.contentElement.setAttribute("style",t)}}formatDateValue(){if(null===this.value||void 0===this.value||""===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=new Date(this.value);if(isNaN(e.getTime()))return String(this.value);if(this.relativeTime)return this.formatRelativeTime(e);const t=this.column.dateFormat||{format:this.dateFormat,customFormat:this.customFormat,locale:this.locale};if(t.customFormat||this.customFormat)return this.formatCustomDate(e,t.customFormat||this.customFormat);const i={};switch(t.format??this.dateFormat){case"short":i.dateStyle="short";break;case"medium":i.dateStyle="medium";break;case"long":i.dateStyle="long";break;case"full":i.dateStyle="full"}this.showTime&&(i.timeStyle="short");const a=t.locale??this.locale;return new Intl.DateTimeFormat(a,i).format(e)}formatCustomDate(e,t){const i={YYYY:e.getFullYear().toString(),YY:e.getFullYear().toString().slice(-2),MM:(e.getMonth()+1).toString().padStart(2,"0"),M:(e.getMonth()+1).toString(),DD:e.getDate().toString().padStart(2,"0"),D:e.getDate().toString(),HH:e.getHours().toString().padStart(2,"0"),H:e.getHours().toString(),mm:e.getMinutes().toString().padStart(2,"0"),m:e.getMinutes().toString(),ss:e.getSeconds().toString().padStart(2,"0"),s:e.getSeconds().toString()};let a=t;for(const[e,t]of Object.entries(i))a=a.replace(new RegExp(e,"g"),t);return a}formatRelativeTime(e){const t=(new Date).getTime()-e.getTime(),i=Math.floor(t/1e3),a=Math.floor(i/60),s=Math.floor(a/60),n=Math.floor(s/24);return i<60?"Just now":a<60?`${a} minute${1===a?"":"s"} ago`:s<24?`${s} hour${1===s?"":"s"} ago`:n<7?`${n} day${1===n?"":"s"} ago`:new Intl.DateTimeFormat(this.locale,{dateStyle:"short"}).format(e)}getDateStyles(){const e=new Date(this.value),t=new Date,i=e.toDateString()===t.toDateString(),a=e<t,s=e>t;return this.classList.remove("date--today","date--past","date--future"),i?this.classList.add("date--today"):a?this.classList.add("date--past"):s&&this.classList.add("date--future"),""}constructor(){super(...arguments),this.align=(a(this,E),a(this,D,"left")),this.type=(a(this,z),a(this,A,"date")),this.value=(a(this,$),a(this,F,"")),this.column=(a(this,T),a(this,L,{key:"",label:"",type:"date",align:"left"})),this.rowData=(a(this,M),a(this,R,null)),this.contentElement=(a(this,B),a(this,j,void 0)),this.dateFormat=(a(this,I),a(this,O,"short")),this.customFormat=(a(this,P),a(this,V,void 0)),this.locale=(a(this,H),a(this,N,"en-US")),this.relativeTime=(a(this,q),a(this,_,!1)),this.showTime=(a(this,W),a(this,K,!1)),a(this,Y)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x=[t.element("snice-cell-boolean")],S=[],C=HTMLElement,E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[];(class extends C{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(C[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.property({attribute:"true-value"})],p=[t.property({attribute:"false-value"})],m=[t.property({type:Boolean,attribute:"use-symbols"})],g=[t.property({attribute:"true-symbol"})],b=[t.property({attribute:"false-symbol"})],v=[t.render()],y=[t.styles()],f=[t.ready()],w=[t.watch("align")],k=[t.watch("value","column")],i(this,null,v,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,E),i(this,null,y,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,E),i(this,null,f,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,E),i(this,null,w,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,E),i(this,null,k,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,E),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},D,z),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},A,$),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},F,T),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},L,M),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},R,B),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},j,I),i(null,null,u,{kind:"field",name:"trueValue",static:!1,private:!1,access:{has:e=>"trueValue"in e,get:e=>e.trueValue,set:(e,t)=>{e.trueValue=t}},metadata:n},O,P),i(null,null,p,{kind:"field",name:"falseValue",static:!1,private:!1,access:{has:e=>"falseValue"in e,get:e=>e.falseValue,set:(e,t)=>{e.falseValue=t}},metadata:n},V,H),i(null,null,m,{kind:"field",name:"useSymbols",static:!1,private:!1,access:{has:e=>"useSymbols"in e,get:e=>e.useSymbols,set:(e,t)=>{e.useSymbols=t}},metadata:n},N,q),i(null,null,g,{kind:"field",name:"trueSymbol",static:!1,private:!1,access:{has:e=>"trueSymbol"in e,get:e=>e.trueSymbol,set:(e,t)=>{e.trueSymbol=t}},metadata:n},_,W),i(null,null,b,{kind:"field",name:"falseSymbol",static:!1,private:!1,access:{has:e=>"falseSymbol"in e,get:e=>e.falseSymbol,set:(e,t)=>{e.falseSymbol=t}},metadata:n},K,Y),i(null,e={value:s},x,{kind:"class",name:s.name,metadata:n},null,S),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,S)}render(){const e=this.formatBooleanContent();return t.html`
|
|
344
344
|
<div class="cell-content cell-content--boolean" part="content">
|
|
345
345
|
${t.unsafeHTML(e)}
|
|
346
346
|
</div>
|
|
347
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatBooleanContent();this.contentElement.innerHTML=e}}formatBooleanContent(){if(null===this.value||void 0===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=this.column.booleanFormat||{trueValue:this.trueValue,falseValue:this.falseValue,useSymbols:this.useSymbols,trueSymbol:this.trueSymbol,falseSymbol:this.falseSymbol},t=Boolean(this.value);if(e.useSymbols??this.useSymbols){const
|
|
348
|
-
<span class="filled">${this.symbol.repeat(e)}</span><span class="empty">${this.emptySymbol.repeat(
|
|
347
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatBooleanContent();this.contentElement.innerHTML=e}}formatBooleanContent(){if(null===this.value||void 0===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=this.column.booleanFormat||{trueValue:this.trueValue,falseValue:this.falseValue,useSymbols:this.useSymbols,trueSymbol:this.trueSymbol,falseSymbol:this.falseSymbol},t=Boolean(this.value);if(e.useSymbols??this.useSymbols){const i=e.trueSymbol??this.trueSymbol,a=e.falseSymbol??this.falseSymbol,s=t?"boolean--true":"boolean--false";if(t&&"svg"===i)return`<span class="${s}"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square"><polyline points="3.5 8.5 6.5 11.5 12.5 4.5"/></svg></span>`;if(!t&&"svg"===a)return`<span class="${s}"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square"><line x1="4" y1="4" x2="12" y2="12"/><line x1="12" y1="4" x2="4" y2="12"/></svg></span>`;return`<span class="${s}">${t?i:a}</span>`}return`<span class="${t?"boolean--true":"boolean--false"}">${t?e.trueValue??this.trueValue:e.falseValue??this.falseValue}</span>`}constructor(){super(...arguments),this.align=(a(this,E),a(this,D,"center")),this.type=(a(this,z),a(this,A,"boolean")),this.value=(a(this,$),a(this,F,!1)),this.column=(a(this,T),a(this,L,{key:"",label:"",type:"boolean",align:"center"})),this.rowData=(a(this,M),a(this,R,null)),this.contentElement=(a(this,B),a(this,j,void 0)),this.trueValue=(a(this,I),a(this,O,"true")),this.falseValue=(a(this,P),a(this,V,"false")),this.useSymbols=(a(this,H),a(this,N,!0)),this.trueSymbol=(a(this,q),a(this,_,"svg")),this.falseSymbol=(a(this,W),a(this,K,"svg")),a(this,Y)}})})(),(()=>{let e,s,n,l,r,o,c,d,h,u=[t.element("snice-rating")],p=[],m=HTMLElement,g=[],b=[],v=[],y=[],f=[],w=[],k=[],x=[],S=[],C=[],E=[];(class extends m{static{s=this}static{const D="function"==typeof Symbol&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;n=[t.property({type:Number})],l=[t.property({type:Number})],r=[t.property()],o=[t.property()],c=[t.property()],d=[t.render()],h=[t.styles()],i(this,null,d,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:D},null,g),i(this,null,h,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:D},null,g),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:D},b,v),i(null,null,l,{kind:"field",name:"max",static:!1,private:!1,access:{has:e=>"max"in e,get:e=>e.max,set:(e,t)=>{e.max=t}},metadata:D},y,f),i(null,null,r,{kind:"field",name:"symbol",static:!1,private:!1,access:{has:e=>"symbol"in e,get:e=>e.symbol,set:(e,t)=>{e.symbol=t}},metadata:D},w,k),i(null,null,o,{kind:"field",name:"emptySymbol",static:!1,private:!1,access:{has:e=>"emptySymbol"in e,get:e=>e.emptySymbol,set:(e,t)=>{e.emptySymbol=t}},metadata:D},x,S),i(null,null,c,{kind:"field",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:D},C,E),i(null,e={value:s},u,{kind:"class",name:s.name,metadata:D},null,p),s=e.value,D&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:D}),a(s,p)}render(){const e=Math.round(this.value),i=this.max-e;return t.html`
|
|
348
|
+
<span class="filled">${this.symbol.repeat(e)}</span><span class="empty">${this.emptySymbol.repeat(i)}</span>
|
|
349
349
|
`}styles(){return t.css`
|
|
350
350
|
:host {
|
|
351
351
|
display: inline-block;
|
|
@@ -359,11 +359,11 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
359
359
|
.empty {
|
|
360
360
|
color: #d1d5db;
|
|
361
361
|
}
|
|
362
|
-
`}constructor(){super(...arguments),this.value=(
|
|
362
|
+
`}constructor(){super(...arguments),this.value=(a(this,g),a(this,b,0)),this.max=(a(this,v),a(this,y,5)),this.symbol=(a(this,f),a(this,w,"★")),this.emptySymbol=(a(this,k),a(this,x,"☆")),this.color=(a(this,S),a(this,C,"#facc15")),a(this,E)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v=[t.element("snice-cell-rating")],y=[],f=HTMLElement,w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[];(class extends f{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.render()],p=[t.styles()],m=[t.ready()],g=[t.watch("align")],b=[t.watch("value","column")],i(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,w),i(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,w),i(this,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,w),i(this,null,g,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,w),i(this,null,b,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,w),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},k,x),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},S,C),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},E,D),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},z,A),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},$,F),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},T,L),i(null,e={value:s},v,{kind:"class",name:s.name,metadata:n},null,y),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,y)}render(){return t.html`
|
|
363
363
|
<div class="cell-content cell-content--rating" part="content">
|
|
364
364
|
<!-- Rating component will be created here -->
|
|
365
365
|
</div>
|
|
366
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment(),this.createRatingElement()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){this.createRatingElement()}createRatingElement(){if(!this.contentElement)return;this.contentElement.innerHTML="";const e=document.createElement("snice-rating");e.value=Number(this.value)||0;const t=this.column.ratingFormat||{};e.max=t.max??5,e.symbol=t.symbol??"★",e.emptySymbol=t.emptySymbol??"☆",e.color=t.color??getComputedStyle(this).getPropertyValue("--snice-color-warning").trim(),this.contentElement.appendChild(e)}constructor(){super(...arguments),this.align=(
|
|
366
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment(),this.createRatingElement()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){this.createRatingElement()}createRatingElement(){if(!this.contentElement)return;this.contentElement.innerHTML="";const e=document.createElement("snice-rating");e.value=Number(this.value)||0;const t=this.column.ratingFormat||{};e.max=t.max??5,e.symbol=t.symbol??"★",e.emptySymbol=t.emptySymbol??"☆",e.color=t.color??getComputedStyle(this).getPropertyValue("--snice-color-warning").trim(),this.contentElement.appendChild(e)}constructor(){super(...arguments),this.align=(a(this,w),a(this,k,"center")),this.type=(a(this,x),a(this,S,"rating")),this.value=(a(this,C),a(this,E,0)),this.column=(a(this,D),a(this,z,{key:"",label:"",type:"rating",align:"center"})),this.rowData=(a(this,A),a(this,$,null)),this.contentElement=(a(this,F),a(this,T,void 0)),a(this,L)}})})(),(()=>{let e,s,n,l,r,o,c,d,h,u,p=[t.element("snice-progress")],m=[],g=HTMLElement,b=[],v=[],y=[],f=[],w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[];(class extends g{static{s=this}static{const $="function"==typeof Symbol&&Symbol.metadata?Object.create(g[Symbol.metadata]??null):void 0;n=[t.property({type:Number})],l=[t.property({type:Number})],r=[t.property()],o=[t.property()],c=[t.property()],d=[t.property({type:Boolean})],h=[t.render()],u=[t.styles()],i(this,null,h,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:$},null,b),i(this,null,u,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:$},null,b),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:$},v,y),i(null,null,l,{kind:"field",name:"max",static:!1,private:!1,access:{has:e=>"max"in e,get:e=>e.max,set:(e,t)=>{e.max=t}},metadata:$},f,w),i(null,null,r,{kind:"field",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:$},k,x),i(null,null,o,{kind:"field",name:"backgroundColor",static:!1,private:!1,access:{has:e=>"backgroundColor"in e,get:e=>e.backgroundColor,set:(e,t)=>{e.backgroundColor=t}},metadata:$},S,C),i(null,null,c,{kind:"field",name:"height",static:!1,private:!1,access:{has:e=>"height"in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:$},E,D),i(null,null,d,{kind:"field",name:"showPercentage",static:!1,private:!1,access:{has:e=>"showPercentage"in e,get:e=>e.showPercentage,set:(e,t)=>{e.showPercentage=t}},metadata:$},z,A),i(null,e={value:s},p,{kind:"class",name:s.name,metadata:$},null,m),s=e.value,$&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:$}),a(s,m)}render(){const e=Math.min(100,this.value/this.max*100);return t.html`
|
|
367
367
|
<div class="progress-container">
|
|
368
368
|
<div class="progress-bar" style="width: ${e}%"></div>
|
|
369
369
|
</div>
|
|
@@ -397,28 +397,28 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
397
397
|
color: #6b7280;
|
|
398
398
|
min-width: 2.1875rem; /* 35px */
|
|
399
399
|
}
|
|
400
|
-
`}constructor(){super(...arguments),this.value=(
|
|
400
|
+
`}constructor(){super(...arguments),this.value=(a(this,b),a(this,v,0)),this.max=(a(this,y),a(this,f,100)),this.color=(a(this,w),a(this,k,"#3b82f6")),this.backgroundColor=(a(this,x),a(this,S,"#e5e7eb")),this.height=(a(this,C),a(this,E,"0.5rem")),this.showPercentage=(a(this,D),a(this,z,!1)),a(this,A)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v=[t.element("snice-cell-progress")],y=[],f=HTMLElement,w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[];(class extends f{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.render()],p=[t.styles()],m=[t.ready()],g=[t.watch("align")],b=[t.watch("value","column")],i(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,w),i(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,w),i(this,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,w),i(this,null,g,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,w),i(this,null,b,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,w),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},k,x),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},S,C),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},E,D),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},z,A),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},$,F),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},T,L),i(null,e={value:s},v,{kind:"class",name:s.name,metadata:n},null,y),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,y)}render(){return t.html`
|
|
401
401
|
<div class="cell-content cell-content--progress" part="content">
|
|
402
402
|
<!-- Progress component will be created here -->
|
|
403
403
|
</div>
|
|
404
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment(),this.createProgressElement()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){this.createProgressElement()}createProgressElement(){if(!this.contentElement)return;let e;this.contentElement.innerHTML="";let t=null;if(this.value&&"object"==typeof this.value)e=Number(this.value.value)||0,t=this.value.color||null;else if("string"==typeof this.value&&this.value.startsWith("{"))try{const
|
|
404
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment(),this.createProgressElement()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){this.createProgressElement()}createProgressElement(){if(!this.contentElement)return;let e;this.contentElement.innerHTML="";let t=null;if(this.value&&"object"==typeof this.value)e=Number(this.value.value)||0,t=this.value.color||null;else if("string"==typeof this.value&&this.value.startsWith("{"))try{const i=JSON.parse(this.value);e=Number(i.value)||0,t=i.color||null}catch{e=Number(this.value)||0}else e=Number(this.value)||0;const i=document.createElement("snice-progress");i.value=e;const a=this.column.progressFormat||{},s=a.max??100;if(i.max=s,i.backgroundColor=a.backgroundColor??getComputedStyle(this).getPropertyValue("--snice-color-border").trim(),i.height=a.height??"0.5rem",i.showPercentage=a.showPercentage??!1,t)i.color=t;else if(a.colorize){const t=e/s*100;i.color=t>=70?"#22c55e":t>=40?"#eab308":"#ef4444"}else i.color=a.color??getComputedStyle(this).getPropertyValue("--snice-color-primary").trim();this.contentElement.appendChild(i)}constructor(){super(...arguments),this.align=(a(this,w),a(this,k,"left")),this.type=(a(this,x),a(this,S,"progress")),this.value=(a(this,C),a(this,E,0)),this.column=(a(this,D),a(this,z,{key:"",label:"",type:"progress",align:"left"})),this.rowData=(a(this,A),a(this,$,null)),this.contentElement=(a(this,F),a(this,T,void 0)),a(this,L)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v=[t.element("snice-cell-duration")],y=[],f=HTMLElement,w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[];(class extends f{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.render()],p=[t.styles()],m=[t.ready()],g=[t.watch("align")],b=[t.watch("value","column")],i(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,w),i(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,w),i(this,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,w),i(this,null,g,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,w),i(this,null,b,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,w),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},k,x),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},S,C),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},E,D),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},z,A),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},$,F),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},T,L),i(null,e={value:s},v,{kind:"class",name:s.name,metadata:n},null,y),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,y)}render(){const e=this.formatDuration();return t.html`
|
|
405
405
|
<div class="cell-content cell-content--duration" part="content">
|
|
406
406
|
${e}
|
|
407
407
|
</div>
|
|
408
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatDuration();this.contentElement.innerHTML=e}}formatDuration(){if(null===this.value||void 0===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=Number(this.value);if(isNaN(e))return String(this.value);const t=Math.floor(e/3600),
|
|
408
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatDuration();this.contentElement.innerHTML=e}}formatDuration(){if(null===this.value||void 0===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=Number(this.value);if(isNaN(e))return String(this.value);const t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=Math.floor(e%60);return t>0?`${t}h ${i}m ${a}s`:i>0?`${i}m ${a}s`:`${a}s`}constructor(){super(...arguments),this.align=(a(this,w),a(this,k,"right")),this.type=(a(this,x),a(this,S,"duration")),this.value=(a(this,C),a(this,E,0)),this.column=(a(this,D),a(this,z,{key:"",label:"",type:"duration",align:"right"})),this.rowData=(a(this,A),a(this,$,null)),this.contentElement=(a(this,F),a(this,T,void 0)),a(this,L)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v=[t.element("snice-cell-filesize")],y=[],f=HTMLElement,w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[];(class extends f{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.render()],p=[t.styles()],m=[t.ready()],g=[t.watch("align")],b=[t.watch("value","column")],i(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,w),i(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,w),i(this,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,w),i(this,null,g,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,w),i(this,null,b,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,w),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},k,x),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},S,C),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},E,D),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},z,A),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},$,F),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},T,L),i(null,e={value:s},v,{kind:"class",name:s.name,metadata:n},null,y),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,y)}render(){const e=this.formatFileSize();return t.html`
|
|
409
409
|
<div class="cell-content cell-content--filesize" part="content">
|
|
410
410
|
${e}
|
|
411
411
|
</div>
|
|
412
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatFileSize();this.contentElement.innerHTML=e}}formatFileSize(){if(null===this.value||void 0===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=Number(this.value);if(isNaN(e))return String(this.value);const t=["B","KB","MB","GB","TB"];let
|
|
412
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatFileSize();this.contentElement.innerHTML=e}}formatFileSize(){if(null===this.value||void 0===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=Number(this.value);if(isNaN(e))return String(this.value);const t=["B","KB","MB","GB","TB"];let i=e,a=0;for(;i>=1024&&a<t.length-1;)i/=1024,a++;return`${i.toFixed(1)} ${t[a]}`}constructor(){super(...arguments),this.align=(a(this,w),a(this,k,"right")),this.type=(a(this,x),a(this,S,"filesize")),this.value=(a(this,C),a(this,E,0)),this.column=(a(this,D),a(this,z,{key:"",label:"",type:"filesize",align:"right"})),this.rowData=(a(this,A),a(this,$,null)),this.contentElement=(a(this,F),a(this,T,void 0)),a(this,L)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C,E,D,z,A=[t.element("snice-cell-sparkline")],$=[],F=HTMLElement,T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[],G=[],J=[],X=[],Q=[],Z=[],ee=[],te=[],ie=[],ae=[],se=[],ne=[],le=[],re=[],oe=[],ce=[];(class extends F{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(F[Symbol.metadata]??null):void 0;l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.property({attribute:"chart-type"})],p=[t.property({})],m=[t.property({type:Number})],g=[t.property({type:Number})],b=[t.property({type:Boolean,attribute:"show-dots"})],v=[t.property({type:Boolean,attribute:"show-baseline"})],y=[t.property({type:Number,attribute:"stroke-width"})],f=[t.property({type:Number,attribute:"min-value"})],w=[t.property({type:Number,attribute:"max-value"})],k=[t.property({type:t.SimpleArray})],x=[t.render()],S=[t.styles()],C=[t.ready()],E=[t.watch("align")],D=[t.watch("value","data","column")],z=[t.watch("value","data","chartType","color","width","height","showDots","showBaseline","strokeWidth","minValue","maxValue")],i(this,null,x,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,T),i(this,null,S,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,T),i(this,null,C,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,T),i(this,null,E,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,T),i(this,null,D,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,T),i(this,null,z,{kind:"method",name:"updateSparkline",static:!1,private:!1,access:{has:e=>"updateSparkline"in e,get:e=>e.updateSparkline},metadata:n},null,T),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},L,M),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},R,B),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},j,I),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},O,P),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},V,H),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},N,q),i(null,null,u,{kind:"field",name:"chartType",static:!1,private:!1,access:{has:e=>"chartType"in e,get:e=>e.chartType,set:(e,t)=>{e.chartType=t}},metadata:n},_,W),i(null,null,p,{kind:"field",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:n},K,Y),i(null,null,m,{kind:"field",name:"width",static:!1,private:!1,access:{has:e=>"width"in e,get:e=>e.width,set:(e,t)=>{e.width=t}},metadata:n},U,G),i(null,null,g,{kind:"field",name:"height",static:!1,private:!1,access:{has:e=>"height"in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:n},J,X),i(null,null,b,{kind:"field",name:"showDots",static:!1,private:!1,access:{has:e=>"showDots"in e,get:e=>e.showDots,set:(e,t)=>{e.showDots=t}},metadata:n},Q,Z),i(null,null,v,{kind:"field",name:"showBaseline",static:!1,private:!1,access:{has:e=>"showBaseline"in e,get:e=>e.showBaseline,set:(e,t)=>{e.showBaseline=t}},metadata:n},ee,te),i(null,null,y,{kind:"field",name:"strokeWidth",static:!1,private:!1,access:{has:e=>"strokeWidth"in e,get:e=>e.strokeWidth,set:(e,t)=>{e.strokeWidth=t}},metadata:n},ie,ae),i(null,null,f,{kind:"field",name:"minValue",static:!1,private:!1,access:{has:e=>"minValue"in e,get:e=>e.minValue,set:(e,t)=>{e.minValue=t}},metadata:n},se,ne),i(null,null,w,{kind:"field",name:"maxValue",static:!1,private:!1,access:{has:e=>"maxValue"in e,get:e=>e.maxValue,set:(e,t)=>{e.maxValue=t}},metadata:n},le,re),i(null,null,k,{kind:"field",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:n},oe,ce),i(null,e={value:s},A,{kind:"class",name:s.name,metadata:n},null,$),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,$)}render(){return t.html`
|
|
413
413
|
<div class="cell-content cell-content--sparkline" part="content">
|
|
414
414
|
${t.unsafeHTML(this.renderSparkline())}
|
|
415
415
|
</div>
|
|
416
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment(),this.updateSparkline()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){this.contentElement&&(this.contentElement.innerHTML=this.renderSparkline())}updateSparkline(){this.contentElement&&(this.contentElement.innerHTML=this.renderSparkline())}renderSparkline(){if(!(null!==this.value&&void 0!==this.value||this.data&&0!==this.data.length))return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=this.parseData();if(0===e.length)return`<span style="color: ${getComputedStyle(this).getPropertyValue("--snice-color-text-secondary").trim()}; font-style: italic;">No data</span>`;const t=this.column.sparklineFormat||{type:this.chartType,color:this.color,width:this.width,height:this.height},
|
|
417
|
-
<div class="cell-content cell-content--percentage" part="content" style="${
|
|
416
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment(),this.updateSparkline()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){this.contentElement&&(this.contentElement.innerHTML=this.renderSparkline())}updateSparkline(){this.contentElement&&(this.contentElement.innerHTML=this.renderSparkline())}renderSparkline(){if(!(null!==this.value&&void 0!==this.value||this.data&&0!==this.data.length))return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=this.parseData();if(0===e.length)return`<span style="color: ${getComputedStyle(this).getPropertyValue("--snice-color-text-secondary").trim()}; font-style: italic;">No data</span>`;const t=this.column.sparklineFormat||{type:this.chartType,color:this.color,width:this.width,height:this.height},i=t.width??this.width,a=t.height??this.height;let s=null;if(this.value&&"object"==typeof this.value&&!Array.isArray(this.value))s=this.value.color||null;else if("string"==typeof this.value&&this.value.startsWith("{"))try{s=JSON.parse(this.value).color||null}catch{}const n=s??t.color??this.color,l=t.type??this.chartType;return this.createCanvas(e,i,a,n,l)}parseData(){if(this.data&&Array.isArray(this.data)&&this.data.length>0)return this.data.map(e=>Number(e)).filter(e=>!isNaN(e));if(Array.isArray(this.value))return this.value.map(e=>Number(e)).filter(e=>!isNaN(e));if(this.value&&"object"==typeof this.value&&!Array.isArray(this.value)&&Array.isArray(this.value.values))return this.value.values.map(e=>Number(e)).filter(e=>!isNaN(e));if("string"==typeof this.value){if(this.value.startsWith("{"))try{const e=JSON.parse(this.value);if(e&&Array.isArray(e.values))return e.values.map(e=>Number(e)).filter(e=>!isNaN(e))}catch{}if(this.value.startsWith("[")&&this.value.endsWith("]"))try{const e=JSON.parse(this.value);if(Array.isArray(e))return e.map(e=>Number(e)).filter(e=>!isNaN(e))}catch{}try{return this.value.split(",").map(e=>Number(e.trim())).filter(e=>!isNaN(e))}catch{return[]}}return[]}createCanvas(e,t,i,a,s){if(0===e.length)return"";const n=document.createElement("canvas");n.width=t,n.height=i;const l=n.getContext("2d");if(!l)return'<div style="color: red;">Canvas not supported</div>';const r=t-4,o=i-4,c=this.minValue??Math.min(...e),d=(this.maxValue??Math.max(...e))-c||1;l.clearRect(0,0,t,i);let h=a;if(a.startsWith("var(")){const e=a.match(/var\(([^)]+)\)/);e&&(h=getComputedStyle(this).getPropertyValue(e[1].split(",")[0].trim()).trim()||"#3b82f6")}if(l.strokeStyle=h,l.fillStyle=h,l.lineWidth=this.strokeWidth,l.lineCap="round",l.lineJoin="round","line"===s||"area"===s){const t=e.map((t,i)=>[2+i/(e.length-1)*r,2+o-(t-c)/d*o]);"area"===s&&(l.beginPath(),l.moveTo(t[0][0],t[0][1]),t.forEach(([e,t])=>l.lineTo(e,t)),l.lineTo(t[t.length-1][0],i-2),l.lineTo(t[0][0],i-2),l.closePath(),l.globalAlpha=.3,l.fill(),l.globalAlpha=1),l.beginPath(),l.moveTo(t[0][0],t[0][1]),t.forEach(([e,t])=>l.lineTo(e,t)),l.stroke(),this.showDots&&t.forEach(([e,t])=>{l.beginPath(),l.arc(e,t,1.5,0,2*Math.PI),l.fill()})}else if("bar"===s){const t=r/e.length*.8,i=r/e.length*.2;e.forEach((e,a)=>{const s=(e-c)/d*o,n=2+a*(t+i),r=2+o-s;l.fillRect(n,r,t,s)})}try{return`<img src="${n.toDataURL("image/png")}" width="${t}" height="${i}" alt="Sparkline chart" style="display: block; vertical-align: middle;">`}catch(e){return console.error("Error creating canvas image:",e),'<div style="color: red;">Canvas error</div>'}}constructor(){super(...arguments),this.align=(a(this,T),a(this,L,"left")),this.type=(a(this,M),a(this,R,"sparkline")),this.value=(a(this,B),a(this,j,"")),this.column=(a(this,I),a(this,O,{key:"",label:"",type:"sparkline",align:"left"})),this.rowData=(a(this,P),a(this,V,null)),this.contentElement=(a(this,H),a(this,N,void 0)),this.chartType=(a(this,q),a(this,_,"line")),this.color=(a(this,W),a(this,K,"var(--snice-color-primary)")),this.width=(a(this,Y),a(this,U,80)),this.height=(a(this,G),a(this,J,24)),this.showDots=(a(this,X),a(this,Q,!1)),this.showBaseline=(a(this,Z),a(this,ee,!1)),this.strokeWidth=(a(this,te),a(this,ie,1.5)),this.minValue=(a(this,ae),a(this,se,void 0)),this.maxValue=(a(this,ne),a(this,le,void 0)),this.data=(a(this,re),a(this,oe,[])),a(this,ce)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w=[t.element("snice-cell-percentage")],k=[],x=HTMLElement,S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[];(class extends x{static{s=this}static{const _="function"==typeof Symbol&&Symbol.metadata?Object.create(x[Symbol.metadata]??null):void 0;n=[t.property({type:String})],l=[t.property({type:String})],r=[t.property({})],o=[t.property({type:Object,attribute:!1})],c=[t.property({type:Object,attribute:!1})],d=[t.query(".cell-content")],h=[t.property({type:Number})],u=[t.property({type:Boolean})],p=[t.property({type:Number})],m=[t.property({type:Boolean})],g=[t.render()],b=[t.styles()],v=[t.ready()],y=[t.watch("align")],f=[t.watch("value","column")],i(this,null,g,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:_},null,S),i(this,null,b,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:_},null,S),i(this,null,v,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:_},null,S),i(this,null,y,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:_},null,S),i(this,null,f,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:_},null,S),i(null,null,n,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:_},C,E),i(null,null,l,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:_},D,z),i(null,null,r,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:_},A,$),i(null,null,o,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:_},F,T),i(null,null,c,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:_},L,M),i(null,null,d,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:_},R,B),i(null,null,h,{kind:"field",name:"decimals",static:!1,private:!1,access:{has:e=>"decimals"in e,get:e=>e.decimals,set:(e,t)=>{e.decimals=t}},metadata:_},j,I),i(null,null,u,{kind:"field",name:"showTrend",static:!1,private:!1,access:{has:e=>"showTrend"in e,get:e=>e.showTrend,set:(e,t)=>{e.showTrend=t}},metadata:_},O,P),i(null,null,p,{kind:"field",name:"trendValue",static:!1,private:!1,access:{has:e=>"trendValue"in e,get:e=>e.trendValue,set:(e,t)=>{e.trendValue=t}},metadata:_},V,H),i(null,null,m,{kind:"field",name:"colorize",static:!1,private:!1,access:{has:e=>"colorize"in e,get:e=>e.colorize,set:(e,t)=>{e.colorize=t}},metadata:_},N,q),i(null,e={value:s},w,{kind:"class",name:s.name,metadata:_},null,k),s=e.value,_&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_}),a(s,k)}render(){const e=this.formatPercentageValue(),i=this.getTrendArrow(),a=this.getPercentageStyles();return t.html`
|
|
417
|
+
<div class="cell-content cell-content--percentage" part="content" style="${a}">
|
|
418
418
|
${e}
|
|
419
|
-
${this.showTrend&&
|
|
419
|
+
${this.showTrend&&i?t.unsafeHTML(`<span class="percentage-trend">${i}</span>`):""}
|
|
420
420
|
</div>
|
|
421
|
-
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem;font-variant-numeric:tabular-nums}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;word-wrap:break-word;display:flex;align-items:center;justify-content:flex-end;gap:.375rem}.cell-content--percentage{font-feature-settings:'tnum'}.percentage-trend{display:inline-flex;align-items:center;font-size:1rem;margin-left:.25rem}:host(.percentage--positive){color:var(--snice-color-success,rgb(22 163 74))}:host(.percentage--negative){color:var(--snice-color-danger,rgb(220 38 38))}:host(.percentage--zero){color:var(--snice-color-text-secondary,rgb(82 82 82))}:host(.percentage--trend-up) .percentage-trend{color:var(--snice-color-success,rgb(22 163 74))}:host(.percentage--trend-down) .percentage-trend{color:var(--snice-color-danger,rgb(220 38 38))}:host(.percentage--trend-neutral) .percentage-trend{color:var(--snice-color-text-secondary,rgb(82 82 82))}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.percentage-trend{font-size:.875rem}}@media print{:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem}.percentage-trend{font-size:.875rem}}"}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatPercentageValue(),t=this.getTrendArrow(),
|
|
421
|
+
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem;font-variant-numeric:tabular-nums}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;word-wrap:break-word;display:flex;align-items:center;justify-content:flex-end;gap:.375rem}.cell-content--percentage{font-feature-settings:'tnum'}.percentage-trend{display:inline-flex;align-items:center;font-size:1rem;margin-left:.25rem}:host(.percentage--positive){color:var(--snice-color-success,rgb(22 163 74))}:host(.percentage--negative){color:var(--snice-color-danger,rgb(220 38 38))}:host(.percentage--zero){color:var(--snice-color-text-secondary,rgb(82 82 82))}:host(.percentage--trend-up) .percentage-trend{color:var(--snice-color-success,rgb(22 163 74))}:host(.percentage--trend-down) .percentage-trend{color:var(--snice-color-danger,rgb(220 38 38))}:host(.percentage--trend-neutral) .percentage-trend{color:var(--snice-color-text-secondary,rgb(82 82 82))}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.percentage-trend{font-size:.875rem}}@media print{:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem}.percentage-trend{font-size:.875rem}}"}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatPercentageValue(),t=this.getTrendArrow(),i=this.getPercentageStyles(),a=this.showTrend&&t?`<span class="percentage-trend">${t}</span>`:"";this.contentElement.innerHTML=e+a,this.contentElement.setAttribute("style",i)}}formatPercentageValue(){if(null===this.value||void 0===this.value||""===this.value)return"";if(this.column?.formatter)return this.column.formatter(this.value,this.rowData);const e=this.column?.percentageFormat||{decimals:this.decimals,showTrend:this.showTrend,trendValue:this.trendValue,colorize:this.colorize},t=Number(this.value);if(isNaN(t))return String(this.value);return`${t.toFixed(e.decimals??this.decimals)}%`}getTrendArrow(){const e=this.column?.percentageFormat?.trendValue??this.trendValue;return null==e?"":e>0?"↑":e<0?"↓":"→"}getPercentageStyles(){const e=Number(this.value),t=this.column?.percentageFormat?.colorize??this.colorize;this.classList.remove("percentage--positive","percentage--negative","percentage--zero"),t&&(e>0?this.classList.add("percentage--positive"):e<0?this.classList.add("percentage--negative"):0===e&&this.classList.add("percentage--zero"));const i=this.column?.percentageFormat?.trendValue??this.trendValue;return this.classList.remove("percentage--trend-up","percentage--trend-down","percentage--trend-neutral"),null!=i&&(i>0?this.classList.add("percentage--trend-up"):i<0?this.classList.add("percentage--trend-down"):this.classList.add("percentage--trend-neutral")),"text-align: right"}constructor(){super(...arguments),this.align=(a(this,S),a(this,C,"right")),this.type=(a(this,E),a(this,D,"percentage")),this.value=(a(this,z),a(this,A,"")),this.column=(a(this,$),a(this,F,null)),this.rowData=(a(this,T),a(this,L,null)),this.contentElement=(a(this,M),a(this,R,void 0)),this.decimals=(a(this,B),a(this,j,2)),this.showTrend=(a(this,I),a(this,O,!1)),this.trendValue=(a(this,P),a(this,V,null)),this.colorize=(a(this,H),a(this,N,!0)),a(this,q)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b=[t.element("snice-cell-tag")],v=[],y=HTMLElement,f=[],w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[];(class extends y{static{s=this}static{const R="function"==typeof Symbol&&Symbol.metadata?Object.create(y[Symbol.metadata]??null):void 0;n=[t.property({type:Array,attribute:!1})],l=[t.property({type:String})],r=[t.property({type:String})],o=[t.property({type:Object,attribute:!1})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:String})],h=[t.property({type:String})],u=[t.render()],p=[t.styles()],m=[t.ready()],g=[t.watch("value","column")],i(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:R},null,f),i(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:R},null,f),i(this,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:R},null,f),i(this,null,g,{kind:"method",name:"extractTagsFromColumn",static:!1,private:!1,access:{has:e=>"extractTagsFromColumn"in e,get:e=>e.extractTagsFromColumn},metadata:R},null,f),i(null,null,n,{kind:"field",name:"tags",static:!1,private:!1,access:{has:e=>"tags"in e,get:e=>e.tags,set:(e,t)=>{e.tags=t}},metadata:R},w,k),i(null,null,l,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:R},x,S),i(null,null,r,{kind:"field",name:"variant",static:!1,private:!1,access:{has:e=>"variant"in e,get:e=>e.variant,set:(e,t)=>{e.variant=t}},metadata:R},C,E),i(null,null,o,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:R},D,z),i(null,null,c,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:R},A,$),i(null,null,d,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:R},F,T),i(null,null,h,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:R},L,M),i(null,e={value:s},b,{kind:"class",name:s.name,metadata:R},null,v),s=e.value,R&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:R}),a(s,v)}render(){const e=this.tags.length>0?this.tags:this.parseValue();return t.html`
|
|
422
422
|
<div class="cell-content cell-content--tag" part="content">
|
|
423
423
|
<div class="tags-container">
|
|
424
424
|
${e.map(e=>this.renderTag(e))}
|
|
@@ -428,12 +428,12 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
428
428
|
<span class="tag tag--${this.variant}" part="tag">
|
|
429
429
|
${e}
|
|
430
430
|
</span>
|
|
431
|
-
`}constructor(){super(...arguments),this.tags=(
|
|
431
|
+
`}constructor(){super(...arguments),this.tags=(a(this,f),a(this,w,[])),this.value=(a(this,k),a(this,x,"")),this.variant=(a(this,S),a(this,C,"default")),this.column=(a(this,E),a(this,D,null)),this.rowData=(a(this,z),a(this,A,null)),this.align=(a(this,$),a(this,F,"left")),this.type=(a(this,T),a(this,L,"tag")),a(this,M)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y=[t.element("snice-cell-status")],f=[],w=HTMLElement,k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[];(class extends w{static{s=this}static{const V="function"==typeof Symbol&&Symbol.metadata?Object.create(w[Symbol.metadata]??null):void 0;n=[t.property({type:String})],l=[t.property({type:String})],r=[t.property({type:String})],o=[t.property({type:Boolean})],c=[t.property({type:String})],d=[t.property({type:Object,attribute:!1})],h=[t.property({type:Object,attribute:!1})],u=[t.property({type:String})],p=[t.property({type:String})],m=[t.render()],g=[t.styles()],b=[t.ready()],v=[t.watch("value","column")],i(this,null,m,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:V},null,k),i(this,null,g,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:V},null,k),i(this,null,b,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:V},null,k),i(this,null,v,{kind:"method",name:"updateStatusAttributes",static:!1,private:!1,access:{has:e=>"updateStatusAttributes"in e,get:e=>e.updateStatusAttributes},metadata:V},null,k),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:V},x,S),i(null,null,l,{kind:"field",name:"status",static:!1,private:!1,access:{has:e=>"status"in e,get:e=>e.status,set:(e,t)=>{e.status=t}},metadata:V},C,E),i(null,null,r,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:V},D,z),i(null,null,o,{kind:"field",name:"showDot",static:!1,private:!1,access:{has:e=>"showDot"in e,get:e=>e.showDot,set:(e,t)=>{e.showDot=t}},metadata:V},A,$),i(null,null,c,{kind:"field",name:"variant",static:!1,private:!1,access:{has:e=>"variant"in e,get:e=>e.variant,set:(e,t)=>{e.variant=t}},metadata:V},F,T),i(null,null,d,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:V},L,M),i(null,null,h,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:V},R,B),i(null,null,u,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:V},j,I),i(null,null,p,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:V},O,P),i(null,e={value:s},y,{kind:"class",name:s.name,metadata:V},null,f),s=e.value,V&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:V}),a(s,f)}render(){const e=this.status||this.value,i=this.label||e,a=this.getStatusVariant(e),s=this.showDot?`<span class="status-dot status-dot--${a}"></span>`:"";return t.html`
|
|
432
432
|
<div class="cell-content cell-content--status" part="content">
|
|
433
433
|
${t.unsafeHTML(s)}
|
|
434
|
-
<span class="status-label status-label--${
|
|
434
|
+
<span class="status-label status-label--${a}">${i}</span>
|
|
435
435
|
</div>
|
|
436
|
-
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.5rem}.status-dot{width:.5rem;height:.5rem;border-radius:50%;flex-shrink:0;position:relative}.status-dot--online{background-color:var(--snice-color-success,rgb(22 163 74));box-shadow:0 0 0 2px rgb(22 163 74 / .2)}.status-dot--offline{background-color:rgb(156 163 175);box-shadow:0 0 0 2px rgb(107 114 128 / .2)}.status-dot--busy{background-color:var(--snice-color-danger,rgb(220 38 38));box-shadow:0 0 0 2px rgb(220 38 38 / .2)}.status-dot--away{background-color:var(--snice-color-warning,rgb(234 179 8));box-shadow:0 0 0 2px rgb(234 179 8 / .2)}.status-dot--custom{background-color:var(--snice-color-primary,rgb(37 99 235));box-shadow:0 0 0 2px rgb(37 99 235 / .2)}.status-dot--online::after{content:'';position:absolute;top:-2px;left:-2px;right:-2px;bottom:-2px;border-radius:50%;border:2px solid var(--snice-color-success,rgb(22 163 74));animation:2s ease-in-out infinite status-pulse;opacity:0}@keyframes status-pulse{0%{transform:scale(1);opacity:1}100%{transform:scale(1.5);opacity:0}}.status-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.status-label--online{color:var(--snice-color-success,rgb(22 163 74))}.status-label--offline{color:var(--snice-color-text-secondary,rgb(82 82 82))}.status-label--busy{color:var(--snice-color-danger,rgb(220 38 38))}.status-label--away{color:var(--snice-color-warning,rgb(234 179 8))}.status-label--custom{color:var(--snice-color-text,rgb(23 23 23))}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.status-dot{width:.375rem;height:.375rem}}@media (prefers-reduced-motion:reduce){.status-dot--online::after{animation:none}}@media print{.status-dot{border:1px solid var(--snice-color-text,rgb(23 23 23))}.status-dot--online{background-color:var(--snice-color-background,rgb(255 255 255));border-color:var(--snice-color-success,rgb(22 163 74))}.status-dot--offline{background-color:var(--snice-color-background,rgb(255 255 255));border-color:var(--snice-color-neutral,rgb(107 114 128))}.status-dot--busy{background-color:var(--snice-color-background,rgb(255 255 255));border-color:var(--snice-color-danger,rgb(220 38 38))}.status-dot--away{background-color:var(--snice-color-background,rgb(255 255 255));border-color:var(--snice-color-warning,rgb(234 179 8))}}"}`}init(){this.updateStatusAttributes()}updateStatusAttributes(){if(this.column?.statusFormat){const e=this.column.statusFormat;this.status=e.status||this.value,this.label=e.label||this.value,this.showDot=e.showDot??!0,this.variant=e.variant||"custom"}}getStatusVariant(e){if("custom"!==this.variant)return this.variant;const t=e.toLowerCase();return"online"===t||"active"===t||"available"===t?"online":"offline"===t||"inactive"===t||"unavailable"===t?"offline":"busy"===t||"dnd"===t||"do not disturb"===t?"busy":"away"===t||"idle"===t?"away":"custom"}constructor(){super(...arguments),this.value=(
|
|
436
|
+
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.5rem}.status-dot{width:.5rem;height:.5rem;border-radius:50%;flex-shrink:0;position:relative}.status-dot--online{background-color:var(--snice-color-success,rgb(22 163 74));box-shadow:0 0 0 2px rgb(22 163 74 / .2)}.status-dot--offline{background-color:rgb(156 163 175);box-shadow:0 0 0 2px rgb(107 114 128 / .2)}.status-dot--busy{background-color:var(--snice-color-danger,rgb(220 38 38));box-shadow:0 0 0 2px rgb(220 38 38 / .2)}.status-dot--away{background-color:var(--snice-color-warning,rgb(234 179 8));box-shadow:0 0 0 2px rgb(234 179 8 / .2)}.status-dot--custom{background-color:var(--snice-color-primary,rgb(37 99 235));box-shadow:0 0 0 2px rgb(37 99 235 / .2)}.status-dot--online::after{content:'';position:absolute;top:-2px;left:-2px;right:-2px;bottom:-2px;border-radius:50%;border:2px solid var(--snice-color-success,rgb(22 163 74));animation:2s ease-in-out infinite status-pulse;opacity:0}@keyframes status-pulse{0%{transform:scale(1);opacity:1}100%{transform:scale(1.5);opacity:0}}.status-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.status-label--online{color:var(--snice-color-success,rgb(22 163 74))}.status-label--offline{color:var(--snice-color-text-secondary,rgb(82 82 82))}.status-label--busy{color:var(--snice-color-danger,rgb(220 38 38))}.status-label--away{color:var(--snice-color-warning,rgb(234 179 8))}.status-label--custom{color:var(--snice-color-text,rgb(23 23 23))}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.status-dot{width:.375rem;height:.375rem}}@media (prefers-reduced-motion:reduce){.status-dot--online::after{animation:none}}@media print{.status-dot{border:1px solid var(--snice-color-text,rgb(23 23 23))}.status-dot--online{background-color:var(--snice-color-background,rgb(255 255 255));border-color:var(--snice-color-success,rgb(22 163 74))}.status-dot--offline{background-color:var(--snice-color-background,rgb(255 255 255));border-color:var(--snice-color-neutral,rgb(107 114 128))}.status-dot--busy{background-color:var(--snice-color-background,rgb(255 255 255));border-color:var(--snice-color-danger,rgb(220 38 38))}.status-dot--away{background-color:var(--snice-color-background,rgb(255 255 255));border-color:var(--snice-color-warning,rgb(234 179 8))}}"}`}init(){this.updateStatusAttributes()}updateStatusAttributes(){if(this.column?.statusFormat){const e=this.column.statusFormat;this.status=e.status||this.value,this.label=e.label||this.value,this.showDot=e.showDot??!0,this.variant=e.variant||"custom"}}getStatusVariant(e){if("custom"!==this.variant)return this.variant;const t=e.toLowerCase();return"online"===t||"active"===t||"available"===t?"online":"offline"===t||"inactive"===t||"unavailable"===t?"offline":"busy"===t||"dnd"===t||"do not disturb"===t?"busy":"away"===t||"idle"===t?"away":"custom"}constructor(){super(...arguments),this.value=(a(this,k),a(this,x,"")),this.status=(a(this,S),a(this,C,"")),this.label=(a(this,E),a(this,D,"")),this.showDot=(a(this,z),a(this,A,!0)),this.variant=(a(this,$),a(this,F,"custom")),this.column=(a(this,T),a(this,L,null)),this.rowData=(a(this,M),a(this,R,null)),this.align=(a(this,B),a(this,j,"left")),this.type=(a(this,I),a(this,O,"status")),a(this,P)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b=[t.element("snice-cell-actions")],v=[],y=HTMLElement,f=[],w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[];(class extends y{static{s=this}static{const L="function"==typeof Symbol&&Symbol.metadata?Object.create(y[Symbol.metadata]??null):void 0;n=[t.property({type:Array,attribute:!1})],l=[t.property({type:Object,attribute:!1})],r=[t.property({type:Object,attribute:!1})],o=[t.property({type:String})],c=[t.property({type:String})],d=[t.property({type:String})],h=[t.render()],u=[t.styles()],p=[t.ready()],m=[t.watch("column")],g=[t.dispatch("cell-action",{bubbles:!0,composed:!0})],i(this,null,h,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:L},null,f),i(this,null,u,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:L},null,f),i(this,null,p,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:L},null,f),i(this,null,m,{kind:"method",name:"extractActionsFromColumn",static:!1,private:!1,access:{has:e=>"extractActionsFromColumn"in e,get:e=>e.extractActionsFromColumn},metadata:L},null,f),i(this,null,g,{kind:"method",name:"dispatchAction",static:!1,private:!1,access:{has:e=>"dispatchAction"in e,get:e=>e.dispatchAction},metadata:L},null,f),i(null,null,n,{kind:"field",name:"actions",static:!1,private:!1,access:{has:e=>"actions"in e,get:e=>e.actions,set:(e,t)=>{e.actions=t}},metadata:L},w,k),i(null,null,l,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:L},x,S),i(null,null,r,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:L},C,E),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:L},D,z),i(null,null,c,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:L},A,$),i(null,null,d,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:L},F,T),i(null,e={value:s},b,{kind:"class",name:s.name,metadata:L},null,v),s=e.value,L&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:L}),a(s,v)}render(){return 0===this.actions.length?t.html`
|
|
437
437
|
<div class="cell-content cell-content--actions" part="content">
|
|
438
438
|
<div class="actions-container"></div>
|
|
439
439
|
</div>
|
|
@@ -443,7 +443,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
443
443
|
${this.actions.map(e=>this.renderActionButton(e))}
|
|
444
444
|
</div>
|
|
445
445
|
</div>
|
|
446
|
-
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem}.actions-container{display:inline-flex;gap:.5rem;align-items:center}.action-button{display:inline-flex;align-items:center;gap:.25rem;padding:.25rem .5rem;border:1px solid transparent;border-radius:.25rem;background:0 0;cursor:pointer;transition:.2s;font-size:.875rem;line-height:1}.action-button:hover{background:var(--snice-color-text,rgb(23 23 23 / .05))}.action-button:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px}.action-button:active{transform:scale(.95)}.action-button:disabled{opacity:.5;cursor:not-allowed}.action-button:disabled:hover{background:0 0}.action-button--primary{color:var(--snice-color-primary,rgb(37 99 235))}.action-button--primary:hover:not(:disabled){background:rgb(37 99 235 / .1)}.action-button--secondary{color:var(--snice-color-text,rgb(23 23 23))}.action-button--danger{color:var(--snice-color-danger,rgb(220 38 38))}.action-button--danger:hover:not(:disabled){background:rgb(220 38 38 / .1)}.action-button--success{color:var(--snice-color-success,rgb(22 163 74))}.action-button--success:hover:not(:disabled){background:rgb(22 163 74 / .1)}.action-icon{display:inline-flex;align-items:center;font-size:1rem}.action-icon--image{width:1rem;height:1rem}.action-icon--image img{width:100%;height:100%;object-fit:contain}.action-label{font-weight:500}:host([align=left]){justify-content:flex-start}:host([align=center]){justify-content:center}:host([align=right]){justify-content:flex-end}@media (max-width:768px){.action-button{padding:.25rem}.action-label{display:none}}@media print{.actions-container{display:none}}"}`}init(){this.extractActionsFromColumn()}extractActionsFromColumn(){this.column?.actionsFormat?.actions&&(this.actions=this.column.actionsFormat.actions)}renderActionButton(e){const
|
|
446
|
+
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem}.actions-container{display:inline-flex;gap:.5rem;align-items:center}.action-button{display:inline-flex;align-items:center;gap:.25rem;padding:.25rem .5rem;border:1px solid transparent;border-radius:.25rem;background:0 0;cursor:pointer;transition:.2s;font-size:.875rem;line-height:1}.action-button:hover{background:var(--snice-color-text,rgb(23 23 23 / .05))}.action-button:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px}.action-button:active{transform:scale(.95)}.action-button:disabled{opacity:.5;cursor:not-allowed}.action-button:disabled:hover{background:0 0}.action-button--primary{color:var(--snice-color-primary,rgb(37 99 235))}.action-button--primary:hover:not(:disabled){background:rgb(37 99 235 / .1)}.action-button--secondary{color:var(--snice-color-text,rgb(23 23 23))}.action-button--danger{color:var(--snice-color-danger,rgb(220 38 38))}.action-button--danger:hover:not(:disabled){background:rgb(220 38 38 / .1)}.action-button--success{color:var(--snice-color-success,rgb(22 163 74))}.action-button--success:hover:not(:disabled){background:rgb(22 163 74 / .1)}.action-icon{display:inline-flex;align-items:center;font-size:1rem}.action-icon--image{width:1rem;height:1rem}.action-icon--image img{width:100%;height:100%;object-fit:contain}.action-label{font-weight:500}:host([align=left]){justify-content:flex-start}:host([align=center]){justify-content:center}:host([align=right]){justify-content:flex-end}@media (max-width:768px){.action-button{padding:.25rem}.action-label{display:none}}@media print{.actions-container{display:none}}"}`}init(){this.extractActionsFromColumn()}extractActionsFromColumn(){this.column?.actionsFormat?.actions&&(this.actions=this.column.actionsFormat.actions)}renderActionButton(e){const i=e.icon||"",a=e.label||"",s=e.variant||"secondary",n=e.disabled||!1,l=i&&(i.startsWith("http://")||i.startsWith("https://")||i.startsWith("/")||i.startsWith("./"));let r="";return i&&(r=l?`<span class="action-icon action-icon--image"><img src="${i}" alt="" /></span>`:`<span class="action-icon">${i}</span>`),t.html`
|
|
447
447
|
<button
|
|
448
448
|
class="action-button action-button--${s}"
|
|
449
449
|
part="action-button"
|
|
@@ -452,88 +452,88 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
452
452
|
@click=${t=>this.handleActionClick(t,e.action)}
|
|
453
453
|
>
|
|
454
454
|
${t.unsafeHTML(r)}
|
|
455
|
-
${
|
|
455
|
+
${a?t.html`<span class="action-label">${a}</span>`:""}
|
|
456
456
|
</button>
|
|
457
|
-
`}handleActionClick(e,t){e.stopPropagation(),this.dispatchAction(t)}dispatchAction(e){return{action:e,rowData:this.rowData,column:this.column}}constructor(){super(...arguments),this.actions=(
|
|
457
|
+
`}handleActionClick(e,t){e.stopPropagation(),this.dispatchAction(t)}dispatchAction(e){return{action:e,rowData:this.rowData,column:this.column}}constructor(){super(...arguments),this.actions=(a(this,f),a(this,w,[])),this.column=(a(this,k),a(this,x,null)),this.rowData=(a(this,S),a(this,C,null)),this.value=(a(this,E),a(this,D,"")),this.align=(a(this,z),a(this,A,"left")),this.type=(a(this,$),a(this,F,"actions")),a(this,T)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f=[t.element("snice-cell-link")],w=[],k=HTMLElement,x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[];(class extends k{static{s=this}static{const q="function"==typeof Symbol&&Symbol.metadata?Object.create(k[Symbol.metadata]??null):void 0;n=[t.property({type:String})],l=[t.property({type:String})],r=[t.property({type:String})],o=[t.property({type:Boolean,attribute:"external"})],c=[t.property({type:String})],d=[t.property({type:String})],h=[t.property({type:Object,attribute:!1})],u=[t.property({type:Object,attribute:!1})],p=[t.property({type:String})],m=[t.property({type:String})],g=[t.render()],b=[t.styles()],v=[t.ready()],y=[t.watch("value","column")],i(this,null,g,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:q},null,x),i(this,null,b,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:q},null,x),i(this,null,v,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:q},null,x),i(this,null,y,{kind:"method",name:"updateCellAttributes",static:!1,private:!1,access:{has:e=>"updateCellAttributes"in e,get:e=>e.updateCellAttributes},metadata:q},null,x),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:q},S,C),i(null,null,l,{kind:"field",name:"href",static:!1,private:!1,access:{has:e=>"href"in e,get:e=>e.href,set:(e,t)=>{e.href=t}},metadata:q},E,D),i(null,null,r,{kind:"field",name:"target",static:!1,private:!1,access:{has:e=>"target"in e,get:e=>e.target,set:(e,t)=>{e.target=t}},metadata:q},z,A),i(null,null,o,{kind:"field",name:"external",static:!1,private:!1,access:{has:e=>"external"in e,get:e=>e.external,set:(e,t)=>{e.external=t}},metadata:q},$,F),i(null,null,c,{kind:"field",name:"icon",static:!1,private:!1,access:{has:e=>"icon"in e,get:e=>e.icon,set:(e,t)=>{e.icon=t}},metadata:q},T,L),i(null,null,d,{kind:"field",name:"text",static:!1,private:!1,access:{has:e=>"text"in e,get:e=>e.text,set:(e,t)=>{e.text=t}},metadata:q},M,R),i(null,null,h,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:q},B,j),i(null,null,u,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:q},I,O),i(null,null,p,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:q},P,V),i(null,null,m,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:q},H,N),i(null,e={value:s},f,{kind:"class",name:s.name,metadata:q},null,w),s=e.value,q&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:q}),a(s,w)}render(){const e=this.href||this.value,i=this.text||this.value,a=this.external||"_blank"===this.target||e.startsWith("http"),s=this.icon?`<span class="link-icon">${this.icon}</span>`:"",n=a?'<span class="external-icon">↗</span>':"";return t.html`
|
|
458
458
|
<div class="cell-content cell-content--link" part="content">
|
|
459
459
|
<a
|
|
460
460
|
href="${e}"
|
|
461
|
-
target="${
|
|
462
|
-
rel="${
|
|
461
|
+
target="${a?"_blank":this.target}"
|
|
462
|
+
rel="${a?"noopener noreferrer":""}"
|
|
463
463
|
class="cell-link"
|
|
464
464
|
part="link"
|
|
465
465
|
>
|
|
466
466
|
${t.unsafeHTML(s)}
|
|
467
|
-
<span class="link-text">${
|
|
467
|
+
<span class="link-text">${i}</span>
|
|
468
468
|
${t.unsafeHTML(n)}
|
|
469
469
|
</a>
|
|
470
470
|
</div>
|
|
471
|
-
`}styles(){return t.css`${':host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem}.cell-link{display:inline-flex;align-items:center;gap:.25rem;color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none;transition:color .2s}.cell-link:hover{color:var(--snice-color-primary-dark,rgb(29 78 216));text-decoration:underline}.cell-link:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-radius:2px}.cell-link:visited{color:var(--snice-color-secondary,rgb(107 114 128))}.link-icon{display:inline-flex;align-items:center;font-size:1rem}.link-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.external-icon{display:inline-flex;align-items:center;font-size:.75rem;opacity:.7}:host([align=left]){text-align:left;justify-content:flex-start}:host([align=center]){text-align:center;justify-content:center}:host([align=right]){text-align:right;justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}}@media print{.cell-link{text-decoration:underline}.cell-link::after{content:" (" attr(href) ")";font-size:.75rem;color:var(--snice-color-text-secondary,rgb(82 82 82))}}'}`}init(){this.updateCellAttributes()}updateCellAttributes(){if(this.column?.linkFormat){const e=this.column.linkFormat;this.href=e.href||this.value,this.target=e.target||"_self",this.external=e.external||!1,this.icon=e.icon||"",this.text=e.text||this.value}}constructor(){super(...arguments),this.value=(
|
|
471
|
+
`}styles(){return t.css`${':host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem}.cell-link{display:inline-flex;align-items:center;gap:.25rem;color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none;transition:color .2s}.cell-link:hover{color:var(--snice-color-primary-dark,rgb(29 78 216));text-decoration:underline}.cell-link:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-radius:2px}.cell-link:visited{color:var(--snice-color-secondary,rgb(107 114 128))}.link-icon{display:inline-flex;align-items:center;font-size:1rem}.link-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.external-icon{display:inline-flex;align-items:center;font-size:.75rem;opacity:.7}:host([align=left]){text-align:left;justify-content:flex-start}:host([align=center]){text-align:center;justify-content:center}:host([align=right]){text-align:right;justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}}@media print{.cell-link{text-decoration:underline}.cell-link::after{content:" (" attr(href) ")";font-size:.75rem;color:var(--snice-color-text-secondary,rgb(82 82 82))}}'}`}init(){this.updateCellAttributes()}updateCellAttributes(){if(this.column?.linkFormat){const e=this.column.linkFormat;this.href=e.href||this.value,this.target=e.target||"_self",this.external=e.external||!1,this.icon=e.icon||"",this.text=e.text||this.value}}constructor(){super(...arguments),this.value=(a(this,x),a(this,S,"")),this.href=(a(this,C),a(this,E,"")),this.target=(a(this,D),a(this,z,"_self")),this.external=(a(this,A),a(this,$,!1)),this.icon=(a(this,F),a(this,T,"")),this.text=(a(this,L),a(this,M,"")),this.column=(a(this,R),a(this,B,null)),this.rowData=(a(this,j),a(this,I,null)),this.align=(a(this,O),a(this,P,"left")),this.type=(a(this,V),a(this,H,"link")),a(this,N)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v=[t.element("snice-cell-email")],y=[],f=HTMLElement,w=[],k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[];(class extends f{static{s=this}static{const I="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;n=[t.property({type:String})],l=[t.property({type:String})],r=[t.property({type:String})],o=[t.property({type:Boolean})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.property({type:String})],u=[t.property({type:String})],p=[t.render()],m=[t.styles()],g=[t.ready()],b=[t.watch("value","column")],i(this,null,p,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:I},null,w),i(this,null,m,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:I},null,w),i(this,null,g,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:I},null,w),i(this,null,b,{kind:"method",name:"updateEmailAttributes",static:!1,private:!1,access:{has:e=>"updateEmailAttributes"in e,get:e=>e.updateEmailAttributes},metadata:I},null,w),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:I},k,x),i(null,null,l,{kind:"field",name:"email",static:!1,private:!1,access:{has:e=>"email"in e,get:e=>e.email,set:(e,t)=>{e.email=t}},metadata:I},S,C),i(null,null,r,{kind:"field",name:"displayText",static:!1,private:!1,access:{has:e=>"displayText"in e,get:e=>e.displayText,set:(e,t)=>{e.displayText=t}},metadata:I},E,D),i(null,null,o,{kind:"field",name:"showIcon",static:!1,private:!1,access:{has:e=>"showIcon"in e,get:e=>e.showIcon,set:(e,t)=>{e.showIcon=t}},metadata:I},z,A),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:I},$,F),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:I},T,L),i(null,null,h,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:I},M,R),i(null,null,u,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:I},B,j),i(null,e={value:s},v,{kind:"class",name:s.name,metadata:I},null,y),s=e.value,I&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:I}),a(s,y)}render(){const e=this.email||this.value,i=this.displayText||e,a=this.showIcon?'<span class="email-icon">✉</span>':"";return e?t.html`
|
|
472
472
|
<div class="cell-content cell-content--email" part="content">
|
|
473
|
-
${t.unsafeHTML(
|
|
473
|
+
${t.unsafeHTML(a)}
|
|
474
474
|
<a href="mailto:${e}" class="email-link" part="link">
|
|
475
|
-
${
|
|
475
|
+
${i}
|
|
476
476
|
</a>
|
|
477
477
|
</div>
|
|
478
478
|
`:t.html`
|
|
479
479
|
<div class="cell-content cell-content--email" part="content">
|
|
480
480
|
<span class="email-empty"></span>
|
|
481
481
|
</div>
|
|
482
|
-
`}styles(){return t.css`${':host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.375rem}.email-icon{display:inline-flex;align-items:center;font-size:.875rem;opacity:.7;flex-shrink:0}.email-link{color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none;transition:color .2s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.email-link:hover{color:var(--snice-color-primary-dark,rgb(29 78 216));text-decoration:underline}.email-link:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-radius:2px}.email-link:visited{color:var(--snice-color-secondary,rgb(107 114 128))}.email-empty{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.email-icon{font-size:.75rem}}@media print{.email-link{text-decoration:underline}.email-link::after{content:" (" attr(href) ")";font-size:.75rem;color:var(--snice-color-text-secondary,rgb(82 82 82))}.email-icon{display:none}}'}`}init(){this.updateEmailAttributes()}updateEmailAttributes(){if(this.column?.emailFormat){const e=this.column.emailFormat;this.email=e.email||this.value,this.displayText=e.displayText||"",this.showIcon=e.showIcon??!0}}constructor(){super(...arguments),this.value=(
|
|
482
|
+
`}styles(){return t.css`${':host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.375rem}.email-icon{display:inline-flex;align-items:center;font-size:.875rem;opacity:.7;flex-shrink:0}.email-link{color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none;transition:color .2s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.email-link:hover{color:var(--snice-color-primary-dark,rgb(29 78 216));text-decoration:underline}.email-link:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-radius:2px}.email-link:visited{color:var(--snice-color-secondary,rgb(107 114 128))}.email-empty{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.email-icon{font-size:.75rem}}@media print{.email-link{text-decoration:underline}.email-link::after{content:" (" attr(href) ")";font-size:.75rem;color:var(--snice-color-text-secondary,rgb(82 82 82))}.email-icon{display:none}}'}`}init(){this.updateEmailAttributes()}updateEmailAttributes(){if(this.column?.emailFormat){const e=this.column.emailFormat;this.email=e.email||this.value,this.displayText=e.displayText||"",this.showIcon=e.showIcon??!0}}constructor(){super(...arguments),this.value=(a(this,w),a(this,k,"")),this.email=(a(this,x),a(this,S,"")),this.displayText=(a(this,C),a(this,E,"")),this.showIcon=(a(this,D),a(this,z,!0)),this.column=(a(this,A),a(this,$,null)),this.rowData=(a(this,F),a(this,T,null)),this.align=(a(this,L),a(this,M,"left")),this.type=(a(this,R),a(this,B,"email")),a(this,j)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f=[t.element("snice-cell-phone")],w=[],k=HTMLElement,x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[];(class extends k{static{s=this}static{const q="function"==typeof Symbol&&Symbol.metadata?Object.create(k[Symbol.metadata]??null):void 0;n=[t.property({type:String})],l=[t.property({type:String})],r=[t.property({type:String})],o=[t.property({type:Boolean})],c=[t.property({type:Boolean})],d=[t.property({type:String})],h=[t.property({type:Object,attribute:!1})],u=[t.property({type:Object,attribute:!1})],p=[t.property({type:String})],m=[t.property({type:String})],g=[t.render()],b=[t.styles()],v=[t.ready()],y=[t.watch("value","column")],i(this,null,g,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:q},null,x),i(this,null,b,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:q},null,x),i(this,null,v,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:q},null,x),i(this,null,y,{kind:"method",name:"updatePhoneAttributes",static:!1,private:!1,access:{has:e=>"updatePhoneAttributes"in e,get:e=>e.updatePhoneAttributes},metadata:q},null,x),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:q},S,C),i(null,null,l,{kind:"field",name:"phone",static:!1,private:!1,access:{has:e=>"phone"in e,get:e=>e.phone,set:(e,t)=>{e.phone=t}},metadata:q},E,D),i(null,null,r,{kind:"field",name:"displayText",static:!1,private:!1,access:{has:e=>"displayText"in e,get:e=>e.displayText,set:(e,t)=>{e.displayText=t}},metadata:q},z,A),i(null,null,o,{kind:"field",name:"showIcon",static:!1,private:!1,access:{has:e=>"showIcon"in e,get:e=>e.showIcon,set:(e,t)=>{e.showIcon=t}},metadata:q},$,F),i(null,null,c,{kind:"field",name:"format",static:!1,private:!1,access:{has:e=>"format"in e,get:e=>e.format,set:(e,t)=>{e.format=t}},metadata:q},T,L),i(null,null,d,{kind:"field",name:"country",static:!1,private:!1,access:{has:e=>"country"in e,get:e=>e.country,set:(e,t)=>{e.country=t}},metadata:q},M,R),i(null,null,h,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:q},B,j),i(null,null,u,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:q},I,O),i(null,null,p,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:q},P,V),i(null,null,m,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:q},H,N),i(null,e={value:s},f,{kind:"class",name:s.name,metadata:q},null,w),s=e.value,q&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:q}),a(s,w)}render(){const e=this.phone||this.value,i=this.displayText||(this.format?this.formatPhoneNumber(e):e),a=this.showIcon?'<span class="phone-icon">📞</span>':"";return e?t.html`
|
|
483
483
|
<div class="cell-content cell-content--phone" part="content">
|
|
484
|
-
${t.unsafeHTML(
|
|
484
|
+
${t.unsafeHTML(a)}
|
|
485
485
|
<a href="tel:${e}" class="phone-link" part="link">
|
|
486
|
-
${
|
|
486
|
+
${i}
|
|
487
487
|
</a>
|
|
488
488
|
</div>
|
|
489
489
|
`:t.html`
|
|
490
490
|
<div class="cell-content cell-content--phone" part="content">
|
|
491
491
|
<span class="phone-empty"></span>
|
|
492
492
|
</div>
|
|
493
|
-
`}styles(){return t.css`${':host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.375rem}.phone-icon{display:inline-flex;align-items:center;font-size:.875rem;opacity:.7;flex-shrink:0}.phone-link{color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none;transition:color .2s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums}.phone-link:hover{color:var(--snice-color-primary-dark,rgb(29 78 216));text-decoration:underline}.phone-link:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-radius:2px}.phone-link:visited{color:var(--snice-color-secondary,rgb(107 114 128))}.phone-empty{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.phone-icon{font-size:.75rem}}@media print{.phone-link{text-decoration:underline}.phone-link::after{content:" (" attr(href) ")";font-size:.75rem;color:var(--snice-color-text-secondary,rgb(82 82 82))}.phone-icon{display:none}}'}`}init(){this.updatePhoneAttributes()}updatePhoneAttributes(){if(this.column?.phoneFormat){const e=this.column.phoneFormat;this.phone=e.phone||this.value,this.displayText=e.displayText||"",this.showIcon=e.showIcon??!0,this.format=e.format??!0,this.country=e.country||"US"}}formatPhoneNumber(e){const t=e.replace(/\D/g,"");return"US"===this.country&&10===t.length?`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`:"US"===this.country&&11===t.length&&"1"===t[0]?`+1 (${t.slice(1,4)}) ${t.slice(4,7)}-${t.slice(7)}`:e}constructor(){super(...arguments),this.value=(
|
|
493
|
+
`}styles(){return t.css`${':host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.375rem}.phone-icon{display:inline-flex;align-items:center;font-size:.875rem;opacity:.7;flex-shrink:0}.phone-link{color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none;transition:color .2s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums}.phone-link:hover{color:var(--snice-color-primary-dark,rgb(29 78 216));text-decoration:underline}.phone-link:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-radius:2px}.phone-link:visited{color:var(--snice-color-secondary,rgb(107 114 128))}.phone-empty{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.phone-icon{font-size:.75rem}}@media print{.phone-link{text-decoration:underline}.phone-link::after{content:" (" attr(href) ")";font-size:.75rem;color:var(--snice-color-text-secondary,rgb(82 82 82))}.phone-icon{display:none}}'}`}init(){this.updatePhoneAttributes()}updatePhoneAttributes(){if(this.column?.phoneFormat){const e=this.column.phoneFormat;this.phone=e.phone||this.value,this.displayText=e.displayText||"",this.showIcon=e.showIcon??!0,this.format=e.format??!0,this.country=e.country||"US"}}formatPhoneNumber(e){const t=e.replace(/\D/g,"");return"US"===this.country&&10===t.length?`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`:"US"===this.country&&11===t.length&&"1"===t[0]?`+1 (${t.slice(1,4)}) ${t.slice(4,7)}-${t.slice(7)}`:e}constructor(){super(...arguments),this.value=(a(this,x),a(this,S,"")),this.phone=(a(this,C),a(this,E,"")),this.displayText=(a(this,D),a(this,z,"")),this.showIcon=(a(this,A),a(this,$,!0)),this.format=(a(this,F),a(this,T,!0)),this.country=(a(this,L),a(this,M,"US")),this.column=(a(this,R),a(this,B,null)),this.rowData=(a(this,j),a(this,I,null)),this.align=(a(this,O),a(this,P,"left")),this.type=(a(this,V),a(this,H,"phone")),a(this,N)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f=[t.element("snice-cell-color")],w=[],k=HTMLElement,x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[];(class extends k{static{s=this}static{const q="function"==typeof Symbol&&Symbol.metadata?Object.create(k[Symbol.metadata]??null):void 0;n=[t.property({type:String})],l=[t.property({type:String})],r=[t.property({type:Boolean})],o=[t.property({type:Boolean})],c=[t.property({type:Boolean})],d=[t.property({type:String})],h=[t.property({type:Object,attribute:!1})],u=[t.property({type:Object,attribute:!1})],p=[t.property({type:String})],m=[t.property({type:String})],g=[t.render()],b=[t.styles()],v=[t.ready()],y=[t.watch("value","column")],i(this,null,g,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:q},null,x),i(this,null,b,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:q},null,x),i(this,null,v,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:q},null,x),i(this,null,y,{kind:"method",name:"updateColorAttributes",static:!1,private:!1,access:{has:e=>"updateColorAttributes"in e,get:e=>e.updateColorAttributes},metadata:q},null,x),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:q},S,C),i(null,null,l,{kind:"field",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:q},E,D),i(null,null,r,{kind:"field",name:"showSwatch",static:!1,private:!1,access:{has:e=>"showSwatch"in e,get:e=>e.showSwatch,set:(e,t)=>{e.showSwatch=t}},metadata:q},z,A),i(null,null,o,{kind:"field",name:"showHex",static:!1,private:!1,access:{has:e=>"showHex"in e,get:e=>e.showHex,set:(e,t)=>{e.showHex=t}},metadata:q},$,F),i(null,null,c,{kind:"field",name:"showRgb",static:!1,private:!1,access:{has:e=>"showRgb"in e,get:e=>e.showRgb,set:(e,t)=>{e.showRgb=t}},metadata:q},T,L),i(null,null,d,{kind:"field",name:"swatchSize",static:!1,private:!1,access:{has:e=>"swatchSize"in e,get:e=>e.swatchSize,set:(e,t)=>{e.swatchSize=t}},metadata:q},M,R),i(null,null,h,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:q},B,j),i(null,null,u,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:q},I,O),i(null,null,p,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:q},P,V),i(null,null,m,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:q},H,N),i(null,e={value:s},f,{kind:"class",name:s.name,metadata:q},null,w),s=e.value,q&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:q}),a(s,w)}render(){const e=this.color||this.value,i=this.showSwatch?`<span class="color-swatch color-swatch--${this.swatchSize}" style="background-color: ${e};"></span>`:"";let a="";if(this.showHex&&(a=e),this.showRgb&&e.startsWith("#")){const t=this.hexToRgb(e);a=t?`rgb(${t.r}, ${t.g}, ${t.b})`:e}return t.html`
|
|
494
494
|
<div class="cell-content cell-content--color" part="content">
|
|
495
|
-
${t.unsafeHTML(
|
|
496
|
-
${
|
|
495
|
+
${t.unsafeHTML(i)}
|
|
496
|
+
${a?t.html`<span class="color-text">${a}</span>`:""}
|
|
497
497
|
</div>
|
|
498
|
-
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.5rem}.color-swatch{border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:.25rem;flex-shrink:0;box-shadow:var(--snice-shadow-xs,0 1px 2px 0 rgb(0 0 0 / .03))}.color-swatch--small{width:1rem;height:1rem}.color-swatch--medium{width:1.5rem;height:1.5rem}.color-swatch--large{width:2rem;height:2rem}.color-text{font-family:monospace;font-size:.875rem;color:var(--snice-color-text,rgb(23 23 23));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.color-swatch--small{width:.875rem;height:.875rem}.color-swatch--medium{width:1.25rem;height:1.25rem}.color-swatch--large{width:1.75rem;height:1.75rem}.color-text{font-size:.75rem}}@media print{.color-swatch{border:2px solid var(--snice-color-text,rgb(23 23 23))}.color-text{font-size:.75rem}}"}`}init(){this.updateColorAttributes()}updateColorAttributes(){if(this.column?.colorFormat){const e=this.column.colorFormat;this.color=e.color||this.value,this.showSwatch=e.showSwatch??!0,this.showHex=e.showHex??!0,this.showRgb=e.showRgb??!1,this.swatchSize=e.swatchSize||"medium"}}hexToRgb(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}constructor(){super(...arguments),this.value=(
|
|
498
|
+
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.5rem}.color-swatch{border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:.25rem;flex-shrink:0;box-shadow:var(--snice-shadow-xs,0 1px 2px 0 rgb(0 0 0 / .03))}.color-swatch--small{width:1rem;height:1rem}.color-swatch--medium{width:1.5rem;height:1.5rem}.color-swatch--large{width:2rem;height:2rem}.color-text{font-family:monospace;font-size:.875rem;color:var(--snice-color-text,rgb(23 23 23));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.color-swatch--small{width:.875rem;height:.875rem}.color-swatch--medium{width:1.25rem;height:1.25rem}.color-swatch--large{width:1.75rem;height:1.75rem}.color-text{font-size:.75rem}}@media print{.color-swatch{border:2px solid var(--snice-color-text,rgb(23 23 23))}.color-text{font-size:.75rem}}"}`}init(){this.updateColorAttributes()}updateColorAttributes(){if(this.column?.colorFormat){const e=this.column.colorFormat;this.color=e.color||this.value,this.showSwatch=e.showSwatch??!0,this.showHex=e.showHex??!0,this.showRgb=e.showRgb??!1,this.swatchSize=e.swatchSize||"medium"}}hexToRgb(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}constructor(){super(...arguments),this.value=(a(this,x),a(this,S,"")),this.color=(a(this,C),a(this,E,"")),this.showSwatch=(a(this,D),a(this,z,!0)),this.showHex=(a(this,A),a(this,$,!0)),this.showRgb=(a(this,F),a(this,T,!1)),this.swatchSize=(a(this,L),a(this,M,"medium")),this.column=(a(this,R),a(this,B,null)),this.rowData=(a(this,j),a(this,I,null)),this.align=(a(this,O),a(this,P,"left")),this.type=(a(this,V),a(this,H,"color")),a(this,N)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w=[t.element("snice-cell-location")],k=[],x=HTMLElement,S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[];(class extends x{static{s=this}static{const K="function"==typeof Symbol&&Symbol.metadata?Object.create(x[Symbol.metadata]??null):void 0;n=[t.property({type:String})],l=[t.property({type:String})],r=[t.property({type:String})],o=[t.property({type:String})],c=[t.property({type:Boolean})],d=[t.property({type:String})],h=[t.property({type:Boolean})],u=[t.property({type:Object,attribute:!1})],p=[t.property({type:Object,attribute:!1})],m=[t.property({type:String})],g=[t.property({type:String})],b=[t.render()],v=[t.styles()],y=[t.ready()],f=[t.watch("value","column")],i(this,null,b,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:K},null,S),i(this,null,v,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:K},null,S),i(this,null,y,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:K},null,S),i(this,null,f,{kind:"method",name:"updateLocationAttributes",static:!1,private:!1,access:{has:e=>"updateLocationAttributes"in e,get:e=>e.updateLocationAttributes},metadata:K},null,S),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:K},C,E),i(null,null,l,{kind:"field",name:"address",static:!1,private:!1,access:{has:e=>"address"in e,get:e=>e.address,set:(e,t)=>{e.address=t}},metadata:K},D,z),i(null,null,r,{kind:"field",name:"latitude",static:!1,private:!1,access:{has:e=>"latitude"in e,get:e=>e.latitude,set:(e,t)=>{e.latitude=t}},metadata:K},A,$),i(null,null,o,{kind:"field",name:"longitude",static:!1,private:!1,access:{has:e=>"longitude"in e,get:e=>e.longitude,set:(e,t)=>{e.longitude=t}},metadata:K},F,T),i(null,null,c,{kind:"field",name:"showMapLink",static:!1,private:!1,access:{has:e=>"showMapLink"in e,get:e=>e.showMapLink,set:(e,t)=>{e.showMapLink=t}},metadata:K},L,M),i(null,null,d,{kind:"field",name:"mapProvider",static:!1,private:!1,access:{has:e=>"mapProvider"in e,get:e=>e.mapProvider,set:(e,t)=>{e.mapProvider=t}},metadata:K},R,B),i(null,null,h,{kind:"field",name:"showIcon",static:!1,private:!1,access:{has:e=>"showIcon"in e,get:e=>e.showIcon,set:(e,t)=>{e.showIcon=t}},metadata:K},j,I),i(null,null,u,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:K},O,P),i(null,null,p,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:K},V,H),i(null,null,m,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:K},N,q),i(null,null,g,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:K},_,W),i(null,e={value:s},w,{kind:"class",name:s.name,metadata:K},null,k),s=e.value,K&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:K}),a(s,k)}render(){const e=this.address||this.value,i=this.showIcon?'<span class="location-icon">📍</span>':"",a=this.getMapLink();if(!e&&!this.latitude&&!this.longitude)return t.html`
|
|
499
499
|
<div class="cell-content cell-content--location" part="content">
|
|
500
500
|
<span class="location-empty"></span>
|
|
501
501
|
</div>
|
|
502
502
|
`;const s=e||`${this.latitude}, ${this.longitude}`;return t.html`
|
|
503
503
|
<div class="cell-content cell-content--location" part="content">
|
|
504
|
-
${t.unsafeHTML(
|
|
505
|
-
${this.showMapLink&&
|
|
504
|
+
${t.unsafeHTML(i)}
|
|
505
|
+
${this.showMapLink&&a?t.html`<a href="${a}" target="_blank" rel="noopener noreferrer" class="location-link" part="link">
|
|
506
506
|
${s}
|
|
507
507
|
</a>`:t.html`<span class="location-text">${s}</span>`}
|
|
508
508
|
</div>
|
|
509
|
-
`}styles(){return t.css`${':host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.375rem}.location-icon{display:inline-flex;align-items:center;font-size:.875rem;opacity:.7;flex-shrink:0}.location-link{color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none;transition:color .2s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.location-link:hover{color:var(--snice-color-primary-dark,rgb(29 78 216));text-decoration:underline}.location-link:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-radius:2px}.location-link:visited{color:var(--snice-color-secondary,rgb(107 114 128))}.location-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--snice-color-text,rgb(23 23 23))}.location-empty{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.location-icon{font-size:.75rem}}@media print{.location-link{text-decoration:underline}.location-link::after{content:" (" attr(href) ")";font-size:.75rem;color:var(--snice-color-text-secondary,rgb(82 82 82))}.location-icon{display:none}}'}`}init(){this.updateLocationAttributes()}updateLocationAttributes(){if(this.column?.locationFormat){const e=this.column.locationFormat;this.address=e.address||this.value,this.latitude=e.latitude?String(e.latitude):"",this.longitude=e.longitude?String(e.longitude):"",this.showMapLink=e.showMapLink??!0,this.mapProvider=e.mapProvider||"google",this.showIcon=e.showIcon??!0}}getMapLink(){if(!this.showMapLink)return"";const e=this.address||this.value,t=this.latitude,
|
|
509
|
+
`}styles(){return t.css`${':host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center;gap:.375rem}.location-icon{display:inline-flex;align-items:center;font-size:.875rem;opacity:.7;flex-shrink:0}.location-link{color:var(--snice-color-primary,rgb(37 99 235));text-decoration:none;transition:color .2s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.location-link:hover{color:var(--snice-color-primary-dark,rgb(29 78 216));text-decoration:underline}.location-link:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px;border-radius:2px}.location-link:visited{color:var(--snice-color-secondary,rgb(107 114 128))}.location-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--snice-color-text,rgb(23 23 23))}.location-empty{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.location-icon{font-size:.75rem}}@media print{.location-link{text-decoration:underline}.location-link::after{content:" (" attr(href) ")";font-size:.75rem;color:var(--snice-color-text-secondary,rgb(82 82 82))}.location-icon{display:none}}'}`}init(){this.updateLocationAttributes()}updateLocationAttributes(){if(this.column?.locationFormat){const e=this.column.locationFormat;this.address=e.address||this.value,this.latitude=e.latitude?String(e.latitude):"",this.longitude=e.longitude?String(e.longitude):"",this.showMapLink=e.showMapLink??!0,this.mapProvider=e.mapProvider||"google",this.showIcon=e.showIcon??!0}}getMapLink(){if(!this.showMapLink)return"";const e=this.address||this.value,t=this.latitude,i=this.longitude;switch(this.mapProvider){case"google":return t&&i?`https://www.google.com/maps?q=${t},${i}`:e?`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(e)}`:"";case"openstreetmap":return t&&i?`https://www.openstreetmap.org/?mlat=${t}&mlon=${i}&zoom=15`:e?`https://www.openstreetmap.org/search?query=${encodeURIComponent(e)}`:"";case"apple":return t&&i?`https://maps.apple.com/?ll=${t},${i}`:e?`https://maps.apple.com/?address=${encodeURIComponent(e)}`:"";default:return""}}constructor(){super(...arguments),this.value=(a(this,S),a(this,C,"")),this.address=(a(this,E),a(this,D,"")),this.latitude=(a(this,z),a(this,A,"")),this.longitude=(a(this,$),a(this,F,"")),this.showMapLink=(a(this,T),a(this,L,!0)),this.mapProvider=(a(this,M),a(this,R,"google")),this.showIcon=(a(this,B),a(this,j,!0)),this.column=(a(this,I),a(this,O,null)),this.rowData=(a(this,P),a(this,V,null)),this.align=(a(this,H),a(this,N,"left")),this.type=(a(this,q),a(this,_,"location")),a(this,W)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y=[t.element("snice-cell-json")],f=[],w=HTMLElement,k=[],x=[],S=[],C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[];(class extends w{static{s=this}static{const O="function"==typeof Symbol&&Symbol.metadata?Object.create(w[Symbol.metadata]??null):void 0;n=[t.property({type:String})],l=[t.property({type:Boolean})],r=[t.property({type:Number})],o=[t.property({type:Boolean})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.property({type:String})],u=[t.property({type:String})],p=[t.render()],m=[t.styles()],g=[t.ready()],b=[t.watch("value","column")],v=[t.on("click",".json-toggle")],i(this,null,p,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:O},null,k),i(this,null,m,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:O},null,k),i(this,null,g,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:O},null,k),i(this,null,b,{kind:"method",name:"updateJsonAttributes",static:!1,private:!1,access:{has:e=>"updateJsonAttributes"in e,get:e=>e.updateJsonAttributes},metadata:O},null,k),i(this,null,v,{kind:"method",name:"handleToggle",static:!1,private:!1,access:{has:e=>"handleToggle"in e,get:e=>e.handleToggle},metadata:O},null,k),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:O},x,S),i(null,null,l,{kind:"field",name:"collapsed",static:!1,private:!1,access:{has:e=>"collapsed"in e,get:e=>e.collapsed,set:(e,t)=>{e.collapsed=t}},metadata:O},C,E),i(null,null,r,{kind:"field",name:"maxDepth",static:!1,private:!1,access:{has:e=>"maxDepth"in e,get:e=>e.maxDepth,set:(e,t)=>{e.maxDepth=t}},metadata:O},D,z),i(null,null,o,{kind:"field",name:"showToggle",static:!1,private:!1,access:{has:e=>"showToggle"in e,get:e=>e.showToggle,set:(e,t)=>{e.showToggle=t}},metadata:O},A,$),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:O},F,T),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:O},L,M),i(null,null,h,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:O},R,B),i(null,null,u,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:O},j,I),i(null,e={value:s},y,{kind:"class",name:s.name,metadata:O},null,f),s=e.value,O&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:O}),a(s,f)}render(){const e="string"==typeof this.value?this.tryParseJson(this.value):this.value;if(null==e)return t.html`
|
|
510
510
|
<div class="cell-content cell-content--json" part="content">
|
|
511
511
|
<span class="json-empty">null</span>
|
|
512
512
|
</div>
|
|
513
|
-
`;const
|
|
513
|
+
`;const i=this.showToggle?`<button class="json-toggle" part="toggle" aria-label="${this.collapsed?"Expand":"Collapse"}">${this.collapsed?"▶":"▼"}</button>`:"",a=this.collapsed?this.renderCollapsed(e):this.renderExpanded(e);return t.html`
|
|
514
514
|
<div class="cell-content cell-content--json" part="content">
|
|
515
|
-
${t.unsafeHTML(
|
|
515
|
+
${t.unsafeHTML(i)}
|
|
516
516
|
<div class="json-viewer ${this.collapsed?"json-viewer--collapsed":"json-viewer--expanded"}">
|
|
517
|
-
${t.unsafeHTML(
|
|
517
|
+
${t.unsafeHTML(a)}
|
|
518
518
|
</div>
|
|
519
519
|
</div>
|
|
520
|
-
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:auto;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:flex-start;gap:.5rem;padding:.25rem 0}.json-toggle{background:0 0;border:none;color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:pointer;padding:.125rem .25rem;font-size:.75rem;line-height:1;border-radius:.25rem;transition:background-color .2s;flex-shrink:0}.json-toggle:hover{background-color:var(--snice-color-background-hover,rgb(245 245 245))}.json-toggle:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px}.json-viewer{font-family:'Courier New',Consolas,monospace;font-size:.8125rem;overflow:hidden;flex:1}.json-viewer--collapsed{white-space:nowrap;text-overflow:ellipsis}.json-viewer--expanded{white-space:pre-wrap;word-break:break-word}.json-preview{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}.json-object{padding-left:1rem}.json-line{margin:.125rem 0}.json-key{color:var(--snice-color-primary,rgb(37 99 235));font-weight:500;margin-right:.25rem}.json-string{color:var(--snice-color-success,rgb(22 163 74))}.json-number{color:var(--snice-color-info,rgb(59 130 246))}.json-boolean{color:var(--snice-color-warning,rgb(234 179 8))}.json-empty,.json-null,.json-undefined{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.json-viewer{font-size:.75rem}.json-toggle{font-size:.625rem}}@media print{.json-toggle{display:none}.json-viewer--collapsed{white-space:normal}.json-viewer{font-size:.625rem}}"}`}init(){this.updateJsonAttributes()}updateJsonAttributes(){if(this.column?.jsonFormat){const e=this.column.jsonFormat;this.collapsed=e.collapsed??!0,this.maxDepth=e.maxDepth??3,this.showToggle=e.showToggle??!0}}handleToggle(){this.collapsed=!this.collapsed}tryParseJson(e){try{return JSON.parse(e)}catch{return e}}renderCollapsed(e){if("object"==typeof e&&null!==e){if(Array.isArray(e))return`<span class="json-preview">[${e.length} items]</span>`;return`<span class="json-preview">{${Object.keys(e).length} keys}</span>`}return this.renderValue(e)}renderExpanded(e,t=0){if(t>=this.maxDepth)return this.renderCollapsed(e);if("object"==typeof e&&null!==e){if(Array.isArray(e)){return`<div class="json-object">[${e.map((e,
|
|
521
|
-
<div class="cell-content cell-content--number" part="content" style="${
|
|
520
|
+
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:auto;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:flex-start;gap:.5rem;padding:.25rem 0}.json-toggle{background:0 0;border:none;color:var(--snice-color-text-secondary,rgb(82 82 82));cursor:pointer;padding:.125rem .25rem;font-size:.75rem;line-height:1;border-radius:.25rem;transition:background-color .2s;flex-shrink:0}.json-toggle:hover{background-color:var(--snice-color-background-hover,rgb(245 245 245))}.json-toggle:focus{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:2px}.json-viewer{font-family:'Courier New',Consolas,monospace;font-size:.8125rem;overflow:hidden;flex:1}.json-viewer--collapsed{white-space:nowrap;text-overflow:ellipsis}.json-viewer--expanded{white-space:pre-wrap;word-break:break-word}.json-preview{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}.json-object{padding-left:1rem}.json-line{margin:.125rem 0}.json-key{color:var(--snice-color-primary,rgb(37 99 235));font-weight:500;margin-right:.25rem}.json-string{color:var(--snice-color-success,rgb(22 163 74))}.json-number{color:var(--snice-color-info,rgb(59 130 246))}.json-boolean{color:var(--snice-color-warning,rgb(234 179 8))}.json-empty,.json-null,.json-undefined{color:var(--snice-color-text-secondary,rgb(82 82 82));font-style:italic}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}@media (max-width:768px){:host{color:var(--snice-color-text,rgb(23 23 23));font-size:.75rem;line-height:1rem}.json-viewer{font-size:.75rem}.json-toggle{font-size:.625rem}}@media print{.json-toggle{display:none}.json-viewer--collapsed{white-space:normal}.json-viewer{font-size:.625rem}}"}`}init(){this.updateJsonAttributes()}updateJsonAttributes(){if(this.column?.jsonFormat){const e=this.column.jsonFormat;this.collapsed=e.collapsed??!0,this.maxDepth=e.maxDepth??3,this.showToggle=e.showToggle??!0}}handleToggle(){this.collapsed=!this.collapsed}tryParseJson(e){try{return JSON.parse(e)}catch{return e}}renderCollapsed(e){if("object"==typeof e&&null!==e){if(Array.isArray(e))return`<span class="json-preview">[${e.length} items]</span>`;return`<span class="json-preview">{${Object.keys(e).length} keys}</span>`}return this.renderValue(e)}renderExpanded(e,t=0){if(t>=this.maxDepth)return this.renderCollapsed(e);if("object"==typeof e&&null!==e){if(Array.isArray(e)){return`<div class="json-object">[${e.map((e,i)=>`<div class="json-line"><span class="json-key">${i}:</span> ${this.renderExpanded(e,t+1)}</div>`).join("")}]</div>`}return`<div class="json-object">{${Object.entries(e).map(([e,i])=>`<div class="json-line"><span class="json-key">${e}:</span> ${this.renderExpanded(i,t+1)}</div>`).join("")}}</div>`}return this.renderValue(e)}renderValue(e){return null===e?'<span class="json-null">null</span>':void 0===e?'<span class="json-undefined">undefined</span>':"boolean"==typeof e?`<span class="json-boolean">${e}</span>`:"number"==typeof e?`<span class="json-number">${e}</span>`:"string"==typeof e?`<span class="json-string">"${e}"</span>`:String(e)}constructor(){super(...arguments),this.value=(a(this,k),a(this,x,null)),this.collapsed=(a(this,S),a(this,C,!0)),this.maxDepth=(a(this,E),a(this,D,3)),this.showToggle=(a(this,z),a(this,A,!0)),this.column=(a(this,$),a(this,F,null)),this.rowData=(a(this,T),a(this,L,null)),this.align=(a(this,M),a(this,R,"left")),this.type=(a(this,B),a(this,j,"json")),a(this,I)}})})(),(()=>{let e,s,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C=[t.element("snice-cell-currency")],E=[],D=HTMLElement,z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[],G=[],J=[],X=[],Q=[],Z=[];(class extends D{static{s=this}static{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(D[Symbol.metadata]??null):void 0;l=[t.property({type:String})],r=[t.property({type:String})],o=[t.property({})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Object,attribute:!1})],h=[t.query(".cell-content")],u=[t.property({type:Number})],p=[t.property({type:Boolean,attribute:"thousands-separator"})],m=[t.property({type:String})],g=[t.property({type:String})],b=[t.property({type:String})],v=[t.property({type:String,attribute:"negative-style"})],y=[t.property({type:Boolean})],f=[t.render()],w=[t.styles()],k=[t.ready()],x=[t.watch("align")],S=[t.watch("value","column")],i(this,null,f,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:n},null,z),i(this,null,w,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:n},null,z),i(this,null,k,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:n},null,z),i(this,null,x,{kind:"method",name:"updateAlignment",static:!1,private:!1,access:{has:e=>"updateAlignment"in e,get:e=>e.updateAlignment},metadata:n},null,z),i(this,null,S,{kind:"method",name:"updateContent",static:!1,private:!1,access:{has:e=>"updateContent"in e,get:e=>e.updateContent},metadata:n},null,z),i(null,null,l,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:n},A,$),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:n},F,T),i(null,null,o,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:n},L,M),i(null,null,c,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:n},R,B),i(null,null,d,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:n},j,I),i(null,null,h,{kind:"field",name:"contentElement",static:!1,private:!1,access:{has:e=>"contentElement"in e,get:e=>e.contentElement,set:(e,t)=>{e.contentElement=t}},metadata:n},O,P),i(null,null,u,{kind:"field",name:"decimals",static:!1,private:!1,access:{has:e=>"decimals"in e,get:e=>e.decimals,set:(e,t)=>{e.decimals=t}},metadata:n},V,H),i(null,null,p,{kind:"field",name:"thousandsSeparator",static:!1,private:!1,access:{has:e=>"thousandsSeparator"in e,get:e=>e.thousandsSeparator,set:(e,t)=>{e.thousandsSeparator=t}},metadata:n},N,q),i(null,null,m,{kind:"field",name:"currency",static:!1,private:!1,access:{has:e=>"currency"in e,get:e=>e.currency,set:(e,t)=>{e.currency=t}},metadata:n},_,W),i(null,null,g,{kind:"field",name:"currencyDisplay",static:!1,private:!1,access:{has:e=>"currencyDisplay"in e,get:e=>e.currencyDisplay,set:(e,t)=>{e.currencyDisplay=t}},metadata:n},K,Y),i(null,null,b,{kind:"field",name:"locale",static:!1,private:!1,access:{has:e=>"locale"in e,get:e=>e.locale,set:(e,t)=>{e.locale=t}},metadata:n},U,G),i(null,null,v,{kind:"field",name:"negativeStyle",static:!1,private:!1,access:{has:e=>"negativeStyle"in e,get:e=>e.negativeStyle,set:(e,t)=>{e.negativeStyle=t}},metadata:n},J,X),i(null,null,y,{kind:"field",name:"highlight",static:!1,private:!1,access:{has:e=>"highlight"in e,get:e=>e.highlight,set:(e,t)=>{e.highlight=t}},metadata:n},Q,Z),i(null,e={value:s},C,{kind:"class",name:s.name,metadata:n},null,E),s=e.value,n&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),a(s,E)}render(){const e=this.formatCurrencyValue(),i=this.getCurrencyStyles();return t.html`
|
|
521
|
+
<div class="cell-content cell-content--number" part="content" style="${i}">
|
|
522
522
|
${e}
|
|
523
523
|
</div>
|
|
524
|
-
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatCurrencyValue(),t=this.getCurrencyStyles();this.contentElement.innerHTML=e,this.contentElement.setAttribute("style",t)}}formatCurrencyValue(){if(null===this.value||void 0===this.value||""===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=this.column.currencyFormat||{decimals:this.decimals,currency:this.currency,currencyDisplay:this.currencyDisplay,locale:this.locale,negativeStyle:this.negativeStyle},t=Number(this.value);if(isNaN(t))return String(this.value);try{let
|
|
524
|
+
`}styles(){return t.css`${n}`}init(){this.applyAlignment()}applyAlignment(){this.style.textAlign=this.align}updateAlignment(){this.applyAlignment()}updateContent(){if(this.contentElement){const e=this.formatCurrencyValue(),t=this.getCurrencyStyles();this.contentElement.innerHTML=e,this.contentElement.setAttribute("style",t)}}formatCurrencyValue(){if(null===this.value||void 0===this.value||""===this.value)return"";if(this.column.formatter)return this.column.formatter(this.value,this.rowData);const e=this.column.currencyFormat||{decimals:this.decimals,currency:this.currency,currencyDisplay:this.currencyDisplay,locale:this.locale,negativeStyle:this.negativeStyle},t=Number(this.value);if(isNaN(t))return String(this.value);try{let i=new Intl.NumberFormat(e.locale||this.locale,{style:"currency",currency:e.currency||this.currency,currencyDisplay:e.currencyDisplay||this.currencyDisplay,minimumFractionDigits:e.decimals??this.decimals,maximumFractionDigits:e.decimals??this.decimals}).format(Math.abs(t));if(t<0){const t=e.negativeStyle??this.negativeStyle;i="parentheses"===t?`(${i})`:`-${i}`}return i}catch(i){let a=t.toFixed(e.decimals??this.decimals);if(this.thousandsSeparator){const e=a.split(".");e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),a=e.join(".")}return`$${a}`}}getCurrencyStyles(){const e=Number(this.value);if(this.classList.remove("number--negative","number--positive","number--zero","number--highlighted"),e<0){this.classList.add("number--negative");"red"===(this.column.currencyFormat?.negativeStyle??this.negativeStyle)&&this.classList.add("number--negative-red")}else e>0?(this.classList.add("number--positive"),this.highlight&&this.classList.add("number--highlighted")):0===e&&this.classList.add("number--zero");return"text-align: right"}constructor(){super(...arguments),this.align=(a(this,z),a(this,A,"right")),this.type=(a(this,$),a(this,F,"currency")),this.value=(a(this,T),a(this,L,"")),this.column=(a(this,M),a(this,R,{key:"",label:"",type:"currency",align:"right"})),this.rowData=(a(this,B),a(this,j,null)),this.contentElement=(a(this,I),a(this,O,void 0)),this.decimals=(a(this,P),a(this,V,2)),this.thousandsSeparator=(a(this,H),a(this,N,!0)),this.currency=(a(this,q),a(this,_,"USD")),this.currencyDisplay=(a(this,W),a(this,K,"symbol")),this.locale=(a(this,Y),a(this,U,"en-US")),this.negativeStyle=(a(this,G),a(this,J,"red")),this.highlight=(a(this,X),a(this,Q,!1)),a(this,Z)}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k=[t.element("snice-cell-image")],x=[],S=HTMLElement,C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[],P=[],V=[],H=[],N=[],q=[],_=[],W=[],K=[],Y=[],U=[];(class extends S{static{s=this}static{const G="function"==typeof Symbol&&Symbol.metadata?Object.create(S[Symbol.metadata]??null):void 0;n=[t.property({type:String})],l=[t.property({type:String})],r=[t.property({type:String})],o=[t.property({type:String})],c=[t.property({type:String})],d=[t.property({type:String})],h=[t.property({type:Boolean})],u=[t.property({type:Object,attribute:!1})],p=[t.property({type:Object,attribute:!1})],m=[t.property({type:String})],g=[t.property({type:String})],b=[t.property({type:Boolean})],v=[t.render()],y=[t.styles()],f=[t.ready()],w=[t.watch("column")],i(this,null,v,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:G},null,C),i(this,null,y,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:G},null,C),i(this,null,f,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:G},null,C),i(this,null,w,{kind:"method",name:"updateImageAttributes",static:!1,private:!1,access:{has:e=>"updateImageAttributes"in e,get:e=>e.updateImageAttributes},metadata:G},null,C),i(null,null,n,{kind:"field",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:G},E,D),i(null,null,l,{kind:"field",name:"src",static:!1,private:!1,access:{has:e=>"src"in e,get:e=>e.src,set:(e,t)=>{e.src=t}},metadata:G},z,A),i(null,null,r,{kind:"field",name:"alt",static:!1,private:!1,access:{has:e=>"alt"in e,get:e=>e.alt,set:(e,t)=>{e.alt=t}},metadata:G},$,F),i(null,null,o,{kind:"field",name:"fallback",static:!1,private:!1,access:{has:e=>"fallback"in e,get:e=>e.fallback,set:(e,t)=>{e.fallback=t}},metadata:G},T,L),i(null,null,c,{kind:"field",name:"variant",static:!1,private:!1,access:{has:e=>"variant"in e,get:e=>e.variant,set:(e,t)=>{e.variant=t}},metadata:G},M,R),i(null,null,d,{kind:"field",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:G},B,j),i(null,null,h,{kind:"field",name:"lazy",static:!1,private:!1,access:{has:e=>"lazy"in e,get:e=>e.lazy,set:(e,t)=>{e.lazy=t}},metadata:G},I,O),i(null,null,u,{kind:"field",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:G},P,V),i(null,null,p,{kind:"field",name:"rowData",static:!1,private:!1,access:{has:e=>"rowData"in e,get:e=>e.rowData,set:(e,t)=>{e.rowData=t}},metadata:G},H,N),i(null,null,m,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:G},q,_),i(null,null,g,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:G},W,K),i(null,null,b,{kind:"field",name:"imageError",static:!1,private:!1,access:{has:e=>"imageError"in e,get:e=>e.imageError,set:(e,t)=>{e.imageError=t}},metadata:G},Y,U),i(null,e={value:s},k,{kind:"class",name:s.name,metadata:G},null,x),s=e.value,G&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:G}),a(s,x)}render(){const e=this.src||this.value,i=this.alt||"Image",a=this.lazy?"lazy":"eager",s=`cell-image ${`image--${this.variant}`} ${`image--${this.size}`}`;return this.imageError&&this.fallback?t.html`
|
|
525
525
|
<div class="cell-content cell-content--image" part="content">
|
|
526
|
-
<img src="${this.fallback}" alt="${
|
|
526
|
+
<img src="${this.fallback}" alt="${i}" class="${s}" />
|
|
527
527
|
</div>
|
|
528
528
|
`:e?t.html`
|
|
529
529
|
<div class="cell-content cell-content--image" part="content">
|
|
530
|
-
<img src="${e}" alt="${
|
|
530
|
+
<img src="${e}" alt="${i}" loading="${a}" class="${s}" @error=${this.handleImageError} />
|
|
531
531
|
</div>
|
|
532
532
|
`:t.html`
|
|
533
533
|
<div class="cell-content cell-content--image" part="content">
|
|
534
534
|
<div class="${s} cell-image--placeholder"></div>
|
|
535
535
|
</div>
|
|
536
|
-
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center}.cell-image{display:block;object-fit:cover;background-color:rgb(243 244 246)}.image--small{width:1.5rem;height:1.5rem}.image--medium{width:2rem;height:2rem}.image--large{width:3rem;height:3rem}.image--rounded{border-radius:.25rem}.image--square{border-radius:0}.image--circle{border-radius:50%}.cell-image--placeholder{background:linear-gradient(135deg,rgb(229 231 235) 0,rgb(209 213 219) 100%);border:1px solid rgb(209 213 219);position:relative}.cell-image--placeholder::after{content:'📷';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:.875rem;opacity:.5}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}:host(.loading) .cell-image{opacity:.6;animation:1.5s ease-in-out infinite image-pulse}@keyframes image-pulse{0%,100%{opacity:.6}50%{opacity:.3}}@media (max-width:768px){.image--small{width:1.25rem;height:1.25rem}.image--medium{width:1.75rem;height:1.75rem}.image--large{width:2.5rem;height:2.5rem}}@media (prefers-reduced-motion:reduce){:host(.loading) .cell-image{animation:none}}@media print{.cell-image{max-width:2rem;max-height:2rem}}"}`}init(){this.updateImageAttributes()}updateImageAttributes(){if(this.column?.imageFormat){const e=this.column.imageFormat;this.src=e.src||this.value,this.alt=e.alt||"",this.fallback=e.fallback||"",this.variant=e.variant||"rounded",this.size=e.size||"medium",this.lazy=e.lazy??!0}}handleImageError(){this.imageError=!0}constructor(){super(...arguments),this.value=(i(this,C),i(this,E,"")),this.src=(i(this,D),i(this,z,"")),this.alt=(i(this,A),i(this,$,"")),this.fallback=(i(this,F),i(this,T,"")),this.variant=(i(this,L),i(this,M,"rounded")),this.size=(i(this,R),i(this,B,"medium")),this.lazy=(i(this,j),i(this,I,!0)),this.column=(i(this,O),i(this,P,null)),this.rowData=(i(this,V),i(this,H,null)),this.align=(i(this,N),i(this,q,"center")),this.type=(i(this,_),i(this,W,"image")),this.imageError=(i(this,K),i(this,Y,!1)),i(this,U)}})})(),(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C,E,D,z,A,$,F,T,L,M,R,B,j,I,O,P,V,H,N,q,_,W,K,Y,U,G,J,X,Q,Z,ee,te,ae=[t.element("snice-column")],ie=[],se=HTMLElement,ne=[],le=[],re=[],oe=[],ce=[],de=[],he=[],ue=[],pe=[],me=[],ge=[],be=[],ve=[],ye=[],fe=[],we=[],ke=[],xe=[],Se=[],Ce=[],Ee=[],De=[],ze=[],Ae=[],$e=[],Fe=[],Te=[],Le=[],Me=[],Re=[],Be=[],je=[],Ie=[],Oe=[],Pe=[],Ve=[],He=[],Ne=[],qe=[],_e=[],We=[],Ke=[],Ye=[],Ue=[],Ge=[],Je=[],Xe=[],Qe=[],Ze=[],et=[],tt=[],at=[],it=[],st=[],nt=[],lt=[],rt=[],ot=[],ct=[],dt=[],ht=[],ut=[],pt=[],mt=[],gt=[],bt=[],vt=[],yt=[],ft=[],wt=[],kt=[],xt=[],St=[],Ct=[],Et=[],Dt=[],zt=[],At=[],$t=[],Ft=[],Tt=[],Lt=[],Mt=[],Rt=[],Bt=[];(class extends se{static{s=this}constructor(){super(...arguments),this.key=(i(this,ne),i(this,le,"")),this.label=(i(this,re),i(this,oe,"")),this.type=(i(this,ce),i(this,de,"text")),this.align=(i(this,he),i(this,ue,"left")),this.width=(i(this,pe),i(this,me,"")),this.sortable=(i(this,ge),i(this,be,!0)),this.filterable=(i(this,ve),i(this,ye,!0)),this.wrap=(i(this,fe),i(this,we,!1)),this.ellipsis=(i(this,ke),i(this,xe,!0)),this.tooltip=(i(this,Se),i(this,Ce,!1)),this.decimals=(i(this,Ee),i(this,De,void 0)),this.thousandsSeparator=(i(this,ze),i(this,Ae,void 0)),this.numberPrefix=(i(this,$e),i(this,Fe,void 0)),this.numberSuffix=(i(this,Te),i(this,Le,void 0)),this.negativeStyle=(i(this,Me),i(this,Re,void 0)),this.dateFormat=(i(this,Be),i(this,je,void 0)),this.customDateFormat=(i(this,Ie),i(this,Oe,void 0)),this.dateLocale=(i(this,Pe),i(this,Ve,void 0)),this.trueValue=(i(this,He),i(this,Ne,void 0)),this.falseValue=(i(this,qe),i(this,_e,void 0)),this.useSymbols=(i(this,We),i(this,Ke,void 0)),this.trueSymbol=(i(this,Ye),i(this,Ue,void 0)),this.falseSymbol=(i(this,Ge),i(this,Je,void 0)),this.ratingMax=(i(this,Xe),i(this,Qe,void 0)),this.ratingSymbol=(i(this,Ze),i(this,et,void 0)),this.ratingEmptySymbol=(i(this,tt),i(this,at,void 0)),this.ratingColor=(i(this,it),i(this,st,void 0)),this.progressMax=(i(this,nt),i(this,lt,void 0)),this.showPercentage=(i(this,rt),i(this,ot,void 0)),this.progressColor=(i(this,ct),i(this,dt,void 0)),this.progressBgColor=(i(this,ht),i(this,ut,void 0)),this.progressHeight=(i(this,pt),i(this,mt,void 0)),this.sparklineType=(i(this,gt),i(this,bt,void 0)),this.sparklineColor=(i(this,vt),i(this,yt,void 0)),this.sparklineWidth=(i(this,ft),i(this,wt,void 0)),this.sparklineHeight=(i(this,kt),i(this,xt,void 0)),this.cellBgColor=(i(this,St),i(this,Ct,void 0)),this.cellColor=(i(this,Et),i(this,Dt,void 0)),this.cellFontWeight=(i(this,zt),i(this,At,void 0)),this.cellFontStyle=(i(this,$t),i(this,Ft,void 0)),this.cellFontSize=(i(this,Tt),i(this,Lt,void 0)),this.cellTextDecoration=(i(this,Mt),i(this,Rt,void 0)),this.formatter=i(this,Bt),this.conditionalFormats=[]}static{const jt="function"==typeof Symbol&&Symbol.metadata?Object.create(se[Symbol.metadata]??null):void 0;n=[t.property({})],l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({})],d=[t.property({type:Boolean})],h=[t.property({type:Boolean})],u=[t.property({type:Boolean})],p=[t.property({type:Boolean})],m=[t.property({type:Boolean})],g=[t.property({type:Number,attribute:"decimals"})],b=[t.property({type:Boolean,attribute:"thousands-separator"})],v=[t.property({attribute:"number-prefix"})],y=[t.property({attribute:"number-suffix"})],f=[t.property({attribute:"negative-style"})],w=[t.property({attribute:"date-format"})],k=[t.property({attribute:"custom-date-format"})],x=[t.property({attribute:"date-locale"})],S=[t.property({attribute:"true-value"})],C=[t.property({attribute:"false-value"})],E=[t.property({type:Boolean,attribute:"use-symbols"})],D=[t.property({attribute:"true-symbol"})],z=[t.property({attribute:"false-symbol"})],A=[t.property({type:Number,attribute:"rating-max"})],$=[t.property({attribute:"rating-symbol"})],F=[t.property({attribute:"rating-empty-symbol"})],T=[t.property({attribute:"rating-color"})],L=[t.property({type:Number,attribute:"progress-max"})],M=[t.property({type:Boolean,attribute:"show-percentage"})],R=[t.property({attribute:"progress-color"})],B=[t.property({attribute:"progress-bg-color"})],j=[t.property({attribute:"progress-height"})],I=[t.property({attribute:"sparkline-type"})],O=[t.property({attribute:"sparkline-color"})],P=[t.property({type:Number,attribute:"sparkline-width"})],V=[t.property({type:Number,attribute:"sparkline-height"})],H=[t.property({attribute:"cell-bg-color"})],N=[t.property({attribute:"cell-color"})],q=[t.property({attribute:"cell-font-weight"})],_=[t.property({attribute:"cell-font-style"})],W=[t.property({attribute:"cell-font-size"})],K=[t.property({attribute:"cell-text-decoration"})],Y=[t.render()],U=[t.watch("key","label","type","align","width","sortable","filterable","wrap","ellipsis","tooltip")],G=[t.watch("decimals","thousandsSeparator","numberPrefix","numberSuffix","negativeStyle")],J=[t.watch("dateFormat","customDateFormat","dateLocale")],X=[t.watch("trueValue","falseValue","useSymbols","trueSymbol","falseSymbol")],Q=[t.watch("ratingMax","ratingSymbol","ratingEmptySymbol","ratingColor")],Z=[t.watch("progressMax","showPercentage","progressColor","progressBgColor","progressHeight")],ee=[t.watch("sparklineType","sparklineColor","sparklineWidth","sparklineHeight")],te=[t.watch("cellBgColor","cellColor","cellFontWeight","cellFontStyle","cellFontSize","cellTextDecoration")],a(this,null,Y,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:jt},null,ne),a(this,null,U,{kind:"method",name:"handleBasicPropsChange",static:!1,private:!1,access:{has:e=>"handleBasicPropsChange"in e,get:e=>e.handleBasicPropsChange},metadata:jt},null,ne),a(this,null,G,{kind:"method",name:"handleNumberFormatChange",static:!1,private:!1,access:{has:e=>"handleNumberFormatChange"in e,get:e=>e.handleNumberFormatChange},metadata:jt},null,ne),a(this,null,J,{kind:"method",name:"handleDateFormatChange",static:!1,private:!1,access:{has:e=>"handleDateFormatChange"in e,get:e=>e.handleDateFormatChange},metadata:jt},null,ne),a(this,null,X,{kind:"method",name:"handleBooleanFormatChange",static:!1,private:!1,access:{has:e=>"handleBooleanFormatChange"in e,get:e=>e.handleBooleanFormatChange},metadata:jt},null,ne),a(this,null,Q,{kind:"method",name:"handleRatingFormatChange",static:!1,private:!1,access:{has:e=>"handleRatingFormatChange"in e,get:e=>e.handleRatingFormatChange},metadata:jt},null,ne),a(this,null,Z,{kind:"method",name:"handleProgressFormatChange",static:!1,private:!1,access:{has:e=>"handleProgressFormatChange"in e,get:e=>e.handleProgressFormatChange},metadata:jt},null,ne),a(this,null,ee,{kind:"method",name:"handleSparklineFormatChange",static:!1,private:!1,access:{has:e=>"handleSparklineFormatChange"in e,get:e=>e.handleSparklineFormatChange},metadata:jt},null,ne),a(this,null,te,{kind:"method",name:"handleStyleChange",static:!1,private:!1,access:{has:e=>"handleStyleChange"in e,get:e=>e.handleStyleChange},metadata:jt},null,ne),a(null,null,n,{kind:"field",name:"key",static:!1,private:!1,access:{has:e=>"key"in e,get:e=>e.key,set:(e,t)=>{e.key=t}},metadata:jt},le,re),a(null,null,l,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:jt},oe,ce),a(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:jt},de,he),a(null,null,o,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:jt},ue,pe),a(null,null,c,{kind:"field",name:"width",static:!1,private:!1,access:{has:e=>"width"in e,get:e=>e.width,set:(e,t)=>{e.width=t}},metadata:jt},me,ge),a(null,null,d,{kind:"field",name:"sortable",static:!1,private:!1,access:{has:e=>"sortable"in e,get:e=>e.sortable,set:(e,t)=>{e.sortable=t}},metadata:jt},be,ve),a(null,null,h,{kind:"field",name:"filterable",static:!1,private:!1,access:{has:e=>"filterable"in e,get:e=>e.filterable,set:(e,t)=>{e.filterable=t}},metadata:jt},ye,fe),a(null,null,u,{kind:"field",name:"wrap",static:!1,private:!1,access:{has:e=>"wrap"in e,get:e=>e.wrap,set:(e,t)=>{e.wrap=t}},metadata:jt},we,ke),a(null,null,p,{kind:"field",name:"ellipsis",static:!1,private:!1,access:{has:e=>"ellipsis"in e,get:e=>e.ellipsis,set:(e,t)=>{e.ellipsis=t}},metadata:jt},xe,Se),a(null,null,m,{kind:"field",name:"tooltip",static:!1,private:!1,access:{has:e=>"tooltip"in e,get:e=>e.tooltip,set:(e,t)=>{e.tooltip=t}},metadata:jt},Ce,Ee),a(null,null,g,{kind:"field",name:"decimals",static:!1,private:!1,access:{has:e=>"decimals"in e,get:e=>e.decimals,set:(e,t)=>{e.decimals=t}},metadata:jt},De,ze),a(null,null,b,{kind:"field",name:"thousandsSeparator",static:!1,private:!1,access:{has:e=>"thousandsSeparator"in e,get:e=>e.thousandsSeparator,set:(e,t)=>{e.thousandsSeparator=t}},metadata:jt},Ae,$e),a(null,null,v,{kind:"field",name:"numberPrefix",static:!1,private:!1,access:{has:e=>"numberPrefix"in e,get:e=>e.numberPrefix,set:(e,t)=>{e.numberPrefix=t}},metadata:jt},Fe,Te),a(null,null,y,{kind:"field",name:"numberSuffix",static:!1,private:!1,access:{has:e=>"numberSuffix"in e,get:e=>e.numberSuffix,set:(e,t)=>{e.numberSuffix=t}},metadata:jt},Le,Me),a(null,null,f,{kind:"field",name:"negativeStyle",static:!1,private:!1,access:{has:e=>"negativeStyle"in e,get:e=>e.negativeStyle,set:(e,t)=>{e.negativeStyle=t}},metadata:jt},Re,Be),a(null,null,w,{kind:"field",name:"dateFormat",static:!1,private:!1,access:{has:e=>"dateFormat"in e,get:e=>e.dateFormat,set:(e,t)=>{e.dateFormat=t}},metadata:jt},je,Ie),a(null,null,k,{kind:"field",name:"customDateFormat",static:!1,private:!1,access:{has:e=>"customDateFormat"in e,get:e=>e.customDateFormat,set:(e,t)=>{e.customDateFormat=t}},metadata:jt},Oe,Pe),a(null,null,x,{kind:"field",name:"dateLocale",static:!1,private:!1,access:{has:e=>"dateLocale"in e,get:e=>e.dateLocale,set:(e,t)=>{e.dateLocale=t}},metadata:jt},Ve,He),a(null,null,S,{kind:"field",name:"trueValue",static:!1,private:!1,access:{has:e=>"trueValue"in e,get:e=>e.trueValue,set:(e,t)=>{e.trueValue=t}},metadata:jt},Ne,qe),a(null,null,C,{kind:"field",name:"falseValue",static:!1,private:!1,access:{has:e=>"falseValue"in e,get:e=>e.falseValue,set:(e,t)=>{e.falseValue=t}},metadata:jt},_e,We),a(null,null,E,{kind:"field",name:"useSymbols",static:!1,private:!1,access:{has:e=>"useSymbols"in e,get:e=>e.useSymbols,set:(e,t)=>{e.useSymbols=t}},metadata:jt},Ke,Ye),a(null,null,D,{kind:"field",name:"trueSymbol",static:!1,private:!1,access:{has:e=>"trueSymbol"in e,get:e=>e.trueSymbol,set:(e,t)=>{e.trueSymbol=t}},metadata:jt},Ue,Ge),a(null,null,z,{kind:"field",name:"falseSymbol",static:!1,private:!1,access:{has:e=>"falseSymbol"in e,get:e=>e.falseSymbol,set:(e,t)=>{e.falseSymbol=t}},metadata:jt},Je,Xe),a(null,null,A,{kind:"field",name:"ratingMax",static:!1,private:!1,access:{has:e=>"ratingMax"in e,get:e=>e.ratingMax,set:(e,t)=>{e.ratingMax=t}},metadata:jt},Qe,Ze),a(null,null,$,{kind:"field",name:"ratingSymbol",static:!1,private:!1,access:{has:e=>"ratingSymbol"in e,get:e=>e.ratingSymbol,set:(e,t)=>{e.ratingSymbol=t}},metadata:jt},et,tt),a(null,null,F,{kind:"field",name:"ratingEmptySymbol",static:!1,private:!1,access:{has:e=>"ratingEmptySymbol"in e,get:e=>e.ratingEmptySymbol,set:(e,t)=>{e.ratingEmptySymbol=t}},metadata:jt},at,it),a(null,null,T,{kind:"field",name:"ratingColor",static:!1,private:!1,access:{has:e=>"ratingColor"in e,get:e=>e.ratingColor,set:(e,t)=>{e.ratingColor=t}},metadata:jt},st,nt),a(null,null,L,{kind:"field",name:"progressMax",static:!1,private:!1,access:{has:e=>"progressMax"in e,get:e=>e.progressMax,set:(e,t)=>{e.progressMax=t}},metadata:jt},lt,rt),a(null,null,M,{kind:"field",name:"showPercentage",static:!1,private:!1,access:{has:e=>"showPercentage"in e,get:e=>e.showPercentage,set:(e,t)=>{e.showPercentage=t}},metadata:jt},ot,ct),a(null,null,R,{kind:"field",name:"progressColor",static:!1,private:!1,access:{has:e=>"progressColor"in e,get:e=>e.progressColor,set:(e,t)=>{e.progressColor=t}},metadata:jt},dt,ht),a(null,null,B,{kind:"field",name:"progressBgColor",static:!1,private:!1,access:{has:e=>"progressBgColor"in e,get:e=>e.progressBgColor,set:(e,t)=>{e.progressBgColor=t}},metadata:jt},ut,pt),a(null,null,j,{kind:"field",name:"progressHeight",static:!1,private:!1,access:{has:e=>"progressHeight"in e,get:e=>e.progressHeight,set:(e,t)=>{e.progressHeight=t}},metadata:jt},mt,gt),a(null,null,I,{kind:"field",name:"sparklineType",static:!1,private:!1,access:{has:e=>"sparklineType"in e,get:e=>e.sparklineType,set:(e,t)=>{e.sparklineType=t}},metadata:jt},bt,vt),a(null,null,O,{kind:"field",name:"sparklineColor",static:!1,private:!1,access:{has:e=>"sparklineColor"in e,get:e=>e.sparklineColor,set:(e,t)=>{e.sparklineColor=t}},metadata:jt},yt,ft),a(null,null,P,{kind:"field",name:"sparklineWidth",static:!1,private:!1,access:{has:e=>"sparklineWidth"in e,get:e=>e.sparklineWidth,set:(e,t)=>{e.sparklineWidth=t}},metadata:jt},wt,kt),a(null,null,V,{kind:"field",name:"sparklineHeight",static:!1,private:!1,access:{has:e=>"sparklineHeight"in e,get:e=>e.sparklineHeight,set:(e,t)=>{e.sparklineHeight=t}},metadata:jt},xt,St),a(null,null,H,{kind:"field",name:"cellBgColor",static:!1,private:!1,access:{has:e=>"cellBgColor"in e,get:e=>e.cellBgColor,set:(e,t)=>{e.cellBgColor=t}},metadata:jt},Ct,Et),a(null,null,N,{kind:"field",name:"cellColor",static:!1,private:!1,access:{has:e=>"cellColor"in e,get:e=>e.cellColor,set:(e,t)=>{e.cellColor=t}},metadata:jt},Dt,zt),a(null,null,q,{kind:"field",name:"cellFontWeight",static:!1,private:!1,access:{has:e=>"cellFontWeight"in e,get:e=>e.cellFontWeight,set:(e,t)=>{e.cellFontWeight=t}},metadata:jt},At,$t),a(null,null,_,{kind:"field",name:"cellFontStyle",static:!1,private:!1,access:{has:e=>"cellFontStyle"in e,get:e=>e.cellFontStyle,set:(e,t)=>{e.cellFontStyle=t}},metadata:jt},Ft,Tt),a(null,null,W,{kind:"field",name:"cellFontSize",static:!1,private:!1,access:{has:e=>"cellFontSize"in e,get:e=>e.cellFontSize,set:(e,t)=>{e.cellFontSize=t}},metadata:jt},Lt,Mt),a(null,null,K,{kind:"field",name:"cellTextDecoration",static:!1,private:!1,access:{has:e=>"cellTextDecoration"in e,get:e=>e.cellTextDecoration,set:(e,t)=>{e.cellTextDecoration=t}},metadata:jt},Rt,Bt),a(null,e={value:s},ae,{kind:"class",name:s.name,metadata:jt},null,ie),s=e.value,jt&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:jt}),i(s,ie)}render(){return t.html`<slot></slot>`}setFormatter(e){this.formatter=e,this.notifyTableOfChange()}addConditionalFormat(e){this.conditionalFormats.push(e),this.notifyTableOfChange()}removeConditionalFormat(e){this.conditionalFormats.splice(e,1),this.notifyTableOfChange()}clearConditionalFormats(){this.conditionalFormats=[],this.notifyTableOfChange()}getColumnDefinition(){const e={key:this.key,label:this.label,type:this.type,align:this.align,width:this.width,sortable:this.sortable,filterable:this.filterable,wrap:this.wrap,ellipsis:this.ellipsis,tooltip:this.tooltip,formatter:this.formatter,conditionalFormats:this.conditionalFormats};if("number"===this.type||"currency"===this.type||"percent"===this.type||"accounting"===this.type||"scientific"===this.type||"fraction"===this.type){const t={};void 0!==this.decimals&&(t.decimals=this.decimals),void 0!==this.thousandsSeparator&&(t.thousandsSeparator=this.thousandsSeparator),this.numberPrefix&&(t.prefix=this.numberPrefix),this.numberSuffix&&(t.suffix=this.numberSuffix),this.negativeStyle&&(t.negativeStyle=this.negativeStyle),Object.keys(t).length>0&&(e.numberFormat=t)}if("date"===this.type){const t={};this.dateFormat&&(t.format=this.dateFormat),this.customDateFormat&&(t.customFormat=this.customDateFormat),this.dateLocale&&(t.locale=this.dateLocale),Object.keys(t).length>0&&(e.dateFormat=t)}if("boolean"===this.type){const t={};this.trueValue&&(t.trueValue=this.trueValue),this.falseValue&&(t.falseValue=this.falseValue),void 0!==this.useSymbols&&(t.useSymbols=this.useSymbols),this.trueSymbol&&(t.trueSymbol=this.trueSymbol),this.falseSymbol&&(t.falseSymbol=this.falseSymbol),Object.keys(t).length>0&&(e.booleanFormat=t)}if("rating"===this.type){const t={};void 0!==this.ratingMax&&(t.max=this.ratingMax),this.ratingSymbol&&(t.symbol=this.ratingSymbol),this.ratingEmptySymbol&&(t.emptySymbol=this.ratingEmptySymbol),this.ratingColor&&(t.color=this.ratingColor),Object.keys(t).length>0&&(e.ratingFormat=t)}if("progress"===this.type){const t={};void 0!==this.progressMax&&(t.max=this.progressMax),void 0!==this.showPercentage&&(t.showPercentage=this.showPercentage),this.progressColor&&(t.color=this.progressColor),this.progressBgColor&&(t.backgroundColor=this.progressBgColor),this.progressHeight&&(t.height=this.progressHeight),Object.keys(t).length>0&&(e.progressFormat=t)}if("sparkline"===this.type){const t={};this.sparklineType&&(t.type=this.sparklineType),this.sparklineColor&&(t.color=this.sparklineColor),void 0!==this.sparklineWidth&&(t.width=this.sparklineWidth),void 0!==this.sparklineHeight&&(t.height=this.sparklineHeight),Object.keys(t).length>0&&(e.sparklineFormat=t)}const t={};return this.cellBgColor&&(t.backgroundColor=this.cellBgColor),this.cellColor&&(t.color=this.cellColor),this.cellFontWeight&&(t.fontWeight=this.cellFontWeight),this.cellFontStyle&&(t.fontStyle=this.cellFontStyle),this.cellFontSize&&(t.fontSize=this.cellFontSize),this.cellTextDecoration&&(t.textDecoration=this.cellTextDecoration),Object.keys(t).length>0&&(e.style=t),e}handleBasicPropsChange(){this.notifyTableOfChange()}handleNumberFormatChange(){"number"!==this.type&&"currency"!==this.type&&"percent"!==this.type&&"accounting"!==this.type&&"scientific"!==this.type&&"fraction"!==this.type||this.notifyTableOfChange()}handleDateFormatChange(){"date"===this.type&&this.notifyTableOfChange()}handleBooleanFormatChange(){"boolean"===this.type&&this.notifyTableOfChange()}handleRatingFormatChange(){"rating"===this.type&&this.notifyTableOfChange()}handleProgressFormatChange(){"progress"===this.type&&this.notifyTableOfChange()}handleSparklineFormatChange(){"sparkline"===this.type&&this.notifyTableOfChange()}handleStyleChange(){this.notifyTableOfChange()}notifyTableOfChange(){this.dispatchEvent(new CustomEvent("column-changed",{detail:{column:this.getColumnDefinition()},bubbles:!0,composed:!0}))}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k=[t.element("snice-row")],x=[],S=HTMLElement,C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[];(class extends S{static{s=this}static{const P="function"==typeof Symbol&&Symbol.metadata?Object.create(S[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean})],l=[t.property({type:Boolean})],r=[t.property({type:Boolean})],o=[t.property({type:Boolean})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Number})],h=[t.property({type:Array,attribute:!1})],u=[t.render()],p=[t.styles()],m=[t.ready()],g=[t.watch("selected")],b=[t.watch("hoverable","clickable","selectable")],v=[t.watch("data","columns")],y=[t.dispatch("row-click",{bubbles:!0,composed:!0})],f=[t.dispatch("row-select",{bubbles:!0,composed:!0})],w=[t.dispatch("row-hover",{bubbles:!0,composed:!0})],a(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:P},null,C),a(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:P},null,C),a(this,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:P},null,C),a(this,null,g,{kind:"method",name:"updateSelection",static:!1,private:!1,access:{has:e=>"updateSelection"in e,get:e=>e.updateSelection},metadata:P},null,C),a(this,null,b,{kind:"method",name:"updateRowAttributes",static:!1,private:!1,access:{has:e=>"updateRowAttributes"in e,get:e=>e.updateRowAttributes},metadata:P},null,C),a(this,null,v,{kind:"method",name:"updateCells",static:!1,private:!1,access:{has:e=>"updateCells"in e,get:e=>e.updateCells},metadata:P},null,C),a(this,null,y,{kind:"method",name:"dispatchRowClick",static:!1,private:!1,access:{has:e=>"dispatchRowClick"in e,get:e=>e.dispatchRowClick},metadata:P},null,C),a(this,null,f,{kind:"method",name:"dispatchRowSelect",static:!1,private:!1,access:{has:e=>"dispatchRowSelect"in e,get:e=>e.dispatchRowSelect},metadata:P},null,C),a(this,null,w,{kind:"method",name:"dispatchRowHover",static:!1,private:!1,access:{has:e=>"dispatchRowHover"in e,get:e=>e.dispatchRowHover},metadata:P},null,C),a(null,null,n,{kind:"field",name:"selected",static:!1,private:!1,access:{has:e=>"selected"in e,get:e=>e.selected,set:(e,t)=>{e.selected=t}},metadata:P},E,D),a(null,null,l,{kind:"field",name:"hoverable",static:!1,private:!1,access:{has:e=>"hoverable"in e,get:e=>e.hoverable,set:(e,t)=>{e.hoverable=t}},metadata:P},z,A),a(null,null,r,{kind:"field",name:"clickable",static:!1,private:!1,access:{has:e=>"clickable"in e,get:e=>e.clickable,set:(e,t)=>{e.clickable=t}},metadata:P},$,F),a(null,null,o,{kind:"field",name:"selectable",static:!1,private:!1,access:{has:e=>"selectable"in e,get:e=>e.selectable,set:(e,t)=>{e.selectable=t}},metadata:P},T,L),a(null,null,c,{kind:"field",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:P},M,R),a(null,null,d,{kind:"field",name:"index",static:!1,private:!1,access:{has:e=>"index"in e,get:e=>e.index,set:(e,t)=>{e.index=t}},metadata:P},B,j),a(null,null,h,{kind:"field",name:"columns",static:!1,private:!1,access:{has:e=>"columns"in e,get:e=>e.columns,set:(e,t)=>{e.columns=t}},metadata:P},I,O),a(null,e={value:s},k,{kind:"class",name:s.name,metadata:P},null,x),s=e.value,P&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:P}),i(s,x)}extractDataFromAttributes(){const e={};return this.getAttributeNames().filter(e=>e.startsWith("data-")&&"data-column-index"!==e).forEach(t=>{const a=t.slice(5),i=this.getAttribute(t);null!==i&&(e[a]=i)}),e}render(){return t.html`
|
|
536
|
+
`}styles(){return t.css`${":host{color:var(--snice-color-text,rgb(23 23 23));display:flex;align-items:center;min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;font-size:.875rem;line-height:1.25rem}.cell-content{width:100%;min-width:6.25rem;min-height:1.25rem;display:flex;align-items:center}.cell-image{display:block;object-fit:cover;background-color:rgb(243 244 246)}.image--small{width:1.5rem;height:1.5rem}.image--medium{width:2rem;height:2rem}.image--large{width:3rem;height:3rem}.image--rounded{border-radius:.25rem}.image--square{border-radius:0}.image--circle{border-radius:50%}.cell-image--placeholder{background:linear-gradient(135deg,rgb(229 231 235) 0,rgb(209 213 219) 100%);border:1px solid rgb(209 213 219);position:relative}.cell-image--placeholder::after{content:'📷';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:.875rem;opacity:.5}:host([align=left]) .cell-content{justify-content:flex-start}:host([align=center]) .cell-content{justify-content:center}:host([align=right]) .cell-content{justify-content:flex-end}:host(.loading) .cell-image{opacity:.6;animation:1.5s ease-in-out infinite image-pulse}@keyframes image-pulse{0%,100%{opacity:.6}50%{opacity:.3}}@media (max-width:768px){.image--small{width:1.25rem;height:1.25rem}.image--medium{width:1.75rem;height:1.75rem}.image--large{width:2.5rem;height:2.5rem}}@media (prefers-reduced-motion:reduce){:host(.loading) .cell-image{animation:none}}@media print{.cell-image{max-width:2rem;max-height:2rem}}"}`}init(){this.updateImageAttributes()}updateImageAttributes(){if(this.column?.imageFormat){const e=this.column.imageFormat;this.src=e.src||this.value,this.alt=e.alt||"",this.fallback=e.fallback||"",this.variant=e.variant||"rounded",this.size=e.size||"medium",this.lazy=e.lazy??!0}}handleImageError(){this.imageError=!0}constructor(){super(...arguments),this.value=(a(this,C),a(this,E,"")),this.src=(a(this,D),a(this,z,"")),this.alt=(a(this,A),a(this,$,"")),this.fallback=(a(this,F),a(this,T,"")),this.variant=(a(this,L),a(this,M,"rounded")),this.size=(a(this,R),a(this,B,"medium")),this.lazy=(a(this,j),a(this,I,!0)),this.column=(a(this,O),a(this,P,null)),this.rowData=(a(this,V),a(this,H,null)),this.align=(a(this,N),a(this,q,"center")),this.type=(a(this,_),a(this,W,"image")),this.imageError=(a(this,K),a(this,Y,!1)),a(this,U)}})})(),(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k,x,S,C,E,D,z,A,$,F,T,L,M,R,B,j,I,O,P,V,H,N,q,_,W,K,Y,U,G,J,X,Q,Z,ee,te,ie=[t.element("snice-column")],ae=[],se=HTMLElement,ne=[],le=[],re=[],oe=[],ce=[],de=[],he=[],ue=[],pe=[],me=[],ge=[],be=[],ve=[],ye=[],fe=[],we=[],ke=[],xe=[],Se=[],Ce=[],Ee=[],De=[],ze=[],Ae=[],$e=[],Fe=[],Te=[],Le=[],Me=[],Re=[],Be=[],je=[],Ie=[],Oe=[],Pe=[],Ve=[],He=[],Ne=[],qe=[],_e=[],We=[],Ke=[],Ye=[],Ue=[],Ge=[],Je=[],Xe=[],Qe=[],Ze=[],et=[],tt=[],it=[],at=[],st=[],nt=[],lt=[],rt=[],ot=[],ct=[],dt=[],ht=[],ut=[],pt=[],mt=[],gt=[],bt=[],vt=[],yt=[],ft=[],wt=[],kt=[],xt=[],St=[],Ct=[],Et=[],Dt=[],zt=[],At=[],$t=[],Ft=[],Tt=[],Lt=[],Mt=[],Rt=[],Bt=[];(class extends se{static{s=this}constructor(){super(...arguments),this.key=(a(this,ne),a(this,le,"")),this.label=(a(this,re),a(this,oe,"")),this.type=(a(this,ce),a(this,de,"text")),this.align=(a(this,he),a(this,ue,"left")),this.width=(a(this,pe),a(this,me,"")),this.sortable=(a(this,ge),a(this,be,!0)),this.filterable=(a(this,ve),a(this,ye,!0)),this.wrap=(a(this,fe),a(this,we,!1)),this.ellipsis=(a(this,ke),a(this,xe,!0)),this.tooltip=(a(this,Se),a(this,Ce,!1)),this.decimals=(a(this,Ee),a(this,De,void 0)),this.thousandsSeparator=(a(this,ze),a(this,Ae,void 0)),this.numberPrefix=(a(this,$e),a(this,Fe,void 0)),this.numberSuffix=(a(this,Te),a(this,Le,void 0)),this.negativeStyle=(a(this,Me),a(this,Re,void 0)),this.dateFormat=(a(this,Be),a(this,je,void 0)),this.customDateFormat=(a(this,Ie),a(this,Oe,void 0)),this.dateLocale=(a(this,Pe),a(this,Ve,void 0)),this.trueValue=(a(this,He),a(this,Ne,void 0)),this.falseValue=(a(this,qe),a(this,_e,void 0)),this.useSymbols=(a(this,We),a(this,Ke,void 0)),this.trueSymbol=(a(this,Ye),a(this,Ue,void 0)),this.falseSymbol=(a(this,Ge),a(this,Je,void 0)),this.ratingMax=(a(this,Xe),a(this,Qe,void 0)),this.ratingSymbol=(a(this,Ze),a(this,et,void 0)),this.ratingEmptySymbol=(a(this,tt),a(this,it,void 0)),this.ratingColor=(a(this,at),a(this,st,void 0)),this.progressMax=(a(this,nt),a(this,lt,void 0)),this.showPercentage=(a(this,rt),a(this,ot,void 0)),this.progressColor=(a(this,ct),a(this,dt,void 0)),this.progressBgColor=(a(this,ht),a(this,ut,void 0)),this.progressHeight=(a(this,pt),a(this,mt,void 0)),this.sparklineType=(a(this,gt),a(this,bt,void 0)),this.sparklineColor=(a(this,vt),a(this,yt,void 0)),this.sparklineWidth=(a(this,ft),a(this,wt,void 0)),this.sparklineHeight=(a(this,kt),a(this,xt,void 0)),this.cellBgColor=(a(this,St),a(this,Ct,void 0)),this.cellColor=(a(this,Et),a(this,Dt,void 0)),this.cellFontWeight=(a(this,zt),a(this,At,void 0)),this.cellFontStyle=(a(this,$t),a(this,Ft,void 0)),this.cellFontSize=(a(this,Tt),a(this,Lt,void 0)),this.cellTextDecoration=(a(this,Mt),a(this,Rt,void 0)),this.formatter=a(this,Bt),this.conditionalFormats=[]}static{const jt="function"==typeof Symbol&&Symbol.metadata?Object.create(se[Symbol.metadata]??null):void 0;n=[t.property({})],l=[t.property({})],r=[t.property({})],o=[t.property({})],c=[t.property({})],d=[t.property({type:Boolean})],h=[t.property({type:Boolean})],u=[t.property({type:Boolean})],p=[t.property({type:Boolean})],m=[t.property({type:Boolean})],g=[t.property({type:Number,attribute:"decimals"})],b=[t.property({type:Boolean,attribute:"thousands-separator"})],v=[t.property({attribute:"number-prefix"})],y=[t.property({attribute:"number-suffix"})],f=[t.property({attribute:"negative-style"})],w=[t.property({attribute:"date-format"})],k=[t.property({attribute:"custom-date-format"})],x=[t.property({attribute:"date-locale"})],S=[t.property({attribute:"true-value"})],C=[t.property({attribute:"false-value"})],E=[t.property({type:Boolean,attribute:"use-symbols"})],D=[t.property({attribute:"true-symbol"})],z=[t.property({attribute:"false-symbol"})],A=[t.property({type:Number,attribute:"rating-max"})],$=[t.property({attribute:"rating-symbol"})],F=[t.property({attribute:"rating-empty-symbol"})],T=[t.property({attribute:"rating-color"})],L=[t.property({type:Number,attribute:"progress-max"})],M=[t.property({type:Boolean,attribute:"show-percentage"})],R=[t.property({attribute:"progress-color"})],B=[t.property({attribute:"progress-bg-color"})],j=[t.property({attribute:"progress-height"})],I=[t.property({attribute:"sparkline-type"})],O=[t.property({attribute:"sparkline-color"})],P=[t.property({type:Number,attribute:"sparkline-width"})],V=[t.property({type:Number,attribute:"sparkline-height"})],H=[t.property({attribute:"cell-bg-color"})],N=[t.property({attribute:"cell-color"})],q=[t.property({attribute:"cell-font-weight"})],_=[t.property({attribute:"cell-font-style"})],W=[t.property({attribute:"cell-font-size"})],K=[t.property({attribute:"cell-text-decoration"})],Y=[t.render()],U=[t.watch("key","label","type","align","width","sortable","filterable","wrap","ellipsis","tooltip")],G=[t.watch("decimals","thousandsSeparator","numberPrefix","numberSuffix","negativeStyle")],J=[t.watch("dateFormat","customDateFormat","dateLocale")],X=[t.watch("trueValue","falseValue","useSymbols","trueSymbol","falseSymbol")],Q=[t.watch("ratingMax","ratingSymbol","ratingEmptySymbol","ratingColor")],Z=[t.watch("progressMax","showPercentage","progressColor","progressBgColor","progressHeight")],ee=[t.watch("sparklineType","sparklineColor","sparklineWidth","sparklineHeight")],te=[t.watch("cellBgColor","cellColor","cellFontWeight","cellFontStyle","cellFontSize","cellTextDecoration")],i(this,null,Y,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:jt},null,ne),i(this,null,U,{kind:"method",name:"handleBasicPropsChange",static:!1,private:!1,access:{has:e=>"handleBasicPropsChange"in e,get:e=>e.handleBasicPropsChange},metadata:jt},null,ne),i(this,null,G,{kind:"method",name:"handleNumberFormatChange",static:!1,private:!1,access:{has:e=>"handleNumberFormatChange"in e,get:e=>e.handleNumberFormatChange},metadata:jt},null,ne),i(this,null,J,{kind:"method",name:"handleDateFormatChange",static:!1,private:!1,access:{has:e=>"handleDateFormatChange"in e,get:e=>e.handleDateFormatChange},metadata:jt},null,ne),i(this,null,X,{kind:"method",name:"handleBooleanFormatChange",static:!1,private:!1,access:{has:e=>"handleBooleanFormatChange"in e,get:e=>e.handleBooleanFormatChange},metadata:jt},null,ne),i(this,null,Q,{kind:"method",name:"handleRatingFormatChange",static:!1,private:!1,access:{has:e=>"handleRatingFormatChange"in e,get:e=>e.handleRatingFormatChange},metadata:jt},null,ne),i(this,null,Z,{kind:"method",name:"handleProgressFormatChange",static:!1,private:!1,access:{has:e=>"handleProgressFormatChange"in e,get:e=>e.handleProgressFormatChange},metadata:jt},null,ne),i(this,null,ee,{kind:"method",name:"handleSparklineFormatChange",static:!1,private:!1,access:{has:e=>"handleSparklineFormatChange"in e,get:e=>e.handleSparklineFormatChange},metadata:jt},null,ne),i(this,null,te,{kind:"method",name:"handleStyleChange",static:!1,private:!1,access:{has:e=>"handleStyleChange"in e,get:e=>e.handleStyleChange},metadata:jt},null,ne),i(null,null,n,{kind:"field",name:"key",static:!1,private:!1,access:{has:e=>"key"in e,get:e=>e.key,set:(e,t)=>{e.key=t}},metadata:jt},le,re),i(null,null,l,{kind:"field",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:jt},oe,ce),i(null,null,r,{kind:"field",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:jt},de,he),i(null,null,o,{kind:"field",name:"align",static:!1,private:!1,access:{has:e=>"align"in e,get:e=>e.align,set:(e,t)=>{e.align=t}},metadata:jt},ue,pe),i(null,null,c,{kind:"field",name:"width",static:!1,private:!1,access:{has:e=>"width"in e,get:e=>e.width,set:(e,t)=>{e.width=t}},metadata:jt},me,ge),i(null,null,d,{kind:"field",name:"sortable",static:!1,private:!1,access:{has:e=>"sortable"in e,get:e=>e.sortable,set:(e,t)=>{e.sortable=t}},metadata:jt},be,ve),i(null,null,h,{kind:"field",name:"filterable",static:!1,private:!1,access:{has:e=>"filterable"in e,get:e=>e.filterable,set:(e,t)=>{e.filterable=t}},metadata:jt},ye,fe),i(null,null,u,{kind:"field",name:"wrap",static:!1,private:!1,access:{has:e=>"wrap"in e,get:e=>e.wrap,set:(e,t)=>{e.wrap=t}},metadata:jt},we,ke),i(null,null,p,{kind:"field",name:"ellipsis",static:!1,private:!1,access:{has:e=>"ellipsis"in e,get:e=>e.ellipsis,set:(e,t)=>{e.ellipsis=t}},metadata:jt},xe,Se),i(null,null,m,{kind:"field",name:"tooltip",static:!1,private:!1,access:{has:e=>"tooltip"in e,get:e=>e.tooltip,set:(e,t)=>{e.tooltip=t}},metadata:jt},Ce,Ee),i(null,null,g,{kind:"field",name:"decimals",static:!1,private:!1,access:{has:e=>"decimals"in e,get:e=>e.decimals,set:(e,t)=>{e.decimals=t}},metadata:jt},De,ze),i(null,null,b,{kind:"field",name:"thousandsSeparator",static:!1,private:!1,access:{has:e=>"thousandsSeparator"in e,get:e=>e.thousandsSeparator,set:(e,t)=>{e.thousandsSeparator=t}},metadata:jt},Ae,$e),i(null,null,v,{kind:"field",name:"numberPrefix",static:!1,private:!1,access:{has:e=>"numberPrefix"in e,get:e=>e.numberPrefix,set:(e,t)=>{e.numberPrefix=t}},metadata:jt},Fe,Te),i(null,null,y,{kind:"field",name:"numberSuffix",static:!1,private:!1,access:{has:e=>"numberSuffix"in e,get:e=>e.numberSuffix,set:(e,t)=>{e.numberSuffix=t}},metadata:jt},Le,Me),i(null,null,f,{kind:"field",name:"negativeStyle",static:!1,private:!1,access:{has:e=>"negativeStyle"in e,get:e=>e.negativeStyle,set:(e,t)=>{e.negativeStyle=t}},metadata:jt},Re,Be),i(null,null,w,{kind:"field",name:"dateFormat",static:!1,private:!1,access:{has:e=>"dateFormat"in e,get:e=>e.dateFormat,set:(e,t)=>{e.dateFormat=t}},metadata:jt},je,Ie),i(null,null,k,{kind:"field",name:"customDateFormat",static:!1,private:!1,access:{has:e=>"customDateFormat"in e,get:e=>e.customDateFormat,set:(e,t)=>{e.customDateFormat=t}},metadata:jt},Oe,Pe),i(null,null,x,{kind:"field",name:"dateLocale",static:!1,private:!1,access:{has:e=>"dateLocale"in e,get:e=>e.dateLocale,set:(e,t)=>{e.dateLocale=t}},metadata:jt},Ve,He),i(null,null,S,{kind:"field",name:"trueValue",static:!1,private:!1,access:{has:e=>"trueValue"in e,get:e=>e.trueValue,set:(e,t)=>{e.trueValue=t}},metadata:jt},Ne,qe),i(null,null,C,{kind:"field",name:"falseValue",static:!1,private:!1,access:{has:e=>"falseValue"in e,get:e=>e.falseValue,set:(e,t)=>{e.falseValue=t}},metadata:jt},_e,We),i(null,null,E,{kind:"field",name:"useSymbols",static:!1,private:!1,access:{has:e=>"useSymbols"in e,get:e=>e.useSymbols,set:(e,t)=>{e.useSymbols=t}},metadata:jt},Ke,Ye),i(null,null,D,{kind:"field",name:"trueSymbol",static:!1,private:!1,access:{has:e=>"trueSymbol"in e,get:e=>e.trueSymbol,set:(e,t)=>{e.trueSymbol=t}},metadata:jt},Ue,Ge),i(null,null,z,{kind:"field",name:"falseSymbol",static:!1,private:!1,access:{has:e=>"falseSymbol"in e,get:e=>e.falseSymbol,set:(e,t)=>{e.falseSymbol=t}},metadata:jt},Je,Xe),i(null,null,A,{kind:"field",name:"ratingMax",static:!1,private:!1,access:{has:e=>"ratingMax"in e,get:e=>e.ratingMax,set:(e,t)=>{e.ratingMax=t}},metadata:jt},Qe,Ze),i(null,null,$,{kind:"field",name:"ratingSymbol",static:!1,private:!1,access:{has:e=>"ratingSymbol"in e,get:e=>e.ratingSymbol,set:(e,t)=>{e.ratingSymbol=t}},metadata:jt},et,tt),i(null,null,F,{kind:"field",name:"ratingEmptySymbol",static:!1,private:!1,access:{has:e=>"ratingEmptySymbol"in e,get:e=>e.ratingEmptySymbol,set:(e,t)=>{e.ratingEmptySymbol=t}},metadata:jt},it,at),i(null,null,T,{kind:"field",name:"ratingColor",static:!1,private:!1,access:{has:e=>"ratingColor"in e,get:e=>e.ratingColor,set:(e,t)=>{e.ratingColor=t}},metadata:jt},st,nt),i(null,null,L,{kind:"field",name:"progressMax",static:!1,private:!1,access:{has:e=>"progressMax"in e,get:e=>e.progressMax,set:(e,t)=>{e.progressMax=t}},metadata:jt},lt,rt),i(null,null,M,{kind:"field",name:"showPercentage",static:!1,private:!1,access:{has:e=>"showPercentage"in e,get:e=>e.showPercentage,set:(e,t)=>{e.showPercentage=t}},metadata:jt},ot,ct),i(null,null,R,{kind:"field",name:"progressColor",static:!1,private:!1,access:{has:e=>"progressColor"in e,get:e=>e.progressColor,set:(e,t)=>{e.progressColor=t}},metadata:jt},dt,ht),i(null,null,B,{kind:"field",name:"progressBgColor",static:!1,private:!1,access:{has:e=>"progressBgColor"in e,get:e=>e.progressBgColor,set:(e,t)=>{e.progressBgColor=t}},metadata:jt},ut,pt),i(null,null,j,{kind:"field",name:"progressHeight",static:!1,private:!1,access:{has:e=>"progressHeight"in e,get:e=>e.progressHeight,set:(e,t)=>{e.progressHeight=t}},metadata:jt},mt,gt),i(null,null,I,{kind:"field",name:"sparklineType",static:!1,private:!1,access:{has:e=>"sparklineType"in e,get:e=>e.sparklineType,set:(e,t)=>{e.sparklineType=t}},metadata:jt},bt,vt),i(null,null,O,{kind:"field",name:"sparklineColor",static:!1,private:!1,access:{has:e=>"sparklineColor"in e,get:e=>e.sparklineColor,set:(e,t)=>{e.sparklineColor=t}},metadata:jt},yt,ft),i(null,null,P,{kind:"field",name:"sparklineWidth",static:!1,private:!1,access:{has:e=>"sparklineWidth"in e,get:e=>e.sparklineWidth,set:(e,t)=>{e.sparklineWidth=t}},metadata:jt},wt,kt),i(null,null,V,{kind:"field",name:"sparklineHeight",static:!1,private:!1,access:{has:e=>"sparklineHeight"in e,get:e=>e.sparklineHeight,set:(e,t)=>{e.sparklineHeight=t}},metadata:jt},xt,St),i(null,null,H,{kind:"field",name:"cellBgColor",static:!1,private:!1,access:{has:e=>"cellBgColor"in e,get:e=>e.cellBgColor,set:(e,t)=>{e.cellBgColor=t}},metadata:jt},Ct,Et),i(null,null,N,{kind:"field",name:"cellColor",static:!1,private:!1,access:{has:e=>"cellColor"in e,get:e=>e.cellColor,set:(e,t)=>{e.cellColor=t}},metadata:jt},Dt,zt),i(null,null,q,{kind:"field",name:"cellFontWeight",static:!1,private:!1,access:{has:e=>"cellFontWeight"in e,get:e=>e.cellFontWeight,set:(e,t)=>{e.cellFontWeight=t}},metadata:jt},At,$t),i(null,null,_,{kind:"field",name:"cellFontStyle",static:!1,private:!1,access:{has:e=>"cellFontStyle"in e,get:e=>e.cellFontStyle,set:(e,t)=>{e.cellFontStyle=t}},metadata:jt},Ft,Tt),i(null,null,W,{kind:"field",name:"cellFontSize",static:!1,private:!1,access:{has:e=>"cellFontSize"in e,get:e=>e.cellFontSize,set:(e,t)=>{e.cellFontSize=t}},metadata:jt},Lt,Mt),i(null,null,K,{kind:"field",name:"cellTextDecoration",static:!1,private:!1,access:{has:e=>"cellTextDecoration"in e,get:e=>e.cellTextDecoration,set:(e,t)=>{e.cellTextDecoration=t}},metadata:jt},Rt,Bt),i(null,e={value:s},ie,{kind:"class",name:s.name,metadata:jt},null,ae),s=e.value,jt&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:jt}),a(s,ae)}render(){return t.html`<slot></slot>`}setFormatter(e){this.formatter=e,this.notifyTableOfChange()}addConditionalFormat(e){this.conditionalFormats.push(e),this.notifyTableOfChange()}removeConditionalFormat(e){this.conditionalFormats.splice(e,1),this.notifyTableOfChange()}clearConditionalFormats(){this.conditionalFormats=[],this.notifyTableOfChange()}getColumnDefinition(){const e={key:this.key,label:this.label,type:this.type,align:this.align,width:this.width,sortable:this.sortable,filterable:this.filterable,wrap:this.wrap,ellipsis:this.ellipsis,tooltip:this.tooltip,formatter:this.formatter,conditionalFormats:this.conditionalFormats};if("number"===this.type||"currency"===this.type||"percent"===this.type||"accounting"===this.type||"scientific"===this.type||"fraction"===this.type){const t={};void 0!==this.decimals&&(t.decimals=this.decimals),void 0!==this.thousandsSeparator&&(t.thousandsSeparator=this.thousandsSeparator),this.numberPrefix&&(t.prefix=this.numberPrefix),this.numberSuffix&&(t.suffix=this.numberSuffix),this.negativeStyle&&(t.negativeStyle=this.negativeStyle),Object.keys(t).length>0&&(e.numberFormat=t)}if("date"===this.type){const t={};this.dateFormat&&(t.format=this.dateFormat),this.customDateFormat&&(t.customFormat=this.customDateFormat),this.dateLocale&&(t.locale=this.dateLocale),Object.keys(t).length>0&&(e.dateFormat=t)}if("boolean"===this.type){const t={};this.trueValue&&(t.trueValue=this.trueValue),this.falseValue&&(t.falseValue=this.falseValue),void 0!==this.useSymbols&&(t.useSymbols=this.useSymbols),this.trueSymbol&&(t.trueSymbol=this.trueSymbol),this.falseSymbol&&(t.falseSymbol=this.falseSymbol),Object.keys(t).length>0&&(e.booleanFormat=t)}if("rating"===this.type){const t={};void 0!==this.ratingMax&&(t.max=this.ratingMax),this.ratingSymbol&&(t.symbol=this.ratingSymbol),this.ratingEmptySymbol&&(t.emptySymbol=this.ratingEmptySymbol),this.ratingColor&&(t.color=this.ratingColor),Object.keys(t).length>0&&(e.ratingFormat=t)}if("progress"===this.type){const t={};void 0!==this.progressMax&&(t.max=this.progressMax),void 0!==this.showPercentage&&(t.showPercentage=this.showPercentage),this.progressColor&&(t.color=this.progressColor),this.progressBgColor&&(t.backgroundColor=this.progressBgColor),this.progressHeight&&(t.height=this.progressHeight),Object.keys(t).length>0&&(e.progressFormat=t)}if("sparkline"===this.type){const t={};this.sparklineType&&(t.type=this.sparklineType),this.sparklineColor&&(t.color=this.sparklineColor),void 0!==this.sparklineWidth&&(t.width=this.sparklineWidth),void 0!==this.sparklineHeight&&(t.height=this.sparklineHeight),Object.keys(t).length>0&&(e.sparklineFormat=t)}const t={};return this.cellBgColor&&(t.backgroundColor=this.cellBgColor),this.cellColor&&(t.color=this.cellColor),this.cellFontWeight&&(t.fontWeight=this.cellFontWeight),this.cellFontStyle&&(t.fontStyle=this.cellFontStyle),this.cellFontSize&&(t.fontSize=this.cellFontSize),this.cellTextDecoration&&(t.textDecoration=this.cellTextDecoration),Object.keys(t).length>0&&(e.style=t),e}handleBasicPropsChange(){this.notifyTableOfChange()}handleNumberFormatChange(){"number"!==this.type&&"currency"!==this.type&&"percent"!==this.type&&"accounting"!==this.type&&"scientific"!==this.type&&"fraction"!==this.type||this.notifyTableOfChange()}handleDateFormatChange(){"date"===this.type&&this.notifyTableOfChange()}handleBooleanFormatChange(){"boolean"===this.type&&this.notifyTableOfChange()}handleRatingFormatChange(){"rating"===this.type&&this.notifyTableOfChange()}handleProgressFormatChange(){"progress"===this.type&&this.notifyTableOfChange()}handleSparklineFormatChange(){"sparkline"===this.type&&this.notifyTableOfChange()}handleStyleChange(){this.notifyTableOfChange()}notifyTableOfChange(){this.dispatchEvent(new CustomEvent("column-changed",{detail:{column:this.getColumnDefinition()},bubbles:!0,composed:!0}))}})})();(()=>{let e,s,n,l,r,o,c,d,h,u,p,m,g,b,v,y,f,w,k=[t.element("snice-row")],x=[],S=HTMLElement,C=[],E=[],D=[],z=[],A=[],$=[],F=[],T=[],L=[],M=[],R=[],B=[],j=[],I=[],O=[];(class extends S{static{s=this}static{const P="function"==typeof Symbol&&Symbol.metadata?Object.create(S[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean})],l=[t.property({type:Boolean})],r=[t.property({type:Boolean})],o=[t.property({type:Boolean})],c=[t.property({type:Object,attribute:!1})],d=[t.property({type:Number})],h=[t.property({type:Array,attribute:!1})],u=[t.render()],p=[t.styles()],m=[t.ready()],g=[t.watch("selected")],b=[t.watch("hoverable","clickable","selectable")],v=[t.watch("data","columns")],y=[t.dispatch("row-click",{bubbles:!0,composed:!0})],f=[t.dispatch("row-select",{bubbles:!0,composed:!0})],w=[t.dispatch("row-hover",{bubbles:!0,composed:!0})],i(this,null,u,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:P},null,C),i(this,null,p,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:P},null,C),i(this,null,m,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:P},null,C),i(this,null,g,{kind:"method",name:"updateSelection",static:!1,private:!1,access:{has:e=>"updateSelection"in e,get:e=>e.updateSelection},metadata:P},null,C),i(this,null,b,{kind:"method",name:"updateRowAttributes",static:!1,private:!1,access:{has:e=>"updateRowAttributes"in e,get:e=>e.updateRowAttributes},metadata:P},null,C),i(this,null,v,{kind:"method",name:"updateCells",static:!1,private:!1,access:{has:e=>"updateCells"in e,get:e=>e.updateCells},metadata:P},null,C),i(this,null,y,{kind:"method",name:"dispatchRowClick",static:!1,private:!1,access:{has:e=>"dispatchRowClick"in e,get:e=>e.dispatchRowClick},metadata:P},null,C),i(this,null,f,{kind:"method",name:"dispatchRowSelect",static:!1,private:!1,access:{has:e=>"dispatchRowSelect"in e,get:e=>e.dispatchRowSelect},metadata:P},null,C),i(this,null,w,{kind:"method",name:"dispatchRowHover",static:!1,private:!1,access:{has:e=>"dispatchRowHover"in e,get:e=>e.dispatchRowHover},metadata:P},null,C),i(null,null,n,{kind:"field",name:"selected",static:!1,private:!1,access:{has:e=>"selected"in e,get:e=>e.selected,set:(e,t)=>{e.selected=t}},metadata:P},E,D),i(null,null,l,{kind:"field",name:"hoverable",static:!1,private:!1,access:{has:e=>"hoverable"in e,get:e=>e.hoverable,set:(e,t)=>{e.hoverable=t}},metadata:P},z,A),i(null,null,r,{kind:"field",name:"clickable",static:!1,private:!1,access:{has:e=>"clickable"in e,get:e=>e.clickable,set:(e,t)=>{e.clickable=t}},metadata:P},$,F),i(null,null,o,{kind:"field",name:"selectable",static:!1,private:!1,access:{has:e=>"selectable"in e,get:e=>e.selectable,set:(e,t)=>{e.selectable=t}},metadata:P},T,L),i(null,null,c,{kind:"field",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:P},M,R),i(null,null,d,{kind:"field",name:"index",static:!1,private:!1,access:{has:e=>"index"in e,get:e=>e.index,set:(e,t)=>{e.index=t}},metadata:P},B,j),i(null,null,h,{kind:"field",name:"columns",static:!1,private:!1,access:{has:e=>"columns"in e,get:e=>e.columns,set:(e,t)=>{e.columns=t}},metadata:P},I,O),i(null,e={value:s},k,{kind:"class",name:s.name,metadata:P},null,x),s=e.value,P&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:P}),a(s,x)}extractDataFromAttributes(){const e={};return this.getAttributeNames().filter(e=>e.startsWith("data-")&&"data-column-index"!==e).forEach(t=>{const i=t.slice(5),a=this.getAttribute(t);null!==a&&(e[i]=a)}),e}render(){return t.html`
|
|
537
537
|
<div class="row-container" part="container" @click=${e=>this.handleRowClick(e)} @keydown=${e=>this.handleKeyDown(e)}>
|
|
538
538
|
<if ${this.selectable}>
|
|
539
539
|
${this.renderCheckbox()}
|
|
@@ -547,7 +547,7 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
547
547
|
</if>
|
|
548
548
|
</div>
|
|
549
549
|
</div>
|
|
550
|
-
`}styles(){return t.css`${":host{display:block;width:100%;min-height:2.5rem}.row-container{display:flex;align-items:stretch;width:100%;min-height:2.5rem;height:2.5rem;background:0 0;color:var(--snice-color-text,rgb(23 23 23));border-bottom:1px solid var(--snice-color-border,rgb(226 226 226));transition:background-color .15s}.cell{display:flex;align-items:center;border-right:1px solid var(--snice-color-border,rgb(226 226 226));min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;word-wrap:break-word;overflow:hidden;color:var(--snice-color-text,rgb(23 23 23))}.cell:last-child{border-right:none}.cell--checkbox{width:3rem;min-width:3rem;max-width:3rem;padding:.75rem;justify-content:center}.row-checkbox{width:1rem;height:1rem;cursor:pointer}.cells-container{display:flex;flex:1;align-items:stretch}.cell--text{text-align:left}.cell--accounting,.cell--currency,.cell--fraction,.cell--number,.cell--percent,.cell--scientific{text-align:right;font-variant-numeric:tabular-nums}.cell--date{min-width:8rem;font-variant-numeric:tabular-nums}.cell--boolean{text-align:center;font-size:1rem}.cell--rating{text-align:center;min-width:6rem}.cell--progress{min-width:8rem}.cell--sparkline{text-align:center;min-width:6rem}.cell--duration,.cell--filesize{text-align:right;font-variant-numeric:tabular-nums}:host(.row--hoverable) .row-container:hover{background-color:var(--snice-color-background-secondary,rgb(245 245 245))}:host(.row--clickable) .row-container{cursor:pointer}:host(.row--clickable) .row-container:hover{background-color:var(--snice-color-background-tertiary,rgb(240 240 240))}:host(.row--selected) .row-container{background-color:var(--snice-color-primary-light,rgb(219 234 254))}:host(.row--selected.row--hoverable) .row-container:hover{background-color:var(--snice-color-primary-lighter,rgb(239 246 255))}:host(.row--highlighted) .row-container{background-color:var(--snice-color-warning-light,rgb(254 249 195))!important;animation:2s ease-out row-highlight-fade}@keyframes row-highlight-fade{0%{background-color:var(--snice-color-warning-lighter,rgb(254 252 232))}100%{background-color:var(--snice-color-warning-light,rgb(254 249 195))}}:host(:focus) .row-container{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:-2px}:host(.row--selectable){tabindex:0}:host(.row--striped) .row-container{background-color:var(--snice-color-background-secondary,rgb(245 245 245))}:host(.row--bordered) .row-container{border-bottom:1px solid var(--snice-color-border,rgb(226 226 226))}:host(.row--small) .cell{padding:.5rem .75rem;min-height:2rem;font-size:.75rem}:host(.row--small) .row-container{min-height:2rem}:host(.row--large) .cell{padding:1rem 1.25rem;min-height:3.5rem;font-size:1rem}:host(.row--large) .row-container{min-height:3.5rem}@media (max-width:768px){.cell{padding:.5rem .75rem;font-size:.875rem}.cell--checkbox{width:2.5rem;min-width:2.5rem;max-width:2.5rem;padding:.5rem}.row-checkbox{width:.875rem;height:.875rem}}:host(.row--loading) .row-container{opacity:.6;pointer-events:none}:host(.row--loading) .row-container::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent,var(--snice-color-background,rgb(255 255 255 / .6)),transparent);animation:1.5s infinite loading-shimmer}@keyframes loading-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}@media (prefers-reduced-motion:reduce){.row-container{transition:none}:host(.row--highlighted) .row-container{animation:none;background-color:var(--snice-color-warning-light,rgb(254 249 195))!important}:host(.row--loading) .row-container::after{animation:none}}@media (prefers-contrast:high){.cell{border-right:1px solid}.row-container{border-bottom:1px solid}:host(.row--selected) .row-container{border:2px solid}}"}`}init(){this.data&&0!==Object.keys(this.data).length||(this.data=this.extractDataFromAttributes()),this.updateRowAttributes(),this.configureCells()}configureCells(){this.columns&&this.columns.forEach((e,t)=>{const
|
|
550
|
+
`}styles(){return t.css`${":host{display:block;width:100%;min-height:2.5rem}.row-container{display:flex;align-items:stretch;width:100%;min-height:2.5rem;height:2.5rem;background:0 0;color:var(--snice-color-text,rgb(23 23 23));border-bottom:1px solid var(--snice-color-border,rgb(226 226 226));transition:background-color .15s}.cell{display:flex;align-items:center;border-right:1px solid var(--snice-color-border,rgb(226 226 226));min-height:2.5rem;height:2.5rem;min-width:6.25rem;flex:1;word-wrap:break-word;overflow:hidden;color:var(--snice-color-text,rgb(23 23 23))}.cell:last-child{border-right:none}.cell--checkbox{width:3rem;min-width:3rem;max-width:3rem;padding:.75rem;justify-content:center}.row-checkbox{width:1rem;height:1rem;cursor:pointer}.cells-container{display:flex;flex:1;align-items:stretch}.cell--text{text-align:left}.cell--accounting,.cell--currency,.cell--fraction,.cell--number,.cell--percent,.cell--scientific{text-align:right;font-variant-numeric:tabular-nums}.cell--date{min-width:8rem;font-variant-numeric:tabular-nums}.cell--boolean{text-align:center;font-size:1rem}.cell--rating{text-align:center;min-width:6rem}.cell--progress{min-width:8rem}.cell--sparkline{text-align:center;min-width:6rem}.cell--duration,.cell--filesize{text-align:right;font-variant-numeric:tabular-nums}:host(.row--hoverable) .row-container:hover{background-color:var(--snice-color-background-secondary,rgb(245 245 245))}:host(.row--clickable) .row-container{cursor:pointer}:host(.row--clickable) .row-container:hover{background-color:var(--snice-color-background-tertiary,rgb(240 240 240))}:host(.row--selected) .row-container{background-color:var(--snice-color-primary-light,rgb(219 234 254))}:host(.row--selected.row--hoverable) .row-container:hover{background-color:var(--snice-color-primary-lighter,rgb(239 246 255))}:host(.row--highlighted) .row-container{background-color:var(--snice-color-warning-light,rgb(254 249 195))!important;animation:2s ease-out row-highlight-fade}@keyframes row-highlight-fade{0%{background-color:var(--snice-color-warning-lighter,rgb(254 252 232))}100%{background-color:var(--snice-color-warning-light,rgb(254 249 195))}}:host(:focus) .row-container{outline:2px solid var(--snice-color-primary,rgb(37 99 235));outline-offset:-2px}:host(.row--selectable){tabindex:0}:host(.row--striped) .row-container{background-color:var(--snice-color-background-secondary,rgb(245 245 245))}:host(.row--bordered) .row-container{border-bottom:1px solid var(--snice-color-border,rgb(226 226 226))}:host(.row--small) .cell{padding:.5rem .75rem;min-height:2rem;font-size:.75rem}:host(.row--small) .row-container{min-height:2rem}:host(.row--large) .cell{padding:1rem 1.25rem;min-height:3.5rem;font-size:1rem}:host(.row--large) .row-container{min-height:3.5rem}@media (max-width:768px){.cell{padding:.5rem .75rem;font-size:.875rem}.cell--checkbox{width:2.5rem;min-width:2.5rem;max-width:2.5rem;padding:.5rem}.row-checkbox{width:.875rem;height:.875rem}}:host(.row--loading) .row-container{opacity:.6;pointer-events:none}:host(.row--loading) .row-container::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent,var(--snice-color-background,rgb(255 255 255 / .6)),transparent);animation:1.5s infinite loading-shimmer}@keyframes loading-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}@media (prefers-reduced-motion:reduce){.row-container{transition:none}:host(.row--highlighted) .row-container{animation:none;background-color:var(--snice-color-warning-light,rgb(254 249 195))!important}:host(.row--loading) .row-container::after{animation:none}}@media (prefers-contrast:high){.cell{border-right:1px solid}.row-container{border-bottom:1px solid}:host(.row--selected) .row-container{border:2px solid}}"}`}init(){this.data&&0!==Object.keys(this.data).length||(this.data=this.extractDataFromAttributes()),this.updateRowAttributes(),this.configureCells()}configureCells(){this.columns&&this.columns.forEach((e,t)=>{const i=this.shadowRoot?.querySelector(`[data-column-index="${t}"]`);if(i){const t=this.data[e.key];i.value=t,i.column=e,i.rowData=this.data,"sparkline"===e.type&&Array.isArray(t)&&(i.data=t)}})}updateSelection(){this.updateRowAttributes();const e=this.shadowRoot?.querySelector(".row-checkbox");e&&(e.checked=this.selected)}updateRowAttributes(){this.classList.toggle("row--hoverable",this.hoverable),this.classList.toggle("row--clickable",this.clickable),this.classList.toggle("row--selectable",this.selectable),this.classList.toggle("row--selected",this.selected)}updateCells(){setTimeout(()=>this.configureCells(),0)}handleRowClick(e){const t=e.target;t.matches(".row-checkbox")||t.matches("button, a, .interactive")||(this.clickable&&this.dispatchRowClick(),this.selectable&&this.toggleSelection())}handleChange(e){const t=e.target;if(!t.matches(".row-checkbox"))return;const i=t;this.selected=i.checked,this.dispatchRowSelect()}handleKeyDown(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.selectable?this.toggleSelection():this.clickable&&this.dispatchRowClick())}renderCheckbox(){return t.html`
|
|
551
551
|
<div class="cell cell--checkbox" part="checkbox-cell">
|
|
552
552
|
<input
|
|
553
553
|
type="checkbox"
|
|
@@ -557,11 +557,11 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
557
557
|
@change=${e=>this.handleChange(e)}
|
|
558
558
|
/>
|
|
559
559
|
</div>
|
|
560
|
-
`}renderCell(e,
|
|
560
|
+
`}renderCell(e,i){this.data[e.key];const a=this.getCellComponent(e.type);return t.html`
|
|
561
561
|
<div class="cell cell--${e.type}" part="cell" style="${this.getCellStyles(e)}">
|
|
562
|
-
${t.unsafeHTML(`<${
|
|
562
|
+
${t.unsafeHTML(`<${a}\n type="${e.type}"\n align="${e.align||"left"}"\n data-column-index="${i}"\n ></${a}>`)}
|
|
563
563
|
</div>
|
|
564
|
-
`}getCellComponent(e){switch(e){case"text":return"snice-cell-text";case"number":case"accounting":case"scientific":case"fraction":return"snice-cell-number";case"date":return"snice-cell-date";case"boolean":return"snice-cell-boolean";case"sparkline":return"snice-cell-sparkline";case"rating":return"snice-cell-rating";case"progress":return"snice-cell-progress";case"duration":return"snice-cell-duration";case"filesize":return"snice-cell-filesize";case"link":case"url":return"snice-cell-link";case"actions":return"snice-cell-actions";case"tag":case"tags":case"badge":case"badges":return"snice-cell-tag";case"image":case"avatar":case"thumbnail":return"snice-cell-image";case"email":return"snice-cell-email";case"phone":case"tel":case"telephone":return"snice-cell-phone";case"status":return"snice-cell-status";case"color":return"snice-cell-color";case"json":case"object":return"snice-cell-json";case"currency":case"money":return"snice-cell-currency";case"percent":case"percentage":return"snice-cell-percentage";case"location":case"address":case"coordinates":return"snice-cell-location";default:return"snice-cell"}}getCellStyles(e){let t=[];return e.width&&(t.push(`width: ${e.width}`),t.push(`min-width: ${e.width}`),t.push(`max-width: ${e.width}`)),e.align&&t.push(`text-align: ${e.align}`),t.join("; ")}escapeHtml(e){if(null==e)return"";const t=String(e),a=document.createElement("div");return a.textContent=t,a.innerHTML}toggleSelection(){this.selected=!this.selected,this.dispatchRowSelect()}dispatchRowClick(){return{data:this.data,index:this.index,element:this}}dispatchRowSelect(){return{selected:this.selected,data:this.data,index:this.index,element:this}}dispatchRowHover(){return{data:this.data,index:this.index,element:this}}select(){this.selected=!0,this.dispatchRowSelect()}deselect(){this.selected=!1,this.dispatchRowSelect()}focusRow(){super.focus(),this.scrollIntoView({behavior:"smooth",block:"nearest"})}getCellValue(e){return this.data[e]}setCellValue(e,t){this.data={...this.data,[e]:t},this.updateCells()}getCellElement(e){const t=this.columns.find(t=>t.key===e);if(!t)return null;const a=this.columns.indexOf(t);return this.shadowRoot?.querySelector(`[data-column-index="${a}"]`)||null}highlight(e=2e3){this.classList.add("row--highlighted"),setTimeout(()=>{this.classList.remove("row--highlighted")},e)}constructor(){super(...arguments),this.selected=(i(this,C),i(this,E,!1)),this.hoverable=(i(this,D),i(this,z,!0)),this.clickable=(i(this,A),i(this,$,!1)),this.selectable=(i(this,F),i(this,T,!1)),this.data=(i(this,L),i(this,M,{})),this.index=(i(this,R),i(this,B,0)),this.columns=(i(this,j),i(this,I,[])),i(this,O)}})})();class l{constructor(){this.rafId=0,this.lastStartIndex=-1,this.lastEndIndex=-1,this.enabled=!1,this.topSpacer=document.createElement("tr"),this.topSpacer.className="virtual-spacer virtual-spacer--top",this.topSpacer.style.display="table-row",this.bottomSpacer=document.createElement("tr"),this.bottomSpacer.className="virtual-spacer virtual-spacer--bottom",this.bottomSpacer.style.display="table-row",this.contentContainer=document.createElement("tbody"),this.options={},this.scrollHandler=()=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>this.update())}}attach(e){this.options=e,this.enabled=!0,this.options.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!0}),window.addEventListener("resize",this.scrollHandler,{passive:!0}),this.update()}detach(){this.enabled=!1,this.options.scrollContainer?.removeEventListener("scroll",this.scrollHandler),window.removeEventListener("resize",this.scrollHandler),cancelAnimationFrame(this.rafId)}setTotalRows(e){this.options.totalRows=e,this.lastStartIndex=-1,this.update()}refresh(){this.lastStartIndex=-1,this.lastEndIndex=-1,this.update()}update(){if(!this.enabled||!this.options.scrollContainer)return;const{rowHeight:e,bufferPx:t,totalRows:a,scrollContainer:i,renderRange:s}=this.options,n=i.scrollTop,l=i.clientHeight,r=a*e,o=Math.max(0,n-t),c=Math.min(r,n+l+t),d=Math.floor(o/e),h=Math.min(a,Math.ceil(c/e));if(d===this.lastStartIndex&&h===this.lastEndIndex)return;this.lastStartIndex=d,this.lastEndIndex=h;const u=d*e,p=Math.max(0,(a-h)*e);this.topSpacer.style.height=`${u}px`,this.bottomSpacer.style.height=`${p}px`;const m=s(d,h),g=this.options.scrollContainer.querySelector("tbody");if(g){if(g.innerHTML="",u>0){const e=document.createElement("td");e.colSpan=999,e.style.height=`${u}px`,e.style.padding="0",e.style.border="none",this.topSpacer.innerHTML="",this.topSpacer.appendChild(e),g.appendChild(this.topSpacer)}if(g.appendChild(m),p>0){const e=document.createElement("td");e.colSpan=999,e.style.height=`${p}px`,e.style.padding="0",e.style.border="none",this.bottomSpacer.innerHTML="",this.bottomSpacer.appendChild(e),g.appendChild(this.bottomSpacer)}}}getVisibleRange(){return{start:this.lastStartIndex,end:this.lastEndIndex}}scrollToRow(e){if(!this.options.scrollContainer)return;const t=e*this.options.rowHeight;this.options.scrollContainer.scrollTop=t}getScrollPosition(){const e=this.options.scrollContainer;return{top:e?.scrollTop??0,left:e?.scrollLeft??0}}isEnabled(){return this.enabled}}class r{constructor(){this.states=new Map,this.groups=[],this.resizeStartX=0,this.resizeStartWidth=0,this.resizingKey=null,this.resizeOverlay=null,this.tableElement=null}initialize(e,t){this.tableElement=t,e.forEach((e,t)=>{const a=this.states.get(e.key);this.states.set(e.key,{key:e.key,width:a?.width??this.parseWidth(e.width)??150,flex:e.flex,minWidth:e.minWidth??50,maxWidth:e.maxWidth??1/0,visible:a?.visible??!0,pinned:a?.pinned??(e.pinned||!1),order:a?.order??t,resizable:!1!==e.resizable,reorderable:!1!==e.reorderable,hideable:!1!==e.hideable,pinnable:!1!==e.pinnable})})}parseWidth(e){if(!e)return;const t=parseInt(e,10);return isNaN(t)?void 0:t}getVisibleColumns(){return Array.from(this.states.values()).filter(e=>e.visible).sort((e,t)=>e.order-t.order)}getAllStates(){return Array.from(this.states.values()).sort((e,t)=>e.order-t.order)}getPinnedLeft(){return this.getVisibleColumns().filter(e=>"left"===e.pinned)}getPinnedRight(){return this.getVisibleColumns().filter(e=>"right"===e.pinned)}getUnpinned(){return this.getVisibleColumns().filter(e=>!e.pinned)}computeFlexWidths(e){const t=this.getVisibleColumns(),a=new Map;let i=0;const s=[];for(const e of t)e.flex&&e.flex>0?s.push(e):(i+=e.width,a.set(e.key,e.width));const n=Math.max(0,e-i),l=s.reduce((e,t)=>e+(t.flex||1),0);for(const e of s){const t=(e.flex||1)/l*n,i=Math.max(e.minWidth,Math.min(e.maxWidth,t));a.set(e.key,i)}return a}applyWidths(e,t){e.querySelectorAll("th[data-key]").forEach(e=>{const a=e.getAttribute("data-key");a&&t.has(a)&&(e.style.width=`${t.get(a)}px`)})}startResize(e,t){const a=this.states.get(e);if(!a||!a.resizable)return;this.resizingKey=e,this.resizeStartX=t,this.resizeStartWidth=a.width,this.resizeOverlay=document.createElement("div"),this.resizeOverlay.style.cssText="position:fixed;inset:0;z-index:99999;cursor:col-resize;",document.body.appendChild(this.resizeOverlay);const i=t=>{t.preventDefault();const i=t.clientX-this.resizeStartX,s=Math.max(a.minWidth,Math.min(a.maxWidth,this.resizeStartWidth+i));a.width=s,a.flex=void 0;const n=this.tableElement?.shadowRoot;if(n){const t=n.querySelector(`th[data-key="${e}"]`);t&&(t.style.width=`${s}px`);n.querySelectorAll(`td[data-key="${e}"]`).forEach(e=>e.style.width=`${s}px`)}this.tableElement?.dispatchEvent(new CustomEvent("column-resize",{detail:{key:e,width:s},bubbles:!0,composed:!0}))},s=()=>{this.resizingKey=null,this.resizeOverlay?.remove(),this.resizeOverlay=null,document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s),this.tableElement?.dispatchEvent(new CustomEvent("column-resize-end",{detail:{key:e,width:a.width},bubbles:!0,composed:!0}))};document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)}autoSizeColumn(e,t){const a=this.states.get(e);if(!a)return;const i=this.tableElement?.shadowRoot?.querySelector(`th[data-key="${e}"]`);let s=i?i.scrollWidth:0;t.querySelectorAll(`td[data-key="${e}"]`).forEach(e=>{s=Math.max(s,e.scrollWidth)}),a.width=Math.max(a.minWidth,Math.min(a.maxWidth,s+16)),a.flex=void 0}autoSizeAll(e){for(const t of this.states.keys())this.autoSizeColumn(t,e)}setColumnVisible(e,t){const a=this.states.get(e);a&&a.hideable&&(a.visible=t)}showAllColumns(){for(const e of this.states.values())e.visible=!0}hideAllColumns(){for(const e of this.states.values())e.hideable&&(e.visible=!1)}getVisibilityModel(){const e={};for(const[t,a]of this.states)e[t]=a.visible;return e}moveColumn(e,t){const a=this.states.get(e);if(!a||!a.reorderable||a.pinned)return;const i=this.getVisibleColumns(),s=i.findIndex(t=>t.key===e);-1!==s&&s!==t&&(i.splice(s,1),i.splice(t,0,a),i.forEach((e,t)=>{e.order=t}))}pinColumn(e,t){const a=this.states.get(e);a&&a.pinnable&&(a.pinned=t)}unpinColumn(e){const t=this.states.get(e);t&&(t.pinned=!1)}setColumnGroups(e){this.groups=e}getColumnGroups(){return this.groups}renderGroupHeaders(){return 0===this.groups.length?"":this.groups.map(e=>{const t=e.children.filter(e=>this.states.get(e)?.visible).length;return 0===t?"":`<th colspan="${t}" class="column-group-header ${e.headerClass||""}">${e.label}</th>`}).join("")}isResizing(){return null!==this.resizingKey}getState(e){return this.states.get(e)}getPinnedLeftOffsets(){const e=new Map;let t=0;for(const a of this.getPinnedLeft())e.set(a.key,t),t+=a.width;return e}getPinnedRightOffsets(){const e=new Map,t=this.getPinnedRight();let a=0;for(let i=t.length-1;i>=0;i--)e.set(t[i].key,a),a+=t[i].width;return e}}const o=[{value:"contains",label:"contains",requiresValue:!0},{value:"notContains",label:"does not contain",requiresValue:!0},{value:"equals",label:"equals",requiresValue:!0},{value:"notEquals",label:"does not equal",requiresValue:!0},{value:"startsWith",label:"starts with",requiresValue:!0},{value:"endsWith",label:"ends with",requiresValue:!0},{value:"isEmpty",label:"is empty",requiresValue:!1},{value:"isNotEmpty",label:"is not empty",requiresValue:!1}],c=[{value:"eq",label:"=",requiresValue:!0},{value:"neq",label:"≠",requiresValue:!0},{value:"gt",label:">",requiresValue:!0},{value:"gte",label:"≥",requiresValue:!0},{value:"lt",label:"<",requiresValue:!0},{value:"lte",label:"≤",requiresValue:!0},{value:"isEmpty",label:"is empty",requiresValue:!1},{value:"isNotEmpty",label:"is not empty",requiresValue:!1}],d=[{value:"is",label:"is",requiresValue:!0},{value:"isNot",label:"is not",requiresValue:!0},{value:"before",label:"before",requiresValue:!0},{value:"onOrBefore",label:"on or before",requiresValue:!0},{value:"after",label:"after",requiresValue:!0},{value:"onOrAfter",label:"on or after",requiresValue:!0},{value:"isEmpty",label:"is empty",requiresValue:!1},{value:"isNotEmpty",label:"is not empty",requiresValue:!1}],h=[{value:"isTrue",label:"is true",requiresValue:!1},{value:"isFalse",label:"is false",requiresValue:!1}];class u{constructor(){this.model={filters:[],logic:"and"},this.headerFilters=new Map}getOperatorsForType(e){switch(e){case"number":case"currency":case"rating":case"progress":case"filesize":case"duration":return c;case"date":return d;case"boolean":return h;default:return o}}setFilterModel(e){this.model=e}getFilterModel(){return{...this.model}}setColumnFilter(e,t,a){const i=this.model.filters.findIndex(t=>t.column===e);i>=0?this.model.filters[i]={column:e,operator:t,value:a}:this.model.filters.push({column:e,operator:t,value:a})}removeColumnFilter(e){this.model.filters=this.model.filters.filter(t=>t.column!==e)}clearAllFilters(){this.model.filters=[],this.model.quickFilter=void 0,this.headerFilters.clear()}setQuickFilter(e){this.model.quickFilter=e||void 0}setHeaderFilter(e,t){t?this.headerFilters.set(e,t):this.headerFilters.delete(e)}getHeaderFilter(e){return this.headerFilters.get(e)||""}setFilterLogic(e){this.model.logic=e}hasActiveFilters(){return this.model.filters.length>0||!!this.model.quickFilter||this.headerFilters.size>0}hasColumnFilter(e){return this.model.filters.some(t=>t.column===e)||this.headerFilters.has(e)}getActiveFilterCount(){return this.model.filters.length+this.headerFilters.size+(this.model.quickFilter?1:0)}applyFilters(e,t){let a=e;this.model.filters.length>0&&(a=a.filter(e=>{const t=this.model.filters.map(t=>this.evaluateFilter(t,e));return"and"===this.model.logic?t.every(Boolean):t.some(Boolean)}));for(const[e,t]of this.headerFilters){const i=t.toLowerCase();a=a.filter(t=>{const a=t[e];return null!=a&&String(a).toLowerCase().includes(i)})}if(this.model.quickFilter){const e=this.model.quickFilter.toLowerCase().split(/\s+/).filter(Boolean),i=t.map(e=>e.key),s=this.model.quickFilterLogic||"and";a=a.filter(t=>{const a=e=>i.some(a=>{const i=t[a];return null!=i&&String(i).toLowerCase().includes(e)});return"and"===s?e.every(a):e.some(a)})}return a}evaluateFilter(e,t){const a=t[e.column],i=e.value;switch(e.operator){case"contains":return null!=a&&String(a).toLowerCase().includes(String(i).toLowerCase());case"notContains":return null==a||!String(a).toLowerCase().includes(String(i).toLowerCase());case"equals":return String(a??"").toLowerCase()===String(i).toLowerCase();case"notEquals":return String(a??"").toLowerCase()!==String(i).toLowerCase();case"startsWith":return null!=a&&String(a).toLowerCase().startsWith(String(i).toLowerCase());case"endsWith":return null!=a&&String(a).toLowerCase().endsWith(String(i).toLowerCase());case"isEmpty":return null==a||""===a;case"isNotEmpty":return null!=a&&""!==a;case"eq":return Number(a)===Number(i);case"neq":return Number(a)!==Number(i);case"gt":return Number(a)>Number(i);case"gte":return Number(a)>=Number(i);case"lt":return Number(a)<Number(i);case"lte":return Number(a)<=Number(i);case"is":return new Date(a).toDateString()===new Date(i).toDateString();case"isNot":return new Date(a).toDateString()!==new Date(i).toDateString();case"before":return new Date(a)<new Date(i);case"onOrBefore":return new Date(a)<=new Date(i);case"after":return new Date(a)>new Date(i);case"onOrAfter":return new Date(a)>=new Date(i);case"isTrue":return!0===a||"true"===a||1===a;case"isFalse":return!1===a||"false"===a||0===a||null==a;default:return!0}}toServerParams(){return{filters:this.model.filters,filterLogic:this.model.logic,quickFilter:this.model.quickFilter,headerFilters:Object.fromEntries(this.headerFilters)}}}class p{constructor(){this.cellState=null,this.rowState=null,this.pipelines=new Map,this.validators=new Map,this.editableColumns=new Set,this.editabilityCheck=null,this.tableElement=null,this.mode="cell"}attach(e){this.tableElement=e}setEditableColumns(e){this.editableColumns=new Set(e)}setEditabilityCheck(e){this.editabilityCheck=e}setEditMode(e){this.mode=e}setPipeline(e,t){this.pipelines.set(e,t)}setValidation(e,t){this.validators.set(e,t)}isCellEditable(e,t){return!!this.editableColumns.has(t)&&(!this.editabilityCheck||this.editabilityCheck(e,t))}getDisplayValue(e,t,a){const i=this.pipelines.get(e);let s=t;return i?.valueGetter&&(s=i.valueGetter(s,a)),i?.valueFormatter?i.valueFormatter(s,a):null==s?"":String(s)}getSortValue(e,t,a){const i=this.pipelines.get(e);return i?.valueGetter?i.valueGetter(t,a):t}getEditorType(e){switch(e){case"number":case"currency":case"rating":case"progress":return"number";case"date":return"date";case"boolean":return"boolean";default:return"text"}}startCellEdit(e,t,a,i){return this.isCellEditable(i,t)?(this.cellState?.isEditing&&this.cancelCellEdit(),this.cellState={rowIndex:e,columnKey:t,originalValue:a,currentValue:a,editorType:this.getEditorType(t),error:null,isEditing:!0},this.cellState):null}updateCellValue(e){this.cellState&&(this.cellState.currentValue=e,this.cellState.error=null)}async commitCellEdit(){if(!this.cellState?.isEditing)return null;const{columnKey:e,currentValue:t,rowIndex:a}=this.cellState,i=this.pipelines.get(e);let s=t;i?.valueParser&&(s=i.valueParser(String(t),{}));const n=this.validators.get(e);if(n){const e=await n.validate(s,{});if(e)return this.cellState.error=e,e}return i?.valueSetter&&(s=i.valueSetter(s,{})),this.tableElement?.dispatchEvent(new CustomEvent("cell-edit-commit",{detail:{rowIndex:a,columnKey:e,oldValue:this.cellState.originalValue,newValue:s},bubbles:!0,composed:!0})),this.cellState.isEditing=!1,this.cellState=null,null}cancelCellEdit(){this.cellState?.isEditing&&(this.tableElement?.dispatchEvent(new CustomEvent("cell-edit-cancel",{detail:{rowIndex:this.cellState.rowIndex,columnKey:this.cellState.columnKey},bubbles:!0,composed:!0})),this.cellState.isEditing=!1,this.cellState=null)}getCellEditState(){return this.cellState}startRowEdit(e,t){return this.rowState?.isEditing&&this.cancelRowEdit(),this.rowState={rowIndex:e,originalRow:{...t},editedRow:{...t},errors:new Map,isEditing:!0},this.rowState}updateRowField(e,t){this.rowState&&(this.rowState.editedRow[e]=t,this.rowState.errors.delete(e))}async commitRowEdit(){if(!this.rowState?.isEditing)return null;const e=new Map;for(const t of this.editableColumns){const a=this.validators.get(t);if(a){const i=this.rowState.editedRow[t],s=await a.validate(i,this.rowState.editedRow);s&&e.set(t,s)}}if(e.size>0)return this.rowState.errors=e,e;const t={...this.rowState.editedRow};for(const[e,a]of this.pipelines)a.valueSetter&&e in t&&(t[e]=a.valueSetter(t[e],t));return this.tableElement?.dispatchEvent(new CustomEvent("row-edit-commit",{detail:{rowIndex:this.rowState.rowIndex,oldRow:this.rowState.originalRow,newRow:t},bubbles:!0,composed:!0})),this.rowState.isEditing=!1,this.rowState=null,null}cancelRowEdit(){this.rowState?.isEditing&&(this.tableElement?.dispatchEvent(new CustomEvent("row-edit-cancel",{detail:{rowIndex:this.rowState.rowIndex},bubbles:!0,composed:!0})),this.rowState.isEditing=!1,this.rowState=null)}getRowEditState(){return this.rowState}isEditing(){return(this.cellState?.isEditing||this.rowState?.isEditing)??!1}createEditor(e,t,a){switch(e){case"number":{const e=document.createElement("input");return e.type="number",e.value=null==t?"":String(t),e.className="table-editor-input",e}case"date":{const e=document.createElement("input");return e.type="date",e.value=t||"",e.className="table-editor-input",e}case"boolean":{const e=document.createElement("input");return e.type="checkbox",e.checked=!!t,e.className="table-editor-checkbox",e}case"select":{const e=document.createElement("select");return e.className="table-editor-select",(a?.selectOptions||[]).forEach(a=>{const i=document.createElement("option");i.value=a.value,i.textContent=a.label,a.value===String(t)&&(i.selected=!0),e.appendChild(i)}),e}default:{const e=document.createElement("input");return e.type="text",e.value=null==t?"":String(t),e.className="table-editor-input",e}}}}class m{constructor(){this.focusedRow=-1,this.focusedCol=0,this.attached=!1,this.options={},this.keyHandler=e=>this.handleKeyDown(e)}attach(e){this.options=e;const t=this.getTable();t&&(t.setAttribute("role","grid"),t.setAttribute("tabindex","0"),t.addEventListener("keydown",this.keyHandler),this.attached=!0,this.applyARIA())}detach(){const e=this.getTable();e&&e.removeEventListener("keydown",this.keyHandler),this.attached=!1}getTable(){return this.options.shadowRoot?.querySelector("table")??null}applyARIA(){const e=this.getTable();if(!e)return;e.setAttribute("aria-rowcount",String(this.options.totalRows+1)),e.setAttribute("aria-colcount",String(this.options.totalColumns));const t=e.querySelector("thead tr");if(t){t.setAttribute("role","row"),t.setAttribute("aria-rowindex","1");t.querySelectorAll("th").forEach((e,t)=>{if(e.setAttribute("role","columnheader"),e.setAttribute("aria-colindex",String(t+1)),e.classList.contains("sortable")){const t=e.querySelector(".sort-indicator.active");if(t){const a=t.textContent?.trim()||"";a.includes("▲")?e.setAttribute("aria-sort","ascending"):a.includes("▼")&&e.setAttribute("aria-sort","descending")}else e.setAttribute("aria-sort","none")}})}e.querySelectorAll("tbody tr:not(.virtual-spacer)").forEach((e,t)=>{e.setAttribute("role","row"),e.setAttribute("aria-rowindex",String(t+2));"true"===e.getAttribute("data-selected")?e.setAttribute("aria-selected","true"):e.removeAttribute("aria-selected");e.querySelectorAll("td").forEach((e,t)=>{e.setAttribute("role","gridcell"),e.setAttribute("aria-colindex",String(t+1))})}),this.updateFocusIndicator()}setFocus(e,t){this.focusedRow=e,this.focusedCol=t,this.updateFocusIndicator()}getFocus(){return{row:this.focusedRow,col:this.focusedCol}}updateFocusIndicator(){const e=this.getTable();if(!e)return;e.querySelectorAll("[data-grid-focus]").forEach(e=>{e.removeAttribute("data-grid-focus"),e.removeAttribute("tabindex")});let t=null;if(-1===this.focusedRow){t=e.querySelectorAll("thead th")[this.focusedCol]}else{const a=e.querySelectorAll("tbody tr:not(.virtual-spacer)")[this.focusedRow];if(a){t=a.querySelectorAll("td")[this.focusedCol]}}t&&(t.setAttribute("data-grid-focus","true"),t.setAttribute("tabindex","0"))}handleKeyDown(e){if(this.options.isEditing())return;const{totalRows:t,totalColumns:a}=this.options;switch(e.key){case"ArrowDown":e.preventDefault(),this.focusedRow=Math.min(t-1,this.focusedRow+1),this.updateFocusIndicator(),this.scrollIntoView();break;case"ArrowUp":e.preventDefault(),this.focusedRow=Math.max(-1,this.focusedRow-1),this.updateFocusIndicator(),this.scrollIntoView();break;case"ArrowRight":e.preventDefault(),this.focusedCol=Math.min(a-1,this.focusedCol+1),this.updateFocusIndicator();break;case"ArrowLeft":e.preventDefault(),this.focusedCol=Math.max(0,this.focusedCol-1),this.updateFocusIndicator();break;case"Home":e.preventDefault(),e.ctrlKey?(this.focusedRow=-1,this.focusedCol=0):this.focusedCol=0,this.updateFocusIndicator(),this.scrollIntoView();break;case"End":e.preventDefault(),e.ctrlKey?(this.focusedRow=t-1,this.focusedCol=a-1):this.focusedCol=a-1,this.updateFocusIndicator(),this.scrollIntoView();break;case"PageDown":e.preventDefault(),this.focusedRow=Math.min(t-1,this.focusedRow+10),this.updateFocusIndicator(),this.scrollIntoView();break;case"PageUp":e.preventDefault(),this.focusedRow=Math.max(0,this.focusedRow-10),this.updateFocusIndicator(),this.scrollIntoView();break;case" ":this.focusedRow>=0&&(e.preventDefault(),e.shiftKey&&this.options.onSelectionToggle?.(this.focusedRow));break;case"Enter":if(this.focusedRow>=0&&this.focusedCol>=0){e.preventDefault();const t=this.getTable(),a=t?.querySelectorAll("tbody tr:not(.virtual-spacer)"),i=a?.[this.focusedRow],s=i?.querySelectorAll("td"),n=s?.[this.focusedCol],l=n?.getAttribute("data-key")||"";this.options.onCellActivate?.(this.focusedRow,l)}break;case"a":(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.options.onSelectAll?.())}}scrollIntoView(){const e=this.getTable();if(!e)return;const t=e.querySelector("[data-grid-focus]");t&&(t.scrollIntoView({block:"nearest",inline:"nearest"}),t.focus({preventScroll:!0}))}isAttached(){return this.attached}}class g{exportCSV(e,t,a={}){const{delimiter:i=",",filename:s="export.csv",includeHeaders:n=!0,columns:l,utf8BOM:r=!0}=a;let o=t.filter(e=>!1!==e.exportable);l&&(o=o.filter(e=>l.includes(e.key)));const c=[];n&&c.push(o.map(e=>this.escapeCSV(e.label,i)).join(i));for(const t of e){const e=o.map(e=>{const a=t[e.key];return this.escapeCSV(null==a?"":String(a),i)});c.push(e.join(i))}const d=c.join("\n"),h=new Blob([(r?"\ufeff":"")+d],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(h),p=document.createElement("a");p.href=u,p.download=s,p.style.display="none",document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(u)}print(e,t={}){const{hideFooter:a=!1,hideToolbar:i=!1,pageStyles:s=""}=t,n=window.open("","_blank");if(!n)return;const l=e.shadowRoot;if(!l)return;const r=l.querySelector("table");if(!r)return;const o=`\n <!DOCTYPE html>\n <html>\n <head>\n <title>Print</title>\n <style>\n body { font-family: system-ui, -apple-system, sans-serif; margin: 1rem; }\n table { width: 100%; border-collapse: collapse; }\n th, td { padding: 8px 12px; border: 1px solid #ddd; text-align: left; }\n th { background: #f5f5f5; font-weight: 600; }\n ${a?".pagination { display: none; }":""}\n ${i?".table-controls { display: none; }":""}\n @media print {\n body { margin: 0; }\n table { page-break-inside: auto; }\n tr { page-break-inside: avoid; }\n }\n ${s}\n </style>\n </head>\n <body>\n ${r.outerHTML}\n </body>\n </html>\n `;n.document.write(o),n.document.close(),n.onload=()=>{n.print(),n.close()}}async copyToClipboard(e,t,a,i={}){const{delimiter:s="\t"}=i,n=a.length>0?a.map(t=>e[t]).filter(Boolean):e;if(0===n.length)return!1;const l=n.map(e=>t.map(t=>{const a=e[t.key];return null==a?"":String(a)}).join(s)).join("\n");try{return await navigator.clipboard.writeText(l),!0}catch{const e=document.createElement("textarea");e.value=l,e.style.cssText="position:fixed;left:-9999px;",document.body.appendChild(e),e.select();const t=document.execCommand("copy");return document.body.removeChild(e),t}}escapeCSV(e,t){return e.includes(t)||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e}}class b{constructor(){this.expandedRows=new Set,this.options=null,this.tableElement=null}attach(e,t){this.tableElement=e,this.options=t}isExpanded(e){return this.expandedRows.has(e)}toggle(e){this.expandedRows.has(e)?this.collapse(e):this.expand(e)}expand(e){this.expandedRows.add(e),this.tableElement?.dispatchEvent(new CustomEvent("row-expand",{detail:{rowIndex:e},bubbles:!0,composed:!0}))}collapse(e){this.expandedRows.delete(e),this.tableElement?.dispatchEvent(new CustomEvent("row-collapse",{detail:{rowIndex:e},bubbles:!0,composed:!0}))}expandAll(e){for(let t=0;t<e;t++)this.expandedRows.add(t)}collapseAll(){this.expandedRows.clear()}getExpandedRows(){return new Set(this.expandedRows)}createToggleButton(e){const t=this.isExpanded(e),a=document.createElement("button");return a.type="button",a.className="detail-toggle"+(t?" detail-toggle--expanded":""),a.setAttribute("aria-expanded",String(t)),a.setAttribute("aria-label",t?"Collapse row":"Expand row"),a.innerHTML='<svg class="detail-toggle-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>',a.addEventListener("click",t=>{t.stopPropagation(),this.toggle(e),this.tableElement?.dispatchEvent(new CustomEvent("detail-toggle",{detail:{rowIndex:e,expanded:this.isExpanded(e)},bubbles:!0,composed:!0}))}),a}createDetailRow(e,t,a){if(!this.options||!this.isExpanded(t))return null;const i=document.createElement("tr");i.className="detail-row",i.setAttribute("data-detail-for",String(t));const s=document.createElement("td");s.colSpan=a,s.className="detail-cell",s.style.padding="0",s.style.border="none";const n=document.createElement("div");n.className="detail-content";const l=document.createElement("div");l.className="detail-content-inner";const r=this.options.getDetailContent(e,t);return"string"==typeof r?l.innerHTML=r:r instanceof HTMLElement&&l.appendChild(r),n.appendChild(l),s.appendChild(n),requestAnimationFrame(()=>{const e=l.scrollHeight;n.style.setProperty("--detail-max-height",`${e}px`),n.classList.add("detail-content--open")}),i.appendChild(s),i}isEnabled(){return null!==this.options}}class v{constructor(){this.container=null,this.options={},this.tableElement=null,this.filterEngine=null,this.activeModal=null,this.onSearch=null,this.onSortColumn=null,this.onSetSortModel=null,this.onFilterColumn=null,this.onRemoveFilter=null,this.onClearFilters=null,this.onSetFilterModel=null,this.onExportCSV=null,this.onFullscreen=null}attach(e,t,a={}){this.tableElement=e,this.container=t,this.options=a,this.render()}setFilterEngine(e){this.filterEngine=e}render(){if(!this.container)return;this.container.innerHTML="";const e=document.createElement("div");if(e.className="table-toolbar",e.setAttribute("part","toolbar"),!1!==this.options.showSearch){const t=document.createElement("snice-input");let a;t.type="search",t.placeholder=this.options.searchPlaceholder||"Search...",t.size="small",t.className="toolbar-search",t.addEventListener("input",()=>{clearTimeout(a),a=window.setTimeout(()=>{this.onSearch?.(t.value)},300)}),e.appendChild(t)}const t=document.createElement("div");if(t.className="toolbar-actions",!1!==this.options.showSort){const e=this.mkBtn("Sort",this.sortIcon());e.addEventListener("click",e=>{e.stopPropagation(),this.openSortModal()}),t.appendChild(e)}if(!1!==this.options.showFilter){const e=this.mkBtn("Filter",this.filterIcon());e.addEventListener("click",e=>{e.stopPropagation(),this.openFilterModal()}),t.appendChild(e)}if(this.options.showExport){const e=this.mkBtn("Export CSV",this.exportIcon());e.addEventListener("click",()=>this.onExportCSV?.()),t.appendChild(e)}const a=this.mkBtn("Fullscreen",this.fullscreenIcon());a.addEventListener("click",()=>this.onFullscreen?.()),t.appendChild(a),e.appendChild(t),this.container.appendChild(e)}mkBtn(e,t){const a=document.createElement("button");return a.className="toolbar-btn",a.setAttribute("aria-label",e),a.setAttribute("title",e),a.innerHTML=t,a}mkSelect(e,t,a,i=!1){const s=document.createElement("snice-select");return s.size="small",s.searchable=i,s.maxHeight="150px",s.options=e,t&&(s.value=t),a&&(s.style.cssText=a),s}mkInput(e,t,a){const i=document.createElement("snice-input");return i.size="small",i.placeholder=e,null!=t&&(i.value=t),a&&(i.style.cssText=a),i}mkRemoveBtn(e){const t=document.createElement("snice-button");return t.size="small",t.variant="text",t.textContent="✕",t.style.cssText="flex:0 0 auto;",t.addEventListener("click",e),t}openSortModal(){this.closeModal();const e=this.tableElement?.columns||[];if(!e.length)return;const t=e.filter(e=>!1!==e.sortable),a=[...this.tableElement?.currentSort||[]],i=this.createModal("Sort"),s=i.querySelector('[slot="default"]')||i,n=document.createElement("div");n.style.cssText="display:flex;flex-direction:column;gap:0.5rem;";const l=document.createElement("div");l.style.cssText="display:flex;flex-direction:column;gap:0.5rem;",n.appendChild(l);const r=t.map(e=>({value:e.key,label:e.label||e.key})),o=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}],c=[],d=e=>{const t=document.createElement("div");t.style.cssText="display:flex;align-items:center;gap:0.375rem;";const a=this.mkSelect(r,e?.column,"width:10rem;",!0),i=this.mkSelect(o,e?.direction||"asc","width:8rem;");t.appendChild(a),t.appendChild(i);const s=()=>({column:a.value,direction:i.value});t.appendChild(this.mkRemoveBtn(()=>{t.remove();const e=c.findIndex(e=>e.getSort===s);e>=0&&c.splice(e,1)})),c.push({getSort:s}),l.appendChild(t)};if(a.length>0)for(const e of a)d(e);else d();const h=document.createElement("snice-button");h.size="small",h.variant="text",h.textContent="+ Add sort",h.style.cssText="width:calc(10rem + 8rem + 0.375rem);",h.addEventListener("click",()=>d()),n.appendChild(h);const u=document.createElement("div");u.setAttribute("slot","footer"),u.style.cssText="display:flex;gap:0.5rem;justify-content:flex-end;";const p=document.createElement("snice-button");p.size="small",p.variant="text",p.textContent="Clear",p.addEventListener("click",()=>{this.onSetSortModel?.([]),this.closeModal()}),u.appendChild(p);const m=document.createElement("snice-button");m.size="small",m.variant="primary",m.textContent="Apply",m.addEventListener("click",()=>{const e=c.map(e=>e.getSort()).filter(Boolean);this.onSetSortModel?.(e),this.closeModal()}),u.appendChild(m),s.appendChild(n),i.appendChild(u),this.showModal(i)}openFilterModal(e){this.closeModal();const t=this.tableElement?.columns||[];if(!t.length)return;const a=this.filterEngine||new u,i=a.getFilterModel(),s=this.createModal("Filters"),n=s.querySelector('[slot="default"]')||s,l=document.createElement("div");l.style.cssText="display:flex;flex-direction:column;gap:0.75rem;";const r=document.createElement("div");r.style.cssText="display:flex;align-items:center;gap:0.5rem;margin-bottom:0.25rem;";const o=document.createElement("span");o.style.cssText="font-size:0.75rem;font-weight:600;text-transform:uppercase;letter-spacing:0.03em;color:var(--snice-color-text-tertiary,rgb(115 115 115));",o.textContent="Logic:",r.appendChild(o);let c=i.logic||"and";const d=document.createElement("snice-button");d.size="small",d.variant="and"===c?"primary":"text",d.textContent="AND";const h=document.createElement("snice-button");h.size="small",h.variant="or"===c?"primary":"text",h.textContent="OR",d.addEventListener("click",()=>{c="and",d.variant="primary",h.variant="text"}),h.addEventListener("click",()=>{c="or",h.variant="primary",d.variant="text"}),r.appendChild(d),r.appendChild(h),l.appendChild(r);const p=document.createElement("div");p.style.cssText="display:flex;flex-direction:column;gap:0.5rem;",l.appendChild(p);const m=t.map(e=>({value:e.key,label:e.label||e.key})),g=[],b=e=>{const i=document.createElement("div");i.style.cssText="display:flex;flex-direction:column;gap:0.25rem;padding:0.5rem;border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,0.25rem);position:relative;";const s=this.mkSelect(m,e?.column,"width:100%;max-width:none;",!0);i.appendChild(s);const n=document.createElement("snice-select");n.size="small",n.style.cssText="width:100%;max-width:none;",i.appendChild(n);const l=this.mkInput("Value...",null!=e?.value?String(e.value):void 0,"width:100%;");i.appendChild(l);const r=()=>{const i=s.value,l=t.find(e=>e.key===i),r=l?.type||"text",c=a.getOperatorsForType(r);n.options=c.map(e=>({value:e.value,label:e.label})),e&&i===e.column&&(n.value=e.operator),o()},o=()=>{const e=s.value,i=t.find(t=>t.key===e),r=i?.type||"text",o=a.getOperatorsForType(r).find(e=>e.value===n.value);l.style.display=!1===o?.requiresValue?"none":""};s.addEventListener("change",r),n.addEventListener("change",o),r();const c=()=>{const e=s.value,i=t.find(t=>t.key===e),r=i?.type||"text",o=a.getOperatorsForType(r),c=n.value,d=o.find(e=>e.value===c),h=!1===d?.requiresValue?null:l.value;return d?.requiresValue&&!h?null:{column:e,operator:c,value:h}},d=document.createElement("snice-badge");d.content="✕",d.variant="error",d.size="small",d.position="top-right",d.style.cursor="pointer",d.appendChild(i),d.addEventListener("click",e=>{if(!e.composedPath().some(e=>e.classList?.contains("badge")))return;d.remove();const t=g.findIndex(e=>e.getFilter===c);t>=0&&g.splice(t,1)}),g.push({getFilter:c}),p.appendChild(d)};if(i.filters.length>0)for(const e of i.filters)b(e);else e?b({column:e,operator:"contains",value:""}):b();const v=document.createElement("snice-button");v.size="small",v.variant="text",v.textContent="+ Add filter",v.addEventListener("click",()=>b()),l.appendChild(v);const y=document.createElement("div");y.setAttribute("slot","footer"),y.style.cssText="display:flex;gap:0.5rem;justify-content:flex-end;";const f=document.createElement("snice-button");f.size="small",f.variant="text",f.textContent="Clear all",f.addEventListener("click",()=>{this.onClearFilters?.(),this.closeModal()}),y.appendChild(f);const w=document.createElement("snice-button");w.size="small",w.variant="primary",w.textContent="Apply",w.addEventListener("click",()=>{const e=g.map(e=>e.getFilter()).filter(Boolean);this.onSetFilterModel?.(e,c),this.closeModal()}),y.appendChild(w),n.appendChild(l),s.appendChild(y),this.showModal(s)}createModal(e,t="small"){const a=document.createElement("snice-modal");a.size=t,a.label=e,a.noBackdropDismiss=!0,a.style.cssText="--modal-padding: 0.75rem;";const i=document.createElement("span");return i.setAttribute("slot","header"),i.textContent=e,a.appendChild(i),a}showModal(e){document.body.appendChild(e),this.activeModal=e,e.addEventListener("modal-close",()=>{this.closeModal()}),requestAnimationFrame(()=>{e.open=!0;const t=e.shadowRoot?.querySelector(".modal__body");t&&(t.style.overflow="visible")})}closeModal(){this.activeModal&&(this.activeModal.open=!1,setTimeout(()=>{this.activeModal?.remove(),this.activeModal=null},300))}setActiveFilterCount(e){}isAttached(){return null!==this.container}sortIcon(){return'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"><path d="M4 6l4-4 4 4"/><path d="M4 10l4 4 4-4"/></svg>'}filterIcon(){return'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"><path d="M2 3h12M4 7h8M6 11h4"/></svg>'}exportIcon(){return'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"><path d="M8 2v8M5 7l3 3 3-3"/><path d="M3 12h10"/></svg>'}fullscreenIcon(){return'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"><polyline points="10,2 14,2 14,6"/><polyline points="6,14 2,14 2,10"/><polyline points="2,6 2,2 6,2"/><polyline points="14,10 14,14 10,14"/></svg>'}}class y{constructor(){this.options=null,this.expandedKeys=new Set,this.flatRows=[],this.enabled=!1,this.defaultDepth=0}attach(e){this.options=e,this.enabled=!0,void 0!==e.defaultExpansionDepth&&e.defaultExpansionDepth>=0&&(this.defaultDepth=e.defaultExpansionDepth)}isEnabled(){return this.enabled}processData(e){if(!this.options)return[];const t=new Map;for(const a of e){const e=this.options.getPath(a),i=e.join("/");t.set(i,{data:a,children:new Set,depth:e.length-1,isGap:!1});for(let a=1;a<e.length;a++){const i=e.slice(0,a),s=i.join("/");t.has(s)||t.set(s,{data:{[this.options.groupColumn||"name"]:i[i.length-1]},children:new Set,depth:a-1,isGap:!0})}if(e.length>1){const a=e.slice(0,-1).join("/"),s=t.get(a);s&&s.children.add(i)}}const a=[];for(const[e,i]of t)0===i.depth&&a.push(e);if(a.sort(),0===this.expandedKeys.size&&this.defaultDepth>0)for(const[e,a]of t)a.depth<this.defaultDepth&&a.children.size>0&&this.expandedKeys.add(e);this.flatRows=[];const i=e=>{const a=t.get(e);if(!a)return;const s=a.children.size>0,n=this.expandedKeys.has(e);if(this.flatRows.push({path:e.split("/"),data:a.data,depth:a.depth,hasChildren:s,expanded:n,key:e,isGap:a.isGap}),n){const e=Array.from(a.children).sort();for(const t of e)i(t)}};for(const e of a)i(e);return this.flatRows}getFlatRows(){return this.flatRows}toggle(e){this.expandedKeys.has(e)?this.expandedKeys.delete(e):this.expandedKeys.add(e)}expand(e){this.expandedKeys.add(e)}collapse(e){this.expandedKeys.delete(e)}expandAll(e){if(this.options)for(const t of e){const e=this.options.getPath(t);for(let t=1;t<=e.length;t++)this.expandedKeys.add(e.slice(0,t).join("/"))}}collapseAll(){this.expandedKeys.clear()}isExpanded(e){return this.expandedKeys.has(e)}createToggle(e){const t=document.createElement("span");if(t.className="tree-indent",t.style.paddingLeft=1.5*e.depth+"rem",e.hasChildren){const a=document.createElement("button");a.type="button",a.className="tree-toggle"+(e.expanded?" tree-toggle--expanded":""),a.innerHTML='<svg class="tree-toggle-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>',a.setAttribute("aria-expanded",String(e.expanded)),a.addEventListener("click",t=>{t.stopPropagation(),this.toggle(e.key),a.dispatchEvent(new CustomEvent("tree-toggle",{detail:{key:e.key,expanded:this.isExpanded(e.key)},bubbles:!0,composed:!0}))}),t.appendChild(a)}else{const e=document.createElement("span");e.className="tree-spacer",t.appendChild(e)}return t}getGroupColumn(){return this.options?.groupColumn||""}}class f{constructor(){this.menuEl=null,this.activeColumn=null,this.tableElement=null,this.outsideClickHandler=null,this.onSortAsc=null,this.onSortDesc=null,this.onFilter=null,this.onHide=null,this.onPinLeft=null,this.onPinRight=null,this.onUnpin=null,this.onAutoSize=null}attach(e){this.tableElement=e}show(e,t,a,i){this.hide(),this.activeColumn=e;const s=document.createElement("div");s.className="table-column-menu",s.style.left=`${t}px`,s.style.top=`${a}px`;const n=[];!1!==i?.sortable&&(n.push({label:"Sort Ascending",icon:"↑",action:"sort-asc"}),n.push({label:"Sort Descending",icon:"↓",action:"sort-desc"}),n.push({label:"",action:"",separator:!0})),!1!==i?.filterable&&n.push({label:"Filter...",icon:"⫧",action:"filter"}),!1!==i?.hideable&&n.push({label:"Hide Column",icon:"👁",action:"hide"}),!1!==i?.pinnable&&(i?.pinned?n.push({label:"Unpin",icon:"📌",action:"unpin"}):(n.push({label:"Pin Left",icon:"⇤",action:"pin-left"}),n.push({label:"Pin Right",icon:"⇥",action:"pin-right"}))),n.push({label:"",action:"",separator:!0}),n.push({label:"Auto-size",icon:"↔",action:"autosize"});for(const e of n){if(e.separator){const e=document.createElement("div");e.className="column-menu-separator",s.appendChild(e);continue}const t=document.createElement("button");t.type="button",t.className="column-menu-item",t.innerHTML=`${e.icon?`<span class="column-menu-icon">${e.icon}</span>`:""}<span>${e.label}</span>`,t.addEventListener("click",()=>{this.handleAction(e.action),this.hide()}),e.disabled&&(t.disabled=!0),s.appendChild(t)}const l=this.tableElement?.shadowRoot;l?l.appendChild(s):document.body.appendChild(s),this.menuEl=s,setTimeout(()=>{this.outsideClickHandler=e=>{e.composedPath().includes(s)||this.hide()},document.addEventListener("click",this.outsideClickHandler,{capture:!0})},0);const r=e=>{"Escape"===e.key&&(this.hide(),document.removeEventListener("keydown",r))};document.addEventListener("keydown",r)}handleAction(e){if(this.activeColumn)switch(e){case"sort-asc":this.onSortAsc?.(this.activeColumn);break;case"sort-desc":this.onSortDesc?.(this.activeColumn);break;case"filter":this.onFilter?.(this.activeColumn);break;case"hide":this.onHide?.(this.activeColumn);break;case"pin-left":this.onPinLeft?.(this.activeColumn);break;case"pin-right":this.onPinRight?.(this.activeColumn);break;case"unpin":this.onUnpin?.(this.activeColumn);break;case"autosize":this.onAutoSize?.(this.activeColumn)}}hide(){this.menuEl&&(this.menuEl.remove(),this.menuEl=null),this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler,{capture:!0}),this.outsideClickHandler=null),this.activeColumn=null}isOpen(){return null!==this.menuEl}}class w{constructor(){this.enabled=!1,this.tableElement=null,this.dragSourceIndex=-1,this.dropTargetIndex=-1,this.dropIndicator=null}attach(e){this.tableElement=e,this.enabled=!0}isEnabled(){return this.enabled}makeRowDraggable(e,t,a=!0){a&&(e.draggable=!0,e.addEventListener("dragstart",a=>{this.dragSourceIndex=t,e.style.opacity="0.5",a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",String(t))}),e.addEventListener("dragend",()=>{e.style.opacity="1",this.removeDropIndicator(),this.dragSourceIndex=-1}),e.addEventListener("dragover",a=>{a.preventDefault(),a.dataTransfer.dropEffect="move",this.dropTargetIndex=t,this.showDropIndicator(e)}),e.addEventListener("dragleave",()=>{this.removeDropIndicator()}),e.addEventListener("drop",e=>{e.preventDefault(),this.removeDropIndicator(),-1!==this.dragSourceIndex&&this.dragSourceIndex!==t&&this.tableElement?.dispatchEvent(new CustomEvent("row-reorder",{detail:{fromIndex:this.dragSourceIndex,toIndex:t},bubbles:!0,composed:!0})),this.dragSourceIndex=-1}))}createDragHandle(){const e=document.createElement("td");return e.className="drag-handle-cell",e.textContent="⠗",e.setAttribute("aria-label","Drag to reorder"),e}showDropIndicator(e){this.removeDropIndicator(),this.dropIndicator=document.createElement("div"),this.dropIndicator.className="drop-indicator";const t=e.getBoundingClientRect(),a=e.parentElement?.getBoundingClientRect();if(a){const i=this.dropTargetIndex>this.dragSourceIndex?t.bottom-a.top:t.top-a.top;this.dropIndicator.style.top=`${i}px`,e.parentElement.style.position="relative",e.parentElement.appendChild(this.dropIndicator)}}removeDropIndicator(){this.dropIndicator?.remove(),this.dropIndicator=null}}class k{constructor(){this.enabled=!1,this.tableElement=null,this.dragSourceKey=null}attach(e){this.tableElement=e,this.enabled=!0}isEnabled(){return this.enabled}makeHeaderDraggable(e,t,a=!0){a&&(e.draggable=!0,e.addEventListener("dragstart",a=>{this.dragSourceKey=t,e.style.opacity="0.5",a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",t)}),e.addEventListener("dragend",()=>{e.style.opacity="1",this.dragSourceKey=null}),e.addEventListener("dragover",a=>{this.dragSourceKey&&this.dragSourceKey!==t&&(a.preventDefault(),a.dataTransfer.dropEffect="move",e.style.borderLeft="2px solid var(--snice-color-primary, rgb(37 99 235))")}),e.addEventListener("dragleave",()=>{e.style.borderLeft=""}),e.addEventListener("drop",a=>{a.preventDefault(),e.style.borderLeft="",this.dragSourceKey&&this.dragSourceKey!==t&&this.tableElement?.dispatchEvent(new CustomEvent("column-reorder",{detail:{fromKey:this.dragSourceKey,toKey:t},bubbles:!0,composed:!0})),this.dragSourceKey=null}))}}let x=(()=>{let e,s,n,o,c,d,h,x,S,C,E,D,z,A,$,F,T,L,M,R,B,j,I,O,P,V,H,N,q,_,W,K,Y,U,G,J,X,Q,Z,ee,te,ae,ie,se,ne,le,re,oe,ce,de,he,ue,pe,me,ge,be,ve,ye,fe,we,ke,xe,Se=[t.element("snice-table")],Ce=[],Ee=HTMLElement,De=[],ze=[],Ae=[],$e=[],Fe=[],Te=[],Le=[],Me=[],Re=[],Be=[],je=[],Ie=[],Oe=[],Pe=[],Ve=[],He=[],Ne=[],qe=[],_e=[],We=[],Ke=[],Ye=[],Ue=[],Ge=[],Je=[],Xe=[],Qe=[],Ze=[],et=[],tt=[],at=[],it=[],st=[],nt=[],lt=[],rt=[],ot=[],ct=[],dt=[],ht=[],ut=[],pt=[],mt=[],gt=[],bt=[],vt=[],yt=[],ft=[],wt=[],kt=[],xt=[],St=[],Ct=[],Et=[],Dt=[],zt=[],At=[],$t=[],Ft=[],Tt=[],Lt=[],Mt=[],Rt=[],Bt=[],jt=[],It=[],Ot=[],Pt=[],Vt=[],Ht=[],Nt=[],qt=[],_t=[],Wt=[],Kt=[];return class extends Ee{static{s=this}constructor(){super(...arguments),this.striped=(i(this,De),i(this,ze,!1)),this.searchable=(i(this,Ae),i(this,$e,!1)),this.filterable=(i(this,Fe),i(this,Te,!1)),this.sortable=(i(this,Le),i(this,Me,!1)),this.selectable=(i(this,Re),i(this,Be,!1)),this.hoverable=(i(this,je),i(this,Ie,!0)),this.clickable=(i(this,Oe),i(this,Pe,!1)),this.list=(i(this,Ve),i(this,He,!1)),this.pagination=(i(this,Ne),i(this,qe,!1)),this.paginationMode=(i(this,_e),i(this,We,"client")),this.pageSize=(i(this,Ke),i(this,Ye,10)),this.currentPage=(i(this,Ue),i(this,Ge,1)),this.totalItems=(i(this,Je),i(this,Xe,0)),this.pageSizes=(i(this,Qe),i(this,Ze,[10,25,50,100])),this.searchDebounce=(i(this,et),i(this,tt,500)),this.columns=(i(this,at),[]),this.data=[],this.currentSort=i(this,it,[]),this.searchText=(i(this,st),""),this.selector=i(this,nt,""),this.selectorOptions=(i(this,lt),i(this,rt,[])),this.loading=(i(this,ot),i(this,ct,!1)),this.virtualize=(i(this,dt),i(this,ht,!1)),this.rowHeight=(i(this,ut),i(this,pt,48)),this.virtualBuffer=(i(this,mt),i(this,gt,200)),this.columnResize=(i(this,bt),i(this,vt,!1)),this.editable=(i(this,yt),i(this,ft,!1)),this.editMode=(i(this,wt),i(this,kt,"cell")),this.density=(i(this,xt),i(this,St,"standard")),this.headerFilters=(i(this,Ct),i(this,Et,!1)),this.quickFilter=(i(this,Dt),i(this,zt,!1)),this.rowReorder=(i(this,At),i(this,$t,!1)),this.columnReorder=(i(this,Ft),i(this,Tt,!1)),this.columnMenu=(i(this,Lt),i(this,Mt,!1)),this.lazyLoad=(i(this,Rt),i(this,Bt,!1)),this.lazyLoadThreshold=(i(this,jt),i(this,It,200)),this.selectedRows=(i(this,Ot),i(this,Pt,[])),this.virtualizer=(i(this,Vt),new l),this.columnManager=new r,this.filterEngine=new u,this.editor=new p,this.keyboard=new m,this.exporter=new g,this.masterDetail=new b,this.toolbar=new v,this.treeData=new y,this.columnMenuManager=new f,this.rowDnD=new w,this.columnDnD=new k,this.pinnedTopRows=[],this.pinnedBottomRows=[],this.lazyLoadHandler=null,this.rowHeightCallback=null,this.table=i(this,Ht,void 0),this.thead=(i(this,Nt),i(this,qt,void 0)),this.tbody=(i(this,_t),i(this,Wt,void 0)),this._hasController=(i(this,Kt),!1),this._unsortedData=[],this.dataRequestTimeout=null,this._escHandler=null,this.toggleFullscreen=()=>{this.classList.contains("table-fullscreen")?(this.classList.remove("table-fullscreen"),this._escHandler&&(document.removeEventListener("keydown",this._escHandler),this._escHandler=null)):(this.classList.add("table-fullscreen"),this._escHandler=e=>{"Escape"===e.key&&this.toggleFullscreen()},document.addEventListener("keydown",this._escHandler))},this.handleClick=e=>{const t=e.target,a=t.closest("th.sortable");if(a){const e=a.getAttribute("data-key");return void(e&&this.toggleSort(e,!0))}const i=t.closest("tbody tr");if(i){if(t.matches('input[type="checkbox"], button, a, .interactive, snice-checkbox, snice-button, snice-input, snice-select'))return;const e=parseInt(i.getAttribute("data-index")||"0"),a=this.data[e];if(this.selectable){const t=this.selectedRows.includes(e);this.selectedRows=t?this.selectedRows.filter(t=>t!==e):[...this.selectedRows,e],this.updateRowSelectionState(),this.updateSelectAllState(),this.dispatchRowSelectionChanged(e,!t)}this.clickable&&this.dispatchEvent(new CustomEvent("row-clicked",{detail:{rowData:a,rowIndex:e}}))}},this.handleChange=e=>{const t=e.target;if(t.matches("snice-checkbox.row-select")){const e=t,a=parseInt(e.getAttribute("data-row-index")||"0");return e.checked?this.selectedRows.includes(a)||(this.selectedRows=[...this.selectedRows,a]):this.selectedRows=this.selectedRows.filter(e=>e!==a),this.updateRowSelectionState(),this.updateSelectAllState(),void this.dispatchRowSelectionChanged(a,e.checked)}if(t.matches("snice-checkbox.select-all")){const e=t;if(e.checked){const e=this.getFilteredData();this.selectedRows=e.map(e=>this.data.indexOf(e))}else this.selectedRows=[];this.updateRowSelectionState(),this.dispatchSelectAllChanged(e.checked)}},this.onAttached=()=>{this._hasController=!0,this.getTableConfig(),this.getTableData()},this.searchDebounceTimeout=null,this.handleSearchInput=e=>{const t=e.target;this.searchText=t.value,this.searchDebounceTimeout&&clearTimeout(this.searchDebounceTimeout),this.searchDebounceTimeout=setTimeout(()=>{this.debouncedDataRequest()},this.searchDebounce)},this.selectorDebounceTimeout=null,this.handleSelectorChange=e=>{this.selector=Array.isArray(e.detail.value)?e.detail.value.join(","):e.detail.value,this.selectorDebounceTimeout&&clearTimeout(this.selectorDebounceTimeout),this.selectorDebounceTimeout=setTimeout(()=>{this.debouncedDataRequest()},150)},this.selectabilityCheck=null,this.listViewRenderer=null}static{const l="function"==typeof Symbol&&Symbol.metadata?Object.create(Ee[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean,attribute:"striped"})],o=[t.property({type:Boolean,attribute:"searchable"})],c=[t.property({type:Boolean,attribute:"filterable"})],d=[t.property({type:Boolean,attribute:"sortable"})],h=[t.property({type:Boolean,attribute:"selectable"})],x=[t.property({type:Boolean,attribute:"hoverable"})],S=[t.property({type:Boolean,attribute:"clickable"})],C=[t.property({type:Boolean,attribute:"list"})],E=[t.property({type:Boolean,attribute:"pagination"})],D=[t.property({attribute:"pagination-mode"})],z=[t.property({type:Number,attribute:"page-size"})],A=[t.property({type:Number,attribute:"current-page"})],$=[t.property({type:Number,attribute:"total-items"})],F=[t.property({type:Array,attribute:!1})],T=[t.property({type:Number,attribute:"search-debounce"})],L=[t.property({type:Array,attribute:!1})],M=[t.property({type:String,attribute:"selector"})],R=[t.property({type:Array,attribute:!1})],B=[t.property({type:Boolean,attribute:"loading"})],j=[t.property({type:Boolean,attribute:"virtualize"})],I=[t.property({type:Number,attribute:"row-height"})],O=[t.property({type:Number,attribute:"virtual-buffer"})],P=[t.property({type:Boolean,attribute:"column-resize"})],V=[t.property({type:Boolean,attribute:"editable"})],H=[t.property({attribute:"edit-mode"})],N=[t.property({attribute:"density"})],q=[t.property({type:Boolean,attribute:"header-filters"})],_=[t.property({type:Boolean,attribute:"quick-filter"})],W=[t.property({type:Boolean,attribute:"row-reorder"})],K=[t.property({type:Boolean,attribute:"column-reorder"})],Y=[t.property({type:Boolean,attribute:"column-menu"})],U=[t.property({type:Boolean,attribute:"lazy-load"})],G=[t.property({type:Number,attribute:"lazy-load-threshold"})],J=[t.property({type:Array,attribute:!1})],X=[t.query("table")],Q=[t.query("thead")],Z=[t.query("tbody")],ee=[t.request("table/config")],te=[t.request("table/data")],ae=[t.styles()],ie=[t.render()],se=[t.ready()],ne=[t.watch("selector-options")],le=[t.watch("sortable")],re=[t.watch("selectable")],oe=[t.watch("columns")],ce=[t.watch("data","loading")],de=[t.watch("selected-rows")],he=[t.watch("current-sort")],ue=[t.watch("searchable","filterable")],pe=[t.dispatch("page-change",{bubbles:!0,composed:!0})],me=[t.dispatch("table-row-selection-changed",{bubbles:!0,composed:!0})],ge=[t.dispatch("table-select-all-changed",{bubbles:!0,composed:!0})],be=[t.dispatch("sort-change",{bubbles:!0,composed:!0})],ve=[t.dispatch("filter-change",{bubbles:!0,composed:!0})],ye=[t.dispatch("column-visibility-change",{bubbles:!0,composed:!0})],fe=[t.dispatch("column-pin-change",{bubbles:!0,composed:!0})],we=[t.dispatch("column-order-change",{bubbles:!0,composed:!0})],ke=[t.dispatch("density-change",{bubbles:!0,composed:!0})],xe=[t.dispose()],a(this,null,ee,{kind:"method",name:"getTableConfig",static:!1,private:!1,access:{has:e=>"getTableConfig"in e,get:e=>e.getTableConfig},metadata:l},null,De),a(this,null,te,{kind:"method",name:"getTableData",static:!1,private:!1,access:{has:e=>"getTableData"in e,get:e=>e.getTableData},metadata:l},null,De),a(this,null,ae,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:l},null,De),a(this,null,ie,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:l},null,De),a(this,null,se,{kind:"method",name:"initialize",static:!1,private:!1,access:{has:e=>"initialize"in e,get:e=>e.initialize},metadata:l},null,De),a(this,null,ne,{kind:"method",name:"handleSelectorOptionsChange",static:!1,private:!1,access:{has:e=>"handleSelectorOptionsChange"in e,get:e=>e.handleSelectorOptionsChange},metadata:l},null,De),a(this,null,le,{kind:"method",name:"handleSortableChange",static:!1,private:!1,access:{has:e=>"handleSortableChange"in e,get:e=>e.handleSortableChange},metadata:l},null,De),a(this,null,re,{kind:"method",name:"handleSelectableChange",static:!1,private:!1,access:{has:e=>"handleSelectableChange"in e,get:e=>e.handleSelectableChange},metadata:l},null,De),a(this,null,oe,{kind:"method",name:"handleColumnsChange",static:!1,private:!1,access:{has:e=>"handleColumnsChange"in e,get:e=>e.handleColumnsChange},metadata:l},null,De),a(this,null,ce,{kind:"method",name:"handleDataChange",static:!1,private:!1,access:{has:e=>"handleDataChange"in e,get:e=>e.handleDataChange},metadata:l},null,De),a(this,null,de,{kind:"method",name:"handleSelectedRowsChange",static:!1,private:!1,access:{has:e=>"handleSelectedRowsChange"in e,get:e=>e.handleSelectedRowsChange},metadata:l},null,De),a(this,null,he,{kind:"method",name:"handleSortChange",static:!1,private:!1,access:{has:e=>"handleSortChange"in e,get:e=>e.handleSortChange},metadata:l},null,De),a(this,null,ue,{kind:"method",name:"handleControlsChange",static:!1,private:!1,access:{has:e=>"handleControlsChange"in e,get:e=>e.handleControlsChange},metadata:l},null,De),a(this,null,pe,{kind:"method",name:"dispatchPageChange",static:!1,private:!1,access:{has:e=>"dispatchPageChange"in e,get:e=>e.dispatchPageChange},metadata:l},null,De),a(this,null,me,{kind:"method",name:"dispatchRowSelectionChanged",static:!1,private:!1,access:{has:e=>"dispatchRowSelectionChanged"in e,get:e=>e.dispatchRowSelectionChanged},metadata:l},null,De),a(this,null,ge,{kind:"method",name:"dispatchSelectAllChanged",static:!1,private:!1,access:{has:e=>"dispatchSelectAllChanged"in e,get:e=>e.dispatchSelectAllChanged},metadata:l},null,De),a(this,null,be,{kind:"method",name:"dispatchSortChange",static:!1,private:!1,access:{has:e=>"dispatchSortChange"in e,get:e=>e.dispatchSortChange},metadata:l},null,De),a(this,null,ve,{kind:"method",name:"dispatchFilterChange",static:!1,private:!1,access:{has:e=>"dispatchFilterChange"in e,get:e=>e.dispatchFilterChange},metadata:l},null,De),a(this,null,ye,{kind:"method",name:"dispatchColumnVisibilityChange",static:!1,private:!1,access:{has:e=>"dispatchColumnVisibilityChange"in e,get:e=>e.dispatchColumnVisibilityChange},metadata:l},null,De),a(this,null,fe,{kind:"method",name:"dispatchColumnPinChange",static:!1,private:!1,access:{has:e=>"dispatchColumnPinChange"in e,get:e=>e.dispatchColumnPinChange},metadata:l},null,De),a(this,null,we,{kind:"method",name:"dispatchColumnOrderChange",static:!1,private:!1,access:{has:e=>"dispatchColumnOrderChange"in e,get:e=>e.dispatchColumnOrderChange},metadata:l},null,De),a(this,null,ke,{kind:"method",name:"dispatchDensityChange",static:!1,private:!1,access:{has:e=>"dispatchDensityChange"in e,get:e=>e.dispatchDensityChange},metadata:l},null,De),a(this,null,xe,{kind:"method",name:"cleanup",static:!1,private:!1,access:{has:e=>"cleanup"in e,get:e=>e.cleanup},metadata:l},null,De),a(null,null,n,{kind:"field",name:"striped",static:!1,private:!1,access:{has:e=>"striped"in e,get:e=>e.striped,set:(e,t)=>{e.striped=t}},metadata:l},ze,Ae),a(null,null,o,{kind:"field",name:"searchable",static:!1,private:!1,access:{has:e=>"searchable"in e,get:e=>e.searchable,set:(e,t)=>{e.searchable=t}},metadata:l},$e,Fe),a(null,null,c,{kind:"field",name:"filterable",static:!1,private:!1,access:{has:e=>"filterable"in e,get:e=>e.filterable,set:(e,t)=>{e.filterable=t}},metadata:l},Te,Le),a(null,null,d,{kind:"field",name:"sortable",static:!1,private:!1,access:{has:e=>"sortable"in e,get:e=>e.sortable,set:(e,t)=>{e.sortable=t}},metadata:l},Me,Re),a(null,null,h,{kind:"field",name:"selectable",static:!1,private:!1,access:{has:e=>"selectable"in e,get:e=>e.selectable,set:(e,t)=>{e.selectable=t}},metadata:l},Be,je),a(null,null,x,{kind:"field",name:"hoverable",static:!1,private:!1,access:{has:e=>"hoverable"in e,get:e=>e.hoverable,set:(e,t)=>{e.hoverable=t}},metadata:l},Ie,Oe),a(null,null,S,{kind:"field",name:"clickable",static:!1,private:!1,access:{has:e=>"clickable"in e,get:e=>e.clickable,set:(e,t)=>{e.clickable=t}},metadata:l},Pe,Ve),a(null,null,C,{kind:"field",name:"list",static:!1,private:!1,access:{has:e=>"list"in e,get:e=>e.list,set:(e,t)=>{e.list=t}},metadata:l},He,Ne),a(null,null,E,{kind:"field",name:"pagination",static:!1,private:!1,access:{has:e=>"pagination"in e,get:e=>e.pagination,set:(e,t)=>{e.pagination=t}},metadata:l},qe,_e),a(null,null,D,{kind:"field",name:"paginationMode",static:!1,private:!1,access:{has:e=>"paginationMode"in e,get:e=>e.paginationMode,set:(e,t)=>{e.paginationMode=t}},metadata:l},We,Ke),a(null,null,z,{kind:"field",name:"pageSize",static:!1,private:!1,access:{has:e=>"pageSize"in e,get:e=>e.pageSize,set:(e,t)=>{e.pageSize=t}},metadata:l},Ye,Ue),a(null,null,A,{kind:"field",name:"currentPage",static:!1,private:!1,access:{has:e=>"currentPage"in e,get:e=>e.currentPage,set:(e,t)=>{e.currentPage=t}},metadata:l},Ge,Je),a(null,null,$,{kind:"field",name:"totalItems",static:!1,private:!1,access:{has:e=>"totalItems"in e,get:e=>e.totalItems,set:(e,t)=>{e.totalItems=t}},metadata:l},Xe,Qe),a(null,null,F,{kind:"field",name:"pageSizes",static:!1,private:!1,access:{has:e=>"pageSizes"in e,get:e=>e.pageSizes,set:(e,t)=>{e.pageSizes=t}},metadata:l},Ze,et),a(null,null,T,{kind:"field",name:"searchDebounce",static:!1,private:!1,access:{has:e=>"searchDebounce"in e,get:e=>e.searchDebounce,set:(e,t)=>{e.searchDebounce=t}},metadata:l},tt,at),a(null,null,L,{kind:"field",name:"currentSort",static:!1,private:!1,access:{has:e=>"currentSort"in e,get:e=>e.currentSort,set:(e,t)=>{e.currentSort=t}},metadata:l},it,st),a(null,null,M,{kind:"field",name:"selector",static:!1,private:!1,access:{has:e=>"selector"in e,get:e=>e.selector,set:(e,t)=>{e.selector=t}},metadata:l},nt,lt),a(null,null,R,{kind:"field",name:"selectorOptions",static:!1,private:!1,access:{has:e=>"selectorOptions"in e,get:e=>e.selectorOptions,set:(e,t)=>{e.selectorOptions=t}},metadata:l},rt,ot),a(null,null,B,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:l},ct,dt),a(null,null,j,{kind:"field",name:"virtualize",static:!1,private:!1,access:{has:e=>"virtualize"in e,get:e=>e.virtualize,set:(e,t)=>{e.virtualize=t}},metadata:l},ht,ut),a(null,null,I,{kind:"field",name:"rowHeight",static:!1,private:!1,access:{has:e=>"rowHeight"in e,get:e=>e.rowHeight,set:(e,t)=>{e.rowHeight=t}},metadata:l},pt,mt),a(null,null,O,{kind:"field",name:"virtualBuffer",static:!1,private:!1,access:{has:e=>"virtualBuffer"in e,get:e=>e.virtualBuffer,set:(e,t)=>{e.virtualBuffer=t}},metadata:l},gt,bt),a(null,null,P,{kind:"field",name:"columnResize",static:!1,private:!1,access:{has:e=>"columnResize"in e,get:e=>e.columnResize,set:(e,t)=>{e.columnResize=t}},metadata:l},vt,yt),a(null,null,V,{kind:"field",name:"editable",static:!1,private:!1,access:{has:e=>"editable"in e,get:e=>e.editable,set:(e,t)=>{e.editable=t}},metadata:l},ft,wt),a(null,null,H,{kind:"field",name:"editMode",static:!1,private:!1,access:{has:e=>"editMode"in e,get:e=>e.editMode,set:(e,t)=>{e.editMode=t}},metadata:l},kt,xt),a(null,null,N,{kind:"field",name:"density",static:!1,private:!1,access:{has:e=>"density"in e,get:e=>e.density,set:(e,t)=>{e.density=t}},metadata:l},St,Ct),a(null,null,q,{kind:"field",name:"headerFilters",static:!1,private:!1,access:{has:e=>"headerFilters"in e,get:e=>e.headerFilters,set:(e,t)=>{e.headerFilters=t}},metadata:l},Et,Dt),a(null,null,_,{kind:"field",name:"quickFilter",static:!1,private:!1,access:{has:e=>"quickFilter"in e,get:e=>e.quickFilter,set:(e,t)=>{e.quickFilter=t}},metadata:l},zt,At),a(null,null,W,{kind:"field",name:"rowReorder",static:!1,private:!1,access:{has:e=>"rowReorder"in e,get:e=>e.rowReorder,set:(e,t)=>{e.rowReorder=t}},metadata:l},$t,Ft),a(null,null,K,{kind:"field",name:"columnReorder",static:!1,private:!1,access:{has:e=>"columnReorder"in e,get:e=>e.columnReorder,set:(e,t)=>{e.columnReorder=t}},metadata:l},Tt,Lt),a(null,null,Y,{kind:"field",name:"columnMenu",static:!1,private:!1,access:{has:e=>"columnMenu"in e,get:e=>e.columnMenu,set:(e,t)=>{e.columnMenu=t}},metadata:l},Mt,Rt),a(null,null,U,{kind:"field",name:"lazyLoad",static:!1,private:!1,access:{has:e=>"lazyLoad"in e,get:e=>e.lazyLoad,set:(e,t)=>{e.lazyLoad=t}},metadata:l},Bt,jt),a(null,null,G,{kind:"field",name:"lazyLoadThreshold",static:!1,private:!1,access:{has:e=>"lazyLoadThreshold"in e,get:e=>e.lazyLoadThreshold,set:(e,t)=>{e.lazyLoadThreshold=t}},metadata:l},It,Ot),a(null,null,J,{kind:"field",name:"selectedRows",static:!1,private:!1,access:{has:e=>"selectedRows"in e,get:e=>e.selectedRows,set:(e,t)=>{e.selectedRows=t}},metadata:l},Pt,Vt),a(null,null,X,{kind:"field",name:"table",static:!1,private:!1,access:{has:e=>"table"in e,get:e=>e.table,set:(e,t)=>{e.table=t}},metadata:l},Ht,Nt),a(null,null,Q,{kind:"field",name:"thead",static:!1,private:!1,access:{has:e=>"thead"in e,get:e=>e.thead,set:(e,t)=>{e.thead=t}},metadata:l},qt,_t),a(null,null,Z,{kind:"field",name:"tbody",static:!1,private:!1,access:{has:e=>"tbody"in e,get:e=>e.tbody,set:(e,t)=>{e.tbody=t}},metadata:l},Wt,Kt),a(null,e={value:s},Se,{kind:"class",name:s.name,metadata:l},null,Ce),s=e.value,l&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l}),i(s,Ce)}setData(e){this._unsortedData=[...e],this.data=e,this.render()}setColumns(e){this.columns=e,this.render()}async*getTableConfig(){const e=await(yield{});return this.columns=e.columns||[],this.selectorOptions=e.selectorOptions||[],await new Promise(e=>requestAnimationFrame(e)),this.renderHeader(),this.renderControls(),e}async*getTableData(){this.loading=!0,this.selectedRows=[];try{const e={search:this.searchText,sort:this.currentSort,filter:this.filterEngine.getFilterModel(),selector:this.selector};this.pagination&&(e.page=this.currentPage,e.pageSize=this.pageSize);const t=await(yield e);return this.data=t.data||[],void 0!==t.totalItems&&(this.totalItems=t.totalItems),this.loading=!1,await new Promise(e=>requestAnimationFrame(e)),this.renderBody(),t}catch(e){console.error("Error loading table data:",e),this.data=[],this.loading=!1,await new Promise(e=>requestAnimationFrame(e)),this.renderBody()}}debouncedDataRequest(){this.loading||(this.loading=!0),this.dataRequestTimeout&&clearTimeout(this.dataRequestTimeout),this.dataRequestTimeout=setTimeout(()=>{this.getTableData(),this.dataRequestTimeout=null},150)}styles(){return t.css`
|
|
564
|
+
`}getCellComponent(e){switch(e){case"text":return"snice-cell-text";case"number":case"accounting":case"scientific":case"fraction":return"snice-cell-number";case"date":return"snice-cell-date";case"boolean":return"snice-cell-boolean";case"sparkline":return"snice-cell-sparkline";case"rating":return"snice-cell-rating";case"progress":return"snice-cell-progress";case"duration":return"snice-cell-duration";case"filesize":return"snice-cell-filesize";case"link":case"url":return"snice-cell-link";case"actions":return"snice-cell-actions";case"tag":case"tags":case"badge":case"badges":return"snice-cell-tag";case"image":case"avatar":case"thumbnail":return"snice-cell-image";case"email":return"snice-cell-email";case"phone":case"tel":case"telephone":return"snice-cell-phone";case"status":return"snice-cell-status";case"color":return"snice-cell-color";case"json":case"object":return"snice-cell-json";case"currency":case"money":return"snice-cell-currency";case"percent":case"percentage":return"snice-cell-percentage";case"location":case"address":case"coordinates":return"snice-cell-location";default:return"snice-cell"}}getCellStyles(e){let t=[];return e.width&&(t.push(`width: ${e.width}`),t.push(`min-width: ${e.width}`),t.push(`max-width: ${e.width}`)),e.align&&t.push(`text-align: ${e.align}`),t.join("; ")}escapeHtml(e){if(null==e)return"";const t=String(e),i=document.createElement("div");return i.textContent=t,i.innerHTML}toggleSelection(){this.selected=!this.selected,this.dispatchRowSelect()}dispatchRowClick(){return{data:this.data,index:this.index,element:this}}dispatchRowSelect(){return{selected:this.selected,data:this.data,index:this.index,element:this}}dispatchRowHover(){return{data:this.data,index:this.index,element:this}}select(){this.selected=!0,this.dispatchRowSelect()}deselect(){this.selected=!1,this.dispatchRowSelect()}focusRow(){super.focus(),this.scrollIntoView({behavior:"smooth",block:"nearest"})}getCellValue(e){return this.data[e]}setCellValue(e,t){this.data={...this.data,[e]:t},this.updateCells()}getCellElement(e){const t=this.columns.find(t=>t.key===e);if(!t)return null;const i=this.columns.indexOf(t);return this.shadowRoot?.querySelector(`[data-column-index="${i}"]`)||null}highlight(e=2e3){this.classList.add("row--highlighted"),setTimeout(()=>{this.classList.remove("row--highlighted")},e)}constructor(){super(...arguments),this.selected=(a(this,C),a(this,E,!1)),this.hoverable=(a(this,D),a(this,z,!0)),this.clickable=(a(this,A),a(this,$,!1)),this.selectable=(a(this,F),a(this,T,!1)),this.data=(a(this,L),a(this,M,{})),this.index=(a(this,R),a(this,B,0)),this.columns=(a(this,j),a(this,I,[])),a(this,O)}})})();class l{constructor(){this.rafId=0,this.lastStartIndex=-1,this.lastEndIndex=-1,this.enabled=!1,this.topSpacer=document.createElement("tr"),this.topSpacer.className="virtual-spacer virtual-spacer--top",this.topSpacer.style.display="table-row",this.bottomSpacer=document.createElement("tr"),this.bottomSpacer.className="virtual-spacer virtual-spacer--bottom",this.bottomSpacer.style.display="table-row",this.contentContainer=document.createElement("tbody"),this.options={},this.scrollHandler=()=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>this.update())}}attach(e){this.options=e,this.enabled=!0,this.options.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!0}),window.addEventListener("resize",this.scrollHandler,{passive:!0}),this.update()}detach(){this.enabled=!1,this.options.scrollContainer?.removeEventListener("scroll",this.scrollHandler),window.removeEventListener("resize",this.scrollHandler),cancelAnimationFrame(this.rafId)}setTotalRows(e){this.options.totalRows=e,this.lastStartIndex=-1,this.update()}refresh(){this.lastStartIndex=-1,this.lastEndIndex=-1,this.update()}update(){if(!this.enabled||!this.options.scrollContainer)return;const{rowHeight:e,bufferPx:t,totalRows:i,scrollContainer:a,renderRange:s}=this.options,n=a.scrollTop,l=a.clientHeight,r=i*e,o=Math.max(0,n-t),c=Math.min(r,n+l+t),d=Math.floor(o/e),h=Math.min(i,Math.ceil(c/e));if(d===this.lastStartIndex&&h===this.lastEndIndex)return;this.lastStartIndex=d,this.lastEndIndex=h;const u=d*e,p=Math.max(0,(i-h)*e);this.topSpacer.style.height=`${u}px`,this.bottomSpacer.style.height=`${p}px`;const m=s(d,h),g=this.options.scrollContainer.querySelector("tbody");if(g){if(g.innerHTML="",u>0){const e=document.createElement("td");e.colSpan=999,e.style.height=`${u}px`,e.style.padding="0",e.style.border="none",this.topSpacer.innerHTML="",this.topSpacer.appendChild(e),g.appendChild(this.topSpacer)}if(g.appendChild(m),p>0){const e=document.createElement("td");e.colSpan=999,e.style.height=`${p}px`,e.style.padding="0",e.style.border="none",this.bottomSpacer.innerHTML="",this.bottomSpacer.appendChild(e),g.appendChild(this.bottomSpacer)}}}getVisibleRange(){return{start:this.lastStartIndex,end:this.lastEndIndex}}scrollToRow(e){if(!this.options.scrollContainer)return;const t=e*this.options.rowHeight;this.options.scrollContainer.scrollTop=t}getScrollPosition(){const e=this.options.scrollContainer;return{top:e?.scrollTop??0,left:e?.scrollLeft??0}}isEnabled(){return this.enabled}}class r{constructor(){this.states=new Map,this.groups=[],this.resizeStartX=0,this.resizeStartWidth=0,this.resizingKey=null,this.resizeOverlay=null,this.tableElement=null}initialize(e,t){this.tableElement=t,e.forEach((e,t)=>{const i=this.states.get(e.key);this.states.set(e.key,{key:e.key,width:i?.width??this.parseWidth(e.width)??150,flex:e.flex,minWidth:e.minWidth??50,maxWidth:e.maxWidth??1/0,visible:i?.visible??!0,pinned:i?.pinned??(e.pinned||!1),order:i?.order??t,resizable:!1!==e.resizable,reorderable:!1!==e.reorderable,hideable:!1!==e.hideable,pinnable:!1!==e.pinnable})})}parseWidth(e){if(!e)return;const t=parseInt(e,10);return isNaN(t)?void 0:t}getVisibleColumns(){return Array.from(this.states.values()).filter(e=>e.visible).sort((e,t)=>e.order-t.order)}getAllStates(){return Array.from(this.states.values()).sort((e,t)=>e.order-t.order)}getPinnedLeft(){return this.getVisibleColumns().filter(e=>"left"===e.pinned)}getPinnedRight(){return this.getVisibleColumns().filter(e=>"right"===e.pinned)}getUnpinned(){return this.getVisibleColumns().filter(e=>!e.pinned)}computeFlexWidths(e){const t=this.getVisibleColumns(),i=new Map;let a=0;const s=[];for(const e of t)e.flex&&e.flex>0?s.push(e):(a+=e.width,i.set(e.key,e.width));const n=Math.max(0,e-a),l=s.reduce((e,t)=>e+(t.flex||1),0);for(const e of s){const t=(e.flex||1)/l*n,a=Math.max(e.minWidth,Math.min(e.maxWidth,t));i.set(e.key,a)}return i}applyWidths(e,t){e.querySelectorAll("th[data-key]").forEach(e=>{const i=e.getAttribute("data-key");i&&t.has(i)&&(e.style.width=`${t.get(i)}px`)})}startResize(e,t){const i=this.states.get(e);if(!i||!i.resizable)return;this.resizingKey=e,this.resizeStartX=t,this.resizeStartWidth=i.width,this.resizeOverlay=document.createElement("div"),this.resizeOverlay.style.cssText="position:fixed;inset:0;z-index:99999;cursor:col-resize;",document.body.appendChild(this.resizeOverlay);const a=t=>{t.preventDefault();const a=t.clientX-this.resizeStartX,s=Math.max(i.minWidth,Math.min(i.maxWidth,this.resizeStartWidth+a));i.width=s,i.flex=void 0;const n=this.tableElement?.shadowRoot;if(n){const t=n.querySelector(`th[data-key="${e}"]`);t&&(t.style.width=`${s}px`);n.querySelectorAll(`td[data-key="${e}"]`).forEach(e=>e.style.width=`${s}px`)}this.tableElement?.dispatchEvent(new CustomEvent("column-resize",{detail:{key:e,width:s},bubbles:!0,composed:!0}))},s=()=>{this.resizingKey=null,this.resizeOverlay?.remove(),this.resizeOverlay=null,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s),this.tableElement?.dispatchEvent(new CustomEvent("column-resize-end",{detail:{key:e,width:i.width},bubbles:!0,composed:!0}))};document.addEventListener("mousemove",a),document.addEventListener("mouseup",s)}autoSizeColumn(e,t){const i=this.states.get(e);if(!i)return;const a=this.tableElement?.shadowRoot?.querySelector(`th[data-key="${e}"]`);let s=a?a.scrollWidth:0;t.querySelectorAll(`td[data-key="${e}"]`).forEach(e=>{s=Math.max(s,e.scrollWidth)}),i.width=Math.max(i.minWidth,Math.min(i.maxWidth,s+16)),i.flex=void 0}autoSizeAll(e){for(const t of this.states.keys())this.autoSizeColumn(t,e)}setColumnVisible(e,t){const i=this.states.get(e);i&&i.hideable&&(i.visible=t)}showAllColumns(){for(const e of this.states.values())e.visible=!0}hideAllColumns(){for(const e of this.states.values())e.hideable&&(e.visible=!1)}getVisibilityModel(){const e={};for(const[t,i]of this.states)e[t]=i.visible;return e}moveColumn(e,t){const i=this.states.get(e);if(!i||!i.reorderable||i.pinned)return;const a=this.getVisibleColumns(),s=a.findIndex(t=>t.key===e);-1!==s&&s!==t&&(a.splice(s,1),a.splice(t,0,i),a.forEach((e,t)=>{e.order=t}))}pinColumn(e,t){const i=this.states.get(e);i&&i.pinnable&&(i.pinned=t)}unpinColumn(e){const t=this.states.get(e);t&&(t.pinned=!1)}setColumnGroups(e){this.groups=e}getColumnGroups(){return this.groups}renderGroupHeaders(){return 0===this.groups.length?"":this.groups.map(e=>{const t=e.children.filter(e=>this.states.get(e)?.visible).length;return 0===t?"":`<th colspan="${t}" class="column-group-header ${e.headerClass||""}">${e.label}</th>`}).join("")}isResizing(){return null!==this.resizingKey}getState(e){return this.states.get(e)}getPinnedLeftOffsets(){const e=new Map;let t=0;for(const i of this.getPinnedLeft())e.set(i.key,t),t+=i.width;return e}getPinnedRightOffsets(){const e=new Map,t=this.getPinnedRight();let i=0;for(let a=t.length-1;a>=0;a--)e.set(t[a].key,i),i+=t[a].width;return e}}const o=[{value:"contains",label:"contains",requiresValue:!0},{value:"notContains",label:"does not contain",requiresValue:!0},{value:"equals",label:"equals",requiresValue:!0},{value:"notEquals",label:"does not equal",requiresValue:!0},{value:"startsWith",label:"starts with",requiresValue:!0},{value:"endsWith",label:"ends with",requiresValue:!0},{value:"isEmpty",label:"is empty",requiresValue:!1},{value:"isNotEmpty",label:"is not empty",requiresValue:!1}],c=[{value:"eq",label:"=",requiresValue:!0},{value:"neq",label:"≠",requiresValue:!0},{value:"gt",label:">",requiresValue:!0},{value:"gte",label:"≥",requiresValue:!0},{value:"lt",label:"<",requiresValue:!0},{value:"lte",label:"≤",requiresValue:!0},{value:"isEmpty",label:"is empty",requiresValue:!1},{value:"isNotEmpty",label:"is not empty",requiresValue:!1}],d=[{value:"is",label:"is",requiresValue:!0},{value:"isNot",label:"is not",requiresValue:!0},{value:"before",label:"before",requiresValue:!0},{value:"onOrBefore",label:"on or before",requiresValue:!0},{value:"after",label:"after",requiresValue:!0},{value:"onOrAfter",label:"on or after",requiresValue:!0},{value:"isEmpty",label:"is empty",requiresValue:!1},{value:"isNotEmpty",label:"is not empty",requiresValue:!1}],h=[{value:"isTrue",label:"is true",requiresValue:!1},{value:"isFalse",label:"is false",requiresValue:!1}];class u{constructor(){this.model={filters:[],logic:"and"},this.headerFilters=new Map}getOperatorsForType(e){switch(e){case"number":case"currency":case"rating":case"progress":case"filesize":case"duration":return c;case"date":return d;case"boolean":return h;default:return o}}setFilterModel(e){this.model=e}getFilterModel(){return{...this.model}}setColumnFilter(e,t,i){const a=this.model.filters.findIndex(t=>t.column===e);a>=0?this.model.filters[a]={column:e,operator:t,value:i}:this.model.filters.push({column:e,operator:t,value:i})}removeColumnFilter(e){this.model.filters=this.model.filters.filter(t=>t.column!==e)}clearAllFilters(){this.model.filters=[],this.model.quickFilter=void 0,this.headerFilters.clear()}setQuickFilter(e){this.model.quickFilter=e||void 0}setHeaderFilter(e,t){t?this.headerFilters.set(e,t):this.headerFilters.delete(e)}getHeaderFilter(e){return this.headerFilters.get(e)||""}setFilterLogic(e){this.model.logic=e}hasActiveFilters(){return this.model.filters.length>0||!!this.model.quickFilter||this.headerFilters.size>0}hasColumnFilter(e){return this.model.filters.some(t=>t.column===e)||this.headerFilters.has(e)}getActiveFilterCount(){return this.model.filters.length+this.headerFilters.size+(this.model.quickFilter?1:0)}applyFilters(e,t){let i=e;this.model.filters.length>0&&(i=i.filter(e=>{const t=this.model.filters.map(t=>this.evaluateFilter(t,e));return"and"===this.model.logic?t.every(Boolean):t.some(Boolean)}));for(const[e,t]of this.headerFilters){const a=t.toLowerCase();i=i.filter(t=>{const i=t[e];return null!=i&&String(i).toLowerCase().includes(a)})}if(this.model.quickFilter){const e=this.model.quickFilter.toLowerCase().split(/\s+/).filter(Boolean),a=t.map(e=>e.key),s=this.model.quickFilterLogic||"and";i=i.filter(t=>{const i=e=>a.some(i=>{const a=t[i];return null!=a&&String(a).toLowerCase().includes(e)});return"and"===s?e.every(i):e.some(i)})}return i}evaluateFilter(e,t){const i=t[e.column],a=e.value;switch(e.operator){case"contains":return null!=i&&String(i).toLowerCase().includes(String(a).toLowerCase());case"notContains":return null==i||!String(i).toLowerCase().includes(String(a).toLowerCase());case"equals":return String(i??"").toLowerCase()===String(a).toLowerCase();case"notEquals":return String(i??"").toLowerCase()!==String(a).toLowerCase();case"startsWith":return null!=i&&String(i).toLowerCase().startsWith(String(a).toLowerCase());case"endsWith":return null!=i&&String(i).toLowerCase().endsWith(String(a).toLowerCase());case"isEmpty":return null==i||""===i;case"isNotEmpty":return null!=i&&""!==i;case"eq":return Number(i)===Number(a);case"neq":return Number(i)!==Number(a);case"gt":return Number(i)>Number(a);case"gte":return Number(i)>=Number(a);case"lt":return Number(i)<Number(a);case"lte":return Number(i)<=Number(a);case"is":return new Date(i).toDateString()===new Date(a).toDateString();case"isNot":return new Date(i).toDateString()!==new Date(a).toDateString();case"before":return new Date(i)<new Date(a);case"onOrBefore":return new Date(i)<=new Date(a);case"after":return new Date(i)>new Date(a);case"onOrAfter":return new Date(i)>=new Date(a);case"isTrue":return!0===i||"true"===i||1===i;case"isFalse":return!1===i||"false"===i||0===i||null==i;default:return!0}}toServerParams(){return{filters:this.model.filters,filterLogic:this.model.logic,quickFilter:this.model.quickFilter,headerFilters:Object.fromEntries(this.headerFilters)}}}class p{constructor(){this.cellState=null,this.rowState=null,this.pipelines=new Map,this.validators=new Map,this.editableColumns=new Set,this.editabilityCheck=null,this.tableElement=null,this.mode="cell"}attach(e){this.tableElement=e}setEditableColumns(e){this.editableColumns=new Set(e)}setEditabilityCheck(e){this.editabilityCheck=e}setEditMode(e){this.mode=e}setPipeline(e,t){this.pipelines.set(e,t)}setValidation(e,t){this.validators.set(e,t)}isCellEditable(e,t){return!!this.editableColumns.has(t)&&(!this.editabilityCheck||this.editabilityCheck(e,t))}getDisplayValue(e,t,i){const a=this.pipelines.get(e);let s=t;return a?.valueGetter&&(s=a.valueGetter(s,i)),a?.valueFormatter?a.valueFormatter(s,i):null==s?"":String(s)}getSortValue(e,t,i){const a=this.pipelines.get(e);return a?.valueGetter?a.valueGetter(t,i):t}getEditorType(e){switch(e){case"number":case"currency":case"rating":case"progress":return"number";case"date":return"date";case"boolean":return"boolean";default:return"text"}}startCellEdit(e,t,i,a){return this.isCellEditable(a,t)?(this.cellState?.isEditing&&this.cancelCellEdit(),this.cellState={rowIndex:e,columnKey:t,originalValue:i,currentValue:i,editorType:this.getEditorType(t),error:null,isEditing:!0},this.cellState):null}updateCellValue(e){this.cellState&&(this.cellState.currentValue=e,this.cellState.error=null)}async commitCellEdit(){if(!this.cellState?.isEditing)return null;const{columnKey:e,currentValue:t,rowIndex:i}=this.cellState,a=this.pipelines.get(e);let s=t;a?.valueParser&&(s=a.valueParser(String(t),{}));const n=this.validators.get(e);if(n){const e=await n.validate(s,{});if(e)return this.cellState.error=e,e}return a?.valueSetter&&(s=a.valueSetter(s,{})),this.tableElement?.dispatchEvent(new CustomEvent("cell-edit-commit",{detail:{rowIndex:i,columnKey:e,oldValue:this.cellState.originalValue,newValue:s},bubbles:!0,composed:!0})),this.cellState.isEditing=!1,this.cellState=null,null}cancelCellEdit(){this.cellState?.isEditing&&(this.tableElement?.dispatchEvent(new CustomEvent("cell-edit-cancel",{detail:{rowIndex:this.cellState.rowIndex,columnKey:this.cellState.columnKey},bubbles:!0,composed:!0})),this.cellState.isEditing=!1,this.cellState=null)}getCellEditState(){return this.cellState}startRowEdit(e,t){return this.rowState?.isEditing&&this.cancelRowEdit(),this.rowState={rowIndex:e,originalRow:{...t},editedRow:{...t},errors:new Map,isEditing:!0},this.rowState}updateRowField(e,t){this.rowState&&(this.rowState.editedRow[e]=t,this.rowState.errors.delete(e))}async commitRowEdit(){if(!this.rowState?.isEditing)return null;const e=new Map;for(const t of this.editableColumns){const i=this.validators.get(t);if(i){const a=this.rowState.editedRow[t],s=await i.validate(a,this.rowState.editedRow);s&&e.set(t,s)}}if(e.size>0)return this.rowState.errors=e,e;const t={...this.rowState.editedRow};for(const[e,i]of this.pipelines)i.valueSetter&&e in t&&(t[e]=i.valueSetter(t[e],t));return this.tableElement?.dispatchEvent(new CustomEvent("row-edit-commit",{detail:{rowIndex:this.rowState.rowIndex,oldRow:this.rowState.originalRow,newRow:t},bubbles:!0,composed:!0})),this.rowState.isEditing=!1,this.rowState=null,null}cancelRowEdit(){this.rowState?.isEditing&&(this.tableElement?.dispatchEvent(new CustomEvent("row-edit-cancel",{detail:{rowIndex:this.rowState.rowIndex},bubbles:!0,composed:!0})),this.rowState.isEditing=!1,this.rowState=null)}getRowEditState(){return this.rowState}isEditing(){return(this.cellState?.isEditing||this.rowState?.isEditing)??!1}createEditor(e,t,i){switch(e){case"number":{const e=document.createElement("input");return e.type="number",e.value=null==t?"":String(t),e.className="table-editor-input",e}case"date":{const e=document.createElement("input");return e.type="date",e.value=t||"",e.className="table-editor-input",e}case"boolean":{const e=document.createElement("input");return e.type="checkbox",e.checked=!!t,e.className="table-editor-checkbox",e}case"select":{const e=document.createElement("select");return e.className="table-editor-select",(i?.selectOptions||[]).forEach(i=>{const a=document.createElement("option");a.value=i.value,a.textContent=i.label,i.value===String(t)&&(a.selected=!0),e.appendChild(a)}),e}default:{const e=document.createElement("input");return e.type="text",e.value=null==t?"":String(t),e.className="table-editor-input",e}}}}class m{constructor(){this.focusedRow=-1,this.focusedCol=0,this.attached=!1,this.options={},this.keyHandler=e=>this.handleKeyDown(e)}attach(e){this.options=e;const t=this.getTable();t&&(t.setAttribute("role","grid"),t.setAttribute("tabindex","0"),t.addEventListener("keydown",this.keyHandler),this.attached=!0,this.applyARIA())}detach(){const e=this.getTable();e&&e.removeEventListener("keydown",this.keyHandler),this.attached=!1}getTable(){return this.options.shadowRoot?.querySelector("table")??null}applyARIA(){const e=this.getTable();if(!e)return;e.setAttribute("aria-rowcount",String(this.options.totalRows+1)),e.setAttribute("aria-colcount",String(this.options.totalColumns));const t=e.querySelector("thead tr");if(t){t.setAttribute("role","row"),t.setAttribute("aria-rowindex","1");t.querySelectorAll("th").forEach((e,t)=>{if(e.setAttribute("role","columnheader"),e.setAttribute("aria-colindex",String(t+1)),e.classList.contains("sortable")){const t=e.querySelector(".sort-indicator.active");if(t){const i=t.textContent?.trim()||"";i.includes("▲")?e.setAttribute("aria-sort","ascending"):i.includes("▼")&&e.setAttribute("aria-sort","descending")}else e.setAttribute("aria-sort","none")}})}e.querySelectorAll("tbody tr:not(.virtual-spacer)").forEach((e,t)=>{e.setAttribute("role","row"),e.setAttribute("aria-rowindex",String(t+2));"true"===e.getAttribute("data-selected")?e.setAttribute("aria-selected","true"):e.removeAttribute("aria-selected");e.querySelectorAll("td").forEach((e,t)=>{e.setAttribute("role","gridcell"),e.setAttribute("aria-colindex",String(t+1))})}),this.updateFocusIndicator()}setFocus(e,t){this.focusedRow=e,this.focusedCol=t,this.updateFocusIndicator()}getFocus(){return{row:this.focusedRow,col:this.focusedCol}}updateFocusIndicator(){const e=this.getTable();if(!e)return;e.querySelectorAll("[data-grid-focus]").forEach(e=>{e.removeAttribute("data-grid-focus"),e.removeAttribute("tabindex")});let t=null;if(-1===this.focusedRow){t=e.querySelectorAll("thead th")[this.focusedCol]}else{const i=e.querySelectorAll("tbody tr:not(.virtual-spacer)")[this.focusedRow];if(i){t=i.querySelectorAll("td")[this.focusedCol]}}t&&(t.setAttribute("data-grid-focus","true"),t.setAttribute("tabindex","0"))}handleKeyDown(e){if(this.options.isEditing())return;const{totalRows:t,totalColumns:i}=this.options;switch(e.key){case"ArrowDown":e.preventDefault(),this.focusedRow=Math.min(t-1,this.focusedRow+1),this.updateFocusIndicator(),this.scrollIntoView();break;case"ArrowUp":e.preventDefault(),this.focusedRow=Math.max(-1,this.focusedRow-1),this.updateFocusIndicator(),this.scrollIntoView();break;case"ArrowRight":e.preventDefault(),this.focusedCol=Math.min(i-1,this.focusedCol+1),this.updateFocusIndicator();break;case"ArrowLeft":e.preventDefault(),this.focusedCol=Math.max(0,this.focusedCol-1),this.updateFocusIndicator();break;case"Home":e.preventDefault(),e.ctrlKey?(this.focusedRow=-1,this.focusedCol=0):this.focusedCol=0,this.updateFocusIndicator(),this.scrollIntoView();break;case"End":e.preventDefault(),e.ctrlKey?(this.focusedRow=t-1,this.focusedCol=i-1):this.focusedCol=i-1,this.updateFocusIndicator(),this.scrollIntoView();break;case"PageDown":e.preventDefault(),this.focusedRow=Math.min(t-1,this.focusedRow+10),this.updateFocusIndicator(),this.scrollIntoView();break;case"PageUp":e.preventDefault(),this.focusedRow=Math.max(0,this.focusedRow-10),this.updateFocusIndicator(),this.scrollIntoView();break;case" ":this.focusedRow>=0&&(e.preventDefault(),e.shiftKey&&this.options.onSelectionToggle?.(this.focusedRow));break;case"Enter":if(this.focusedRow>=0&&this.focusedCol>=0){e.preventDefault();const t=this.getTable(),i=t?.querySelectorAll("tbody tr:not(.virtual-spacer)"),a=i?.[this.focusedRow],s=a?.querySelectorAll("td"),n=s?.[this.focusedCol],l=n?.getAttribute("data-key")||"";this.options.onCellActivate?.(this.focusedRow,l)}break;case"a":(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.options.onSelectAll?.())}}scrollIntoView(){const e=this.getTable();if(!e)return;const t=e.querySelector("[data-grid-focus]");t&&(t.scrollIntoView({block:"nearest",inline:"nearest"}),t.focus({preventScroll:!0}))}isAttached(){return this.attached}}class g{exportCSV(e,t,i={}){const{delimiter:a=",",filename:s="export.csv",includeHeaders:n=!0,columns:l,utf8BOM:r=!0}=i;let o=t.filter(e=>!1!==e.exportable);l&&(o=o.filter(e=>l.includes(e.key)));const c=[];n&&c.push(o.map(e=>this.escapeCSV(e.label,a)).join(a));for(const t of e){const e=o.map(e=>{const i=t[e.key];return this.escapeCSV(null==i?"":String(i),a)});c.push(e.join(a))}const d=c.join("\n"),h=new Blob([(r?"\ufeff":"")+d],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(h),p=document.createElement("a");p.href=u,p.download=s,p.style.display="none",document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(u)}print(e,t={}){const{hideFooter:i=!1,hideToolbar:a=!1,pageStyles:s=""}=t,n=window.open("","_blank");if(!n)return;const l=e.shadowRoot;if(!l)return;const r=l.querySelector("table");if(!r)return;const o=`\n <!DOCTYPE html>\n <html>\n <head>\n <title>Print</title>\n <style>\n body { font-family: system-ui, -apple-system, sans-serif; margin: 1rem; }\n table { width: 100%; border-collapse: collapse; }\n th, td { padding: 8px 12px; border: 1px solid #ddd; text-align: left; }\n th { background: #f5f5f5; font-weight: 600; }\n ${i?".pagination { display: none; }":""}\n ${a?".table-controls { display: none; }":""}\n @media print {\n body { margin: 0; }\n table { page-break-inside: auto; }\n tr { page-break-inside: avoid; }\n }\n ${s}\n </style>\n </head>\n <body>\n ${r.outerHTML}\n </body>\n </html>\n `;n.document.write(o),n.document.close(),n.onload=()=>{n.print(),n.close()}}async copyToClipboard(e,t,i,a={}){const{delimiter:s="\t"}=a,n=i.length>0?i.map(t=>e[t]).filter(Boolean):e;if(0===n.length)return!1;const l=n.map(e=>t.map(t=>{const i=e[t.key];return null==i?"":String(i)}).join(s)).join("\n");try{return await navigator.clipboard.writeText(l),!0}catch{const e=document.createElement("textarea");e.value=l,e.style.cssText="position:fixed;left:-9999px;",document.body.appendChild(e),e.select();const t=document.execCommand("copy");return document.body.removeChild(e),t}}escapeCSV(e,t){return e.includes(t)||e.includes('"')||e.includes("\n")||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e}}class b{constructor(){this.expandedRows=new Set,this.options=null,this.tableElement=null}attach(e,t){this.tableElement=e,this.options=t}isExpanded(e){return this.expandedRows.has(e)}toggle(e){this.expandedRows.has(e)?this.collapse(e):this.expand(e)}expand(e){this.expandedRows.add(e),this.tableElement?.dispatchEvent(new CustomEvent("row-expand",{detail:{rowIndex:e},bubbles:!0,composed:!0}))}collapse(e){this.expandedRows.delete(e),this.tableElement?.dispatchEvent(new CustomEvent("row-collapse",{detail:{rowIndex:e},bubbles:!0,composed:!0}))}expandAll(e){for(let t=0;t<e;t++)this.expandedRows.add(t)}collapseAll(){this.expandedRows.clear()}getExpandedRows(){return new Set(this.expandedRows)}createToggleButton(e){const t=this.isExpanded(e),i=document.createElement("button");return i.type="button",i.className="detail-toggle"+(t?" detail-toggle--expanded":""),i.setAttribute("aria-expanded",String(t)),i.setAttribute("aria-label",t?"Collapse row":"Expand row"),i.innerHTML='<svg class="detail-toggle-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>',i.addEventListener("click",t=>{t.stopPropagation(),this.toggle(e),this.tableElement?.dispatchEvent(new CustomEvent("detail-toggle",{detail:{rowIndex:e,expanded:this.isExpanded(e)},bubbles:!0,composed:!0}))}),i}createDetailRow(e,t,i){if(!this.options||!this.isExpanded(t))return null;const a=document.createElement("tr");a.className="detail-row",a.setAttribute("data-detail-for",String(t));const s=document.createElement("td");s.colSpan=i,s.className="detail-cell",s.style.padding="0",s.style.border="none";const n=document.createElement("div");n.className="detail-content";const l=document.createElement("div");l.className="detail-content-inner";const r=this.options.getDetailContent(e,t);return"string"==typeof r?l.innerHTML=r:r instanceof HTMLElement&&l.appendChild(r),n.appendChild(l),s.appendChild(n),requestAnimationFrame(()=>{const e=l.scrollHeight;n.style.setProperty("--detail-max-height",`${e}px`),n.classList.add("detail-content--open")}),a.appendChild(s),a}isEnabled(){return null!==this.options}}class v{constructor(){this.container=null,this.options={},this.tableElement=null,this.filterEngine=null,this.activeModal=null,this.onSearch=null,this.onSortColumn=null,this.onSetSortModel=null,this.onFilterColumn=null,this.onRemoveFilter=null,this.onClearFilters=null,this.onSetFilterModel=null,this.onExportCSV=null,this.onFullscreen=null}attach(e,t,i={}){this.tableElement=e,this.container=t,this.options=i,this.render()}setFilterEngine(e){this.filterEngine=e}render(){if(!this.container)return;this.container.innerHTML="";const e=document.createElement("div");if(e.className="table-toolbar",e.setAttribute("part","toolbar"),!1!==this.options.showSearch){const t=document.createElement("snice-input");let i;t.type="search",t.placeholder=this.options.searchPlaceholder||"Search...",t.size="small",t.className="toolbar-search",t.addEventListener("input",()=>{clearTimeout(i),i=window.setTimeout(()=>{this.onSearch?.(t.value)},300)}),e.appendChild(t)}const t=document.createElement("div");if(t.className="toolbar-actions",!1!==this.options.showSort){const e=this.mkBtn("Sort",this.sortIcon());e.addEventListener("click",e=>{e.stopPropagation(),this.openSortModal()}),t.appendChild(e)}if(!1!==this.options.showFilter){const e=this.mkBtn("Filter",this.filterIcon());e.addEventListener("click",e=>{e.stopPropagation(),this.openFilterModal()}),t.appendChild(e)}if(this.options.showExport){const e=this.mkBtn("Export CSV",this.exportIcon());e.addEventListener("click",()=>this.onExportCSV?.()),t.appendChild(e)}const i=this.mkBtn("Fullscreen",this.fullscreenIcon());i.addEventListener("click",()=>this.onFullscreen?.()),t.appendChild(i),e.appendChild(t),this.container.appendChild(e)}mkBtn(e,t){const i=document.createElement("button");return i.className="toolbar-btn",i.setAttribute("aria-label",e),i.setAttribute("title",e),i.innerHTML=t,i}mkSelect(e,t,i,a=!1){const s=document.createElement("snice-select");return s.size="small",s.searchable=a,s.maxHeight="150px",s.options=e,t&&(s.value=t),i&&(s.style.cssText=i),s}mkInput(e,t,i){const a=document.createElement("snice-input");return a.size="small",a.placeholder=e,null!=t&&(a.value=t),i&&(a.style.cssText=i),a}mkRemoveBtn(e){const t=document.createElement("snice-button");return t.size="small",t.variant="text",t.textContent="✕",t.style.cssText="flex:0 0 auto;",t.addEventListener("click",e),t}openSortModal(){this.closeModal();const e=this.tableElement?.columns||[];if(!e.length)return;const t=e.filter(e=>!1!==e.sortable),i=[...this.tableElement?.currentSort||[]],a=this.createModal("Sort"),s=a.querySelector('[slot="default"]')||a,n=document.createElement("div");n.style.cssText="display:flex;flex-direction:column;gap:0.5rem;";const l=document.createElement("div");l.style.cssText="display:flex;flex-direction:column;gap:0.5rem;",n.appendChild(l);const r=t.map(e=>({value:e.key,label:e.label||e.key})),o=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}],c=[],d=e=>{const t=document.createElement("div");t.style.cssText="display:flex;align-items:center;gap:0.375rem;";const i=this.mkSelect(r,e?.column,"width:10rem;",!0),a=this.mkSelect(o,e?.direction||"asc","width:8rem;");t.appendChild(i),t.appendChild(a);const s=()=>({column:i.value,direction:a.value});t.appendChild(this.mkRemoveBtn(()=>{t.remove();const e=c.findIndex(e=>e.getSort===s);e>=0&&c.splice(e,1)})),c.push({getSort:s}),l.appendChild(t)};if(i.length>0)for(const e of i)d(e);else d();const h=document.createElement("snice-button");h.size="small",h.variant="text",h.textContent="+ Add sort",h.style.cssText="width:calc(10rem + 8rem + 0.375rem);",h.addEventListener("click",()=>d()),n.appendChild(h);const u=document.createElement("div");u.setAttribute("slot","footer"),u.style.cssText="display:flex;gap:0.5rem;justify-content:flex-end;";const p=document.createElement("snice-button");p.size="small",p.variant="text",p.textContent="Clear",p.addEventListener("click",()=>{this.onSetSortModel?.([]),this.closeModal()}),u.appendChild(p);const m=document.createElement("snice-button");m.size="small",m.variant="primary",m.textContent="Apply",m.addEventListener("click",()=>{const e=c.map(e=>e.getSort()).filter(Boolean);this.onSetSortModel?.(e),this.closeModal()}),u.appendChild(m),s.appendChild(n),a.appendChild(u),this.showModal(a)}openFilterModal(e){this.closeModal();const t=this.tableElement?.columns||[];if(!t.length)return;const i=this.filterEngine||new u,a=i.getFilterModel(),s=this.createModal("Filters"),n=s.querySelector('[slot="default"]')||s,l=document.createElement("div");l.style.cssText="display:flex;flex-direction:column;gap:0.75rem;";const r=document.createElement("div");r.style.cssText="display:flex;align-items:center;gap:0.5rem;margin-bottom:0.25rem;";const o=document.createElement("span");o.style.cssText="font-size:0.75rem;font-weight:600;text-transform:uppercase;letter-spacing:0.03em;color:var(--snice-color-text-tertiary,rgb(115 115 115));",o.textContent="Logic:",r.appendChild(o);let c=a.logic||"and";const d=document.createElement("snice-button");d.size="small",d.variant="and"===c?"primary":"text",d.textContent="AND";const h=document.createElement("snice-button");h.size="small",h.variant="or"===c?"primary":"text",h.textContent="OR",d.addEventListener("click",()=>{c="and",d.variant="primary",h.variant="text"}),h.addEventListener("click",()=>{c="or",h.variant="primary",d.variant="text"}),r.appendChild(d),r.appendChild(h),l.appendChild(r);const p=document.createElement("div");p.style.cssText="display:flex;flex-direction:column;gap:0.5rem;",l.appendChild(p);const m=t.map(e=>({value:e.key,label:e.label||e.key})),g=[],b=e=>{const a=document.createElement("div");a.style.cssText="display:flex;flex-direction:column;gap:0.25rem;padding:0.5rem;border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:var(--snice-border-radius-md,0.25rem);position:relative;";const s=this.mkSelect(m,e?.column,"width:100%;max-width:none;",!0);a.appendChild(s);const n=document.createElement("snice-select");n.size="small",n.style.cssText="width:100%;max-width:none;",a.appendChild(n);const l=this.mkInput("Value...",null!=e?.value?String(e.value):void 0,"width:100%;");a.appendChild(l);const r=()=>{const a=s.value,l=t.find(e=>e.key===a),r=l?.type||"text",c=i.getOperatorsForType(r);n.options=c.map(e=>({value:e.value,label:e.label})),e&&a===e.column&&(n.value=e.operator),o()},o=()=>{const e=s.value,a=t.find(t=>t.key===e),r=a?.type||"text",o=i.getOperatorsForType(r).find(e=>e.value===n.value);l.style.display=!1===o?.requiresValue?"none":""};s.addEventListener("change",r),n.addEventListener("change",o),r();const c=()=>{const e=s.value,a=t.find(t=>t.key===e),r=a?.type||"text",o=i.getOperatorsForType(r),c=n.value,d=o.find(e=>e.value===c),h=!1===d?.requiresValue?null:l.value;return d?.requiresValue&&!h?null:{column:e,operator:c,value:h}},d=document.createElement("snice-badge");d.content="✕",d.variant="error",d.size="small",d.position="top-right",d.style.cursor="pointer",d.appendChild(a),d.addEventListener("click",e=>{if(!e.composedPath().some(e=>e.classList?.contains("badge")))return;d.remove();const t=g.findIndex(e=>e.getFilter===c);t>=0&&g.splice(t,1)}),g.push({getFilter:c}),p.appendChild(d)};if(a.filters.length>0)for(const e of a.filters)b(e);else e?b({column:e,operator:"contains",value:""}):b();const v=document.createElement("snice-button");v.size="small",v.variant="text",v.textContent="+ Add filter",v.addEventListener("click",()=>b()),l.appendChild(v);const y=document.createElement("div");y.setAttribute("slot","footer"),y.style.cssText="display:flex;gap:0.5rem;justify-content:flex-end;";const f=document.createElement("snice-button");f.size="small",f.variant="text",f.textContent="Clear all",f.addEventListener("click",()=>{this.onClearFilters?.(),this.closeModal()}),y.appendChild(f);const w=document.createElement("snice-button");w.size="small",w.variant="primary",w.textContent="Apply",w.addEventListener("click",()=>{const e=g.map(e=>e.getFilter()).filter(Boolean);this.onSetFilterModel?.(e,c),this.closeModal()}),y.appendChild(w),n.appendChild(l),s.appendChild(y),this.showModal(s)}createModal(e,t="small"){const i=document.createElement("snice-modal");i.size=t,i.label=e,i.noBackdropDismiss=!0,i.style.cssText="--modal-padding: 0.75rem;";const a=document.createElement("span");return a.setAttribute("slot","header"),a.textContent=e,i.appendChild(a),i}showModal(e){document.body.appendChild(e),this.activeModal=e,e.addEventListener("modal-close",()=>{this.closeModal()}),requestAnimationFrame(()=>{e.open=!0;const t=e.shadowRoot?.querySelector(".modal__body");t&&(t.style.overflow="visible")})}closeModal(){this.activeModal&&(this.activeModal.open=!1,setTimeout(()=>{this.activeModal?.remove(),this.activeModal=null},300))}setActiveFilterCount(e){}isAttached(){return null!==this.container}sortIcon(){return'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"><path d="M4 6l4-4 4 4"/><path d="M4 10l4 4 4-4"/></svg>'}filterIcon(){return'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"><path d="M2 3h12M4 7h8M6 11h4"/></svg>'}exportIcon(){return'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"><path d="M8 2v8M5 7l3 3 3-3"/><path d="M3 12h10"/></svg>'}fullscreenIcon(){return'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"><polyline points="10,2 14,2 14,6"/><polyline points="6,14 2,14 2,10"/><polyline points="2,6 2,2 6,2"/><polyline points="14,10 14,14 10,14"/></svg>'}}class y{constructor(){this.options=null,this.expandedKeys=new Set,this.flatRows=[],this.enabled=!1,this.defaultDepth=0}attach(e){this.options=e,this.enabled=!0,void 0!==e.defaultExpansionDepth&&e.defaultExpansionDepth>=0&&(this.defaultDepth=e.defaultExpansionDepth)}isEnabled(){return this.enabled}processData(e){if(!this.options)return[];const t=new Map;for(const i of e){const e=this.options.getPath(i),a=e.join("/");t.set(a,{data:i,children:new Set,depth:e.length-1,isGap:!1});for(let i=1;i<e.length;i++){const a=e.slice(0,i),s=a.join("/");t.has(s)||t.set(s,{data:{[this.options.groupColumn||"name"]:a[a.length-1]},children:new Set,depth:i-1,isGap:!0})}if(e.length>1){const i=e.slice(0,-1).join("/"),s=t.get(i);s&&s.children.add(a)}}const i=[];for(const[e,a]of t)0===a.depth&&i.push(e);if(i.sort(),0===this.expandedKeys.size&&this.defaultDepth>0)for(const[e,i]of t)i.depth<this.defaultDepth&&i.children.size>0&&this.expandedKeys.add(e);this.flatRows=[];const a=e=>{const i=t.get(e);if(!i)return;const s=i.children.size>0,n=this.expandedKeys.has(e);if(this.flatRows.push({path:e.split("/"),data:i.data,depth:i.depth,hasChildren:s,expanded:n,key:e,isGap:i.isGap}),n){const e=Array.from(i.children).sort();for(const t of e)a(t)}};for(const e of i)a(e);return this.flatRows}getFlatRows(){return this.flatRows}toggle(e){this.expandedKeys.has(e)?this.expandedKeys.delete(e):this.expandedKeys.add(e)}expand(e){this.expandedKeys.add(e)}collapse(e){this.expandedKeys.delete(e)}expandAll(e){if(this.options)for(const t of e){const e=this.options.getPath(t);for(let t=1;t<=e.length;t++)this.expandedKeys.add(e.slice(0,t).join("/"))}}collapseAll(){this.expandedKeys.clear()}isExpanded(e){return this.expandedKeys.has(e)}createToggle(e){const t=document.createElement("span");if(t.className="tree-indent",t.style.paddingLeft=1.5*e.depth+"rem",e.hasChildren){const i=document.createElement("button");i.type="button",i.className="tree-toggle"+(e.expanded?" tree-toggle--expanded":""),i.innerHTML='<svg class="tree-toggle-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>',i.setAttribute("aria-expanded",String(e.expanded)),i.addEventListener("click",t=>{t.stopPropagation(),this.toggle(e.key),i.dispatchEvent(new CustomEvent("tree-toggle",{detail:{key:e.key,expanded:this.isExpanded(e.key)},bubbles:!0,composed:!0}))}),t.appendChild(i)}else{const e=document.createElement("span");e.className="tree-spacer",t.appendChild(e)}return t}getGroupColumn(){return this.options?.groupColumn||""}}class f{constructor(){this.menuEl=null,this.activeColumn=null,this.tableElement=null,this.outsideClickHandler=null,this.onSortAsc=null,this.onSortDesc=null,this.onFilter=null,this.onHide=null,this.onPinLeft=null,this.onPinRight=null,this.onUnpin=null,this.onAutoSize=null}attach(e){this.tableElement=e}show(e,t,i,a){this.hide(),this.activeColumn=e;const s=document.createElement("div");s.className="table-column-menu",s.style.left=`${t}px`,s.style.top=`${i}px`;const n=[];!1!==a?.sortable&&(n.push({label:"Sort Ascending",icon:"↑",action:"sort-asc"}),n.push({label:"Sort Descending",icon:"↓",action:"sort-desc"}),n.push({label:"",action:"",separator:!0})),!1!==a?.filterable&&n.push({label:"Filter...",icon:"⫧",action:"filter"}),!1!==a?.hideable&&n.push({label:"Hide Column",icon:"👁",action:"hide"}),!1!==a?.pinnable&&(a?.pinned?n.push({label:"Unpin",icon:"📌",action:"unpin"}):(n.push({label:"Pin Left",icon:"⇤",action:"pin-left"}),n.push({label:"Pin Right",icon:"⇥",action:"pin-right"}))),n.push({label:"",action:"",separator:!0}),n.push({label:"Auto-size",icon:"↔",action:"autosize"});for(const e of n){if(e.separator){const e=document.createElement("div");e.className="column-menu-separator",s.appendChild(e);continue}const t=document.createElement("button");t.type="button",t.className="column-menu-item",t.innerHTML=`${e.icon?`<span class="column-menu-icon">${e.icon}</span>`:""}<span>${e.label}</span>`,t.addEventListener("click",()=>{this.handleAction(e.action),this.hide()}),e.disabled&&(t.disabled=!0),s.appendChild(t)}const l=this.tableElement?.shadowRoot;l?l.appendChild(s):document.body.appendChild(s),this.menuEl=s,setTimeout(()=>{this.outsideClickHandler=e=>{e.composedPath().includes(s)||this.hide()},document.addEventListener("click",this.outsideClickHandler,{capture:!0})},0);const r=e=>{"Escape"===e.key&&(this.hide(),document.removeEventListener("keydown",r))};document.addEventListener("keydown",r)}handleAction(e){if(this.activeColumn)switch(e){case"sort-asc":this.onSortAsc?.(this.activeColumn);break;case"sort-desc":this.onSortDesc?.(this.activeColumn);break;case"filter":this.onFilter?.(this.activeColumn);break;case"hide":this.onHide?.(this.activeColumn);break;case"pin-left":this.onPinLeft?.(this.activeColumn);break;case"pin-right":this.onPinRight?.(this.activeColumn);break;case"unpin":this.onUnpin?.(this.activeColumn);break;case"autosize":this.onAutoSize?.(this.activeColumn)}}hide(){this.menuEl&&(this.menuEl.remove(),this.menuEl=null),this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler,{capture:!0}),this.outsideClickHandler=null),this.activeColumn=null}isOpen(){return null!==this.menuEl}}class w{constructor(){this.enabled=!1,this.tableElement=null,this.dragSourceIndex=-1,this.dropTargetIndex=-1,this.dropIndicator=null}attach(e){this.tableElement=e,this.enabled=!0}isEnabled(){return this.enabled}makeRowDraggable(e,t,i=!0){i&&(e.draggable=!0,e.addEventListener("dragstart",i=>{this.dragSourceIndex=t,e.style.opacity="0.5",i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",String(t))}),e.addEventListener("dragend",()=>{e.style.opacity="1",this.removeDropIndicator(),this.dragSourceIndex=-1}),e.addEventListener("dragover",i=>{i.preventDefault(),i.dataTransfer.dropEffect="move",this.dropTargetIndex=t,this.showDropIndicator(e)}),e.addEventListener("dragleave",()=>{this.removeDropIndicator()}),e.addEventListener("drop",e=>{e.preventDefault(),this.removeDropIndicator(),-1!==this.dragSourceIndex&&this.dragSourceIndex!==t&&this.tableElement?.dispatchEvent(new CustomEvent("row-reorder",{detail:{fromIndex:this.dragSourceIndex,toIndex:t},bubbles:!0,composed:!0})),this.dragSourceIndex=-1}))}createDragHandle(){const e=document.createElement("td");return e.className="drag-handle-cell",e.textContent="⠗",e.setAttribute("aria-label","Drag to reorder"),e}showDropIndicator(e){this.removeDropIndicator(),this.dropIndicator=document.createElement("div"),this.dropIndicator.className="drop-indicator";const t=e.getBoundingClientRect(),i=e.parentElement?.getBoundingClientRect();if(i){const a=this.dropTargetIndex>this.dragSourceIndex?t.bottom-i.top:t.top-i.top;this.dropIndicator.style.top=`${a}px`,e.parentElement.style.position="relative",e.parentElement.appendChild(this.dropIndicator)}}removeDropIndicator(){this.dropIndicator?.remove(),this.dropIndicator=null}}class k{constructor(){this.enabled=!1,this.tableElement=null,this.dragSourceKey=null}attach(e){this.tableElement=e,this.enabled=!0}isEnabled(){return this.enabled}makeHeaderDraggable(e,t,i=!0){i&&(e.draggable=!0,e.addEventListener("dragstart",i=>{this.dragSourceKey=t,e.style.opacity="0.5",i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",t)}),e.addEventListener("dragend",()=>{e.style.opacity="1",this.dragSourceKey=null}),e.addEventListener("dragover",i=>{this.dragSourceKey&&this.dragSourceKey!==t&&(i.preventDefault(),i.dataTransfer.dropEffect="move",e.style.borderLeft="2px solid var(--snice-color-primary, rgb(37 99 235))")}),e.addEventListener("dragleave",()=>{e.style.borderLeft=""}),e.addEventListener("drop",i=>{i.preventDefault(),e.style.borderLeft="",this.dragSourceKey&&this.dragSourceKey!==t&&this.tableElement?.dispatchEvent(new CustomEvent("column-reorder",{detail:{fromKey:this.dragSourceKey,toKey:t},bubbles:!0,composed:!0})),this.dragSourceKey=null}))}}let x=(()=>{let e,s,n,o,c,d,h,x,S,C,E,D,z,A,$,F,T,L,M,R,B,j,I,O,P,V,H,N,q,_,W,K,Y,U,G,J,X,Q,Z,ee,te,ie,ae,se,ne,le,re,oe,ce,de,he,ue,pe,me,ge,be,ve,ye,fe,we,ke,xe,Se=[t.element("snice-table")],Ce=[],Ee=HTMLElement,De=[],ze=[],Ae=[],$e=[],Fe=[],Te=[],Le=[],Me=[],Re=[],Be=[],je=[],Ie=[],Oe=[],Pe=[],Ve=[],He=[],Ne=[],qe=[],_e=[],We=[],Ke=[],Ye=[],Ue=[],Ge=[],Je=[],Xe=[],Qe=[],Ze=[],et=[],tt=[],it=[],at=[],st=[],nt=[],lt=[],rt=[],ot=[],ct=[],dt=[],ht=[],ut=[],pt=[],mt=[],gt=[],bt=[],vt=[],yt=[],ft=[],wt=[],kt=[],xt=[],St=[],Ct=[],Et=[],Dt=[],zt=[],At=[],$t=[],Ft=[],Tt=[],Lt=[],Mt=[],Rt=[],Bt=[],jt=[],It=[],Ot=[],Pt=[],Vt=[],Ht=[],Nt=[],qt=[],_t=[],Wt=[],Kt=[];return class extends Ee{static{s=this}constructor(){super(...arguments),this.striped=(a(this,De),a(this,ze,!1)),this.searchable=(a(this,Ae),a(this,$e,!1)),this.filterable=(a(this,Fe),a(this,Te,!1)),this.sortable=(a(this,Le),a(this,Me,!1)),this.selectable=(a(this,Re),a(this,Be,!1)),this.hoverable=(a(this,je),a(this,Ie,!0)),this.clickable=(a(this,Oe),a(this,Pe,!1)),this.list=(a(this,Ve),a(this,He,!1)),this.pagination=(a(this,Ne),a(this,qe,!1)),this.paginationMode=(a(this,_e),a(this,We,"client")),this.pageSize=(a(this,Ke),a(this,Ye,10)),this.currentPage=(a(this,Ue),a(this,Ge,1)),this.totalItems=(a(this,Je),a(this,Xe,0)),this.pageSizes=(a(this,Qe),a(this,Ze,[10,25,50,100])),this.searchDebounce=(a(this,et),a(this,tt,500)),this.columns=(a(this,it),[]),this.data=[],this.currentSort=a(this,at,[]),this.searchText=(a(this,st),""),this.selector=a(this,nt,""),this.selectorOptions=(a(this,lt),a(this,rt,[])),this.loading=(a(this,ot),a(this,ct,!1)),this.virtualize=(a(this,dt),a(this,ht,!1)),this.rowHeight=(a(this,ut),a(this,pt,48)),this.virtualBuffer=(a(this,mt),a(this,gt,200)),this.columnResize=(a(this,bt),a(this,vt,!1)),this.editable=(a(this,yt),a(this,ft,!1)),this.editMode=(a(this,wt),a(this,kt,"cell")),this.density=(a(this,xt),a(this,St,"standard")),this.headerFilters=(a(this,Ct),a(this,Et,!1)),this.quickFilter=(a(this,Dt),a(this,zt,!1)),this.rowReorder=(a(this,At),a(this,$t,!1)),this.columnReorder=(a(this,Ft),a(this,Tt,!1)),this.columnMenu=(a(this,Lt),a(this,Mt,!1)),this.lazyLoad=(a(this,Rt),a(this,Bt,!1)),this.lazyLoadThreshold=(a(this,jt),a(this,It,200)),this.selectedRows=(a(this,Ot),a(this,Pt,[])),this.virtualizer=(a(this,Vt),new l),this.columnManager=new r,this.filterEngine=new u,this.editor=new p,this.keyboard=new m,this.exporter=new g,this.masterDetail=new b,this.toolbar=new v,this.treeData=new y,this.columnMenuManager=new f,this.rowDnD=new w,this.columnDnD=new k,this.pinnedTopRows=[],this.pinnedBottomRows=[],this.lazyLoadHandler=null,this.rowHeightCallback=null,this.table=a(this,Ht,void 0),this.thead=(a(this,Nt),a(this,qt,void 0)),this.tbody=(a(this,_t),a(this,Wt,void 0)),this._hasController=(a(this,Kt),!1),this._unsortedData=[],this.dataRequestTimeout=null,this._escHandler=null,this.toggleFullscreen=()=>{this.classList.contains("table-fullscreen")?(this.classList.remove("table-fullscreen"),this._escHandler&&(document.removeEventListener("keydown",this._escHandler),this._escHandler=null)):(this.classList.add("table-fullscreen"),this._escHandler=e=>{"Escape"===e.key&&this.toggleFullscreen()},document.addEventListener("keydown",this._escHandler))},this.handleClick=e=>{const t=e.target,i=t.closest("th.sortable");if(i){const e=i.getAttribute("data-key");return void(e&&this.toggleSort(e,!0))}const a=t.closest("tbody tr");if(a){if(t.matches('input[type="checkbox"], button, a, .interactive, snice-checkbox, snice-button, snice-input, snice-select'))return;const e=parseInt(a.getAttribute("data-index")||"0"),i=this.data[e];if(this.selectable){const t=this.selectedRows.includes(e);this.selectedRows=t?this.selectedRows.filter(t=>t!==e):[...this.selectedRows,e],this.updateRowSelectionState(),this.updateSelectAllState(),this.dispatchRowSelectionChanged(e,!t)}this.clickable&&this.dispatchEvent(new CustomEvent("row-clicked",{detail:{rowData:i,rowIndex:e}}))}},this.handleChange=e=>{const t=e.target;if(t.matches("snice-checkbox.row-select")){const e=t,i=parseInt(e.getAttribute("data-row-index")||"0");return e.checked?this.selectedRows.includes(i)||(this.selectedRows=[...this.selectedRows,i]):this.selectedRows=this.selectedRows.filter(e=>e!==i),this.updateRowSelectionState(),this.updateSelectAllState(),void this.dispatchRowSelectionChanged(i,e.checked)}if(t.matches("snice-checkbox.select-all")){const e=t;if(e.checked){const e=this.getFilteredData();this.selectedRows=e.map(e=>this.data.indexOf(e))}else this.selectedRows=[];this.updateRowSelectionState(),this.dispatchSelectAllChanged(e.checked)}},this.onAttached=()=>{this._hasController=!0,this.getTableConfig(),this.getTableData()},this.searchDebounceTimeout=null,this.handleSearchInput=e=>{const t=e.target;this.searchText=t.value,this.searchDebounceTimeout&&clearTimeout(this.searchDebounceTimeout),this.searchDebounceTimeout=setTimeout(()=>{this.debouncedDataRequest()},this.searchDebounce)},this.selectorDebounceTimeout=null,this.handleSelectorChange=e=>{this.selector=Array.isArray(e.detail.value)?e.detail.value.join(","):e.detail.value,this.selectorDebounceTimeout&&clearTimeout(this.selectorDebounceTimeout),this.selectorDebounceTimeout=setTimeout(()=>{this.debouncedDataRequest()},150)},this.selectabilityCheck=null,this.listViewRenderer=null}static{const l="function"==typeof Symbol&&Symbol.metadata?Object.create(Ee[Symbol.metadata]??null):void 0;n=[t.property({type:Boolean,attribute:"striped"})],o=[t.property({type:Boolean,attribute:"searchable"})],c=[t.property({type:Boolean,attribute:"filterable"})],d=[t.property({type:Boolean,attribute:"sortable"})],h=[t.property({type:Boolean,attribute:"selectable"})],x=[t.property({type:Boolean,attribute:"hoverable"})],S=[t.property({type:Boolean,attribute:"clickable"})],C=[t.property({type:Boolean,attribute:"list"})],E=[t.property({type:Boolean,attribute:"pagination"})],D=[t.property({attribute:"pagination-mode"})],z=[t.property({type:Number,attribute:"page-size"})],A=[t.property({type:Number,attribute:"current-page"})],$=[t.property({type:Number,attribute:"total-items"})],F=[t.property({type:Array,attribute:!1})],T=[t.property({type:Number,attribute:"search-debounce"})],L=[t.property({type:Array,attribute:!1})],M=[t.property({type:String,attribute:"selector"})],R=[t.property({type:Array,attribute:!1})],B=[t.property({type:Boolean,attribute:"loading"})],j=[t.property({type:Boolean,attribute:"virtualize"})],I=[t.property({type:Number,attribute:"row-height"})],O=[t.property({type:Number,attribute:"virtual-buffer"})],P=[t.property({type:Boolean,attribute:"column-resize"})],V=[t.property({type:Boolean,attribute:"editable"})],H=[t.property({attribute:"edit-mode"})],N=[t.property({attribute:"density"})],q=[t.property({type:Boolean,attribute:"header-filters"})],_=[t.property({type:Boolean,attribute:"quick-filter"})],W=[t.property({type:Boolean,attribute:"row-reorder"})],K=[t.property({type:Boolean,attribute:"column-reorder"})],Y=[t.property({type:Boolean,attribute:"column-menu"})],U=[t.property({type:Boolean,attribute:"lazy-load"})],G=[t.property({type:Number,attribute:"lazy-load-threshold"})],J=[t.property({type:Array,attribute:!1})],X=[t.query("table")],Q=[t.query("thead")],Z=[t.query("tbody")],ee=[t.request("table/config")],te=[t.request("table/data")],ie=[t.styles()],ae=[t.render()],se=[t.ready()],ne=[t.watch("selector-options")],le=[t.watch("sortable")],re=[t.watch("selectable")],oe=[t.watch("columns")],ce=[t.watch("data","loading")],de=[t.watch("selected-rows")],he=[t.watch("current-sort")],ue=[t.watch("searchable","filterable")],pe=[t.dispatch("page-change",{bubbles:!0,composed:!0})],me=[t.dispatch("table-row-selection-changed",{bubbles:!0,composed:!0})],ge=[t.dispatch("table-select-all-changed",{bubbles:!0,composed:!0})],be=[t.dispatch("sort-change",{bubbles:!0,composed:!0})],ve=[t.dispatch("filter-change",{bubbles:!0,composed:!0})],ye=[t.dispatch("column-visibility-change",{bubbles:!0,composed:!0})],fe=[t.dispatch("column-pin-change",{bubbles:!0,composed:!0})],we=[t.dispatch("column-order-change",{bubbles:!0,composed:!0})],ke=[t.dispatch("density-change",{bubbles:!0,composed:!0})],xe=[t.dispose()],i(this,null,ee,{kind:"method",name:"getTableConfig",static:!1,private:!1,access:{has:e=>"getTableConfig"in e,get:e=>e.getTableConfig},metadata:l},null,De),i(this,null,te,{kind:"method",name:"getTableData",static:!1,private:!1,access:{has:e=>"getTableData"in e,get:e=>e.getTableData},metadata:l},null,De),i(this,null,ie,{kind:"method",name:"styles",static:!1,private:!1,access:{has:e=>"styles"in e,get:e=>e.styles},metadata:l},null,De),i(this,null,ae,{kind:"method",name:"render",static:!1,private:!1,access:{has:e=>"render"in e,get:e=>e.render},metadata:l},null,De),i(this,null,se,{kind:"method",name:"initialize",static:!1,private:!1,access:{has:e=>"initialize"in e,get:e=>e.initialize},metadata:l},null,De),i(this,null,ne,{kind:"method",name:"handleSelectorOptionsChange",static:!1,private:!1,access:{has:e=>"handleSelectorOptionsChange"in e,get:e=>e.handleSelectorOptionsChange},metadata:l},null,De),i(this,null,le,{kind:"method",name:"handleSortableChange",static:!1,private:!1,access:{has:e=>"handleSortableChange"in e,get:e=>e.handleSortableChange},metadata:l},null,De),i(this,null,re,{kind:"method",name:"handleSelectableChange",static:!1,private:!1,access:{has:e=>"handleSelectableChange"in e,get:e=>e.handleSelectableChange},metadata:l},null,De),i(this,null,oe,{kind:"method",name:"handleColumnsChange",static:!1,private:!1,access:{has:e=>"handleColumnsChange"in e,get:e=>e.handleColumnsChange},metadata:l},null,De),i(this,null,ce,{kind:"method",name:"handleDataChange",static:!1,private:!1,access:{has:e=>"handleDataChange"in e,get:e=>e.handleDataChange},metadata:l},null,De),i(this,null,de,{kind:"method",name:"handleSelectedRowsChange",static:!1,private:!1,access:{has:e=>"handleSelectedRowsChange"in e,get:e=>e.handleSelectedRowsChange},metadata:l},null,De),i(this,null,he,{kind:"method",name:"handleSortChange",static:!1,private:!1,access:{has:e=>"handleSortChange"in e,get:e=>e.handleSortChange},metadata:l},null,De),i(this,null,ue,{kind:"method",name:"handleControlsChange",static:!1,private:!1,access:{has:e=>"handleControlsChange"in e,get:e=>e.handleControlsChange},metadata:l},null,De),i(this,null,pe,{kind:"method",name:"dispatchPageChange",static:!1,private:!1,access:{has:e=>"dispatchPageChange"in e,get:e=>e.dispatchPageChange},metadata:l},null,De),i(this,null,me,{kind:"method",name:"dispatchRowSelectionChanged",static:!1,private:!1,access:{has:e=>"dispatchRowSelectionChanged"in e,get:e=>e.dispatchRowSelectionChanged},metadata:l},null,De),i(this,null,ge,{kind:"method",name:"dispatchSelectAllChanged",static:!1,private:!1,access:{has:e=>"dispatchSelectAllChanged"in e,get:e=>e.dispatchSelectAllChanged},metadata:l},null,De),i(this,null,be,{kind:"method",name:"dispatchSortChange",static:!1,private:!1,access:{has:e=>"dispatchSortChange"in e,get:e=>e.dispatchSortChange},metadata:l},null,De),i(this,null,ve,{kind:"method",name:"dispatchFilterChange",static:!1,private:!1,access:{has:e=>"dispatchFilterChange"in e,get:e=>e.dispatchFilterChange},metadata:l},null,De),i(this,null,ye,{kind:"method",name:"dispatchColumnVisibilityChange",static:!1,private:!1,access:{has:e=>"dispatchColumnVisibilityChange"in e,get:e=>e.dispatchColumnVisibilityChange},metadata:l},null,De),i(this,null,fe,{kind:"method",name:"dispatchColumnPinChange",static:!1,private:!1,access:{has:e=>"dispatchColumnPinChange"in e,get:e=>e.dispatchColumnPinChange},metadata:l},null,De),i(this,null,we,{kind:"method",name:"dispatchColumnOrderChange",static:!1,private:!1,access:{has:e=>"dispatchColumnOrderChange"in e,get:e=>e.dispatchColumnOrderChange},metadata:l},null,De),i(this,null,ke,{kind:"method",name:"dispatchDensityChange",static:!1,private:!1,access:{has:e=>"dispatchDensityChange"in e,get:e=>e.dispatchDensityChange},metadata:l},null,De),i(this,null,xe,{kind:"method",name:"cleanup",static:!1,private:!1,access:{has:e=>"cleanup"in e,get:e=>e.cleanup},metadata:l},null,De),i(null,null,n,{kind:"field",name:"striped",static:!1,private:!1,access:{has:e=>"striped"in e,get:e=>e.striped,set:(e,t)=>{e.striped=t}},metadata:l},ze,Ae),i(null,null,o,{kind:"field",name:"searchable",static:!1,private:!1,access:{has:e=>"searchable"in e,get:e=>e.searchable,set:(e,t)=>{e.searchable=t}},metadata:l},$e,Fe),i(null,null,c,{kind:"field",name:"filterable",static:!1,private:!1,access:{has:e=>"filterable"in e,get:e=>e.filterable,set:(e,t)=>{e.filterable=t}},metadata:l},Te,Le),i(null,null,d,{kind:"field",name:"sortable",static:!1,private:!1,access:{has:e=>"sortable"in e,get:e=>e.sortable,set:(e,t)=>{e.sortable=t}},metadata:l},Me,Re),i(null,null,h,{kind:"field",name:"selectable",static:!1,private:!1,access:{has:e=>"selectable"in e,get:e=>e.selectable,set:(e,t)=>{e.selectable=t}},metadata:l},Be,je),i(null,null,x,{kind:"field",name:"hoverable",static:!1,private:!1,access:{has:e=>"hoverable"in e,get:e=>e.hoverable,set:(e,t)=>{e.hoverable=t}},metadata:l},Ie,Oe),i(null,null,S,{kind:"field",name:"clickable",static:!1,private:!1,access:{has:e=>"clickable"in e,get:e=>e.clickable,set:(e,t)=>{e.clickable=t}},metadata:l},Pe,Ve),i(null,null,C,{kind:"field",name:"list",static:!1,private:!1,access:{has:e=>"list"in e,get:e=>e.list,set:(e,t)=>{e.list=t}},metadata:l},He,Ne),i(null,null,E,{kind:"field",name:"pagination",static:!1,private:!1,access:{has:e=>"pagination"in e,get:e=>e.pagination,set:(e,t)=>{e.pagination=t}},metadata:l},qe,_e),i(null,null,D,{kind:"field",name:"paginationMode",static:!1,private:!1,access:{has:e=>"paginationMode"in e,get:e=>e.paginationMode,set:(e,t)=>{e.paginationMode=t}},metadata:l},We,Ke),i(null,null,z,{kind:"field",name:"pageSize",static:!1,private:!1,access:{has:e=>"pageSize"in e,get:e=>e.pageSize,set:(e,t)=>{e.pageSize=t}},metadata:l},Ye,Ue),i(null,null,A,{kind:"field",name:"currentPage",static:!1,private:!1,access:{has:e=>"currentPage"in e,get:e=>e.currentPage,set:(e,t)=>{e.currentPage=t}},metadata:l},Ge,Je),i(null,null,$,{kind:"field",name:"totalItems",static:!1,private:!1,access:{has:e=>"totalItems"in e,get:e=>e.totalItems,set:(e,t)=>{e.totalItems=t}},metadata:l},Xe,Qe),i(null,null,F,{kind:"field",name:"pageSizes",static:!1,private:!1,access:{has:e=>"pageSizes"in e,get:e=>e.pageSizes,set:(e,t)=>{e.pageSizes=t}},metadata:l},Ze,et),i(null,null,T,{kind:"field",name:"searchDebounce",static:!1,private:!1,access:{has:e=>"searchDebounce"in e,get:e=>e.searchDebounce,set:(e,t)=>{e.searchDebounce=t}},metadata:l},tt,it),i(null,null,L,{kind:"field",name:"currentSort",static:!1,private:!1,access:{has:e=>"currentSort"in e,get:e=>e.currentSort,set:(e,t)=>{e.currentSort=t}},metadata:l},at,st),i(null,null,M,{kind:"field",name:"selector",static:!1,private:!1,access:{has:e=>"selector"in e,get:e=>e.selector,set:(e,t)=>{e.selector=t}},metadata:l},nt,lt),i(null,null,R,{kind:"field",name:"selectorOptions",static:!1,private:!1,access:{has:e=>"selectorOptions"in e,get:e=>e.selectorOptions,set:(e,t)=>{e.selectorOptions=t}},metadata:l},rt,ot),i(null,null,B,{kind:"field",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:l},ct,dt),i(null,null,j,{kind:"field",name:"virtualize",static:!1,private:!1,access:{has:e=>"virtualize"in e,get:e=>e.virtualize,set:(e,t)=>{e.virtualize=t}},metadata:l},ht,ut),i(null,null,I,{kind:"field",name:"rowHeight",static:!1,private:!1,access:{has:e=>"rowHeight"in e,get:e=>e.rowHeight,set:(e,t)=>{e.rowHeight=t}},metadata:l},pt,mt),i(null,null,O,{kind:"field",name:"virtualBuffer",static:!1,private:!1,access:{has:e=>"virtualBuffer"in e,get:e=>e.virtualBuffer,set:(e,t)=>{e.virtualBuffer=t}},metadata:l},gt,bt),i(null,null,P,{kind:"field",name:"columnResize",static:!1,private:!1,access:{has:e=>"columnResize"in e,get:e=>e.columnResize,set:(e,t)=>{e.columnResize=t}},metadata:l},vt,yt),i(null,null,V,{kind:"field",name:"editable",static:!1,private:!1,access:{has:e=>"editable"in e,get:e=>e.editable,set:(e,t)=>{e.editable=t}},metadata:l},ft,wt),i(null,null,H,{kind:"field",name:"editMode",static:!1,private:!1,access:{has:e=>"editMode"in e,get:e=>e.editMode,set:(e,t)=>{e.editMode=t}},metadata:l},kt,xt),i(null,null,N,{kind:"field",name:"density",static:!1,private:!1,access:{has:e=>"density"in e,get:e=>e.density,set:(e,t)=>{e.density=t}},metadata:l},St,Ct),i(null,null,q,{kind:"field",name:"headerFilters",static:!1,private:!1,access:{has:e=>"headerFilters"in e,get:e=>e.headerFilters,set:(e,t)=>{e.headerFilters=t}},metadata:l},Et,Dt),i(null,null,_,{kind:"field",name:"quickFilter",static:!1,private:!1,access:{has:e=>"quickFilter"in e,get:e=>e.quickFilter,set:(e,t)=>{e.quickFilter=t}},metadata:l},zt,At),i(null,null,W,{kind:"field",name:"rowReorder",static:!1,private:!1,access:{has:e=>"rowReorder"in e,get:e=>e.rowReorder,set:(e,t)=>{e.rowReorder=t}},metadata:l},$t,Ft),i(null,null,K,{kind:"field",name:"columnReorder",static:!1,private:!1,access:{has:e=>"columnReorder"in e,get:e=>e.columnReorder,set:(e,t)=>{e.columnReorder=t}},metadata:l},Tt,Lt),i(null,null,Y,{kind:"field",name:"columnMenu",static:!1,private:!1,access:{has:e=>"columnMenu"in e,get:e=>e.columnMenu,set:(e,t)=>{e.columnMenu=t}},metadata:l},Mt,Rt),i(null,null,U,{kind:"field",name:"lazyLoad",static:!1,private:!1,access:{has:e=>"lazyLoad"in e,get:e=>e.lazyLoad,set:(e,t)=>{e.lazyLoad=t}},metadata:l},Bt,jt),i(null,null,G,{kind:"field",name:"lazyLoadThreshold",static:!1,private:!1,access:{has:e=>"lazyLoadThreshold"in e,get:e=>e.lazyLoadThreshold,set:(e,t)=>{e.lazyLoadThreshold=t}},metadata:l},It,Ot),i(null,null,J,{kind:"field",name:"selectedRows",static:!1,private:!1,access:{has:e=>"selectedRows"in e,get:e=>e.selectedRows,set:(e,t)=>{e.selectedRows=t}},metadata:l},Pt,Vt),i(null,null,X,{kind:"field",name:"table",static:!1,private:!1,access:{has:e=>"table"in e,get:e=>e.table,set:(e,t)=>{e.table=t}},metadata:l},Ht,Nt),i(null,null,Q,{kind:"field",name:"thead",static:!1,private:!1,access:{has:e=>"thead"in e,get:e=>e.thead,set:(e,t)=>{e.thead=t}},metadata:l},qt,_t),i(null,null,Z,{kind:"field",name:"tbody",static:!1,private:!1,access:{has:e=>"tbody"in e,get:e=>e.tbody,set:(e,t)=>{e.tbody=t}},metadata:l},Wt,Kt),i(null,e={value:s},Se,{kind:"class",name:s.name,metadata:l},null,Ce),s=e.value,l&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l}),a(s,Ce)}setData(e){this._unsortedData=[...e],this.data=e,this.render()}setColumns(e){this.columns=e,this.render()}async*getTableConfig(){const e=await(yield{});return this.columns=e.columns||[],this.selectorOptions=e.selectorOptions||[],await new Promise(e=>requestAnimationFrame(e)),this.renderHeader(),this.renderControls(),e}async*getTableData(){this.loading=!0,this.selectedRows=[];try{const e={search:this.searchText,sort:this.currentSort,filter:this.filterEngine.getFilterModel(),selector:this.selector};this.pagination&&(e.page=this.currentPage,e.pageSize=this.pageSize);const t=await(yield e);return this.data=t.data||[],void 0!==t.totalItems&&(this.totalItems=t.totalItems),this.loading=!1,await new Promise(e=>requestAnimationFrame(e)),this.renderBody(),t}catch(e){console.error("Error loading table data:",e),this.data=[],this.loading=!1,await new Promise(e=>requestAnimationFrame(e)),this.renderBody()}}debouncedDataRequest(){this.loading||(this.loading=!0),this.dataRequestTimeout&&clearTimeout(this.dataRequestTimeout),this.dataRequestTimeout=setTimeout(()=>{this.getTableData(),this.dataRequestTimeout=null},150)}styles(){return t.css`
|
|
565
565
|
:host {
|
|
566
566
|
display: block;
|
|
567
567
|
position: relative;
|
|
@@ -1453,5 +1453,5 @@ void 0===globalThis.Snice&&console.warn("[snice] snice-runtime.min.js must be lo
|
|
|
1453
1453
|
</div>
|
|
1454
1454
|
<div class="table-pagination-container"></div>
|
|
1455
1455
|
</div>
|
|
1456
|
-
`}renderControls(){const e=this.shadowRoot?.querySelector(".table-controls-container");if(!e)return;if(this.searchable||this.filterable){if(0===e.children.length){const t=document.createElement("div");if(t.className="table-controls",t.setAttribute("part","controls"),this.searchable){const e=document.createElement("snice-input");e.className="search-input",e.setAttribute("type","search"),e.setAttribute("placeholder","Search..."),e.setAttribute("size","small"),e.style.width="16rem",e.style.maxWidth="16rem",e.style.flex="0 0 auto",e.addEventListener("input",this.handleSearchInput),t.appendChild(e)}if(this.filterable){const e=document.createElement("snice-select");e.className="selector-input",e.setAttribute("multiple",""),e.setAttribute("searchable",""),e.setAttribute("clearable",""),e.setAttribute("placeholder","Filter..."),e.setAttribute("size","medium"),this.selectorOptions.forEach(t=>{const a=document.createElement("snice-option");a.setAttribute("value",t.value),a.textContent=t.label,e.appendChild(a)}),t.appendChild(e)}e.appendChild(t)}}else e.innerHTML=""}async initialize(){this.addEventListener("controller-attached",this.onAttached),this.addEventListener("select-change",this.handleSelectorChange),this.addEventListener("detail-toggle",()=>this.renderBody()),await customElements.whenDefined("snice-column"),await customElements.whenDefined("snice-row"),await this.processSlottedContent(),this.renderControls(),this.initializeModules(),this.initColumnMenu(),this.rowReorder&&this.rowDnD.attach(this),this.columnReorder&&this.columnDnD.attach(this),this.virtualize&&requestAnimationFrame(()=>this.setupVirtualization()),this.lazyLoad&&requestAnimationFrame(()=>this.setupLazyLoading()),this.addEventListener("row-reorder",e=>{const{fromIndex:t,toIndex:a}=e.detail,i=this.data.splice(t,1)[0];this.data.splice(a,0,i),this.setData([...this.data])}),this.addEventListener("column-reorder",e=>{const{fromKey:t,toKey:a}=e.detail,i=this.columns.findIndex(e=>e.key===t),s=this.columns.findIndex(e=>e.key===a);i>=0&&s>=0&&(this.columnManager.moveColumn(t,s),this.renderHeader(),this.renderBody())}),this.addEventListener("tree-toggle",()=>this.renderBody())}async processSlottedContent(){const e=Array.from(this.querySelectorAll('snice-column[slot="columns"]'));if(e.length>0){this.columns=e.map(e=>e.getColumnDefinition());Array.from(this.querySelectorAll('snice-row[slot="rows"]')).forEach((e,t)=>{e.columns=this.columns,e.index=t,e.hoverable=this.hoverable,e.clickable=this.clickable,e.selectable=this.selectable}),requestAnimationFrame(()=>this.renderSlottedHeader())}}renderSlottedHeader(){const e=this.shadowRoot?.querySelector("#slotted-header");e&&0!==this.columns.length&&(e.innerHTML=this.columns.map(e=>`<div class="header-cell">${e.label}</div>`).join(""))}handleSelectorOptionsChange(){0===this.selectorOptions.length?this.classList.add("selector-options-empty"):this.classList.remove("selector-options-empty")}handleSortableChange(){this.renderHeader()}handleSelectableChange(){this.render()}handleColumnsChange(){this.renderHeader()}handleDataChange(){this.renderBody()}handleSelectedRowsChange(){this.updateRowSelectionState(),this.updateSelectAllState()}handleSortChange(){this.renderHeader()}handleControlsChange(){this.renderControls()}renderHeader(){if(!this.thead)return;const e=document.createElement("tr");if(this.rowReorder&&this.rowDnD.isEnabled()){const t=document.createElement("th");t.className="drag-handle-cell",e.appendChild(t)}if(this.masterDetail.isEnabled()){const t=document.createElement("th");t.className="detail-toggle-cell",e.appendChild(t)}if(this.selectable){const t=document.createElement("th");t.className="select-column";const a=this.getFilteredData().map(e=>this.data.indexOf(e)),i=a.filter(e=>this.selectedRows.includes(e)),s=i.length===a.length&&a.length>0,n=i.length>0&&i.length<a.length;t.innerHTML=`<snice-checkbox class="select-all" size="small" compact ${s?"checked":""}></snice-checkbox>`,e.appendChild(t),setTimeout(()=>{const e=t.querySelector(".select-all");e&&(e.indeterminate=n)},0)}const t=this.columnManager.getVisibleColumns(),a=t.length>0?new Set(t.map(e=>e.key)):null;this.columns.forEach(t=>{if(a&&!a.has(t.key))return;const i=document.createElement("th");i.setAttribute("data-key",t.key);const s=this.columnManager.getState(t.key);if(s)if(i.style.width=`${s.width}px`,"left"===s.pinned){const e=this.columnManager.getPinnedLeftOffsets();i.classList.add("pinned-cell"),i.style.position="sticky",i.style.left=`${e.get(t.key)??0}px`,i.style.zIndex="2"}else if("right"===s.pinned){const e=this.columnManager.getPinnedRightOffsets();i.classList.add("pinned-cell"),i.style.position="sticky",i.style.right=`${e.get(t.key)??0}px`,i.style.zIndex="2"}if(this.sortable&&!1!==t.sortable?(i.classList.add("sortable"),i.setAttribute("role","button"),i.innerHTML=this.renderSortableHeader(t)):i.textContent=t.label,this.filterEngine.hasColumnFilter(t.key)&&i.classList.add("filtered"),this.columnResize&&!1!==t.resizable){const e=document.createElement("span");e.className="resize-handle",e.addEventListener("mousedown",e=>{e.stopPropagation(),this.columnManager.startResize(t.key,e.clientX)}),e.addEventListener("dblclick",e=>{e.stopPropagation(),this.tbody&&(this.columnManager.autoSizeColumn(t.key,this.tbody),this.renderHeader(),this.renderBody())}),i.appendChild(e),i.style.position="relative"}this.columnMenu&&i.addEventListener("contextmenu",e=>{e.preventDefault();const a=this.columnManager.getState(t.key);this.columnMenuManager.show(t.key,e.clientX,e.clientY,{sortable:this.sortable&&!1!==t.sortable,filterable:!1!==t.filterable,hideable:a?.hideable,pinnable:a?.pinnable,pinned:a?.pinned})}),this.columnReorder&&this.columnDnD.isEnabled()&&this.columnDnD.makeHeaderDraggable(i,t.key,!1!==t.reorderable),e.appendChild(i)}),this.thead.innerHTML="";if(this.columnManager.getColumnGroups().length>0){const e=document.createElement("tr");e.className="column-group-row",e.innerHTML=this.columnManager.renderGroupHeaders(),this.thead.appendChild(e)}if(this.thead.appendChild(e),this.headerFilters){const e=document.createElement("tr");if(e.className="header-filter-row",this.rowReorder&&this.rowDnD.isEnabled()){const t=document.createElement("td");t.className="drag-handle-cell",e.appendChild(t)}if(this.masterDetail.isEnabled()){const t=document.createElement("td");t.className="detail-toggle-cell",e.appendChild(t)}if(this.selectable){const t=document.createElement("td");t.className="select-column",e.appendChild(t)}this.columns.forEach(t=>{if(a&&!a.has(t.key))return;const i=document.createElement("td"),s=document.createElement("snice-input");s.size="small",s.placeholder=`Filter ${t.label}...`,s.setAttribute("data-column",t.key),s.value=this.filterEngine.getHeaderFilter(t.key),s.style.cssText="width:100%;--snice-color-border:transparent;--snice-border-radius-md:0;",s.addEventListener("input",()=>{this.filterEngine.setHeaderFilter(t.key,s.value),this.applyClientFilters()}),i.appendChild(s),e.appendChild(i)}),this.thead.appendChild(e)}}renderSortableHeader(e){const t=this.currentSort.find(t=>t.column===e.key),a=this.currentSort.findIndex(t=>t.column===e.key),i=!!t,s='<svg width="10" height="6" viewBox="0 0 10 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M1 5l4-4 4 4"/></svg>',n='<svg width="10" height="6" viewBox="0 0 10 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M1 1l4 4 4-4"/></svg>';let l=`<span style="display:flex;flex-direction:column;gap:0;opacity:0.3">${s}${n}</span>`,r="";t&&("asc"===t.direction?l=s:"desc"===t.direction&&(l=n),this.currentSort.length>1&&(r=`<span class="sort-order">${a+1}</span>`));const o=["sort-indicator",i?"active":""].filter(Boolean).join(" ");return`\n <div class="sort-header">\n <span>${e.label}</span>\n <div class="${o}">\n ${l}\n ${r}\n </div>\n </div>\n `}renderBody(){if(!this.tbody)return;if(this.columns.length>0&&this.columnManager.initialize(this.columns,this),this.virtualize&&this.virtualizer.isEnabled()){const e=this.getFilteredData();return this.virtualizer.setTotalRows(e.length),this.virtualizer.refresh(),void(this.pagination&&this.renderPagination())}if(this.tbody.innerHTML="",0===this.data.length&&this.columns.length>0){const e=(this.selectable?1:0)+(this.masterDetail.isEnabled()?1:0)+(this.rowReorder&&this.rowDnD.isEnabled()?1:0),t=this.columns.length+e;if(this.loading){const e=document.createElement("tr"),a=document.createElement("td");return a.colSpan=t,a.className="no-data",a.innerHTML='<snice-progress variant="circular" indeterminate size="small"></snice-progress>',e.appendChild(a),void this.tbody.appendChild(e)}{const e=document.createElement("tr"),a=document.createElement("td");a.colSpan=t,a.className="no-data";const i=this.querySelector('[slot="empty-state"]');if(i)a.appendChild(i.cloneNode(!0));else{const e=document.createElement("snice-empty-state");e.setAttribute("size","small"),e.setAttribute("icon","📭"),e.setAttribute("title","No data"),e.setAttribute("description","No records to display."),a.appendChild(e)}return e.appendChild(a),void this.tbody.appendChild(e)}}const e=document.createDocumentFragment();let t=this.getFilteredData(),a=t,i=0;this.pagination&&"client"===this.paginationMode&&(this.totalItems=t.length,i=(this.currentPage-1)*this.pageSize,a=t.slice(i,i+this.pageSize));const s=(this.selectable?1:0)+(this.masterDetail.isEnabled()?1:0)+(this.rowReorder&&this.rowDnD.isEnabled()?1:0),n=this.columns.length+s;for(const t of this.pinnedTopRows){const a=this.createRow(t,-1);a.classList.add("pinned-row","pinned-row--top"),e.appendChild(a)}if(this.treeData.isEnabled()){this.treeData.processData(a).forEach((t,a)=>{const s=i+a;e.appendChild(this.createRow(t.data,s,t))})}else a.forEach((t,a)=>{const s=i+a;if(e.appendChild(this.createRow(t,s)),this.masterDetail.isEnabled()&&this.masterDetail.isExpanded(s)){const a=this.masterDetail.createDetailRow(t,s,n);a&&e.appendChild(a)}});for(const t of this.pinnedBottomRows){const a=this.createRow(t,-1);a.classList.add("pinned-row","pinned-row--bottom"),e.appendChild(a)}this.tbody.appendChild(e),this.pagination&&this.renderPagination()}get totalPages(){const e="client"===this.paginationMode?this.data.length:this.totalItems;return Math.max(1,Math.ceil(e/this.pageSize))}goToPage(e){const t=Math.max(1,Math.min(e,this.totalPages));t!==this.currentPage&&(this.currentPage=t,"server"===this.paginationMode&&this._hasController?this.debouncedDataRequest():this.renderBody(),this.dispatchPageChange())}setPageSize(e){this.pageSize=e,this.currentPage=1,"server"===this.paginationMode&&this._hasController?this.debouncedDataRequest():this.renderBody(),this.dispatchPageChange()}dispatchPageChange(){return{page:this.currentPage,pageSize:this.pageSize,totalPages:this.totalPages,totalItems:"client"===this.paginationMode?this.data.length:this.totalItems}}renderPagination(){const e=this.shadowRoot?.querySelector(".table-pagination-container");if(!e)return;if(!this.pagination)return void(e.innerHTML="");const t="client"===this.paginationMode?this.data.length:this.totalItems,a=this.totalPages,i=Math.min((this.currentPage-1)*this.pageSize+1,t),s=Math.min(this.currentPage*this.pageSize,t),n=[];if(a<=7)for(let e=1;e<=a;e++)n.push(this.pageButton(e));else{n.push(this.pageButton(1)),this.currentPage>3&&n.push('<span class="pagination__ellipsis">…</span>');const e=Math.max(2,this.currentPage-1),t=Math.min(a-1,this.currentPage+1);for(let a=e;a<=t;a++)n.push(this.pageButton(a));this.currentPage<a-2&&n.push('<span class="pagination__ellipsis">…</span>'),n.push(this.pageButton(a))}e.innerHTML="";const l=document.createElement("div");l.className="pagination",l.setAttribute("part","pagination");const r=document.createElement("div");r.className="pagination__info",r.textContent=`Showing ${i}–${s} of ${t}`,l.appendChild(r);const o=document.createElement("div");o.className="pagination__controls",o.innerHTML=`\n <button class="pagination__btn pagination__first" ${this.currentPage<=1?"disabled":""} data-page="1" aria-label="First page">⟨⟨</button>\n <button class="pagination__btn pagination__prev" ${this.currentPage<=1?"disabled":""} data-page="${this.currentPage-1}" aria-label="Previous page">⟨</button>\n ${n.join("")}\n <button class="pagination__btn pagination__next" ${this.currentPage>=a?"disabled":""} data-page="${this.currentPage+1}" aria-label="Next page">⟩</button>\n <button class="pagination__btn pagination__last" ${this.currentPage>=a?"disabled":""} data-page="${a}" aria-label="Last page">⟩⟩</button>\n `,l.appendChild(o);const c=document.createElement("div");c.className="pagination__size";const d=document.createElement("label");d.textContent="Rows per page:",c.appendChild(d);const h=document.createElement("snice-select");h.size="small",h.className="pagination__size-select";for(const e of this.pageSizes){const t=document.createElement("snice-option");t.setAttribute("value",String(e)),t.textContent=String(e),e===this.pageSize&&t.setAttribute("selected",""),h.appendChild(t)}h.value=String(this.pageSize),c.appendChild(h),l.appendChild(c),e.appendChild(l),o.querySelectorAll("[data-page]").forEach(e=>{e.addEventListener("click",()=>{const t=parseInt(e.getAttribute("data-page"));this.goToPage(t)})}),h.addEventListener("select-change",e=>{this.setPageSize(parseInt(e.detail.value))})}pageButton(e){return`<button class="pagination__btn pagination__page${e===this.currentPage?" pagination__btn--active":""}" data-page="${e}">${e}</button>`}createCellElement(e,t){const a=this.getCellTagName(e.type),i=document.createElement(a);i.setAttribute("type",e.type||"text"),i.setAttribute("align",e.align||"left"),i.setAttribute("in-table","true");switch(null!==t&&"object"==typeof t?i.setAttribute("value",JSON.stringify(t)):i.setAttribute("value",String(t??"")),i.column=e,e.type){case"number":case"currency":if(void 0!==e.decimals&&i.setAttribute("decimals",String(e.decimals)),e.thousandsSeparator&&i.setAttribute("thousands-separator","true"),e.prefix&&i.setAttribute("prefix",e.prefix),e.suffix&&i.setAttribute("suffix",e.suffix),"currency"===e.type){const t=e.currencyFormat;t&&(t.currency&&i.setAttribute("currency",t.currency),t.locale&&i.setAttribute("locale",t.locale),t.display&&i.setAttribute("display",t.display),void 0!==t.decimals&&i.setAttribute("decimals",String(t.decimals)))}break;case"date":e.dateFormat&&i.setAttribute("date-format",e.dateFormat);break;case"boolean":e.useSymbols&&i.setAttribute("use-symbols","true"),e.trueSymbol&&i.setAttribute("true-symbol",e.trueSymbol),e.falseSymbol&&i.setAttribute("false-symbol",e.falseSymbol),e.trueValue&&i.setAttribute("true-value",e.trueValue),e.falseValue&&i.setAttribute("false-value",e.falseValue);break;case"sparkline":{const t=e.sparklineFormat;t&&(t.color&&i.setAttribute("color",t.color),t.type&&i.setAttribute("chart-type",t.type),t.width&&i.setAttribute("width",String(t.width)),t.height&&i.setAttribute("height",String(t.height)));break}case"rating":{const t=e.ratingFormat;t&&(t.max&&i.setAttribute("max",String(t.max)),t.color&&i.setAttribute("color",t.color));break}case"progress":{const t=e.progressFormat;t&&(t.max&&i.setAttribute("max",String(t.max)),t.color&&i.setAttribute("color",t.color),t.showPercentage&&i.setAttribute("show-percentage","true"));break}case"percentage":case"percent":{const t=e.percentageFormat;t&&(void 0!==t.decimals&&i.setAttribute("decimals",String(t.decimals)),t.colorize&&i.setAttribute("colorize","true"));break}case"status":{const t=e.statusFormat;t&&(t.variant&&i.setAttribute("variant",t.variant),t.showDot&&i.setAttribute("show-dot","true"));break}case"link":{const t=e.linkFormat;t&&(t.target&&i.setAttribute("target",t.target),t.external&&i.setAttribute("external","true"));break}case"image":{const t=e.imageFormat;t&&(t.shape&&i.setAttribute("shape",t.shape),t.size&&i.setAttribute("size",t.size));break}case"color":{const t=e.colorFormat;t&&(!1!==t.showSwatch&&i.setAttribute("show-swatch","true"),t.displayFormat&&i.setAttribute("display-format",t.displayFormat));break}case"email":{const t=e.emailFormat;t&&t.showIcon&&i.setAttribute("show-icon","true");break}case"phone":{const t=e.phoneFormat;t&&(t.showIcon&&i.setAttribute("show-icon","true"),t.format&&i.setAttribute("format","true"));break}}return i}getCellTagName(e){switch(e){case"text":return"snice-cell-text";case"number":case"currency":return"snice-cell-number";case"date":return"snice-cell-date";case"boolean":return"snice-cell-boolean";case"rating":return"snice-cell-rating";case"progress":return"snice-cell-progress";case"duration":return"snice-cell-duration";case"filesize":return"snice-cell-filesize";case"sparkline":return"snice-cell-sparkline";case"image":return"snice-cell-image";case"percentage":case"percent":return"snice-cell-percentage";case"tag":return"snice-cell-tag";case"status":return"snice-cell-status";case"actions":return"snice-cell-actions";case"link":return"snice-cell-link";case"email":return"snice-cell-email";case"phone":return"snice-cell-phone";case"color":return"snice-cell-color";case"location":return"snice-cell-location";case"json":return"snice-cell-json";default:return"snice-cell"}}updateRowSelectionState(){if(!this.tbody)return;this.tbody.querySelectorAll("tr").forEach((e,t)=>{const a=this.selectedRows.includes(t);e.setAttribute("data-selected",String(a));const i=e.querySelector("snice-checkbox.row-select");i&&(i.checked=a)})}updateSelectAllState(){const e=this.thead?.querySelector("snice-checkbox.select-all");if(!e)return;const t=this.getFilteredData().map(e=>this.data.indexOf(e)),a=t.filter(e=>this.selectedRows.includes(e)),i=a.length===t.length&&t.length>0,s=a.length>0&&a.length<t.length;e.checked=i,e.indeterminate=s}toggleSort(e,t=!1){if(t){const t=this.currentSort.findIndex(t=>t.column===e);if(-1===t)this.currentSort=[...this.currentSort,{column:e,direction:"asc"}];else{"asc"===this.currentSort[t].direction?this.currentSort=this.currentSort.map((e,a)=>a===t?{...e,direction:"desc"}:e):this.currentSort=this.currentSort.filter(t=>t.column!==e)}}else{const t=this.currentSort.find(t=>t.column===e);t?"asc"===t.direction?this.currentSort=[{column:e,direction:"desc"}]:this.currentSort=[]:this.currentSort=[{column:e,direction:"asc"}]}this.renderHeader(),this.dispatchSortChange(),this._hasController?this.debouncedDataRequest():this.sortLocalData()}sortLocalData(){this._unsortedData.length||(this._unsortedData=[...this.data]),0===this.currentSort.length?this.data=[...this._unsortedData]:this.data=[...this._unsortedData].sort((e,t)=>{for(const{column:a,direction:i}of this.currentSort){const s=this.columns.find(e=>e.key===a),n=s?.sortComparator;if(n){const s=n(e[a],t[a],i);if(0!==s)return s}else{const n=s?.valueGetter?s.valueGetter(e[a],e):e[a]??"",l=s?.valueGetter?s.valueGetter(t[a],t):t[a]??"",r=String(n).localeCompare(String(l),void 0,{numeric:!0});if(0!==r)return"asc"===i?r:-r}}return 0}),this.renderBody()}dispatchRowSelectionChanged(e,t){return{selectedRows:this.selectedRows,rowIndex:e,selected:t}}dispatchSelectAllChanged(e){return{selectedRows:this.selectedRows,allSelected:e}}dispatchSortChange(){return{sort:this.currentSort}}dispatchFilterChange(){return{filters:this.filterEngine.getFilterModel()}}dispatchColumnVisibilityChange(e,t){return{key:e,visible:t,visibility:this.columnManager.getVisibilityModel()}}dispatchColumnPinChange(e,t){return{key:e,pinned:t}}dispatchColumnOrderChange(e,t){return{key:e,toIndex:t}}dispatchDensityChange(){return{density:this.density}}initializeModules(){if(this.columnManager.initialize(this.columns,this),this.editable){this.editor.attach(this),this.editor.setEditMode(this.editMode);const e=this.columns.filter(e=>!1!==e.editable).map(e=>e.key);this.editor.setEditableColumns(e);for(const e of this.columns)(e.valueGetter||e.valueFormatter||e.valueParser||e.valueSetter)&&this.editor.setPipeline(e.key,{valueGetter:e.valueGetter,valueFormatter:e.valueFormatter,valueParser:e.valueParser,valueSetter:e.valueSetter})}this.shadowRoot&&this.keyboard.attach({shadowRoot:this.shadowRoot,totalRows:this.data.length,totalColumns:this.columns.length,tabMode:"all",isEditing:()=>this.editor.isEditing(),onCellActivate:(e,t)=>{this.editable&&this.startEdit(e,t)},onSelectionToggle:e=>{this.selectable&&this.toggleRowSelection(e)},onSelectAll:()=>{this.selectable&&this.selectAllRows()}})}cleanup(){if(this.virtualizer.detach(),this.keyboard.detach(),this.lazyLoadHandler){const e=this.shadowRoot?.querySelector(".snice-table");e?.removeEventListener("scroll",this.lazyLoadHandler)}}setupVirtualization(){if(!this.virtualize||!this.shadowRoot)return;const e=this.shadowRoot.querySelector(".snice-table");e&&this.virtualizer.attach({rowHeight:this.rowHeight,bufferPx:this.virtualBuffer,totalRows:this.getFilteredData().length,scrollContainer:e,renderRange:(e,t)=>this.renderRowRange(e,t)})}renderRowRange(e,t){const a=document.createDocumentFragment(),i=this.getFilteredData();for(let s=e;s<t&&s<i.length;s++){const e=i[s],t=this.createRow(e,s);a.appendChild(t)}return a}scrollToRow(e){this.virtualizer.scrollToRow(e)}getScrollPosition(){return this.virtualizer.getScrollPosition()}setColumnFilter(e,t,a){this.filterEngine.setColumnFilter(e,t,a),this.applyClientFilters()}removeColumnFilter(e){this.filterEngine.removeColumnFilter(e),this.applyClientFilters()}setQuickFilter(e){this.filterEngine.setQuickFilter(e),this.applyClientFilters()}setFilterModel(e){this.filterEngine.setFilterModel(e),this.applyClientFilters()}getFilterModel(){return this.filterEngine.getFilterModel()}clearAllFilters(){this.filterEngine.clearAllFilters(),this.applyClientFilters()}getFilteredData(){return this.filterEngine.hasActiveFilters()?this.filterEngine.applyFilters(this.data,this.columns):this.data}applyClientFilters(){this.dispatchFilterChange(),this._hasController?this.debouncedDataRequest():this.renderBody()}setColumnVisible(e,t){this.columnManager.setColumnVisible(e,t),this.renderHeader(),this.renderBody(),this.dispatchColumnVisibilityChange(e,t)}showAllColumns(){this.columnManager.showAllColumns(),this.renderHeader(),this.renderBody()}hideAllColumns(){this.columnManager.hideAllColumns(),this.renderHeader(),this.renderBody()}getColumnVisibility(){return this.columnManager.getVisibilityModel()}pinColumn(e,t){this.columnManager.pinColumn(e,t),this.renderHeader(),this.renderBody(),this.dispatchColumnPinChange(e,t)}unpinColumn(e){this.columnManager.unpinColumn(e),this.renderHeader(),this.renderBody(),this.dispatchColumnPinChange(e,!1)}autoSizeColumn(e){this.tbody&&(this.columnManager.autoSizeColumn(e,this.tbody),this.renderHeader())}autoSizeAllColumns(){this.tbody&&(this.columnManager.autoSizeAll(this.tbody),this.renderHeader())}moveColumn(e,t){this.columnManager.moveColumn(e,t),this.renderHeader(),this.renderBody(),this.dispatchColumnOrderChange(e,t)}startEdit(e,t){if(!this.editable)return;const a=this.data[e];if(a){if("row"===this.editMode)this.editor.startRowEdit(e,a);else{const i=a[t];this.editor.startCellEdit(e,t,i,a)}this.renderBody()}}async commitEdit(){if("row"===this.editMode){const e=await this.editor.commitRowEdit();return this.renderBody(),e?"Validation errors":null}{const e=await this.editor.commitCellEdit();return this.renderBody(),e}}cancelEdit(){"row"===this.editMode?this.editor.cancelRowEdit():this.editor.cancelCellEdit(),this.renderBody()}exportCSV(e){const t=this.getFilteredData(),a=e?.selectedOnly?this.selectedRows.map(e=>t[e]).filter(Boolean):t;this.exporter.exportCSV(a,this.columns,e)}printTable(e){this.exporter.print(this,e)}async copyToClipboard(e){return this.exporter.copyToClipboard(this.getFilteredData(),this.columns,this.selectedRows,e)}toggleRowSelection(e){if(this.selectabilityCheck&&!this.selectabilityCheck(this.data[e],e))return;const t=this.selectedRows.includes(e);this.selectedRows=t?this.selectedRows.filter(t=>t!==e):[...this.selectedRows,e],this.updateRowSelectionState(),this.updateSelectAllState(),this.dispatchRowSelectionChanged(e,!t)}selectAllRows(){const e=this.getFilteredData().map(e=>this.data.indexOf(e)),t=e.every(e=>this.selectedRows.includes(e));if(t)this.selectedRows=this.selectedRows.filter(t=>!e.includes(t));else{const t=new Set([...this.selectedRows,...e]);this.selectedRows=Array.from(t)}this.updateRowSelectionState(),this.updateSelectAllState(),this.dispatchSelectAllChanged(t)}setDetailPanel(e){this.masterDetail.attach(this,e),this.renderHeader(),this.renderBody()}expandRow(e){this.masterDetail.expand(e),this.renderBody()}collapseRow(e){this.masterDetail.collapse(e),this.renderBody()}toggleRowExpansion(e){this.masterDetail.toggle(e),this.renderBody()}expandAllRows(){this.masterDetail.expandAll(this.data.length),this.renderBody()}collapseAllRows(){this.masterDetail.collapseAll(),this.renderBody()}setToolbar(e){const t=this.shadowRoot?.querySelector(".table-controls-container");t&&(this.toolbar.attach(this,t,e),this.toolbar.onSearch=e=>this.setQuickFilter(e),this.toolbar.onSortColumn=(e,t)=>{this.currentSort=[{column:e,direction:t}],this.renderHeader(),this._hasController?this.debouncedDataRequest():this.sortLocalData()},this.toolbar.onSetSortModel=e=>{this.currentSort=e,this.renderHeader(),this._hasController?this.debouncedDataRequest():this.sortLocalData()},this.toolbar.onFilterColumn=(e,t,a)=>{this.setColumnFilter(e,t,a)},this.toolbar.onRemoveFilter=e=>{this.removeColumnFilter(e)},this.toolbar.onSetFilterModel=(e,t)=>{this.filterEngine.clearAllFilters(),this.filterEngine.setFilterLogic(t);for(const t of e)this.filterEngine.setColumnFilter(t.column,t.operator,t.value);this.applyClientFilters()},this.toolbar.onClearFilters=()=>{this.clearAllFilters()},this.toolbar.onExportCSV=()=>this.exportCSV(),this.toolbar.onFullscreen=()=>this.toggleFullscreen())}setTreeData(e){this.treeData.attach(e),this.renderBody()}expandTreeNode(e){this.treeData.expand(e),this.renderBody()}collapseTreeNode(e){this.treeData.collapse(e),this.renderBody()}toggleTreeNode(e){this.treeData.toggle(e),this.renderBody()}expandAllTreeNodes(){this.treeData.expandAll(this.data),this.renderBody()}collapseAllTreeNodes(){this.treeData.collapseAll(),this.renderBody()}setColumnGroups(e){this.columnManager.setColumnGroups(e),this.renderHeader()}initColumnMenu(){this.columnMenu&&(this.columnMenuManager.attach(this),this.columnMenuManager.onSortAsc=e=>{this.currentSort=[{column:e,direction:"asc"}],this.renderHeader(),this._hasController?this.debouncedDataRequest():this.sortLocalData()},this.columnMenuManager.onSortDesc=e=>{this.currentSort=[{column:e,direction:"desc"}],this.renderHeader(),this._hasController?this.debouncedDataRequest():this.sortLocalData()},this.columnMenuManager.onFilter=e=>{this.toolbar.openFilterModal(e)},this.columnMenuManager.onHide=e=>this.setColumnVisible(e,!1),this.columnMenuManager.onPinLeft=e=>this.pinColumn(e,"left"),this.columnMenuManager.onPinRight=e=>this.pinColumn(e,"right"),this.columnMenuManager.onUnpin=e=>this.unpinColumn(e),this.columnMenuManager.onAutoSize=e=>this.autoSizeColumn(e))}pinRowTop(e){this.pinnedTopRows.push(e),this.renderBody()}pinRowBottom(e){this.pinnedBottomRows.push(e),this.renderBody()}unpinRow(e){this.pinnedTopRows=this.pinnedTopRows.filter(t=>t!==e),this.pinnedBottomRows=this.pinnedBottomRows.filter(t=>t!==e),this.renderBody()}clearPinnedRows(){this.pinnedTopRows=[],this.pinnedBottomRows=[],this.renderBody()}setRowHeight(e){this.rowHeight=e,this.renderBody()}setRowHeightCallback(e){this.rowHeightCallback=e,this.renderBody()}setSortComparator(e,t){const a=this.columns.find(t=>t.key===e);a&&(a.sortComparator=t)}setSelectabilityCheck(e){this.selectabilityCheck=e}getSelectedData(){return this.selectedRows.map(e=>this.data[e]).filter(Boolean)}setupLazyLoading(){if(!this.lazyLoad)return;const e=this.shadowRoot?.querySelector(".snice-table");e&&(this.lazyLoadHandler=()=>{const{scrollTop:t,scrollHeight:a,clientHeight:i}=e;a-t-i<this.lazyLoadThreshold&&this.dispatchEvent(new CustomEvent("lazy-load",{detail:{currentCount:this.data.length},bubbles:!0,composed:!0}))},e.addEventListener("scroll",this.lazyLoadHandler,{passive:!0}))}scrollToColumn(e){const t=this.shadowRoot?.querySelector(`th[data-key="${e}"]`);t?.scrollIntoView({inline:"nearest",block:"nearest"})}setListViewRenderer(e){this.listViewRenderer=e,this.list&&this.renderBody()}createRow(e,t,a){const i=document.createElement("tr");i.setAttribute("data-index",String(t)),this.rowHeightCallback?i.style.height=`${this.rowHeightCallback(e,t)}px`:48!==this.rowHeight&&(i.style.height=`${this.rowHeight}px`);const s=this.selectedRows.includes(t);if(i.setAttribute("data-selected",String(s)),this.rowReorder&&this.rowDnD.isEnabled()&&(i.appendChild(this.rowDnD.createDragHandle()),this.rowDnD.makeRowDraggable(i,t)),this.masterDetail.isEnabled()){const e=document.createElement("td");e.className="detail-toggle-cell",e.appendChild(this.masterDetail.createToggleButton(t)),i.appendChild(e)}if(this.selectable){const e=document.createElement("td");e.className="select-column",e.innerHTML=`<snice-checkbox class="row-select" size="small" compact ${s?"checked":""} data-row-index="${t}"></snice-checkbox>`,i.appendChild(e)}const n=this.columnManager.getAllStates().length>0?this.columnManager.getVisibleColumns():null,l=n?this.columns.filter(e=>n.some(t=>t.key===e.key)):this.columns;let r=0;return l.forEach((t,s)=>{if(r>0)return void r--;const n=document.createElement("td");n.setAttribute("data-key",t.key);const l=e[t.key],o=t.colSpan;if(o){const t="function"==typeof o?o(l,e):o;t>1&&(n.colSpan=t,r=t-1)}if(a&&t.key===this.treeData.getGroupColumn()){const e=this.treeData.createToggle(a);n.appendChild(e);const t=document.createElement("span");t.textContent=null==l?"":String(l),a.hasChildren&&(t.style.cursor="pointer",t.addEventListener("click",e=>{e.stopPropagation(),this.treeData.toggle(a.key),this.renderBody()})),n.appendChild(t)}else n.appendChild(this.createCellElement(t,l));const c=this.columnManager.getState(t.key);if(c)if(n.style.width=`${c.width}px`,"left"===c.pinned){const e=this.columnManager.getPinnedLeftOffsets();n.classList.add("pinned-cell"),n.style.position="sticky",n.style.left=`${e.get(t.key)??0}px`,n.style.zIndex="1"}else if("right"===c.pinned){const e=this.columnManager.getPinnedRightOffsets();n.classList.add("pinned-cell"),n.style.position="sticky",n.style.right=`${e.get(t.key)??0}px`,n.style.zIndex="1"}i.appendChild(n)}),i}},s})();return e.SniceTable=x,e}({},Snice);
|
|
1456
|
+
`}renderControls(){const e=this.shadowRoot?.querySelector(".table-controls-container");if(!e)return;if(this.searchable||this.filterable){if(0===e.children.length){const t=document.createElement("div");if(t.className="table-controls",t.setAttribute("part","controls"),this.searchable){const e=document.createElement("snice-input");e.className="search-input",e.setAttribute("type","search"),e.setAttribute("placeholder","Search..."),e.setAttribute("size","small"),e.style.width="16rem",e.style.maxWidth="16rem",e.style.flex="0 0 auto",e.addEventListener("input",this.handleSearchInput),t.appendChild(e)}if(this.filterable){const e=document.createElement("snice-select");e.className="selector-input",e.setAttribute("multiple",""),e.setAttribute("searchable",""),e.setAttribute("clearable",""),e.setAttribute("placeholder","Filter..."),e.setAttribute("size","medium"),this.selectorOptions.forEach(t=>{const i=document.createElement("snice-option");i.setAttribute("value",t.value),i.textContent=t.label,e.appendChild(i)}),t.appendChild(e)}e.appendChild(t)}}else e.innerHTML=""}async initialize(){this.addEventListener("controller-attached",this.onAttached),this.addEventListener("select-change",this.handleSelectorChange),this.addEventListener("detail-toggle",()=>this.renderBody()),await customElements.whenDefined("snice-column"),await customElements.whenDefined("snice-row"),await this.processSlottedContent(),this.renderControls(),this.initializeModules(),this.initColumnMenu(),this.rowReorder&&this.rowDnD.attach(this),this.columnReorder&&this.columnDnD.attach(this),this.virtualize&&requestAnimationFrame(()=>this.setupVirtualization()),this.lazyLoad&&requestAnimationFrame(()=>this.setupLazyLoading()),this.addEventListener("row-reorder",e=>{const{fromIndex:t,toIndex:i}=e.detail,a=this.data.splice(t,1)[0];this.data.splice(i,0,a),this.setData([...this.data])}),this.addEventListener("column-reorder",e=>{const{fromKey:t,toKey:i}=e.detail,a=this.columns.findIndex(e=>e.key===t),s=this.columns.findIndex(e=>e.key===i);a>=0&&s>=0&&(this.columnManager.moveColumn(t,s),this.renderHeader(),this.renderBody())}),this.addEventListener("tree-toggle",()=>this.renderBody())}async processSlottedContent(){const e=Array.from(this.querySelectorAll('snice-column[slot="columns"]'));if(e.length>0){this.columns=e.map(e=>e.getColumnDefinition());Array.from(this.querySelectorAll('snice-row[slot="rows"]')).forEach((e,t)=>{e.columns=this.columns,e.index=t,e.hoverable=this.hoverable,e.clickable=this.clickable,e.selectable=this.selectable}),requestAnimationFrame(()=>this.renderSlottedHeader())}}renderSlottedHeader(){const e=this.shadowRoot?.querySelector("#slotted-header");e&&0!==this.columns.length&&(e.innerHTML=this.columns.map(e=>`<div class="header-cell">${e.label}</div>`).join(""))}handleSelectorOptionsChange(){0===this.selectorOptions.length?this.classList.add("selector-options-empty"):this.classList.remove("selector-options-empty")}handleSortableChange(){this.renderHeader()}handleSelectableChange(){this.render()}handleColumnsChange(){this.renderHeader()}handleDataChange(){this.renderBody()}handleSelectedRowsChange(){this.updateRowSelectionState(),this.updateSelectAllState()}handleSortChange(){this.renderHeader()}handleControlsChange(){this.renderControls()}renderHeader(){if(!this.thead)return;const e=document.createElement("tr");if(this.rowReorder&&this.rowDnD.isEnabled()){const t=document.createElement("th");t.className="drag-handle-cell",e.appendChild(t)}if(this.masterDetail.isEnabled()){const t=document.createElement("th");t.className="detail-toggle-cell",e.appendChild(t)}if(this.selectable){const t=document.createElement("th");t.className="select-column";const i=this.getFilteredData().map(e=>this.data.indexOf(e)),a=i.filter(e=>this.selectedRows.includes(e)),s=a.length===i.length&&i.length>0,n=a.length>0&&a.length<i.length;t.innerHTML=`<snice-checkbox class="select-all" size="small" compact ${s?"checked":""}></snice-checkbox>`,e.appendChild(t),setTimeout(()=>{const e=t.querySelector(".select-all");e&&(e.indeterminate=n)},0)}const t=this.columnManager.getVisibleColumns(),i=t.length>0?new Set(t.map(e=>e.key)):null;this.columns.forEach(t=>{if(i&&!i.has(t.key))return;const a=document.createElement("th");a.setAttribute("data-key",t.key);const s=this.columnManager.getState(t.key);if(s)if(a.style.width=`${s.width}px`,"left"===s.pinned){const e=this.columnManager.getPinnedLeftOffsets();a.classList.add("pinned-cell"),a.style.position="sticky",a.style.left=`${e.get(t.key)??0}px`,a.style.zIndex="2"}else if("right"===s.pinned){const e=this.columnManager.getPinnedRightOffsets();a.classList.add("pinned-cell"),a.style.position="sticky",a.style.right=`${e.get(t.key)??0}px`,a.style.zIndex="2"}if(this.sortable&&!1!==t.sortable?(a.classList.add("sortable"),a.setAttribute("role","button"),a.innerHTML=this.renderSortableHeader(t)):a.textContent=t.label,this.filterEngine.hasColumnFilter(t.key)&&a.classList.add("filtered"),this.columnResize&&!1!==t.resizable){const e=document.createElement("span");e.className="resize-handle",e.addEventListener("mousedown",e=>{e.stopPropagation(),this.columnManager.startResize(t.key,e.clientX)}),e.addEventListener("dblclick",e=>{e.stopPropagation(),this.tbody&&(this.columnManager.autoSizeColumn(t.key,this.tbody),this.renderHeader(),this.renderBody())}),a.appendChild(e),a.style.position="relative"}this.columnMenu&&a.addEventListener("contextmenu",e=>{e.preventDefault();const i=this.columnManager.getState(t.key);this.columnMenuManager.show(t.key,e.clientX,e.clientY,{sortable:this.sortable&&!1!==t.sortable,filterable:!1!==t.filterable,hideable:i?.hideable,pinnable:i?.pinnable,pinned:i?.pinned})}),this.columnReorder&&this.columnDnD.isEnabled()&&this.columnDnD.makeHeaderDraggable(a,t.key,!1!==t.reorderable),e.appendChild(a)}),this.thead.innerHTML="";if(this.columnManager.getColumnGroups().length>0){const e=document.createElement("tr");e.className="column-group-row",e.innerHTML=this.columnManager.renderGroupHeaders(),this.thead.appendChild(e)}if(this.thead.appendChild(e),this.headerFilters){const e=document.createElement("tr");if(e.className="header-filter-row",this.rowReorder&&this.rowDnD.isEnabled()){const t=document.createElement("td");t.className="drag-handle-cell",e.appendChild(t)}if(this.masterDetail.isEnabled()){const t=document.createElement("td");t.className="detail-toggle-cell",e.appendChild(t)}if(this.selectable){const t=document.createElement("td");t.className="select-column",e.appendChild(t)}this.columns.forEach(t=>{if(i&&!i.has(t.key))return;const a=document.createElement("td"),s=document.createElement("snice-input");s.size="small",s.placeholder=`Filter ${t.label}...`,s.setAttribute("data-column",t.key),s.value=this.filterEngine.getHeaderFilter(t.key),s.style.cssText="width:100%;--snice-color-border:transparent;--snice-border-radius-md:0;",s.addEventListener("input",()=>{this.filterEngine.setHeaderFilter(t.key,s.value),this.applyClientFilters()}),a.appendChild(s),e.appendChild(a)}),this.thead.appendChild(e)}}renderSortableHeader(e){const t=this.currentSort.find(t=>t.column===e.key),i=this.currentSort.findIndex(t=>t.column===e.key),a=!!t,s='<svg width="10" height="6" viewBox="0 0 10 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M1 5l4-4 4 4"/></svg>',n='<svg width="10" height="6" viewBox="0 0 10 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M1 1l4 4 4-4"/></svg>';let l=`<span style="display:flex;flex-direction:column;gap:0;opacity:0.3">${s}${n}</span>`,r="";t&&("asc"===t.direction?l=s:"desc"===t.direction&&(l=n),this.currentSort.length>1&&(r=`<span class="sort-order">${i+1}</span>`));const o=["sort-indicator",a?"active":""].filter(Boolean).join(" ");return`\n <div class="sort-header">\n <span>${e.label}</span>\n <div class="${o}">\n ${l}\n ${r}\n </div>\n </div>\n `}renderBody(){if(!this.tbody)return;if(this.columns.length>0&&this.columnManager.initialize(this.columns,this),this.virtualize&&this.virtualizer.isEnabled()){const e=this.getFilteredData();return this.virtualizer.setTotalRows(e.length),this.virtualizer.refresh(),void(this.pagination&&this.renderPagination())}if(this.tbody.innerHTML="",0===this.data.length&&this.columns.length>0){const e=(this.selectable?1:0)+(this.masterDetail.isEnabled()?1:0)+(this.rowReorder&&this.rowDnD.isEnabled()?1:0),t=this.columns.length+e;if(this.loading){const e=document.createElement("tr"),i=document.createElement("td");return i.colSpan=t,i.className="no-data",i.innerHTML='<snice-progress variant="circular" indeterminate size="small"></snice-progress>',e.appendChild(i),void this.tbody.appendChild(e)}{const e=document.createElement("tr"),i=document.createElement("td");i.colSpan=t,i.className="no-data";const a=this.querySelector('[slot="empty-state"]');if(a)i.appendChild(a.cloneNode(!0));else{const e=document.createElement("snice-empty-state");e.setAttribute("size","small"),e.setAttribute("icon","📭"),e.setAttribute("title","No data"),e.setAttribute("description","No records to display."),i.appendChild(e)}return e.appendChild(i),void this.tbody.appendChild(e)}}const e=document.createDocumentFragment();let t=this.getFilteredData(),i=t,a=0;this.pagination&&"client"===this.paginationMode&&(this.totalItems=t.length,a=(this.currentPage-1)*this.pageSize,i=t.slice(a,a+this.pageSize));const s=(this.selectable?1:0)+(this.masterDetail.isEnabled()?1:0)+(this.rowReorder&&this.rowDnD.isEnabled()?1:0),n=this.columns.length+s;for(const t of this.pinnedTopRows){const i=this.createRow(t,-1);i.classList.add("pinned-row","pinned-row--top"),e.appendChild(i)}if(this.treeData.isEnabled()){this.treeData.processData(i).forEach((t,i)=>{const s=a+i;e.appendChild(this.createRow(t.data,s,t))})}else i.forEach((t,i)=>{const s=a+i;if(e.appendChild(this.createRow(t,s)),this.masterDetail.isEnabled()&&this.masterDetail.isExpanded(s)){const i=this.masterDetail.createDetailRow(t,s,n);i&&e.appendChild(i)}});for(const t of this.pinnedBottomRows){const i=this.createRow(t,-1);i.classList.add("pinned-row","pinned-row--bottom"),e.appendChild(i)}this.tbody.appendChild(e),this.pagination&&this.renderPagination()}get totalPages(){const e="client"===this.paginationMode?this.data.length:this.totalItems;return Math.max(1,Math.ceil(e/this.pageSize))}goToPage(e){const t=Math.max(1,Math.min(e,this.totalPages));t!==this.currentPage&&(this.currentPage=t,"server"===this.paginationMode&&this._hasController?this.debouncedDataRequest():this.renderBody(),this.dispatchPageChange())}setPageSize(e){this.pageSize=e,this.currentPage=1,"server"===this.paginationMode&&this._hasController?this.debouncedDataRequest():this.renderBody(),this.dispatchPageChange()}dispatchPageChange(){return{page:this.currentPage,pageSize:this.pageSize,totalPages:this.totalPages,totalItems:"client"===this.paginationMode?this.data.length:this.totalItems}}renderPagination(){const e=this.shadowRoot?.querySelector(".table-pagination-container");if(!e)return;if(!this.pagination)return void(e.innerHTML="");const t="client"===this.paginationMode?this.data.length:this.totalItems,i=this.totalPages,a=Math.min((this.currentPage-1)*this.pageSize+1,t),s=Math.min(this.currentPage*this.pageSize,t),n=[];if(i<=7)for(let e=1;e<=i;e++)n.push(this.pageButton(e));else{n.push(this.pageButton(1)),this.currentPage>3&&n.push('<span class="pagination__ellipsis">…</span>');const e=Math.max(2,this.currentPage-1),t=Math.min(i-1,this.currentPage+1);for(let i=e;i<=t;i++)n.push(this.pageButton(i));this.currentPage<i-2&&n.push('<span class="pagination__ellipsis">…</span>'),n.push(this.pageButton(i))}e.innerHTML="";const l=document.createElement("div");l.className="pagination",l.setAttribute("part","pagination");const r=document.createElement("div");r.className="pagination__info",r.textContent=`Showing ${a}–${s} of ${t}`,l.appendChild(r);const o=document.createElement("div");o.className="pagination__controls",o.innerHTML=`\n <button class="pagination__btn pagination__first" ${this.currentPage<=1?"disabled":""} data-page="1" aria-label="First page">⟨⟨</button>\n <button class="pagination__btn pagination__prev" ${this.currentPage<=1?"disabled":""} data-page="${this.currentPage-1}" aria-label="Previous page">⟨</button>\n ${n.join("")}\n <button class="pagination__btn pagination__next" ${this.currentPage>=i?"disabled":""} data-page="${this.currentPage+1}" aria-label="Next page">⟩</button>\n <button class="pagination__btn pagination__last" ${this.currentPage>=i?"disabled":""} data-page="${i}" aria-label="Last page">⟩⟩</button>\n `,l.appendChild(o);const c=document.createElement("div");c.className="pagination__size";const d=document.createElement("label");d.textContent="Rows per page:",c.appendChild(d);const h=document.createElement("snice-select");h.size="small",h.className="pagination__size-select";for(const e of this.pageSizes){const t=document.createElement("snice-option");t.setAttribute("value",String(e)),t.textContent=String(e),e===this.pageSize&&t.setAttribute("selected",""),h.appendChild(t)}h.value=String(this.pageSize),c.appendChild(h),l.appendChild(c),e.appendChild(l),o.querySelectorAll("[data-page]").forEach(e=>{e.addEventListener("click",()=>{const t=parseInt(e.getAttribute("data-page"));this.goToPage(t)})}),h.addEventListener("select-change",e=>{this.setPageSize(parseInt(e.detail.value))})}pageButton(e){return`<button class="pagination__btn pagination__page${e===this.currentPage?" pagination__btn--active":""}" data-page="${e}">${e}</button>`}createCellElement(e,t){const i=this.getCellTagName(e.type),a=document.createElement(i);a.setAttribute("type",e.type||"text"),a.setAttribute("align",e.align||"left"),a.setAttribute("in-table","true");switch(null!==t&&"object"==typeof t?a.setAttribute("value",JSON.stringify(t)):a.setAttribute("value",String(t??"")),a.column=e,e.type){case"number":case"currency":if(void 0!==e.decimals&&a.setAttribute("decimals",String(e.decimals)),e.thousandsSeparator&&a.setAttribute("thousands-separator","true"),e.prefix&&a.setAttribute("prefix",e.prefix),e.suffix&&a.setAttribute("suffix",e.suffix),"currency"===e.type){const t=e.currencyFormat;t&&(t.currency&&a.setAttribute("currency",t.currency),t.locale&&a.setAttribute("locale",t.locale),t.display&&a.setAttribute("display",t.display),void 0!==t.decimals&&a.setAttribute("decimals",String(t.decimals)))}break;case"date":e.dateFormat&&a.setAttribute("date-format",e.dateFormat);break;case"boolean":e.useSymbols&&a.setAttribute("use-symbols","true"),e.trueSymbol&&a.setAttribute("true-symbol",e.trueSymbol),e.falseSymbol&&a.setAttribute("false-symbol",e.falseSymbol),e.trueValue&&a.setAttribute("true-value",e.trueValue),e.falseValue&&a.setAttribute("false-value",e.falseValue);break;case"sparkline":{const t=e.sparklineFormat;t&&(t.color&&a.setAttribute("color",t.color),t.type&&a.setAttribute("chart-type",t.type),t.width&&a.setAttribute("width",String(t.width)),t.height&&a.setAttribute("height",String(t.height)));break}case"rating":{const t=e.ratingFormat;t&&(t.max&&a.setAttribute("max",String(t.max)),t.color&&a.setAttribute("color",t.color));break}case"progress":{const t=e.progressFormat;t&&(t.max&&a.setAttribute("max",String(t.max)),t.color&&a.setAttribute("color",t.color),t.showPercentage&&a.setAttribute("show-percentage","true"));break}case"percentage":case"percent":{const t=e.percentageFormat;t&&(void 0!==t.decimals&&a.setAttribute("decimals",String(t.decimals)),t.colorize&&a.setAttribute("colorize","true"));break}case"status":{const t=e.statusFormat;t&&(t.variant&&a.setAttribute("variant",t.variant),t.showDot&&a.setAttribute("show-dot","true"));break}case"link":{const t=e.linkFormat;t&&(t.target&&a.setAttribute("target",t.target),t.external&&a.setAttribute("external","true"));break}case"image":{const t=e.imageFormat;t&&(t.shape&&a.setAttribute("shape",t.shape),t.size&&a.setAttribute("size",t.size));break}case"color":{const t=e.colorFormat;t&&(!1!==t.showSwatch&&a.setAttribute("show-swatch","true"),t.displayFormat&&a.setAttribute("display-format",t.displayFormat));break}case"email":{const t=e.emailFormat;t&&t.showIcon&&a.setAttribute("show-icon","true");break}case"phone":{const t=e.phoneFormat;t&&(t.showIcon&&a.setAttribute("show-icon","true"),t.format&&a.setAttribute("format","true"));break}}return a}getCellTagName(e){switch(e){case"text":return"snice-cell-text";case"number":case"currency":return"snice-cell-number";case"date":return"snice-cell-date";case"boolean":return"snice-cell-boolean";case"rating":return"snice-cell-rating";case"progress":return"snice-cell-progress";case"duration":return"snice-cell-duration";case"filesize":return"snice-cell-filesize";case"sparkline":return"snice-cell-sparkline";case"image":return"snice-cell-image";case"percentage":case"percent":return"snice-cell-percentage";case"tag":return"snice-cell-tag";case"status":return"snice-cell-status";case"actions":return"snice-cell-actions";case"link":return"snice-cell-link";case"email":return"snice-cell-email";case"phone":return"snice-cell-phone";case"color":return"snice-cell-color";case"location":return"snice-cell-location";case"json":return"snice-cell-json";default:return"snice-cell"}}updateRowSelectionState(){if(!this.tbody)return;this.tbody.querySelectorAll("tr").forEach((e,t)=>{const i=this.selectedRows.includes(t);e.setAttribute("data-selected",String(i));const a=e.querySelector("snice-checkbox.row-select");a&&(a.checked=i)})}updateSelectAllState(){const e=this.thead?.querySelector("snice-checkbox.select-all");if(!e)return;const t=this.getFilteredData().map(e=>this.data.indexOf(e)),i=t.filter(e=>this.selectedRows.includes(e)),a=i.length===t.length&&t.length>0,s=i.length>0&&i.length<t.length;e.checked=a,e.indeterminate=s}toggleSort(e,t=!1){if(t){const t=this.currentSort.findIndex(t=>t.column===e);if(-1===t)this.currentSort=[...this.currentSort,{column:e,direction:"asc"}];else{"asc"===this.currentSort[t].direction?this.currentSort=this.currentSort.map((e,i)=>i===t?{...e,direction:"desc"}:e):this.currentSort=this.currentSort.filter(t=>t.column!==e)}}else{const t=this.currentSort.find(t=>t.column===e);t?"asc"===t.direction?this.currentSort=[{column:e,direction:"desc"}]:this.currentSort=[]:this.currentSort=[{column:e,direction:"asc"}]}this.renderHeader(),this.dispatchSortChange(),this._hasController?this.debouncedDataRequest():this.sortLocalData()}sortLocalData(){this._unsortedData.length||(this._unsortedData=[...this.data]),0===this.currentSort.length?this.data=[...this._unsortedData]:this.data=[...this._unsortedData].sort((e,t)=>{for(const{column:i,direction:a}of this.currentSort){const s=this.columns.find(e=>e.key===i),n=s?.sortComparator;if(n){const s=n(e[i],t[i],a);if(0!==s)return s}else{const n=s?.valueGetter?s.valueGetter(e[i],e):e[i]??"",l=s?.valueGetter?s.valueGetter(t[i],t):t[i]??"",r=String(n).localeCompare(String(l),void 0,{numeric:!0});if(0!==r)return"asc"===a?r:-r}}return 0}),this.renderBody()}dispatchRowSelectionChanged(e,t){return{selectedRows:this.selectedRows,rowIndex:e,selected:t}}dispatchSelectAllChanged(e){return{selectedRows:this.selectedRows,allSelected:e}}dispatchSortChange(){return{sort:this.currentSort}}dispatchFilterChange(){return{filters:this.filterEngine.getFilterModel()}}dispatchColumnVisibilityChange(e,t){return{key:e,visible:t,visibility:this.columnManager.getVisibilityModel()}}dispatchColumnPinChange(e,t){return{key:e,pinned:t}}dispatchColumnOrderChange(e,t){return{key:e,toIndex:t}}dispatchDensityChange(){return{density:this.density}}initializeModules(){if(this.columnManager.initialize(this.columns,this),this.editable){this.editor.attach(this),this.editor.setEditMode(this.editMode);const e=this.columns.filter(e=>!1!==e.editable).map(e=>e.key);this.editor.setEditableColumns(e);for(const e of this.columns)(e.valueGetter||e.valueFormatter||e.valueParser||e.valueSetter)&&this.editor.setPipeline(e.key,{valueGetter:e.valueGetter,valueFormatter:e.valueFormatter,valueParser:e.valueParser,valueSetter:e.valueSetter})}this.shadowRoot&&this.keyboard.attach({shadowRoot:this.shadowRoot,totalRows:this.data.length,totalColumns:this.columns.length,tabMode:"all",isEditing:()=>this.editor.isEditing(),onCellActivate:(e,t)=>{this.editable&&this.startEdit(e,t)},onSelectionToggle:e=>{this.selectable&&this.toggleRowSelection(e)},onSelectAll:()=>{this.selectable&&this.selectAllRows()}})}cleanup(){if(this.virtualizer.detach(),this.keyboard.detach(),this.lazyLoadHandler){const e=this.shadowRoot?.querySelector(".snice-table");e?.removeEventListener("scroll",this.lazyLoadHandler)}}setupVirtualization(){if(!this.virtualize||!this.shadowRoot)return;const e=this.shadowRoot.querySelector(".snice-table");e&&this.virtualizer.attach({rowHeight:this.rowHeight,bufferPx:this.virtualBuffer,totalRows:this.getFilteredData().length,scrollContainer:e,renderRange:(e,t)=>this.renderRowRange(e,t)})}renderRowRange(e,t){const i=document.createDocumentFragment(),a=this.getFilteredData();for(let s=e;s<t&&s<a.length;s++){const e=a[s],t=this.createRow(e,s);i.appendChild(t)}return i}scrollToRow(e){this.virtualizer.scrollToRow(e)}getScrollPosition(){return this.virtualizer.getScrollPosition()}setColumnFilter(e,t,i){this.filterEngine.setColumnFilter(e,t,i),this.applyClientFilters()}removeColumnFilter(e){this.filterEngine.removeColumnFilter(e),this.applyClientFilters()}setQuickFilter(e){this.filterEngine.setQuickFilter(e),this.applyClientFilters()}setFilterModel(e){this.filterEngine.setFilterModel(e),this.applyClientFilters()}getFilterModel(){return this.filterEngine.getFilterModel()}clearAllFilters(){this.filterEngine.clearAllFilters(),this.applyClientFilters()}getFilteredData(){return this.filterEngine.hasActiveFilters()?this.filterEngine.applyFilters(this.data,this.columns):this.data}applyClientFilters(){this.dispatchFilterChange(),this._hasController?this.debouncedDataRequest():this.renderBody()}setColumnVisible(e,t){this.columnManager.setColumnVisible(e,t),this.renderHeader(),this.renderBody(),this.dispatchColumnVisibilityChange(e,t)}showAllColumns(){this.columnManager.showAllColumns(),this.renderHeader(),this.renderBody()}hideAllColumns(){this.columnManager.hideAllColumns(),this.renderHeader(),this.renderBody()}getColumnVisibility(){return this.columnManager.getVisibilityModel()}pinColumn(e,t){this.columnManager.pinColumn(e,t),this.renderHeader(),this.renderBody(),this.dispatchColumnPinChange(e,t)}unpinColumn(e){this.columnManager.unpinColumn(e),this.renderHeader(),this.renderBody(),this.dispatchColumnPinChange(e,!1)}autoSizeColumn(e){this.tbody&&(this.columnManager.autoSizeColumn(e,this.tbody),this.renderHeader())}autoSizeAllColumns(){this.tbody&&(this.columnManager.autoSizeAll(this.tbody),this.renderHeader())}moveColumn(e,t){this.columnManager.moveColumn(e,t),this.renderHeader(),this.renderBody(),this.dispatchColumnOrderChange(e,t)}startEdit(e,t){if(!this.editable)return;const i=this.data[e];if(i){if("row"===this.editMode)this.editor.startRowEdit(e,i);else{const a=i[t];this.editor.startCellEdit(e,t,a,i)}this.renderBody()}}async commitEdit(){if("row"===this.editMode){const e=await this.editor.commitRowEdit();return this.renderBody(),e?"Validation errors":null}{const e=await this.editor.commitCellEdit();return this.renderBody(),e}}cancelEdit(){"row"===this.editMode?this.editor.cancelRowEdit():this.editor.cancelCellEdit(),this.renderBody()}exportCSV(e){const t=this.getFilteredData(),i=e?.selectedOnly?this.selectedRows.map(e=>t[e]).filter(Boolean):t;this.exporter.exportCSV(i,this.columns,e)}printTable(e){this.exporter.print(this,e)}async copyToClipboard(e){return this.exporter.copyToClipboard(this.getFilteredData(),this.columns,this.selectedRows,e)}toggleRowSelection(e){if(this.selectabilityCheck&&!this.selectabilityCheck(this.data[e],e))return;const t=this.selectedRows.includes(e);this.selectedRows=t?this.selectedRows.filter(t=>t!==e):[...this.selectedRows,e],this.updateRowSelectionState(),this.updateSelectAllState(),this.dispatchRowSelectionChanged(e,!t)}selectAllRows(){const e=this.getFilteredData().map(e=>this.data.indexOf(e)),t=e.every(e=>this.selectedRows.includes(e));if(t)this.selectedRows=this.selectedRows.filter(t=>!e.includes(t));else{const t=new Set([...this.selectedRows,...e]);this.selectedRows=Array.from(t)}this.updateRowSelectionState(),this.updateSelectAllState(),this.dispatchSelectAllChanged(t)}setDetailPanel(e){this.masterDetail.attach(this,e),this.renderHeader(),this.renderBody()}expandRow(e){this.masterDetail.expand(e),this.renderBody()}collapseRow(e){this.masterDetail.collapse(e),this.renderBody()}toggleRowExpansion(e){this.masterDetail.toggle(e),this.renderBody()}expandAllRows(){this.masterDetail.expandAll(this.data.length),this.renderBody()}collapseAllRows(){this.masterDetail.collapseAll(),this.renderBody()}setToolbar(e){const t=this.shadowRoot?.querySelector(".table-controls-container");t&&(this.toolbar.attach(this,t,e),this.toolbar.onSearch=e=>this.setQuickFilter(e),this.toolbar.onSortColumn=(e,t)=>{this.currentSort=[{column:e,direction:t}],this.renderHeader(),this._hasController?this.debouncedDataRequest():this.sortLocalData()},this.toolbar.onSetSortModel=e=>{this.currentSort=e,this.renderHeader(),this._hasController?this.debouncedDataRequest():this.sortLocalData()},this.toolbar.onFilterColumn=(e,t,i)=>{this.setColumnFilter(e,t,i)},this.toolbar.onRemoveFilter=e=>{this.removeColumnFilter(e)},this.toolbar.onSetFilterModel=(e,t)=>{this.filterEngine.clearAllFilters(),this.filterEngine.setFilterLogic(t);for(const t of e)this.filterEngine.setColumnFilter(t.column,t.operator,t.value);this.applyClientFilters()},this.toolbar.onClearFilters=()=>{this.clearAllFilters()},this.toolbar.onExportCSV=()=>this.exportCSV(),this.toolbar.onFullscreen=()=>this.toggleFullscreen())}setTreeData(e){this.treeData.attach(e),this.renderBody()}expandTreeNode(e){this.treeData.expand(e),this.renderBody()}collapseTreeNode(e){this.treeData.collapse(e),this.renderBody()}toggleTreeNode(e){this.treeData.toggle(e),this.renderBody()}expandAllTreeNodes(){this.treeData.expandAll(this.data),this.renderBody()}collapseAllTreeNodes(){this.treeData.collapseAll(),this.renderBody()}setColumnGroups(e){this.columnManager.setColumnGroups(e),this.renderHeader()}initColumnMenu(){this.columnMenu&&(this.columnMenuManager.attach(this),this.columnMenuManager.onSortAsc=e=>{this.currentSort=[{column:e,direction:"asc"}],this.renderHeader(),this._hasController?this.debouncedDataRequest():this.sortLocalData()},this.columnMenuManager.onSortDesc=e=>{this.currentSort=[{column:e,direction:"desc"}],this.renderHeader(),this._hasController?this.debouncedDataRequest():this.sortLocalData()},this.columnMenuManager.onFilter=e=>{this.toolbar.openFilterModal(e)},this.columnMenuManager.onHide=e=>this.setColumnVisible(e,!1),this.columnMenuManager.onPinLeft=e=>this.pinColumn(e,"left"),this.columnMenuManager.onPinRight=e=>this.pinColumn(e,"right"),this.columnMenuManager.onUnpin=e=>this.unpinColumn(e),this.columnMenuManager.onAutoSize=e=>this.autoSizeColumn(e))}pinRowTop(e){this.pinnedTopRows.push(e),this.renderBody()}pinRowBottom(e){this.pinnedBottomRows.push(e),this.renderBody()}unpinRow(e){this.pinnedTopRows=this.pinnedTopRows.filter(t=>t!==e),this.pinnedBottomRows=this.pinnedBottomRows.filter(t=>t!==e),this.renderBody()}clearPinnedRows(){this.pinnedTopRows=[],this.pinnedBottomRows=[],this.renderBody()}setRowHeight(e){this.rowHeight=e,this.renderBody()}setRowHeightCallback(e){this.rowHeightCallback=e,this.renderBody()}setSortComparator(e,t){const i=this.columns.find(t=>t.key===e);i&&(i.sortComparator=t)}setSelectabilityCheck(e){this.selectabilityCheck=e}getSelectedData(){return this.selectedRows.map(e=>this.data[e]).filter(Boolean)}setupLazyLoading(){if(!this.lazyLoad)return;const e=this.shadowRoot?.querySelector(".snice-table");e&&(this.lazyLoadHandler=()=>{const{scrollTop:t,scrollHeight:i,clientHeight:a}=e;i-t-a<this.lazyLoadThreshold&&this.dispatchEvent(new CustomEvent("lazy-load",{detail:{currentCount:this.data.length},bubbles:!0,composed:!0}))},e.addEventListener("scroll",this.lazyLoadHandler,{passive:!0}))}scrollToColumn(e){const t=this.shadowRoot?.querySelector(`th[data-key="${e}"]`);t?.scrollIntoView({inline:"nearest",block:"nearest"})}setListViewRenderer(e){this.listViewRenderer=e,this.list&&this.renderBody()}createRow(e,t,i){const a=document.createElement("tr");a.setAttribute("data-index",String(t)),this.rowHeightCallback?a.style.height=`${this.rowHeightCallback(e,t)}px`:48!==this.rowHeight&&(a.style.height=`${this.rowHeight}px`);const s=this.selectedRows.includes(t);if(a.setAttribute("data-selected",String(s)),this.rowReorder&&this.rowDnD.isEnabled()&&(a.appendChild(this.rowDnD.createDragHandle()),this.rowDnD.makeRowDraggable(a,t)),this.masterDetail.isEnabled()){const e=document.createElement("td");e.className="detail-toggle-cell",e.appendChild(this.masterDetail.createToggleButton(t)),a.appendChild(e)}if(this.selectable){const e=document.createElement("td");e.className="select-column",e.innerHTML=`<snice-checkbox class="row-select" size="small" compact ${s?"checked":""} data-row-index="${t}"></snice-checkbox>`,a.appendChild(e)}const n=this.columnManager.getAllStates().length>0?this.columnManager.getVisibleColumns():null,l=n?this.columns.filter(e=>n.some(t=>t.key===e.key)):this.columns;let r=0;return l.forEach((t,s)=>{if(r>0)return void r--;const n=document.createElement("td");n.setAttribute("data-key",t.key);const l=e[t.key],o=t.colSpan;if(o){const t="function"==typeof o?o(l,e):o;t>1&&(n.colSpan=t,r=t-1)}if(i&&t.key===this.treeData.getGroupColumn()){const e=this.treeData.createToggle(i);n.appendChild(e);const t=document.createElement("span");t.textContent=null==l?"":String(l),i.hasChildren&&(t.style.cursor="pointer",t.addEventListener("click",e=>{e.stopPropagation(),this.treeData.toggle(i.key),this.renderBody()})),n.appendChild(t)}else n.appendChild(this.createCellElement(t,l));const c=this.columnManager.getState(t.key);if(c)if(n.style.width=`${c.width}px`,"left"===c.pinned){const e=this.columnManager.getPinnedLeftOffsets();n.classList.add("pinned-cell"),n.style.position="sticky",n.style.left=`${e.get(t.key)??0}px`,n.style.zIndex="1"}else if("right"===c.pinned){const e=this.columnManager.getPinnedRightOffsets();n.classList.add("pinned-cell"),n.style.position="sticky",n.style.right=`${e.get(t.key)??0}px`,n.style.zIndex="1"}a.appendChild(n)}),a}},s})();return e.SniceTable=x,e}({},Snice);
|
|
1457
1457
|
//# sourceMappingURL=snice-table.min.js.map
|