@lushly-dev/violet-elements 0.2.0-preview.4 → 0.2.0-preview.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -22
- package/custom-elements.json +5742 -149
- package/dist/accordion/violet-accordion.d.ts +6 -1
- package/dist/accordion/violet-accordion.define.d.ts +7 -0
- package/dist/accordion/violet-accordion.define.js +15 -0
- package/dist/accordion/violet-accordion.define.js.map +1 -0
- package/dist/accordion/violet-accordion.js +22 -24
- package/dist/accordion/violet-accordion.js.map +1 -1
- package/dist/accordion-item/violet-accordion-item.d.ts +9 -0
- package/dist/accordion-item/violet-accordion-item.define.d.ts +7 -0
- package/dist/accordion-item/violet-accordion-item.define.js +13 -0
- package/dist/accordion-item/violet-accordion-item.define.js.map +1 -0
- package/dist/accordion-item/violet-accordion-item.js +124 -116
- package/dist/accordion-item/violet-accordion-item.js.map +1 -1
- package/dist/alert/violet-alert.d.ts +10 -4
- package/dist/alert/violet-alert.define.d.ts +7 -0
- package/dist/alert/violet-alert.define.js +21 -0
- package/dist/alert/violet-alert.define.js.map +1 -0
- package/dist/alert/violet-alert.js +184 -167
- package/dist/alert/violet-alert.js.map +1 -1
- package/dist/all.d.ts +81 -0
- package/dist/all.js +82 -0
- package/dist/all.js.map +1 -0
- package/dist/badge/violet-badge.d.ts +6 -1
- package/dist/badge/violet-badge.define.d.ts +7 -0
- package/dist/badge/violet-badge.define.js +15 -0
- package/dist/badge/violet-badge.define.js.map +1 -0
- package/dist/badge/violet-badge.js +89 -91
- package/dist/badge/violet-badge.js.map +1 -1
- package/dist/breadcrumb/violet-breadcrumb.d.ts +6 -1
- package/dist/breadcrumb/violet-breadcrumb.define.d.ts +7 -0
- package/dist/breadcrumb/violet-breadcrumb.define.js +15 -0
- package/dist/breadcrumb/violet-breadcrumb.define.js.map +1 -0
- package/dist/breadcrumb/violet-breadcrumb.js +21 -23
- package/dist/breadcrumb/violet-breadcrumb.js.map +1 -1
- package/dist/breadcrumb-item/violet-breadcrumb-item.d.ts +6 -0
- package/dist/breadcrumb-item/violet-breadcrumb-item.define.d.ts +7 -0
- package/dist/breadcrumb-item/violet-breadcrumb-item.define.js +13 -0
- package/dist/breadcrumb-item/violet-breadcrumb-item.define.js.map +1 -0
- package/dist/breadcrumb-item/violet-breadcrumb-item.js +50 -51
- package/dist/breadcrumb-item/violet-breadcrumb-item.js.map +1 -1
- package/dist/button/violet-button.d.ts +14 -0
- package/dist/button/violet-button.define.d.ts +7 -0
- package/dist/button/violet-button.define.js +13 -0
- package/dist/button/violet-button.define.js.map +1 -0
- package/dist/button/violet-button.js +147 -129
- package/dist/button/violet-button.js.map +1 -1
- package/dist/calendar/violet-calendar.d.ts +6 -0
- package/dist/calendar/violet-calendar.define.d.ts +7 -0
- package/dist/calendar/violet-calendar.define.js +13 -0
- package/dist/calendar/violet-calendar.define.js.map +1 -0
- package/dist/calendar/violet-calendar.js +148 -149
- package/dist/calendar/violet-calendar.js.map +1 -1
- package/dist/card/violet-card.d.ts +9 -0
- package/dist/card/violet-card.define.d.ts +7 -0
- package/dist/card/violet-card.define.js +13 -0
- package/dist/card/violet-card.define.js.map +1 -0
- package/dist/card/violet-card.js +112 -115
- package/dist/card/violet-card.js.map +1 -1
- package/dist/carousel/violet-carousel.d.ts +9 -2
- package/dist/carousel/violet-carousel.define.d.ts +7 -0
- package/dist/carousel/violet-carousel.define.js +19 -0
- package/dist/carousel/violet-carousel.define.js.map +1 -0
- package/dist/carousel/violet-carousel.js +173 -167
- package/dist/carousel/violet-carousel.js.map +1 -1
- package/dist/checkbox/violet-checkbox.d.ts +25 -1
- package/dist/checkbox/violet-checkbox.define.d.ts +7 -0
- package/dist/checkbox/violet-checkbox.define.js +13 -0
- package/dist/checkbox/violet-checkbox.define.js.map +1 -0
- package/dist/checkbox/violet-checkbox.js +301 -224
- package/dist/checkbox/violet-checkbox.js.map +1 -1
- package/dist/color-picker/violet-color-picker.d.ts +12 -2
- package/dist/color-picker/violet-color-picker.define.d.ts +7 -0
- package/dist/color-picker/violet-color-picker.define.js +19 -0
- package/dist/color-picker/violet-color-picker.define.js.map +1 -0
- package/dist/color-picker/violet-color-picker.js +354 -347
- package/dist/color-picker/violet-color-picker.js.map +1 -1
- package/dist/color-swatch/violet-color-swatch.d.ts +6 -0
- package/dist/color-swatch/violet-color-swatch.define.d.ts +7 -0
- package/dist/color-swatch/violet-color-swatch.define.js +13 -0
- package/dist/color-swatch/violet-color-swatch.define.js.map +1 -0
- package/dist/color-swatch/violet-color-swatch.js +43 -44
- package/dist/color-swatch/violet-color-swatch.js.map +1 -1
- package/dist/combobox/violet-combobox.d.ts +13 -1
- package/dist/combobox/violet-combobox.define.d.ts +7 -0
- package/dist/combobox/violet-combobox.define.js +15 -0
- package/dist/combobox/violet-combobox.define.js.map +1 -0
- package/dist/combobox/violet-combobox.js +425 -224
- package/dist/combobox/violet-combobox.js.map +1 -1
- package/dist/conversation/violet-approval-card.d.ts +6 -3
- package/dist/conversation/violet-approval-card.define.d.ts +7 -0
- package/dist/conversation/violet-approval-card.define.js +19 -0
- package/dist/conversation/violet-approval-card.define.js.map +1 -0
- package/dist/conversation/violet-approval-card.js +156 -160
- package/dist/conversation/violet-approval-card.js.map +1 -1
- package/dist/conversation/violet-chat-composer.d.ts +9 -3
- package/dist/conversation/violet-chat-composer.define.d.ts +7 -0
- package/dist/conversation/violet-chat-composer.define.js +19 -0
- package/dist/conversation/violet-chat-composer.define.js.map +1 -0
- package/dist/conversation/violet-chat-composer.js +100 -104
- package/dist/conversation/violet-chat-composer.js.map +1 -1
- package/dist/conversation/violet-chat-suggestions.d.ts +6 -0
- package/dist/conversation/violet-chat-suggestions.define.d.ts +7 -0
- package/dist/conversation/violet-chat-suggestions.define.js +13 -0
- package/dist/conversation/violet-chat-suggestions.define.js.map +1 -0
- package/dist/conversation/violet-chat-suggestions.js +56 -57
- package/dist/conversation/violet-chat-suggestions.js.map +1 -1
- package/dist/conversation/violet-conversation-thread.d.ts +6 -0
- package/dist/conversation/violet-conversation-thread.define.d.ts +7 -0
- package/dist/conversation/violet-conversation-thread.define.js +13 -0
- package/dist/conversation/violet-conversation-thread.define.js.map +1 -0
- package/dist/conversation/violet-conversation-thread.js +47 -48
- package/dist/conversation/violet-conversation-thread.js.map +1 -1
- package/dist/conversation/violet-message-media.d.ts +6 -1
- package/dist/conversation/violet-message-media.define.d.ts +7 -0
- package/dist/conversation/violet-message-media.define.js +15 -0
- package/dist/conversation/violet-message-media.define.js.map +1 -0
- package/dist/conversation/violet-message-media.js +77 -79
- package/dist/conversation/violet-message-media.js.map +1 -1
- package/dist/conversation/violet-message-status.d.ts +6 -0
- package/dist/conversation/violet-message-status.define.d.ts +7 -0
- package/dist/conversation/violet-message-status.define.js +13 -0
- package/dist/conversation/violet-message-status.define.js.map +1 -0
- package/dist/conversation/violet-message-status.js +91 -94
- package/dist/conversation/violet-message-status.js.map +1 -1
- package/dist/conversation/violet-message-text.d.ts +6 -0
- package/dist/conversation/violet-message-text.define.d.ts +7 -0
- package/dist/conversation/violet-message-text.define.js +13 -0
- package/dist/conversation/violet-message-text.define.js.map +1 -0
- package/dist/conversation/violet-message-text.js +47 -48
- package/dist/conversation/violet-message-text.js.map +1 -1
- package/dist/conversation/violet-message.d.ts +6 -0
- package/dist/conversation/violet-message.define.d.ts +7 -0
- package/dist/conversation/violet-message.define.js +13 -0
- package/dist/conversation/violet-message.define.js.map +1 -0
- package/dist/conversation/violet-message.js +94 -95
- package/dist/conversation/violet-message.js.map +1 -1
- package/dist/conversation/violet-reasoning-block.d.ts +6 -1
- package/dist/conversation/violet-reasoning-block.define.d.ts +7 -0
- package/dist/conversation/violet-reasoning-block.define.js +15 -0
- package/dist/conversation/violet-reasoning-block.define.js.map +1 -0
- package/dist/conversation/violet-reasoning-block.js +92 -94
- package/dist/conversation/violet-reasoning-block.js.map +1 -1
- package/dist/conversation/violet-source-citation.d.ts +6 -1
- package/dist/conversation/violet-source-citation.define.d.ts +7 -0
- package/dist/conversation/violet-source-citation.define.js +15 -0
- package/dist/conversation/violet-source-citation.define.js.map +1 -0
- package/dist/conversation/violet-source-citation.js +76 -78
- package/dist/conversation/violet-source-citation.js.map +1 -1
- package/dist/conversation/violet-tool-call-card.d.ts +6 -3
- package/dist/conversation/violet-tool-call-card.define.d.ts +7 -0
- package/dist/conversation/violet-tool-call-card.define.js +19 -0
- package/dist/conversation/violet-tool-call-card.define.js.map +1 -0
- package/dist/conversation/violet-tool-call-card.js +192 -196
- package/dist/conversation/violet-tool-call-card.js.map +1 -1
- package/dist/conversation/violet-tool-result-card.d.ts +6 -2
- package/dist/conversation/violet-tool-result-card.define.d.ts +7 -0
- package/dist/conversation/violet-tool-result-card.define.js +17 -0
- package/dist/conversation/violet-tool-result-card.define.js.map +1 -0
- package/dist/conversation/violet-tool-result-card.js +157 -160
- package/dist/conversation/violet-tool-result-card.js.map +1 -1
- package/dist/data-grid/violet-data-grid-attachment-cell.d.ts +9 -4
- package/dist/data-grid/violet-data-grid-attachment-cell.define.d.ts +7 -0
- package/dist/data-grid/violet-data-grid-attachment-cell.define.js +25 -0
- package/dist/data-grid/violet-data-grid-attachment-cell.define.js.map +1 -0
- package/dist/data-grid/violet-data-grid-attachment-cell.js +300 -309
- package/dist/data-grid/violet-data-grid-attachment-cell.js.map +1 -1
- package/dist/data-grid/violet-data-grid-cell-keyboard.d.ts +80 -0
- package/dist/data-grid/violet-data-grid-cell-keyboard.js +249 -0
- package/dist/data-grid/violet-data-grid-cell-keyboard.js.map +1 -0
- package/dist/data-grid/violet-data-grid-focus-recovery.d.ts +7 -0
- package/dist/data-grid/violet-data-grid-focus-recovery.js +65 -0
- package/dist/data-grid/violet-data-grid-focus-recovery.js.map +1 -0
- package/dist/data-grid/violet-data-grid-header-nav.d.ts +29 -0
- package/dist/data-grid/violet-data-grid-header-nav.js +173 -0
- package/dist/data-grid/violet-data-grid-header-nav.js.map +1 -0
- package/dist/data-grid/violet-data-grid-multi-picker.d.ts +9 -2
- package/dist/data-grid/violet-data-grid-multi-picker.define.d.ts +7 -0
- package/dist/data-grid/violet-data-grid-multi-picker.define.js +17 -0
- package/dist/data-grid/violet-data-grid-multi-picker.define.js.map +1 -0
- package/dist/data-grid/violet-data-grid-multi-picker.js +205 -204
- package/dist/data-grid/violet-data-grid-multi-picker.js.map +1 -1
- package/dist/data-grid/violet-data-grid-persona-picker.d.ts +9 -3
- package/dist/data-grid/violet-data-grid-persona-picker.define.d.ts +7 -0
- package/dist/data-grid/violet-data-grid-persona-picker.define.js +19 -0
- package/dist/data-grid/violet-data-grid-persona-picker.define.js.map +1 -0
- package/dist/data-grid/violet-data-grid-persona-picker.js +218 -218
- package/dist/data-grid/violet-data-grid-persona-picker.js.map +1 -1
- package/dist/data-grid/violet-data-grid-pill-select.d.ts +11 -1
- package/dist/data-grid/violet-data-grid-pill-select.define.d.ts +7 -0
- package/dist/data-grid/violet-data-grid-pill-select.define.js +13 -0
- package/dist/data-grid/violet-data-grid-pill-select.define.js.map +1 -0
- package/dist/data-grid/violet-data-grid-pill-select.js +210 -191
- package/dist/data-grid/violet-data-grid-pill-select.js.map +1 -1
- package/dist/data-grid/violet-data-grid-rating.d.ts +9 -0
- package/dist/data-grid/violet-data-grid-rating.define.d.ts +7 -0
- package/dist/data-grid/violet-data-grid-rating.define.js +13 -0
- package/dist/data-grid/violet-data-grid-rating.define.js.map +1 -0
- package/dist/data-grid/violet-data-grid-rating.js +98 -99
- package/dist/data-grid/violet-data-grid-rating.js.map +1 -1
- package/dist/data-grid/violet-data-grid-reference-picker.d.ts +9 -2
- package/dist/data-grid/violet-data-grid-reference-picker.define.d.ts +7 -0
- package/dist/data-grid/violet-data-grid-reference-picker.define.js +17 -0
- package/dist/data-grid/violet-data-grid-reference-picker.define.js.map +1 -0
- package/dist/data-grid/violet-data-grid-reference-picker.js +241 -240
- package/dist/data-grid/violet-data-grid-reference-picker.js.map +1 -1
- package/dist/data-grid/violet-data-grid-roving-focus.d.ts +40 -0
- package/dist/data-grid/violet-data-grid-roving-focus.js +298 -0
- package/dist/data-grid/violet-data-grid-roving-focus.js.map +1 -0
- package/dist/data-grid/violet-data-grid-targets.d.ts +1 -0
- package/dist/data-grid/violet-data-grid-targets.js +13 -0
- package/dist/data-grid/violet-data-grid-targets.js.map +1 -1
- package/dist/data-grid/violet-data-grid-types.d.ts +211 -0
- package/dist/data-grid/violet-data-grid-types.js +2 -0
- package/dist/data-grid/violet-data-grid-types.js.map +1 -0
- package/dist/data-grid/violet-data-grid.d.ts +101 -186
- package/dist/data-grid/violet-data-grid.define.d.ts +7 -0
- package/dist/data-grid/violet-data-grid.define.js +25 -0
- package/dist/data-grid/violet-data-grid.define.js.map +1 -0
- package/dist/data-grid/violet-data-grid.js +872 -642
- package/dist/data-grid/violet-data-grid.js.map +1 -1
- package/dist/data-grid/violet-data-grid.styles.js +710 -684
- package/dist/data-grid/violet-data-grid.styles.js.map +1 -1
- package/dist/data-grid/violet-data-grid.template.d.ts +2 -0
- package/dist/data-grid/violet-data-grid.template.js +356 -0
- package/dist/data-grid/violet-data-grid.template.js.map +1 -0
- package/dist/date-picker/violet-date-picker.d.ts +13 -2
- package/dist/date-picker/violet-date-picker.define.d.ts +7 -0
- package/dist/date-picker/violet-date-picker.define.js +19 -0
- package/dist/date-picker/violet-date-picker.define.js.map +1 -0
- package/dist/date-picker/violet-date-picker.js +312 -234
- package/dist/date-picker/violet-date-picker.js.map +1 -1
- package/dist/date-range-picker/violet-date-range-picker.d.ts +10 -2
- package/dist/date-range-picker/violet-date-range-picker.define.d.ts +7 -0
- package/dist/date-range-picker/violet-date-range-picker.define.js +19 -0
- package/dist/date-range-picker/violet-date-range-picker.define.js.map +1 -0
- package/dist/date-range-picker/violet-date-range-picker.js +216 -184
- package/dist/date-range-picker/violet-date-range-picker.js.map +1 -1
- package/dist/dialog/violet-dialog.d.ts +6 -2
- package/dist/dialog/violet-dialog.define.d.ts +7 -0
- package/dist/dialog/violet-dialog.define.js +19 -0
- package/dist/dialog/violet-dialog.define.js.map +1 -0
- package/dist/dialog/violet-dialog.js +191 -145
- package/dist/dialog/violet-dialog.js.map +1 -1
- package/dist/divider/violet-divider.d.ts +6 -0
- package/dist/divider/violet-divider.define.d.ts +7 -0
- package/dist/divider/violet-divider.define.js +13 -0
- package/dist/divider/violet-divider.define.js.map +1 -0
- package/dist/divider/violet-divider.js +43 -44
- package/dist/divider/violet-divider.js.map +1 -1
- package/dist/empty-state/violet-empty-state.d.ts +6 -1
- package/dist/empty-state/violet-empty-state.define.d.ts +7 -0
- package/dist/empty-state/violet-empty-state.define.js +15 -0
- package/dist/empty-state/violet-empty-state.define.js.map +1 -0
- package/dist/empty-state/violet-empty-state.js +86 -88
- package/dist/empty-state/violet-empty-state.js.map +1 -1
- package/dist/file-explorer/violet-file-explorer.d.ts +7 -8
- package/dist/file-explorer/violet-file-explorer.define.d.ts +7 -0
- package/dist/file-explorer/violet-file-explorer.define.js +33 -0
- package/dist/file-explorer/violet-file-explorer.define.js.map +1 -0
- package/dist/file-explorer/violet-file-explorer.js +210 -222
- package/dist/file-explorer/violet-file-explorer.js.map +1 -1
- package/dist/file-upload/violet-file-upload.d.ts +10 -4
- package/dist/file-upload/violet-file-upload.define.d.ts +7 -0
- package/dist/file-upload/violet-file-upload.define.js +19 -0
- package/dist/file-upload/violet-file-upload.define.js.map +1 -0
- package/dist/file-upload/violet-file-upload.js +383 -308
- package/dist/file-upload/violet-file-upload.js.map +1 -1
- package/dist/foundations/token-registry.js +2 -2
- package/dist/foundations/token-registry.js.map +1 -1
- package/dist/foundations/violet-popover-layer.d.ts +21 -0
- package/dist/foundations/violet-popover-layer.js +94 -0
- package/dist/foundations/violet-popover-layer.js.map +1 -0
- package/dist/gantt/violet-gantt.d.ts +6 -0
- package/dist/gantt/violet-gantt.define.d.ts +7 -0
- package/dist/gantt/violet-gantt.define.js +13 -0
- package/dist/gantt/violet-gantt.define.js.map +1 -0
- package/dist/gantt/violet-gantt.js +17 -15
- package/dist/gantt/violet-gantt.js.map +1 -1
- package/dist/gantt/violet-gantt.styles.js +573 -573
- package/dist/icon/violet-icon.d.ts +7 -0
- package/dist/icon/violet-icon.define.d.ts +7 -0
- package/dist/icon/violet-icon.define.js +13 -0
- package/dist/icon/violet-icon.define.js.map +1 -0
- package/dist/icon/violet-icon.js +29 -30
- package/dist/icon/violet-icon.js.map +1 -1
- package/dist/icon-button/violet-icon-button.d.ts +9 -0
- package/dist/icon-button/violet-icon-button.define.d.ts +7 -0
- package/dist/icon-button/violet-icon-button.define.js +13 -0
- package/dist/icon-button/violet-icon-button.define.js.map +1 -0
- package/dist/icon-button/violet-icon-button.js +135 -120
- package/dist/icon-button/violet-icon-button.js.map +1 -1
- package/dist/image/violet-image.d.ts +6 -0
- package/dist/image/violet-image.define.d.ts +7 -0
- package/dist/image/violet-image.define.js +13 -0
- package/dist/image/violet-image.define.js.map +1 -0
- package/dist/image/violet-image.js +84 -85
- package/dist/image/violet-image.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/listbox/violet-listbox.d.ts +18 -5
- package/dist/listbox/violet-listbox.define.d.ts +7 -0
- package/dist/listbox/violet-listbox.define.js +17 -0
- package/dist/listbox/violet-listbox.define.js.map +1 -0
- package/dist/listbox/violet-listbox.js +288 -135
- package/dist/listbox/violet-listbox.js.map +1 -1
- package/dist/listbox/violet-selection-helpers.d.ts +14 -3
- package/dist/listbox/violet-selection-helpers.js +68 -8
- package/dist/listbox/violet-selection-helpers.js.map +1 -1
- package/dist/menu/violet-menu-item.d.ts +9 -0
- package/dist/menu/violet-menu-item.define.d.ts +7 -0
- package/dist/menu/violet-menu-item.define.js +13 -0
- package/dist/menu/violet-menu-item.define.js.map +1 -0
- package/dist/menu/violet-menu-item.js +77 -78
- package/dist/menu/violet-menu-item.js.map +1 -1
- package/dist/menu/violet-menu.d.ts +8 -0
- package/dist/menu/violet-menu.define.d.ts +7 -0
- package/dist/menu/violet-menu.define.js +13 -0
- package/dist/menu/violet-menu.define.js.map +1 -0
- package/dist/menu/violet-menu.js +94 -83
- package/dist/menu/violet-menu.js.map +1 -1
- package/dist/option/violet-option.d.ts +16 -3
- package/dist/option/violet-option.define.d.ts +7 -0
- package/dist/option/violet-option.define.js +13 -0
- package/dist/option/violet-option.define.js.map +1 -0
- package/dist/option/violet-option.js +181 -126
- package/dist/option/violet-option.js.map +1 -1
- package/dist/option-group/violet-option-group.d.ts +6 -0
- package/dist/option-group/violet-option-group.define.d.ts +7 -0
- package/dist/option-group/violet-option-group.define.js +13 -0
- package/dist/option-group/violet-option-group.define.js.map +1 -0
- package/dist/option-group/violet-option-group.js +27 -28
- package/dist/option-group/violet-option-group.js.map +1 -1
- package/dist/pagination/violet-pagination.d.ts +6 -0
- package/dist/pagination/violet-pagination.define.d.ts +7 -0
- package/dist/pagination/violet-pagination.define.js +13 -0
- package/dist/pagination/violet-pagination.define.js.map +1 -0
- package/dist/pagination/violet-pagination.js +105 -106
- package/dist/pagination/violet-pagination.js.map +1 -1
- package/dist/persona/violet-persona.d.ts +6 -0
- package/dist/persona/violet-persona.define.d.ts +7 -0
- package/dist/persona/violet-persona.define.js +13 -0
- package/dist/persona/violet-persona.define.js.map +1 -0
- package/dist/persona/violet-persona.js +101 -102
- package/dist/persona/violet-persona.js.map +1 -1
- package/dist/popover/violet-popover.d.ts +8 -4
- package/dist/popover/violet-popover.define.d.ts +7 -0
- package/dist/popover/violet-popover.define.js +13 -0
- package/dist/popover/violet-popover.define.js.map +1 -0
- package/dist/popover/violet-popover.js +138 -127
- package/dist/popover/violet-popover.js.map +1 -1
- package/dist/progress/violet-progress.d.ts +7 -0
- package/dist/progress/violet-progress.define.d.ts +7 -0
- package/dist/progress/violet-progress.define.js +13 -0
- package/dist/progress/violet-progress.define.js.map +1 -0
- package/dist/progress/violet-progress.js +118 -114
- package/dist/progress/violet-progress.js.map +1 -1
- package/dist/radio/violet-radio.d.ts +23 -1
- package/dist/radio/violet-radio.define.d.ts +7 -0
- package/dist/radio/violet-radio.define.js +13 -0
- package/dist/radio/violet-radio.define.js.map +1 -0
- package/dist/radio/violet-radio.js +289 -172
- package/dist/radio/violet-radio.js.map +1 -1
- package/dist/radio-group/violet-radio-group.d.ts +11 -1
- package/dist/radio-group/violet-radio-group.define.d.ts +7 -0
- package/dist/radio-group/violet-radio-group.define.js +15 -0
- package/dist/radio-group/violet-radio-group.define.js.map +1 -0
- package/dist/radio-group/violet-radio-group.js +85 -66
- package/dist/radio-group/violet-radio-group.js.map +1 -1
- package/dist/segment/violet-segment.d.ts +9 -0
- package/dist/segment/violet-segment.define.d.ts +7 -0
- package/dist/segment/violet-segment.define.js +13 -0
- package/dist/segment/violet-segment.define.js.map +1 -0
- package/dist/segment/violet-segment.js +74 -75
- package/dist/segment/violet-segment.js.map +1 -1
- package/dist/segmented-control/violet-segmented-control.d.ts +8 -1
- package/dist/segmented-control/violet-segmented-control.define.d.ts +7 -0
- package/dist/segmented-control/violet-segmented-control.define.js +15 -0
- package/dist/segmented-control/violet-segmented-control.define.js.map +1 -0
- package/dist/segmented-control/violet-segmented-control.js +97 -86
- package/dist/segmented-control/violet-segmented-control.js.map +1 -1
- package/dist/select/violet-select.d.ts +17 -4
- package/dist/select/violet-select.define.d.ts +7 -0
- package/dist/select/violet-select.define.js +15 -0
- package/dist/select/violet-select.define.js.map +1 -0
- package/dist/select/violet-select.js +338 -215
- package/dist/select/violet-select.js.map +1 -1
- package/dist/shared/define-element.d.ts +19 -0
- package/dist/shared/define-element.js +28 -0
- package/dist/shared/define-element.js.map +1 -0
- package/dist/shared/field-error.d.ts +13 -0
- package/dist/shared/field-error.js +16 -0
- package/dist/shared/field-error.js.map +1 -0
- package/dist/shared/overlay-anchor.d.ts +37 -0
- package/dist/shared/overlay-anchor.js +75 -0
- package/dist/shared/overlay-anchor.js.map +1 -0
- package/dist/shared/overlay-positioning.d.ts +60 -0
- package/dist/shared/overlay-positioning.js +264 -0
- package/dist/shared/overlay-positioning.js.map +1 -0
- package/dist/skeleton/violet-skeleton.d.ts +6 -0
- package/dist/skeleton/violet-skeleton.define.d.ts +7 -0
- package/dist/skeleton/violet-skeleton.define.js +13 -0
- package/dist/skeleton/violet-skeleton.define.js.map +1 -0
- package/dist/skeleton/violet-skeleton.js +81 -82
- package/dist/skeleton/violet-skeleton.js.map +1 -1
- package/dist/slider/violet-range-slider.d.ts +11 -0
- package/dist/slider/violet-range-slider.define.d.ts +7 -0
- package/dist/slider/violet-range-slider.define.js +13 -0
- package/dist/slider/violet-range-slider.define.js.map +1 -0
- package/dist/slider/violet-range-slider.js +280 -266
- package/dist/slider/violet-range-slider.js.map +1 -1
- package/dist/slider/violet-slider.d.ts +11 -0
- package/dist/slider/violet-slider.define.d.ts +7 -0
- package/dist/slider/violet-slider.define.js +13 -0
- package/dist/slider/violet-slider.define.js.map +1 -0
- package/dist/slider/violet-slider.js +245 -234
- package/dist/slider/violet-slider.js.map +1 -1
- package/dist/snackbar/violet-snackbar.d.ts +9 -4
- package/dist/snackbar/violet-snackbar.define.d.ts +7 -0
- package/dist/snackbar/violet-snackbar.define.js +21 -0
- package/dist/snackbar/violet-snackbar.define.js.map +1 -0
- package/dist/snackbar/violet-snackbar.js +130 -135
- package/dist/snackbar/violet-snackbar.js.map +1 -1
- package/dist/spinner/violet-spinner.d.ts +6 -0
- package/dist/spinner/violet-spinner.define.d.ts +7 -0
- package/dist/spinner/violet-spinner.define.js +13 -0
- package/dist/spinner/violet-spinner.define.js.map +1 -0
- package/dist/spinner/violet-spinner.js +60 -61
- package/dist/spinner/violet-spinner.js.map +1 -1
- package/dist/switch/violet-switch.d.ts +25 -1
- package/dist/switch/violet-switch.define.d.ts +7 -0
- package/dist/switch/violet-switch.define.js +13 -0
- package/dist/switch/violet-switch.define.js.map +1 -0
- package/dist/switch/violet-switch.js +283 -225
- package/dist/switch/violet-switch.js.map +1 -1
- package/dist/tab/violet-tab.d.ts +6 -0
- package/dist/tab/violet-tab.define.d.ts +7 -0
- package/dist/tab/violet-tab.define.js +13 -0
- package/dist/tab/violet-tab.define.js.map +1 -0
- package/dist/tab/violet-tab.js +201 -202
- package/dist/tab/violet-tab.js.map +1 -1
- package/dist/tab-panel/violet-tab-panel.d.ts +6 -0
- package/dist/tab-panel/violet-tab-panel.define.d.ts +7 -0
- package/dist/tab-panel/violet-tab-panel.define.js +13 -0
- package/dist/tab-panel/violet-tab-panel.define.js.map +1 -0
- package/dist/tab-panel/violet-tab-panel.js +30 -31
- package/dist/tab-panel/violet-tab-panel.js.map +1 -1
- package/dist/tabs/violet-tabs.d.ts +6 -0
- package/dist/tabs/violet-tabs.define.d.ts +7 -0
- package/dist/tabs/violet-tabs.define.js +17 -0
- package/dist/tabs/violet-tabs.define.js.map +1 -0
- package/dist/tabs/violet-tabs.js +78 -76
- package/dist/tabs/violet-tabs.js.map +1 -1
- package/dist/teaching-tip/violet-teaching-tip.d.ts +8 -2
- package/dist/teaching-tip/violet-teaching-tip.define.d.ts +7 -0
- package/dist/teaching-tip/violet-teaching-tip.define.js +19 -0
- package/dist/teaching-tip/violet-teaching-tip.define.js.map +1 -0
- package/dist/teaching-tip/violet-teaching-tip.js +178 -133
- package/dist/teaching-tip/violet-teaching-tip.js.map +1 -1
- package/dist/text/violet-text.d.ts +9 -0
- package/dist/text/violet-text.define.d.ts +7 -0
- package/dist/text/violet-text.define.js +13 -0
- package/dist/text/violet-text.define.js.map +1 -0
- package/dist/text/violet-text.js +77 -78
- package/dist/text/violet-text.js.map +1 -1
- package/dist/text-area/violet-text-area.d.ts +28 -1
- package/dist/text-area/violet-text-area.define.d.ts +7 -0
- package/dist/text-area/violet-text-area.define.js +13 -0
- package/dist/text-area/violet-text-area.define.js.map +1 -0
- package/dist/text-area/violet-text-area.js +202 -136
- package/dist/text-area/violet-text-area.js.map +1 -1
- package/dist/text-field/violet-text-field.d.ts +28 -1
- package/dist/text-field/violet-text-field.define.d.ts +7 -0
- package/dist/text-field/violet-text-field.define.js +13 -0
- package/dist/text-field/violet-text-field.define.js.map +1 -0
- package/dist/text-field/violet-text-field.js +205 -141
- package/dist/text-field/violet-text-field.js.map +1 -1
- package/dist/theme/generated/violet-theme.generated.d.ts +32 -14
- package/dist/theme/generated/violet-theme.generated.js +20 -14
- package/dist/theme/generated/violet-theme.generated.js.map +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/violet-theme-nodes.d.ts +12 -0
- package/dist/theme/violet-theme-nodes.js +20 -0
- package/dist/theme/violet-theme-nodes.js.map +1 -0
- package/dist/theme/violet-theme-runtime.d.ts +25 -15
- package/dist/theme/violet-theme-runtime.js +149 -67
- package/dist/theme/violet-theme-runtime.js.map +1 -1
- package/dist/theme/violet-theme.d.ts +6 -0
- package/dist/theme/violet-theme.define.d.ts +7 -0
- package/dist/theme/violet-theme.define.js +13 -0
- package/dist/theme/violet-theme.define.js.map +1 -0
- package/dist/theme/violet-theme.js +11 -11
- package/dist/theme/violet-theme.js.map +1 -1
- package/dist/theme/violet-token-defaults.js +183 -181
- package/dist/theme/violet-token-defaults.js.map +1 -1
- package/dist/time-picker/violet-time-picker.d.ts +14 -1
- package/dist/time-picker/violet-time-picker.define.d.ts +7 -0
- package/dist/time-picker/violet-time-picker.define.js +17 -0
- package/dist/time-picker/violet-time-picker.define.js.map +1 -0
- package/dist/time-picker/violet-time-picker.js +211 -164
- package/dist/time-picker/violet-time-picker.js.map +1 -1
- package/dist/toast/violet-toast.d.ts +9 -4
- package/dist/toast/violet-toast.define.d.ts +7 -0
- package/dist/toast/violet-toast.define.js +21 -0
- package/dist/toast/violet-toast.define.js.map +1 -0
- package/dist/toast/violet-toast.js +147 -154
- package/dist/toast/violet-toast.js.map +1 -1
- package/dist/tooltip/violet-tooltip.d.ts +8 -0
- package/dist/tooltip/violet-tooltip.define.d.ts +7 -0
- package/dist/tooltip/violet-tooltip.define.js +13 -0
- package/dist/tooltip/violet-tooltip.define.js.map +1 -0
- package/dist/tooltip/violet-tooltip.js +118 -93
- package/dist/tooltip/violet-tooltip.js.map +1 -1
- package/dist/tree/violet-tree.d.ts +9 -2
- package/dist/tree/violet-tree.define.d.ts +7 -0
- package/dist/tree/violet-tree.define.js +15 -0
- package/dist/tree/violet-tree.define.js.map +1 -0
- package/dist/tree/violet-tree.js +87 -77
- package/dist/tree/violet-tree.js.map +1 -1
- package/dist/tree-item/violet-tree-item.d.ts +6 -1
- package/dist/tree-item/violet-tree-item.define.d.ts +7 -0
- package/dist/tree-item/violet-tree-item.define.js +17 -0
- package/dist/tree-item/violet-tree-item.define.js.map +1 -0
- package/dist/tree-item/violet-tree-item.js +120 -124
- package/dist/tree-item/violet-tree-item.js.map +1 -1
- package/package.json +805 -9
- package/tokens/interface.json +9 -1
- package/tokens/raw-palette.proposal.jsonc +46 -28
- package/tokens/violet-theme.export.json +38 -14
- package/tokens/master-semantic.tokens.jsonc +0 -7
- package/tokens/theme-presets.jsonc +0 -7
|
@@ -1,355 +1,27 @@
|
|
|
1
|
-
import { attr, FASTElement,
|
|
1
|
+
import { attr, FASTElement, observable, Updates } from "@lushly-dev/fast-element";
|
|
2
2
|
import { elementScroll, observeElementOffset, observeElementRect, Virtualizer, } from "@tanstack/virtual-core";
|
|
3
|
-
import "../checkbox/violet-checkbox";
|
|
4
|
-
import "../icon/violet-icon";
|
|
5
|
-
import "../radio/violet-radio";
|
|
6
|
-
import "../text-field/violet-text-field";
|
|
7
|
-
import { registerSystemSortAscendingIcon } from "../icon/generated/icons/system-sort-ascending";
|
|
8
|
-
import { registerSystemSortDescendingIcon } from "../icon/generated/icons/system-sort-descending";
|
|
9
|
-
import { logicalArrowKey } from "../foundations/violet-direction";
|
|
10
3
|
import { styles } from "./violet-data-grid.styles";
|
|
4
|
+
import { template } from "./violet-data-grid.template";
|
|
5
|
+
import { handleGridClickEvent, handleGridFocusInEvent, handleGridKeydownEvent, } from "./violet-data-grid-cell-keyboard";
|
|
11
6
|
import { resolveCellPartText as composeCellPartText, isCellSelected as computeIsCellSelected, isFillPreviewCell as computeIsFillPreviewCell, rangeEdgeForCell as computeRangeEdgeForCell, } from "./violet-data-grid-cell-state";
|
|
12
|
-
import { defaultCellContentTemplate, inputCellEditorTemplate, selectCellEditorTemplate, } from "./violet-data-grid-cell-templates";
|
|
13
7
|
import { copyTextForSelection, normalizePastedText as normalizeGridPastedText, resolvePasteOriginLocation, sampleAutosizeRows, } from "./violet-data-grid-clipboard";
|
|
14
8
|
import { cellValueFor as resolveCellValue, editorOptionsForColumn as resolveEditorOptionsForColumn, serializeCellValue as serializeGridCellValue, sortRows as sortGridRows, stringifyCellValue, } from "./violet-data-grid-data";
|
|
15
9
|
import { beginEditingState, cancelEditingState as clearEditingState, editorStringValue, focusEditorAtEnd, seedEditorValue, } from "./violet-data-grid-editing";
|
|
16
10
|
import { cellElementFromEvent, cellElementFromTarget as eventCellElementFromTarget, closestFromEventPath as eventClosestFromEventPath, } from "./violet-data-grid-events";
|
|
17
11
|
import { buildFillChanges, buildPasteChanges, clampFillBoundsToEditableTargets as clampEditableFillBounds, hasEditableCellsInBounds, } from "./violet-data-grid-fill";
|
|
12
|
+
import { findFocusedSelectionControl, isDocumentFocusAvailableForGrid, isGridCellElementNode, scrollCellIntoScrollContainer, selectionControlRowIdFromElement, suspendRovingCellTabStops, } from "./violet-data-grid-focus-recovery";
|
|
18
13
|
import { locationFromCellElement as geometryLocationFromCellElement, nearestLocationForPoint as nearestGeometryLocationForPoint, preferredAxisForPoint, rectFromCellPair, } from "./violet-data-grid-geometry";
|
|
14
|
+
import { handleColumnHeaderKeydownEvent, handleColumnResizeKeyDownEvent, handleSelectionHeaderKeydownEvent, } from "./violet-data-grid-header-nav";
|
|
19
15
|
import { createCellSelection as createNavigationCellSelection, firstCellLocation as resolveNavigationFirstCellLocation, nextCellLocationForKey as resolveNextCellLocationForKey, } from "./violet-data-grid-navigation";
|
|
20
16
|
import { clearedFillSession, clearedPointerSelectionSession, isFillPointerEventForSession, isPointerSelectionEventForSession, markPointerSelectionMoved, pointerSelectionSuppressesNextClick, beginFillDrag as startFillDragSession, beginPointerSelection as startPointerSelectionSession, } from "./violet-data-grid-pointer";
|
|
21
17
|
import { createPresentedColumn as buildPresentedColumn, createPresentedRow as buildPresentedRow, syncEditingState, syncActiveCell as syncPresentedActiveCell, syncCellSelection as syncPresentedCellSelection, syncFillPreview as syncPresentedFillPreview, } from "./violet-data-grid-presentation";
|
|
22
|
-
import { clearedColumnResizeSession,
|
|
18
|
+
import { clearedColumnResizeSession, resizedColumnWidth as computeResizedColumnWidth, isColumnResizeEventForSession, beginColumnResize as startColumnResizeSession, } from "./violet-data-grid-resize";
|
|
19
|
+
import { customCellWidgetsInCellElement, findCustomCellWidgetFromTarget, focusRowModeControlInShadow, handleCustomCellWidgetKeydownEvent, handleRowModeBodyKeydownEvent, handleSelectionCellKeydownEvent, syncCustomCellWidgetTabIndexesInShadow, } from "./violet-data-grid-roving-focus";
|
|
23
20
|
import { nextTabLocation, selectedLocations, locationForIndices as selectionLocationForIndices, rangeFromBounds as selectionRangeFromBounds, } from "./violet-data-grid-selection";
|
|
24
|
-
import { autosizedColumnWidth as computeAutosizedColumnWidth,
|
|
21
|
+
import { autosizedColumnWidth as computeAutosizedColumnWidth, minimumColumnWidth as computeMinimumColumnWidth, renderedColumnWidth as computeRenderedColumnWidth, resolvedColumnWidth as resolveGridColumnWidth, } from "./violet-data-grid-sizing";
|
|
25
22
|
import { isEditorElement as isGridEditorElement, isFillHandleTarget as isGridFillHandleTarget, isInteractiveCellWidgetTarget as isGridInteractiveCellWidgetTarget, } from "./violet-data-grid-targets";
|
|
26
23
|
import { opensOnSingleActiveClick as editorOpensOnSingleActiveClick, editStringForRawValue, booleanCellValue as normalizeBooleanCellValue, normalizedEditingValue as normalizeEditingValue, resolveEditingValue, } from "./violet-data-grid-values";
|
|
27
24
|
import { buildVirtualizerUpdateOptions, buildRenderedRows as computeRenderedRows, } from "./violet-data-grid-virtualization";
|
|
28
|
-
registerSystemSortAscendingIcon();
|
|
29
|
-
registerSystemSortDescendingIcon();
|
|
30
|
-
const bodyRowTemplate = html `
|
|
31
|
-
<tr
|
|
32
|
-
part="row"
|
|
33
|
-
data-index="${(x) => String(x.item.index)}"
|
|
34
|
-
data-selected="${(x, c) => String(c.parent.isRowSelected(x.row.id))}"
|
|
35
|
-
data-row-index="${(x) => String(x.item.index)}"
|
|
36
|
-
aria-rowindex="${(x) => String(x.item.index + 2)}"
|
|
37
|
-
aria-selected="${(x, c) => c.parent.selectionMode === "none" ? null : String(c.parent.isRowSelected(x.row.id))}"
|
|
38
|
-
>
|
|
39
|
-
<td
|
|
40
|
-
class="selection-cell"
|
|
41
|
-
part="cell"
|
|
42
|
-
headers="${(_x, c) => c.parent.selectionHeaderId}"
|
|
43
|
-
?hidden="${(x, c) => c.parent.selectionMode === "none"}"
|
|
44
|
-
>
|
|
45
|
-
${when((x, c) => c.parent.selectionMode === "single", html `
|
|
46
|
-
<violet-radio
|
|
47
|
-
class="selection-radio"
|
|
48
|
-
inline
|
|
49
|
-
value="${(x) => x.row.id}"
|
|
50
|
-
name="${(x, c) => c.parent.selectionControlName}"
|
|
51
|
-
aria-label="${(x, c) => c.parent.selectionLabelFor(x.row.id, x.row.label)}"
|
|
52
|
-
:checked="${(x, c) => c.parent.isRowSelected(x.row.id)}"
|
|
53
|
-
@pointerdown="${(x, c) => c.parent.handleSelectionControlPointerDown(c.event)}"
|
|
54
|
-
@click="${(x, c) => c.parent.handleSelectionControlClick(c.event)}"
|
|
55
|
-
@change="${(x, c) => c.parent.handleRowSelection(x.row.id, c.event)}"
|
|
56
|
-
></violet-radio>
|
|
57
|
-
`)}
|
|
58
|
-
${when((x, c) => c.parent.selectionMode === "multiple", html `
|
|
59
|
-
<violet-checkbox
|
|
60
|
-
class="selection-checkbox"
|
|
61
|
-
inline
|
|
62
|
-
aria-label="${(x, c) => c.parent.selectionLabelFor(x.row.id, x.row.label)}"
|
|
63
|
-
:checked="${(x, c) => c.parent.isRowSelected(x.row.id)}"
|
|
64
|
-
@pointerdown="${(x, c) => c.parent.handleSelectionControlPointerDown(c.event)}"
|
|
65
|
-
@click="${(x, c) => c.parent.handleRowCheckboxClick(x.row.id, c.event)}"
|
|
66
|
-
></violet-checkbox>
|
|
67
|
-
`)}
|
|
68
|
-
</td>
|
|
69
|
-
${repeat((x) => x.row.cells, html `
|
|
70
|
-
<td
|
|
71
|
-
id="${(x) => x.cellId}"
|
|
72
|
-
headers="${(x, c) => c.parentContext.parent.columnHeaderIdFor(x.columnId)}"
|
|
73
|
-
part="${(x) => x.resolvedCellPartText}"
|
|
74
|
-
data-align="${(x) => x.align}"
|
|
75
|
-
data-row-id="${(x) => x.rowId}"
|
|
76
|
-
data-column-id="${(x) => x.columnId}"
|
|
77
|
-
data-active="${(x) => String(x.active)}"
|
|
78
|
-
data-selected="${(x) => String(x.selected)}"
|
|
79
|
-
data-fill-preview="${(x) => String(x.fillPreview)}"
|
|
80
|
-
data-editing="${(x) => String(x.editing)}"
|
|
81
|
-
data-range-edge="${(x) => x.rangeEdge}"
|
|
82
|
-
style="${(x) => x.widthStyle}"
|
|
83
|
-
>
|
|
84
|
-
${when((x) => x.editing && (x.editor === "text" || x.editor === "number"), html `
|
|
85
|
-
<span class="cell-sizing-content" aria-hidden="true">
|
|
86
|
-
${render((x) => x, (x) => x.cellTemplate ?? defaultCellContentTemplate)}
|
|
87
|
-
</span>
|
|
88
|
-
${inputCellEditorTemplate}
|
|
89
|
-
`)}
|
|
90
|
-
${when((x) => x.editing && x.editor === "select", html `
|
|
91
|
-
<span class="cell-sizing-content" aria-hidden="true">
|
|
92
|
-
${render((x) => x, (x) => x.cellTemplate ?? defaultCellContentTemplate)}
|
|
93
|
-
</span>
|
|
94
|
-
${selectCellEditorTemplate}
|
|
95
|
-
`)}
|
|
96
|
-
${when((x) => x.editing && x.editor === "custom", html `
|
|
97
|
-
<span class="cell-sizing-content" aria-hidden="true">
|
|
98
|
-
${render((x) => x, (x) => x.cellTemplate ?? defaultCellContentTemplate)}
|
|
99
|
-
</span>
|
|
100
|
-
${render((x) => x, (x) => x.editorTemplate ?? defaultCellContentTemplate)}
|
|
101
|
-
`)}
|
|
102
|
-
${when((x) => !x.editing && x.editor === "checkbox", html `
|
|
103
|
-
<span class="cell-widget" data-align="${(x) => x.align}">
|
|
104
|
-
<violet-checkbox
|
|
105
|
-
class="cell-checkbox"
|
|
106
|
-
data-cell-widget="checkbox"
|
|
107
|
-
inline
|
|
108
|
-
aria-label="${(x) => `${x.columnLabel} for ${x.rowLabel}`}"
|
|
109
|
-
:checked="${(x) => normalizeBooleanCellValue(x.rawValue)}"
|
|
110
|
-
?disabled="${(x) => !x.editable}"
|
|
111
|
-
@click="${(x, c) => c.parentContext.parent.handleCellCheckboxClick(x.rowId, x.columnId, c.event)}"
|
|
112
|
-
></violet-checkbox>
|
|
113
|
-
</span>
|
|
114
|
-
`)}
|
|
115
|
-
${when((x) => x.editing && Boolean(x.editingError), html `
|
|
116
|
-
<span
|
|
117
|
-
class="cell-editor-error"
|
|
118
|
-
id="${(x) => x.editingErrorId}"
|
|
119
|
-
role="alert"
|
|
120
|
-
>${(x) => x.editingError}</span>
|
|
121
|
-
`)}
|
|
122
|
-
${when((x) => x.editing && Boolean(x.editingHint), html `
|
|
123
|
-
<span class="cell-editor-hint" id="${(x) => x.editingHintId}"
|
|
124
|
-
>${(x) => x.editingHint}</span>
|
|
125
|
-
`)}
|
|
126
|
-
${when((x) => !x.editing && x.editor !== "checkbox", html `
|
|
127
|
-
${render((x) => x, (x) => x.cellTemplate ?? defaultCellContentTemplate)}
|
|
128
|
-
`)}
|
|
129
|
-
${when((x, c) => c.parentContext.parent.shouldShowFillHandleForCell(x.rowId, x.columnId), html `
|
|
130
|
-
<span class="fill-handle" data-fill-handle="true" aria-hidden="true"></span>
|
|
131
|
-
`)}
|
|
132
|
-
</td>
|
|
133
|
-
`)}
|
|
134
|
-
</tr>
|
|
135
|
-
`;
|
|
136
|
-
const fullTableTemplate = html `
|
|
137
|
-
<div class="table-canvas" style="--_virtual-total-size:${(x) => `${x.virtualTotalSize}px`};">
|
|
138
|
-
<table
|
|
139
|
-
class="table-full-table"
|
|
140
|
-
part="table"
|
|
141
|
-
aria-rowcount="${(x) => String(x.logicalRowCount)}"
|
|
142
|
-
aria-colcount="${(x) => String(x.logicalColumnCount)}"
|
|
143
|
-
>
|
|
144
|
-
<colgroup>
|
|
145
|
-
<!-- With selection off the selection cells are hidden, so the column is hidden too: a hidden <col>
|
|
146
|
-
creates no column slot, and a visible one would shift every cell one slot to the left. -->
|
|
147
|
-
<col
|
|
148
|
-
class="selection-column"
|
|
149
|
-
?hidden="${(x) => x.selectionMode === "none"}"
|
|
150
|
-
style="width:var(--_selection-column-size);inline-size:var(--_selection-column-size);min-inline-size:var(--_selection-column-size);max-inline-size:var(--_selection-column-size);"
|
|
151
|
-
/>
|
|
152
|
-
${repeat((x) => x.presentedColumns, html `
|
|
153
|
-
<col data-column-id="${(x) => x.id}" style="${(x) => x.widthStyle}" />
|
|
154
|
-
`)}
|
|
155
|
-
</colgroup>
|
|
156
|
-
<thead part="head">
|
|
157
|
-
<tr part="header-row">
|
|
158
|
-
<th
|
|
159
|
-
id="${(x) => x.selectionHeaderId}"
|
|
160
|
-
class="selection-header"
|
|
161
|
-
part="header-cell selection-header-cell"
|
|
162
|
-
scope="col"
|
|
163
|
-
aria-label="${(x) => x.selectionHeaderLabel}"
|
|
164
|
-
?hidden="${(x) => x.selectionMode === "none"}"
|
|
165
|
-
>
|
|
166
|
-
<span class="visually-hidden">${(x) => x.selectionHeaderLabel}</span>
|
|
167
|
-
${when((x) => x.selectionMode === "multiple" && x.presentedRows.length > 0, html `
|
|
168
|
-
<violet-checkbox
|
|
169
|
-
class="selection-checkbox"
|
|
170
|
-
inline
|
|
171
|
-
aria-label="Select all rows"
|
|
172
|
-
:checked="${(x) => x.allRowsSelected}"
|
|
173
|
-
:indeterminate="${(x) => x.partiallySelected}"
|
|
174
|
-
@pointerdown="${(x, c) => x.handleSelectionControlPointerDown(c.event)}"
|
|
175
|
-
@click="${(x, c) => x.handleToggleAllCheckboxClick(c.event)}"
|
|
176
|
-
></violet-checkbox>
|
|
177
|
-
`)}
|
|
178
|
-
</th>
|
|
179
|
-
${repeat((x) => x.presentedColumns, html `
|
|
180
|
-
<th
|
|
181
|
-
id="${(x, c) => c.parent.columnHeaderIdFor(x.id)}"
|
|
182
|
-
part="${(x) => x.headerPartText}"
|
|
183
|
-
scope="col"
|
|
184
|
-
data-column-id="${(x) => x.id}"
|
|
185
|
-
data-align="${(x) => x.align}"
|
|
186
|
-
aria-sort="${(x, c) => c.parent.sortStateFor(x.id)}"
|
|
187
|
-
style="${(x) => x.widthStyle}"
|
|
188
|
-
tabindex="${(x, c) => (x.sortable ? null : c.parent.columnHeaderTabIndexFor(x.id))}"
|
|
189
|
-
aria-keyshortcuts="${(x) => (x.sortable ? null : columnResizeKeyShortcut)}"
|
|
190
|
-
@keydown="${(x, c) => c.parent.handleColumnHeaderKeydown(x.id, c.event)}"
|
|
191
|
-
@focusin="${(x, c) => c.parent.handleColumnHeaderFocus(x.id, c.event)}"
|
|
192
|
-
>
|
|
193
|
-
${when((x) => x.sortable, html `
|
|
194
|
-
<button
|
|
195
|
-
class="header-button"
|
|
196
|
-
type="button"
|
|
197
|
-
tabindex="${(x, c) => c.parent.columnHeaderTabIndexFor(x.id)}"
|
|
198
|
-
aria-keyshortcuts="${() => columnResizeKeyShortcut}"
|
|
199
|
-
@click="${(x, c) => c.parent.handleSortRequest(x.id)}"
|
|
200
|
-
>
|
|
201
|
-
<span class="header-label">${(x) => x.label}</span>
|
|
202
|
-
<violet-icon
|
|
203
|
-
class="sort-indicator"
|
|
204
|
-
data-sorted="${(x, c) => String(c.parent.isSortedColumn(x.id))}"
|
|
205
|
-
icon="${(x, c) => c.parent.sortIconNameFor(x.id)}"
|
|
206
|
-
decorative
|
|
207
|
-
></violet-icon>
|
|
208
|
-
</button>
|
|
209
|
-
`)}
|
|
210
|
-
${when((x) => !x.sortable, html `
|
|
211
|
-
<span class="header-label">${(x) => x.label}</span>
|
|
212
|
-
`)}
|
|
213
|
-
<button
|
|
214
|
-
class="column-resizer"
|
|
215
|
-
type="button"
|
|
216
|
-
tabindex="-1"
|
|
217
|
-
aria-label="${(x) => `Resize ${x.label} column`}"
|
|
218
|
-
data-column-resizer="${(x) => x.id}"
|
|
219
|
-
@pointerdown="${(x, c) => c.parent.handleColumnResizePointerDown(x.id, c.event)}"
|
|
220
|
-
@pointermove="${(x, c) => c.parent.handleColumnResizePointerMove(c.event)}"
|
|
221
|
-
@pointerup="${(x, c) => c.parent.handleColumnResizePointerUp(c.event)}"
|
|
222
|
-
@pointercancel="${(x, c) => c.parent.handleColumnResizePointerCancel(c.event)}"
|
|
223
|
-
@dblclick="${(x, c) => c.parent.handleColumnResizeDoubleClick(x.id, c.event)}"
|
|
224
|
-
@keydown="${(x, c) => c.parent.handleColumnResizeKeyDown(x.id, c.event)}"
|
|
225
|
-
></button>
|
|
226
|
-
</th>
|
|
227
|
-
`)}
|
|
228
|
-
</tr>
|
|
229
|
-
</thead>
|
|
230
|
-
<tbody part="body">
|
|
231
|
-
<tr
|
|
232
|
-
class="virtual-spacer-row"
|
|
233
|
-
aria-hidden="true"
|
|
234
|
-
?hidden="${(x) => !x.virtualize || x.virtualPaddingStart <= 0}"
|
|
235
|
-
>
|
|
236
|
-
<td
|
|
237
|
-
colspan="${(x) => String(x.columnSpan)}"
|
|
238
|
-
style="block-size:${(x) => `${x.virtualPaddingStart}px`};"
|
|
239
|
-
></td>
|
|
240
|
-
</tr>
|
|
241
|
-
${repeat((x) => x.renderedRows, bodyRowTemplate)}
|
|
242
|
-
<tr
|
|
243
|
-
class="virtual-spacer-row"
|
|
244
|
-
aria-hidden="true"
|
|
245
|
-
?hidden="${(x) => !x.virtualize || x.virtualPaddingEnd <= 0}"
|
|
246
|
-
>
|
|
247
|
-
<td
|
|
248
|
-
colspan="${(x) => String(x.columnSpan)}"
|
|
249
|
-
style="block-size:${(x) => `${x.virtualPaddingEnd}px`};"
|
|
250
|
-
></td>
|
|
251
|
-
</tr>
|
|
252
|
-
</tbody>
|
|
253
|
-
</table>
|
|
254
|
-
</div>
|
|
255
|
-
`;
|
|
256
|
-
const template = html `
|
|
257
|
-
<div class="grid-shell">
|
|
258
|
-
${when((x) => x.shouldShowToolbar, html `
|
|
259
|
-
<div class="toolbar" part="toolbar">
|
|
260
|
-
${when((x) => x.showsBuiltInFilter, html `
|
|
261
|
-
<div class="filter-shell">
|
|
262
|
-
<violet-text-field
|
|
263
|
-
class="filter-field"
|
|
264
|
-
aria-label="Filter rows"
|
|
265
|
-
type="search"
|
|
266
|
-
:value="${(x) => x.filterState.query ?? ""}"
|
|
267
|
-
placeholder="Filter visible rows"
|
|
268
|
-
@input="${(x, c) => x.handleFilterInput(c.event)}"
|
|
269
|
-
></violet-text-field>
|
|
270
|
-
</div>
|
|
271
|
-
`)}
|
|
272
|
-
${when((x) => x.focusMode === "cell", html `
|
|
273
|
-
<div class="fill-actions" role="group" aria-label="Fill selection">
|
|
274
|
-
<button class="fill-action" type="button"
|
|
275
|
-
?disabled="${(x) => !x.canFillSelection("down")}"
|
|
276
|
-
@click="${(x) => x.handleFillAction("down")}"
|
|
277
|
-
>Fill down</button>
|
|
278
|
-
<button class="fill-action" type="button"
|
|
279
|
-
?disabled="${(x) => !x.canFillSelection("right")}"
|
|
280
|
-
@click="${(x) => x.handleFillAction("right")}"
|
|
281
|
-
>Fill right</button>
|
|
282
|
-
<span class="fill-status" role="status" aria-live="polite" aria-atomic="true"
|
|
283
|
-
>${(x) => x.fillAnnouncement}</span>
|
|
284
|
-
</div>
|
|
285
|
-
`)}
|
|
286
|
-
<div class="toolbar-meta">
|
|
287
|
-
<span>${(x) => x.rowSummary}</span>
|
|
288
|
-
<div class="toolbar-slot">
|
|
289
|
-
<slot
|
|
290
|
-
name="toolbar"
|
|
291
|
-
@slotchange="${(x, c) => x.handleToolbarSlotChange(c.event)}"
|
|
292
|
-
></slot>
|
|
293
|
-
</div>
|
|
294
|
-
</div>
|
|
295
|
-
</div>
|
|
296
|
-
`)}
|
|
297
|
-
|
|
298
|
-
<slot class="default-slot"></slot>
|
|
299
|
-
|
|
300
|
-
<div class="table-region">
|
|
301
|
-
<div
|
|
302
|
-
class="edit-status"
|
|
303
|
-
part="edit-status"
|
|
304
|
-
role="status"
|
|
305
|
-
aria-live="polite"
|
|
306
|
-
aria-atomic="true"
|
|
307
|
-
>${(x) => x.editAnnouncement}</div>
|
|
308
|
-
${when((x) => x.presentedRows.length > 0, html `
|
|
309
|
-
<div
|
|
310
|
-
class="table-scroll"
|
|
311
|
-
role="${(x) => (x.getAttribute("aria-label") ? "group" : null)}"
|
|
312
|
-
aria-label="${(x) => x.getAttribute("aria-label")}"
|
|
313
|
-
tabindex="${(x) => (x.focusMode === "cell" ? "0" : "-1")}"
|
|
314
|
-
aria-describedby="${(x) => (x.focusMode === "cell" ? x.activeCellLabelId : null)}"
|
|
315
|
-
aria-keyshortcuts="${(x) => (x.focusMode === "cell" ? columnResizeKeyShortcut : null)}"
|
|
316
|
-
@focus="${(x) => x.handleGridFocus()}"
|
|
317
|
-
@click="${(x, c) => x.handleGridClick(c.event)}"
|
|
318
|
-
@dblclick="${(x, c) => x.handleGridDoubleClick(c.event)}"
|
|
319
|
-
@pointerdown="${(x, c) => x.handleGridPointerDown(c.event)}"
|
|
320
|
-
@pointermove="${(x, c) => x.handleGridPointerMove(c.event)}"
|
|
321
|
-
@pointerup="${(x, c) => x.handleGridPointerUp(c.event)}"
|
|
322
|
-
@pointercancel="${(x, c) => x.handleGridPointerCancel(c.event)}"
|
|
323
|
-
@focusout="${(x, c) => x.handleGridFocusOut(c.event)}"
|
|
324
|
-
@input="${(x, c) => x.handleGridInput(c.event)}"
|
|
325
|
-
@change="${(x, c) => x.handleGridChange(c.event)}"
|
|
326
|
-
@copy="${(x, c) => x.handleGridCopy(c.event)}"
|
|
327
|
-
@paste="${(x, c) => x.handleGridPaste(c.event)}"
|
|
328
|
-
@keydown="${(x, c) => x.handleGridKeydown(c.event)}"
|
|
329
|
-
>
|
|
330
|
-
${when((x) => x.focusMode === "cell", html `
|
|
331
|
-
<span class="visually-hidden" id="${(x) => x.activeCellLabelId}">
|
|
332
|
-
${(x) => x.activeCellDescription}
|
|
333
|
-
</span>
|
|
334
|
-
`)}
|
|
335
|
-
${fullTableTemplate}
|
|
336
|
-
</div>
|
|
337
|
-
`)}
|
|
338
|
-
|
|
339
|
-
${when((x) => x.presentedRows.length === 0 && !x.busy, html `
|
|
340
|
-
<div class="empty-state" part="empty-state">
|
|
341
|
-
<slot name="empty">No rows available.</slot>
|
|
342
|
-
</div>
|
|
343
|
-
`)}
|
|
344
|
-
|
|
345
|
-
${when((x) => x.busy, html `
|
|
346
|
-
<div class="loading-overlay" part="loading-state">
|
|
347
|
-
<slot name="loading">Loading rows...</slot>
|
|
348
|
-
</div>
|
|
349
|
-
`)}
|
|
350
|
-
</div>
|
|
351
|
-
</div>
|
|
352
|
-
`;
|
|
353
25
|
/**
|
|
354
26
|
* Violet reusable data grid component.
|
|
355
27
|
*
|
|
@@ -367,11 +39,15 @@ const template = html `
|
|
|
367
39
|
* @fires edit-start - Emitted when a cell enters edit mode.
|
|
368
40
|
* @fires edit-cancel - Emitted when a cell edit is cancelled.
|
|
369
41
|
* @fires cell-change - Emitted when a cell edit is committed.
|
|
370
|
-
* @remarks
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
42
|
+
* @remarks In cell focus mode the table exposes `role="grid"` with `aria-multiselectable="true"` and
|
|
43
|
+
* `role="gridcell"` on body cells, using roving `tabindex` on real cells so the grid adds one Tab stop
|
|
44
|
+
* regardless of row count, selection columns or checkbox columns. Arrow keys, Home and End move focus
|
|
45
|
+
* between cells (including selection cells, which toggle with Space); ArrowUp from the first row moves
|
|
46
|
+
* focus to the column header (and ArrowLeft/Home reaches select-all), ArrowDown returns to the first row,
|
|
47
|
+
* and Shift+Tab returns to the active cell. When the active virtualized row unmounts, `.table-scroll`
|
|
48
|
+
* becomes the single Tab stop and focusing it scrolls the active cell back into view. In row focus mode
|
|
49
|
+
* native table semantics are kept, headers share one roving Tab stop (including select-all) and interactive
|
|
50
|
+
* selection/checkbox controls in the body share at most one roving Tab stop. Enter or Space on a sortable
|
|
375
51
|
* header sorts it. Column resizers are not Tab stops: Ctrl+Alt+R on any column header, or on the active
|
|
376
52
|
* cell in cell focus mode, moves focus to that column's resizer. ArrowLeft/ArrowRight resize it (Shift for
|
|
377
53
|
* larger steps), Enter autosizes it and Escape returns focus to where it came from.
|
|
@@ -409,6 +85,8 @@ export class VioletDataGrid extends FASTElement {
|
|
|
409
85
|
#rowMeasurementFrame;
|
|
410
86
|
#pointerSelectionSession;
|
|
411
87
|
#suppressNextGridClick;
|
|
88
|
+
#editorPointerId;
|
|
89
|
+
#handleEditorPointerEnd;
|
|
412
90
|
#nativeCopyPending;
|
|
413
91
|
#fillSession;
|
|
414
92
|
#columnResizeReturnTarget;
|
|
@@ -435,6 +113,14 @@ export class VioletDataGrid extends FASTElement {
|
|
|
435
113
|
#editorRecycleFocusFrame;
|
|
436
114
|
#focusGeneration;
|
|
437
115
|
#selectionControlFocusRevision;
|
|
116
|
+
#cellFocusRecoveryRevision;
|
|
117
|
+
#pendingCellFocusRevision;
|
|
118
|
+
#pendingGridFocus;
|
|
119
|
+
#pendingRowModeFocus;
|
|
120
|
+
#pendingRowModeFocusRevision;
|
|
121
|
+
#managedCustomWidgetTabIndexes;
|
|
122
|
+
#parkingFocusOnScrollContainer;
|
|
123
|
+
#hostAriaObserver;
|
|
438
124
|
#editorRestoreFrame;
|
|
439
125
|
#editingEditorElement;
|
|
440
126
|
#nextEditingSessionId;
|
|
@@ -450,6 +136,9 @@ export class VioletDataGrid extends FASTElement {
|
|
|
450
136
|
this.#rowMeasurementFrame = null;
|
|
451
137
|
this.#pointerSelectionSession = clearedPointerSelectionSession();
|
|
452
138
|
this.#suppressNextGridClick = false;
|
|
139
|
+
this.#editorPointerId = null;
|
|
140
|
+
this.#handleEditorPointerEnd = (e) => { if (e.pointerId === this.#editorPointerId)
|
|
141
|
+
this.#editorPointerId = null; };
|
|
453
142
|
this.#nativeCopyPending = false;
|
|
454
143
|
this.#fillSession = clearedFillSession();
|
|
455
144
|
this.#columnResizeReturnTarget = null;
|
|
@@ -476,6 +165,14 @@ export class VioletDataGrid extends FASTElement {
|
|
|
476
165
|
this.#editorRecycleFocusFrame = null;
|
|
477
166
|
this.#focusGeneration = 0;
|
|
478
167
|
this.#selectionControlFocusRevision = 0;
|
|
168
|
+
this.#cellFocusRecoveryRevision = 0;
|
|
169
|
+
this.#pendingCellFocusRevision = 0;
|
|
170
|
+
this.#pendingGridFocus = false;
|
|
171
|
+
this.#pendingRowModeFocus = null;
|
|
172
|
+
this.#pendingRowModeFocusRevision = 0;
|
|
173
|
+
this.#managedCustomWidgetTabIndexes = new WeakMap();
|
|
174
|
+
this.#parkingFocusOnScrollContainer = false;
|
|
175
|
+
this.#hostAriaObserver = null;
|
|
479
176
|
this.#editorRestoreFrame = null;
|
|
480
177
|
this.#editingEditorElement = null;
|
|
481
178
|
this.#nextEditingSessionId = 0;
|
|
@@ -483,6 +180,14 @@ export class VioletDataGrid extends FASTElement {
|
|
|
483
180
|
this.#resolvingEditingSessionId = null;
|
|
484
181
|
this.#presentationRetainingSessionId = null;
|
|
485
182
|
this.#pendingEditorSelection = null;
|
|
183
|
+
this.#overlayResizeObserver = null;
|
|
184
|
+
this.#overlayResizeFrame = null;
|
|
185
|
+
this.#observedOverlayTargets = new Set();
|
|
186
|
+
this.#handleViewportResize = () => {
|
|
187
|
+
if (this.editingCell) {
|
|
188
|
+
this.positionEditingOverlay();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
486
191
|
this.#handleFocusIntent = () => {
|
|
487
192
|
this.#focusGeneration += 1;
|
|
488
193
|
};
|
|
@@ -521,6 +226,13 @@ export class VioletDataGrid extends FASTElement {
|
|
|
521
226
|
this.virtualTotalSize = 0;
|
|
522
227
|
this.hasToolbarSlotContent = false;
|
|
523
228
|
this.headerFocusColumnId = null;
|
|
229
|
+
this.headerFocusSelection = false;
|
|
230
|
+
this.hostAriaLabel = null;
|
|
231
|
+
this.focusedSelectionRowId = null;
|
|
232
|
+
this.rowModeFocusRowId = null;
|
|
233
|
+
this.rowModeFocusColumnId = null;
|
|
234
|
+
this.rowModeMountedRowId = null;
|
|
235
|
+
this.rovingCellMounted = false;
|
|
524
236
|
this.#rowVirtualizer = new Virtualizer({
|
|
525
237
|
count: 0,
|
|
526
238
|
getScrollElement: () => this.getScrollContainer(),
|
|
@@ -536,11 +248,26 @@ export class VioletDataGrid extends FASTElement {
|
|
|
536
248
|
},
|
|
537
249
|
});
|
|
538
250
|
}
|
|
251
|
+
#overlayResizeObserver;
|
|
252
|
+
#overlayResizeFrame;
|
|
253
|
+
#observedOverlayTargets;
|
|
254
|
+
#handleViewportResize;
|
|
539
255
|
connectedCallback() {
|
|
256
|
+
this.hostAriaLabel = this.getAttribute("aria-label");
|
|
540
257
|
this.refreshPresentation();
|
|
541
258
|
super.connectedCallback();
|
|
259
|
+
this.#hostAriaObserver ??= new MutationObserver(() => {
|
|
260
|
+
this.hostAriaLabel = this.getAttribute("aria-label");
|
|
261
|
+
});
|
|
262
|
+
this.#hostAriaObserver.observe(this, {
|
|
263
|
+
attributes: true,
|
|
264
|
+
attributeFilter: ["aria-label"],
|
|
265
|
+
});
|
|
542
266
|
this.ownerDocument.addEventListener("focusin", this.#handleFocusIntent, true);
|
|
543
267
|
this.ownerDocument.addEventListener("pointerdown", this.#handleFocusIntent, true);
|
|
268
|
+
this.ownerDocument.addEventListener("pointerup", this.#handleEditorPointerEnd, true);
|
|
269
|
+
this.ownerDocument.addEventListener("pointercancel", this.#handleEditorPointerEnd, true);
|
|
270
|
+
window.addEventListener("resize", this.#handleViewportResize);
|
|
544
271
|
this.#virtualizerCleanup ??= this.#rowVirtualizer._didMount();
|
|
545
272
|
this.hasToolbarSlotContent = this.querySelector('[slot="toolbar"]') !== null;
|
|
546
273
|
this.syncHostStates();
|
|
@@ -551,8 +278,15 @@ export class VioletDataGrid extends FASTElement {
|
|
|
551
278
|
// Disconnect is the fail-safe terminal path for anything still active,
|
|
552
279
|
// including invalid drafts that cannot remain in an invisible editor.
|
|
553
280
|
this.cancelActiveEdit();
|
|
281
|
+
this.disconnectOverlayResizeObserver();
|
|
282
|
+
this.#hostAriaObserver?.disconnect();
|
|
283
|
+
this.#hostAriaObserver = null;
|
|
554
284
|
this.ownerDocument.removeEventListener("focusin", this.#handleFocusIntent, true);
|
|
555
285
|
this.ownerDocument.removeEventListener("pointerdown", this.#handleFocusIntent, true);
|
|
286
|
+
this.ownerDocument.removeEventListener("pointerup", this.#handleEditorPointerEnd, true);
|
|
287
|
+
this.ownerDocument.removeEventListener("pointercancel", this.#handleEditorPointerEnd, true);
|
|
288
|
+
this.#editorPointerId = null;
|
|
289
|
+
window.removeEventListener("resize", this.#handleViewportResize);
|
|
556
290
|
if (this.#virtualizerFrame !== null) {
|
|
557
291
|
cancelAnimationFrame(this.#virtualizerFrame);
|
|
558
292
|
this.#virtualizerFrame = null;
|
|
@@ -562,6 +296,9 @@ export class VioletDataGrid extends FASTElement {
|
|
|
562
296
|
this.#editorRecycleFocusFrame = null;
|
|
563
297
|
}
|
|
564
298
|
this.#selectionControlFocusRevision += 1;
|
|
299
|
+
this.#cellFocusRecoveryRevision += 1;
|
|
300
|
+
this.#pendingCellFocusRevision += 1;
|
|
301
|
+
this.#pendingGridFocus = false;
|
|
565
302
|
if (this.#editorRestoreFrame !== null) {
|
|
566
303
|
cancelAnimationFrame(this.#editorRestoreFrame);
|
|
567
304
|
this.#editorRestoreFrame = null;
|
|
@@ -577,9 +314,14 @@ export class VioletDataGrid extends FASTElement {
|
|
|
577
314
|
}
|
|
578
315
|
selectionModeChanged() {
|
|
579
316
|
if (this.selectionMode === "none") {
|
|
317
|
+
this.focusedSelectionRowId = null;
|
|
318
|
+
this.headerFocusSelection = false;
|
|
580
319
|
this.selectedRowIds = [];
|
|
581
320
|
return;
|
|
582
321
|
}
|
|
322
|
+
if (this.selectionMode !== "multiple") {
|
|
323
|
+
this.headerFocusSelection = false;
|
|
324
|
+
}
|
|
583
325
|
if (this.selectionMode === "single" && this.selectedRowIds.length > 1) {
|
|
584
326
|
this.selectedRowIds = this.selectedRowIds.slice(0, 1);
|
|
585
327
|
}
|
|
@@ -598,16 +340,21 @@ export class VioletDataGrid extends FASTElement {
|
|
|
598
340
|
this.scheduleVirtualizerUpdate();
|
|
599
341
|
}
|
|
600
342
|
focusModeChanged() {
|
|
343
|
+
this.#pendingRowModeFocus = null;
|
|
601
344
|
if (this.focusMode !== "cell") {
|
|
602
345
|
this.cancelActiveEdit();
|
|
346
|
+
this.focusedSelectionRowId = null;
|
|
603
347
|
this.activeCell = null;
|
|
604
348
|
this.cellSelection = null;
|
|
605
349
|
this.fillPreview = null;
|
|
350
|
+
Updates.enqueue(() => this.syncCustomCellWidgetTabIndexes());
|
|
606
351
|
return;
|
|
607
352
|
}
|
|
353
|
+
this.headerFocusSelection = false;
|
|
608
354
|
if (!this.activeCell && this.presentedRows.length > 0 && this.presentedColumns.length > 0) {
|
|
609
355
|
this.activeCell = this.firstCellLocation();
|
|
610
356
|
}
|
|
357
|
+
Updates.enqueue(() => this.syncCustomCellWidgetTabIndexes());
|
|
611
358
|
}
|
|
612
359
|
sortModeChanged() {
|
|
613
360
|
this.schedulePresentationRefresh();
|
|
@@ -652,10 +399,22 @@ export class VioletDataGrid extends FASTElement {
|
|
|
652
399
|
if (this.focusMode !== "cell") {
|
|
653
400
|
return;
|
|
654
401
|
}
|
|
402
|
+
if (this.activeCell && this.focusedSelectionRowId !== null) {
|
|
403
|
+
this.focusedSelectionRowId = null;
|
|
404
|
+
}
|
|
655
405
|
this.updateInteractionState();
|
|
656
406
|
this.ensureActiveCellVisible();
|
|
657
407
|
this.$emit("active-cell-change", this.activeCell);
|
|
658
408
|
}
|
|
409
|
+
focusedSelectionRowIdChanged() {
|
|
410
|
+
if (this.focusMode !== "cell") {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
this.updateInteractionState();
|
|
414
|
+
if (this.focusedSelectionRowId) {
|
|
415
|
+
this.ensureRovingRowVisible();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
659
418
|
cellSelectionChanged() {
|
|
660
419
|
if (this.focusMode !== "cell") {
|
|
661
420
|
return;
|
|
@@ -677,6 +436,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
677
436
|
}
|
|
678
437
|
this.updateInteractionState();
|
|
679
438
|
if (!this.editingCell || !this.#editingSession) {
|
|
439
|
+
this.disconnectOverlayResizeObserver();
|
|
680
440
|
return;
|
|
681
441
|
}
|
|
682
442
|
this.scheduleEditorRestore(this.#editingSession.id);
|
|
@@ -702,6 +462,9 @@ export class VioletDataGrid extends FASTElement {
|
|
|
702
462
|
}
|
|
703
463
|
this.syncRenderedRows();
|
|
704
464
|
this.scheduleVirtualizerUpdate();
|
|
465
|
+
if (this.editingCell) {
|
|
466
|
+
this.scheduleOverlayPosition();
|
|
467
|
+
}
|
|
705
468
|
}
|
|
706
469
|
overscanCountChanged() {
|
|
707
470
|
this.syncRenderedRows();
|
|
@@ -737,6 +500,157 @@ export class VioletDataGrid extends FASTElement {
|
|
|
737
500
|
get activeCellLabelId() {
|
|
738
501
|
return `${this.localName}-active-cell-${this.instanceId}`;
|
|
739
502
|
}
|
|
503
|
+
get activeCellDescribeId() {
|
|
504
|
+
return `${this.localName}-active-cell-describe-${this.instanceId}`;
|
|
505
|
+
}
|
|
506
|
+
get activeCellDescribeText() {
|
|
507
|
+
if (!this.activeCell || this.focusedSelectionRowId) {
|
|
508
|
+
return "";
|
|
509
|
+
}
|
|
510
|
+
const rowIndex = this.#rowIndexById.get(this.activeCell.rowId) ?? -1;
|
|
511
|
+
return this.columnAccessoryText(this.activeCell.columnId, this.presentedRows[rowIndex]?.data, "describe");
|
|
512
|
+
}
|
|
513
|
+
columnAriaColIndexFor(columnId) {
|
|
514
|
+
const index = this.#columnIndexById.get(columnId) ?? 0;
|
|
515
|
+
return index + (this.selectionMode === "none" ? 1 : 2);
|
|
516
|
+
}
|
|
517
|
+
isSelectionCellActive(rowId) {
|
|
518
|
+
return (this.focusMode === "cell" &&
|
|
519
|
+
this.selectionMode !== "none" &&
|
|
520
|
+
this.focusedSelectionRowId === rowId);
|
|
521
|
+
}
|
|
522
|
+
get hasSelectAllHeaderControl() {
|
|
523
|
+
return this.selectionMode === "multiple" && this.presentedRows.length > 0;
|
|
524
|
+
}
|
|
525
|
+
get selectionHeaderCellTabIndex() {
|
|
526
|
+
return this.focusMode === "cell" && this.selectionMode === "single" ? "-1" : null;
|
|
527
|
+
}
|
|
528
|
+
get selectAllTabIndex() {
|
|
529
|
+
if (this.focusMode === "cell") {
|
|
530
|
+
return "-1";
|
|
531
|
+
}
|
|
532
|
+
return this.headerFocusSelection && this.hasSelectAllHeaderControl ? "0" : "-1";
|
|
533
|
+
}
|
|
534
|
+
focus(options) {
|
|
535
|
+
this.#focusGeneration += 1;
|
|
536
|
+
if (this.focusMode === "cell") {
|
|
537
|
+
if (!this.focusedSelectionRowId &&
|
|
538
|
+
!this.activeCell &&
|
|
539
|
+
this.presentedRows.length > 0 &&
|
|
540
|
+
this.presentedColumns.length > 0) {
|
|
541
|
+
this.activeCell = this.firstCellLocation();
|
|
542
|
+
}
|
|
543
|
+
if (this.focusActiveCell({ preventScroll: options?.preventScroll ?? false })) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
super.focus(options);
|
|
548
|
+
}
|
|
549
|
+
get scrollContainerTabIndex() {
|
|
550
|
+
if (this.focusMode !== "cell" || this.presentedRows.length === 0) {
|
|
551
|
+
return "-1";
|
|
552
|
+
}
|
|
553
|
+
const target = this.rovingCellTarget();
|
|
554
|
+
if (!target) {
|
|
555
|
+
return "-1";
|
|
556
|
+
}
|
|
557
|
+
return this.rovingCellMounted ? "-1" : "0";
|
|
558
|
+
}
|
|
559
|
+
selectionCellTabIndexFor(rowId) {
|
|
560
|
+
if (this.focusMode !== "cell" || this.selectionMode === "none") {
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
const target = this.rovingCellTarget();
|
|
564
|
+
return target?.kind === "selection" && target.rowId === rowId ? "0" : "-1";
|
|
565
|
+
}
|
|
566
|
+
cellTabIndexFor(rowId, columnId) {
|
|
567
|
+
if (this.focusMode !== "cell") {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
const target = this.rovingCellTarget();
|
|
571
|
+
return target?.kind === "data" && target.rowId === rowId && target.columnId === columnId
|
|
572
|
+
? "0"
|
|
573
|
+
: "-1";
|
|
574
|
+
}
|
|
575
|
+
cellAriaSelectedFor(cell) {
|
|
576
|
+
if (this.focusMode !== "cell") {
|
|
577
|
+
return null;
|
|
578
|
+
}
|
|
579
|
+
if (cell.selected) {
|
|
580
|
+
return "true";
|
|
581
|
+
}
|
|
582
|
+
return this.cellSelection ? "false" : null;
|
|
583
|
+
}
|
|
584
|
+
cellAriaDescribedByFor(cell) {
|
|
585
|
+
if (this.focusMode !== "cell" || !cell.active) {
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
return this.activeCellDescribeText ? this.activeCellDescribeId : null;
|
|
589
|
+
}
|
|
590
|
+
rowSelectionControlTabIndexFor(rowId) {
|
|
591
|
+
if (this.focusMode !== "row") {
|
|
592
|
+
return -1;
|
|
593
|
+
}
|
|
594
|
+
const target = this.resolveRowModeBodyTarget();
|
|
595
|
+
return target && target.rowId === rowId && target.columnId === null ? 0 : -1;
|
|
596
|
+
}
|
|
597
|
+
cellCheckboxTabIndexFor(rowId, columnId) {
|
|
598
|
+
if (this.focusMode !== "row") {
|
|
599
|
+
return -1;
|
|
600
|
+
}
|
|
601
|
+
const target = this.resolveRowModeBodyTarget();
|
|
602
|
+
return target && target.rowId === rowId && target.columnId === columnId ? 0 : -1;
|
|
603
|
+
}
|
|
604
|
+
rovingCellTarget() {
|
|
605
|
+
if (this.focusMode !== "cell" || this.presentedRows.length === 0) {
|
|
606
|
+
return null;
|
|
607
|
+
}
|
|
608
|
+
if (this.selectionMode !== "none" &&
|
|
609
|
+
this.focusedSelectionRowId &&
|
|
610
|
+
this.#rowIndexById.has(this.focusedSelectionRowId)) {
|
|
611
|
+
return { kind: "selection", rowId: this.focusedSelectionRowId };
|
|
612
|
+
}
|
|
613
|
+
if (this.activeCell && this.isValidCellLocation(this.activeCell)) {
|
|
614
|
+
return {
|
|
615
|
+
kind: "data",
|
|
616
|
+
rowId: this.activeCell.rowId,
|
|
617
|
+
columnId: this.activeCell.columnId,
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
const first = this.firstCellLocation();
|
|
621
|
+
return first ? { kind: "data", rowId: first.rowId, columnId: first.columnId } : null;
|
|
622
|
+
}
|
|
623
|
+
rowModeInteractiveColumns() {
|
|
624
|
+
const columns = [];
|
|
625
|
+
if (this.selectionMode !== "none") {
|
|
626
|
+
columns.push(null);
|
|
627
|
+
}
|
|
628
|
+
for (const column of this.presentedColumns) {
|
|
629
|
+
if (column.source.editor === "checkbox" && column.source.editable) {
|
|
630
|
+
columns.push(column.id);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return columns;
|
|
634
|
+
}
|
|
635
|
+
resolveRowModeBodyTarget() {
|
|
636
|
+
if (this.focusMode !== "row" || this.presentedRows.length === 0) {
|
|
637
|
+
return null;
|
|
638
|
+
}
|
|
639
|
+
const columns = this.rowModeInteractiveColumns();
|
|
640
|
+
if (columns.length === 0) {
|
|
641
|
+
return null;
|
|
642
|
+
}
|
|
643
|
+
const preferredRowId = this.rowModeFocusRowId && this.#rowIndexById.has(this.rowModeFocusRowId)
|
|
644
|
+
? this.rowModeFocusRowId
|
|
645
|
+
: this.presentedRows[0].id;
|
|
646
|
+
const rowId = this.virtualize && this.rowModeMountedRowId && this.#rowIndexById.has(this.rowModeMountedRowId)
|
|
647
|
+
? this.rowModeMountedRowId
|
|
648
|
+
: preferredRowId;
|
|
649
|
+
const columnId = columns.includes(this.rowModeFocusColumnId)
|
|
650
|
+
? this.rowModeFocusColumnId
|
|
651
|
+
: columns[0];
|
|
652
|
+
return { rowId, columnId };
|
|
653
|
+
}
|
|
740
654
|
get activeCellDescription() {
|
|
741
655
|
if (!this.activeCell) {
|
|
742
656
|
return "No active cell.";
|
|
@@ -892,14 +806,54 @@ export class VioletDataGrid extends FASTElement {
|
|
|
892
806
|
}
|
|
893
807
|
this.commitCheckboxCellToggle(location, nextChecked);
|
|
894
808
|
}
|
|
895
|
-
handleGridFocus() {
|
|
896
|
-
if (this.focusMode !== "cell" ||
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
809
|
+
handleGridFocus(event) {
|
|
810
|
+
if (this.focusMode !== "cell" || this.#parkingFocusOnScrollContainer) {
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
if (event && event.target !== this.getScrollContainer()) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
if (!this.focusedSelectionRowId &&
|
|
817
|
+
!this.activeCell &&
|
|
818
|
+
this.presentedRows.length > 0 &&
|
|
819
|
+
this.presentedColumns.length > 0) {
|
|
820
|
+
this.activeCell = this.firstCellLocation();
|
|
821
|
+
}
|
|
822
|
+
if (this.focusActiveCell({ preventScroll: true })) {
|
|
900
823
|
return;
|
|
901
824
|
}
|
|
902
|
-
|
|
825
|
+
}
|
|
826
|
+
handleGridFocusIn(event) {
|
|
827
|
+
const self = this;
|
|
828
|
+
handleGridFocusInEvent({
|
|
829
|
+
focusMode: this.focusMode,
|
|
830
|
+
editingCell: this.editingCell,
|
|
831
|
+
activeCell: this.activeCell,
|
|
832
|
+
get focusedSelectionRowId() {
|
|
833
|
+
return self.focusedSelectionRowId;
|
|
834
|
+
},
|
|
835
|
+
set focusedSelectionRowId(value) {
|
|
836
|
+
self.focusedSelectionRowId = value;
|
|
837
|
+
},
|
|
838
|
+
get rowModeFocusRowId() {
|
|
839
|
+
return self.rowModeFocusRowId;
|
|
840
|
+
},
|
|
841
|
+
set rowModeFocusRowId(value) {
|
|
842
|
+
self.rowModeFocusRowId = value;
|
|
843
|
+
},
|
|
844
|
+
get rowModeFocusColumnId() {
|
|
845
|
+
return self.rowModeFocusColumnId;
|
|
846
|
+
},
|
|
847
|
+
set rowModeFocusColumnId(value) {
|
|
848
|
+
self.rowModeFocusColumnId = value;
|
|
849
|
+
},
|
|
850
|
+
setActiveCellDirect: (location) => {
|
|
851
|
+
this.activeCell = location;
|
|
852
|
+
},
|
|
853
|
+
setFocusedSelectionRow: (rowId) => this.setFocusedSelectionRow(rowId),
|
|
854
|
+
sameEditingLocation: (left, right) => this.sameEditingLocation(left, right),
|
|
855
|
+
selectionControlRowId: (el) => this.selectionControlRowId(el),
|
|
856
|
+
}, event);
|
|
903
857
|
}
|
|
904
858
|
/**
|
|
905
859
|
* Returns true to let the browser perform the key's default action.
|
|
@@ -911,172 +865,79 @@ export class VioletDataGrid extends FASTElement {
|
|
|
911
865
|
* handler consumes.
|
|
912
866
|
*/
|
|
913
867
|
handleGridKeydown(event) {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
return true;
|
|
958
|
-
}
|
|
959
|
-
const nextLocation = this.nextTabCellLocation(currentCell, event.shiftKey ? -1 : 1);
|
|
960
|
-
if (!nextLocation) {
|
|
961
|
-
return true;
|
|
962
|
-
}
|
|
963
|
-
event.preventDefault();
|
|
964
|
-
this.setActiveCell(nextLocation);
|
|
965
|
-
return false;
|
|
966
|
-
}
|
|
967
|
-
if ((event.metaKey || event.ctrlKey) &&
|
|
968
|
-
!event.shiftKey &&
|
|
969
|
-
!event.altKey &&
|
|
970
|
-
event.key.toLowerCase() === "c") {
|
|
971
|
-
// Let the browser run its native copy so `handleGridCopy` can write through
|
|
972
|
-
// `clipboardData` (works in insecure contexts and Safari). If no copy event
|
|
973
|
-
// follows, fall back to the async clipboard API.
|
|
974
|
-
this.#nativeCopyPending = true;
|
|
975
|
-
setTimeout(() => {
|
|
976
|
-
if (!this.#nativeCopyPending) {
|
|
977
|
-
return;
|
|
978
|
-
}
|
|
979
|
-
this.#nativeCopyPending = false;
|
|
980
|
-
void this.handleCopyRequest();
|
|
981
|
-
}, 0);
|
|
982
|
-
return true;
|
|
983
|
-
}
|
|
984
|
-
if ((event.key === " " || event.key === "Spacebar" || event.key === "Enter") &&
|
|
985
|
-
this.activeCell) {
|
|
986
|
-
const activeCell = this.presentedCellAt(this.activeCell);
|
|
987
|
-
if (activeCell?.editable && activeCell.editor === "checkbox") {
|
|
988
|
-
event.preventDefault();
|
|
989
|
-
this.commitCheckboxCellToggle(this.activeCell, !this.booleanCellValue(activeCell.rawValue));
|
|
990
|
-
return false;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
if ((event.key === "Enter" || event.key === "F2") && this.activeCell) {
|
|
994
|
-
const editableCell = this.presentedCellAt(this.activeCell);
|
|
995
|
-
if (!editableCell?.editable) {
|
|
996
|
-
return true;
|
|
997
|
-
}
|
|
998
|
-
event.preventDefault();
|
|
999
|
-
this.startEditingCell(this.activeCell);
|
|
1000
|
-
return false;
|
|
1001
|
-
}
|
|
1002
|
-
if (event.key === "ArrowUp" &&
|
|
1003
|
-
!event.shiftKey &&
|
|
1004
|
-
!event.altKey &&
|
|
1005
|
-
!event.ctrlKey &&
|
|
1006
|
-
!event.metaKey &&
|
|
1007
|
-
this.activeCell &&
|
|
1008
|
-
this.activeCell.rowId === this.presentedRows[0]?.id) {
|
|
1009
|
-
const header = this.columnHeaderFocusTargetFor(this.activeCell.columnId);
|
|
1010
|
-
if (header) {
|
|
1011
|
-
event.preventDefault();
|
|
1012
|
-
header.focus();
|
|
1013
|
-
return false;
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
const nextLocation = this.nextCellLocationForKey(event);
|
|
1017
|
-
if (!nextLocation) {
|
|
1018
|
-
return true;
|
|
1019
|
-
}
|
|
1020
|
-
event.preventDefault();
|
|
1021
|
-
this.setActiveCell(nextLocation, { extendRange: event.shiftKey });
|
|
1022
|
-
return false;
|
|
868
|
+
return handleGridKeydownEvent({
|
|
869
|
+
element: this,
|
|
870
|
+
focusMode: this.focusMode,
|
|
871
|
+
selectionMode: this.selectionMode,
|
|
872
|
+
activeCell: this.activeCell,
|
|
873
|
+
focusedSelectionRowId: this.focusedSelectionRowId,
|
|
874
|
+
presentedRows: this.presentedRows,
|
|
875
|
+
shadowActiveElement: this.shadowRoot?.activeElement ?? null,
|
|
876
|
+
handleRowModeBodyKeydown: (e) => this.handleRowModeBodyKeydown(e),
|
|
877
|
+
isEditorElement: (target) => this.isEditorElement(target),
|
|
878
|
+
commitActiveEdit: () => this.commitActiveEdit(),
|
|
879
|
+
focusActiveCell: (options) => this.focusActiveCell(options),
|
|
880
|
+
refocusActiveEditor: () => this.refocusActiveEditor(),
|
|
881
|
+
commitEditingCellAndMove: (step) => this.commitEditingCellAndMove(step),
|
|
882
|
+
cancelActiveEdit: () => this.cancelActiveEdit(),
|
|
883
|
+
customCellWidgetFromTarget: (target) => this.customCellWidgetFromTarget(target),
|
|
884
|
+
handleCustomCellWidgetKeydown: (widget, e) => this.handleCustomCellWidgetKeydown(widget, e),
|
|
885
|
+
getScrollContainer: () => this.getScrollContainer(),
|
|
886
|
+
handleSelectionCellKeydown: (e, target, move) => this.handleSelectionCellKeydown(e, target, move),
|
|
887
|
+
focusColumnResizer: (columnId, returnTarget) => this.focusColumnResizer(columnId, returnTarget),
|
|
888
|
+
getActiveGridCellElement: () => this.getActiveGridCellElement(),
|
|
889
|
+
scheduleNativeCopyFallback: () => {
|
|
890
|
+
this.#nativeCopyPending = true;
|
|
891
|
+
setTimeout(() => {
|
|
892
|
+
if (!this.#nativeCopyPending) {
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
this.#nativeCopyPending = false;
|
|
896
|
+
void this.handleCopyRequest();
|
|
897
|
+
}, 0);
|
|
898
|
+
},
|
|
899
|
+
presentedCellAt: (location) => this.presentedCellAt(location),
|
|
900
|
+
booleanCellValue: (value) => this.booleanCellValue(value),
|
|
901
|
+
commitCheckboxCellToggle: (location, checked) => this.commitCheckboxCellToggle(location, checked),
|
|
902
|
+
getActiveCellElement: () => this.getActiveCellElement(),
|
|
903
|
+
customCellWidgetsInCell: (cell) => this.customCellWidgetsInCell(cell),
|
|
904
|
+
startEditingCell: (location) => this.startEditingCell(location),
|
|
905
|
+
columnHeaderFocusTargetFor: (columnId) => this.columnHeaderFocusTargetFor(columnId),
|
|
906
|
+
columnIndexForId: (columnId) => this.#columnIndexById.get(columnId) ?? -1,
|
|
907
|
+
setFocusedSelectionRow: (rowId) => this.setFocusedSelectionRow(rowId),
|
|
908
|
+
nextCellLocationForKey: (e, key) => this.nextCellLocationForKey(e, key),
|
|
909
|
+
setActiveCell: (location, options) => this.setActiveCell(location, options),
|
|
910
|
+
}, event);
|
|
1023
911
|
}
|
|
1024
912
|
handleGridClick(event) {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
return
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
this.
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
this.
|
|
1042
|
-
this.
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
!this.sameEditingLocation(this.editingCell, location) &&
|
|
1054
|
-
!this.commitActiveEdit()) {
|
|
1055
|
-
this.refocusActiveEditor();
|
|
1056
|
-
return true;
|
|
1057
|
-
}
|
|
1058
|
-
const sameActiveCell = this.activeCell?.rowId === location.rowId && this.activeCell?.columnId === location.columnId;
|
|
1059
|
-
const activeCell = this.presentedCellAt(location);
|
|
1060
|
-
if (sameActiveCell &&
|
|
1061
|
-
activeCell?.editable &&
|
|
1062
|
-
this.opensOnSingleActiveClick(activeCell.editor)) {
|
|
1063
|
-
this.startEditingCell(location);
|
|
1064
|
-
return true;
|
|
1065
|
-
}
|
|
1066
|
-
this.handleCellPointerActivate(location.rowId, location.columnId, pointerEvent.shiftKey);
|
|
1067
|
-
const timestamp = typeof pointerEvent.timeStamp === "number" ? pointerEvent.timeStamp : performance.now();
|
|
1068
|
-
const sameCellAsLastClick = this.#lastCellClickLocation?.rowId === location.rowId &&
|
|
1069
|
-
this.#lastCellClickLocation?.columnId === location.columnId;
|
|
1070
|
-
const withinDoubleClickWindow = timestamp - this.#lastCellClickTimestamp <= 350;
|
|
1071
|
-
if (pointerEvent.detail >= 2 || (sameCellAsLastClick && withinDoubleClickWindow)) {
|
|
1072
|
-
const cell = this.presentedCellAt(location);
|
|
1073
|
-
if (cell?.editable && cell.editor !== "checkbox") {
|
|
1074
|
-
this.startEditingCell(location);
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
this.#lastCellClickLocation = location;
|
|
1078
|
-
this.#lastCellClickTimestamp = timestamp;
|
|
1079
|
-
return true;
|
|
913
|
+
const self = this;
|
|
914
|
+
return handleGridClickEvent({
|
|
915
|
+
focusMode: this.focusMode,
|
|
916
|
+
get editingCell() { return self.editingCell; },
|
|
917
|
+
get activeCell() { return self.activeCell; },
|
|
918
|
+
get suppressNextGridClick() { return self.#suppressNextGridClick; },
|
|
919
|
+
set suppressNextGridClick(v) { self.#suppressNextGridClick = v; },
|
|
920
|
+
get lastCellClickLocation() { return self.#lastCellClickLocation; },
|
|
921
|
+
set lastCellClickLocation(v) { self.#lastCellClickLocation = v; },
|
|
922
|
+
get lastCellClickTimestamp() { return self.#lastCellClickTimestamp; },
|
|
923
|
+
set lastCellClickTimestamp(v) { self.#lastCellClickTimestamp = v; },
|
|
924
|
+
isEditorEvent: (e) => this.isEditorEvent(e),
|
|
925
|
+
isEditorElement: (t) => this.isEditorElement(t),
|
|
926
|
+
isInteractiveCellWidgetEvent: (e) => this.isInteractiveCellWidgetEvent(e),
|
|
927
|
+
isInteractiveCellWidgetTarget: (t) => this.isInteractiveCellWidgetTarget(t),
|
|
928
|
+
commitActiveEdit: () => this.commitActiveEdit(),
|
|
929
|
+
refocusActiveEditor: () => this.refocusActiveEditor(),
|
|
930
|
+
setFocusedSelectionRow: (rowId) => this.setFocusedSelectionRow(rowId),
|
|
931
|
+
focusActiveCell: (options) => this.focusActiveCell(options),
|
|
932
|
+
locationFromMouseEvent: (e) => this.locationFromMouseEvent(e),
|
|
933
|
+
locationFromEvent: (e) => this.locationFromEvent(e),
|
|
934
|
+
locationFromTarget: (t) => this.locationFromTarget(t),
|
|
935
|
+
presentedCellAt: (loc) => this.presentedCellAt(loc),
|
|
936
|
+
startEditingCell: (loc) => this.startEditingCell(loc),
|
|
937
|
+
sameEditingLocation: (l, r) => this.sameEditingLocation(l, r),
|
|
938
|
+
opensOnSingleActiveClick: (ed) => this.opensOnSingleActiveClick(ed),
|
|
939
|
+
handleCellPointerActivate: (r, c, s) => this.handleCellPointerActivate(r, c, s),
|
|
940
|
+
}, event);
|
|
1080
941
|
}
|
|
1081
942
|
handleGridDoubleClick(event) {
|
|
1082
943
|
if (this.focusMode !== "cell") {
|
|
@@ -1116,27 +977,37 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1116
977
|
return false;
|
|
1117
978
|
}
|
|
1118
979
|
handleGridPointerDown(event) {
|
|
980
|
+
if (this.isEditorEvent(event) || this.isEditorElement(event.target)) {
|
|
981
|
+
this.#editorPointerId = event.pointerId;
|
|
982
|
+
return true;
|
|
983
|
+
}
|
|
1119
984
|
if (this.focusMode !== "cell" ||
|
|
1120
985
|
event.button !== 0 ||
|
|
1121
|
-
event.shiftKey ||
|
|
1122
|
-
this.isEditorEvent(event) ||
|
|
1123
|
-
this.isEditorElement(event.target) ||
|
|
1124
986
|
this.isInteractiveCellWidgetEvent(event) ||
|
|
1125
987
|
this.isInteractiveCellWidgetTarget(event.target)) {
|
|
1126
988
|
return true;
|
|
1127
989
|
}
|
|
990
|
+
if (event.shiftKey) {
|
|
991
|
+
const location = this.locationFromEvent(event) ?? this.locationFromTarget(event.target);
|
|
992
|
+
if (location) {
|
|
993
|
+
// Keep browser mousedown focus from firing focusin and overwriting `activeCell`
|
|
994
|
+
// before `handleGridClick` extends the range from the previous anchor.
|
|
995
|
+
event.preventDefault();
|
|
996
|
+
return false;
|
|
997
|
+
}
|
|
998
|
+
return true;
|
|
999
|
+
}
|
|
1128
1000
|
if (this.isFillHandleEvent(event) || this.isFillHandleTarget(event.target)) {
|
|
1129
1001
|
this.beginFillDrag(event);
|
|
1130
1002
|
return false;
|
|
1131
1003
|
}
|
|
1132
1004
|
const location = this.locationFromEvent(event) ?? this.locationFromTarget(event.target);
|
|
1133
|
-
if (!location)
|
|
1005
|
+
if (!location)
|
|
1134
1006
|
return true;
|
|
1135
|
-
}
|
|
1136
1007
|
const scrollContainer = this.getScrollContainer();
|
|
1137
1008
|
this.#pointerSelectionSession = startPointerSelectionSession(event.pointerId, location);
|
|
1138
1009
|
this.setActiveCell(location);
|
|
1139
|
-
|
|
1010
|
+
this.focusActiveCell({ preventScroll: true });
|
|
1140
1011
|
try {
|
|
1141
1012
|
scrollContainer?.setPointerCapture(event.pointerId);
|
|
1142
1013
|
}
|
|
@@ -1173,6 +1044,8 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1173
1044
|
}
|
|
1174
1045
|
handleGridPointerUp(event) {
|
|
1175
1046
|
if (isFillPointerEventForSession(this.#fillSession, event.pointerId)) {
|
|
1047
|
+
if (event.isTrusted && (event.clientX || event.clientY))
|
|
1048
|
+
this.handleFillPointerMove(event);
|
|
1176
1049
|
this.handleFillPointerUp();
|
|
1177
1050
|
return;
|
|
1178
1051
|
}
|
|
@@ -1210,7 +1083,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1210
1083
|
const cell = this.presentedCellAt(this.editingCell);
|
|
1211
1084
|
if (cell?.editor === "select" || target.dataset.commitOnChange === "true") {
|
|
1212
1085
|
if (this.commitActiveEdit()) {
|
|
1213
|
-
this.
|
|
1086
|
+
this.focusActiveCell({ preventScroll: true });
|
|
1214
1087
|
}
|
|
1215
1088
|
else {
|
|
1216
1089
|
this.refocusActiveEditor();
|
|
@@ -1221,6 +1094,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1221
1094
|
}
|
|
1222
1095
|
handleGridPaste(event) {
|
|
1223
1096
|
if (this.focusMode !== "cell" ||
|
|
1097
|
+
this.focusedSelectionRowId !== null ||
|
|
1224
1098
|
this.isEditorEvent(event) ||
|
|
1225
1099
|
this.isEditorElement(event.target)) {
|
|
1226
1100
|
return true;
|
|
@@ -1241,7 +1115,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1241
1115
|
}
|
|
1242
1116
|
const sessionId = this.#editingSession?.id ?? null;
|
|
1243
1117
|
const relatedTarget = event.relatedTarget;
|
|
1244
|
-
if (this.isTargetWithinEditingOwnership(relatedTarget)) {
|
|
1118
|
+
if (this.isTargetWithinEditingOwnership(relatedTarget) || (this.#editorPointerId !== null && (!relatedTarget || relatedTarget === this.getScrollContainer()))) {
|
|
1245
1119
|
return;
|
|
1246
1120
|
}
|
|
1247
1121
|
// A concrete outside target is an intentional focus transfer. Resolve it
|
|
@@ -1274,7 +1148,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1274
1148
|
this.scheduleEditorRestore(sessionId, true);
|
|
1275
1149
|
return;
|
|
1276
1150
|
}
|
|
1277
|
-
if (currentEditor?.matches?.(":focus-within")) {
|
|
1151
|
+
if (this.#editorPointerId !== null || currentEditor?.matches?.(":focus-within") || currentEditor?.open) {
|
|
1278
1152
|
return;
|
|
1279
1153
|
}
|
|
1280
1154
|
const editorShadowActiveElement = currentEditor?.shadowRoot?.activeElement;
|
|
@@ -1291,6 +1165,9 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1291
1165
|
});
|
|
1292
1166
|
}
|
|
1293
1167
|
async handleCopyRequest() {
|
|
1168
|
+
if (this.focusedSelectionRowId !== null) {
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1294
1171
|
const detail = this.copyDetailForCurrentSelection();
|
|
1295
1172
|
if (!detail) {
|
|
1296
1173
|
return;
|
|
@@ -1311,6 +1188,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1311
1188
|
/** Handles the native `copy` event, writing TSV through `clipboardData`. */
|
|
1312
1189
|
handleGridCopy(event) {
|
|
1313
1190
|
if (this.focusMode !== "cell" ||
|
|
1191
|
+
this.focusedSelectionRowId !== null ||
|
|
1314
1192
|
this.isEditorEvent(event) ||
|
|
1315
1193
|
this.isEditorElement(event.target)) {
|
|
1316
1194
|
return true;
|
|
@@ -1407,43 +1285,16 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1407
1285
|
this.endColumnResize();
|
|
1408
1286
|
}
|
|
1409
1287
|
handleColumnResizeKeyDown(columnId, event) {
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
this.
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
this.
|
|
1419
|
-
|
|
1420
|
-
}
|
|
1421
|
-
if (event.altKey || event.ctrlKey || event.metaKey) {
|
|
1422
|
-
return true;
|
|
1423
|
-
}
|
|
1424
|
-
if (event.key === "Enter") {
|
|
1425
|
-
this.handleColumnResizeDoubleClick(columnId, event);
|
|
1426
|
-
return false;
|
|
1427
|
-
}
|
|
1428
|
-
// Step from the column's own width when it is absolute: a table narrower than the grid stretches its
|
|
1429
|
-
// columns, so the drawn width is larger, and stepping from it would grow the column by more than a step.
|
|
1430
|
-
const declared = this.resolvedColumnWidth(columnId)?.trim();
|
|
1431
|
-
const declaredPixels = declared && /^\d+(\.\d+)?(px|rem)$/.test(declared) ? cssLengthToPixels(declared) : null;
|
|
1432
|
-
const width = computeKeyboardResizedColumnWidth({
|
|
1433
|
-
key: event.key,
|
|
1434
|
-
shiftKey: event.shiftKey,
|
|
1435
|
-
currentWidth: declaredPixels ?? this.renderedColumnWidth(columnId),
|
|
1436
|
-
minimumWidth: this.minimumColumnWidth(columnId),
|
|
1437
|
-
rtl: getComputedStyle(this).direction === "rtl",
|
|
1438
|
-
});
|
|
1439
|
-
if (width === null) {
|
|
1440
|
-
return true;
|
|
1441
|
-
}
|
|
1442
|
-
event.preventDefault();
|
|
1443
|
-
event.stopPropagation();
|
|
1444
|
-
this.applyLiveColumnWidth(columnId, `${width}px`);
|
|
1445
|
-
this.commitColumnWidth(columnId, `${width}px`);
|
|
1446
|
-
return false;
|
|
1288
|
+
return handleColumnResizeKeyDownEvent({
|
|
1289
|
+
element: this,
|
|
1290
|
+
returnFocusFromColumnResizer: (id) => this.returnFocusFromColumnResizer(id),
|
|
1291
|
+
handleColumnResizeDoubleClick: (id, e) => this.handleColumnResizeDoubleClick(id, e),
|
|
1292
|
+
resolvedColumnWidth: (id) => this.resolvedColumnWidth(id),
|
|
1293
|
+
renderedColumnWidth: (id) => this.renderedColumnWidth(id),
|
|
1294
|
+
minimumColumnWidth: (id) => this.minimumColumnWidth(id),
|
|
1295
|
+
applyLiveColumnWidth: (id, w) => this.applyLiveColumnWidth(id, w),
|
|
1296
|
+
commitColumnWidth: (id, w) => this.commitColumnWidth(id, w),
|
|
1297
|
+
}, columnId, event);
|
|
1447
1298
|
}
|
|
1448
1299
|
/**
|
|
1449
1300
|
* Tab index for a column header's focus target: its sort button, or the header cell when it is not
|
|
@@ -1454,14 +1305,41 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1454
1305
|
if (this.focusMode === "cell") {
|
|
1455
1306
|
return "-1";
|
|
1456
1307
|
}
|
|
1308
|
+
if (this.headerFocusSelection && this.hasSelectAllHeaderControl) {
|
|
1309
|
+
return "-1";
|
|
1310
|
+
}
|
|
1457
1311
|
const columns = this.presentedColumns;
|
|
1458
1312
|
const tabStopColumnId = columns.some((column) => column.id === this.headerFocusColumnId)
|
|
1459
1313
|
? this.headerFocusColumnId
|
|
1460
1314
|
: columns[0]?.id;
|
|
1461
1315
|
return columnId === tabStopColumnId ? "0" : "-1";
|
|
1462
1316
|
}
|
|
1317
|
+
handleSelectionHeaderFocus(event) {
|
|
1318
|
+
if (this.hasSelectAllHeaderControl && event.target === this.selectionHeaderFocusTarget()) {
|
|
1319
|
+
this.headerFocusSelection = true;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
headerKeyboardHost() {
|
|
1323
|
+
return {
|
|
1324
|
+
element: this,
|
|
1325
|
+
focusMode: this.focusMode,
|
|
1326
|
+
presentedColumns: this.presentedColumns,
|
|
1327
|
+
presentedRows: this.presentedRows,
|
|
1328
|
+
selectionHeaderFocusTarget: () => this.selectionHeaderFocusTarget(),
|
|
1329
|
+
columnHeaderFocusTargetFor: (columnId) => this.columnHeaderFocusTargetFor(columnId),
|
|
1330
|
+
focusColumnResizer: (columnId, returnTarget) => this.focusColumnResizer(columnId, returnTarget),
|
|
1331
|
+
temporarilySuspendRovingCellTabStop: () => this.temporarilySuspendRovingCellTabStop(),
|
|
1332
|
+
focusActiveCell: (options) => this.focusActiveCell(options),
|
|
1333
|
+
setFocusedSelectionRow: (rowId) => this.setFocusedSelectionRow(rowId),
|
|
1334
|
+
focusFirstRowFromHeader: (columnId, event) => this.focusFirstRowFromHeader(columnId, event),
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
handleSelectionHeaderKeydown(event) {
|
|
1338
|
+
return handleSelectionHeaderKeydownEvent(this.headerKeyboardHost(), event);
|
|
1339
|
+
}
|
|
1463
1340
|
handleColumnHeaderFocus(columnId, event) {
|
|
1464
1341
|
if (event.target === this.columnHeaderFocusTargetFor(columnId)) {
|
|
1342
|
+
this.headerFocusSelection = false;
|
|
1465
1343
|
this.headerFocusColumnId = columnId;
|
|
1466
1344
|
}
|
|
1467
1345
|
}
|
|
@@ -1471,56 +1349,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1471
1349
|
* and Ctrl+Alt+R moves focus to the column's resizer. Enter and Space reach the sort button natively.
|
|
1472
1350
|
*/
|
|
1473
1351
|
handleColumnHeaderKeydown(columnId, event) {
|
|
1474
|
-
|
|
1475
|
-
// Keys pressed on the column's resizer bubble through the header cell.
|
|
1476
|
-
if (!header || event.target !== header) {
|
|
1477
|
-
return true;
|
|
1478
|
-
}
|
|
1479
|
-
if (isColumnResizeShortcut(event)) {
|
|
1480
|
-
event.preventDefault();
|
|
1481
|
-
return !this.focusColumnResizer(columnId, header);
|
|
1482
|
-
}
|
|
1483
|
-
if (event.altKey || event.ctrlKey || event.metaKey) {
|
|
1484
|
-
return true;
|
|
1485
|
-
}
|
|
1486
|
-
if (event.key === "Tab") {
|
|
1487
|
-
if (!event.shiftKey || this.focusMode !== "cell") {
|
|
1488
|
-
return true;
|
|
1489
|
-
}
|
|
1490
|
-
// The header sits above the body within the grid's single Tab stop.
|
|
1491
|
-
event.preventDefault();
|
|
1492
|
-
this.getScrollContainer()?.focus({ preventScroll: true });
|
|
1493
|
-
return false;
|
|
1494
|
-
}
|
|
1495
|
-
if (event.shiftKey) {
|
|
1496
|
-
return true;
|
|
1497
|
-
}
|
|
1498
|
-
const columns = this.presentedColumns;
|
|
1499
|
-
const columnIndex = columns.findIndex((column) => column.id === columnId);
|
|
1500
|
-
let nextColumnId;
|
|
1501
|
-
switch (logicalArrowKey(event.key, this)) {
|
|
1502
|
-
case "ArrowLeft":
|
|
1503
|
-
nextColumnId = columns[Math.max(0, columnIndex - 1)]?.id;
|
|
1504
|
-
break;
|
|
1505
|
-
case "ArrowRight":
|
|
1506
|
-
nextColumnId = columns[Math.min(columns.length - 1, columnIndex + 1)]?.id;
|
|
1507
|
-
break;
|
|
1508
|
-
case "Home":
|
|
1509
|
-
nextColumnId = columns[0]?.id;
|
|
1510
|
-
break;
|
|
1511
|
-
case "End":
|
|
1512
|
-
nextColumnId = columns.at(-1)?.id;
|
|
1513
|
-
break;
|
|
1514
|
-
case "ArrowDown":
|
|
1515
|
-
return this.focusFirstRowFromHeader(columnId, event);
|
|
1516
|
-
default:
|
|
1517
|
-
return true;
|
|
1518
|
-
}
|
|
1519
|
-
event.preventDefault();
|
|
1520
|
-
if (nextColumnId) {
|
|
1521
|
-
this.columnHeaderFocusTargetFor(nextColumnId)?.focus();
|
|
1522
|
-
}
|
|
1523
|
-
return false;
|
|
1352
|
+
return handleColumnHeaderKeydownEvent(this.headerKeyboardHost(), columnId, event);
|
|
1524
1353
|
}
|
|
1525
1354
|
handleColumnResizeDoubleClick(columnId, event) {
|
|
1526
1355
|
event.preventDefault();
|
|
@@ -1542,14 +1371,24 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1542
1371
|
}
|
|
1543
1372
|
return header.querySelector(".header-button") ?? header;
|
|
1544
1373
|
}
|
|
1374
|
+
selectionHeaderFocusTarget() {
|
|
1375
|
+
if (this.hasSelectAllHeaderControl) {
|
|
1376
|
+
return (this.shadowRoot?.querySelector("th.selection-header violet-checkbox.selection-checkbox") ?? null);
|
|
1377
|
+
}
|
|
1378
|
+
if (this.focusMode === "cell" && this.selectionMode === "single") {
|
|
1379
|
+
return this.shadowRoot?.querySelector("th.selection-header") ?? null;
|
|
1380
|
+
}
|
|
1381
|
+
return null;
|
|
1382
|
+
}
|
|
1545
1383
|
focusFirstRowFromHeader(columnId, event) {
|
|
1546
1384
|
const rowId = this.presentedRows[0]?.id;
|
|
1547
1385
|
if (this.focusMode !== "cell" || !rowId) {
|
|
1548
1386
|
return true;
|
|
1549
1387
|
}
|
|
1550
1388
|
event.preventDefault();
|
|
1389
|
+
this.focusedSelectionRowId = null;
|
|
1551
1390
|
this.setActiveCell({ rowId, columnId });
|
|
1552
|
-
this.
|
|
1391
|
+
this.focusActiveCell({ preventScroll: true });
|
|
1553
1392
|
return false;
|
|
1554
1393
|
}
|
|
1555
1394
|
focusColumnResizer(columnId, returnTarget) {
|
|
@@ -1597,8 +1436,9 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1597
1436
|
}
|
|
1598
1437
|
this.editAnnouncement = "";
|
|
1599
1438
|
this.fillAnnouncement = "";
|
|
1439
|
+
this.focusedSelectionRowId = null;
|
|
1600
1440
|
this.setActiveCell({ rowId, columnId }, { extendRange });
|
|
1601
|
-
this.
|
|
1441
|
+
this.focusActiveCell({ preventScroll: true });
|
|
1602
1442
|
}
|
|
1603
1443
|
updateSelection(nextSelectedRowIds) {
|
|
1604
1444
|
const uniqueSelected = [...new Set(nextSelectedRowIds)];
|
|
@@ -1677,6 +1517,12 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1677
1517
|
}
|
|
1678
1518
|
}
|
|
1679
1519
|
this.syncActiveCell();
|
|
1520
|
+
if (this.focusedSelectionRowId &&
|
|
1521
|
+
(this.focusMode !== "cell" ||
|
|
1522
|
+
this.selectionMode === "none" ||
|
|
1523
|
+
!this.#rowIndexById.has(this.focusedSelectionRowId))) {
|
|
1524
|
+
this.focusedSelectionRowId = null;
|
|
1525
|
+
}
|
|
1680
1526
|
this.syncCellSelection();
|
|
1681
1527
|
this.syncEditingCell();
|
|
1682
1528
|
this.syncFillPreview();
|
|
@@ -1922,12 +1768,12 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1922
1768
|
firstCellLocation() {
|
|
1923
1769
|
return resolveNavigationFirstCellLocation(this.presentedRows, this.presentedColumns);
|
|
1924
1770
|
}
|
|
1925
|
-
nextCellLocationForKey(event) {
|
|
1771
|
+
nextCellLocationForKey(event, key = event.key) {
|
|
1926
1772
|
return resolveNextCellLocationForKey({
|
|
1927
1773
|
rows: this.presentedRows,
|
|
1928
1774
|
columns: this.presentedColumns,
|
|
1929
1775
|
activeCell: this.activeCell,
|
|
1930
|
-
key
|
|
1776
|
+
key,
|
|
1931
1777
|
metaKey: event.ctrlKey || event.metaKey,
|
|
1932
1778
|
});
|
|
1933
1779
|
}
|
|
@@ -1936,6 +1782,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1936
1782
|
if (!this.sameEditingLocation(this.activeCell, location)) {
|
|
1937
1783
|
this.editAnnouncement = "";
|
|
1938
1784
|
}
|
|
1785
|
+
this.focusedSelectionRowId = null;
|
|
1939
1786
|
if (extendRange) {
|
|
1940
1787
|
const anchor = this.cellSelection?.anchor ?? this.activeCell ?? location;
|
|
1941
1788
|
this.cellSelection = this.createCellSelection(anchor, location);
|
|
@@ -1946,6 +1793,106 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1946
1793
|
this.activeCell = location;
|
|
1947
1794
|
this.updateInteractionState();
|
|
1948
1795
|
}
|
|
1796
|
+
setFocusedSelectionRow(rowId) {
|
|
1797
|
+
if (this.selectionMode === "none" || !this.#rowIndexById.has(rowId)) {
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
this.editAnnouncement = "";
|
|
1801
|
+
this.fillAnnouncement = "";
|
|
1802
|
+
if (this.cellSelection) {
|
|
1803
|
+
this.cellSelection = null;
|
|
1804
|
+
}
|
|
1805
|
+
this.focusedSelectionRowId = rowId;
|
|
1806
|
+
this.updateInteractionState();
|
|
1807
|
+
}
|
|
1808
|
+
toggleRowSelectionFromKeyboard(rowId) {
|
|
1809
|
+
if (this.selectionMode === "none" || !this.#rowIndexById.has(rowId)) {
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
if (this.selectionMode === "single") {
|
|
1813
|
+
this.updateSelection([rowId]);
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1816
|
+
const current = new Set(this.selectedRowIds);
|
|
1817
|
+
if (current.has(rowId)) {
|
|
1818
|
+
current.delete(rowId);
|
|
1819
|
+
}
|
|
1820
|
+
else {
|
|
1821
|
+
current.add(rowId);
|
|
1822
|
+
}
|
|
1823
|
+
this.updateSelection([...current]);
|
|
1824
|
+
}
|
|
1825
|
+
handleSelectionCellKeydown(event, target, moveDomFocus) {
|
|
1826
|
+
return handleSelectionCellKeydownEvent({
|
|
1827
|
+
element: this,
|
|
1828
|
+
focusedSelectionRowId: this.focusedSelectionRowId,
|
|
1829
|
+
presentedRows: this.presentedRows,
|
|
1830
|
+
presentedColumns: this.presentedColumns,
|
|
1831
|
+
rowIndexForId: (rowId) => this.#rowIndexById.get(rowId),
|
|
1832
|
+
toggleRowSelectionFromKeyboard: (rowId) => this.toggleRowSelectionFromKeyboard(rowId),
|
|
1833
|
+
selectionHeaderFocusTarget: () => this.selectionHeaderFocusTarget(),
|
|
1834
|
+
columnHeaderFocusTargetFor: (columnId) => this.columnHeaderFocusTargetFor(columnId),
|
|
1835
|
+
setFocusedSelectionRow: (rowId) => this.setFocusedSelectionRow(rowId),
|
|
1836
|
+
setActiveCell: (location) => this.setActiveCell(location),
|
|
1837
|
+
focusActiveCell: (options) => this.focusActiveCell(options),
|
|
1838
|
+
}, event, target, moveDomFocus);
|
|
1839
|
+
}
|
|
1840
|
+
handleRowModeBodyKeydown(event) {
|
|
1841
|
+
return handleRowModeBodyKeydownEvent({
|
|
1842
|
+
element: this,
|
|
1843
|
+
presentedRows: this.presentedRows,
|
|
1844
|
+
rowModeInteractiveColumns: () => this.rowModeInteractiveColumns(),
|
|
1845
|
+
selectionControlRowId: (el) => this.selectionControlRowId(el),
|
|
1846
|
+
rowIndexForId: (rowId) => this.#rowIndexById.get(rowId),
|
|
1847
|
+
setRowModeFocusTarget: (nextRowId, nextColumnId, nextRowIndex) => {
|
|
1848
|
+
this.rowModeFocusRowId = nextRowId;
|
|
1849
|
+
this.rowModeFocusColumnId = nextColumnId;
|
|
1850
|
+
if (this.virtualize) {
|
|
1851
|
+
const focusGeneration = this.#focusGeneration;
|
|
1852
|
+
this.#pendingRowModeFocus = {
|
|
1853
|
+
rowId: nextRowId,
|
|
1854
|
+
columnId: nextColumnId,
|
|
1855
|
+
focusGeneration,
|
|
1856
|
+
};
|
|
1857
|
+
this.#rowVirtualizer.scrollToIndex(nextRowIndex, { align: "auto" });
|
|
1858
|
+
if (this.focusRowModeBodyControl(nextRowId, nextColumnId, { preventScroll: false })) {
|
|
1859
|
+
this.#pendingRowModeFocus = null;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
else {
|
|
1863
|
+
this.#pendingRowModeFocus = null;
|
|
1864
|
+
this.focusRowModeBodyControl(nextRowId, nextColumnId, { preventScroll: false });
|
|
1865
|
+
}
|
|
1866
|
+
},
|
|
1867
|
+
}, event);
|
|
1868
|
+
}
|
|
1869
|
+
focusRowModeBodyControl(rowId, columnId, options = {}) {
|
|
1870
|
+
return focusRowModeControlInShadow(this.shadowRoot, rowId, columnId, options);
|
|
1871
|
+
}
|
|
1872
|
+
temporarilySuspendRovingCellTabStop() {
|
|
1873
|
+
suspendRovingCellTabStops(this.shadowRoot, () => this.$fastController.isConnected && this.focusMode === "cell"
|
|
1874
|
+
? this.getActiveGridCellElement()
|
|
1875
|
+
: null);
|
|
1876
|
+
}
|
|
1877
|
+
customCellWidgetsInCell(cell) {
|
|
1878
|
+
return customCellWidgetsInCellElement(cell);
|
|
1879
|
+
}
|
|
1880
|
+
customCellWidgetFromTarget(target) {
|
|
1881
|
+
return findCustomCellWidgetFromTarget(target);
|
|
1882
|
+
}
|
|
1883
|
+
handleCustomCellWidgetKeydown(widget, event) {
|
|
1884
|
+
return handleCustomCellWidgetKeydownEvent({
|
|
1885
|
+
setActiveCell: (location) => this.setActiveCell(location),
|
|
1886
|
+
focusActiveCell: (options) => this.focusActiveCell(options),
|
|
1887
|
+
temporarilySuspendRovingCellTabStop: () => this.temporarilySuspendRovingCellTabStop(),
|
|
1888
|
+
}, widget, event);
|
|
1889
|
+
}
|
|
1890
|
+
syncCustomCellWidgetTabIndexes() {
|
|
1891
|
+
if (!this.$fastController.isConnected) {
|
|
1892
|
+
return;
|
|
1893
|
+
}
|
|
1894
|
+
syncCustomCellWidgetTabIndexesInShadow(this.shadowRoot, this.focusMode, this.#managedCustomWidgetTabIndexes);
|
|
1895
|
+
}
|
|
1949
1896
|
startEditingCell(location) {
|
|
1950
1897
|
if (this.editingCell) {
|
|
1951
1898
|
if (this.sameEditingLocation(this.editingCell, location)) {
|
|
@@ -2031,7 +1978,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2031
1978
|
}
|
|
2032
1979
|
const nextCell = this.nextTabCellLocation(currentCell, direction);
|
|
2033
1980
|
this.setActiveCell(nextCell ?? currentCell);
|
|
2034
|
-
this.
|
|
1981
|
+
this.focusActiveCell({ preventScroll: true });
|
|
2035
1982
|
}
|
|
2036
1983
|
/** Cancel the active edit synchronously and emit `edit-cancel` once. */
|
|
2037
1984
|
cancelActiveEdit() {
|
|
@@ -2148,10 +2095,103 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2148
2095
|
this.cancelActiveEdit();
|
|
2149
2096
|
}
|
|
2150
2097
|
}
|
|
2098
|
+
handleGridScroll() {
|
|
2099
|
+
if (this.editingCell) {
|
|
2100
|
+
this.positionEditingOverlay();
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
disconnectOverlayResizeObserver() {
|
|
2104
|
+
if (this.#overlayResizeFrame !== null) {
|
|
2105
|
+
cancelAnimationFrame(this.#overlayResizeFrame);
|
|
2106
|
+
this.#overlayResizeFrame = null;
|
|
2107
|
+
}
|
|
2108
|
+
this.#overlayResizeObserver?.disconnect();
|
|
2109
|
+
this.#observedOverlayTargets.clear();
|
|
2110
|
+
}
|
|
2111
|
+
scheduleOverlayPosition() {
|
|
2112
|
+
if (this.#overlayResizeFrame !== null) {
|
|
2113
|
+
cancelAnimationFrame(this.#overlayResizeFrame);
|
|
2114
|
+
}
|
|
2115
|
+
this.#overlayResizeFrame = requestAnimationFrame(() => {
|
|
2116
|
+
this.#overlayResizeFrame = null;
|
|
2117
|
+
if (this.editingCell) {
|
|
2118
|
+
this.positionEditingOverlay();
|
|
2119
|
+
}
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
2122
|
+
observeOverlayGeometry(targets) {
|
|
2123
|
+
if (typeof ResizeObserver === "undefined") {
|
|
2124
|
+
return;
|
|
2125
|
+
}
|
|
2126
|
+
this.#overlayResizeObserver ??= new ResizeObserver(() => {
|
|
2127
|
+
if (this.editingCell) {
|
|
2128
|
+
this.scheduleOverlayPosition();
|
|
2129
|
+
}
|
|
2130
|
+
});
|
|
2131
|
+
const next = new Set(targets);
|
|
2132
|
+
for (const existing of this.#observedOverlayTargets) {
|
|
2133
|
+
if (!next.has(existing)) {
|
|
2134
|
+
this.#overlayResizeObserver.unobserve(existing);
|
|
2135
|
+
this.#observedOverlayTargets.delete(existing);
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
for (const target of next) {
|
|
2139
|
+
if (!this.#observedOverlayTargets.has(target)) {
|
|
2140
|
+
this.#overlayResizeObserver.observe(target);
|
|
2141
|
+
this.#observedOverlayTargets.add(target);
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
/**
|
|
2146
|
+
* Flips the editing hint or error overlay above the editing cell when there is
|
|
2147
|
+
* not enough room below it inside `.table-scroll`, and bounds its height to the
|
|
2148
|
+
* chosen side when a narrow column wraps a long message (#1197).
|
|
2149
|
+
*/
|
|
2150
|
+
positionEditingOverlay() {
|
|
2151
|
+
const scrollContainer = this.getScrollContainer();
|
|
2152
|
+
const cell = this.cellElementForLocation(this.editingCell);
|
|
2153
|
+
const overlay = cell?.querySelector(".cell-editor-error, .cell-editor-hint") ?? null;
|
|
2154
|
+
if (!scrollContainer || !cell || !overlay) {
|
|
2155
|
+
this.disconnectOverlayResizeObserver();
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
this.observeOverlayGeometry([scrollContainer, cell, overlay]);
|
|
2159
|
+
const scrollerRect = scrollContainer.getBoundingClientRect();
|
|
2160
|
+
const viewportTop = scrollerRect.top + scrollContainer.clientTop;
|
|
2161
|
+
const viewportBottom = viewportTop + scrollContainer.clientHeight;
|
|
2162
|
+
const cellRect = cell.getBoundingClientRect();
|
|
2163
|
+
const overlayRect = overlay.getBoundingClientRect();
|
|
2164
|
+
const borderBlock = overlay.offsetHeight - overlay.clientHeight;
|
|
2165
|
+
const naturalHeight = Math.max(overlayRect.height, overlay.scrollHeight + borderBlock);
|
|
2166
|
+
const overlap = overlay.dataset.placement === "above"
|
|
2167
|
+
? Math.max(0, overlayRect.bottom - cellRect.top)
|
|
2168
|
+
: Math.max(0, cellRect.bottom - overlayRect.top);
|
|
2169
|
+
const roomBelow = viewportBottom - cellRect.bottom + overlap;
|
|
2170
|
+
const roomAbove = cellRect.top + overlap - viewportTop;
|
|
2171
|
+
const placeAbove = roomBelow < naturalHeight && roomAbove > roomBelow;
|
|
2172
|
+
const available = placeAbove ? roomAbove : roomBelow;
|
|
2173
|
+
if (placeAbove) {
|
|
2174
|
+
overlay.dataset.placement = "above";
|
|
2175
|
+
}
|
|
2176
|
+
else {
|
|
2177
|
+
delete overlay.dataset.placement;
|
|
2178
|
+
}
|
|
2179
|
+
if (naturalHeight > available && available > 0) {
|
|
2180
|
+
overlay.style.maxBlockSize = `${Math.floor(available)}px`;
|
|
2181
|
+
}
|
|
2182
|
+
else {
|
|
2183
|
+
overlay.style.maxBlockSize = "";
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2151
2186
|
scheduleEditorRestore(sessionId, forceFocus = false, attempt = 0) {
|
|
2152
2187
|
if (!sessionId) {
|
|
2153
2188
|
return;
|
|
2154
2189
|
}
|
|
2190
|
+
Updates.enqueue(() => {
|
|
2191
|
+
if (this.#editingSession?.id === sessionId) {
|
|
2192
|
+
this.positionEditingOverlay();
|
|
2193
|
+
}
|
|
2194
|
+
});
|
|
2155
2195
|
if (this.#editorRestoreFrame !== null) {
|
|
2156
2196
|
cancelAnimationFrame(this.#editorRestoreFrame);
|
|
2157
2197
|
}
|
|
@@ -2160,6 +2200,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2160
2200
|
if (this.#editingSession?.id !== sessionId) {
|
|
2161
2201
|
return;
|
|
2162
2202
|
}
|
|
2203
|
+
this.positionEditingOverlay();
|
|
2163
2204
|
const editor = this.getActiveEditorElement();
|
|
2164
2205
|
if (!editor) {
|
|
2165
2206
|
if (this.#presentationRetainingSessionId === sessionId && attempt < 3) {
|
|
@@ -2314,6 +2355,9 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2314
2355
|
});
|
|
2315
2356
|
}
|
|
2316
2357
|
copyDetailForCurrentSelection() {
|
|
2358
|
+
if (this.focusedSelectionRowId !== null) {
|
|
2359
|
+
return null;
|
|
2360
|
+
}
|
|
2317
2361
|
const cells = this.selectedCellLocations();
|
|
2318
2362
|
if (!cells.length) {
|
|
2319
2363
|
return null;
|
|
@@ -2346,6 +2390,9 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2346
2390
|
return normalizeGridPastedText(text);
|
|
2347
2391
|
}
|
|
2348
2392
|
pasteOriginLocation() {
|
|
2393
|
+
if (this.focusedSelectionRowId !== null) {
|
|
2394
|
+
return null;
|
|
2395
|
+
}
|
|
2349
2396
|
return resolvePasteOriginLocation({
|
|
2350
2397
|
selection: this.normalizedCellSelection(),
|
|
2351
2398
|
rows: this.presentedRows,
|
|
@@ -2369,6 +2416,9 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2369
2416
|
});
|
|
2370
2417
|
}
|
|
2371
2418
|
currentFillSourceRange() {
|
|
2419
|
+
if (this.focusedSelectionRowId !== null) {
|
|
2420
|
+
return null;
|
|
2421
|
+
}
|
|
2372
2422
|
const selection = this.normalizedCellSelection();
|
|
2373
2423
|
if (selection) {
|
|
2374
2424
|
return this.rangeFromBounds(selection);
|
|
@@ -2432,7 +2482,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2432
2482
|
const scrollContainer = this.getScrollContainer();
|
|
2433
2483
|
this.#fillSession = session;
|
|
2434
2484
|
this.fillPreview = null;
|
|
2435
|
-
|
|
2485
|
+
this.focusActiveCell({ preventScroll: true });
|
|
2436
2486
|
try {
|
|
2437
2487
|
scrollContainer?.setPointerCapture(event.pointerId);
|
|
2438
2488
|
}
|
|
@@ -2638,7 +2688,9 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2638
2688
|
return this.closestFromEventPath(event, '[data-fill-handle="true"]') !== null;
|
|
2639
2689
|
}
|
|
2640
2690
|
isActiveCell(rowId, columnId) {
|
|
2641
|
-
return this.
|
|
2691
|
+
return (!this.focusedSelectionRowId &&
|
|
2692
|
+
this.activeCell?.rowId === rowId &&
|
|
2693
|
+
this.activeCell?.columnId === columnId);
|
|
2642
2694
|
}
|
|
2643
2695
|
locationFromTarget(target) {
|
|
2644
2696
|
const cell = this.cellElementFromTarget(target);
|
|
@@ -2743,6 +2795,95 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2743
2795
|
}
|
|
2744
2796
|
return this.shadowRoot?.getElementById(this.cellIdFor(this.activeCell.rowId, this.activeCell.columnId));
|
|
2745
2797
|
}
|
|
2798
|
+
selectionCellElementForRow(rowId) {
|
|
2799
|
+
if (!rowId) {
|
|
2800
|
+
return null;
|
|
2801
|
+
}
|
|
2802
|
+
return (this.shadowRoot?.querySelector(`td.selection-cell[data-selection-row-id="${CSS.escape(rowId)}"]`) ?? null);
|
|
2803
|
+
}
|
|
2804
|
+
getActiveGridCellElement() {
|
|
2805
|
+
if (this.focusedSelectionRowId) {
|
|
2806
|
+
return this.selectionCellElementForRow(this.focusedSelectionRowId);
|
|
2807
|
+
}
|
|
2808
|
+
return this.getActiveCellElement();
|
|
2809
|
+
}
|
|
2810
|
+
parkFocusOnScrollContainer() {
|
|
2811
|
+
const scrollContainer = this.getScrollContainer();
|
|
2812
|
+
if (!scrollContainer) {
|
|
2813
|
+
return;
|
|
2814
|
+
}
|
|
2815
|
+
this.#parkingFocusOnScrollContainer = true;
|
|
2816
|
+
try {
|
|
2817
|
+
scrollContainer.focus({ preventScroll: true });
|
|
2818
|
+
}
|
|
2819
|
+
finally {
|
|
2820
|
+
this.#parkingFocusOnScrollContainer = false;
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
focusActiveCell(options = {}) {
|
|
2824
|
+
const preventScroll = options.preventScroll ?? true;
|
|
2825
|
+
const revision = ++this.#pendingCellFocusRevision;
|
|
2826
|
+
const cell = this.getActiveGridCellElement();
|
|
2827
|
+
if (cell) {
|
|
2828
|
+
this.#pendingGridFocus = false;
|
|
2829
|
+
cell.focus({ preventScroll });
|
|
2830
|
+
// Capture generation after `cell.focus()` so our own synchronous `focusin` does not
|
|
2831
|
+
// make the post-update re-check treat our own focus move as an outside departure.
|
|
2832
|
+
const focusGeneration = this.#focusGeneration;
|
|
2833
|
+
// Re-apply focus after FAST's `Updates` microtask in case `renderedRows.splice`
|
|
2834
|
+
// replaced the `<tr>`/`<td>` DOM nodes right after this synchronous call.
|
|
2835
|
+
Updates.enqueue(() => {
|
|
2836
|
+
if (revision !== this.#pendingCellFocusRevision ||
|
|
2837
|
+
!this.$fastController.isConnected ||
|
|
2838
|
+
this.editingCell ||
|
|
2839
|
+
this.#focusGeneration !== focusGeneration) {
|
|
2840
|
+
return;
|
|
2841
|
+
}
|
|
2842
|
+
const current = this.getActiveGridCellElement();
|
|
2843
|
+
const shadowActive = this.shadowRoot?.activeElement;
|
|
2844
|
+
if (shadowActive?.isConnected &&
|
|
2845
|
+
(!this.isGridCellElement(shadowActive) || shadowActive === current)) {
|
|
2846
|
+
return;
|
|
2847
|
+
}
|
|
2848
|
+
if (current && shadowActive !== current) {
|
|
2849
|
+
const documentActive = this.ownerDocument.activeElement;
|
|
2850
|
+
if (!documentActive ||
|
|
2851
|
+
documentActive === this ||
|
|
2852
|
+
documentActive === this.ownerDocument.body) {
|
|
2853
|
+
current.focus({ preventScroll });
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
});
|
|
2857
|
+
return true;
|
|
2858
|
+
}
|
|
2859
|
+
if (this.focusMode === "cell" && this.rovingCellTarget()) {
|
|
2860
|
+
this.#pendingGridFocus = true;
|
|
2861
|
+
this.ensureRovingRowVisible();
|
|
2862
|
+
if (this.shadowRoot?.activeElement !== this.getScrollContainer()) {
|
|
2863
|
+
this.parkFocusOnScrollContainer();
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
return false;
|
|
2867
|
+
}
|
|
2868
|
+
ensureRovingRowVisible() {
|
|
2869
|
+
if (this.focusedSelectionRowId) {
|
|
2870
|
+
const rowIndex = this.#rowIndexById.get(this.focusedSelectionRowId);
|
|
2871
|
+
if (rowIndex === undefined) {
|
|
2872
|
+
return;
|
|
2873
|
+
}
|
|
2874
|
+
if (this.virtualize) {
|
|
2875
|
+
this.#rowVirtualizer.scrollToIndex(rowIndex, { align: "auto" });
|
|
2876
|
+
}
|
|
2877
|
+
requestAnimationFrame(() => {
|
|
2878
|
+
scrollCellIntoScrollContainer(this.selectionCellElementForRow(this.focusedSelectionRowId), this.getScrollContainer(), this.virtualize);
|
|
2879
|
+
});
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
this.ensureActiveCellVisible();
|
|
2883
|
+
}
|
|
2884
|
+
isGridCellElement(element) {
|
|
2885
|
+
return isGridCellElementNode(element);
|
|
2886
|
+
}
|
|
2746
2887
|
getActiveEditorElement() {
|
|
2747
2888
|
if (!this.editingCell) {
|
|
2748
2889
|
return null;
|
|
@@ -2771,6 +2912,8 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2771
2912
|
return;
|
|
2772
2913
|
}
|
|
2773
2914
|
const focusedSelectionControl = this.focusedSelectionControl();
|
|
2915
|
+
const hadGridCellFocus = this.isGridCellElement(this.shadowRoot?.activeElement);
|
|
2916
|
+
const focusGenerationBeforeRender = this.#focusGeneration;
|
|
2774
2917
|
const virtualItems = this.virtualize ? this.#rowVirtualizer.getVirtualItems() : [];
|
|
2775
2918
|
const totalSize = this.virtualize ? this.#rowVirtualizer.getTotalSize() : 0;
|
|
2776
2919
|
const nextState = computeRenderedRows({
|
|
@@ -2827,28 +2970,93 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2827
2970
|
}
|
|
2828
2971
|
this.virtualPaddingStart = nextState.virtualPaddingStart;
|
|
2829
2972
|
this.virtualPaddingEnd = nextState.virtualPaddingEnd;
|
|
2973
|
+
const rovingTarget = this.rovingCellTarget();
|
|
2974
|
+
this.rovingCellMounted = Boolean(rovingTarget && nextRenderedRows.some((rendered) => rendered.row.id === rovingTarget.rowId));
|
|
2975
|
+
const mountedRowIds = new Set(nextRenderedRows.map((rendered) => rendered.row.id));
|
|
2976
|
+
this.rowModeMountedRowId =
|
|
2977
|
+
this.rowModeFocusRowId && mountedRowIds.has(this.rowModeFocusRowId)
|
|
2978
|
+
? this.rowModeFocusRowId
|
|
2979
|
+
: (nextRenderedRows[0]?.row.id ?? null);
|
|
2830
2980
|
this.scheduleRenderedRowMeasurement();
|
|
2831
2981
|
this.restoreSelectionControlFocus(focusedSelectionControl);
|
|
2982
|
+
this.recheckCellFocusAfterRender(hadGridCellFocus, focusGenerationBeforeRender);
|
|
2983
|
+
this.recheckRowModeFocusAfterRender();
|
|
2984
|
+
Updates.enqueue(() => this.syncCustomCellWidgetTabIndexes());
|
|
2985
|
+
}
|
|
2986
|
+
recheckRowModeFocusAfterRender() {
|
|
2987
|
+
const pending = this.#pendingRowModeFocus;
|
|
2988
|
+
if (!pending || this.focusMode !== "row") {
|
|
2989
|
+
return;
|
|
2990
|
+
}
|
|
2991
|
+
const revision = ++this.#pendingRowModeFocusRevision;
|
|
2992
|
+
Updates.enqueue(() => {
|
|
2993
|
+
if (revision !== this.#pendingRowModeFocusRevision ||
|
|
2994
|
+
!this.$fastController.isConnected ||
|
|
2995
|
+
this.focusMode !== "row") {
|
|
2996
|
+
return;
|
|
2997
|
+
}
|
|
2998
|
+
const current = this.#pendingRowModeFocus;
|
|
2999
|
+
if (!current) {
|
|
3000
|
+
return;
|
|
3001
|
+
}
|
|
3002
|
+
if (this.#focusGeneration !== current.focusGeneration) {
|
|
3003
|
+
this.#pendingRowModeFocus = null;
|
|
3004
|
+
return;
|
|
3005
|
+
}
|
|
3006
|
+
if (!isDocumentFocusAvailableForGrid(this, this.ownerDocument)) {
|
|
3007
|
+
this.#pendingRowModeFocus = null;
|
|
3008
|
+
return;
|
|
3009
|
+
}
|
|
3010
|
+
if (this.focusRowModeBodyControl(current.rowId, current.columnId, { preventScroll: false })) {
|
|
3011
|
+
this.#pendingRowModeFocus = null;
|
|
3012
|
+
}
|
|
3013
|
+
});
|
|
3014
|
+
}
|
|
3015
|
+
recheckCellFocusAfterRender(hadGridCellFocus, focusGeneration) {
|
|
3016
|
+
if (this.focusMode !== "cell" || (!hadGridCellFocus && !this.#pendingGridFocus)) {
|
|
3017
|
+
return;
|
|
3018
|
+
}
|
|
3019
|
+
const revision = ++this.#cellFocusRecoveryRevision;
|
|
3020
|
+
Updates.enqueue(() => {
|
|
3021
|
+
if (revision !== this.#cellFocusRecoveryRevision || !this.$fastController.isConnected || this.editingCell) {
|
|
3022
|
+
return;
|
|
3023
|
+
}
|
|
3024
|
+
if (this.#pendingGridFocus) {
|
|
3025
|
+
const cell = this.getActiveGridCellElement();
|
|
3026
|
+
if (cell) {
|
|
3027
|
+
this.#pendingGridFocus = false;
|
|
3028
|
+
if (isDocumentFocusAvailableForGrid(this, this.ownerDocument) ||
|
|
3029
|
+
Boolean(this.shadowRoot?.activeElement)) {
|
|
3030
|
+
cell.focus({ preventScroll: true });
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
return;
|
|
3034
|
+
}
|
|
3035
|
+
if (!hadGridCellFocus || this.#focusGeneration !== focusGeneration) {
|
|
3036
|
+
return;
|
|
3037
|
+
}
|
|
3038
|
+
const shadowActive = this.shadowRoot?.activeElement;
|
|
3039
|
+
const activeCell = this.getActiveGridCellElement();
|
|
3040
|
+
if (shadowActive?.isConnected &&
|
|
3041
|
+
(!this.isGridCellElement(shadowActive) || (activeCell && shadowActive === activeCell))) {
|
|
3042
|
+
return;
|
|
3043
|
+
}
|
|
3044
|
+
if (!isDocumentFocusAvailableForGrid(this, this.ownerDocument)) {
|
|
3045
|
+
return;
|
|
3046
|
+
}
|
|
3047
|
+
if (activeCell) {
|
|
3048
|
+
activeCell.focus({ preventScroll: true });
|
|
3049
|
+
}
|
|
3050
|
+
else {
|
|
3051
|
+
this.parkFocusOnScrollContainer();
|
|
3052
|
+
}
|
|
3053
|
+
});
|
|
2832
3054
|
}
|
|
2833
3055
|
focusedSelectionControl() {
|
|
2834
|
-
|
|
2835
|
-
if (!(element instanceof HTMLElement))
|
|
2836
|
-
return null;
|
|
2837
|
-
const selector = element.matches("violet-radio.selection-radio")
|
|
2838
|
-
? "violet-radio.selection-radio"
|
|
2839
|
-
: element.matches("violet-checkbox.selection-checkbox")
|
|
2840
|
-
? "violet-checkbox.selection-checkbox"
|
|
2841
|
-
: null;
|
|
2842
|
-
const rowId = selector ? this.selectionControlRowId(element) : undefined;
|
|
2843
|
-
return selector && rowId
|
|
2844
|
-
? { element, focusGeneration: this.#focusGeneration, rowId, selector }
|
|
2845
|
-
: null;
|
|
3056
|
+
return findFocusedSelectionControl(this.shadowRoot, this.#focusGeneration);
|
|
2846
3057
|
}
|
|
2847
3058
|
selectionControlRowId(element) {
|
|
2848
|
-
return (element
|
|
2849
|
-
?.closest("tr[data-row-index]")
|
|
2850
|
-
?.querySelector("td[data-row-id]")
|
|
2851
|
-
?.getAttribute("data-row-id") ?? undefined);
|
|
3059
|
+
return selectionControlRowIdFromElement(element);
|
|
2852
3060
|
}
|
|
2853
3061
|
restoreSelectionControlFocus(focused) {
|
|
2854
3062
|
if (!focused)
|
|
@@ -2941,10 +3149,26 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2941
3149
|
if (this.#editorRecycleFocusFrame !== null) {
|
|
2942
3150
|
cancelAnimationFrame(this.#editorRecycleFocusFrame);
|
|
2943
3151
|
}
|
|
3152
|
+
const focusGeneration = this.#focusGeneration;
|
|
2944
3153
|
this.#editorRecycleFocusFrame = requestAnimationFrame(() => {
|
|
2945
3154
|
this.#editorRecycleFocusFrame = null;
|
|
2946
|
-
if (!this.
|
|
2947
|
-
this.
|
|
3155
|
+
if (!this.$fastController.isConnected ||
|
|
3156
|
+
this.editingCell ||
|
|
3157
|
+
this.#focusGeneration !== focusGeneration) {
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
3160
|
+
const documentActive = this.ownerDocument.activeElement;
|
|
3161
|
+
if (documentActive &&
|
|
3162
|
+
documentActive !== this &&
|
|
3163
|
+
documentActive !== this.ownerDocument.body) {
|
|
3164
|
+
return;
|
|
3165
|
+
}
|
|
3166
|
+
const activeCell = this.getActiveGridCellElement();
|
|
3167
|
+
if (activeCell) {
|
|
3168
|
+
activeCell.focus({ preventScroll: true });
|
|
3169
|
+
}
|
|
3170
|
+
else {
|
|
3171
|
+
this.parkFocusOnScrollContainer();
|
|
2948
3172
|
}
|
|
2949
3173
|
});
|
|
2950
3174
|
}
|
|
@@ -3029,14 +3253,20 @@ observable(VioletDataGrid.prototype, "virtualPaddingEnd");
|
|
|
3029
3253
|
observable(VioletDataGrid.prototype, "virtualTotalSize");
|
|
3030
3254
|
observable(VioletDataGrid.prototype, "hasToolbarSlotContent");
|
|
3031
3255
|
observable(VioletDataGrid.prototype, "headerFocusColumnId");
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3256
|
+
observable(VioletDataGrid.prototype, "headerFocusSelection");
|
|
3257
|
+
observable(VioletDataGrid.prototype, "hostAriaLabel");
|
|
3258
|
+
observable(VioletDataGrid.prototype, "focusedSelectionRowId");
|
|
3259
|
+
observable(VioletDataGrid.prototype, "rowModeFocusRowId");
|
|
3260
|
+
observable(VioletDataGrid.prototype, "rowModeFocusColumnId");
|
|
3261
|
+
observable(VioletDataGrid.prototype, "rowModeMountedRowId");
|
|
3262
|
+
observable(VioletDataGrid.prototype, "rovingCellMounted");
|
|
3263
|
+
/** The FAST definition of `<violet-data-grid>`; `defineVioletDataGrid` in `./violet-data-grid.define` registers it. */
|
|
3264
|
+
export const violetDataGridDefinition = {
|
|
3265
|
+
name: "violet-data-grid",
|
|
3266
|
+
template,
|
|
3267
|
+
styles,
|
|
3268
|
+
shadowOptions: {
|
|
3269
|
+
delegatesFocus: true,
|
|
3270
|
+
},
|
|
3271
|
+
};
|
|
3042
3272
|
//# sourceMappingURL=violet-data-grid.js.map
|