@slotted/angular 0.0.0-stage → 0.1.0-beta.1
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/LICENSE +21 -0
- package/README.md +51 -2
- package/docs/AGENTS.snippet.md +10 -0
- package/docs/accordion.json +345 -0
- package/docs/accordion.md +207 -0
- package/docs/action-bar.json +421 -0
- package/docs/action-bar.md +364 -0
- package/docs/action-sheet.json +210 -0
- package/docs/action-sheet.md +19 -0
- package/docs/alert.json +407 -0
- package/docs/alert.md +239 -0
- package/docs/app-shell.examples.md +349 -0
- package/docs/app-shell.json +835 -0
- package/docs/app-shell.md +214 -0
- package/docs/aspect-ratio.json +159 -0
- package/docs/aspect-ratio.md +134 -0
- package/docs/attachment.json +486 -0
- package/docs/attachment.md +253 -0
- package/docs/avatar-group.json +208 -0
- package/docs/avatar-group.md +130 -0
- package/docs/avatar.json +342 -0
- package/docs/avatar.md +142 -0
- package/docs/badge.json +334 -0
- package/docs/badge.md +138 -0
- package/docs/breadcrumb.json +368 -0
- package/docs/breadcrumb.md +237 -0
- package/docs/button-group.json +158 -0
- package/docs/button-group.md +72 -0
- package/docs/button.examples.md +621 -0
- package/docs/button.json +977 -0
- package/docs/button.md +200 -0
- package/docs/calendar.json +592 -0
- package/docs/calendar.md +242 -0
- package/docs/card.json +283 -0
- package/docs/card.md +130 -0
- package/docs/carousel.json +560 -0
- package/docs/carousel.md +357 -0
- package/docs/cascader.json +933 -0
- package/docs/cascader.md +379 -0
- package/docs/chart.examples.md +582 -0
- package/docs/chart.json +1359 -0
- package/docs/chart.md +187 -0
- package/docs/checkbox-group.examples.md +612 -0
- package/docs/checkbox-group.json +395 -0
- package/docs/checkbox-group.md +106 -0
- package/docs/checkbox.examples.md +546 -0
- package/docs/checkbox.json +506 -0
- package/docs/checkbox.md +104 -0
- package/docs/code-block.json +616 -0
- package/docs/code-block.md +303 -0
- package/docs/collapsible.json +456 -0
- package/docs/collapsible.md +261 -0
- package/docs/color-picker.json +523 -0
- package/docs/color-picker.md +201 -0
- package/docs/column-manager.json +486 -0
- package/docs/column-manager.md +277 -0
- package/docs/combobox.examples.md +1732 -0
- package/docs/combobox.json +1250 -0
- package/docs/combobox.md +209 -0
- package/docs/command-palette.json +800 -0
- package/docs/command-palette.md +419 -0
- package/docs/container.json +156 -0
- package/docs/container.md +92 -0
- package/docs/context-menu.json +231 -0
- package/docs/context-menu.md +176 -0
- package/docs/currency-field.examples.md +321 -0
- package/docs/currency-field.json +649 -0
- package/docs/currency-field.md +128 -0
- package/docs/dashboard-grid.json +680 -0
- package/docs/dashboard-grid.md +265 -0
- package/docs/data-grid.examples.md +3064 -0
- package/docs/data-grid.json +1577 -0
- package/docs/data-grid.md +237 -0
- package/docs/data-grid.props.md +81 -0
- package/docs/data-list.json +685 -0
- package/docs/data-list.md +327 -0
- package/docs/date-field.json +490 -0
- package/docs/date-field.md +235 -0
- package/docs/date-picker.examples.md +1226 -0
- package/docs/date-picker.json +696 -0
- package/docs/date-picker.md +121 -0
- package/docs/date-range-picker.examples.md +1300 -0
- package/docs/date-range-picker.json +903 -0
- package/docs/date-range-picker.md +142 -0
- package/docs/datetime-field.json +665 -0
- package/docs/datetime-field.md +337 -0
- package/docs/datetime-picker.examples.md +1269 -0
- package/docs/datetime-picker.json +928 -0
- package/docs/datetime-picker.md +150 -0
- package/docs/datetime-range-picker.examples.md +225 -0
- package/docs/datetime-range-picker.json +1015 -0
- package/docs/datetime-range-picker.md +162 -0
- package/docs/description-list.json +471 -0
- package/docs/description-list.md +268 -0
- package/docs/detail-panel.json +530 -0
- package/docs/detail-panel.md +361 -0
- package/docs/dialog.examples.md +2467 -0
- package/docs/dialog.json +1141 -0
- package/docs/dialog.md +217 -0
- package/docs/dialog.props.md +63 -0
- package/docs/divider.json +148 -0
- package/docs/divider.md +83 -0
- package/docs/drawer.examples.md +1929 -0
- package/docs/drawer.json +753 -0
- package/docs/drawer.md +199 -0
- package/docs/entity-picker.json +946 -0
- package/docs/entity-picker.md +365 -0
- package/docs/event-calendar.examples.md +308 -0
- package/docs/event-calendar.json +1202 -0
- package/docs/event-calendar.md +201 -0
- package/docs/field-group.json +333 -0
- package/docs/field-group.md +181 -0
- package/docs/field.examples.md +676 -0
- package/docs/field.json +528 -0
- package/docs/field.md +127 -0
- package/docs/filter-bar.json +817 -0
- package/docs/filter-bar.md +380 -0
- package/docs/form.json +378 -0
- package/docs/form.md +235 -0
- package/docs/fullscreen.json +395 -0
- package/docs/fullscreen.md +225 -0
- package/docs/grid.json +176 -0
- package/docs/grid.md +74 -0
- package/docs/highlight.json +279 -0
- package/docs/highlight.md +210 -0
- package/docs/hover-card.json +254 -0
- package/docs/hover-card.md +213 -0
- package/docs/icon.json +173 -0
- package/docs/icon.md +101 -0
- package/docs/image.json +476 -0
- package/docs/image.md +254 -0
- package/docs/import-export-center.json +836 -0
- package/docs/import-export-center.md +345 -0
- package/docs/index.md +141 -0
- package/docs/inline-message.json +312 -0
- package/docs/inline-message.md +191 -0
- package/docs/inline.json +149 -0
- package/docs/inline.md +72 -0
- package/docs/kbd.json +350 -0
- package/docs/kbd.md +210 -0
- package/docs/link.json +264 -0
- package/docs/link.md +167 -0
- package/docs/list-item.json +463 -0
- package/docs/list-item.md +236 -0
- package/docs/list.json +321 -0
- package/docs/list.md +185 -0
- package/docs/listbox.json +807 -0
- package/docs/listbox.md +413 -0
- package/docs/loading-overlay.json +440 -0
- package/docs/loading-overlay.md +248 -0
- package/docs/markdown.json +461 -0
- package/docs/markdown.md +266 -0
- package/docs/menu.examples.md +1651 -0
- package/docs/menu.json +922 -0
- package/docs/menu.md +155 -0
- package/docs/menubar.json +292 -0
- package/docs/menubar.md +173 -0
- package/docs/message-scroller.json +401 -0
- package/docs/message-scroller.md +212 -0
- package/docs/message.json +862 -0
- package/docs/message.md +473 -0
- package/docs/multi-select.examples.md +1922 -0
- package/docs/multi-select.json +1314 -0
- package/docs/multi-select.md +213 -0
- package/docs/navigation-menu.json +529 -0
- package/docs/navigation-menu.md +329 -0
- package/docs/notification-center.json +664 -0
- package/docs/notification-center.md +372 -0
- package/docs/number-field.examples.md +1078 -0
- package/docs/number-field.json +668 -0
- package/docs/number-field.md +137 -0
- package/docs/otp-input.json +479 -0
- package/docs/otp-input.md +291 -0
- package/docs/page-header.json +574 -0
- package/docs/page-header.md +338 -0
- package/docs/page.json +332 -0
- package/docs/page.md +184 -0
- package/docs/pagination.json +434 -0
- package/docs/pagination.md +238 -0
- package/docs/popover.examples.md +1235 -0
- package/docs/popover.json +656 -0
- package/docs/popover.md +199 -0
- package/docs/progress-indicator.json +501 -0
- package/docs/progress-indicator.md +329 -0
- package/docs/prompt-composer.json +498 -0
- package/docs/prompt-composer.md +278 -0
- package/docs/prose.json +357 -0
- package/docs/prose.md +226 -0
- package/docs/radio-group.examples.md +626 -0
- package/docs/radio-group.json +541 -0
- package/docs/radio-group.md +112 -0
- package/docs/rating.json +1053 -0
- package/docs/rating.md +435 -0
- package/docs/result-state.json +376 -0
- package/docs/result-state.md +286 -0
- package/docs/saved-views.json +384 -0
- package/docs/saved-views.md +242 -0
- package/docs/scroll-area.json +120 -0
- package/docs/scroll-area.md +8 -0
- package/docs/section.json +344 -0
- package/docs/section.md +208 -0
- package/docs/segmented-control.json +429 -0
- package/docs/segmented-control.md +240 -0
- package/docs/select.examples.md +1214 -0
- package/docs/select.json +1147 -0
- package/docs/select.md +199 -0
- package/docs/side-navigation.json +632 -0
- package/docs/side-navigation.md +430 -0
- package/docs/skeleton.json +358 -0
- package/docs/skeleton.md +223 -0
- package/docs/slider.json +522 -0
- package/docs/slider.md +261 -0
- package/docs/sparkline.json +426 -0
- package/docs/sparkline.md +206 -0
- package/docs/split-button.json +361 -0
- package/docs/split-button.md +275 -0
- package/docs/splitter.json +142 -0
- package/docs/splitter.md +14 -0
- package/docs/stack.json +135 -0
- package/docs/stack.md +74 -0
- package/docs/stat-card.json +529 -0
- package/docs/stat-card.md +270 -0
- package/docs/status-indicator.json +314 -0
- package/docs/status-indicator.md +197 -0
- package/docs/stepper.json +451 -0
- package/docs/stepper.md +250 -0
- package/docs/switch.json +451 -0
- package/docs/switch.md +508 -0
- package/docs/table-of-contents.json +553 -0
- package/docs/table-of-contents.md +289 -0
- package/docs/table.examples.md +1981 -0
- package/docs/table.json +1059 -0
- package/docs/table.md +290 -0
- package/docs/tabs.examples.md +1370 -0
- package/docs/tabs.json +661 -0
- package/docs/tabs.md +211 -0
- package/docs/tag.json +813 -0
- package/docs/tag.md +241 -0
- package/docs/tags-input.json +771 -0
- package/docs/tags-input.md +361 -0
- package/docs/text-field.examples.md +821 -0
- package/docs/text-field.json +604 -0
- package/docs/text-field.md +125 -0
- package/docs/textarea.examples.md +612 -0
- package/docs/textarea.json +440 -0
- package/docs/textarea.md +98 -0
- package/docs/time-field.json +584 -0
- package/docs/time-field.md +291 -0
- package/docs/time-picker.json +679 -0
- package/docs/time-picker.md +315 -0
- package/docs/time-range-picker.examples.md +191 -0
- package/docs/time-range-picker.json +924 -0
- package/docs/time-range-picker.md +152 -0
- package/docs/timeline.json +839 -0
- package/docs/timeline.md +401 -0
- package/docs/toast.json +642 -0
- package/docs/toast.md +311 -0
- package/docs/toggle-group.json +417 -0
- package/docs/toggle-group.md +255 -0
- package/docs/toggle.json +326 -0
- package/docs/toggle.md +222 -0
- package/docs/toolbar.json +380 -0
- package/docs/toolbar.md +240 -0
- package/docs/tooltip.examples.md +664 -0
- package/docs/tooltip.json +604 -0
- package/docs/tooltip.md +146 -0
- package/docs/top-navigation.examples.md +287 -0
- package/docs/top-navigation.json +648 -0
- package/docs/top-navigation.md +138 -0
- package/docs/tour.json +759 -0
- package/docs/tour.md +337 -0
- package/docs/transfer.json +746 -0
- package/docs/transfer.md +273 -0
- package/docs/tree.json +918 -0
- package/docs/tree.md +397 -0
- package/docs/typography.json +317 -0
- package/docs/typography.md +107 -0
- package/docs/upload.examples.md +358 -0
- package/docs/upload.json +1103 -0
- package/docs/upload.md +166 -0
- package/docs/visually-hidden.json +71 -0
- package/docs/visually-hidden.md +42 -0
- package/docs/wizard.json +724 -0
- package/docs/wizard.md +295 -0
- package/fesm2022/slotted-angular-accordion.mjs +247 -0
- package/fesm2022/slotted-angular-accordion.mjs.map +1 -0
- package/fesm2022/slotted-angular-action-bar.mjs +639 -0
- package/fesm2022/slotted-angular-action-bar.mjs.map +1 -0
- package/fesm2022/slotted-angular-action-sheet.mjs +749 -0
- package/fesm2022/slotted-angular-action-sheet.mjs.map +1 -0
- package/fesm2022/slotted-angular-alert.mjs +427 -0
- package/fesm2022/slotted-angular-alert.mjs.map +1 -0
- package/fesm2022/slotted-angular-app-shell.mjs +1334 -0
- package/fesm2022/slotted-angular-app-shell.mjs.map +1 -0
- package/fesm2022/slotted-angular-aspect-ratio.mjs +63 -0
- package/fesm2022/slotted-angular-aspect-ratio.mjs.map +1 -0
- package/fesm2022/slotted-angular-attachment.mjs +595 -0
- package/fesm2022/slotted-angular-attachment.mjs.map +1 -0
- package/fesm2022/slotted-angular-avatar-group.mjs +230 -0
- package/fesm2022/slotted-angular-avatar-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-avatar.mjs +330 -0
- package/fesm2022/slotted-angular-avatar.mjs.map +1 -0
- package/fesm2022/slotted-angular-badge.mjs +255 -0
- package/fesm2022/slotted-angular-badge.mjs.map +1 -0
- package/fesm2022/slotted-angular-breadcrumb.mjs +544 -0
- package/fesm2022/slotted-angular-breadcrumb.mjs.map +1 -0
- package/fesm2022/slotted-angular-button-group.mjs +146 -0
- package/fesm2022/slotted-angular-button-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-button.mjs +692 -0
- package/fesm2022/slotted-angular-button.mjs.map +1 -0
- package/fesm2022/slotted-angular-calendar.mjs +916 -0
- package/fesm2022/slotted-angular-calendar.mjs.map +1 -0
- package/fesm2022/slotted-angular-card.mjs +225 -0
- package/fesm2022/slotted-angular-card.mjs.map +1 -0
- package/fesm2022/slotted-angular-carousel.mjs +840 -0
- package/fesm2022/slotted-angular-carousel.mjs.map +1 -0
- package/fesm2022/slotted-angular-cascader.mjs +1839 -0
- package/fesm2022/slotted-angular-cascader.mjs.map +1 -0
- package/fesm2022/slotted-angular-chart.mjs +974 -0
- package/fesm2022/slotted-angular-chart.mjs.map +1 -0
- package/fesm2022/slotted-angular-checkbox-group.mjs +283 -0
- package/fesm2022/slotted-angular-checkbox-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-checkbox.mjs +468 -0
- package/fesm2022/slotted-angular-checkbox.mjs.map +1 -0
- package/fesm2022/slotted-angular-code-block.mjs +476 -0
- package/fesm2022/slotted-angular-code-block.mjs.map +1 -0
- package/fesm2022/slotted-angular-collapsible.mjs +479 -0
- package/fesm2022/slotted-angular-collapsible.mjs.map +1 -0
- package/fesm2022/slotted-angular-color-picker.mjs +910 -0
- package/fesm2022/slotted-angular-color-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-column-manager.mjs +1037 -0
- package/fesm2022/slotted-angular-column-manager.mjs.map +1 -0
- package/fesm2022/slotted-angular-combobox.mjs +1480 -0
- package/fesm2022/slotted-angular-combobox.mjs.map +1 -0
- package/fesm2022/slotted-angular-command-palette.mjs +1283 -0
- package/fesm2022/slotted-angular-command-palette.mjs.map +1 -0
- package/fesm2022/slotted-angular-container.mjs +105 -0
- package/fesm2022/slotted-angular-container.mjs.map +1 -0
- package/fesm2022/slotted-angular-context-menu.mjs +221 -0
- package/fesm2022/slotted-angular-context-menu.mjs.map +1 -0
- package/fesm2022/slotted-angular-currency-field.mjs +1131 -0
- package/fesm2022/slotted-angular-currency-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-dashboard-grid.mjs +1928 -0
- package/fesm2022/slotted-angular-dashboard-grid.mjs.map +1 -0
- package/fesm2022/slotted-angular-data-grid.mjs +6697 -0
- package/fesm2022/slotted-angular-data-grid.mjs.map +1 -0
- package/fesm2022/slotted-angular-data-list.mjs +1418 -0
- package/fesm2022/slotted-angular-data-list.mjs.map +1 -0
- package/fesm2022/slotted-angular-date-field.mjs +772 -0
- package/fesm2022/slotted-angular-date-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-date-picker.mjs +690 -0
- package/fesm2022/slotted-angular-date-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-date-range-picker.mjs +1150 -0
- package/fesm2022/slotted-angular-date-range-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-datetime-field.mjs +1058 -0
- package/fesm2022/slotted-angular-datetime-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-datetime-picker.mjs +1362 -0
- package/fesm2022/slotted-angular-datetime-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-datetime-range-picker.mjs +1872 -0
- package/fesm2022/slotted-angular-datetime-range-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-description-list.mjs +545 -0
- package/fesm2022/slotted-angular-description-list.mjs.map +1 -0
- package/fesm2022/slotted-angular-detail-panel.mjs +754 -0
- package/fesm2022/slotted-angular-detail-panel.mjs.map +1 -0
- package/fesm2022/slotted-angular-dialog.mjs +980 -0
- package/fesm2022/slotted-angular-dialog.mjs.map +1 -0
- package/fesm2022/slotted-angular-divider.mjs +76 -0
- package/fesm2022/slotted-angular-divider.mjs.map +1 -0
- package/fesm2022/slotted-angular-drawer.mjs +1397 -0
- package/fesm2022/slotted-angular-drawer.mjs.map +1 -0
- package/fesm2022/slotted-angular-entity-picker.mjs +1987 -0
- package/fesm2022/slotted-angular-entity-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-event-calendar.mjs +2934 -0
- package/fesm2022/slotted-angular-event-calendar.mjs.map +1 -0
- package/fesm2022/slotted-angular-field-group.mjs +301 -0
- package/fesm2022/slotted-angular-field-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-field.mjs +928 -0
- package/fesm2022/slotted-angular-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-filter-bar.mjs +3107 -0
- package/fesm2022/slotted-angular-filter-bar.mjs.map +1 -0
- package/fesm2022/slotted-angular-form.mjs +592 -0
- package/fesm2022/slotted-angular-form.mjs.map +1 -0
- package/fesm2022/slotted-angular-fullscreen.mjs +314 -0
- package/fesm2022/slotted-angular-fullscreen.mjs.map +1 -0
- package/fesm2022/slotted-angular-grid.mjs +58 -0
- package/fesm2022/slotted-angular-grid.mjs.map +1 -0
- package/fesm2022/slotted-angular-highlight.mjs +123 -0
- package/fesm2022/slotted-angular-highlight.mjs.map +1 -0
- package/fesm2022/slotted-angular-hover-card.mjs +326 -0
- package/fesm2022/slotted-angular-hover-card.mjs.map +1 -0
- package/fesm2022/slotted-angular-i18n.mjs +75 -0
- package/fesm2022/slotted-angular-i18n.mjs.map +1 -0
- package/fesm2022/slotted-angular-icon.mjs +232 -0
- package/fesm2022/slotted-angular-icon.mjs.map +1 -0
- package/fesm2022/slotted-angular-image.mjs +442 -0
- package/fesm2022/slotted-angular-image.mjs.map +1 -0
- package/fesm2022/slotted-angular-import-export-center.mjs +1792 -0
- package/fesm2022/slotted-angular-import-export-center.mjs.map +1 -0
- package/fesm2022/slotted-angular-inline-message.mjs +280 -0
- package/fesm2022/slotted-angular-inline-message.mjs.map +1 -0
- package/fesm2022/slotted-angular-inline.mjs +52 -0
- package/fesm2022/slotted-angular-inline.mjs.map +1 -0
- package/fesm2022/slotted-angular-kbd.mjs +284 -0
- package/fesm2022/slotted-angular-kbd.mjs.map +1 -0
- package/fesm2022/slotted-angular-link.mjs +182 -0
- package/fesm2022/slotted-angular-link.mjs.map +1 -0
- package/fesm2022/slotted-angular-list-item.mjs +367 -0
- package/fesm2022/slotted-angular-list-item.mjs.map +1 -0
- package/fesm2022/slotted-angular-list.mjs +256 -0
- package/fesm2022/slotted-angular-list.mjs.map +1 -0
- package/fesm2022/slotted-angular-listbox.mjs +1274 -0
- package/fesm2022/slotted-angular-listbox.mjs.map +1 -0
- package/fesm2022/slotted-angular-loading-overlay.mjs +451 -0
- package/fesm2022/slotted-angular-loading-overlay.mjs.map +1 -0
- package/fesm2022/slotted-angular-markdown.mjs +914 -0
- package/fesm2022/slotted-angular-markdown.mjs.map +1 -0
- package/fesm2022/slotted-angular-menu.mjs +1211 -0
- package/fesm2022/slotted-angular-menu.mjs.map +1 -0
- package/fesm2022/slotted-angular-menubar.mjs +230 -0
- package/fesm2022/slotted-angular-menubar.mjs.map +1 -0
- package/fesm2022/slotted-angular-message-scroller.mjs +378 -0
- package/fesm2022/slotted-angular-message-scroller.mjs.map +1 -0
- package/fesm2022/slotted-angular-message.mjs +866 -0
- package/fesm2022/slotted-angular-message.mjs.map +1 -0
- package/fesm2022/slotted-angular-multi-select.mjs +1939 -0
- package/fesm2022/slotted-angular-multi-select.mjs.map +1 -0
- package/fesm2022/slotted-angular-navigation-menu.mjs +770 -0
- package/fesm2022/slotted-angular-navigation-menu.mjs.map +1 -0
- package/fesm2022/slotted-angular-notification-center.mjs +1172 -0
- package/fesm2022/slotted-angular-notification-center.mjs.map +1 -0
- package/fesm2022/slotted-angular-number-field.mjs +966 -0
- package/fesm2022/slotted-angular-number-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-otp-input.mjs +629 -0
- package/fesm2022/slotted-angular-otp-input.mjs.map +1 -0
- package/fesm2022/slotted-angular-page-header.mjs +788 -0
- package/fesm2022/slotted-angular-page-header.mjs.map +1 -0
- package/fesm2022/slotted-angular-page.mjs +255 -0
- package/fesm2022/slotted-angular-page.mjs.map +1 -0
- package/fesm2022/slotted-angular-pagination.mjs +562 -0
- package/fesm2022/slotted-angular-pagination.mjs.map +1 -0
- package/fesm2022/slotted-angular-popover.mjs +799 -0
- package/fesm2022/slotted-angular-popover.mjs.map +1 -0
- package/fesm2022/slotted-angular-progress-indicator.mjs +572 -0
- package/fesm2022/slotted-angular-progress-indicator.mjs.map +1 -0
- package/fesm2022/slotted-angular-prompt-composer.mjs +596 -0
- package/fesm2022/slotted-angular-prompt-composer.mjs.map +1 -0
- package/fesm2022/slotted-angular-prose.mjs +314 -0
- package/fesm2022/slotted-angular-prose.mjs.map +1 -0
- package/fesm2022/slotted-angular-radio-group.mjs +469 -0
- package/fesm2022/slotted-angular-radio-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-rating.mjs +1174 -0
- package/fesm2022/slotted-angular-rating.mjs.map +1 -0
- package/fesm2022/slotted-angular-result-state.mjs +330 -0
- package/fesm2022/slotted-angular-result-state.mjs.map +1 -0
- package/fesm2022/slotted-angular-saved-views.mjs +877 -0
- package/fesm2022/slotted-angular-saved-views.mjs.map +1 -0
- package/fesm2022/slotted-angular-scroll-area.mjs +294 -0
- package/fesm2022/slotted-angular-scroll-area.mjs.map +1 -0
- package/fesm2022/slotted-angular-section.mjs +266 -0
- package/fesm2022/slotted-angular-section.mjs.map +1 -0
- package/fesm2022/slotted-angular-segmented-control.mjs +454 -0
- package/fesm2022/slotted-angular-segmented-control.mjs.map +1 -0
- package/fesm2022/slotted-angular-select.mjs +1899 -0
- package/fesm2022/slotted-angular-select.mjs.map +1 -0
- package/fesm2022/slotted-angular-side-navigation.mjs +1042 -0
- package/fesm2022/slotted-angular-side-navigation.mjs.map +1 -0
- package/fesm2022/slotted-angular-skeleton.mjs +316 -0
- package/fesm2022/slotted-angular-skeleton.mjs.map +1 -0
- package/fesm2022/slotted-angular-slider.mjs +586 -0
- package/fesm2022/slotted-angular-slider.mjs.map +1 -0
- package/fesm2022/slotted-angular-sparkline.mjs +235 -0
- package/fesm2022/slotted-angular-sparkline.mjs.map +1 -0
- package/fesm2022/slotted-angular-split-button.mjs +331 -0
- package/fesm2022/slotted-angular-split-button.mjs.map +1 -0
- package/fesm2022/slotted-angular-splitter.mjs +516 -0
- package/fesm2022/slotted-angular-splitter.mjs.map +1 -0
- package/fesm2022/slotted-angular-stack.mjs +48 -0
- package/fesm2022/slotted-angular-stack.mjs.map +1 -0
- package/fesm2022/slotted-angular-stat-card.mjs +478 -0
- package/fesm2022/slotted-angular-stat-card.mjs.map +1 -0
- package/fesm2022/slotted-angular-status-indicator.mjs +155 -0
- package/fesm2022/slotted-angular-status-indicator.mjs.map +1 -0
- package/fesm2022/slotted-angular-stepper.mjs +536 -0
- package/fesm2022/slotted-angular-stepper.mjs.map +1 -0
- package/fesm2022/slotted-angular-switch.mjs +447 -0
- package/fesm2022/slotted-angular-switch.mjs.map +1 -0
- package/fesm2022/slotted-angular-table-of-contents.mjs +750 -0
- package/fesm2022/slotted-angular-table-of-contents.mjs.map +1 -0
- package/fesm2022/slotted-angular-table.mjs +2518 -0
- package/fesm2022/slotted-angular-table.mjs.map +1 -0
- package/fesm2022/slotted-angular-tabs.mjs +829 -0
- package/fesm2022/slotted-angular-tabs.mjs.map +1 -0
- package/fesm2022/slotted-angular-tag.mjs +595 -0
- package/fesm2022/slotted-angular-tag.mjs.map +1 -0
- package/fesm2022/slotted-angular-tags-input.mjs +1211 -0
- package/fesm2022/slotted-angular-tags-input.mjs.map +1 -0
- package/fesm2022/slotted-angular-text-field.mjs +674 -0
- package/fesm2022/slotted-angular-text-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-textarea.mjs +275 -0
- package/fesm2022/slotted-angular-textarea.mjs.map +1 -0
- package/fesm2022/slotted-angular-theme.mjs +45 -0
- package/fesm2022/slotted-angular-theme.mjs.map +1 -0
- package/fesm2022/slotted-angular-time-field.mjs +895 -0
- package/fesm2022/slotted-angular-time-field.mjs.map +1 -0
- package/fesm2022/slotted-angular-time-picker.mjs +856 -0
- package/fesm2022/slotted-angular-time-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-time-range-picker.mjs +1534 -0
- package/fesm2022/slotted-angular-time-range-picker.mjs.map +1 -0
- package/fesm2022/slotted-angular-timeline.mjs +928 -0
- package/fesm2022/slotted-angular-timeline.mjs.map +1 -0
- package/fesm2022/slotted-angular-toast.mjs +917 -0
- package/fesm2022/slotted-angular-toast.mjs.map +1 -0
- package/fesm2022/slotted-angular-toggle-group.mjs +311 -0
- package/fesm2022/slotted-angular-toggle-group.mjs.map +1 -0
- package/fesm2022/slotted-angular-toggle.mjs +162 -0
- package/fesm2022/slotted-angular-toggle.mjs.map +1 -0
- package/fesm2022/slotted-angular-toolbar.mjs +536 -0
- package/fesm2022/slotted-angular-toolbar.mjs.map +1 -0
- package/fesm2022/slotted-angular-tooltip.mjs +798 -0
- package/fesm2022/slotted-angular-tooltip.mjs.map +1 -0
- package/fesm2022/slotted-angular-top-navigation.mjs +1308 -0
- package/fesm2022/slotted-angular-top-navigation.mjs.map +1 -0
- package/fesm2022/slotted-angular-tour.mjs +1330 -0
- package/fesm2022/slotted-angular-tour.mjs.map +1 -0
- package/fesm2022/slotted-angular-transfer.mjs +1406 -0
- package/fesm2022/slotted-angular-transfer.mjs.map +1 -0
- package/fesm2022/slotted-angular-tree.mjs +1448 -0
- package/fesm2022/slotted-angular-tree.mjs.map +1 -0
- package/fesm2022/slotted-angular-typography.mjs +184 -0
- package/fesm2022/slotted-angular-typography.mjs.map +1 -0
- package/fesm2022/slotted-angular-upload.mjs +1523 -0
- package/fesm2022/slotted-angular-upload.mjs.map +1 -0
- package/fesm2022/slotted-angular-visually-hidden.mjs +32 -0
- package/fesm2022/slotted-angular-visually-hidden.mjs.map +1 -0
- package/fesm2022/slotted-angular-wizard.mjs +1715 -0
- package/fesm2022/slotted-angular-wizard.mjs.map +1 -0
- package/fesm2022/slotted-angular.mjs +4 -0
- package/fesm2022/slotted-angular.mjs.map +1 -0
- package/package.json +537 -3
- package/types/slotted-angular-accordion.d.ts +156 -0
- package/types/slotted-angular-accordion.d.ts.map +1 -0
- package/types/slotted-angular-action-bar.d.ts +291 -0
- package/types/slotted-angular-action-bar.d.ts.map +1 -0
- package/types/slotted-angular-action-sheet.d.ts +294 -0
- package/types/slotted-angular-action-sheet.d.ts.map +1 -0
- package/types/slotted-angular-alert.d.ts +214 -0
- package/types/slotted-angular-alert.d.ts.map +1 -0
- package/types/slotted-angular-app-shell.d.ts +549 -0
- package/types/slotted-angular-app-shell.d.ts.map +1 -0
- package/types/slotted-angular-aspect-ratio.d.ts +57 -0
- package/types/slotted-angular-aspect-ratio.d.ts.map +1 -0
- package/types/slotted-angular-attachment.d.ts +294 -0
- package/types/slotted-angular-attachment.d.ts.map +1 -0
- package/types/slotted-angular-avatar-group.d.ts +119 -0
- package/types/slotted-angular-avatar-group.d.ts.map +1 -0
- package/types/slotted-angular-avatar.d.ts +202 -0
- package/types/slotted-angular-avatar.d.ts.map +1 -0
- package/types/slotted-angular-badge.d.ts +166 -0
- package/types/slotted-angular-badge.d.ts.map +1 -0
- package/types/slotted-angular-breadcrumb.d.ts +251 -0
- package/types/slotted-angular-breadcrumb.d.ts.map +1 -0
- package/types/slotted-angular-button-group.d.ts +89 -0
- package/types/slotted-angular-button-group.d.ts.map +1 -0
- package/types/slotted-angular-button.d.ts +390 -0
- package/types/slotted-angular-button.d.ts.map +1 -0
- package/types/slotted-angular-calendar.d.ts +280 -0
- package/types/slotted-angular-calendar.d.ts.map +1 -0
- package/types/slotted-angular-card.d.ts +140 -0
- package/types/slotted-angular-card.d.ts.map +1 -0
- package/types/slotted-angular-carousel.d.ts +288 -0
- package/types/slotted-angular-carousel.d.ts.map +1 -0
- package/types/slotted-angular-cascader.d.ts +351 -0
- package/types/slotted-angular-cascader.d.ts.map +1 -0
- package/types/slotted-angular-chart.d.ts +319 -0
- package/types/slotted-angular-chart.d.ts.map +1 -0
- package/types/slotted-angular-checkbox-group.d.ts +156 -0
- package/types/slotted-angular-checkbox-group.d.ts.map +1 -0
- package/types/slotted-angular-checkbox.d.ts +197 -0
- package/types/slotted-angular-checkbox.d.ts.map +1 -0
- package/types/slotted-angular-code-block.d.ts +158 -0
- package/types/slotted-angular-code-block.d.ts.map +1 -0
- package/types/slotted-angular-collapsible.d.ts +272 -0
- package/types/slotted-angular-collapsible.d.ts.map +1 -0
- package/types/slotted-angular-color-picker.d.ts +181 -0
- package/types/slotted-angular-color-picker.d.ts.map +1 -0
- package/types/slotted-angular-column-manager.d.ts +200 -0
- package/types/slotted-angular-column-manager.d.ts.map +1 -0
- package/types/slotted-angular-combobox.d.ts +449 -0
- package/types/slotted-angular-combobox.d.ts.map +1 -0
- package/types/slotted-angular-command-palette.d.ts +256 -0
- package/types/slotted-angular-command-palette.d.ts.map +1 -0
- package/types/slotted-angular-container.d.ts +84 -0
- package/types/slotted-angular-container.d.ts.map +1 -0
- package/types/slotted-angular-context-menu.d.ts +84 -0
- package/types/slotted-angular-context-menu.d.ts.map +1 -0
- package/types/slotted-angular-currency-field.d.ts +480 -0
- package/types/slotted-angular-currency-field.d.ts.map +1 -0
- package/types/slotted-angular-dashboard-grid.d.ts +341 -0
- package/types/slotted-angular-dashboard-grid.d.ts.map +1 -0
- package/types/slotted-angular-data-grid.d.ts +1077 -0
- package/types/slotted-angular-data-grid.d.ts.map +1 -0
- package/types/slotted-angular-data-list.d.ts +272 -0
- package/types/slotted-angular-data-list.d.ts.map +1 -0
- package/types/slotted-angular-date-field.d.ts +320 -0
- package/types/slotted-angular-date-field.d.ts.map +1 -0
- package/types/slotted-angular-date-picker.d.ts +224 -0
- package/types/slotted-angular-date-picker.d.ts.map +1 -0
- package/types/slotted-angular-date-range-picker.d.ts +310 -0
- package/types/slotted-angular-date-range-picker.d.ts.map +1 -0
- package/types/slotted-angular-datetime-field.d.ts +362 -0
- package/types/slotted-angular-datetime-field.d.ts.map +1 -0
- package/types/slotted-angular-datetime-picker.d.ts +370 -0
- package/types/slotted-angular-datetime-picker.d.ts.map +1 -0
- package/types/slotted-angular-datetime-range-picker.d.ts +459 -0
- package/types/slotted-angular-datetime-range-picker.d.ts.map +1 -0
- package/types/slotted-angular-description-list.d.ts +281 -0
- package/types/slotted-angular-description-list.d.ts.map +1 -0
- package/types/slotted-angular-detail-panel.d.ts +240 -0
- package/types/slotted-angular-detail-panel.d.ts.map +1 -0
- package/types/slotted-angular-dialog.d.ts +497 -0
- package/types/slotted-angular-dialog.d.ts.map +1 -0
- package/types/slotted-angular-divider.d.ts +40 -0
- package/types/slotted-angular-divider.d.ts.map +1 -0
- package/types/slotted-angular-drawer.d.ts +532 -0
- package/types/slotted-angular-drawer.d.ts.map +1 -0
- package/types/slotted-angular-entity-picker.d.ts +338 -0
- package/types/slotted-angular-entity-picker.d.ts.map +1 -0
- package/types/slotted-angular-event-calendar.d.ts +574 -0
- package/types/slotted-angular-event-calendar.d.ts.map +1 -0
- package/types/slotted-angular-field-group.d.ts +152 -0
- package/types/slotted-angular-field-group.d.ts.map +1 -0
- package/types/slotted-angular-field.d.ts +535 -0
- package/types/slotted-angular-field.d.ts.map +1 -0
- package/types/slotted-angular-filter-bar.d.ts +573 -0
- package/types/slotted-angular-filter-bar.d.ts.map +1 -0
- package/types/slotted-angular-form.d.ts +298 -0
- package/types/slotted-angular-form.d.ts.map +1 -0
- package/types/slotted-angular-fullscreen.d.ts +145 -0
- package/types/slotted-angular-fullscreen.d.ts.map +1 -0
- package/types/slotted-angular-grid.d.ts +50 -0
- package/types/slotted-angular-grid.d.ts.map +1 -0
- package/types/slotted-angular-highlight.d.ts +93 -0
- package/types/slotted-angular-highlight.d.ts.map +1 -0
- package/types/slotted-angular-hover-card.d.ts +140 -0
- package/types/slotted-angular-hover-card.d.ts.map +1 -0
- package/types/slotted-angular-i18n.d.ts +46 -0
- package/types/slotted-angular-i18n.d.ts.map +1 -0
- package/types/slotted-angular-icon.d.ts +94 -0
- package/types/slotted-angular-icon.d.ts.map +1 -0
- package/types/slotted-angular-image.d.ts +251 -0
- package/types/slotted-angular-image.d.ts.map +1 -0
- package/types/slotted-angular-import-export-center.d.ts +351 -0
- package/types/slotted-angular-import-export-center.d.ts.map +1 -0
- package/types/slotted-angular-inline-message.d.ts +195 -0
- package/types/slotted-angular-inline-message.d.ts.map +1 -0
- package/types/slotted-angular-inline.d.ts +41 -0
- package/types/slotted-angular-inline.d.ts.map +1 -0
- package/types/slotted-angular-kbd.d.ts +174 -0
- package/types/slotted-angular-kbd.d.ts.map +1 -0
- package/types/slotted-angular-link.d.ts +94 -0
- package/types/slotted-angular-link.d.ts.map +1 -0
- package/types/slotted-angular-list-item.d.ts +210 -0
- package/types/slotted-angular-list-item.d.ts.map +1 -0
- package/types/slotted-angular-list.d.ts +176 -0
- package/types/slotted-angular-list.d.ts.map +1 -0
- package/types/slotted-angular-listbox.d.ts +470 -0
- package/types/slotted-angular-listbox.d.ts.map +1 -0
- package/types/slotted-angular-loading-overlay.d.ts +219 -0
- package/types/slotted-angular-loading-overlay.d.ts.map +1 -0
- package/types/slotted-angular-markdown.d.ts +172 -0
- package/types/slotted-angular-markdown.d.ts.map +1 -0
- package/types/slotted-angular-menu.d.ts +448 -0
- package/types/slotted-angular-menu.d.ts.map +1 -0
- package/types/slotted-angular-menubar.d.ts +90 -0
- package/types/slotted-angular-menubar.d.ts.map +1 -0
- package/types/slotted-angular-message-scroller.d.ts +151 -0
- package/types/slotted-angular-message-scroller.d.ts.map +1 -0
- package/types/slotted-angular-message.d.ts +348 -0
- package/types/slotted-angular-message.d.ts.map +1 -0
- package/types/slotted-angular-multi-select.d.ts +462 -0
- package/types/slotted-angular-multi-select.d.ts.map +1 -0
- package/types/slotted-angular-navigation-menu.d.ts +309 -0
- package/types/slotted-angular-navigation-menu.d.ts.map +1 -0
- package/types/slotted-angular-notification-center.d.ts +318 -0
- package/types/slotted-angular-notification-center.d.ts.map +1 -0
- package/types/slotted-angular-number-field.d.ts +402 -0
- package/types/slotted-angular-number-field.d.ts.map +1 -0
- package/types/slotted-angular-otp-input.d.ts +286 -0
- package/types/slotted-angular-otp-input.d.ts.map +1 -0
- package/types/slotted-angular-page-header.d.ts +334 -0
- package/types/slotted-angular-page-header.d.ts.map +1 -0
- package/types/slotted-angular-page.d.ts +141 -0
- package/types/slotted-angular-page.d.ts.map +1 -0
- package/types/slotted-angular-pagination.d.ts +213 -0
- package/types/slotted-angular-pagination.d.ts.map +1 -0
- package/types/slotted-angular-popover.d.ts +366 -0
- package/types/slotted-angular-popover.d.ts.map +1 -0
- package/types/slotted-angular-progress-indicator.d.ts +312 -0
- package/types/slotted-angular-progress-indicator.d.ts.map +1 -0
- package/types/slotted-angular-prompt-composer.d.ts +242 -0
- package/types/slotted-angular-prompt-composer.d.ts.map +1 -0
- package/types/slotted-angular-prose.d.ts +171 -0
- package/types/slotted-angular-prose.d.ts.map +1 -0
- package/types/slotted-angular-radio-group.d.ts +268 -0
- package/types/slotted-angular-radio-group.d.ts.map +1 -0
- package/types/slotted-angular-rating.d.ts +374 -0
- package/types/slotted-angular-rating.d.ts.map +1 -0
- package/types/slotted-angular-result-state.d.ts +217 -0
- package/types/slotted-angular-result-state.d.ts.map +1 -0
- package/types/slotted-angular-saved-views.d.ts +198 -0
- package/types/slotted-angular-saved-views.d.ts.map +1 -0
- package/types/slotted-angular-scroll-area.d.ts +186 -0
- package/types/slotted-angular-scroll-area.d.ts.map +1 -0
- package/types/slotted-angular-section.d.ts +143 -0
- package/types/slotted-angular-section.d.ts.map +1 -0
- package/types/slotted-angular-segmented-control.d.ts +251 -0
- package/types/slotted-angular-segmented-control.d.ts.map +1 -0
- package/types/slotted-angular-select.d.ts +507 -0
- package/types/slotted-angular-select.d.ts.map +1 -0
- package/types/slotted-angular-side-navigation.d.ts +373 -0
- package/types/slotted-angular-side-navigation.d.ts.map +1 -0
- package/types/slotted-angular-skeleton.d.ts +198 -0
- package/types/slotted-angular-skeleton.d.ts.map +1 -0
- package/types/slotted-angular-slider.d.ts +216 -0
- package/types/slotted-angular-slider.d.ts.map +1 -0
- package/types/slotted-angular-sparkline.d.ts +106 -0
- package/types/slotted-angular-sparkline.d.ts.map +1 -0
- package/types/slotted-angular-split-button.d.ts +180 -0
- package/types/slotted-angular-split-button.d.ts.map +1 -0
- package/types/slotted-angular-splitter.d.ts +206 -0
- package/types/slotted-angular-splitter.d.ts.map +1 -0
- package/types/slotted-angular-stack.d.ts +38 -0
- package/types/slotted-angular-stack.d.ts.map +1 -0
- package/types/slotted-angular-stat-card.d.ts +232 -0
- package/types/slotted-angular-stat-card.d.ts.map +1 -0
- package/types/slotted-angular-status-indicator.d.ts +106 -0
- package/types/slotted-angular-status-indicator.d.ts.map +1 -0
- package/types/slotted-angular-stepper.d.ts +198 -0
- package/types/slotted-angular-stepper.d.ts.map +1 -0
- package/types/slotted-angular-switch.d.ts +243 -0
- package/types/slotted-angular-switch.d.ts.map +1 -0
- package/types/slotted-angular-table-of-contents.d.ts +210 -0
- package/types/slotted-angular-table-of-contents.d.ts.map +1 -0
- package/types/slotted-angular-table.d.ts +888 -0
- package/types/slotted-angular-table.d.ts.map +1 -0
- package/types/slotted-angular-tabs.d.ts +340 -0
- package/types/slotted-angular-tabs.d.ts.map +1 -0
- package/types/slotted-angular-tag.d.ts +279 -0
- package/types/slotted-angular-tag.d.ts.map +1 -0
- package/types/slotted-angular-tags-input.d.ts +302 -0
- package/types/slotted-angular-tags-input.d.ts.map +1 -0
- package/types/slotted-angular-text-field.d.ts +334 -0
- package/types/slotted-angular-text-field.d.ts.map +1 -0
- package/types/slotted-angular-textarea.d.ts +150 -0
- package/types/slotted-angular-textarea.d.ts.map +1 -0
- package/types/slotted-angular-theme.d.ts +26 -0
- package/types/slotted-angular-theme.d.ts.map +1 -0
- package/types/slotted-angular-time-field.d.ts +300 -0
- package/types/slotted-angular-time-field.d.ts.map +1 -0
- package/types/slotted-angular-time-picker.d.ts +260 -0
- package/types/slotted-angular-time-picker.d.ts.map +1 -0
- package/types/slotted-angular-time-range-picker.d.ts +401 -0
- package/types/slotted-angular-time-range-picker.d.ts.map +1 -0
- package/types/slotted-angular-timeline.d.ts +329 -0
- package/types/slotted-angular-timeline.d.ts.map +1 -0
- package/types/slotted-angular-toast.d.ts +340 -0
- package/types/slotted-angular-toast.d.ts.map +1 -0
- package/types/slotted-angular-toggle-group.d.ts +167 -0
- package/types/slotted-angular-toggle-group.d.ts.map +1 -0
- package/types/slotted-angular-toggle.d.ts +106 -0
- package/types/slotted-angular-toggle.d.ts.map +1 -0
- package/types/slotted-angular-toolbar.d.ts +252 -0
- package/types/slotted-angular-toolbar.d.ts.map +1 -0
- package/types/slotted-angular-tooltip.d.ts +388 -0
- package/types/slotted-angular-tooltip.d.ts.map +1 -0
- package/types/slotted-angular-top-navigation.d.ts +442 -0
- package/types/slotted-angular-top-navigation.d.ts.map +1 -0
- package/types/slotted-angular-tour.d.ts +440 -0
- package/types/slotted-angular-tour.d.ts.map +1 -0
- package/types/slotted-angular-transfer.d.ts +296 -0
- package/types/slotted-angular-transfer.d.ts.map +1 -0
- package/types/slotted-angular-tree.d.ts +499 -0
- package/types/slotted-angular-tree.d.ts.map +1 -0
- package/types/slotted-angular-typography.d.ts +89 -0
- package/types/slotted-angular-typography.d.ts.map +1 -0
- package/types/slotted-angular-upload.d.ts +365 -0
- package/types/slotted-angular-upload.d.ts.map +1 -0
- package/types/slotted-angular-visually-hidden.d.ts +19 -0
- package/types/slotted-angular-visually-hidden.d.ts.map +1 -0
- package/types/slotted-angular-wizard.d.ts +441 -0
- package/types/slotted-angular-wizard.d.ts.map +1 -0
- package/types/slotted-angular.d.ts +3 -0
- package/types/slotted-angular.d.ts.map +1 -0
|
@@ -0,0 +1,3064 @@
|
|
|
1
|
+
<!-- index: ./index.md -->
|
|
2
|
+
# data-grid
|
|
3
|
+
|
|
4
|
+
`data-ui="data-grid"` · Table that sorts, filters and selects records.
|
|
5
|
+
|
|
6
|
+
## Examples
|
|
7
|
+
|
|
8
|
+
### Playground
|
|
9
|
+
|
|
10
|
+
Every capability on one listing of shipments: sort with a press and Shift, filter from the funnel or the row, select with the checkboxes, edit a cell with Enter, pin and resize from the header. The toolbar switches scheme, density and direction.
|
|
11
|
+
|
|
12
|
+
Excerpt — not a complete module
|
|
13
|
+
|
|
14
|
+
```html
|
|
15
|
+
<sl-data-grid
|
|
16
|
+
aria-label="Shipments"
|
|
17
|
+
rowKey="id"
|
|
18
|
+
height="100%"
|
|
19
|
+
selectionMode="multiple"
|
|
20
|
+
[rows]="shipments()"
|
|
21
|
+
[columns]="columns"
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Columns
|
|
26
|
+
|
|
27
|
+
Each column declares its kind, and the kind decides the comparator, the operators, the editor and the alignment: a number column sits its digits at the end in tabular figures, a date column formats the ISO day in the reader’s locale, a set column names its values.
|
|
28
|
+
|
|
29
|
+
Example
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { Component } from '@angular/core';
|
|
33
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
34
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
35
|
+
|
|
36
|
+
interface Shipment {
|
|
37
|
+
id: string;
|
|
38
|
+
customer: string;
|
|
39
|
+
destination: string;
|
|
40
|
+
carrier: string;
|
|
41
|
+
status: string;
|
|
42
|
+
shipped: string;
|
|
43
|
+
weight: number;
|
|
44
|
+
cost: number;
|
|
45
|
+
priority: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const CUSTOMERS = [
|
|
49
|
+
'Alfreds Futterkiste',
|
|
50
|
+
"Bon app'",
|
|
51
|
+
'Ernst Handel',
|
|
52
|
+
'Folk och fä HB',
|
|
53
|
+
'Hanari Carnes',
|
|
54
|
+
'Island Trading',
|
|
55
|
+
'QUICK-Stop',
|
|
56
|
+
'Wartian Herkku',
|
|
57
|
+
];
|
|
58
|
+
const DESTINATIONS = [
|
|
59
|
+
'Berlin, DE',
|
|
60
|
+
'Marseille, FR',
|
|
61
|
+
'Graz, AT',
|
|
62
|
+
'Bräcke, SE',
|
|
63
|
+
'Rio de Janeiro, BR',
|
|
64
|
+
'Cowes, UK',
|
|
65
|
+
'Boise, US',
|
|
66
|
+
'Oulu, FI',
|
|
67
|
+
];
|
|
68
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
69
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
70
|
+
|
|
71
|
+
function shipments(count: number): Shipment[] {
|
|
72
|
+
let seed = 7;
|
|
73
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
74
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
75
|
+
return Array.from({ length: count }, (_, index) => {
|
|
76
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
77
|
+
return {
|
|
78
|
+
id: `SH-${3301 + index}`,
|
|
79
|
+
customer: pick(CUSTOMERS),
|
|
80
|
+
destination: pick(DESTINATIONS),
|
|
81
|
+
carrier: pick(CARRIERS),
|
|
82
|
+
status: pick(STATUSES),
|
|
83
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
84
|
+
weight,
|
|
85
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
86
|
+
priority: next() < 0.3,
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
92
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
93
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
94
|
+
|
|
95
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
96
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
97
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
98
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
99
|
+
{
|
|
100
|
+
id: 'carrier',
|
|
101
|
+
label: 'Carrier',
|
|
102
|
+
accessor: 'carrier',
|
|
103
|
+
kind: 'set',
|
|
104
|
+
width: 110,
|
|
105
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: 'status',
|
|
109
|
+
label: 'Status',
|
|
110
|
+
accessor: 'status',
|
|
111
|
+
kind: 'set',
|
|
112
|
+
width: 120,
|
|
113
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
114
|
+
},
|
|
115
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
116
|
+
{
|
|
117
|
+
id: 'weight',
|
|
118
|
+
label: 'Weight',
|
|
119
|
+
accessor: 'weight',
|
|
120
|
+
kind: 'number',
|
|
121
|
+
width: 110,
|
|
122
|
+
format: kilograms,
|
|
123
|
+
},
|
|
124
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
const ROWS = shipments(8);
|
|
128
|
+
|
|
129
|
+
@Component({
|
|
130
|
+
selector: 'app-data-grid-columns',
|
|
131
|
+
imports: [SlDataGrid],
|
|
132
|
+
template: `
|
|
133
|
+
<sl-data-grid
|
|
134
|
+
aria-label="Shipments"
|
|
135
|
+
rowKey="id"
|
|
136
|
+
height="22rem"
|
|
137
|
+
[columns]="columns"
|
|
138
|
+
[rows]="rows"
|
|
139
|
+
></sl-data-grid>
|
|
140
|
+
`,
|
|
141
|
+
})
|
|
142
|
+
export class DataGridColumns {
|
|
143
|
+
readonly rows = ROWS;
|
|
144
|
+
readonly columns = COLUMNS;
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Column groups
|
|
149
|
+
|
|
150
|
+
A second header row above the columns: each group spans the columns it names, wherever the reader has laid them out, and a column no group names spans itself.
|
|
151
|
+
|
|
152
|
+
Example
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
import { Component } from '@angular/core';
|
|
156
|
+
import type { GridColumn, GridColumnGroup } from '@slotted/core/grid';
|
|
157
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
158
|
+
|
|
159
|
+
interface Shipment {
|
|
160
|
+
id: string;
|
|
161
|
+
customer: string;
|
|
162
|
+
destination: string;
|
|
163
|
+
carrier: string;
|
|
164
|
+
status: string;
|
|
165
|
+
shipped: string;
|
|
166
|
+
weight: number;
|
|
167
|
+
cost: number;
|
|
168
|
+
priority: boolean;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const CUSTOMERS = [
|
|
172
|
+
'Alfreds Futterkiste',
|
|
173
|
+
"Bon app'",
|
|
174
|
+
'Ernst Handel',
|
|
175
|
+
'Folk och fä HB',
|
|
176
|
+
'Hanari Carnes',
|
|
177
|
+
'Island Trading',
|
|
178
|
+
'QUICK-Stop',
|
|
179
|
+
'Wartian Herkku',
|
|
180
|
+
];
|
|
181
|
+
const DESTINATIONS = [
|
|
182
|
+
'Berlin, DE',
|
|
183
|
+
'Marseille, FR',
|
|
184
|
+
'Graz, AT',
|
|
185
|
+
'Bräcke, SE',
|
|
186
|
+
'Rio de Janeiro, BR',
|
|
187
|
+
'Cowes, UK',
|
|
188
|
+
'Boise, US',
|
|
189
|
+
'Oulu, FI',
|
|
190
|
+
];
|
|
191
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
192
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
193
|
+
|
|
194
|
+
function shipments(count: number): Shipment[] {
|
|
195
|
+
let seed = 7;
|
|
196
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
197
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
198
|
+
return Array.from({ length: count }, (_, index) => {
|
|
199
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
200
|
+
return {
|
|
201
|
+
id: `SH-${3301 + index}`,
|
|
202
|
+
customer: pick(CUSTOMERS),
|
|
203
|
+
destination: pick(DESTINATIONS),
|
|
204
|
+
carrier: pick(CARRIERS),
|
|
205
|
+
status: pick(STATUSES),
|
|
206
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
207
|
+
weight,
|
|
208
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
209
|
+
priority: next() < 0.3,
|
|
210
|
+
};
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
215
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
216
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
217
|
+
|
|
218
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
219
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
220
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
221
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
222
|
+
{
|
|
223
|
+
id: 'carrier',
|
|
224
|
+
label: 'Carrier',
|
|
225
|
+
accessor: 'carrier',
|
|
226
|
+
kind: 'set',
|
|
227
|
+
width: 110,
|
|
228
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: 'status',
|
|
232
|
+
label: 'Status',
|
|
233
|
+
accessor: 'status',
|
|
234
|
+
kind: 'set',
|
|
235
|
+
width: 120,
|
|
236
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
237
|
+
},
|
|
238
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
239
|
+
{
|
|
240
|
+
id: 'weight',
|
|
241
|
+
label: 'Weight',
|
|
242
|
+
accessor: 'weight',
|
|
243
|
+
kind: 'number',
|
|
244
|
+
width: 110,
|
|
245
|
+
format: kilograms,
|
|
246
|
+
},
|
|
247
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
248
|
+
];
|
|
249
|
+
|
|
250
|
+
const GROUPS: GridColumnGroup[] = [
|
|
251
|
+
{ id: 'shipment', label: 'Shipment', columns: ['id', 'customer', 'destination'] },
|
|
252
|
+
{ id: 'transport', label: 'Transport', columns: ['carrier', 'status', 'shipped'] },
|
|
253
|
+
{ id: 'charges', label: 'Charges', columns: ['weight', 'cost'] },
|
|
254
|
+
];
|
|
255
|
+
|
|
256
|
+
const ROWS = shipments(8);
|
|
257
|
+
|
|
258
|
+
@Component({
|
|
259
|
+
selector: 'app-data-grid-column-groups',
|
|
260
|
+
imports: [SlDataGrid],
|
|
261
|
+
template: `
|
|
262
|
+
<sl-data-grid
|
|
263
|
+
aria-label="Shipments"
|
|
264
|
+
rowKey="id"
|
|
265
|
+
height="22rem"
|
|
266
|
+
[columnGroups]="groups"
|
|
267
|
+
[columns]="columns"
|
|
268
|
+
[rows]="rows"
|
|
269
|
+
></sl-data-grid>
|
|
270
|
+
`,
|
|
271
|
+
})
|
|
272
|
+
export class DataGridColumnGroups {
|
|
273
|
+
readonly rows = ROWS;
|
|
274
|
+
readonly columns = COLUMNS;
|
|
275
|
+
readonly groups = GROUPS;
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Sorting
|
|
280
|
+
|
|
281
|
+
A press on a header sorts ascending, a second descending, a third removes the key; Shift with the press appends the column to the order instead, and the second and third keys carry their index beside the mark. Enter on the header does the same from the keyboard.
|
|
282
|
+
|
|
283
|
+
Example
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
import { Component, computed, signal } from '@angular/core';
|
|
287
|
+
import { emptyQuery, type GridColumn, type GridQuery } from '@slotted/core/grid';
|
|
288
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
289
|
+
import { SlStack } from '@slotted/angular/stack';
|
|
290
|
+
import { SlText } from '@slotted/angular/typography';
|
|
291
|
+
|
|
292
|
+
interface Shipment {
|
|
293
|
+
id: string;
|
|
294
|
+
customer: string;
|
|
295
|
+
destination: string;
|
|
296
|
+
carrier: string;
|
|
297
|
+
status: string;
|
|
298
|
+
shipped: string;
|
|
299
|
+
weight: number;
|
|
300
|
+
cost: number;
|
|
301
|
+
priority: boolean;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const CUSTOMERS = [
|
|
305
|
+
'Alfreds Futterkiste',
|
|
306
|
+
"Bon app'",
|
|
307
|
+
'Ernst Handel',
|
|
308
|
+
'Folk och fä HB',
|
|
309
|
+
'Hanari Carnes',
|
|
310
|
+
'Island Trading',
|
|
311
|
+
'QUICK-Stop',
|
|
312
|
+
'Wartian Herkku',
|
|
313
|
+
];
|
|
314
|
+
const DESTINATIONS = [
|
|
315
|
+
'Berlin, DE',
|
|
316
|
+
'Marseille, FR',
|
|
317
|
+
'Graz, AT',
|
|
318
|
+
'Bräcke, SE',
|
|
319
|
+
'Rio de Janeiro, BR',
|
|
320
|
+
'Cowes, UK',
|
|
321
|
+
'Boise, US',
|
|
322
|
+
'Oulu, FI',
|
|
323
|
+
];
|
|
324
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
325
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
326
|
+
|
|
327
|
+
function shipments(count: number): Shipment[] {
|
|
328
|
+
let seed = 7;
|
|
329
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
330
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
331
|
+
return Array.from({ length: count }, (_, index) => {
|
|
332
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
333
|
+
return {
|
|
334
|
+
id: `SH-${3301 + index}`,
|
|
335
|
+
customer: pick(CUSTOMERS),
|
|
336
|
+
destination: pick(DESTINATIONS),
|
|
337
|
+
carrier: pick(CARRIERS),
|
|
338
|
+
status: pick(STATUSES),
|
|
339
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
340
|
+
weight,
|
|
341
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
342
|
+
priority: next() < 0.3,
|
|
343
|
+
};
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
348
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
349
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
350
|
+
|
|
351
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
352
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
353
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
354
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
355
|
+
{
|
|
356
|
+
id: 'carrier',
|
|
357
|
+
label: 'Carrier',
|
|
358
|
+
accessor: 'carrier',
|
|
359
|
+
kind: 'set',
|
|
360
|
+
width: 110,
|
|
361
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
id: 'status',
|
|
365
|
+
label: 'Status',
|
|
366
|
+
accessor: 'status',
|
|
367
|
+
kind: 'set',
|
|
368
|
+
width: 120,
|
|
369
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
370
|
+
},
|
|
371
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
372
|
+
{
|
|
373
|
+
id: 'weight',
|
|
374
|
+
label: 'Weight',
|
|
375
|
+
accessor: 'weight',
|
|
376
|
+
kind: 'number',
|
|
377
|
+
width: 110,
|
|
378
|
+
format: kilograms,
|
|
379
|
+
},
|
|
380
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
381
|
+
];
|
|
382
|
+
|
|
383
|
+
const ROWS = shipments(12);
|
|
384
|
+
|
|
385
|
+
@Component({
|
|
386
|
+
selector: 'app-data-grid-sorting',
|
|
387
|
+
imports: [SlDataGrid, SlStack, SlText],
|
|
388
|
+
template: `
|
|
389
|
+
<div slStack [gap]="3">
|
|
390
|
+
<span slText size="sm" tone="muted">Sorted by: {{ order() }}</span>
|
|
391
|
+
<sl-data-grid
|
|
392
|
+
aria-label="Shipments"
|
|
393
|
+
rowKey="id"
|
|
394
|
+
height="22rem"
|
|
395
|
+
[(query)]="query"
|
|
396
|
+
[columns]="columns"
|
|
397
|
+
[rows]="rows"
|
|
398
|
+
></sl-data-grid>
|
|
399
|
+
</div>
|
|
400
|
+
`,
|
|
401
|
+
})
|
|
402
|
+
export class DataGridSorting {
|
|
403
|
+
readonly rows = ROWS;
|
|
404
|
+
readonly columns = COLUMNS;
|
|
405
|
+
readonly query = signal<GridQuery>({
|
|
406
|
+
...emptyQuery(),
|
|
407
|
+
sort: [
|
|
408
|
+
{ column: 'carrier', direction: 'ascending' },
|
|
409
|
+
{ column: 'cost', direction: 'descending' },
|
|
410
|
+
],
|
|
411
|
+
});
|
|
412
|
+
readonly order = computed(
|
|
413
|
+
() =>
|
|
414
|
+
this.query()
|
|
415
|
+
.sort.map((key) => `${key.column} ${key.direction}`)
|
|
416
|
+
.join(', ') || 'none',
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### The filter panel
|
|
422
|
+
|
|
423
|
+
Ctrl+Enter on a header or its menu opens the panel: one line per condition — operator and operand in sm — the join as two words on the second line once the first is complete, Clear and Apply at the end. Nothing reaches the query until Apply.
|
|
424
|
+
|
|
425
|
+
Excerpt — not a complete module
|
|
426
|
+
|
|
427
|
+
```ts
|
|
428
|
+
const query = signal(
|
|
429
|
+
withColumnFilter(emptyQuery(), 'customer', {
|
|
430
|
+
kind: 'text',
|
|
431
|
+
join: 'or',
|
|
432
|
+
conditions: [
|
|
433
|
+
{ operator: 'contains', value: 'nord' },
|
|
434
|
+
{ operator: 'startsWith', value: 'B' },
|
|
435
|
+
],
|
|
436
|
+
}).query,
|
|
437
|
+
);
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### The filter row
|
|
441
|
+
|
|
442
|
+
With filterRow the row under the header holds one operand per column, plain, with the operator as a symbol at its start — press it for the names in full. Text and number apply after the debounce and on Enter; a set, a boolean and a date apply on change. The cursor walks the row.
|
|
443
|
+
|
|
444
|
+
Example
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
import { Component } from '@angular/core';
|
|
448
|
+
import { emptyQuery, withColumnFilter, type GridColumn } from '@slotted/core/grid';
|
|
449
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
450
|
+
|
|
451
|
+
interface Shipment {
|
|
452
|
+
id: string;
|
|
453
|
+
customer: string;
|
|
454
|
+
destination: string;
|
|
455
|
+
carrier: string;
|
|
456
|
+
status: string;
|
|
457
|
+
shipped: string;
|
|
458
|
+
weight: number;
|
|
459
|
+
cost: number;
|
|
460
|
+
priority: boolean;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const CUSTOMERS = [
|
|
464
|
+
'Alfreds Futterkiste',
|
|
465
|
+
"Bon app'",
|
|
466
|
+
'Ernst Handel',
|
|
467
|
+
'Folk och fä HB',
|
|
468
|
+
'Hanari Carnes',
|
|
469
|
+
'Island Trading',
|
|
470
|
+
'QUICK-Stop',
|
|
471
|
+
'Wartian Herkku',
|
|
472
|
+
];
|
|
473
|
+
const DESTINATIONS = [
|
|
474
|
+
'Berlin, DE',
|
|
475
|
+
'Marseille, FR',
|
|
476
|
+
'Graz, AT',
|
|
477
|
+
'Bräcke, SE',
|
|
478
|
+
'Rio de Janeiro, BR',
|
|
479
|
+
'Cowes, UK',
|
|
480
|
+
'Boise, US',
|
|
481
|
+
'Oulu, FI',
|
|
482
|
+
];
|
|
483
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
484
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
485
|
+
|
|
486
|
+
function shipments(count: number): Shipment[] {
|
|
487
|
+
let seed = 7;
|
|
488
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
489
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
490
|
+
return Array.from({ length: count }, (_, index) => {
|
|
491
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
492
|
+
return {
|
|
493
|
+
id: `SH-${3301 + index}`,
|
|
494
|
+
customer: pick(CUSTOMERS),
|
|
495
|
+
destination: pick(DESTINATIONS),
|
|
496
|
+
carrier: pick(CARRIERS),
|
|
497
|
+
status: pick(STATUSES),
|
|
498
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
499
|
+
weight,
|
|
500
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
501
|
+
priority: next() < 0.3,
|
|
502
|
+
};
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
507
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
508
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
509
|
+
|
|
510
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
511
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
512
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
513
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
514
|
+
{
|
|
515
|
+
id: 'carrier',
|
|
516
|
+
label: 'Carrier',
|
|
517
|
+
accessor: 'carrier',
|
|
518
|
+
kind: 'set',
|
|
519
|
+
width: 110,
|
|
520
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
id: 'status',
|
|
524
|
+
label: 'Status',
|
|
525
|
+
accessor: 'status',
|
|
526
|
+
kind: 'set',
|
|
527
|
+
width: 120,
|
|
528
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
529
|
+
},
|
|
530
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
531
|
+
{
|
|
532
|
+
id: 'weight',
|
|
533
|
+
label: 'Weight',
|
|
534
|
+
accessor: 'weight',
|
|
535
|
+
kind: 'number',
|
|
536
|
+
width: 110,
|
|
537
|
+
format: kilograms,
|
|
538
|
+
},
|
|
539
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
540
|
+
];
|
|
541
|
+
|
|
542
|
+
const INITIAL_QUERY = withColumnFilter(emptyQuery(), 'status', {
|
|
543
|
+
kind: 'set',
|
|
544
|
+
join: 'and',
|
|
545
|
+
conditions: [{ operator: 'anyOf', value: ['Delayed', 'Customs'] }],
|
|
546
|
+
}).query;
|
|
547
|
+
|
|
548
|
+
const ROWS = shipments(24);
|
|
549
|
+
|
|
550
|
+
@Component({
|
|
551
|
+
selector: 'app-data-grid-filter-row',
|
|
552
|
+
imports: [SlDataGrid],
|
|
553
|
+
template: `
|
|
554
|
+
<sl-data-grid
|
|
555
|
+
aria-label="Shipments"
|
|
556
|
+
rowKey="id"
|
|
557
|
+
filterRow
|
|
558
|
+
height="24rem"
|
|
559
|
+
[query]="initialQuery"
|
|
560
|
+
[columns]="columns"
|
|
561
|
+
[rows]="rows"
|
|
562
|
+
></sl-data-grid>
|
|
563
|
+
`,
|
|
564
|
+
})
|
|
565
|
+
export class DataGridFilterRow {
|
|
566
|
+
readonly rows = ROWS;
|
|
567
|
+
readonly columns = COLUMNS;
|
|
568
|
+
readonly initialQuery = INITIAL_QUERY;
|
|
569
|
+
}
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
### With a filter bar
|
|
573
|
+
|
|
574
|
+
One descriptor, two families: the bar above edits query.filter and the grid evaluates it, nested groups included. A rule written in a column header appears as a chip in the bar, and a chip removed in the bar clears the header’s funnel.
|
|
575
|
+
|
|
576
|
+
Excerpt — not a complete module
|
|
577
|
+
|
|
578
|
+
```html
|
|
579
|
+
<div
|
|
580
|
+
slFilterBar
|
|
581
|
+
[fields]="fields"
|
|
582
|
+
[value]="query().filter"
|
|
583
|
+
(valueChange)="query.set(withFilter(query(), $event).query)"
|
|
584
|
+
></div>
|
|
585
|
+
<sl-data-grid rowKey="id" [rows]="shipments()" [columns]="columns" [(query)]="query" />
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
### Search
|
|
589
|
+
|
|
590
|
+
One condition that belongs to no column: query.search is matched against the text of every searchable column through the locale collator, so "agua" finds "Água". The field that writes it is the consumer’s own text-field.
|
|
591
|
+
|
|
592
|
+
Example
|
|
593
|
+
|
|
594
|
+
```ts
|
|
595
|
+
import { Component, signal } from '@angular/core';
|
|
596
|
+
import { emptyQuery, withSearch, type GridColumn, type GridQuery } from '@slotted/core/grid';
|
|
597
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
598
|
+
import { SlStack } from '@slotted/angular/stack';
|
|
599
|
+
import { SlTextField, SlTextFieldInput } from '@slotted/angular/text-field';
|
|
600
|
+
|
|
601
|
+
interface Shipment {
|
|
602
|
+
id: string;
|
|
603
|
+
customer: string;
|
|
604
|
+
destination: string;
|
|
605
|
+
carrier: string;
|
|
606
|
+
status: string;
|
|
607
|
+
shipped: string;
|
|
608
|
+
weight: number;
|
|
609
|
+
cost: number;
|
|
610
|
+
priority: boolean;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
const CUSTOMERS = [
|
|
614
|
+
'Alfreds Futterkiste',
|
|
615
|
+
"Bon app'",
|
|
616
|
+
'Ernst Handel',
|
|
617
|
+
'Folk och fä HB',
|
|
618
|
+
'Hanari Carnes',
|
|
619
|
+
'Island Trading',
|
|
620
|
+
'QUICK-Stop',
|
|
621
|
+
'Wartian Herkku',
|
|
622
|
+
];
|
|
623
|
+
const DESTINATIONS = [
|
|
624
|
+
'Berlin, DE',
|
|
625
|
+
'Marseille, FR',
|
|
626
|
+
'Graz, AT',
|
|
627
|
+
'Bräcke, SE',
|
|
628
|
+
'Rio de Janeiro, BR',
|
|
629
|
+
'Cowes, UK',
|
|
630
|
+
'Boise, US',
|
|
631
|
+
'Oulu, FI',
|
|
632
|
+
];
|
|
633
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
634
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
635
|
+
|
|
636
|
+
function shipments(count: number): Shipment[] {
|
|
637
|
+
let seed = 7;
|
|
638
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
639
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
640
|
+
return Array.from({ length: count }, (_, index) => {
|
|
641
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
642
|
+
return {
|
|
643
|
+
id: `SH-${3301 + index}`,
|
|
644
|
+
customer: pick(CUSTOMERS),
|
|
645
|
+
destination: pick(DESTINATIONS),
|
|
646
|
+
carrier: pick(CARRIERS),
|
|
647
|
+
status: pick(STATUSES),
|
|
648
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
649
|
+
weight,
|
|
650
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
651
|
+
priority: next() < 0.3,
|
|
652
|
+
};
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
657
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
658
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
659
|
+
|
|
660
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
661
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
662
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
663
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
664
|
+
{
|
|
665
|
+
id: 'carrier',
|
|
666
|
+
label: 'Carrier',
|
|
667
|
+
accessor: 'carrier',
|
|
668
|
+
kind: 'set',
|
|
669
|
+
width: 110,
|
|
670
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
id: 'status',
|
|
674
|
+
label: 'Status',
|
|
675
|
+
accessor: 'status',
|
|
676
|
+
kind: 'set',
|
|
677
|
+
width: 120,
|
|
678
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
679
|
+
},
|
|
680
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
681
|
+
{
|
|
682
|
+
id: 'weight',
|
|
683
|
+
label: 'Weight',
|
|
684
|
+
accessor: 'weight',
|
|
685
|
+
kind: 'number',
|
|
686
|
+
width: 110,
|
|
687
|
+
format: kilograms,
|
|
688
|
+
},
|
|
689
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
690
|
+
];
|
|
691
|
+
|
|
692
|
+
const ROWS = shipments(24);
|
|
693
|
+
|
|
694
|
+
@Component({
|
|
695
|
+
selector: 'app-data-grid-search',
|
|
696
|
+
imports: [SlDataGrid, SlStack, SlTextField, SlTextFieldInput],
|
|
697
|
+
template: `
|
|
698
|
+
<div slStack [gap]="3">
|
|
699
|
+
<div slTextField clearable>
|
|
700
|
+
<input
|
|
701
|
+
slTextFieldInput
|
|
702
|
+
aria-label="Search shipments"
|
|
703
|
+
placeholder="Search shipments"
|
|
704
|
+
[value]="query().search"
|
|
705
|
+
(valueChange)="search($event.value)"
|
|
706
|
+
/>
|
|
707
|
+
</div>
|
|
708
|
+
<sl-data-grid
|
|
709
|
+
aria-label="Shipments"
|
|
710
|
+
rowKey="id"
|
|
711
|
+
height="22rem"
|
|
712
|
+
[(query)]="query"
|
|
713
|
+
[columns]="columns"
|
|
714
|
+
[rows]="rows"
|
|
715
|
+
></sl-data-grid>
|
|
716
|
+
</div>
|
|
717
|
+
`,
|
|
718
|
+
})
|
|
719
|
+
export class DataGridSearch {
|
|
720
|
+
readonly rows = ROWS;
|
|
721
|
+
readonly columns = COLUMNS;
|
|
722
|
+
readonly query = signal<GridQuery>({ ...emptyQuery(), search: 'graz' });
|
|
723
|
+
|
|
724
|
+
search(text: string): void {
|
|
725
|
+
this.query.update((current) => withSearch(current, text).query);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
### Row selection
|
|
731
|
+
|
|
732
|
+
single chooses one row with a press; multiple draws the checkbox column, pinned to the start: Shift extends from the anchor, Shift+Space toggles the row from any cell, Ctrl+A and the header checkbox cover every row the query left and say so in their name.
|
|
733
|
+
|
|
734
|
+
Example
|
|
735
|
+
|
|
736
|
+
```ts
|
|
737
|
+
import { Component, computed, signal } from '@angular/core';
|
|
738
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
739
|
+
import { SlDataGrid, SlDataGridFooter } from '@slotted/angular/data-grid';
|
|
740
|
+
import { SlText } from '@slotted/angular/typography';
|
|
741
|
+
|
|
742
|
+
interface Shipment {
|
|
743
|
+
id: string;
|
|
744
|
+
customer: string;
|
|
745
|
+
destination: string;
|
|
746
|
+
carrier: string;
|
|
747
|
+
status: string;
|
|
748
|
+
shipped: string;
|
|
749
|
+
weight: number;
|
|
750
|
+
cost: number;
|
|
751
|
+
priority: boolean;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
const CUSTOMERS = [
|
|
755
|
+
'Alfreds Futterkiste',
|
|
756
|
+
"Bon app'",
|
|
757
|
+
'Ernst Handel',
|
|
758
|
+
'Folk och fä HB',
|
|
759
|
+
'Hanari Carnes',
|
|
760
|
+
'Island Trading',
|
|
761
|
+
'QUICK-Stop',
|
|
762
|
+
'Wartian Herkku',
|
|
763
|
+
];
|
|
764
|
+
const DESTINATIONS = [
|
|
765
|
+
'Berlin, DE',
|
|
766
|
+
'Marseille, FR',
|
|
767
|
+
'Graz, AT',
|
|
768
|
+
'Bräcke, SE',
|
|
769
|
+
'Rio de Janeiro, BR',
|
|
770
|
+
'Cowes, UK',
|
|
771
|
+
'Boise, US',
|
|
772
|
+
'Oulu, FI',
|
|
773
|
+
];
|
|
774
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
775
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
776
|
+
|
|
777
|
+
function shipments(count: number): Shipment[] {
|
|
778
|
+
let seed = 7;
|
|
779
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
780
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
781
|
+
return Array.from({ length: count }, (_, index) => {
|
|
782
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
783
|
+
return {
|
|
784
|
+
id: `SH-${3301 + index}`,
|
|
785
|
+
customer: pick(CUSTOMERS),
|
|
786
|
+
destination: pick(DESTINATIONS),
|
|
787
|
+
carrier: pick(CARRIERS),
|
|
788
|
+
status: pick(STATUSES),
|
|
789
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
790
|
+
weight,
|
|
791
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
792
|
+
priority: next() < 0.3,
|
|
793
|
+
};
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
798
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
799
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
800
|
+
|
|
801
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
802
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
803
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
804
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
805
|
+
{
|
|
806
|
+
id: 'carrier',
|
|
807
|
+
label: 'Carrier',
|
|
808
|
+
accessor: 'carrier',
|
|
809
|
+
kind: 'set',
|
|
810
|
+
width: 110,
|
|
811
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
id: 'status',
|
|
815
|
+
label: 'Status',
|
|
816
|
+
accessor: 'status',
|
|
817
|
+
kind: 'set',
|
|
818
|
+
width: 120,
|
|
819
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
820
|
+
},
|
|
821
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
822
|
+
{
|
|
823
|
+
id: 'weight',
|
|
824
|
+
label: 'Weight',
|
|
825
|
+
accessor: 'weight',
|
|
826
|
+
kind: 'number',
|
|
827
|
+
width: 110,
|
|
828
|
+
format: kilograms,
|
|
829
|
+
},
|
|
830
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
831
|
+
];
|
|
832
|
+
|
|
833
|
+
const ROWS = shipments(12);
|
|
834
|
+
|
|
835
|
+
@Component({
|
|
836
|
+
selector: 'app-data-grid-selection',
|
|
837
|
+
imports: [SlDataGrid, SlDataGridFooter, SlText],
|
|
838
|
+
template: `
|
|
839
|
+
<sl-data-grid
|
|
840
|
+
aria-label="Shipments"
|
|
841
|
+
rowKey="id"
|
|
842
|
+
height="24rem"
|
|
843
|
+
selectionMode="multiple"
|
|
844
|
+
[disabledKeys]="disabled"
|
|
845
|
+
[(value)]="value"
|
|
846
|
+
[columns]="columns"
|
|
847
|
+
[rows]="rows"
|
|
848
|
+
>
|
|
849
|
+
<span slDataGridFooter slText size="sm" tone="muted">{{ count() }} selected</span>
|
|
850
|
+
</sl-data-grid>
|
|
851
|
+
`,
|
|
852
|
+
})
|
|
853
|
+
export class DataGridSelection {
|
|
854
|
+
readonly rows = ROWS;
|
|
855
|
+
readonly columns = COLUMNS;
|
|
856
|
+
readonly disabled = ['SH-3305'];
|
|
857
|
+
readonly value = signal<string | readonly string[] | null>(['SH-3302', 'SH-3303']);
|
|
858
|
+
readonly count = computed(() => {
|
|
859
|
+
const value = this.value();
|
|
860
|
+
return Array.isArray(value) ? value.length : value === null ? 0 : 1;
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
### Cell range
|
|
866
|
+
|
|
867
|
+
range selects a rectangle of cells: Shift with the arrows extends it from the anchor, Shift with a press sets it, a drag paints it, Ctrl+Space takes the column and Shift+Space the row. Ctrl+C copies it as tab-separated text; Escape clears it.
|
|
868
|
+
|
|
869
|
+
Example
|
|
870
|
+
|
|
871
|
+
```ts
|
|
872
|
+
import { Component } from '@angular/core';
|
|
873
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
874
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
875
|
+
|
|
876
|
+
interface Shipment {
|
|
877
|
+
id: string;
|
|
878
|
+
customer: string;
|
|
879
|
+
destination: string;
|
|
880
|
+
carrier: string;
|
|
881
|
+
status: string;
|
|
882
|
+
shipped: string;
|
|
883
|
+
weight: number;
|
|
884
|
+
cost: number;
|
|
885
|
+
priority: boolean;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
const CUSTOMERS = [
|
|
889
|
+
'Alfreds Futterkiste',
|
|
890
|
+
"Bon app'",
|
|
891
|
+
'Ernst Handel',
|
|
892
|
+
'Folk och fä HB',
|
|
893
|
+
'Hanari Carnes',
|
|
894
|
+
'Island Trading',
|
|
895
|
+
'QUICK-Stop',
|
|
896
|
+
'Wartian Herkku',
|
|
897
|
+
];
|
|
898
|
+
const DESTINATIONS = [
|
|
899
|
+
'Berlin, DE',
|
|
900
|
+
'Marseille, FR',
|
|
901
|
+
'Graz, AT',
|
|
902
|
+
'Bräcke, SE',
|
|
903
|
+
'Rio de Janeiro, BR',
|
|
904
|
+
'Cowes, UK',
|
|
905
|
+
'Boise, US',
|
|
906
|
+
'Oulu, FI',
|
|
907
|
+
];
|
|
908
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
909
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
910
|
+
|
|
911
|
+
function shipments(count: number): Shipment[] {
|
|
912
|
+
let seed = 7;
|
|
913
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
914
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
915
|
+
return Array.from({ length: count }, (_, index) => {
|
|
916
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
917
|
+
return {
|
|
918
|
+
id: `SH-${3301 + index}`,
|
|
919
|
+
customer: pick(CUSTOMERS),
|
|
920
|
+
destination: pick(DESTINATIONS),
|
|
921
|
+
carrier: pick(CARRIERS),
|
|
922
|
+
status: pick(STATUSES),
|
|
923
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
924
|
+
weight,
|
|
925
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
926
|
+
priority: next() < 0.3,
|
|
927
|
+
};
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
932
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
933
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
934
|
+
|
|
935
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
936
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
937
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
938
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
939
|
+
{
|
|
940
|
+
id: 'carrier',
|
|
941
|
+
label: 'Carrier',
|
|
942
|
+
accessor: 'carrier',
|
|
943
|
+
kind: 'set',
|
|
944
|
+
width: 110,
|
|
945
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
id: 'status',
|
|
949
|
+
label: 'Status',
|
|
950
|
+
accessor: 'status',
|
|
951
|
+
kind: 'set',
|
|
952
|
+
width: 120,
|
|
953
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
954
|
+
},
|
|
955
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
956
|
+
{
|
|
957
|
+
id: 'weight',
|
|
958
|
+
label: 'Weight',
|
|
959
|
+
accessor: 'weight',
|
|
960
|
+
kind: 'number',
|
|
961
|
+
width: 110,
|
|
962
|
+
format: kilograms,
|
|
963
|
+
},
|
|
964
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
965
|
+
];
|
|
966
|
+
|
|
967
|
+
const ROWS = shipments(12);
|
|
968
|
+
|
|
969
|
+
@Component({
|
|
970
|
+
selector: 'app-data-grid-range',
|
|
971
|
+
imports: [SlDataGrid],
|
|
972
|
+
template: `
|
|
973
|
+
<sl-data-grid
|
|
974
|
+
aria-label="Shipments"
|
|
975
|
+
rowKey="id"
|
|
976
|
+
height="24rem"
|
|
977
|
+
selectionMode="range"
|
|
978
|
+
[current]="start"
|
|
979
|
+
[columns]="columns"
|
|
980
|
+
[rows]="rows"
|
|
981
|
+
></sl-data-grid>
|
|
982
|
+
`,
|
|
983
|
+
})
|
|
984
|
+
export class DataGridRange {
|
|
985
|
+
readonly rows = ROWS;
|
|
986
|
+
readonly columns = COLUMNS;
|
|
987
|
+
readonly start = { row: 'SH-3303', column: 'weight' };
|
|
988
|
+
}
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
### Editing a cell
|
|
992
|
+
|
|
993
|
+
Enter, F2, a double press or a typed key open the cell’s editor — the field family of its kind, plain, filling the cell. Enter commits and moves one row down, Tab commits and moves to the next editable cell, Escape cancels. The commit may hand back a promise through wait(); the cell dims until it settles.
|
|
994
|
+
|
|
995
|
+
Example
|
|
996
|
+
|
|
997
|
+
```ts
|
|
998
|
+
import { Component, signal } from '@angular/core';
|
|
999
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
1000
|
+
import { SlDataGrid, type DataGridEditCommit } from '@slotted/angular/data-grid';
|
|
1001
|
+
|
|
1002
|
+
interface Shipment {
|
|
1003
|
+
id: string;
|
|
1004
|
+
customer: string;
|
|
1005
|
+
destination: string;
|
|
1006
|
+
carrier: string;
|
|
1007
|
+
status: string;
|
|
1008
|
+
shipped: string;
|
|
1009
|
+
weight: number;
|
|
1010
|
+
cost: number;
|
|
1011
|
+
priority: boolean;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
const CUSTOMERS = [
|
|
1015
|
+
'Alfreds Futterkiste',
|
|
1016
|
+
"Bon app'",
|
|
1017
|
+
'Ernst Handel',
|
|
1018
|
+
'Folk och fä HB',
|
|
1019
|
+
'Hanari Carnes',
|
|
1020
|
+
'Island Trading',
|
|
1021
|
+
'QUICK-Stop',
|
|
1022
|
+
'Wartian Herkku',
|
|
1023
|
+
];
|
|
1024
|
+
const DESTINATIONS = [
|
|
1025
|
+
'Berlin, DE',
|
|
1026
|
+
'Marseille, FR',
|
|
1027
|
+
'Graz, AT',
|
|
1028
|
+
'Bräcke, SE',
|
|
1029
|
+
'Rio de Janeiro, BR',
|
|
1030
|
+
'Cowes, UK',
|
|
1031
|
+
'Boise, US',
|
|
1032
|
+
'Oulu, FI',
|
|
1033
|
+
];
|
|
1034
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
1035
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
1036
|
+
|
|
1037
|
+
function shipments(count: number): Shipment[] {
|
|
1038
|
+
let seed = 7;
|
|
1039
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
1040
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
1041
|
+
return Array.from({ length: count }, (_, index) => {
|
|
1042
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
1043
|
+
return {
|
|
1044
|
+
id: `SH-${3301 + index}`,
|
|
1045
|
+
customer: pick(CUSTOMERS),
|
|
1046
|
+
destination: pick(DESTINATIONS),
|
|
1047
|
+
carrier: pick(CARRIERS),
|
|
1048
|
+
status: pick(STATUSES),
|
|
1049
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
1050
|
+
weight,
|
|
1051
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
1052
|
+
priority: next() < 0.3,
|
|
1053
|
+
};
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
1058
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
1059
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
1060
|
+
|
|
1061
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
1062
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
1063
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
1064
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
1065
|
+
{
|
|
1066
|
+
id: 'carrier',
|
|
1067
|
+
label: 'Carrier',
|
|
1068
|
+
accessor: 'carrier',
|
|
1069
|
+
kind: 'set',
|
|
1070
|
+
width: 110,
|
|
1071
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
1072
|
+
},
|
|
1073
|
+
{
|
|
1074
|
+
id: 'status',
|
|
1075
|
+
label: 'Status',
|
|
1076
|
+
accessor: 'status',
|
|
1077
|
+
kind: 'set',
|
|
1078
|
+
width: 120,
|
|
1079
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
1080
|
+
},
|
|
1081
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
1082
|
+
{
|
|
1083
|
+
id: 'weight',
|
|
1084
|
+
label: 'Weight',
|
|
1085
|
+
accessor: 'weight',
|
|
1086
|
+
kind: 'number',
|
|
1087
|
+
width: 110,
|
|
1088
|
+
format: kilograms,
|
|
1089
|
+
},
|
|
1090
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
1091
|
+
];
|
|
1092
|
+
|
|
1093
|
+
const EDIT_COLUMNS: GridColumn<Shipment>[] = COLUMNS.map((column) =>
|
|
1094
|
+
column.id === 'weight'
|
|
1095
|
+
? {
|
|
1096
|
+
...column,
|
|
1097
|
+
editable: true,
|
|
1098
|
+
validate: (value: unknown) =>
|
|
1099
|
+
typeof value === 'number' && value <= 0 ? 'Enter a weight above zero.' : null,
|
|
1100
|
+
}
|
|
1101
|
+
: ['customer', 'destination', 'carrier'].includes(column.id)
|
|
1102
|
+
? { ...column, editable: true }
|
|
1103
|
+
: column,
|
|
1104
|
+
);
|
|
1105
|
+
|
|
1106
|
+
const ROWS = shipments(8);
|
|
1107
|
+
|
|
1108
|
+
@Component({
|
|
1109
|
+
selector: 'app-data-grid-editing',
|
|
1110
|
+
imports: [SlDataGrid],
|
|
1111
|
+
template: `
|
|
1112
|
+
<sl-data-grid
|
|
1113
|
+
aria-label="Shipments"
|
|
1114
|
+
rowKey="id"
|
|
1115
|
+
editMode="cell"
|
|
1116
|
+
height="22rem"
|
|
1117
|
+
(editCommit)="commit($event)"
|
|
1118
|
+
[columns]="columns"
|
|
1119
|
+
[rows]="edited()"
|
|
1120
|
+
></sl-data-grid>
|
|
1121
|
+
`,
|
|
1122
|
+
})
|
|
1123
|
+
export class DataGridEditing {
|
|
1124
|
+
readonly rows = ROWS;
|
|
1125
|
+
readonly columns = EDIT_COLUMNS;
|
|
1126
|
+
readonly edited = signal(ROWS);
|
|
1127
|
+
|
|
1128
|
+
commit({ key, changes }: DataGridEditCommit<Shipment>): void {
|
|
1129
|
+
this.edited.update((current) =>
|
|
1130
|
+
current.map((row) => (row.id === key ? { ...row, ...changes } : row)),
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
### Editing a row
|
|
1137
|
+
|
|
1138
|
+
editMode="row" opens every editable cell of the row at once: Tab moves between them, Enter commits the row with every change in one request, Escape cancels them all.
|
|
1139
|
+
|
|
1140
|
+
Example
|
|
1141
|
+
|
|
1142
|
+
```ts
|
|
1143
|
+
import { Component, signal } from '@angular/core';
|
|
1144
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
1145
|
+
import { SlDataGrid, type DataGridEditCommit } from '@slotted/angular/data-grid';
|
|
1146
|
+
|
|
1147
|
+
interface Shipment {
|
|
1148
|
+
id: string;
|
|
1149
|
+
customer: string;
|
|
1150
|
+
destination: string;
|
|
1151
|
+
carrier: string;
|
|
1152
|
+
status: string;
|
|
1153
|
+
shipped: string;
|
|
1154
|
+
weight: number;
|
|
1155
|
+
cost: number;
|
|
1156
|
+
priority: boolean;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
const CUSTOMERS = [
|
|
1160
|
+
'Alfreds Futterkiste',
|
|
1161
|
+
"Bon app'",
|
|
1162
|
+
'Ernst Handel',
|
|
1163
|
+
'Folk och fä HB',
|
|
1164
|
+
'Hanari Carnes',
|
|
1165
|
+
'Island Trading',
|
|
1166
|
+
'QUICK-Stop',
|
|
1167
|
+
'Wartian Herkku',
|
|
1168
|
+
];
|
|
1169
|
+
const DESTINATIONS = [
|
|
1170
|
+
'Berlin, DE',
|
|
1171
|
+
'Marseille, FR',
|
|
1172
|
+
'Graz, AT',
|
|
1173
|
+
'Bräcke, SE',
|
|
1174
|
+
'Rio de Janeiro, BR',
|
|
1175
|
+
'Cowes, UK',
|
|
1176
|
+
'Boise, US',
|
|
1177
|
+
'Oulu, FI',
|
|
1178
|
+
];
|
|
1179
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
1180
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
1181
|
+
|
|
1182
|
+
function shipments(count: number): Shipment[] {
|
|
1183
|
+
let seed = 7;
|
|
1184
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
1185
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
1186
|
+
return Array.from({ length: count }, (_, index) => {
|
|
1187
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
1188
|
+
return {
|
|
1189
|
+
id: `SH-${3301 + index}`,
|
|
1190
|
+
customer: pick(CUSTOMERS),
|
|
1191
|
+
destination: pick(DESTINATIONS),
|
|
1192
|
+
carrier: pick(CARRIERS),
|
|
1193
|
+
status: pick(STATUSES),
|
|
1194
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
1195
|
+
weight,
|
|
1196
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
1197
|
+
priority: next() < 0.3,
|
|
1198
|
+
};
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
1203
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
1204
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
1205
|
+
|
|
1206
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
1207
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
1208
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
1209
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
1210
|
+
{
|
|
1211
|
+
id: 'carrier',
|
|
1212
|
+
label: 'Carrier',
|
|
1213
|
+
accessor: 'carrier',
|
|
1214
|
+
kind: 'set',
|
|
1215
|
+
width: 110,
|
|
1216
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
id: 'status',
|
|
1220
|
+
label: 'Status',
|
|
1221
|
+
accessor: 'status',
|
|
1222
|
+
kind: 'set',
|
|
1223
|
+
width: 120,
|
|
1224
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
1225
|
+
},
|
|
1226
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
1227
|
+
{
|
|
1228
|
+
id: 'weight',
|
|
1229
|
+
label: 'Weight',
|
|
1230
|
+
accessor: 'weight',
|
|
1231
|
+
kind: 'number',
|
|
1232
|
+
width: 110,
|
|
1233
|
+
format: kilograms,
|
|
1234
|
+
},
|
|
1235
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
1236
|
+
];
|
|
1237
|
+
|
|
1238
|
+
const EDIT_COLUMNS: GridColumn<Shipment>[] = COLUMNS.map((column) =>
|
|
1239
|
+
column.id === 'weight'
|
|
1240
|
+
? {
|
|
1241
|
+
...column,
|
|
1242
|
+
editable: true,
|
|
1243
|
+
validate: (value: unknown) =>
|
|
1244
|
+
typeof value === 'number' && value <= 0 ? 'Enter a weight above zero.' : null,
|
|
1245
|
+
}
|
|
1246
|
+
: ['customer', 'destination', 'carrier'].includes(column.id)
|
|
1247
|
+
? { ...column, editable: true }
|
|
1248
|
+
: column,
|
|
1249
|
+
);
|
|
1250
|
+
|
|
1251
|
+
const ROWS = shipments(8);
|
|
1252
|
+
|
|
1253
|
+
@Component({
|
|
1254
|
+
selector: 'app-data-grid-editing-row',
|
|
1255
|
+
imports: [SlDataGrid],
|
|
1256
|
+
template: `
|
|
1257
|
+
<sl-data-grid
|
|
1258
|
+
aria-label="Shipments"
|
|
1259
|
+
rowKey="id"
|
|
1260
|
+
editMode="row"
|
|
1261
|
+
height="22rem"
|
|
1262
|
+
(editCommit)="commit($event)"
|
|
1263
|
+
[columns]="columns"
|
|
1264
|
+
[rows]="edited()"
|
|
1265
|
+
></sl-data-grid>
|
|
1266
|
+
`,
|
|
1267
|
+
})
|
|
1268
|
+
export class DataGridEditingRow {
|
|
1269
|
+
readonly rows = ROWS;
|
|
1270
|
+
readonly columns = EDIT_COLUMNS;
|
|
1271
|
+
readonly edited = signal(ROWS);
|
|
1272
|
+
|
|
1273
|
+
commit({ key, changes }: DataGridEditCommit<Shipment>): void {
|
|
1274
|
+
this.edited.update((current) =>
|
|
1275
|
+
current.map((row) => (row.id === key ? { ...row, ...changes } : row)),
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
```
|
|
1280
|
+
|
|
1281
|
+
### Validation, failure and conflict
|
|
1282
|
+
|
|
1283
|
+
A column’s validate refuses a draft with a message: the cell turns invalid and keeps what was typed. A commit whose promise rejects reopens the editor with the draft and the error. A row that changes under an open editor is a conflict, said in the same place.
|
|
1284
|
+
|
|
1285
|
+
Excerpt — not a complete module
|
|
1286
|
+
|
|
1287
|
+
```ts
|
|
1288
|
+
const columns: GridColumn<Shipment>[] = [
|
|
1289
|
+
{
|
|
1290
|
+
id: 'weight',
|
|
1291
|
+
label: 'Weight',
|
|
1292
|
+
kind: 'number',
|
|
1293
|
+
editable: true,
|
|
1294
|
+
validate: (value) =>
|
|
1295
|
+
typeof value === 'number' && value < 0 ? 'A weight is not negative' : null,
|
|
1296
|
+
},
|
|
1297
|
+
];
|
|
1298
|
+
class ShipmentsPage {
|
|
1299
|
+
onCommit(commit: DataGridEditCommit<Shipment>) {
|
|
1300
|
+
commit.wait(Promise.reject(new Error('Offline')));
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
```
|
|
1304
|
+
|
|
1305
|
+
### Row activation
|
|
1306
|
+
|
|
1307
|
+
activatable turns a double press or Enter on a text cell into activate with the row’s key — opening the record is a different act from choosing it, and the two never share a key. An editable cell keeps Enter for its editor. On a touch screen or with a pen one press activates, except on a widget in the cell or a cell in edit, and the double press that follows within 500ms is ignored.
|
|
1308
|
+
|
|
1309
|
+
Example
|
|
1310
|
+
|
|
1311
|
+
```ts
|
|
1312
|
+
import { Component, signal } from '@angular/core';
|
|
1313
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
1314
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
1315
|
+
import { SlStack } from '@slotted/angular/stack';
|
|
1316
|
+
import { SlText } from '@slotted/angular/typography';
|
|
1317
|
+
|
|
1318
|
+
interface Shipment {
|
|
1319
|
+
id: string;
|
|
1320
|
+
customer: string;
|
|
1321
|
+
destination: string;
|
|
1322
|
+
carrier: string;
|
|
1323
|
+
status: string;
|
|
1324
|
+
shipped: string;
|
|
1325
|
+
weight: number;
|
|
1326
|
+
cost: number;
|
|
1327
|
+
priority: boolean;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
const CUSTOMERS = [
|
|
1331
|
+
'Alfreds Futterkiste',
|
|
1332
|
+
"Bon app'",
|
|
1333
|
+
'Ernst Handel',
|
|
1334
|
+
'Folk och fä HB',
|
|
1335
|
+
'Hanari Carnes',
|
|
1336
|
+
'Island Trading',
|
|
1337
|
+
'QUICK-Stop',
|
|
1338
|
+
'Wartian Herkku',
|
|
1339
|
+
];
|
|
1340
|
+
const DESTINATIONS = [
|
|
1341
|
+
'Berlin, DE',
|
|
1342
|
+
'Marseille, FR',
|
|
1343
|
+
'Graz, AT',
|
|
1344
|
+
'Bräcke, SE',
|
|
1345
|
+
'Rio de Janeiro, BR',
|
|
1346
|
+
'Cowes, UK',
|
|
1347
|
+
'Boise, US',
|
|
1348
|
+
'Oulu, FI',
|
|
1349
|
+
];
|
|
1350
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
1351
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
1352
|
+
|
|
1353
|
+
function shipments(count: number): Shipment[] {
|
|
1354
|
+
let seed = 7;
|
|
1355
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
1356
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
1357
|
+
return Array.from({ length: count }, (_, index) => {
|
|
1358
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
1359
|
+
return {
|
|
1360
|
+
id: `SH-${3301 + index}`,
|
|
1361
|
+
customer: pick(CUSTOMERS),
|
|
1362
|
+
destination: pick(DESTINATIONS),
|
|
1363
|
+
carrier: pick(CARRIERS),
|
|
1364
|
+
status: pick(STATUSES),
|
|
1365
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
1366
|
+
weight,
|
|
1367
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
1368
|
+
priority: next() < 0.3,
|
|
1369
|
+
};
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
1374
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
1375
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
1376
|
+
|
|
1377
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
1378
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
1379
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
1380
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
1381
|
+
{
|
|
1382
|
+
id: 'carrier',
|
|
1383
|
+
label: 'Carrier',
|
|
1384
|
+
accessor: 'carrier',
|
|
1385
|
+
kind: 'set',
|
|
1386
|
+
width: 110,
|
|
1387
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
id: 'status',
|
|
1391
|
+
label: 'Status',
|
|
1392
|
+
accessor: 'status',
|
|
1393
|
+
kind: 'set',
|
|
1394
|
+
width: 120,
|
|
1395
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
1396
|
+
},
|
|
1397
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
1398
|
+
{
|
|
1399
|
+
id: 'weight',
|
|
1400
|
+
label: 'Weight',
|
|
1401
|
+
accessor: 'weight',
|
|
1402
|
+
kind: 'number',
|
|
1403
|
+
width: 110,
|
|
1404
|
+
format: kilograms,
|
|
1405
|
+
},
|
|
1406
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
1407
|
+
];
|
|
1408
|
+
|
|
1409
|
+
const ROWS = shipments(12);
|
|
1410
|
+
|
|
1411
|
+
@Component({
|
|
1412
|
+
selector: 'app-data-grid-activation',
|
|
1413
|
+
imports: [SlDataGrid, SlStack, SlText],
|
|
1414
|
+
template: `
|
|
1415
|
+
<div slStack [gap]="3">
|
|
1416
|
+
<span slText size="sm" tone="muted">{{
|
|
1417
|
+
opened() ? 'Opened ' + opened() : 'Double-click a row, or press Enter on its shipment cell.'
|
|
1418
|
+
}}</span>
|
|
1419
|
+
<sl-data-grid
|
|
1420
|
+
aria-label="Shipments"
|
|
1421
|
+
rowKey="id"
|
|
1422
|
+
activatable
|
|
1423
|
+
height="22rem"
|
|
1424
|
+
(activate)="opened.set($event.key)"
|
|
1425
|
+
[columns]="columns"
|
|
1426
|
+
[rows]="rows"
|
|
1427
|
+
></sl-data-grid>
|
|
1428
|
+
</div>
|
|
1429
|
+
`,
|
|
1430
|
+
})
|
|
1431
|
+
export class DataGridActivation {
|
|
1432
|
+
readonly rows = ROWS;
|
|
1433
|
+
readonly columns = COLUMNS;
|
|
1434
|
+
readonly opened = signal<string | null>(null);
|
|
1435
|
+
}
|
|
1436
|
+
```
|
|
1437
|
+
|
|
1438
|
+
### Pinned columns
|
|
1439
|
+
|
|
1440
|
+
A column pinned to the start or the end stays while the others scroll; the checkbox column is always pinned. Pin from the column menu or the state; the last column of each zone draws the edge, darker while something is hidden under it.
|
|
1441
|
+
|
|
1442
|
+
Excerpt — not a complete module
|
|
1443
|
+
|
|
1444
|
+
```html
|
|
1445
|
+
<sl-data-grid
|
|
1446
|
+
rowKey="id"
|
|
1447
|
+
[rows]="shipments()"
|
|
1448
|
+
[columns]="columns"
|
|
1449
|
+
[columnState]="{ pinned: { start: ['id'], end: ['actions'] } }"
|
|
1450
|
+
/>
|
|
1451
|
+
```
|
|
1452
|
+
|
|
1453
|
+
### Resizing
|
|
1454
|
+
|
|
1455
|
+
Drag the handle on a column’s trailing edge; Escape during the drag restores the width. From the keyboard, Ctrl+Shift+ArrowRight widens by eight pixels and announces the width; Ctrl+Shift+Enter and a double press on the handle fit the column to its mounted cells.
|
|
1456
|
+
|
|
1457
|
+
Excerpt — not a complete module
|
|
1458
|
+
|
|
1459
|
+
```html
|
|
1460
|
+
<sl-data-grid
|
|
1461
|
+
rowKey="id"
|
|
1462
|
+
[rows]="shipments()"
|
|
1463
|
+
[columns]="columns"
|
|
1464
|
+
[(columnState)]="state"
|
|
1465
|
+
(columnStateChangeRequest)="$event.change === 'width' && log($event.value.widths)"
|
|
1466
|
+
/>
|
|
1467
|
+
```
|
|
1468
|
+
|
|
1469
|
+
### Reordering
|
|
1470
|
+
|
|
1471
|
+
Drag a header along the row: the drop indicator shows the boundary it lands on, and a column never leaves its pin zone. Alt+ArrowLeft and Alt+ArrowRight move the column one place from the keyboard. Every move is announced.
|
|
1472
|
+
|
|
1473
|
+
Excerpt — not a complete module
|
|
1474
|
+
|
|
1475
|
+
```html
|
|
1476
|
+
<sl-data-grid
|
|
1477
|
+
rowKey="id"
|
|
1478
|
+
[rows]="shipments()"
|
|
1479
|
+
[columns]="columns"
|
|
1480
|
+
[columnState]="{ order: ['customer', 'id', 'carrier'] }"
|
|
1481
|
+
/>
|
|
1482
|
+
```
|
|
1483
|
+
|
|
1484
|
+
### The column menu
|
|
1485
|
+
|
|
1486
|
+
Revealed by the pointer and by the cursor, opened with Ctrl+Enter, a secondary press on the header (at the press; Shift keeps the browser’s menu) or Shift+F10 and the Menu key (on the header cell): sort ascending, descending or remove; filter; pin to either edge or unpin; fit to content, and fit all columns in one request; hide; and manage columns, which hands over to the application’s column-manager. A fit chosen by pointer carries reason pointer, by keyboard reason keyboard; Shift with a double press on the resizer fits every column.
|
|
1487
|
+
|
|
1488
|
+
Excerpt — not a complete module
|
|
1489
|
+
|
|
1490
|
+
```html
|
|
1491
|
+
<sl-data-grid
|
|
1492
|
+
rowKey="id"
|
|
1493
|
+
[rows]="shipments()"
|
|
1494
|
+
[columns]="columns"
|
|
1495
|
+
manageable
|
|
1496
|
+
(manageColumns)="manager.set(true)"
|
|
1497
|
+
/>
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
### A column that explains itself
|
|
1501
|
+
|
|
1502
|
+
Weight and Cost carry a description; Status carries an slDataGridColumnHelp template. The circled question mark stays shown, because a coarse pointer has no hover; it opens a popover on a press, Enter or Space, and never sorts. The description is also the header’s accessible description and the caption atop its menu. F2 on a header reaches the button without a pointer.
|
|
1503
|
+
|
|
1504
|
+
Excerpt — not a complete module
|
|
1505
|
+
|
|
1506
|
+
```html
|
|
1507
|
+
<sl-data-grid rowKey="id" [rows]="shipments()" [columns]="columns">
|
|
1508
|
+
<ng-template slDataGridColumnHelp="status">
|
|
1509
|
+
<p>Customs means the shipment is held at a border for inspection.</p>
|
|
1510
|
+
</ng-template>
|
|
1511
|
+
</sl-data-grid>
|
|
1512
|
+
```
|
|
1513
|
+
|
|
1514
|
+
### Undoing a hidden column
|
|
1515
|
+
|
|
1516
|
+
Hide column announces “Carrier hidden” and asks with change: hidden. The application answers with a toast whose Undo shows that column again through withColumnHidden: a hide moves no order, width or pin, so the column returns to its place and its width, and whatever the reader changed after the hide stays. Writing back request.previous would undo those changes too.
|
|
1517
|
+
|
|
1518
|
+
Excerpt — not a complete module
|
|
1519
|
+
|
|
1520
|
+
```ts
|
|
1521
|
+
export class ShipmentsPage {
|
|
1522
|
+
// <ng-template #undo let-message>
|
|
1523
|
+
// <button slButton size="sm" (click)="restore(message.id)">Undo</button>
|
|
1524
|
+
// </ng-template>
|
|
1525
|
+
private readonly undo = viewChild.required<TemplateRef<unknown>>('undo');
|
|
1526
|
+
/** The columns each toast's Undo shows again, by the toast. */
|
|
1527
|
+
private readonly hidden = new Map<string, readonly string[]>();
|
|
1528
|
+
|
|
1529
|
+
onRequest(request: DataGridColumnStateRequest) {
|
|
1530
|
+
if (request.change !== 'hidden') return;
|
|
1531
|
+
const shown = request.value.hidden.filter((id) => !request.previous.hidden.includes(id));
|
|
1532
|
+
const toast = this.toasts.show({ title: 'Column hidden', actions: this.undo() });
|
|
1533
|
+
this.hidden.set(toast, shown);
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
restore(id: string) {
|
|
1537
|
+
const shown = this.hidden.get(id) ?? [];
|
|
1538
|
+
this.hidden.delete(id);
|
|
1539
|
+
this.columnState.update((state) =>
|
|
1540
|
+
shown.reduce((next, column) => withColumnHidden(next, column, false), state),
|
|
1541
|
+
);
|
|
1542
|
+
this.toasts.dismiss(id, 'pointer');
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
```
|
|
1546
|
+
|
|
1547
|
+
### Saving a view
|
|
1548
|
+
|
|
1549
|
+
A view is the column state, the query and the density as one line of text: serializeGridView writes it, parseGridView reads it back and drops a column the model no longer has. persistedGridView keeps that line under a key in localStorage (or any store with getItem, setItem and removeItem; null keeps it in memory), reads it once, writes it after every change through an effect, and resets to the defaults by removing the entry. query and columnState take the two-way bindings and density the density input. Selection, cursor and expansion are session state and are not kept.
|
|
1550
|
+
|
|
1551
|
+
Example
|
|
1552
|
+
|
|
1553
|
+
```ts
|
|
1554
|
+
import { Component } from '@angular/core';
|
|
1555
|
+
import type { GridColumn, GridColumnState } from '@slotted/core/grid';
|
|
1556
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
1557
|
+
|
|
1558
|
+
interface Shipment {
|
|
1559
|
+
id: string;
|
|
1560
|
+
customer: string;
|
|
1561
|
+
destination: string;
|
|
1562
|
+
carrier: string;
|
|
1563
|
+
status: string;
|
|
1564
|
+
shipped: string;
|
|
1565
|
+
weight: number;
|
|
1566
|
+
cost: number;
|
|
1567
|
+
priority: boolean;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
const CUSTOMERS = [
|
|
1571
|
+
'Alfreds Futterkiste',
|
|
1572
|
+
"Bon app'",
|
|
1573
|
+
'Ernst Handel',
|
|
1574
|
+
'Folk och fä HB',
|
|
1575
|
+
'Hanari Carnes',
|
|
1576
|
+
'Island Trading',
|
|
1577
|
+
'QUICK-Stop',
|
|
1578
|
+
'Wartian Herkku',
|
|
1579
|
+
];
|
|
1580
|
+
const DESTINATIONS = [
|
|
1581
|
+
'Berlin, DE',
|
|
1582
|
+
'Marseille, FR',
|
|
1583
|
+
'Graz, AT',
|
|
1584
|
+
'Bräcke, SE',
|
|
1585
|
+
'Rio de Janeiro, BR',
|
|
1586
|
+
'Cowes, UK',
|
|
1587
|
+
'Boise, US',
|
|
1588
|
+
'Oulu, FI',
|
|
1589
|
+
];
|
|
1590
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
1591
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
1592
|
+
|
|
1593
|
+
function shipments(count: number): Shipment[] {
|
|
1594
|
+
let seed = 7;
|
|
1595
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
1596
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
1597
|
+
return Array.from({ length: count }, (_, index) => {
|
|
1598
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
1599
|
+
return {
|
|
1600
|
+
id: `SH-${3301 + index}`,
|
|
1601
|
+
customer: pick(CUSTOMERS),
|
|
1602
|
+
destination: pick(DESTINATIONS),
|
|
1603
|
+
carrier: pick(CARRIERS),
|
|
1604
|
+
status: pick(STATUSES),
|
|
1605
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
1606
|
+
weight,
|
|
1607
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
1608
|
+
priority: next() < 0.3,
|
|
1609
|
+
};
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
1614
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
1615
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
1616
|
+
|
|
1617
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
1618
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
1619
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
1620
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
1621
|
+
{
|
|
1622
|
+
id: 'carrier',
|
|
1623
|
+
label: 'Carrier',
|
|
1624
|
+
accessor: 'carrier',
|
|
1625
|
+
kind: 'set',
|
|
1626
|
+
width: 110,
|
|
1627
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
id: 'status',
|
|
1631
|
+
label: 'Status',
|
|
1632
|
+
accessor: 'status',
|
|
1633
|
+
kind: 'set',
|
|
1634
|
+
width: 120,
|
|
1635
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
1636
|
+
},
|
|
1637
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
1638
|
+
{
|
|
1639
|
+
id: 'weight',
|
|
1640
|
+
label: 'Weight',
|
|
1641
|
+
accessor: 'weight',
|
|
1642
|
+
kind: 'number',
|
|
1643
|
+
width: 110,
|
|
1644
|
+
format: kilograms,
|
|
1645
|
+
},
|
|
1646
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
1647
|
+
];
|
|
1648
|
+
|
|
1649
|
+
const ROWS = shipments(12);
|
|
1650
|
+
|
|
1651
|
+
@Component({
|
|
1652
|
+
selector: 'app-data-grid-column-state',
|
|
1653
|
+
imports: [SlDataGrid],
|
|
1654
|
+
template: `
|
|
1655
|
+
<sl-data-grid
|
|
1656
|
+
aria-label="Shipments"
|
|
1657
|
+
rowKey="id"
|
|
1658
|
+
height="24rem"
|
|
1659
|
+
selectionMode="multiple"
|
|
1660
|
+
[columnState]="state"
|
|
1661
|
+
[columns]="columns"
|
|
1662
|
+
[rows]="rows"
|
|
1663
|
+
></sl-data-grid>
|
|
1664
|
+
`,
|
|
1665
|
+
})
|
|
1666
|
+
export class DataGridColumnState {
|
|
1667
|
+
readonly rows = ROWS;
|
|
1668
|
+
readonly columns = COLUMNS;
|
|
1669
|
+
readonly state: Partial<GridColumnState> = {
|
|
1670
|
+
pinned: { start: ['id'], end: ['cost'] },
|
|
1671
|
+
widths: { customer: 240 },
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
```
|
|
1675
|
+
|
|
1676
|
+
### Grouping
|
|
1677
|
+
|
|
1678
|
+
query.group names the columns the rows are grouped by, outermost first. A group row carries its level, its count and the aggregates of its rows; ArrowLeft closes it and ArrowRight opens it. expandedGroups is the set of open groups, all by default.
|
|
1679
|
+
|
|
1680
|
+
Example
|
|
1681
|
+
|
|
1682
|
+
```ts
|
|
1683
|
+
import { Component } from '@angular/core';
|
|
1684
|
+
import { emptyQuery, type GridColumn, type GridQuery } from '@slotted/core/grid';
|
|
1685
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
1686
|
+
|
|
1687
|
+
interface Shipment {
|
|
1688
|
+
id: string;
|
|
1689
|
+
customer: string;
|
|
1690
|
+
destination: string;
|
|
1691
|
+
carrier: string;
|
|
1692
|
+
status: string;
|
|
1693
|
+
shipped: string;
|
|
1694
|
+
weight: number;
|
|
1695
|
+
cost: number;
|
|
1696
|
+
priority: boolean;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
const CUSTOMERS = [
|
|
1700
|
+
'Alfreds Futterkiste',
|
|
1701
|
+
"Bon app'",
|
|
1702
|
+
'Ernst Handel',
|
|
1703
|
+
'Folk och fä HB',
|
|
1704
|
+
'Hanari Carnes',
|
|
1705
|
+
'Island Trading',
|
|
1706
|
+
'QUICK-Stop',
|
|
1707
|
+
'Wartian Herkku',
|
|
1708
|
+
];
|
|
1709
|
+
const DESTINATIONS = [
|
|
1710
|
+
'Berlin, DE',
|
|
1711
|
+
'Marseille, FR',
|
|
1712
|
+
'Graz, AT',
|
|
1713
|
+
'Bräcke, SE',
|
|
1714
|
+
'Rio de Janeiro, BR',
|
|
1715
|
+
'Cowes, UK',
|
|
1716
|
+
'Boise, US',
|
|
1717
|
+
'Oulu, FI',
|
|
1718
|
+
];
|
|
1719
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
1720
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
1721
|
+
|
|
1722
|
+
function shipments(count: number): Shipment[] {
|
|
1723
|
+
let seed = 7;
|
|
1724
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
1725
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
1726
|
+
return Array.from({ length: count }, (_, index) => {
|
|
1727
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
1728
|
+
return {
|
|
1729
|
+
id: `SH-${3301 + index}`,
|
|
1730
|
+
customer: pick(CUSTOMERS),
|
|
1731
|
+
destination: pick(DESTINATIONS),
|
|
1732
|
+
carrier: pick(CARRIERS),
|
|
1733
|
+
status: pick(STATUSES),
|
|
1734
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
1735
|
+
weight,
|
|
1736
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
1737
|
+
priority: next() < 0.3,
|
|
1738
|
+
};
|
|
1739
|
+
});
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
1743
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
1744
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
1745
|
+
|
|
1746
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
1747
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
1748
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
1749
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
1750
|
+
{
|
|
1751
|
+
id: 'carrier',
|
|
1752
|
+
label: 'Carrier',
|
|
1753
|
+
accessor: 'carrier',
|
|
1754
|
+
kind: 'set',
|
|
1755
|
+
width: 110,
|
|
1756
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
1757
|
+
},
|
|
1758
|
+
{
|
|
1759
|
+
id: 'status',
|
|
1760
|
+
label: 'Status',
|
|
1761
|
+
accessor: 'status',
|
|
1762
|
+
kind: 'set',
|
|
1763
|
+
width: 120,
|
|
1764
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
1765
|
+
},
|
|
1766
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
1767
|
+
{
|
|
1768
|
+
id: 'weight',
|
|
1769
|
+
label: 'Weight',
|
|
1770
|
+
accessor: 'weight',
|
|
1771
|
+
kind: 'number',
|
|
1772
|
+
width: 110,
|
|
1773
|
+
format: kilograms,
|
|
1774
|
+
},
|
|
1775
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
1776
|
+
];
|
|
1777
|
+
|
|
1778
|
+
const INITIAL_QUERY: GridQuery = {
|
|
1779
|
+
...emptyQuery(),
|
|
1780
|
+
group: ['carrier'],
|
|
1781
|
+
sort: [{ column: 'id', direction: 'ascending' }],
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
const ROWS = shipments(20);
|
|
1785
|
+
|
|
1786
|
+
@Component({
|
|
1787
|
+
selector: 'app-data-grid-grouping',
|
|
1788
|
+
imports: [SlDataGrid],
|
|
1789
|
+
template: `
|
|
1790
|
+
<sl-data-grid
|
|
1791
|
+
aria-label="Shipments"
|
|
1792
|
+
rowKey="id"
|
|
1793
|
+
height="26rem"
|
|
1794
|
+
[query]="initialQuery"
|
|
1795
|
+
[columns]="columns"
|
|
1796
|
+
[rows]="rows"
|
|
1797
|
+
></sl-data-grid>
|
|
1798
|
+
`,
|
|
1799
|
+
})
|
|
1800
|
+
export class DataGridGrouping {
|
|
1801
|
+
readonly rows = ROWS;
|
|
1802
|
+
readonly columns = COLUMNS;
|
|
1803
|
+
readonly initialQuery = INITIAL_QUERY;
|
|
1804
|
+
}
|
|
1805
|
+
```
|
|
1806
|
+
|
|
1807
|
+
### Aggregates
|
|
1808
|
+
|
|
1809
|
+
A column with aggregate — sum, avg, min, max, count or a function — draws the summary row, pinned to the end of the scroller, over every row the query kept; a grouped grid draws the same aggregate on each group row.
|
|
1810
|
+
|
|
1811
|
+
Example
|
|
1812
|
+
|
|
1813
|
+
```ts
|
|
1814
|
+
import { Component } from '@angular/core';
|
|
1815
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
1816
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
1817
|
+
|
|
1818
|
+
interface Shipment {
|
|
1819
|
+
id: string;
|
|
1820
|
+
customer: string;
|
|
1821
|
+
destination: string;
|
|
1822
|
+
carrier: string;
|
|
1823
|
+
status: string;
|
|
1824
|
+
shipped: string;
|
|
1825
|
+
weight: number;
|
|
1826
|
+
cost: number;
|
|
1827
|
+
priority: boolean;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
const CUSTOMERS = [
|
|
1831
|
+
'Alfreds Futterkiste',
|
|
1832
|
+
"Bon app'",
|
|
1833
|
+
'Ernst Handel',
|
|
1834
|
+
'Folk och fä HB',
|
|
1835
|
+
'Hanari Carnes',
|
|
1836
|
+
'Island Trading',
|
|
1837
|
+
'QUICK-Stop',
|
|
1838
|
+
'Wartian Herkku',
|
|
1839
|
+
];
|
|
1840
|
+
const DESTINATIONS = [
|
|
1841
|
+
'Berlin, DE',
|
|
1842
|
+
'Marseille, FR',
|
|
1843
|
+
'Graz, AT',
|
|
1844
|
+
'Bräcke, SE',
|
|
1845
|
+
'Rio de Janeiro, BR',
|
|
1846
|
+
'Cowes, UK',
|
|
1847
|
+
'Boise, US',
|
|
1848
|
+
'Oulu, FI',
|
|
1849
|
+
];
|
|
1850
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
1851
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
1852
|
+
|
|
1853
|
+
function shipments(count: number): Shipment[] {
|
|
1854
|
+
let seed = 7;
|
|
1855
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
1856
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
1857
|
+
return Array.from({ length: count }, (_, index) => {
|
|
1858
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
1859
|
+
return {
|
|
1860
|
+
id: `SH-${3301 + index}`,
|
|
1861
|
+
customer: pick(CUSTOMERS),
|
|
1862
|
+
destination: pick(DESTINATIONS),
|
|
1863
|
+
carrier: pick(CARRIERS),
|
|
1864
|
+
status: pick(STATUSES),
|
|
1865
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
1866
|
+
weight,
|
|
1867
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
1868
|
+
priority: next() < 0.3,
|
|
1869
|
+
};
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
1874
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
1875
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
1876
|
+
|
|
1877
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
1878
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
1879
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
1880
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
1881
|
+
{
|
|
1882
|
+
id: 'carrier',
|
|
1883
|
+
label: 'Carrier',
|
|
1884
|
+
accessor: 'carrier',
|
|
1885
|
+
kind: 'set',
|
|
1886
|
+
width: 110,
|
|
1887
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
1888
|
+
},
|
|
1889
|
+
{
|
|
1890
|
+
id: 'status',
|
|
1891
|
+
label: 'Status',
|
|
1892
|
+
accessor: 'status',
|
|
1893
|
+
kind: 'set',
|
|
1894
|
+
width: 120,
|
|
1895
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
1896
|
+
},
|
|
1897
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
1898
|
+
{
|
|
1899
|
+
id: 'weight',
|
|
1900
|
+
label: 'Weight',
|
|
1901
|
+
accessor: 'weight',
|
|
1902
|
+
kind: 'number',
|
|
1903
|
+
width: 110,
|
|
1904
|
+
format: kilograms,
|
|
1905
|
+
},
|
|
1906
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
1907
|
+
];
|
|
1908
|
+
|
|
1909
|
+
const SUM_COLUMNS: GridColumn<Shipment>[] = COLUMNS.map((column) =>
|
|
1910
|
+
column.id === 'weight' || column.id === 'cost'
|
|
1911
|
+
? { ...column, aggregate: 'sum' as const }
|
|
1912
|
+
: column,
|
|
1913
|
+
);
|
|
1914
|
+
|
|
1915
|
+
const ROWS = shipments(10);
|
|
1916
|
+
|
|
1917
|
+
@Component({
|
|
1918
|
+
selector: 'app-data-grid-summary',
|
|
1919
|
+
imports: [SlDataGrid],
|
|
1920
|
+
template: `
|
|
1921
|
+
<sl-data-grid
|
|
1922
|
+
aria-label="Shipments"
|
|
1923
|
+
rowKey="id"
|
|
1924
|
+
height="24rem"
|
|
1925
|
+
[columns]="columns"
|
|
1926
|
+
[rows]="rows"
|
|
1927
|
+
></sl-data-grid>
|
|
1928
|
+
`,
|
|
1929
|
+
})
|
|
1930
|
+
export class DataGridSummary {
|
|
1931
|
+
readonly rows = ROWS;
|
|
1932
|
+
readonly columns = SUM_COLUMNS;
|
|
1933
|
+
}
|
|
1934
|
+
```
|
|
1935
|
+
|
|
1936
|
+
### Row detail
|
|
1937
|
+
|
|
1938
|
+
An ng-template with slDataGridDetail gives a row a detail: the expander column appears, ArrowRight on it opens the detail under the row as one cell spanning every column and held to the frame, ArrowLeft closes it. expanded is the set of open rows.
|
|
1939
|
+
|
|
1940
|
+
Example
|
|
1941
|
+
|
|
1942
|
+
```ts
|
|
1943
|
+
import { Component } from '@angular/core';
|
|
1944
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
1945
|
+
import { SlDataGrid, SlDataGridDetailTemplate } from '@slotted/angular/data-grid';
|
|
1946
|
+
import { SlText } from '@slotted/angular/typography';
|
|
1947
|
+
|
|
1948
|
+
interface Shipment {
|
|
1949
|
+
id: string;
|
|
1950
|
+
customer: string;
|
|
1951
|
+
destination: string;
|
|
1952
|
+
carrier: string;
|
|
1953
|
+
status: string;
|
|
1954
|
+
shipped: string;
|
|
1955
|
+
weight: number;
|
|
1956
|
+
cost: number;
|
|
1957
|
+
priority: boolean;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
const CUSTOMERS = [
|
|
1961
|
+
'Alfreds Futterkiste',
|
|
1962
|
+
"Bon app'",
|
|
1963
|
+
'Ernst Handel',
|
|
1964
|
+
'Folk och fä HB',
|
|
1965
|
+
'Hanari Carnes',
|
|
1966
|
+
'Island Trading',
|
|
1967
|
+
'QUICK-Stop',
|
|
1968
|
+
'Wartian Herkku',
|
|
1969
|
+
];
|
|
1970
|
+
const DESTINATIONS = [
|
|
1971
|
+
'Berlin, DE',
|
|
1972
|
+
'Marseille, FR',
|
|
1973
|
+
'Graz, AT',
|
|
1974
|
+
'Bräcke, SE',
|
|
1975
|
+
'Rio de Janeiro, BR',
|
|
1976
|
+
'Cowes, UK',
|
|
1977
|
+
'Boise, US',
|
|
1978
|
+
'Oulu, FI',
|
|
1979
|
+
];
|
|
1980
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
1981
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
1982
|
+
|
|
1983
|
+
function shipments(count: number): Shipment[] {
|
|
1984
|
+
let seed = 7;
|
|
1985
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
1986
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
1987
|
+
return Array.from({ length: count }, (_, index) => {
|
|
1988
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
1989
|
+
return {
|
|
1990
|
+
id: `SH-${3301 + index}`,
|
|
1991
|
+
customer: pick(CUSTOMERS),
|
|
1992
|
+
destination: pick(DESTINATIONS),
|
|
1993
|
+
carrier: pick(CARRIERS),
|
|
1994
|
+
status: pick(STATUSES),
|
|
1995
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
1996
|
+
weight,
|
|
1997
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
1998
|
+
priority: next() < 0.3,
|
|
1999
|
+
};
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
2004
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
2005
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
2006
|
+
|
|
2007
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
2008
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
2009
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
2010
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
2011
|
+
{
|
|
2012
|
+
id: 'carrier',
|
|
2013
|
+
label: 'Carrier',
|
|
2014
|
+
accessor: 'carrier',
|
|
2015
|
+
kind: 'set',
|
|
2016
|
+
width: 110,
|
|
2017
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
id: 'status',
|
|
2021
|
+
label: 'Status',
|
|
2022
|
+
accessor: 'status',
|
|
2023
|
+
kind: 'set',
|
|
2024
|
+
width: 120,
|
|
2025
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
2026
|
+
},
|
|
2027
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
2028
|
+
{
|
|
2029
|
+
id: 'weight',
|
|
2030
|
+
label: 'Weight',
|
|
2031
|
+
accessor: 'weight',
|
|
2032
|
+
kind: 'number',
|
|
2033
|
+
width: 110,
|
|
2034
|
+
format: kilograms,
|
|
2035
|
+
},
|
|
2036
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
2037
|
+
];
|
|
2038
|
+
|
|
2039
|
+
const ROWS = shipments(8);
|
|
2040
|
+
|
|
2041
|
+
@Component({
|
|
2042
|
+
selector: 'app-data-grid-detail',
|
|
2043
|
+
imports: [SlDataGrid, SlDataGridDetailTemplate, SlText],
|
|
2044
|
+
template: `
|
|
2045
|
+
<sl-data-grid
|
|
2046
|
+
aria-label="Shipments"
|
|
2047
|
+
rowKey="id"
|
|
2048
|
+
height="26rem"
|
|
2049
|
+
[expanded]="expanded"
|
|
2050
|
+
[columns]="columns"
|
|
2051
|
+
[rows]="rows"
|
|
2052
|
+
>
|
|
2053
|
+
<ng-template slDataGridDetail let-row>
|
|
2054
|
+
<p slText size="sm">
|
|
2055
|
+
{{ row.carrier }} picked up {{ row.weight.toFixed(1) }} kg on {{ row.shipped }} for
|
|
2056
|
+
{{ row.destination }}. Charged {{ money(row.cost) }}.
|
|
2057
|
+
</p>
|
|
2058
|
+
</ng-template>
|
|
2059
|
+
</sl-data-grid>
|
|
2060
|
+
`,
|
|
2061
|
+
})
|
|
2062
|
+
export class DataGridDetail {
|
|
2063
|
+
readonly rows = ROWS;
|
|
2064
|
+
readonly columns = COLUMNS;
|
|
2065
|
+
readonly expanded = ['SH-3301'];
|
|
2066
|
+
readonly money = money;
|
|
2067
|
+
}
|
|
2068
|
+
```
|
|
2069
|
+
|
|
2070
|
+
### Ten thousand rows
|
|
2071
|
+
|
|
2072
|
+
Above a hundred rows the grid windows them: the body is as tall as every row and only the ones in view, plus the overscan, are in the DOM. Scroll, or jump with Ctrl+End — the last row is mounted and focused. Above twenty middle columns the same happens sideways.
|
|
2073
|
+
|
|
2074
|
+
Example
|
|
2075
|
+
|
|
2076
|
+
```ts
|
|
2077
|
+
import { Component } from '@angular/core';
|
|
2078
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
2079
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
2080
|
+
|
|
2081
|
+
interface Shipment {
|
|
2082
|
+
id: string;
|
|
2083
|
+
customer: string;
|
|
2084
|
+
destination: string;
|
|
2085
|
+
carrier: string;
|
|
2086
|
+
status: string;
|
|
2087
|
+
shipped: string;
|
|
2088
|
+
weight: number;
|
|
2089
|
+
cost: number;
|
|
2090
|
+
priority: boolean;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
const CUSTOMERS = [
|
|
2094
|
+
'Alfreds Futterkiste',
|
|
2095
|
+
"Bon app'",
|
|
2096
|
+
'Ernst Handel',
|
|
2097
|
+
'Folk och fä HB',
|
|
2098
|
+
'Hanari Carnes',
|
|
2099
|
+
'Island Trading',
|
|
2100
|
+
'QUICK-Stop',
|
|
2101
|
+
'Wartian Herkku',
|
|
2102
|
+
];
|
|
2103
|
+
const DESTINATIONS = [
|
|
2104
|
+
'Berlin, DE',
|
|
2105
|
+
'Marseille, FR',
|
|
2106
|
+
'Graz, AT',
|
|
2107
|
+
'Bräcke, SE',
|
|
2108
|
+
'Rio de Janeiro, BR',
|
|
2109
|
+
'Cowes, UK',
|
|
2110
|
+
'Boise, US',
|
|
2111
|
+
'Oulu, FI',
|
|
2112
|
+
];
|
|
2113
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
2114
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
2115
|
+
|
|
2116
|
+
function shipments(count: number): Shipment[] {
|
|
2117
|
+
let seed = 7;
|
|
2118
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
2119
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
2120
|
+
return Array.from({ length: count }, (_, index) => {
|
|
2121
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
2122
|
+
return {
|
|
2123
|
+
id: `SH-${3301 + index}`,
|
|
2124
|
+
customer: pick(CUSTOMERS),
|
|
2125
|
+
destination: pick(DESTINATIONS),
|
|
2126
|
+
carrier: pick(CARRIERS),
|
|
2127
|
+
status: pick(STATUSES),
|
|
2128
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
2129
|
+
weight,
|
|
2130
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
2131
|
+
priority: next() < 0.3,
|
|
2132
|
+
};
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
2137
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
2138
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
2139
|
+
|
|
2140
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
2141
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
2142
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
2143
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
2144
|
+
{
|
|
2145
|
+
id: 'carrier',
|
|
2146
|
+
label: 'Carrier',
|
|
2147
|
+
accessor: 'carrier',
|
|
2148
|
+
kind: 'set',
|
|
2149
|
+
width: 110,
|
|
2150
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
2151
|
+
},
|
|
2152
|
+
{
|
|
2153
|
+
id: 'status',
|
|
2154
|
+
label: 'Status',
|
|
2155
|
+
accessor: 'status',
|
|
2156
|
+
kind: 'set',
|
|
2157
|
+
width: 120,
|
|
2158
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
2159
|
+
},
|
|
2160
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
2161
|
+
{
|
|
2162
|
+
id: 'weight',
|
|
2163
|
+
label: 'Weight',
|
|
2164
|
+
accessor: 'weight',
|
|
2165
|
+
kind: 'number',
|
|
2166
|
+
width: 110,
|
|
2167
|
+
format: kilograms,
|
|
2168
|
+
},
|
|
2169
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
2170
|
+
];
|
|
2171
|
+
|
|
2172
|
+
const ROWS = shipments(10_000);
|
|
2173
|
+
|
|
2174
|
+
@Component({
|
|
2175
|
+
selector: 'app-data-grid-virtualization',
|
|
2176
|
+
imports: [SlDataGrid],
|
|
2177
|
+
template: `
|
|
2178
|
+
<sl-data-grid
|
|
2179
|
+
aria-label="Shipments, 10,000 rows"
|
|
2180
|
+
rowKey="id"
|
|
2181
|
+
height="26rem"
|
|
2182
|
+
selectionMode="multiple"
|
|
2183
|
+
[columns]="columns"
|
|
2184
|
+
[rows]="rows"
|
|
2185
|
+
></sl-data-grid>
|
|
2186
|
+
`,
|
|
2187
|
+
})
|
|
2188
|
+
export class DataGridVirtualization {
|
|
2189
|
+
readonly rows = ROWS;
|
|
2190
|
+
readonly columns = COLUMNS;
|
|
2191
|
+
}
|
|
2192
|
+
```
|
|
2193
|
+
|
|
2194
|
+
### Server mode
|
|
2195
|
+
|
|
2196
|
+
With totalCount or hasMore the grid draws the rows it is given and reports the query instead of applying it: sorting, filtering, searching and paging all arrive as one request saying what changed, and a server answers with the page.
|
|
2197
|
+
|
|
2198
|
+
Excerpt — not a complete module
|
|
2199
|
+
|
|
2200
|
+
```html
|
|
2201
|
+
<sl-data-grid
|
|
2202
|
+
rowKey="id"
|
|
2203
|
+
[rows]="page().rows"
|
|
2204
|
+
[columns]="columns"
|
|
2205
|
+
[totalCount]="page().total"
|
|
2206
|
+
[loading]="pending()"
|
|
2207
|
+
[(query)]="query"
|
|
2208
|
+
(queryChangeRequest)="fetchPage($event.value, $event.change)"
|
|
2209
|
+
/>
|
|
2210
|
+
```
|
|
2211
|
+
|
|
2212
|
+
### A data source
|
|
2213
|
+
|
|
2214
|
+
dataSource hands the grid its own fetching: getRows is called with the query on every change and an AbortSignal, the request before it aborted; the answer — rows, total or hasMore — is kept by the query’s text (cacheSize, default 20), so a page the reader comes back to is on screen at once. The grid is in server mode with the loading and the error states of its own: a rejection is the error state with the message thrown, Try again asks the same query, reload() drops the cache. rows, totalCount, loading, error and retry are the source’s and are not read.
|
|
2215
|
+
|
|
2216
|
+
Excerpt — not a complete module
|
|
2217
|
+
|
|
2218
|
+
```html
|
|
2219
|
+
<sl-data-grid rowKey="id" [columns]="columns" [dataSource]="shipments" [(query)]="query" />
|
|
2220
|
+
```
|
|
2221
|
+
|
|
2222
|
+
### Pagination
|
|
2223
|
+
|
|
2224
|
+
query.page carries the index and the size; the pagination family projected with slDataGridFooter moves both, in the bar a table carries: a page size, the range and the two triggers, at the inline end. The status states the range, so showRange is off. A change of filter, search or group puts the page back at the start in the same request.
|
|
2225
|
+
|
|
2226
|
+
Excerpt — not a complete module
|
|
2227
|
+
|
|
2228
|
+
```html
|
|
2229
|
+
<sl-data-grid
|
|
2230
|
+
rowKey="id"
|
|
2231
|
+
[rows]="shipments()"
|
|
2232
|
+
[columns]="columns"
|
|
2233
|
+
[(query)]="query"
|
|
2234
|
+
[showRange]="false"
|
|
2235
|
+
>
|
|
2236
|
+
<nav
|
|
2237
|
+
slDataGridFooter
|
|
2238
|
+
slPagination
|
|
2239
|
+
[count]="total()"
|
|
2240
|
+
[pageSize]="pageSize()"
|
|
2241
|
+
[pageSizeOptions]="[25, 50, 100]"
|
|
2242
|
+
[page]="pageIndex() + 1"
|
|
2243
|
+
(pageChange)="query.set(withPageIndex(query(), $event.value - 1).query)"
|
|
2244
|
+
(pageSizeChange)="query.set(withPageSize(query(), $event.value).query)"
|
|
2245
|
+
>
|
|
2246
|
+
<sl-pagination-page-size></sl-pagination-page-size>
|
|
2247
|
+
<p slPaginationStatus></p>
|
|
2248
|
+
<button slPaginationPrevious></button>
|
|
2249
|
+
<button slPaginationNext></button>
|
|
2250
|
+
</nav>
|
|
2251
|
+
</sl-data-grid>
|
|
2252
|
+
```
|
|
2253
|
+
|
|
2254
|
+
### Load more
|
|
2255
|
+
|
|
2256
|
+
With an unknown total the footer states the range without one and offers Load more; when the grid windows its rows, loadMore is emitted on its own as the window nears the end.
|
|
2257
|
+
|
|
2258
|
+
Excerpt — not a complete module
|
|
2259
|
+
|
|
2260
|
+
```html
|
|
2261
|
+
<sl-data-grid
|
|
2262
|
+
rowKey="id"
|
|
2263
|
+
[rows]="rows()"
|
|
2264
|
+
[columns]="columns"
|
|
2265
|
+
[hasMore]="hasMore()"
|
|
2266
|
+
[query]="{ ...emptyQuery(), page: { cursor: cursor(), size: 50 } }"
|
|
2267
|
+
(loadMore)="fetchMore()"
|
|
2268
|
+
/>
|
|
2269
|
+
```
|
|
2270
|
+
|
|
2271
|
+
### Empty, no results, error, loading
|
|
2272
|
+
|
|
2273
|
+
Three states a body can hold instead of rows, each a result-state: nothing at all; nothing after the filter, with Clear filters; and a failed load, with Try again. A first load draws skeleton rows; a refresh over rows already shown dims them and moves nothing.
|
|
2274
|
+
|
|
2275
|
+
Excerpt — not a complete module
|
|
2276
|
+
|
|
2277
|
+
```html
|
|
2278
|
+
<sl-data-grid
|
|
2279
|
+
rowKey="id"
|
|
2280
|
+
[rows]="rows()"
|
|
2281
|
+
[columns]="columns"
|
|
2282
|
+
[loading]="loading()"
|
|
2283
|
+
[error]="error()"
|
|
2284
|
+
(retry)="reload()"
|
|
2285
|
+
/>
|
|
2286
|
+
```
|
|
2287
|
+
|
|
2288
|
+
### Variants
|
|
2289
|
+
|
|
2290
|
+
plain draws no rules and no band; ruled draws a rule between rows; framed adds the border, the radius and the footer inside. striped tints every second row under every state.
|
|
2291
|
+
|
|
2292
|
+
Excerpt — not a complete module
|
|
2293
|
+
|
|
2294
|
+
```html
|
|
2295
|
+
<sl-data-grid rowKey="id" variant="framed" striped [rows]="shipments()" [columns]="columns" />
|
|
2296
|
+
```
|
|
2297
|
+
|
|
2298
|
+
### Long values
|
|
2299
|
+
|
|
2300
|
+
truncate is the default — a column has a width — and keeps the whole value in the cell’s title; wrap breaks an unbroken token rather than widening the column; nowrap keeps a code on one line. A value keeps its own direction in a right-to-left grid.
|
|
2301
|
+
|
|
2302
|
+
Excerpt — not a complete module
|
|
2303
|
+
|
|
2304
|
+
```ts
|
|
2305
|
+
const columns: GridColumn<Shipment>[] = [
|
|
2306
|
+
{ id: 'customer', label: 'Customer', text: 'wrap' },
|
|
2307
|
+
{ id: 'hash', label: 'Hash', text: 'nowrap' },
|
|
2308
|
+
];
|
|
2309
|
+
```
|
|
2310
|
+
|
|
2311
|
+
### Density
|
|
2312
|
+
|
|
2313
|
+
The row reads the theme’s control scale: 34 pixels at comfortable, 28 at compact, 26 at dense, with the type and the inset stepping with it. Without density the grid takes the page’s, which the toolbar switches; with density it writes data-slotted-density on its own root and holds that one whatever the page says. The menu and the popovers it opens are portals and stay at the page’s density.
|
|
2314
|
+
|
|
2315
|
+
Excerpt — not a complete module
|
|
2316
|
+
|
|
2317
|
+
```html
|
|
2318
|
+
<sl-data-grid density="dense" rowKey="id" [rows]="shipments()" [columns]="columns" />
|
|
2319
|
+
```
|
|
2320
|
+
|
|
2321
|
+
### Columns that yield to a phone
|
|
2322
|
+
|
|
2323
|
+
The same grid in a phone-wide room. When the frame is too narrow for the template, columns leave the row: first those without a priority, the last first, then the highest priority; the identity column — the first rowHeader — and an actions column never leave. A column that leaves moves into the row’s pop-in, its label over its value drawn by the same cell template; one with popin: false is hidden instead. The root states the pop-in’s count as data-popin, rows grow to their fields, and outOfSpaceChange reports both sets — but the column state is untouched, so nothing is persisted and a wider frame brings them back. That is columnOverflow="auto", the default, under 600px, or under 1024px with a coarse pointer; wider, with a mouse, it scrolls. columnOverflow="popin" pops in at every width, and "scroll" keeps every column and scrolls.
|
|
2324
|
+
|
|
2325
|
+
Excerpt — not a complete module
|
|
2326
|
+
|
|
2327
|
+
```html
|
|
2328
|
+
<!-- columns: tracking rowHeader; status priority 1, eta 2, carrier 3; cost popin: false -->
|
|
2329
|
+
<sl-data-grid
|
|
2330
|
+
rowKey="id"
|
|
2331
|
+
[rows]="shipments()"
|
|
2332
|
+
[columns]="columns"
|
|
2333
|
+
(outOfSpaceChange)="out.set($event)"
|
|
2334
|
+
/>
|
|
2335
|
+
```
|
|
2336
|
+
|
|
2337
|
+
### Content the grid did not choose
|
|
2338
|
+
|
|
2339
|
+
A hundred-character customer name, an unbroken identifier, a right-to-left name, a disabled row, an empty cell in a numeric column and a value with a dash: each holds where the family says it holds.
|
|
2340
|
+
|
|
2341
|
+
Example
|
|
2342
|
+
|
|
2343
|
+
```ts
|
|
2344
|
+
import { Component } from '@angular/core';
|
|
2345
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
2346
|
+
import { SlAvatar } from '@slotted/angular/avatar';
|
|
2347
|
+
import { SlBadge } from '@slotted/angular/badge';
|
|
2348
|
+
import { SlDataGrid, SlDataGridCellTemplate } from '@slotted/angular/data-grid';
|
|
2349
|
+
import { SlInline } from '@slotted/angular/inline';
|
|
2350
|
+
|
|
2351
|
+
interface Shipment {
|
|
2352
|
+
id: string;
|
|
2353
|
+
customer: string;
|
|
2354
|
+
destination: string;
|
|
2355
|
+
carrier: string;
|
|
2356
|
+
status: string;
|
|
2357
|
+
shipped: string;
|
|
2358
|
+
weight: number;
|
|
2359
|
+
cost: number;
|
|
2360
|
+
priority: boolean;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
const CUSTOMERS = [
|
|
2364
|
+
'Alfreds Futterkiste',
|
|
2365
|
+
"Bon app'",
|
|
2366
|
+
'Ernst Handel',
|
|
2367
|
+
'Folk och fä HB',
|
|
2368
|
+
'Hanari Carnes',
|
|
2369
|
+
'Island Trading',
|
|
2370
|
+
'QUICK-Stop',
|
|
2371
|
+
'Wartian Herkku',
|
|
2372
|
+
];
|
|
2373
|
+
const DESTINATIONS = [
|
|
2374
|
+
'Berlin, DE',
|
|
2375
|
+
'Marseille, FR',
|
|
2376
|
+
'Graz, AT',
|
|
2377
|
+
'Bräcke, SE',
|
|
2378
|
+
'Rio de Janeiro, BR',
|
|
2379
|
+
'Cowes, UK',
|
|
2380
|
+
'Boise, US',
|
|
2381
|
+
'Oulu, FI',
|
|
2382
|
+
];
|
|
2383
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
2384
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
2385
|
+
|
|
2386
|
+
function shipments(count: number): Shipment[] {
|
|
2387
|
+
let seed = 7;
|
|
2388
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
2389
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
2390
|
+
return Array.from({ length: count }, (_, index) => {
|
|
2391
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
2392
|
+
return {
|
|
2393
|
+
id: `SH-${3301 + index}`,
|
|
2394
|
+
customer: pick(CUSTOMERS),
|
|
2395
|
+
destination: pick(DESTINATIONS),
|
|
2396
|
+
carrier: pick(CARRIERS),
|
|
2397
|
+
status: pick(STATUSES),
|
|
2398
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
2399
|
+
weight,
|
|
2400
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
2401
|
+
priority: next() < 0.3,
|
|
2402
|
+
};
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
2407
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
2408
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
2409
|
+
|
|
2410
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
2411
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
2412
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
2413
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
2414
|
+
{
|
|
2415
|
+
id: 'carrier',
|
|
2416
|
+
label: 'Carrier',
|
|
2417
|
+
accessor: 'carrier',
|
|
2418
|
+
kind: 'set',
|
|
2419
|
+
width: 110,
|
|
2420
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
id: 'status',
|
|
2424
|
+
label: 'Status',
|
|
2425
|
+
accessor: 'status',
|
|
2426
|
+
kind: 'set',
|
|
2427
|
+
width: 120,
|
|
2428
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
2429
|
+
},
|
|
2430
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
2431
|
+
{
|
|
2432
|
+
id: 'weight',
|
|
2433
|
+
label: 'Weight',
|
|
2434
|
+
accessor: 'weight',
|
|
2435
|
+
kind: 'number',
|
|
2436
|
+
width: 110,
|
|
2437
|
+
format: kilograms,
|
|
2438
|
+
},
|
|
2439
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
2440
|
+
];
|
|
2441
|
+
|
|
2442
|
+
const TONE: Record<string, 'secondary' | 'success' | 'danger' | 'warning'> = {
|
|
2443
|
+
'In transit': 'secondary',
|
|
2444
|
+
Delivered: 'success',
|
|
2445
|
+
Delayed: 'danger',
|
|
2446
|
+
Customs: 'warning',
|
|
2447
|
+
};
|
|
2448
|
+
|
|
2449
|
+
const ROWS = shipments(10);
|
|
2450
|
+
|
|
2451
|
+
@Component({
|
|
2452
|
+
selector: 'app-data-grid-content',
|
|
2453
|
+
imports: [SlAvatar, SlBadge, SlDataGrid, SlDataGridCellTemplate, SlInline],
|
|
2454
|
+
template: `
|
|
2455
|
+
<sl-data-grid
|
|
2456
|
+
aria-label="Shipments"
|
|
2457
|
+
rowKey="id"
|
|
2458
|
+
height="24rem"
|
|
2459
|
+
[columns]="columns"
|
|
2460
|
+
[rows]="rows"
|
|
2461
|
+
>
|
|
2462
|
+
<ng-template slDataGridCell="customer" let-row="row">
|
|
2463
|
+
<div slInline align="center" [gap]="2">
|
|
2464
|
+
<span slAvatar size="sm" [name]="row.customer"></span>
|
|
2465
|
+
{{ row.customer }}
|
|
2466
|
+
</div>
|
|
2467
|
+
</ng-template>
|
|
2468
|
+
<ng-template slDataGridCell="status" let-value="value">
|
|
2469
|
+
<span slBadge variant="soft" [tone]="tone[value]">{{ value }}</span>
|
|
2470
|
+
</ng-template>
|
|
2471
|
+
</sl-data-grid>
|
|
2472
|
+
`,
|
|
2473
|
+
})
|
|
2474
|
+
export class DataGridContent {
|
|
2475
|
+
readonly rows = ROWS;
|
|
2476
|
+
readonly columns = COLUMNS;
|
|
2477
|
+
readonly tone = TONE;
|
|
2478
|
+
}
|
|
2479
|
+
```
|
|
2480
|
+
|
|
2481
|
+
### Pictures in cells
|
|
2482
|
+
|
|
2483
|
+
A cell template draws anything: an avatar beside the name, a thumbnail in a custom column. A stated rowHeight is the drawn row as well as the windowed one, so ten thousand rows of 56 pixels scroll to the right place. A cell with a picture and a name is one flex row of the template’s own; the grid lays out the template’s first element as the value.
|
|
2484
|
+
|
|
2485
|
+
Excerpt — not a complete module
|
|
2486
|
+
|
|
2487
|
+
```html
|
|
2488
|
+
<sl-data-grid rowKey="id" [rows]="shipments()" [columns]="columns" [rowHeight]="56">
|
|
2489
|
+
<ng-template slDataGridCell="customer" let-row="row">
|
|
2490
|
+
<span class="customer">
|
|
2491
|
+
<span slAvatar [name]="row.customer" size="sm"></span>
|
|
2492
|
+
<span>{{ row.customer }}</span>
|
|
2493
|
+
</span>
|
|
2494
|
+
</ng-template>
|
|
2495
|
+
<ng-template slDataGridCell="photo" let-row="row">
|
|
2496
|
+
<div slImage alt="" radius="sm" ratio="landscape" [src]="row.photo"></div>
|
|
2497
|
+
</ng-template>
|
|
2498
|
+
</sl-data-grid>
|
|
2499
|
+
```
|
|
2500
|
+
|
|
2501
|
+
### Realtime
|
|
2502
|
+
|
|
2503
|
+
rows is compared with the rows before it, by key, on the mounted rows only: a cell whose value changed is marked for the time highlightChanges states (true is 1200 ms) and fades on the accent’s subtle ground; under reduced motion the ground stays flat and leaves with the mark. A row that arrived is not a change. Selection, cursor, expansion and scroll survive every tick because the key is the identity.
|
|
2504
|
+
|
|
2505
|
+
Excerpt — not a complete module
|
|
2506
|
+
|
|
2507
|
+
```html
|
|
2508
|
+
<sl-data-grid rowKey="id" [rows]="feed()" [columns]="columns" highlightChanges />
|
|
2509
|
+
```
|
|
2510
|
+
|
|
2511
|
+
### Tree data
|
|
2512
|
+
|
|
2513
|
+
tree names each row’s parent by key; a row whose parent is not in rows is a root. The root is a treegrid, every row carries aria-level and a branch aria-expanded. The open branches are expanded — the same state the detail uses; a branch opens its children, a leaf its detail. Filter and search keep a row that matches or has a descendant that matches, with its ancestors; sorting is among siblings; the page is a slice of the open rows; query.group is ignored. In the tree column, ArrowRight opens a closed branch, ArrowLeft closes an open one and climbs to the parent from a leaf. A row hasChildren says has children not yet in rows emits loadChildren when opened, and shows the wait until they arrive.
|
|
2514
|
+
|
|
2515
|
+
Example
|
|
2516
|
+
|
|
2517
|
+
```ts
|
|
2518
|
+
import { Component } from '@angular/core';
|
|
2519
|
+
import type { GridColumn, GridTree } from '@slotted/core/grid';
|
|
2520
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
2521
|
+
|
|
2522
|
+
interface Location {
|
|
2523
|
+
id: string;
|
|
2524
|
+
parent: string | null;
|
|
2525
|
+
name: string;
|
|
2526
|
+
kind: string;
|
|
2527
|
+
units: number;
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
const LOCATIONS: Location[] = [
|
|
2531
|
+
{ id: 'reno', parent: null, name: 'Reno, NV', kind: 'Warehouse', units: 4210 },
|
|
2532
|
+
{ id: 'reno-a', parent: 'reno', name: 'Zone A — dry goods', kind: 'Zone', units: 2630 },
|
|
2533
|
+
{ id: 'reno-a-01', parent: 'reno-a', name: 'Aisle 01', kind: 'Aisle', units: 1410 },
|
|
2534
|
+
{ id: 'reno-a-02', parent: 'reno-a', name: 'Aisle 02', kind: 'Aisle', units: 1220 },
|
|
2535
|
+
{ id: 'reno-b', parent: 'reno', name: 'Zone B — chilled', kind: 'Zone', units: 1580 },
|
|
2536
|
+
{ id: 'columbus', parent: null, name: 'Columbus, OH', kind: 'Warehouse', units: 3075 },
|
|
2537
|
+
{ id: 'columbus-a', parent: 'columbus', name: 'Zone A — dry goods', kind: 'Zone', units: 3075 },
|
|
2538
|
+
{ id: 'savannah', parent: null, name: 'Savannah, GA', kind: 'Warehouse', units: 1890 },
|
|
2539
|
+
{ id: 'savannah-a', parent: 'savannah', name: 'Zone A — bonded', kind: 'Zone', units: 1890 },
|
|
2540
|
+
];
|
|
2541
|
+
|
|
2542
|
+
const COLUMNS: GridColumn<Location>[] = [
|
|
2543
|
+
{ id: 'name', label: 'Location', accessor: 'name', rowHeader: true, flex: 1, minWidth: 220 },
|
|
2544
|
+
{ id: 'kind', label: 'Type', accessor: 'kind', width: 130 },
|
|
2545
|
+
{ id: 'units', label: 'Units on hand', accessor: 'units', kind: 'number', width: 150 },
|
|
2546
|
+
];
|
|
2547
|
+
|
|
2548
|
+
const TREE: GridTree<Location> = { parentKey: (row) => row.parent };
|
|
2549
|
+
|
|
2550
|
+
@Component({
|
|
2551
|
+
selector: 'app-data-grid-tree',
|
|
2552
|
+
imports: [SlDataGrid],
|
|
2553
|
+
template: `
|
|
2554
|
+
<sl-data-grid
|
|
2555
|
+
aria-label="Stock by location"
|
|
2556
|
+
height="22rem"
|
|
2557
|
+
rowKey="id"
|
|
2558
|
+
[columns]="columns"
|
|
2559
|
+
[expanded]="expanded"
|
|
2560
|
+
[rows]="locations"
|
|
2561
|
+
[tree]="tree"
|
|
2562
|
+
/>
|
|
2563
|
+
`,
|
|
2564
|
+
})
|
|
2565
|
+
export class DataGridTree {
|
|
2566
|
+
readonly locations = LOCATIONS;
|
|
2567
|
+
readonly columns = COLUMNS;
|
|
2568
|
+
readonly tree = TREE;
|
|
2569
|
+
readonly expanded = ['reno', 'reno-a'];
|
|
2570
|
+
}
|
|
2571
|
+
```
|
|
2572
|
+
|
|
2573
|
+
### Pinned rows
|
|
2574
|
+
|
|
2575
|
+
pinnedRows holds rows at the top or the bottom of the body, by key, in the stated order. A held row leaves the query — never sorted, filtered or paged — and stays on screen, under the head and over the summary, at the heights the grid measures for each. It is a row like any other: the cursor walks through it, it selects, edits and exports with the rest, and it counts in aria-rowcount.
|
|
2576
|
+
|
|
2577
|
+
Excerpt — not a complete module
|
|
2578
|
+
|
|
2579
|
+
```html
|
|
2580
|
+
<sl-data-grid
|
|
2581
|
+
rowKey="id"
|
|
2582
|
+
[rows]="rows()"
|
|
2583
|
+
[columns]="columns"
|
|
2584
|
+
[pinnedRows]="{ top: ['SHP-20487'], bottom: ['SHP-20481'] }"
|
|
2585
|
+
/>
|
|
2586
|
+
```
|
|
2587
|
+
|
|
2588
|
+
### Reordering rows
|
|
2589
|
+
|
|
2590
|
+
rowsReorderable draws a grip per row in a reserved column. The pointer drags from the grip and drops in a gap, with the same guide a column shows; Alt with the vertical arrows moves the row from any of its cells, and the move is announced. The grid keeps no order of its own: rowsReorder says where the row goes in rows (from and to, the index it takes once moved) and the consumer moves it. Only while the query is at rest — no sort, filter, search or group — and without a tree, because elsewhere the position on screen is not the position in rows; the grip is disabled otherwise.
|
|
2591
|
+
|
|
2592
|
+
Excerpt — not a complete module
|
|
2593
|
+
|
|
2594
|
+
```html
|
|
2595
|
+
<sl-data-grid
|
|
2596
|
+
rowKey="id"
|
|
2597
|
+
[rows]="rows()"
|
|
2598
|
+
[columns]="columns"
|
|
2599
|
+
rowsReorderable
|
|
2600
|
+
(rowsReorder)="move($event)"
|
|
2601
|
+
/>
|
|
2602
|
+
```
|
|
2603
|
+
|
|
2604
|
+
### Export and print
|
|
2605
|
+
|
|
2606
|
+
exportCsv() on the grid (exportAs slDataGrid) builds the file by toCsv — RFC 4180, each cell as the grid draws it — from the rows the query left (every page in client mode) and the columns not hidden in the reader’s order, or the selected rows and every column on request, and hands it to the browser as a download; toCsv() returns the text for a consumer who sends it elsewhere. In print, the frame grows to its rows, nothing scrolls or sticks, and the pointer’s controls are not on paper; a windowed grid prints the rows it has mounted, so a consumer who prints ten thousand turns the window off first. Excel is the consumer’s: SheetJS reads the same text.
|
|
2607
|
+
|
|
2608
|
+
Excerpt — not a complete module
|
|
2609
|
+
|
|
2610
|
+
```html
|
|
2611
|
+
<sl-data-grid #grid="slDataGrid" rowKey="id" [rows]="shipments()" [columns]="columns" />
|
|
2612
|
+
<button slButton (click)="grid.exportCsv({ filename: 'shipments.csv' })">CSV</button>
|
|
2613
|
+
<button slButton (click)="grid.exportCsv({ rows: 'selected', bom: true })">
|
|
2614
|
+
Selected, for Excel
|
|
2615
|
+
</button>
|
|
2616
|
+
<button slButton (click)="print()">Print</button>
|
|
2617
|
+
```
|
|
2618
|
+
|
|
2619
|
+
### Keyboard
|
|
2620
|
+
|
|
2621
|
+
Tab enters on the current cell and leaves the grid. The arrows move one cell, Home and End along the row, Ctrl+Home and Ctrl+End to the corners, PageUp and PageDown a view. Enter and F2 enter a cell, Escape leaves it. On a header: Enter sorts, Shift+Enter appends, Ctrl+Enter, Shift+F10 and the Menu key open the menu, Ctrl+Shift+arrows resize, Alt+arrows move. The pop-in is the last cell of a row.
|
|
2622
|
+
|
|
2623
|
+
Excerpt — not a complete module
|
|
2624
|
+
|
|
2625
|
+
```html
|
|
2626
|
+
<sl-data-grid
|
|
2627
|
+
rowKey="id"
|
|
2628
|
+
[rows]="shipments()"
|
|
2629
|
+
[columns]="columns"
|
|
2630
|
+
[(current)]="cell"
|
|
2631
|
+
(currentChangeRequest)="log($event.value, $event.reason)"
|
|
2632
|
+
/>
|
|
2633
|
+
```
|
|
2634
|
+
|
|
2635
|
+
### What a reader hears
|
|
2636
|
+
|
|
2637
|
+
A grid named by aria-label; every row with its index in the whole set and every cell with its column index; aria-sort on the first key and the rest announced; the selection’s size in the header checkbox’s name; a resize as a width; a filter as its sentence. Inspect the tree with a screen reader.
|
|
2638
|
+
|
|
2639
|
+
Excerpt — not a complete module
|
|
2640
|
+
|
|
2641
|
+
```ts
|
|
2642
|
+
@Component({
|
|
2643
|
+
template: `<sl-data-grid aria-label="Shipments" [messages]="messages" />`,
|
|
2644
|
+
})
|
|
2645
|
+
class Shipments {
|
|
2646
|
+
readonly messages: PartialMessages<DataGridMessages> = {
|
|
2647
|
+
selectAllFiltered:
|
|
2648
|
+
'{count, plural, one {Select the # shipment} other {Select all # shipments}}',
|
|
2649
|
+
};
|
|
2650
|
+
}
|
|
2651
|
+
```
|
|
2652
|
+
|
|
2653
|
+
### empty.ts
|
|
2654
|
+
|
|
2655
|
+
Example
|
|
2656
|
+
|
|
2657
|
+
```ts
|
|
2658
|
+
import { Component } from '@angular/core';
|
|
2659
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
2660
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
2661
|
+
|
|
2662
|
+
interface Shipment {
|
|
2663
|
+
id: string;
|
|
2664
|
+
customer: string;
|
|
2665
|
+
destination: string;
|
|
2666
|
+
carrier: string;
|
|
2667
|
+
status: string;
|
|
2668
|
+
shipped: string;
|
|
2669
|
+
weight: number;
|
|
2670
|
+
cost: number;
|
|
2671
|
+
priority: boolean;
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
2675
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
2676
|
+
|
|
2677
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
2678
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
2679
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
2680
|
+
|
|
2681
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
2682
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
2683
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
2684
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
2685
|
+
{
|
|
2686
|
+
id: 'carrier',
|
|
2687
|
+
label: 'Carrier',
|
|
2688
|
+
accessor: 'carrier',
|
|
2689
|
+
kind: 'set',
|
|
2690
|
+
width: 110,
|
|
2691
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
2692
|
+
},
|
|
2693
|
+
{
|
|
2694
|
+
id: 'status',
|
|
2695
|
+
label: 'Status',
|
|
2696
|
+
accessor: 'status',
|
|
2697
|
+
kind: 'set',
|
|
2698
|
+
width: 120,
|
|
2699
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
2700
|
+
},
|
|
2701
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
2702
|
+
{
|
|
2703
|
+
id: 'weight',
|
|
2704
|
+
label: 'Weight',
|
|
2705
|
+
accessor: 'weight',
|
|
2706
|
+
kind: 'number',
|
|
2707
|
+
width: 110,
|
|
2708
|
+
format: kilograms,
|
|
2709
|
+
},
|
|
2710
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
2711
|
+
];
|
|
2712
|
+
|
|
2713
|
+
const ROWS = [] as Shipment[];
|
|
2714
|
+
|
|
2715
|
+
@Component({
|
|
2716
|
+
selector: 'app-data-grid-empty',
|
|
2717
|
+
imports: [SlDataGrid],
|
|
2718
|
+
template: `
|
|
2719
|
+
<sl-data-grid
|
|
2720
|
+
aria-label="Shipments"
|
|
2721
|
+
rowKey="id"
|
|
2722
|
+
height="18rem"
|
|
2723
|
+
[columns]="columns"
|
|
2724
|
+
[rows]="rows"
|
|
2725
|
+
></sl-data-grid>
|
|
2726
|
+
`,
|
|
2727
|
+
})
|
|
2728
|
+
export class DataGridEmpty {
|
|
2729
|
+
readonly rows = ROWS;
|
|
2730
|
+
readonly columns = COLUMNS;
|
|
2731
|
+
}
|
|
2732
|
+
```
|
|
2733
|
+
|
|
2734
|
+
### error.ts
|
|
2735
|
+
|
|
2736
|
+
Example
|
|
2737
|
+
|
|
2738
|
+
```ts
|
|
2739
|
+
import { Component, signal } from '@angular/core';
|
|
2740
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
2741
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
2742
|
+
|
|
2743
|
+
interface Shipment {
|
|
2744
|
+
id: string;
|
|
2745
|
+
customer: string;
|
|
2746
|
+
destination: string;
|
|
2747
|
+
carrier: string;
|
|
2748
|
+
status: string;
|
|
2749
|
+
shipped: string;
|
|
2750
|
+
weight: number;
|
|
2751
|
+
cost: number;
|
|
2752
|
+
priority: boolean;
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
2756
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
2757
|
+
|
|
2758
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
2759
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
2760
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
2761
|
+
|
|
2762
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
2763
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
2764
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
2765
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
2766
|
+
{
|
|
2767
|
+
id: 'carrier',
|
|
2768
|
+
label: 'Carrier',
|
|
2769
|
+
accessor: 'carrier',
|
|
2770
|
+
kind: 'set',
|
|
2771
|
+
width: 110,
|
|
2772
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
2773
|
+
},
|
|
2774
|
+
{
|
|
2775
|
+
id: 'status',
|
|
2776
|
+
label: 'Status',
|
|
2777
|
+
accessor: 'status',
|
|
2778
|
+
kind: 'set',
|
|
2779
|
+
width: 120,
|
|
2780
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
2781
|
+
},
|
|
2782
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
2783
|
+
{
|
|
2784
|
+
id: 'weight',
|
|
2785
|
+
label: 'Weight',
|
|
2786
|
+
accessor: 'weight',
|
|
2787
|
+
kind: 'number',
|
|
2788
|
+
width: 110,
|
|
2789
|
+
format: kilograms,
|
|
2790
|
+
},
|
|
2791
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
2792
|
+
];
|
|
2793
|
+
|
|
2794
|
+
const ROWS = [] as Shipment[];
|
|
2795
|
+
|
|
2796
|
+
@Component({
|
|
2797
|
+
selector: 'app-data-grid-error',
|
|
2798
|
+
imports: [SlDataGrid],
|
|
2799
|
+
template: `
|
|
2800
|
+
<sl-data-grid
|
|
2801
|
+
aria-label="Shipments"
|
|
2802
|
+
rowKey="id"
|
|
2803
|
+
error="The shipments service did not answer within 30 seconds."
|
|
2804
|
+
height="18rem"
|
|
2805
|
+
(retry)="attempts.set(attempts() + 1)"
|
|
2806
|
+
[columns]="columns"
|
|
2807
|
+
[rows]="rows"
|
|
2808
|
+
></sl-data-grid>
|
|
2809
|
+
`,
|
|
2810
|
+
})
|
|
2811
|
+
export class DataGridError {
|
|
2812
|
+
readonly rows = ROWS;
|
|
2813
|
+
readonly columns = COLUMNS;
|
|
2814
|
+
readonly attempts = signal(0);
|
|
2815
|
+
}
|
|
2816
|
+
```
|
|
2817
|
+
|
|
2818
|
+
### loading.ts
|
|
2819
|
+
|
|
2820
|
+
Example
|
|
2821
|
+
|
|
2822
|
+
```ts
|
|
2823
|
+
import { Component } from '@angular/core';
|
|
2824
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
2825
|
+
import { SlDataGrid } from '@slotted/angular/data-grid';
|
|
2826
|
+
|
|
2827
|
+
interface Shipment {
|
|
2828
|
+
id: string;
|
|
2829
|
+
customer: string;
|
|
2830
|
+
destination: string;
|
|
2831
|
+
carrier: string;
|
|
2832
|
+
status: string;
|
|
2833
|
+
shipped: string;
|
|
2834
|
+
weight: number;
|
|
2835
|
+
cost: number;
|
|
2836
|
+
priority: boolean;
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
2840
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
2841
|
+
|
|
2842
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
2843
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
2844
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
2845
|
+
|
|
2846
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
2847
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
2848
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
2849
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
2850
|
+
{
|
|
2851
|
+
id: 'carrier',
|
|
2852
|
+
label: 'Carrier',
|
|
2853
|
+
accessor: 'carrier',
|
|
2854
|
+
kind: 'set',
|
|
2855
|
+
width: 110,
|
|
2856
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
2857
|
+
},
|
|
2858
|
+
{
|
|
2859
|
+
id: 'status',
|
|
2860
|
+
label: 'Status',
|
|
2861
|
+
accessor: 'status',
|
|
2862
|
+
kind: 'set',
|
|
2863
|
+
width: 120,
|
|
2864
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
2865
|
+
},
|
|
2866
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
2867
|
+
{
|
|
2868
|
+
id: 'weight',
|
|
2869
|
+
label: 'Weight',
|
|
2870
|
+
accessor: 'weight',
|
|
2871
|
+
kind: 'number',
|
|
2872
|
+
width: 110,
|
|
2873
|
+
format: kilograms,
|
|
2874
|
+
},
|
|
2875
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
2876
|
+
];
|
|
2877
|
+
|
|
2878
|
+
const ROWS = [] as Shipment[];
|
|
2879
|
+
|
|
2880
|
+
@Component({
|
|
2881
|
+
selector: 'app-data-grid-loading',
|
|
2882
|
+
imports: [SlDataGrid],
|
|
2883
|
+
template: `
|
|
2884
|
+
<sl-data-grid
|
|
2885
|
+
aria-label="Shipments"
|
|
2886
|
+
rowKey="id"
|
|
2887
|
+
height="18rem"
|
|
2888
|
+
loading
|
|
2889
|
+
[columns]="columns"
|
|
2890
|
+
[rows]="rows"
|
|
2891
|
+
></sl-data-grid>
|
|
2892
|
+
`,
|
|
2893
|
+
})
|
|
2894
|
+
export class DataGridLoading {
|
|
2895
|
+
readonly rows = ROWS;
|
|
2896
|
+
readonly columns = COLUMNS;
|
|
2897
|
+
}
|
|
2898
|
+
```
|
|
2899
|
+
|
|
2900
|
+
### shipments-workspace.ts
|
|
2901
|
+
|
|
2902
|
+
Example
|
|
2903
|
+
|
|
2904
|
+
```ts
|
|
2905
|
+
import { Component, computed, signal } from '@angular/core';
|
|
2906
|
+
import { emptyQuery, withSearch, type GridColumn, type GridQuery } from '@slotted/core/grid';
|
|
2907
|
+
import { SlButton } from '@slotted/angular/button';
|
|
2908
|
+
import { SlDataGrid, SlDataGridFooter } from '@slotted/angular/data-grid';
|
|
2909
|
+
import { SlInline } from '@slotted/angular/inline';
|
|
2910
|
+
import { SlStack } from '@slotted/angular/stack';
|
|
2911
|
+
import { SlTextField, SlTextFieldInput } from '@slotted/angular/text-field';
|
|
2912
|
+
import { SlText } from '@slotted/angular/typography';
|
|
2913
|
+
|
|
2914
|
+
interface Shipment {
|
|
2915
|
+
id: string;
|
|
2916
|
+
customer: string;
|
|
2917
|
+
destination: string;
|
|
2918
|
+
carrier: string;
|
|
2919
|
+
status: string;
|
|
2920
|
+
shipped: string;
|
|
2921
|
+
weight: number;
|
|
2922
|
+
cost: number;
|
|
2923
|
+
priority: boolean;
|
|
2924
|
+
}
|
|
2925
|
+
|
|
2926
|
+
const CUSTOMERS = [
|
|
2927
|
+
'Alfreds Futterkiste',
|
|
2928
|
+
"Bon app'",
|
|
2929
|
+
'Ernst Handel',
|
|
2930
|
+
'Folk och fä HB',
|
|
2931
|
+
'Hanari Carnes',
|
|
2932
|
+
'Island Trading',
|
|
2933
|
+
'QUICK-Stop',
|
|
2934
|
+
'Wartian Herkku',
|
|
2935
|
+
];
|
|
2936
|
+
const DESTINATIONS = [
|
|
2937
|
+
'Berlin, DE',
|
|
2938
|
+
'Marseille, FR',
|
|
2939
|
+
'Graz, AT',
|
|
2940
|
+
'Bräcke, SE',
|
|
2941
|
+
'Rio de Janeiro, BR',
|
|
2942
|
+
'Cowes, UK',
|
|
2943
|
+
'Boise, US',
|
|
2944
|
+
'Oulu, FI',
|
|
2945
|
+
];
|
|
2946
|
+
const CARRIERS = ['UPS', 'FedEx', 'DHL', 'USPS'];
|
|
2947
|
+
const STATUSES = ['In transit', 'Delivered', 'Delayed', 'Customs'];
|
|
2948
|
+
|
|
2949
|
+
function shipments(count: number): Shipment[] {
|
|
2950
|
+
let seed = 7;
|
|
2951
|
+
const next = () => (seed = (seed * 1664525 + 1013904223) % 4294967296) / 4294967296;
|
|
2952
|
+
const pick = <T>(list: readonly T[]) => list[Math.floor(next() * list.length)]!;
|
|
2953
|
+
return Array.from({ length: count }, (_, index) => {
|
|
2954
|
+
const weight = Math.round(next() * 9000) / 10;
|
|
2955
|
+
return {
|
|
2956
|
+
id: `SH-${3301 + index}`,
|
|
2957
|
+
customer: pick(CUSTOMERS),
|
|
2958
|
+
destination: pick(DESTINATIONS),
|
|
2959
|
+
carrier: pick(CARRIERS),
|
|
2960
|
+
status: pick(STATUSES),
|
|
2961
|
+
shipped: `2026-09-${String(1 + Math.floor(next() * 28)).padStart(2, '0')}`,
|
|
2962
|
+
weight,
|
|
2963
|
+
cost: Math.round(weight * (2 + next() * 3) * 100) / 100,
|
|
2964
|
+
priority: next() < 0.3,
|
|
2965
|
+
};
|
|
2966
|
+
});
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
const USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });
|
|
2970
|
+
const money = (value: unknown) => (typeof value === 'number' ? USD.format(value) : '');
|
|
2971
|
+
const kilograms = (value: unknown) => (typeof value === 'number' ? `${value.toFixed(1)} kg` : '');
|
|
2972
|
+
|
|
2973
|
+
const COLUMNS: GridColumn<Shipment>[] = [
|
|
2974
|
+
{ id: 'id', label: 'Shipment', accessor: 'id', rowHeader: true, width: 120, text: 'nowrap' },
|
|
2975
|
+
{ id: 'customer', label: 'Customer', accessor: 'customer', flex: 1, minWidth: 180 },
|
|
2976
|
+
{ id: 'destination', label: 'Destination', accessor: 'destination', width: 170 },
|
|
2977
|
+
{
|
|
2978
|
+
id: 'carrier',
|
|
2979
|
+
label: 'Carrier',
|
|
2980
|
+
accessor: 'carrier',
|
|
2981
|
+
kind: 'set',
|
|
2982
|
+
width: 110,
|
|
2983
|
+
options: CARRIERS.map((value) => ({ value, label: value })),
|
|
2984
|
+
},
|
|
2985
|
+
{
|
|
2986
|
+
id: 'status',
|
|
2987
|
+
label: 'Status',
|
|
2988
|
+
accessor: 'status',
|
|
2989
|
+
kind: 'set',
|
|
2990
|
+
width: 120,
|
|
2991
|
+
options: STATUSES.map((value) => ({ value, label: value })),
|
|
2992
|
+
},
|
|
2993
|
+
{ id: 'shipped', label: 'Shipped', accessor: 'shipped', kind: 'date', width: 130 },
|
|
2994
|
+
{
|
|
2995
|
+
id: 'weight',
|
|
2996
|
+
label: 'Weight',
|
|
2997
|
+
accessor: 'weight',
|
|
2998
|
+
kind: 'number',
|
|
2999
|
+
width: 110,
|
|
3000
|
+
format: kilograms,
|
|
3001
|
+
},
|
|
3002
|
+
{ id: 'cost', label: 'Cost', accessor: 'cost', kind: 'number', width: 120, format: money },
|
|
3003
|
+
];
|
|
3004
|
+
|
|
3005
|
+
const ROWS = shipments(60);
|
|
3006
|
+
|
|
3007
|
+
@Component({
|
|
3008
|
+
selector: 'app-data-grid-shipments-workspace',
|
|
3009
|
+
imports: [
|
|
3010
|
+
SlButton,
|
|
3011
|
+
SlDataGrid,
|
|
3012
|
+
SlDataGridFooter,
|
|
3013
|
+
SlInline,
|
|
3014
|
+
SlStack,
|
|
3015
|
+
SlText,
|
|
3016
|
+
SlTextField,
|
|
3017
|
+
SlTextFieldInput,
|
|
3018
|
+
],
|
|
3019
|
+
template: `
|
|
3020
|
+
<div slStack [gap]="3">
|
|
3021
|
+
<div slTextField clearable>
|
|
3022
|
+
<input
|
|
3023
|
+
slTextFieldInput
|
|
3024
|
+
aria-label="Search shipments"
|
|
3025
|
+
placeholder="Search by shipment, customer or destination"
|
|
3026
|
+
[value]="query().search"
|
|
3027
|
+
(valueChange)="search($event.value)"
|
|
3028
|
+
/>
|
|
3029
|
+
</div>
|
|
3030
|
+
<sl-data-grid
|
|
3031
|
+
aria-label="Shipments"
|
|
3032
|
+
rowKey="id"
|
|
3033
|
+
height="26rem"
|
|
3034
|
+
selectionMode="multiple"
|
|
3035
|
+
[(query)]="query"
|
|
3036
|
+
[(value)]="value"
|
|
3037
|
+
[columns]="columns"
|
|
3038
|
+
[rows]="rows"
|
|
3039
|
+
>
|
|
3040
|
+
<div slDataGridFooter slInline align="center" [gap]="3">
|
|
3041
|
+
<span slText size="sm" tone="muted">{{ count() }} selected</span>
|
|
3042
|
+
<button slButton type="button" size="sm" variant="outline" [disabled]="count() === 0">
|
|
3043
|
+
Print labels
|
|
3044
|
+
</button>
|
|
3045
|
+
</div>
|
|
3046
|
+
</sl-data-grid>
|
|
3047
|
+
</div>
|
|
3048
|
+
`,
|
|
3049
|
+
})
|
|
3050
|
+
export class DataGridShipmentsWorkspace {
|
|
3051
|
+
readonly rows = ROWS;
|
|
3052
|
+
readonly columns = COLUMNS;
|
|
3053
|
+
readonly query = signal<GridQuery>(emptyQuery());
|
|
3054
|
+
readonly value = signal<string | readonly string[] | null>([]);
|
|
3055
|
+
readonly count = computed(() => {
|
|
3056
|
+
const value = this.value();
|
|
3057
|
+
return Array.isArray(value) ? value.length : 0;
|
|
3058
|
+
});
|
|
3059
|
+
|
|
3060
|
+
search(text: string): void {
|
|
3061
|
+
this.query.update((current) => withSearch(current, text).query);
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
```
|