@vonage/vivid 4.13.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +4033 -2662
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/index.cjs +70 -136
- package/index.d.ts +0 -1
- package/index.js +60 -62
- package/lib/accordion/accordion.d.ts +2 -2
- package/lib/accordion/accordion.template.d.ts +1 -2
- package/lib/accordion/definition.d.ts +1 -1
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/accordion-item/accordion-item.template.d.ts +2 -3
- package/lib/accordion-item/definition.d.ts +1 -1
- package/lib/action-group/action-group.d.ts +2 -2
- package/lib/action-group/action-group.template.d.ts +1 -3
- package/lib/action-group/definition.d.ts +1 -1
- package/lib/alert/alert.d.ts +2 -2
- package/lib/alert/alert.template.d.ts +2 -3
- package/lib/alert/definition.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +2 -2
- package/lib/audio-player/audio-player.template.d.ts +2 -3
- package/lib/audio-player/definition.d.ts +1 -3
- package/lib/avatar/avatar.d.ts +2 -2
- package/lib/avatar/avatar.template.d.ts +2 -3
- package/lib/avatar/definition.d.ts +1 -1
- package/lib/badge/badge.d.ts +2 -2
- package/lib/badge/badge.template.d.ts +2 -3
- package/lib/badge/definition.d.ts +1 -3
- package/lib/banner/banner.d.ts +2 -2
- package/lib/banner/banner.template.d.ts +2 -3
- package/lib/banner/definition.d.ts +1 -1
- package/lib/breadcrumb/breadcrumb.d.ts +2 -2
- package/lib/breadcrumb/breadcrumb.template.d.ts +3 -4
- package/lib/breadcrumb/definition.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
- package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +2 -3
- package/lib/breadcrumb-item/definition.d.ts +1 -1
- package/lib/button/button.d.ts +2 -2
- package/lib/button/button.template.d.ts +2 -4
- package/lib/button/definition.d.ts +1 -1
- package/lib/calendar/calendar.d.ts +2 -2
- package/lib/calendar/calendar.template.d.ts +1 -3
- package/lib/calendar/definition.d.ts +1 -1
- package/lib/calendar-event/calendar-event.d.ts +2 -2
- package/lib/calendar-event/calendar-event.template.d.ts +1 -3
- package/lib/calendar-event/definition.d.ts +1 -1
- package/lib/card/card.d.ts +2 -2
- package/lib/card/card.template.d.ts +2 -3
- package/lib/card/definition.d.ts +1 -1
- package/lib/checkbox/checkbox.form-associated.d.ts +3 -2
- package/lib/checkbox/checkbox.template.d.ts +2 -3
- package/lib/checkbox/definition.d.ts +1 -1
- package/lib/combobox/combobox.d.ts +17 -2
- package/lib/combobox/combobox.options.d.ts +7 -0
- package/lib/combobox/combobox.template.d.ts +2 -3
- package/lib/combobox/definition.d.ts +1 -2
- package/lib/data-grid/data-grid-cell.d.ts +16 -13
- package/lib/data-grid/data-grid-cell.template.d.ts +2 -3
- package/lib/data-grid/data-grid-row.d.ts +19 -2
- package/lib/data-grid/data-grid-row.template.d.ts +2 -2
- package/lib/data-grid/data-grid.d.ts +45 -4
- package/lib/data-grid/data-grid.template.d.ts +2 -2
- package/lib/data-grid/definition.d.ts +1 -6
- package/lib/date-picker/definition.d.ts +1 -3
- package/lib/date-range-picker/definition.d.ts +1 -3
- package/lib/dial-pad/definition.d.ts +1 -3
- package/lib/dial-pad/dial-pad.d.ts +2 -2
- package/lib/dial-pad/dial-pad.template.d.ts +2 -3
- package/lib/dialog/definition.d.ts +1 -1
- package/lib/dialog/dialog.d.ts +2 -2
- package/lib/dialog/dialog.template.d.ts +2 -3
- package/lib/divider/definition.d.ts +1 -1
- package/lib/divider/divider.d.ts +2 -2
- package/lib/divider/divider.template.d.ts +1 -3
- package/lib/elevation/definition.d.ts +1 -1
- package/lib/elevation/elevation.d.ts +2 -2
- package/lib/elevation/elevation.template.d.ts +1 -3
- package/lib/empty-state/definition.d.ts +1 -3
- package/lib/empty-state/empty-state.d.ts +2 -2
- package/lib/empty-state/empty-state.template.d.ts +2 -3
- package/lib/fab/definition.d.ts +1 -3
- package/lib/fab/fab.template.d.ts +2 -3
- package/lib/file-picker/definition.d.ts +1 -3
- package/lib/file-picker/file-picker.form-associated.d.ts +3 -2
- package/lib/file-picker/file-picker.template.d.ts +2 -3
- package/lib/header/definition.d.ts +1 -3
- package/lib/header/header.d.ts +2 -2
- package/lib/header/header.template.d.ts +2 -3
- package/lib/icon/definition.d.ts +1 -3
- package/lib/icon/icon.d.ts +2 -2
- package/lib/icon/icon.template.d.ts +1 -3
- package/lib/layout/definition.d.ts +1 -3
- package/lib/layout/layout.d.ts +2 -2
- package/lib/layout/layout.template.d.ts +1 -3
- package/lib/listbox/definition.d.ts +1 -3
- package/lib/listbox/listbox.template.d.ts +1 -3
- package/lib/menu/definition.d.ts +1 -11
- package/lib/menu/menu.d.ts +2 -2
- package/lib/menu/menu.template.d.ts +3 -3
- package/lib/menu-item/definition.d.ts +1 -3
- package/lib/menu-item/menu-item.d.ts +2 -2
- package/lib/menu-item/menu-item.template.d.ts +2 -3
- package/lib/nav/definition.d.ts +1 -3
- package/lib/nav/nav.d.ts +2 -2
- package/lib/nav/nav.template.d.ts +1 -3
- package/lib/nav-disclosure/definition.d.ts +1 -3
- package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
- package/lib/nav-disclosure/nav-disclosure.template.d.ts +2 -3
- package/lib/nav-item/definition.d.ts +1 -3
- package/lib/nav-item/nav-item.template.d.ts +2 -3
- package/lib/note/definition.d.ts +1 -3
- package/lib/note/note.d.ts +2 -2
- package/lib/note/note.template.d.ts +2 -3
- package/lib/number-field/definition.d.ts +1 -4
- package/lib/number-field/number-field.form-associated.d.ts +3 -2
- package/lib/number-field/number-field.template.d.ts +2 -3
- package/lib/option/definition.d.ts +1 -3
- package/lib/option/option.d.ts +3 -2
- package/lib/option/option.template.d.ts +2 -3
- package/lib/pagination/definition.d.ts +1 -3
- package/lib/pagination/pagination.d.ts +2 -2
- package/lib/pagination/pagination.template.d.ts +2 -3
- package/lib/popup/definition.d.ts +1 -3
- package/lib/popup/popup.template.d.ts +2 -3
- package/lib/progress/definition.d.ts +1 -3
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress/progress.template.d.ts +1 -4
- package/lib/progress-ring/definition.d.ts +1 -3
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/progress-ring/progress-ring.template.d.ts +1 -3
- package/lib/radio/definition.d.ts +1 -3
- package/lib/radio/radio.form-associated.d.ts +3 -2
- package/lib/radio/radio.template.d.ts +1 -3
- package/lib/radio-group/definition.d.ts +1 -11
- package/lib/radio-group/radio-group.d.ts +2 -2
- package/lib/radio-group/radio-group.template.d.ts +2 -3
- package/lib/range-slider/definition.d.ts +1 -3
- package/lib/range-slider/range-slider.form-associated.d.ts +3 -2
- package/lib/range-slider/range-slider.template.d.ts +2 -3
- package/lib/searchable-select/definition.d.ts +1 -4
- package/lib/searchable-select/option-tag.template.d.ts +2 -3
- package/lib/searchable-select/searchable-select.form-associated.d.ts +3 -2
- package/lib/searchable-select/searchable-select.template.d.ts +2 -3
- package/lib/select/definition.d.ts +1 -3
- package/lib/select/select.d.ts +14 -4
- package/lib/select/select.form-associated.d.ts +11 -0
- package/lib/select/select.template.d.ts +2 -3
- package/lib/selectable-box/definition.d.ts +1 -3
- package/lib/selectable-box/selectable-box.d.ts +2 -2
- package/lib/selectable-box/selectable-box.template.d.ts +2 -3
- package/lib/side-drawer/definition.d.ts +1 -3
- package/lib/side-drawer/side-drawer.d.ts +2 -2
- package/lib/side-drawer/side-drawer.template.d.ts +1 -3
- package/lib/slider/definition.d.ts +1 -3
- package/lib/slider/slider.form-associated.d.ts +3 -2
- package/lib/slider/slider.template.d.ts +3 -4
- package/lib/split-button/definition.d.ts +1 -1
- package/lib/split-button/split-button.d.ts +2 -2
- package/lib/split-button/split-button.template.d.ts +2 -3
- package/lib/switch/definition.d.ts +1 -3
- package/lib/switch/switch.form-associated.d.ts +3 -2
- package/lib/switch/switch.template.d.ts +1 -3
- package/lib/tab/definition.d.ts +1 -3
- package/lib/tab/tab.d.ts +2 -2
- package/lib/tab/tab.template.d.ts +2 -2
- package/lib/tab-panel/definition.d.ts +1 -3
- package/lib/tab-panel/tab-panel.d.ts +2 -2
- package/lib/tab-panel/tab-panel.template.d.ts +1 -1
- package/lib/tabs/definition.d.ts +1 -3
- package/lib/tabs/tabs.d.ts +3 -2
- package/lib/tabs/tabs.template.d.ts +1 -1
- package/lib/tag/definition.d.ts +1 -4
- package/lib/tag/tag.d.ts +2 -2
- package/lib/tag/tag.template.d.ts +2 -3
- package/lib/tag-group/definition.d.ts +1 -3
- package/lib/tag-group/tag-group.d.ts +2 -2
- package/lib/tag-group/tag-group.template.d.ts +1 -3
- package/lib/text-anchor/definition.d.ts +1 -3
- package/lib/text-anchor/text-anchor.d.ts +4 -3
- package/lib/text-anchor/text-anchor.template.d.ts +2 -3
- package/lib/text-area/definition.d.ts +1 -3
- package/lib/text-area/text-area.d.ts +1 -1
- package/lib/text-area/{text-field.form-associated.d.ts → text-area.form-associated.d.ts} +3 -2
- package/lib/text-area/text-area.template.d.ts +2 -3
- package/lib/text-field/definition.d.ts +1 -3
- package/lib/text-field/text-field.form-associated.d.ts +3 -2
- package/lib/text-field/text-field.template.d.ts +2 -3
- package/lib/time-picker/definition.d.ts +1 -3
- package/lib/time-picker/time-picker.form-associated.d.ts +3 -2
- package/lib/time-picker/time-picker.template.d.ts +2 -2
- package/lib/toggletip/definition.d.ts +1 -3
- package/lib/toggletip/toggletip.d.ts +2 -2
- package/lib/toggletip/toggletip.template.d.ts +2 -3
- package/lib/tooltip/definition.d.ts +1 -3
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/lib/tooltip/tooltip.template.d.ts +2 -3
- package/lib/tree-item/definition.d.ts +1 -3
- package/lib/tree-item/tree-item.d.ts +11 -2
- package/lib/tree-item/tree-item.template.d.ts +3 -3
- package/lib/tree-view/definition.d.ts +1 -3
- package/lib/tree-view/tree-view.d.ts +16 -2
- package/lib/tree-view/tree-view.template.d.ts +1 -1
- package/lib/video-player/definition.d.ts +1 -3
- package/lib/video-player/video-player.d.ts +2 -2
- package/lib/video-player/video-player.template.d.ts +1 -3
- package/listbox/index.cjs +37 -39
- package/listbox/index.js +37 -39
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.cjs +1 -1
- package/note/index.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/affix.cjs +10 -10
- package/shared/affix.js +2 -2
- package/shared/anchor.cjs +59 -0
- package/shared/anchor.js +57 -0
- package/shared/anchored.cjs +6 -6
- package/shared/anchored.js +2 -2
- package/shared/apply-mixins.cjs +15 -17
- package/shared/apply-mixins.js +15 -17
- package/shared/apply-mixins2.cjs +25 -0
- package/shared/apply-mixins2.js +23 -0
- package/shared/applyMixinsWithObservables.cjs +4 -4
- package/shared/applyMixinsWithObservables.js +2 -2
- package/shared/aria-global.cjs +86 -67
- package/shared/aria-global.js +86 -67
- package/shared/aria-global2.cjs +68 -86
- package/shared/aria-global2.js +68 -86
- package/shared/base-progress.cjs +70 -63
- package/shared/base-progress.js +69 -62
- package/shared/breadcrumb-item.cjs +7 -58
- package/shared/breadcrumb-item.js +4 -55
- package/shared/button.cjs +178 -0
- package/shared/button.js +176 -0
- package/shared/calendar-event.cjs +10 -9
- package/shared/calendar-event.js +3 -2
- package/shared/children.cjs +2 -2
- package/shared/children.js +1 -1
- package/shared/date-picker/date-picker-base.form-associated.d.ts +3 -2
- package/shared/date-picker/date-picker-base.template.d.ts +2 -3
- package/shared/defineVividComponent.cjs +2612 -0
- package/shared/defineVividComponent.js +2592 -0
- package/shared/definition.cjs +26 -24
- package/shared/definition.js +17 -14
- package/shared/definition10.cjs +15 -12
- package/shared/definition10.js +15 -11
- package/shared/definition11.cjs +52 -248
- package/shared/definition11.js +24 -218
- package/shared/definition12.cjs +18 -14
- package/shared/definition12.js +17 -12
- package/shared/definition13.cjs +20 -19
- package/shared/definition13.js +11 -9
- package/shared/definition14.cjs +36 -38
- package/shared/definition14.js +16 -17
- package/shared/definition15.cjs +28 -26
- package/shared/definition15.js +17 -14
- package/shared/definition16.cjs +478 -611
- package/shared/definition16.js +471 -603
- package/shared/definition17.cjs +934 -1113
- package/shared/definition17.js +912 -1090
- package/shared/definition18.cjs +16 -20
- package/shared/definition18.js +19 -22
- package/shared/definition19.cjs +26 -30
- package/shared/definition19.js +21 -24
- package/shared/definition2.cjs +20 -22
- package/shared/definition2.js +21 -22
- package/shared/definition20.cjs +51 -52
- package/shared/definition20.js +35 -35
- package/shared/definition21.cjs +42 -45
- package/shared/definition21.js +18 -20
- package/shared/definition22.cjs +16 -13
- package/shared/definition22.js +15 -11
- package/shared/definition23.cjs +22 -20
- package/shared/definition23.js +15 -12
- package/shared/definition24.cjs +20 -172
- package/shared/definition24.js +17 -168
- package/shared/definition25.cjs +27 -28
- package/shared/definition25.js +19 -19
- package/shared/definition26.cjs +17 -14
- package/shared/definition26.js +15 -11
- package/shared/definition27.cjs +265 -12
- package/shared/definition27.js +262 -10
- package/shared/definition28.cjs +19 -16
- package/shared/definition28.js +15 -11
- package/shared/definition29.cjs +143 -68
- package/shared/definition29.js +102 -29
- package/shared/definition3.cjs +21 -16
- package/shared/definition3.js +17 -11
- package/shared/definition30.cjs +99 -76
- package/shared/definition30.js +98 -74
- package/shared/definition31.cjs +24 -97
- package/shared/definition31.js +25 -97
- package/shared/definition32.cjs +10 -25
- package/shared/definition32.js +9 -23
- package/shared/definition33.cjs +53 -14
- package/shared/definition33.js +52 -12
- package/shared/definition34.cjs +641 -34
- package/shared/definition34.js +638 -30
- package/shared/definition35.cjs +204 -596
- package/shared/definition35.js +198 -591
- package/shared/definition36.cjs +198 -233
- package/shared/definition36.js +193 -226
- package/shared/definition37.cjs +79 -206
- package/shared/definition37.js +75 -202
- package/shared/definition38.cjs +50 -56
- package/shared/definition38.js +48 -52
- package/shared/definition39.cjs +260 -56
- package/shared/definition39.js +259 -54
- package/shared/definition4.cjs +33 -35
- package/shared/definition4.js +20 -21
- package/shared/definition40.cjs +112 -229
- package/shared/definition40.js +109 -226
- package/shared/definition41.cjs +627 -36
- package/shared/definition41.js +626 -34
- package/shared/definition42.cjs +975 -487
- package/shared/definition42.js +972 -482
- package/shared/definition43.cjs +725 -932
- package/shared/definition43.js +713 -918
- package/shared/definition44.cjs +116 -734
- package/shared/definition44.js +114 -731
- package/shared/definition45.cjs +93 -116
- package/shared/definition45.js +93 -115
- package/shared/definition46.cjs +469 -89
- package/shared/definition46.js +466 -86
- package/shared/definition47.cjs +119 -470
- package/shared/definition47.js +116 -465
- package/shared/definition48.cjs +114 -120
- package/shared/definition48.js +112 -117
- package/shared/definition49.cjs +17 -134
- package/shared/definition49.js +16 -132
- package/shared/definition5.cjs +48 -49
- package/shared/definition5.js +19 -19
- package/shared/definition50.cjs +112 -15
- package/shared/definition50.js +110 -12
- package/shared/definition51.cjs +847 -84
- package/shared/definition51.js +843 -79
- package/shared/definition52.cjs +31 -873
- package/shared/definition52.js +29 -870
- package/shared/definition53.cjs +126 -28
- package/shared/definition53.js +124 -25
- package/shared/definition54.cjs +268 -107
- package/shared/definition54.js +262 -100
- package/shared/definition55.cjs +63 -278
- package/shared/definition55.js +61 -275
- package/shared/definition56.cjs +868 -76
- package/shared/definition56.js +867 -74
- package/shared/definition57.cjs +108 -826
- package/shared/definition57.js +106 -823
- package/shared/definition58.cjs +74 -100
- package/shared/definition58.js +70 -95
- package/shared/definition59.cjs +181 -106
- package/shared/definition59.js +175 -101
- package/shared/definition6.cjs +23 -21
- package/shared/definition6.js +15 -12
- package/shared/definition60.cjs +273 -70
- package/shared/definition60.js +273 -69
- package/shared/definition61.cjs +66157 -271
- package/shared/definition61.js +66156 -269
- package/shared/definition62.cjs +36 -66174
- package/shared/definition62.js +33 -66171
- package/shared/definition63.cjs +2154 -27
- package/shared/definition63.js +2151 -25
- package/shared/definition7.cjs +19 -15
- package/shared/definition7.js +14 -10
- package/shared/definition8.cjs +26 -27
- package/shared/definition8.js +17 -17
- package/shared/definition9.cjs +21 -21
- package/shared/definition9.js +18 -17
- package/shared/design-system/createRegisterFunction.d.ts +2 -0
- package/shared/design-system/defineVividComponent.d.ts +15 -0
- package/shared/{localization.js → direction.js} +11 -11
- package/shared/dom.cjs +0 -13
- package/shared/dom.js +1 -13
- package/shared/form-associated.cjs +422 -457
- package/shared/form-associated.js +422 -457
- package/shared/form-associated2.cjs +383 -0
- package/shared/form-associated2.js +381 -0
- package/shared/form-elements.cjs +15 -42
- package/shared/form-elements.js +2 -29
- package/shared/foundation/anchor/anchor.d.ts +1 -0
- package/shared/foundation/button/button.d.ts +3 -2
- package/shared/foundation/button/button.template.d.ts +2 -4
- package/shared/foundation/form-associated/form-associated.d.ts +51 -0
- package/shared/foundation/listbox/listbox.d.ts +22 -0
- package/shared/foundation/progress/base-progress.d.ts +9 -0
- package/shared/foundation/utilities/apply-mixins.d.ts +1 -0
- package/shared/foundation/vivid-element/vivid-element.d.ts +3 -0
- package/shared/foundation-element.cjs +1417 -0
- package/shared/foundation-element.js +1414 -0
- package/shared/index.cjs +7 -5097
- package/shared/index.js +7 -5079
- package/shared/key-codes.cjs +10 -0
- package/shared/key-codes.js +6 -1
- package/shared/key-codes2.cjs +50 -6
- package/shared/key-codes2.js +50 -4
- package/shared/listbox.cjs +428 -1195
- package/shared/listbox.js +412 -1176
- package/shared/listbox2.cjs +1268 -0
- package/shared/listbox2.js +1265 -0
- package/shared/localized.cjs +2 -2
- package/shared/localized.js +1 -1
- package/shared/numbers.cjs +12 -0
- package/shared/numbers.js +12 -1
- package/shared/patterns/affix.d.ts +2 -2
- package/shared/patterns/chevron.d.ts +2 -2
- package/shared/patterns/form-elements/form-elements.d.ts +2 -2
- package/shared/presentationDate.cjs +50 -49
- package/shared/presentationDate.js +7 -6
- package/shared/ref.cjs +2 -2
- package/shared/ref.js +1 -1
- package/shared/repeat.cjs +22 -22
- package/shared/repeat.js +1 -1
- package/shared/slider.template.cjs +5 -5
- package/shared/slider.template.js +2 -2
- package/shared/slotted.cjs +4 -4
- package/shared/slotted.js +1 -1
- package/shared/strings.cjs +0 -26
- package/shared/strings.js +1 -25
- package/shared/strings2.cjs +37 -0
- package/shared/strings2.js +33 -0
- package/shared/text-anchor.cjs +8 -89
- package/shared/text-anchor.js +5 -86
- package/shared/text-anchor.template.cjs +2 -2
- package/shared/text-anchor.template.js +1 -1
- package/shared/text-field2.cjs +29 -28
- package/shared/text-field2.js +6 -5
- package/shared/vivid-element.cjs +8 -0
- package/shared/vivid-element.js +6 -0
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-anchor/index.cjs +10 -7
- package/text-anchor/index.js +10 -7
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +2846 -7860
- package/shared/definition64.cjs +0 -2175
- package/shared/definition64.js +0 -2170
- package/shared/design-system/index.d.ts +0 -3
- package/shared/icon.cjs +0 -261
- package/shared/icon.js +0 -258
- package/shared/index2.cjs +0 -11
- package/shared/index2.js +0 -9
- package/shared/radio.cjs +0 -126
- package/shared/radio.js +0 -124
- package/shared/select.options.cjs +0 -12
- package/shared/select.options.js +0 -10
- package/shared/start-end.cjs +0 -52
- package/shared/start-end.js +0 -50
- package/shared/tree-item.cjs +0 -154
- package/shared/tree-item.js +0 -151
- package/shared/{localization.cjs → direction.cjs} +9 -9
package/shared/definition17.cjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const definition = require('./definition27.cjs');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const defineVividComponent = require('./defineVividComponent.cjs');
|
|
5
|
+
const vividElement = require('./vivid-element.cjs');
|
|
6
|
+
const keyCodes = require('./key-codes.cjs');
|
|
6
7
|
const repeat = require('./repeat.cjs');
|
|
7
8
|
const slotted = require('./slotted.cjs');
|
|
8
9
|
const children = require('./children.cjs');
|
|
9
|
-
const icon = require('./icon.cjs');
|
|
10
10
|
const when = require('./when.cjs');
|
|
11
|
-
const keyCodes$1 = require('./key-codes.cjs');
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* This set of exported strings reference https://developer.mozilla.org/en-US/docs/Web/Events
|
|
@@ -19,941 +18,532 @@ const eventFocusIn = "focusin";
|
|
|
19
18
|
const eventFocusOut = "focusout";
|
|
20
19
|
const eventKeyDown = "keydown";
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
const dataGridStyles = ":host{display:block}:host([generate-header=sticky]){max-block-size:400px}.base{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.base{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.base ::-webkit-scrollbar{width:4px}.base ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.base ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-thumb-color)}.base{position:relative;overflow:auto;block-size:inherit;inline-size:100%;max-block-size:inherit}";
|
|
22
|
+
|
|
23
|
+
const dataGridRowStyles = ".base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-row-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-row-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-row-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-data-grid-row-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-data-grid-row-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-data-grid-row-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-row-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-row-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-row-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-row-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-data-grid-row-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-data-grid-row-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-data-grid-row-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-row-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:grid;width:100%;box-sizing:border-box;color:var(--vvd-color-canvas-text)}:host([row-type=sticky-header]) .base{position:sticky;z-index:9;top:0;background:var(--data-grid-row-background, var(--vvd-color-canvas))}:host([row-type=hidden-header]) .base{display:none}:host(:is([aria-selected]):not([row-type*=header])) .base{background-color:var(--_appearance-color-fill)}";
|
|
24
|
+
|
|
25
|
+
const dataGridCellStyles = ":host{block-size:100%;min-inline-size:80px}:host(:focus-visible){outline:none}.base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-cell-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-cell-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-cell-cta-firm, var(--vvd-color-cta-600));--_connotation-color-soft: var(--vvd-data-grid-cell-cta-soft, var(--vvd-color-cta-100));--_connotation-color-faint: var(--vvd-data-grid-cell-cta-faint, var(--vvd-color-cta-50));--_connotation-color-pale: var(--vvd-data-grid-cell-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-cell-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-cell-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-cell-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-cell-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-soft: var(--vvd-data-grid-cell-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-faint: var(--vvd-data-grid-cell-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-pale: var(--vvd-data-grid-cell-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-cell-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:flex;box-sizing:border-box;align-items:center;border-bottom:1px solid var(--vvd-color-neutral-300);block-size:var(--data-grid-cell-block-size, var(--_data-grid-cell-default-block-size));color:var(--_appearance-color-text);font:var(--vvd-typography-base);min-block-size:calc(1px*(48 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-block:13px 14px;padding-inline:12px}:host(:focus-visible) .base{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}:host([cell-type=columnheader]) .base{border-color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);--_data-grid-cell-default-block-size: calc(1px*(48 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_data-grid-cell-default-white-space: nowrap}:host(:not([cell-type=columnheader])) .base{--_data-grid-cell-default-block-size: 100%;--_data-grid-cell-default-white-space: normal}:host(:is([aria-selected]):not([cell-type=columnheader])) .base{background-color:var(--_appearance-color-fill)}slot{display:block;overflow:hidden;text-overflow:ellipsis;white-space:var(--data-grid-cell-white-space, var(--_data-grid-cell-default-white-space))}:host(:not([cell-type=columnheader][aria-sort])) slot{inline-size:100%}.header-icon{margin-inline-start:16px}";
|
|
26
|
+
|
|
27
|
+
const DataGridCellSortStates = {
|
|
28
|
+
none: "none",
|
|
29
|
+
ascending: "ascending",
|
|
30
|
+
descending: "descending",
|
|
31
|
+
other: "other"
|
|
32
|
+
};
|
|
33
|
+
const GenerateHeaderOptions = {
|
|
34
|
+
none: "none",
|
|
35
|
+
default: "default",
|
|
36
|
+
sticky: "sticky"
|
|
32
37
|
};
|
|
33
|
-
/**
|
|
34
|
-
* Enumerates possible data grid cell types.
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
38
|
const DataGridCellTypes = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
default: "default",
|
|
40
|
+
columnHeader: "columnheader",
|
|
41
|
+
rowHeader: "rowheader"
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*/
|
|
48
|
-
const DataGridRowTypes$1 = {
|
|
49
|
-
default: "default",
|
|
50
|
-
header: "header",
|
|
51
|
-
stickyHeader: "sticky-header",
|
|
43
|
+
const DataGridRowTypes = {
|
|
44
|
+
default: "default",
|
|
45
|
+
header: "header",
|
|
46
|
+
stickyHeader: "sticky-header"
|
|
52
47
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* @fires row-focused - Fires a custom 'row-focused' event when focus is on an element (usually a cell or its contents) in the row
|
|
58
|
-
* @slot - The default slot for custom cell elements
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
let DataGridRow$1 = class DataGridRow extends index.FoundationElement {
|
|
62
|
-
constructor() {
|
|
63
|
-
super(...arguments);
|
|
64
|
-
/**
|
|
65
|
-
* The type of row
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
68
|
-
* @remarks
|
|
69
|
-
* HTML Attribute: row-type
|
|
70
|
-
*/
|
|
71
|
-
this.rowType = DataGridRowTypes$1.default;
|
|
72
|
-
/**
|
|
73
|
-
* The base data for this row
|
|
74
|
-
*
|
|
75
|
-
* @public
|
|
76
|
-
*/
|
|
77
|
-
this.rowData = null;
|
|
78
|
-
/**
|
|
79
|
-
* The column definitions of the row
|
|
80
|
-
*
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
this.columnDefinitions = null;
|
|
84
|
-
/**
|
|
85
|
-
* Whether focus is on/in a cell within this row.
|
|
86
|
-
*
|
|
87
|
-
* @internal
|
|
88
|
-
*/
|
|
89
|
-
this.isActiveRow = false;
|
|
90
|
-
this.cellsRepeatBehavior = null;
|
|
91
|
-
this.cellsPlaceholder = null;
|
|
92
|
-
/**
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
|
-
this.focusColumnIndex = 0;
|
|
96
|
-
this.refocusOnLoad = false;
|
|
97
|
-
this.updateRowStyle = () => {
|
|
98
|
-
this.style.gridTemplateColumns = this.gridTemplateColumns;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
gridTemplateColumnsChanged() {
|
|
102
|
-
if (this.$fastController.isConnected) {
|
|
103
|
-
this.updateRowStyle();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
rowTypeChanged() {
|
|
107
|
-
if (this.$fastController.isConnected) {
|
|
108
|
-
this.updateItemTemplate();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
rowDataChanged() {
|
|
112
|
-
if (this.rowData !== null && this.isActiveRow) {
|
|
113
|
-
this.refocusOnLoad = true;
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
cellItemTemplateChanged() {
|
|
118
|
-
this.updateItemTemplate();
|
|
119
|
-
}
|
|
120
|
-
headerCellItemTemplateChanged() {
|
|
121
|
-
this.updateItemTemplate();
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* @internal
|
|
125
|
-
*/
|
|
126
|
-
connectedCallback() {
|
|
127
|
-
super.connectedCallback();
|
|
128
|
-
// note that row elements can be reused with a different data object
|
|
129
|
-
// as the parent grid's repeat behavior reacts to changes in the data set.
|
|
130
|
-
if (this.cellsRepeatBehavior === null) {
|
|
131
|
-
this.cellsPlaceholder = document.createComment("");
|
|
132
|
-
this.appendChild(this.cellsPlaceholder);
|
|
133
|
-
this.updateItemTemplate();
|
|
134
|
-
this.cellsRepeatBehavior = new repeat.RepeatDirective(x => x.columnDefinitions, x => x.activeCellItemTemplate, { positioning: true }).createBehavior(this.cellsPlaceholder);
|
|
135
|
-
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
136
|
-
this.$fastController.addBehaviors([this.cellsRepeatBehavior]);
|
|
137
|
-
}
|
|
138
|
-
this.addEventListener("cell-focused", this.handleCellFocus);
|
|
139
|
-
this.addEventListener(eventFocusOut, this.handleFocusout);
|
|
140
|
-
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
141
|
-
this.updateRowStyle();
|
|
142
|
-
if (this.refocusOnLoad) {
|
|
143
|
-
// if focus was on the row when data changed try to refocus on same cell
|
|
144
|
-
this.refocusOnLoad = false;
|
|
145
|
-
if (this.cellElements.length > this.focusColumnIndex) {
|
|
146
|
-
this.cellElements[this.focusColumnIndex].focus();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* @internal
|
|
152
|
-
*/
|
|
153
|
-
disconnectedCallback() {
|
|
154
|
-
super.disconnectedCallback();
|
|
155
|
-
this.removeEventListener("cell-focused", this.handleCellFocus);
|
|
156
|
-
this.removeEventListener(eventFocusOut, this.handleFocusout);
|
|
157
|
-
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
158
|
-
}
|
|
159
|
-
handleFocusout(e) {
|
|
160
|
-
if (!this.contains(e.target)) {
|
|
161
|
-
this.isActiveRow = false;
|
|
162
|
-
this.focusColumnIndex = 0;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
handleCellFocus(e) {
|
|
166
|
-
this.isActiveRow = true;
|
|
167
|
-
this.focusColumnIndex = this.cellElements.indexOf(e.target);
|
|
168
|
-
this.$emit("row-focused", this);
|
|
169
|
-
}
|
|
170
|
-
handleKeydown(e) {
|
|
171
|
-
if (e.defaultPrevented) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
let newFocusColumnIndex = 0;
|
|
175
|
-
switch (e.key) {
|
|
176
|
-
case keyCodes.keyArrowLeft:
|
|
177
|
-
// focus left one cell
|
|
178
|
-
newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
|
|
179
|
-
this.cellElements[newFocusColumnIndex].focus();
|
|
180
|
-
e.preventDefault();
|
|
181
|
-
break;
|
|
182
|
-
case keyCodes.keyArrowRight:
|
|
183
|
-
// focus right one cell
|
|
184
|
-
newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
|
|
185
|
-
this.cellElements[newFocusColumnIndex].focus();
|
|
186
|
-
e.preventDefault();
|
|
187
|
-
break;
|
|
188
|
-
case keyCodes.keyHome:
|
|
189
|
-
if (!e.ctrlKey) {
|
|
190
|
-
this.cellElements[0].focus();
|
|
191
|
-
e.preventDefault();
|
|
192
|
-
}
|
|
193
|
-
break;
|
|
194
|
-
case keyCodes.keyEnd:
|
|
195
|
-
if (!e.ctrlKey) {
|
|
196
|
-
// focus last cell of the row
|
|
197
|
-
this.cellElements[this.cellElements.length - 1].focus();
|
|
198
|
-
e.preventDefault();
|
|
199
|
-
}
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
updateItemTemplate() {
|
|
204
|
-
this.activeCellItemTemplate =
|
|
205
|
-
this.rowType === DataGridRowTypes$1.default &&
|
|
206
|
-
this.cellItemTemplate !== undefined
|
|
207
|
-
? this.cellItemTemplate
|
|
208
|
-
: this.rowType === DataGridRowTypes$1.default &&
|
|
209
|
-
this.cellItemTemplate === undefined
|
|
210
|
-
? this.defaultCellItemTemplate
|
|
211
|
-
: this.headerCellItemTemplate !== undefined
|
|
212
|
-
? this.headerCellItemTemplate
|
|
213
|
-
: this.defaultHeaderCellItemTemplate;
|
|
214
|
-
}
|
|
48
|
+
const DataGridCellRole = {
|
|
49
|
+
columnheader: "columnheader",
|
|
50
|
+
rowheader: "rowheader",
|
|
51
|
+
default: "gridcell"
|
|
215
52
|
};
|
|
216
|
-
index.__decorate([
|
|
217
|
-
index.attr({ attribute: "grid-template-columns" })
|
|
218
|
-
], DataGridRow$1.prototype, "gridTemplateColumns", void 0);
|
|
219
|
-
index.__decorate([
|
|
220
|
-
index.attr({ attribute: "row-type" })
|
|
221
|
-
], DataGridRow$1.prototype, "rowType", void 0);
|
|
222
|
-
index.__decorate([
|
|
223
|
-
index.observable
|
|
224
|
-
], DataGridRow$1.prototype, "rowData", void 0);
|
|
225
|
-
index.__decorate([
|
|
226
|
-
index.observable
|
|
227
|
-
], DataGridRow$1.prototype, "columnDefinitions", void 0);
|
|
228
|
-
index.__decorate([
|
|
229
|
-
index.observable
|
|
230
|
-
], DataGridRow$1.prototype, "cellItemTemplate", void 0);
|
|
231
|
-
index.__decorate([
|
|
232
|
-
index.observable
|
|
233
|
-
], DataGridRow$1.prototype, "headerCellItemTemplate", void 0);
|
|
234
|
-
index.__decorate([
|
|
235
|
-
index.observable
|
|
236
|
-
], DataGridRow$1.prototype, "rowIndex", void 0);
|
|
237
|
-
index.__decorate([
|
|
238
|
-
index.observable
|
|
239
|
-
], DataGridRow$1.prototype, "isActiveRow", void 0);
|
|
240
|
-
index.__decorate([
|
|
241
|
-
index.observable
|
|
242
|
-
], DataGridRow$1.prototype, "activeCellItemTemplate", void 0);
|
|
243
|
-
index.__decorate([
|
|
244
|
-
index.observable
|
|
245
|
-
], DataGridRow$1.prototype, "defaultCellItemTemplate", void 0);
|
|
246
|
-
index.__decorate([
|
|
247
|
-
index.observable
|
|
248
|
-
], DataGridRow$1.prototype, "defaultHeaderCellItemTemplate", void 0);
|
|
249
|
-
index.__decorate([
|
|
250
|
-
index.observable
|
|
251
|
-
], DataGridRow$1.prototype, "cellElements", void 0);
|
|
252
53
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
*/
|
|
290
|
-
this.columnDefinitions = null;
|
|
291
|
-
/**
|
|
292
|
-
* The index of the row that will receive focus the next time the
|
|
293
|
-
* grid is focused. This value changes as focus moves to different
|
|
294
|
-
* rows within the grid. Changing this value when focus is already
|
|
295
|
-
* within the grid moves focus to the specified row.
|
|
296
|
-
*
|
|
297
|
-
* @public
|
|
298
|
-
*/
|
|
54
|
+
var __defProp$2 = Object.defineProperty;
|
|
55
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
56
|
+
var result = void 0 ;
|
|
57
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
58
|
+
if (decorator = decorators[i])
|
|
59
|
+
result = (decorator(target, key, result) ) || result;
|
|
60
|
+
if (result) __defProp$2(target, key, result);
|
|
61
|
+
return result;
|
|
62
|
+
};
|
|
63
|
+
const DataGridSelectionMode = {
|
|
64
|
+
none: "none",
|
|
65
|
+
singleRow: "single-row",
|
|
66
|
+
multiRow: "multi-row",
|
|
67
|
+
singleCell: "single-cell",
|
|
68
|
+
multiCell: "multi-cell"
|
|
69
|
+
};
|
|
70
|
+
const _DataGrid = class _DataGrid extends vividElement.VividElement {
|
|
71
|
+
constructor() {
|
|
72
|
+
super();
|
|
73
|
+
this.noTabbing = false;
|
|
74
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
75
|
+
this.generateHeader = GenerateHeaderOptions.default;
|
|
76
|
+
this.rowsData = [];
|
|
77
|
+
this.columnDefinitions = null;
|
|
78
|
+
this.focusRowIndex = 0;
|
|
79
|
+
this.focusColumnIndex = 0;
|
|
80
|
+
this.rowsRepeatBehavior = null;
|
|
81
|
+
this.rowsPlaceholder = null;
|
|
82
|
+
this.generatedHeader = null;
|
|
83
|
+
this.isUpdatingFocus = false;
|
|
84
|
+
this.pendingFocusUpdate = false;
|
|
85
|
+
this.rowindexUpdateQueued = false;
|
|
86
|
+
this.columnDefinitionsStale = true;
|
|
87
|
+
this.generatedGridTemplateColumns = "";
|
|
88
|
+
this.focusOnCell = (rowIndex, columnIndex, scrollIntoView) => {
|
|
89
|
+
if (this.rowElements.length === 0) {
|
|
299
90
|
this.focusRowIndex = 0;
|
|
300
|
-
/**
|
|
301
|
-
* The index of the column that will receive focus the next time the
|
|
302
|
-
* grid is focused. This value changes as focus moves to different rows
|
|
303
|
-
* within the grid. Changing this value when focus is already within
|
|
304
|
-
* the grid moves focus to the specified column.
|
|
305
|
-
*
|
|
306
|
-
* @public
|
|
307
|
-
*/
|
|
308
91
|
this.focusColumnIndex = 0;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
this.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
};
|
|
336
|
-
this.onChildListChange = (mutations,
|
|
337
|
-
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
338
|
-
observer) => {
|
|
339
|
-
if (mutations && mutations.length) {
|
|
340
|
-
mutations.forEach((mutation) => {
|
|
341
|
-
mutation.addedNodes.forEach((newNode) => {
|
|
342
|
-
if (newNode.nodeType === 1 &&
|
|
343
|
-
newNode.getAttribute("role") === "row") {
|
|
344
|
-
newNode.columnDefinitions = this.columnDefinitions;
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
this.queueRowIndexUpdate();
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
this.queueRowIndexUpdate = () => {
|
|
352
|
-
if (!this.rowindexUpdateQueued) {
|
|
353
|
-
this.rowindexUpdateQueued = true;
|
|
354
|
-
index.DOM.queueUpdate(this.updateRowIndexes);
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
this.updateRowIndexes = () => {
|
|
358
|
-
let newGridTemplateColumns = this.gridTemplateColumns;
|
|
359
|
-
if (newGridTemplateColumns === undefined) {
|
|
360
|
-
// try to generate columns based on manual rows
|
|
361
|
-
if (this.generatedGridTemplateColumns === "" && this.rowElements.length > 0) {
|
|
362
|
-
const firstRow = this.rowElements[0];
|
|
363
|
-
this.generatedGridTemplateColumns = new Array(firstRow.cellElements.length)
|
|
364
|
-
.fill("1fr")
|
|
365
|
-
.join(" ");
|
|
366
|
-
}
|
|
367
|
-
newGridTemplateColumns = this.generatedGridTemplateColumns;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const focusRowIndex = Math.max(
|
|
95
|
+
0,
|
|
96
|
+
Math.min(this.rowElements.length - 1, rowIndex)
|
|
97
|
+
);
|
|
98
|
+
const focusRow = this.rowElements[focusRowIndex];
|
|
99
|
+
const cells = focusRow.querySelectorAll(
|
|
100
|
+
'[role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"]'
|
|
101
|
+
);
|
|
102
|
+
const focusColumnIndex = Math.max(
|
|
103
|
+
0,
|
|
104
|
+
Math.min(cells.length - 1, columnIndex)
|
|
105
|
+
);
|
|
106
|
+
const focusTarget = cells[focusColumnIndex];
|
|
107
|
+
if (scrollIntoView && this.scrollHeight !== this.clientHeight && (focusRowIndex < this.focusRowIndex && this.scrollTop > 0 || focusRowIndex > this.focusRowIndex && this.scrollTop < this.scrollHeight - this.clientHeight)) {
|
|
108
|
+
focusTarget.scrollIntoView({ block: "center", inline: "center" });
|
|
109
|
+
}
|
|
110
|
+
focusTarget.focus();
|
|
111
|
+
};
|
|
112
|
+
this.onChildListChange = (mutations, _) => {
|
|
113
|
+
if (mutations && mutations.length) {
|
|
114
|
+
mutations.forEach((mutation) => {
|
|
115
|
+
mutation.addedNodes.forEach((newNode) => {
|
|
116
|
+
if (newNode.nodeType === 1 && newNode.getAttribute("role") === "row") {
|
|
117
|
+
newNode.columnDefinitions = this.columnDefinitions;
|
|
368
118
|
}
|
|
369
|
-
|
|
370
|
-
const thisRow = element;
|
|
371
|
-
thisRow.rowIndex = index;
|
|
372
|
-
thisRow.gridTemplateColumns = newGridTemplateColumns;
|
|
373
|
-
if (this.columnDefinitionsStale) {
|
|
374
|
-
thisRow.columnDefinitions = this.columnDefinitions;
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
this.rowindexUpdateQueued = false;
|
|
378
|
-
this.columnDefinitionsStale = false;
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* generates a gridTemplateColumns based on columndata array
|
|
383
|
-
*/
|
|
384
|
-
static generateTemplateColumns(columnDefinitions) {
|
|
385
|
-
let templateColumns = "";
|
|
386
|
-
columnDefinitions.forEach((column) => {
|
|
387
|
-
templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}${"1fr"}`;
|
|
119
|
+
});
|
|
388
120
|
});
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
this.toggleGeneratedHeader();
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
gridTemplateColumnsChanged() {
|
|
410
|
-
if (this.$fastController.isConnected) {
|
|
411
|
-
this.updateRowIndexes();
|
|
121
|
+
this.queueRowIndexUpdate();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
this.queueRowIndexUpdate = () => {
|
|
125
|
+
if (!this.rowindexUpdateQueued) {
|
|
126
|
+
this.rowindexUpdateQueued = true;
|
|
127
|
+
defineVividComponent.DOM.queueUpdate(this.updateRowIndexes);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
this.updateRowIndexes = () => {
|
|
131
|
+
let newGridTemplateColumns = this.gridTemplateColumns;
|
|
132
|
+
if (newGridTemplateColumns === void 0) {
|
|
133
|
+
if (this.generatedGridTemplateColumns === "" && this.rowElements.length > 0) {
|
|
134
|
+
const firstRow = this.rowElements[0];
|
|
135
|
+
this.generatedGridTemplateColumns = new Array(
|
|
136
|
+
firstRow.cellElements.length
|
|
137
|
+
).fill("1fr").join(" ");
|
|
412
138
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
139
|
+
newGridTemplateColumns = this.generatedGridTemplateColumns;
|
|
140
|
+
}
|
|
141
|
+
this.rowElements.forEach((element, index) => {
|
|
142
|
+
const thisRow = element;
|
|
143
|
+
thisRow.rowIndex = index;
|
|
144
|
+
thisRow.gridTemplateColumns = newGridTemplateColumns;
|
|
145
|
+
if (this.columnDefinitionsStale) {
|
|
146
|
+
thisRow.columnDefinitions = this.columnDefinitions;
|
|
417
147
|
}
|
|
418
|
-
|
|
419
|
-
|
|
148
|
+
});
|
|
149
|
+
this.rowindexUpdateQueued = false;
|
|
150
|
+
this.columnDefinitionsStale = false;
|
|
151
|
+
};
|
|
152
|
+
this.#handleKeypress = (e) => {
|
|
153
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
154
|
+
this.#handleClick(e);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
this.#handleClick = ({ target, ctrlKey, shiftKey, metaKey }) => {
|
|
158
|
+
if (target.getAttribute("role") !== "gridcell") return;
|
|
159
|
+
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
160
|
+
this.#handleCellSelection({ target, ctrlKey, shiftKey, metaKey });
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
164
|
+
this.#handleRowSelection({ target, ctrlKey, shiftKey, metaKey });
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
this.#handleCellSelection = ({
|
|
168
|
+
target,
|
|
169
|
+
ctrlKey,
|
|
170
|
+
shiftKey,
|
|
171
|
+
metaKey
|
|
172
|
+
}) => {
|
|
173
|
+
const cell = target;
|
|
174
|
+
if (this.selectionMode === DataGridSelectionMode.multiCell && (ctrlKey || shiftKey || metaKey)) {
|
|
175
|
+
this.#setSelectedState(cell, !this.#selectedCells.includes(cell));
|
|
176
|
+
} else {
|
|
177
|
+
const cacheTargetSelection = cell.getAttribute("aria-selected") === "true";
|
|
178
|
+
this.#resetSelection();
|
|
179
|
+
this.#setSelectedState(cell, !cacheTargetSelection);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
this.#handleRowSelection = ({
|
|
183
|
+
target,
|
|
184
|
+
ctrlKey,
|
|
185
|
+
shiftKey,
|
|
186
|
+
metaKey
|
|
187
|
+
}) => {
|
|
188
|
+
const row = target.parentNode;
|
|
189
|
+
if (this.selectionMode === DataGridSelectionMode.multiRow && (ctrlKey || shiftKey || metaKey)) {
|
|
190
|
+
this.#setSelectedState(row, !this.#selectedRows.includes(row));
|
|
191
|
+
} else {
|
|
192
|
+
const cacheTargetSelection = row.getAttribute("aria-selected") === "true";
|
|
193
|
+
this.#resetSelection();
|
|
194
|
+
this.#setSelectedState(row, !cacheTargetSelection);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
this.#changeHandler = {
|
|
198
|
+
handleChange(dataGrid, propertyName) {
|
|
199
|
+
if (propertyName === "columnDefinitions") {
|
|
200
|
+
if (dataGrid.$fastController.isConnected) {
|
|
201
|
+
dataGrid.toggleGeneratedHeader();
|
|
202
|
+
}
|
|
420
203
|
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
this.#setSelectedState = (cell, selectedState) => {
|
|
207
|
+
cell.setAttribute("aria-selected", selectedState.toString());
|
|
208
|
+
};
|
|
209
|
+
this.#resetSelection = () => {
|
|
210
|
+
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
211
|
+
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
212
|
+
(cell) => this.#setSelectedState(cell, false)
|
|
213
|
+
);
|
|
214
|
+
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
215
|
+
(row) => row.removeAttribute("aria-selected")
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
if (this.selectionMode === DataGridSelectionMode.none) {
|
|
219
|
+
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
220
|
+
(cell) => cell.removeAttribute("aria-selected")
|
|
221
|
+
);
|
|
222
|
+
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
223
|
+
(row) => row.removeAttribute("aria-selected")
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
227
|
+
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
228
|
+
(cell) => cell.removeAttribute("aria-selected")
|
|
229
|
+
);
|
|
230
|
+
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
231
|
+
(row) => row.setAttribute("aria-selected", "false")
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
this.#initSelections = () => {
|
|
236
|
+
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
237
|
+
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
238
|
+
(cell) => !cell.hasAttribute("aria-selected") && this.#setSelectedState(cell, false)
|
|
239
|
+
);
|
|
240
|
+
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
241
|
+
(row) => row.removeAttribute("aria-selected")
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
if (this.selectionMode === DataGridSelectionMode.none) {
|
|
245
|
+
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
246
|
+
(cell) => cell.removeAttribute("aria-selected")
|
|
247
|
+
);
|
|
248
|
+
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
249
|
+
(row) => row.removeAttribute("aria-selected")
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
253
|
+
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
254
|
+
(cell) => cell.removeAttribute("aria-selected")
|
|
255
|
+
);
|
|
256
|
+
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
257
|
+
(row) => !row.hasAttribute("aria-selected") && row.setAttribute("aria-selected", "false")
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
this.addEventListener("click", this.#handleClick);
|
|
262
|
+
this.addEventListener("keydown", this.#handleKeypress);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* generates a gridTemplateColumns based on columndata array
|
|
266
|
+
*/
|
|
267
|
+
static generateTemplateColumns(columnDefinitions) {
|
|
268
|
+
let templateColumns = "";
|
|
269
|
+
columnDefinitions.forEach((_) => {
|
|
270
|
+
templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}${"1fr"}`;
|
|
271
|
+
});
|
|
272
|
+
return templateColumns;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
noTabbingChanged() {
|
|
278
|
+
if (this.noTabbing) {
|
|
279
|
+
this.setAttribute("tabIndex", "-1");
|
|
280
|
+
} else {
|
|
281
|
+
this.setAttribute(
|
|
282
|
+
"tabIndex",
|
|
283
|
+
this.contains(document.activeElement) ? "-1" : "0"
|
|
284
|
+
);
|
|
421
285
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
this.columnDefinitionsStale = true;
|
|
430
|
-
this.queueRowIndexUpdate();
|
|
431
|
-
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* @internal
|
|
289
|
+
*/
|
|
290
|
+
generateHeaderChanged() {
|
|
291
|
+
if (this.$fastController.isConnected) {
|
|
292
|
+
this.toggleGeneratedHeader();
|
|
432
293
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @internal
|
|
297
|
+
*/
|
|
298
|
+
gridTemplateColumnsChanged() {
|
|
299
|
+
if (this.$fastController.isConnected) {
|
|
300
|
+
this.updateRowIndexes();
|
|
439
301
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* @internal
|
|
305
|
+
*/
|
|
306
|
+
rowsDataChanged() {
|
|
307
|
+
if (this.columnDefinitions === null && this.rowsData.length > 0) {
|
|
308
|
+
this.columnDefinitions = _DataGrid.generateColumns(this.rowsData[0]);
|
|
444
309
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
this.queueFocusUpdate();
|
|
448
|
-
}
|
|
310
|
+
if (this.$fastController.isConnected) {
|
|
311
|
+
this.toggleGeneratedHeader();
|
|
449
312
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
this.rowsPlaceholder = document.createComment("");
|
|
459
|
-
this.appendChild(this.rowsPlaceholder);
|
|
460
|
-
this.toggleGeneratedHeader();
|
|
461
|
-
this.rowsRepeatBehavior = new repeat.RepeatDirective(x => x.rowsData, x => x.rowItemTemplate, { positioning: true }).createBehavior(this.rowsPlaceholder);
|
|
462
|
-
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
463
|
-
this.$fastController.addBehaviors([this.rowsRepeatBehavior]);
|
|
464
|
-
this.addEventListener("row-focused", this.handleRowFocus);
|
|
465
|
-
this.addEventListener(eventFocus, this.handleFocus);
|
|
466
|
-
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
467
|
-
this.addEventListener(eventFocusOut, this.handleFocusOut);
|
|
468
|
-
this.observer = new MutationObserver(this.onChildListChange);
|
|
469
|
-
// only observe if nodes are added or removed
|
|
470
|
-
this.observer.observe(this, { childList: true });
|
|
471
|
-
if (this.noTabbing) {
|
|
472
|
-
this.setAttribute("tabindex", "-1");
|
|
473
|
-
}
|
|
474
|
-
index.DOM.queueUpdate(this.queueRowIndexUpdate);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* @internal
|
|
316
|
+
*/
|
|
317
|
+
columnDefinitionsChanged() {
|
|
318
|
+
if (this.columnDefinitions === null) {
|
|
319
|
+
this.generatedGridTemplateColumns = "";
|
|
320
|
+
return;
|
|
475
321
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
this.removeEventListener(eventFocus, this.handleFocus);
|
|
483
|
-
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
484
|
-
this.removeEventListener(eventFocusOut, this.handleFocusOut);
|
|
485
|
-
// disconnect observer
|
|
486
|
-
this.observer.disconnect();
|
|
487
|
-
this.rowsPlaceholder = null;
|
|
488
|
-
this.generatedHeader = null;
|
|
322
|
+
this.generatedGridTemplateColumns = _DataGrid.generateTemplateColumns(
|
|
323
|
+
this.columnDefinitions
|
|
324
|
+
);
|
|
325
|
+
if (this.$fastController.isConnected) {
|
|
326
|
+
this.columnDefinitionsStale = true;
|
|
327
|
+
this.queueRowIndexUpdate();
|
|
489
328
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
this.
|
|
498
|
-
|
|
499
|
-
this.isUpdatingFocus = false;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* @internal
|
|
332
|
+
*/
|
|
333
|
+
headerCellItemTemplateChanged() {
|
|
334
|
+
if (this.$fastController.isConnected) {
|
|
335
|
+
if (this.generatedHeader !== null) {
|
|
336
|
+
this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
|
|
337
|
+
}
|
|
500
338
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* @internal
|
|
342
|
+
*/
|
|
343
|
+
focusRowIndexChanged() {
|
|
344
|
+
if (this.$fastController.isConnected) {
|
|
345
|
+
this.queueFocusUpdate();
|
|
506
346
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* @internal
|
|
350
|
+
*/
|
|
351
|
+
focusColumnIndexChanged() {
|
|
352
|
+
if (this.$fastController.isConnected) {
|
|
353
|
+
this.queueFocusUpdate();
|
|
514
354
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const maxIndex = this.rowElements.length - 1;
|
|
524
|
-
const currentGridBottom = this.offsetHeight + this.scrollTop;
|
|
525
|
-
const lastRow = this.rowElements[maxIndex];
|
|
526
|
-
switch (e.key) {
|
|
527
|
-
case keyCodes.keyArrowUp:
|
|
528
|
-
e.preventDefault();
|
|
529
|
-
// focus up one row
|
|
530
|
-
this.focusOnCell(this.focusRowIndex - 1, this.focusColumnIndex, true);
|
|
531
|
-
break;
|
|
532
|
-
case keyCodes.keyArrowDown:
|
|
533
|
-
e.preventDefault();
|
|
534
|
-
// focus down one row
|
|
535
|
-
this.focusOnCell(this.focusRowIndex + 1, this.focusColumnIndex, true);
|
|
536
|
-
break;
|
|
537
|
-
case keyCodes.keyPageUp:
|
|
538
|
-
e.preventDefault();
|
|
539
|
-
if (this.rowElements.length === 0) {
|
|
540
|
-
this.focusOnCell(0, 0, false);
|
|
541
|
-
break;
|
|
542
|
-
}
|
|
543
|
-
if (this.focusRowIndex === 0) {
|
|
544
|
-
this.focusOnCell(0, this.focusColumnIndex, false);
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
newFocusRowIndex = this.focusRowIndex - 1;
|
|
548
|
-
for (newFocusRowIndex; newFocusRowIndex >= 0; newFocusRowIndex--) {
|
|
549
|
-
const thisRow = this.rowElements[newFocusRowIndex];
|
|
550
|
-
if (thisRow.offsetTop < this.scrollTop) {
|
|
551
|
-
this.scrollTop =
|
|
552
|
-
thisRow.offsetTop + thisRow.clientHeight - this.clientHeight;
|
|
553
|
-
break;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
|
|
557
|
-
break;
|
|
558
|
-
case keyCodes.keyPageDown:
|
|
559
|
-
e.preventDefault();
|
|
560
|
-
if (this.rowElements.length === 0) {
|
|
561
|
-
this.focusOnCell(0, 0, false);
|
|
562
|
-
break;
|
|
563
|
-
}
|
|
564
|
-
// focus down one "page"
|
|
565
|
-
if (this.focusRowIndex >= maxIndex ||
|
|
566
|
-
lastRow.offsetTop + lastRow.offsetHeight <= currentGridBottom) {
|
|
567
|
-
this.focusOnCell(maxIndex, this.focusColumnIndex, false);
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
newFocusRowIndex = this.focusRowIndex + 1;
|
|
571
|
-
for (newFocusRowIndex; newFocusRowIndex <= maxIndex; newFocusRowIndex++) {
|
|
572
|
-
const thisRow = this.rowElements[newFocusRowIndex];
|
|
573
|
-
if (thisRow.offsetTop + thisRow.offsetHeight > currentGridBottom) {
|
|
574
|
-
let stickyHeaderOffset = 0;
|
|
575
|
-
if (this.generateHeader === GenerateHeaderOptions$1.sticky &&
|
|
576
|
-
this.generatedHeader !== null) {
|
|
577
|
-
stickyHeaderOffset = this.generatedHeader.clientHeight;
|
|
578
|
-
}
|
|
579
|
-
this.scrollTop = thisRow.offsetTop - stickyHeaderOffset;
|
|
580
|
-
break;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
|
|
584
|
-
break;
|
|
585
|
-
case keyCodes.keyHome:
|
|
586
|
-
if (e.ctrlKey) {
|
|
587
|
-
e.preventDefault();
|
|
588
|
-
// focus first cell of first row
|
|
589
|
-
this.focusOnCell(0, 0, true);
|
|
590
|
-
}
|
|
591
|
-
break;
|
|
592
|
-
case keyCodes.keyEnd:
|
|
593
|
-
if (e.ctrlKey && this.columnDefinitions !== null) {
|
|
594
|
-
e.preventDefault();
|
|
595
|
-
// focus last cell of last row
|
|
596
|
-
this.focusOnCell(this.rowElements.length - 1, this.columnDefinitions.length - 1, true);
|
|
597
|
-
}
|
|
598
|
-
break;
|
|
599
|
-
}
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* @internal
|
|
358
|
+
*/
|
|
359
|
+
connectedCallback() {
|
|
360
|
+
super.connectedCallback();
|
|
361
|
+
if (this.rowItemTemplate === void 0) {
|
|
362
|
+
this.rowItemTemplate = this.defaultRowItemTemplate;
|
|
600
363
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
364
|
+
this.rowsPlaceholder = document.createComment("");
|
|
365
|
+
this.appendChild(this.rowsPlaceholder);
|
|
366
|
+
this.toggleGeneratedHeader();
|
|
367
|
+
this.rowsRepeatBehavior = new repeat.RepeatDirective(
|
|
368
|
+
(x) => x.rowsData,
|
|
369
|
+
(x) => x.rowItemTemplate,
|
|
370
|
+
{ positioning: true }
|
|
371
|
+
).createBehavior(this.rowsPlaceholder);
|
|
372
|
+
this.$fastController.addBehaviors([this.rowsRepeatBehavior]);
|
|
373
|
+
this.addEventListener("row-focused", this.handleRowFocus);
|
|
374
|
+
this.addEventListener(eventFocus, this.handleFocus);
|
|
375
|
+
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
376
|
+
this.addEventListener(eventFocusOut, this.handleFocusOut);
|
|
377
|
+
this.observer = new MutationObserver(this.onChildListChange);
|
|
378
|
+
this.observer.observe(this, { childList: true });
|
|
379
|
+
defineVividComponent.DOM.queueUpdate(this.queueRowIndexUpdate);
|
|
380
|
+
defineVividComponent.Observable.getNotifier(this).subscribe(
|
|
381
|
+
this.#changeHandler,
|
|
382
|
+
"columnDefinitions"
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* @internal
|
|
387
|
+
*/
|
|
388
|
+
disconnectedCallback() {
|
|
389
|
+
super.disconnectedCallback();
|
|
390
|
+
this.removeEventListener("row-focused", this.handleRowFocus);
|
|
391
|
+
this.removeEventListener(eventFocus, this.handleFocus);
|
|
392
|
+
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
393
|
+
this.removeEventListener(
|
|
394
|
+
eventFocusOut,
|
|
395
|
+
this.handleFocusOut
|
|
396
|
+
);
|
|
397
|
+
this.observer.disconnect();
|
|
398
|
+
this.rowsPlaceholder = null;
|
|
399
|
+
this.generatedHeader = null;
|
|
400
|
+
defineVividComponent.Observable.getNotifier(this).unsubscribe(
|
|
401
|
+
this.#changeHandler,
|
|
402
|
+
"columnDefinitions"
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* @internal
|
|
407
|
+
*/
|
|
408
|
+
handleRowFocus(e) {
|
|
409
|
+
this.isUpdatingFocus = true;
|
|
410
|
+
const focusRow = e.target;
|
|
411
|
+
this.focusRowIndex = this.rowElements.indexOf(focusRow);
|
|
412
|
+
this.focusColumnIndex = focusRow.focusColumnIndex;
|
|
413
|
+
this.setAttribute("tabIndex", "-1");
|
|
414
|
+
this.isUpdatingFocus = false;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* @internal
|
|
418
|
+
*/
|
|
419
|
+
handleFocus(_) {
|
|
420
|
+
this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* @internal
|
|
424
|
+
*/
|
|
425
|
+
handleFocusOut(e) {
|
|
426
|
+
if (e.relatedTarget === null || !this.contains(e.relatedTarget)) {
|
|
427
|
+
this.setAttribute("tabIndex", this.noTabbing ? "-1" : "0");
|
|
610
428
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* @internal
|
|
432
|
+
*/
|
|
433
|
+
handleKeydown(e) {
|
|
434
|
+
if (e.defaultPrevented) {
|
|
435
|
+
return;
|
|
614
436
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
437
|
+
let newFocusRowIndex;
|
|
438
|
+
const maxIndex = this.rowElements.length - 1;
|
|
439
|
+
const currentGridBottom = this.offsetHeight + this.scrollTop;
|
|
440
|
+
const lastRow = this.rowElements[maxIndex];
|
|
441
|
+
switch (e.key) {
|
|
442
|
+
case keyCodes.keyArrowUp:
|
|
443
|
+
e.preventDefault();
|
|
444
|
+
this.focusOnCell(this.focusRowIndex - 1, this.focusColumnIndex, true);
|
|
445
|
+
break;
|
|
446
|
+
case keyCodes.keyArrowDown:
|
|
447
|
+
e.preventDefault();
|
|
448
|
+
this.focusOnCell(this.focusRowIndex + 1, this.focusColumnIndex, true);
|
|
449
|
+
break;
|
|
450
|
+
case keyCodes.keyPageUp:
|
|
451
|
+
e.preventDefault();
|
|
452
|
+
if (this.rowElements.length === 0) {
|
|
453
|
+
this.focusOnCell(0, 0, false);
|
|
454
|
+
break;
|
|
619
455
|
}
|
|
620
|
-
if (this.
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
this.generatedHeader = generatedHeaderElement;
|
|
624
|
-
this.generatedHeader.columnDefinitions = this.columnDefinitions;
|
|
625
|
-
this.generatedHeader.gridTemplateColumns = this.gridTemplateColumns;
|
|
626
|
-
this.generatedHeader.rowType =
|
|
627
|
-
this.generateHeader === GenerateHeaderOptions$1.sticky
|
|
628
|
-
? DataGridRowTypes$1.stickyHeader
|
|
629
|
-
: DataGridRowTypes$1.header;
|
|
630
|
-
if (this.firstChild !== null || this.rowsPlaceholder !== null) {
|
|
631
|
-
this.insertBefore(generatedHeaderElement, this.firstChild !== null ? this.firstChild : this.rowsPlaceholder);
|
|
632
|
-
}
|
|
633
|
-
return;
|
|
456
|
+
if (this.focusRowIndex === 0) {
|
|
457
|
+
this.focusOnCell(0, this.focusColumnIndex, false);
|
|
458
|
+
return;
|
|
634
459
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
return {
|
|
643
|
-
columnDataKey: property,
|
|
644
|
-
gridColumn: `${index}`,
|
|
645
|
-
};
|
|
646
|
-
});
|
|
647
|
-
};
|
|
648
|
-
index.__decorate([
|
|
649
|
-
index.attr({ attribute: "no-tabbing", mode: "boolean" })
|
|
650
|
-
], DataGrid$1.prototype, "noTabbing", void 0);
|
|
651
|
-
index.__decorate([
|
|
652
|
-
index.attr({ attribute: "generate-header" })
|
|
653
|
-
], DataGrid$1.prototype, "generateHeader", void 0);
|
|
654
|
-
index.__decorate([
|
|
655
|
-
index.attr({ attribute: "grid-template-columns" })
|
|
656
|
-
], DataGrid$1.prototype, "gridTemplateColumns", void 0);
|
|
657
|
-
index.__decorate([
|
|
658
|
-
index.observable
|
|
659
|
-
], DataGrid$1.prototype, "rowsData", void 0);
|
|
660
|
-
index.__decorate([
|
|
661
|
-
index.observable
|
|
662
|
-
], DataGrid$1.prototype, "columnDefinitions", void 0);
|
|
663
|
-
index.__decorate([
|
|
664
|
-
index.observable
|
|
665
|
-
], DataGrid$1.prototype, "rowItemTemplate", void 0);
|
|
666
|
-
index.__decorate([
|
|
667
|
-
index.observable
|
|
668
|
-
], DataGrid$1.prototype, "cellItemTemplate", void 0);
|
|
669
|
-
index.__decorate([
|
|
670
|
-
index.observable
|
|
671
|
-
], DataGrid$1.prototype, "headerCellItemTemplate", void 0);
|
|
672
|
-
index.__decorate([
|
|
673
|
-
index.observable
|
|
674
|
-
], DataGrid$1.prototype, "focusRowIndex", void 0);
|
|
675
|
-
index.__decorate([
|
|
676
|
-
index.observable
|
|
677
|
-
], DataGrid$1.prototype, "focusColumnIndex", void 0);
|
|
678
|
-
index.__decorate([
|
|
679
|
-
index.observable
|
|
680
|
-
], DataGrid$1.prototype, "defaultRowItemTemplate", void 0);
|
|
681
|
-
index.__decorate([
|
|
682
|
-
index.observable
|
|
683
|
-
], DataGrid$1.prototype, "rowElementTag", void 0);
|
|
684
|
-
index.__decorate([
|
|
685
|
-
index.observable
|
|
686
|
-
], DataGrid$1.prototype, "rowElements", void 0);
|
|
687
|
-
|
|
688
|
-
const defaultCellContentsTemplate = index.html `
|
|
689
|
-
<template>
|
|
690
|
-
${x => x.rowData === null ||
|
|
691
|
-
x.columnDefinition === null ||
|
|
692
|
-
x.columnDefinition.columnDataKey === null
|
|
693
|
-
? null
|
|
694
|
-
: x.rowData[x.columnDefinition.columnDataKey]}
|
|
695
|
-
</template>
|
|
696
|
-
`;
|
|
697
|
-
const defaultHeaderCellContentsTemplate = index.html `
|
|
698
|
-
<template>
|
|
699
|
-
${x => x.columnDefinition === null
|
|
700
|
-
? null
|
|
701
|
-
: x.columnDefinition.title === undefined
|
|
702
|
-
? x.columnDefinition.columnDataKey
|
|
703
|
-
: x.columnDefinition.title}
|
|
704
|
-
</template>
|
|
705
|
-
`;
|
|
706
|
-
/**
|
|
707
|
-
* A Data Grid Cell Custom HTML Element.
|
|
708
|
-
*
|
|
709
|
-
* @fires cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
|
|
710
|
-
* @slot - The default slot for cell contents. The "cell contents template" renders here.
|
|
711
|
-
* @public
|
|
712
|
-
*/
|
|
713
|
-
let DataGridCell$1 = class DataGridCell extends index.FoundationElement {
|
|
714
|
-
constructor() {
|
|
715
|
-
super(...arguments);
|
|
716
|
-
/**
|
|
717
|
-
* The type of cell
|
|
718
|
-
*
|
|
719
|
-
* @public
|
|
720
|
-
* @remarks
|
|
721
|
-
* HTML Attribute: cell-type
|
|
722
|
-
*/
|
|
723
|
-
this.cellType = DataGridCellTypes.default;
|
|
724
|
-
/**
|
|
725
|
-
* The base data for the parent row
|
|
726
|
-
*
|
|
727
|
-
* @public
|
|
728
|
-
*/
|
|
729
|
-
this.rowData = null;
|
|
730
|
-
/**
|
|
731
|
-
* The base data for the column
|
|
732
|
-
*
|
|
733
|
-
* @public
|
|
734
|
-
*/
|
|
735
|
-
this.columnDefinition = null;
|
|
736
|
-
this.isActiveCell = false;
|
|
737
|
-
this.customCellView = null;
|
|
738
|
-
this.updateCellStyle = () => {
|
|
739
|
-
this.style.gridColumn = this.gridColumn;
|
|
740
|
-
};
|
|
741
|
-
}
|
|
742
|
-
cellTypeChanged() {
|
|
743
|
-
if (this.$fastController.isConnected) {
|
|
744
|
-
this.updateCellView();
|
|
460
|
+
newFocusRowIndex = this.focusRowIndex - 1;
|
|
461
|
+
for (newFocusRowIndex; newFocusRowIndex >= 0; newFocusRowIndex--) {
|
|
462
|
+
const thisRow = this.rowElements[newFocusRowIndex];
|
|
463
|
+
if (thisRow.offsetTop < this.scrollTop) {
|
|
464
|
+
this.scrollTop = thisRow.offsetTop + thisRow.clientHeight - this.clientHeight;
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
745
467
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
468
|
+
this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
|
|
469
|
+
break;
|
|
470
|
+
case keyCodes.keyPageDown:
|
|
471
|
+
e.preventDefault();
|
|
472
|
+
if (this.rowElements.length === 0) {
|
|
473
|
+
this.focusOnCell(0, 0, false);
|
|
474
|
+
break;
|
|
750
475
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
this.updateCellView();
|
|
476
|
+
if (this.focusRowIndex >= maxIndex || lastRow.offsetTop + lastRow.offsetHeight <= currentGridBottom) {
|
|
477
|
+
this.focusOnCell(maxIndex, this.focusColumnIndex, false);
|
|
478
|
+
return;
|
|
755
479
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
? 0
|
|
768
|
-
: this.columnDefinition.gridColumn}`;
|
|
769
|
-
this.updateCellView();
|
|
770
|
-
this.updateCellStyle();
|
|
771
|
-
}
|
|
772
|
-
/**
|
|
773
|
-
* @internal
|
|
774
|
-
*/
|
|
775
|
-
disconnectedCallback() {
|
|
776
|
-
super.disconnectedCallback();
|
|
777
|
-
this.removeEventListener(eventFocusIn, this.handleFocusin);
|
|
778
|
-
this.removeEventListener(eventFocusOut, this.handleFocusout);
|
|
779
|
-
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
780
|
-
this.disconnectCellView();
|
|
781
|
-
}
|
|
782
|
-
handleFocusin(e) {
|
|
783
|
-
if (this.isActiveCell) {
|
|
784
|
-
return;
|
|
480
|
+
newFocusRowIndex = this.focusRowIndex + 1;
|
|
481
|
+
for (newFocusRowIndex; newFocusRowIndex <= maxIndex; newFocusRowIndex++) {
|
|
482
|
+
const thisRow = this.rowElements[newFocusRowIndex];
|
|
483
|
+
if (thisRow.offsetTop + thisRow.offsetHeight > currentGridBottom) {
|
|
484
|
+
let stickyHeaderOffset = 0;
|
|
485
|
+
if (this.generateHeader === GenerateHeaderOptions.sticky && this.generatedHeader !== null) {
|
|
486
|
+
stickyHeaderOffset = this.generatedHeader.clientHeight;
|
|
487
|
+
}
|
|
488
|
+
this.scrollTop = thisRow.offsetTop - stickyHeaderOffset;
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
785
491
|
}
|
|
786
|
-
this.
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
"function") {
|
|
793
|
-
// move focus to the focus target
|
|
794
|
-
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
795
|
-
if (focusTarget !== null) {
|
|
796
|
-
focusTarget.focus();
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
break;
|
|
800
|
-
default:
|
|
801
|
-
if (this.columnDefinition !== null &&
|
|
802
|
-
this.columnDefinition.cellInternalFocusQueue !== true &&
|
|
803
|
-
typeof this.columnDefinition.cellFocusTargetCallback === "function") {
|
|
804
|
-
// move focus to the focus target
|
|
805
|
-
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
806
|
-
if (focusTarget !== null) {
|
|
807
|
-
focusTarget.focus();
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
break;
|
|
492
|
+
this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
|
|
493
|
+
break;
|
|
494
|
+
case keyCodes.keyHome:
|
|
495
|
+
if (e.ctrlKey) {
|
|
496
|
+
e.preventDefault();
|
|
497
|
+
this.focusOnCell(0, 0, true);
|
|
811
498
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
499
|
+
break;
|
|
500
|
+
case keyCodes.keyEnd:
|
|
501
|
+
if (e.ctrlKey && this.columnDefinitions !== null) {
|
|
502
|
+
e.preventDefault();
|
|
503
|
+
this.focusOnCell(
|
|
504
|
+
this.rowElements.length - 1,
|
|
505
|
+
this.columnDefinitions.length - 1,
|
|
506
|
+
true
|
|
507
|
+
);
|
|
817
508
|
}
|
|
509
|
+
break;
|
|
818
510
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
this.columnDefinition.cellInternalFocusQueue !== true) ||
|
|
824
|
-
(this.cellType === DataGridCellTypes.columnHeader &&
|
|
825
|
-
this.columnDefinition.headerCellInternalFocusQueue !== true)) {
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
switch (e.key) {
|
|
829
|
-
case keyCodes.keyEnter:
|
|
830
|
-
case keyCodes.keyFunction2:
|
|
831
|
-
if (this.contains(document.activeElement) &&
|
|
832
|
-
document.activeElement !== this) {
|
|
833
|
-
return;
|
|
834
|
-
}
|
|
835
|
-
switch (this.cellType) {
|
|
836
|
-
case DataGridCellTypes.columnHeader:
|
|
837
|
-
if (this.columnDefinition.headerCellFocusTargetCallback !==
|
|
838
|
-
undefined) {
|
|
839
|
-
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
840
|
-
if (focusTarget !== null) {
|
|
841
|
-
focusTarget.focus();
|
|
842
|
-
}
|
|
843
|
-
e.preventDefault();
|
|
844
|
-
}
|
|
845
|
-
break;
|
|
846
|
-
default:
|
|
847
|
-
if (this.columnDefinition.cellFocusTargetCallback !== undefined) {
|
|
848
|
-
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
849
|
-
if (focusTarget !== null) {
|
|
850
|
-
focusTarget.focus();
|
|
851
|
-
}
|
|
852
|
-
e.preventDefault();
|
|
853
|
-
}
|
|
854
|
-
break;
|
|
855
|
-
}
|
|
856
|
-
break;
|
|
857
|
-
case keyCodes.keyEscape:
|
|
858
|
-
if (this.contains(document.activeElement) &&
|
|
859
|
-
document.activeElement !== this) {
|
|
860
|
-
this.focus();
|
|
861
|
-
e.preventDefault();
|
|
862
|
-
}
|
|
863
|
-
break;
|
|
864
|
-
}
|
|
511
|
+
}
|
|
512
|
+
queueFocusUpdate() {
|
|
513
|
+
if (this.isUpdatingFocus && this.contains(document.activeElement)) {
|
|
514
|
+
return;
|
|
865
515
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
return;
|
|
870
|
-
}
|
|
871
|
-
switch (this.cellType) {
|
|
872
|
-
case DataGridCellTypes.columnHeader:
|
|
873
|
-
if (this.columnDefinition.headerCellTemplate !== undefined) {
|
|
874
|
-
this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
|
|
875
|
-
}
|
|
876
|
-
else {
|
|
877
|
-
this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
|
|
878
|
-
}
|
|
879
|
-
break;
|
|
880
|
-
case undefined:
|
|
881
|
-
case DataGridCellTypes.rowHeader:
|
|
882
|
-
case DataGridCellTypes.default:
|
|
883
|
-
if (this.columnDefinition.cellTemplate !== undefined) {
|
|
884
|
-
this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
|
|
885
|
-
}
|
|
886
|
-
else {
|
|
887
|
-
this.customCellView = defaultCellContentsTemplate.render(this, this);
|
|
888
|
-
}
|
|
889
|
-
break;
|
|
890
|
-
}
|
|
516
|
+
if (this.pendingFocusUpdate === false) {
|
|
517
|
+
this.pendingFocusUpdate = true;
|
|
518
|
+
defineVividComponent.DOM.queueUpdate(() => this.updateFocus());
|
|
891
519
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
520
|
+
}
|
|
521
|
+
updateFocus() {
|
|
522
|
+
this.pendingFocusUpdate = false;
|
|
523
|
+
this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
|
|
524
|
+
}
|
|
525
|
+
toggleGeneratedHeader() {
|
|
526
|
+
if (this.generatedHeader !== null) {
|
|
527
|
+
this.removeChild(this.generatedHeader);
|
|
528
|
+
this.generatedHeader = null;
|
|
529
|
+
}
|
|
530
|
+
if (this.generateHeader !== GenerateHeaderOptions.none && this.columnDefinitions !== null) {
|
|
531
|
+
const generatedHeaderElement = document.createElement(
|
|
532
|
+
this.rowElementTag
|
|
533
|
+
);
|
|
534
|
+
this.generatedHeader = generatedHeaderElement;
|
|
535
|
+
this.generatedHeader.columnDefinitions = this.columnDefinitions;
|
|
536
|
+
this.generatedHeader.gridTemplateColumns = this.gridTemplateColumns;
|
|
537
|
+
this.generatedHeader.rowType = this.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : DataGridRowTypes.header;
|
|
538
|
+
if (this.firstChild !== null || this.rowsPlaceholder !== null) {
|
|
539
|
+
this.insertBefore(
|
|
540
|
+
generatedHeaderElement,
|
|
541
|
+
this.firstChild !== null ? this.firstChild : this.rowsPlaceholder
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
return;
|
|
897
545
|
}
|
|
898
|
-
}
|
|
899
|
-
index.__decorate([
|
|
900
|
-
index.attr({ attribute: "cell-type" })
|
|
901
|
-
], DataGridCell$1.prototype, "cellType", void 0);
|
|
902
|
-
index.__decorate([
|
|
903
|
-
index.attr({ attribute: "grid-column" })
|
|
904
|
-
], DataGridCell$1.prototype, "gridColumn", void 0);
|
|
905
|
-
index.__decorate([
|
|
906
|
-
index.observable
|
|
907
|
-
], DataGridCell$1.prototype, "rowData", void 0);
|
|
908
|
-
index.__decorate([
|
|
909
|
-
index.observable
|
|
910
|
-
], DataGridCell$1.prototype, "columnDefinition", void 0);
|
|
911
|
-
|
|
912
|
-
const dataGridStyles = ":host{display:block}:host([generate-header=sticky]){max-block-size:400px}.base{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.base{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.base ::-webkit-scrollbar{width:4px}.base ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.base ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-thumb-color)}.base{position:relative;overflow:auto;block-size:inherit;inline-size:100%;max-block-size:inherit}";
|
|
913
|
-
|
|
914
|
-
const dataGridRowStyles = ".base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-row-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-row-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-row-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-data-grid-row-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-data-grid-row-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-data-grid-row-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-row-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-row-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-row-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-row-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-data-grid-row-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-data-grid-row-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-data-grid-row-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-row-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:grid;width:100%;box-sizing:border-box;color:var(--vvd-color-canvas-text)}:host([row-type=sticky-header]) .base{position:sticky;z-index:9;top:0;background:var(--data-grid-row-background, var(--vvd-color-canvas))}:host([row-type=hidden-header]) .base{display:none}:host(:is([aria-selected]):not([row-type*=header])) .base{background-color:var(--_appearance-color-fill)}";
|
|
915
|
-
|
|
916
|
-
const dataGridCellStyles = ":host{block-size:100%;min-inline-size:80px}:host(:focus-visible){outline:none}.base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-cell-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-cell-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-cell-cta-firm, var(--vvd-color-cta-600));--_connotation-color-soft: var(--vvd-data-grid-cell-cta-soft, var(--vvd-color-cta-100));--_connotation-color-faint: var(--vvd-data-grid-cell-cta-faint, var(--vvd-color-cta-50));--_connotation-color-pale: var(--vvd-data-grid-cell-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-cell-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-cell-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-cell-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-cell-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-soft: var(--vvd-data-grid-cell-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-faint: var(--vvd-data-grid-cell-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-pale: var(--vvd-data-grid-cell-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-cell-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:flex;box-sizing:border-box;align-items:center;border-bottom:1px solid var(--vvd-color-neutral-300);block-size:var(--data-grid-cell-block-size, var(--_data-grid-cell-default-block-size));color:var(--_appearance-color-text);font:var(--vvd-typography-base);min-block-size:calc(1px*(48 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-block:13px 14px;padding-inline:12px}:host(:focus-visible) .base{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}:host([cell-type=columnheader]) .base{border-color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);--_data-grid-cell-default-block-size: calc(1px*(48 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_data-grid-cell-default-white-space: nowrap}:host(:not([cell-type=columnheader])) .base{--_data-grid-cell-default-block-size: 100%;--_data-grid-cell-default-white-space: normal}:host(:is([aria-selected]):not([cell-type=columnheader])) .base{background-color:var(--_appearance-color-fill)}slot{display:block;overflow:hidden;text-overflow:ellipsis;white-space:var(--data-grid-cell-white-space, var(--_data-grid-cell-default-white-space))}:host(:not([cell-type=columnheader][aria-sort])) slot{inline-size:100%}.header-icon{margin-inline-start:16px}";
|
|
917
|
-
|
|
918
|
-
const DataGridCellSortStates = {
|
|
919
|
-
none: "none",
|
|
920
|
-
ascending: "ascending",
|
|
921
|
-
descending: "descending",
|
|
922
|
-
other: "other"
|
|
923
|
-
};
|
|
924
|
-
const GenerateHeaderOptions = {
|
|
925
|
-
none: "none",
|
|
926
|
-
default: "default",
|
|
927
|
-
sticky: "sticky"
|
|
928
|
-
};
|
|
929
|
-
const DataGridRowTypes = {
|
|
930
|
-
default: "default",
|
|
931
|
-
header: "header",
|
|
932
|
-
stickyHeader: "sticky-header"
|
|
933
|
-
};
|
|
934
|
-
const DataGridCellRole = {
|
|
935
|
-
columnheader: "columnheader",
|
|
936
|
-
rowheader: "rowheader",
|
|
937
|
-
default: "gridcell"
|
|
938
|
-
};
|
|
939
|
-
|
|
940
|
-
var __defProp$2 = Object.defineProperty;
|
|
941
|
-
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
942
|
-
var result = void 0 ;
|
|
943
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
944
|
-
if (decorator = decorators[i])
|
|
945
|
-
result = (decorator(target, key, result) ) || result;
|
|
946
|
-
if (result) __defProp$2(target, key, result);
|
|
947
|
-
return result;
|
|
948
|
-
};
|
|
949
|
-
const DataGridSelectionMode = {
|
|
950
|
-
none: "none",
|
|
951
|
-
singleRow: "single-row",
|
|
952
|
-
multiRow: "multi-row",
|
|
953
|
-
singleCell: "single-cell",
|
|
954
|
-
multiCell: "multi-cell"
|
|
955
|
-
};
|
|
956
|
-
class DataGrid extends DataGrid$1 {
|
|
546
|
+
}
|
|
957
547
|
/**
|
|
958
548
|
*
|
|
959
549
|
*
|
|
@@ -978,162 +568,19 @@ class DataGrid extends DataGrid$1 {
|
|
|
978
568
|
}
|
|
979
569
|
selectionModeChanged(oldValue) {
|
|
980
570
|
if (oldValue === void 0) {
|
|
981
|
-
|
|
571
|
+
defineVividComponent.DOM.queueUpdate(this.#initSelections);
|
|
982
572
|
return;
|
|
983
573
|
}
|
|
984
574
|
this.#resetSelection();
|
|
985
575
|
}
|
|
986
|
-
#handleKeypress
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
#
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
this.#handleCellSelection({ target, ctrlKey, shiftKey, metaKey });
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
998
|
-
this.#handleRowSelection({ target, ctrlKey, shiftKey, metaKey });
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
#handleCellSelection = ({
|
|
1002
|
-
target,
|
|
1003
|
-
ctrlKey,
|
|
1004
|
-
shiftKey,
|
|
1005
|
-
metaKey
|
|
1006
|
-
}) => {
|
|
1007
|
-
const cell = target;
|
|
1008
|
-
if (this.selectionMode === DataGridSelectionMode.multiCell && (ctrlKey || shiftKey || metaKey)) {
|
|
1009
|
-
this.#setSelectedState(cell, !this.#selectedCells.includes(cell));
|
|
1010
|
-
} else {
|
|
1011
|
-
const cacheTargetSelection = cell.getAttribute("aria-selected") === "true";
|
|
1012
|
-
this.#resetSelection();
|
|
1013
|
-
this.#setSelectedState(cell, !cacheTargetSelection);
|
|
1014
|
-
}
|
|
1015
|
-
};
|
|
1016
|
-
#handleRowSelection = ({
|
|
1017
|
-
target,
|
|
1018
|
-
ctrlKey,
|
|
1019
|
-
shiftKey,
|
|
1020
|
-
metaKey
|
|
1021
|
-
}) => {
|
|
1022
|
-
const row = target.parentNode;
|
|
1023
|
-
if (this.selectionMode === DataGridSelectionMode.multiRow && (ctrlKey || shiftKey || metaKey)) {
|
|
1024
|
-
this.#setSelectedState(row, !this.#selectedRows.includes(row));
|
|
1025
|
-
} else {
|
|
1026
|
-
const cacheTargetSelection = row.getAttribute("aria-selected") === "true";
|
|
1027
|
-
this.#resetSelection();
|
|
1028
|
-
this.#setSelectedState(row, !cacheTargetSelection);
|
|
1029
|
-
}
|
|
1030
|
-
};
|
|
1031
|
-
constructor() {
|
|
1032
|
-
super();
|
|
1033
|
-
this.addEventListener("click", this.#handleClick);
|
|
1034
|
-
this.addEventListener("keydown", this.#handleKeypress);
|
|
1035
|
-
const privates = this;
|
|
1036
|
-
privates.toggleGeneratedHeader = () => {
|
|
1037
|
-
if (privates.generatedHeader !== null) {
|
|
1038
|
-
this.removeChild(privates.generatedHeader);
|
|
1039
|
-
privates.generatedHeader = null;
|
|
1040
|
-
}
|
|
1041
|
-
if (this.generateHeader !== GenerateHeaderOptions.none && this.columnDefinitions !== null) {
|
|
1042
|
-
const generatedHeaderElement = document.createElement(
|
|
1043
|
-
this.rowElementTag
|
|
1044
|
-
);
|
|
1045
|
-
privates.generatedHeader = generatedHeaderElement;
|
|
1046
|
-
privates.generatedHeader.columnDefinitions = this.columnDefinitions;
|
|
1047
|
-
privates.generatedHeader.gridTemplateColumns = this.gridTemplateColumns;
|
|
1048
|
-
privates.generatedHeader.rowType = this.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : DataGridRowTypes.header;
|
|
1049
|
-
if (this.firstChild !== null || privates.rowsPlaceholder !== null) {
|
|
1050
|
-
this.insertBefore(
|
|
1051
|
-
generatedHeaderElement,
|
|
1052
|
-
this.firstChild !== null ? this.firstChild : privates.rowsPlaceholder
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
};
|
|
1058
|
-
}
|
|
1059
|
-
#changeHandler = {
|
|
1060
|
-
handleChange(dataGrid, propertyName) {
|
|
1061
|
-
if (propertyName === "columnDefinitions") {
|
|
1062
|
-
if (dataGrid.$fastController.isConnected) {
|
|
1063
|
-
dataGrid.toggleGeneratedHeader();
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
};
|
|
1068
|
-
connectedCallback() {
|
|
1069
|
-
super.connectedCallback();
|
|
1070
|
-
index.Observable.getNotifier(this).subscribe(
|
|
1071
|
-
this.#changeHandler,
|
|
1072
|
-
"columnDefinitions"
|
|
1073
|
-
);
|
|
1074
|
-
}
|
|
1075
|
-
disconnectedCallback() {
|
|
1076
|
-
super.disconnectedCallback();
|
|
1077
|
-
index.Observable.getNotifier(this).unsubscribe(
|
|
1078
|
-
this.#changeHandler,
|
|
1079
|
-
"columnDefinitions"
|
|
1080
|
-
);
|
|
1081
|
-
}
|
|
1082
|
-
#setSelectedState = (cell, selectedState) => {
|
|
1083
|
-
cell.setAttribute("aria-selected", selectedState.toString());
|
|
1084
|
-
};
|
|
1085
|
-
#resetSelection = () => {
|
|
1086
|
-
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
1087
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
1088
|
-
(cell) => this.#setSelectedState(cell, false)
|
|
1089
|
-
);
|
|
1090
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
1091
|
-
(row) => row.removeAttribute("aria-selected")
|
|
1092
|
-
);
|
|
1093
|
-
}
|
|
1094
|
-
if (this.selectionMode === DataGridSelectionMode.none) {
|
|
1095
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
1096
|
-
(cell) => cell.removeAttribute("aria-selected")
|
|
1097
|
-
);
|
|
1098
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
1099
|
-
(row) => row.removeAttribute("aria-selected")
|
|
1100
|
-
);
|
|
1101
|
-
}
|
|
1102
|
-
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
1103
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
1104
|
-
(cell) => cell.removeAttribute("aria-selected")
|
|
1105
|
-
);
|
|
1106
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
1107
|
-
(row) => row.setAttribute("aria-selected", "false")
|
|
1108
|
-
);
|
|
1109
|
-
}
|
|
1110
|
-
};
|
|
1111
|
-
#initSelections = () => {
|
|
1112
|
-
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
1113
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
1114
|
-
(cell) => !cell.hasAttribute("aria-selected") && this.#setSelectedState(cell, false)
|
|
1115
|
-
);
|
|
1116
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
1117
|
-
(row) => row.removeAttribute("aria-selected")
|
|
1118
|
-
);
|
|
1119
|
-
}
|
|
1120
|
-
if (this.selectionMode === DataGridSelectionMode.none) {
|
|
1121
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
1122
|
-
(cell) => cell.removeAttribute("aria-selected")
|
|
1123
|
-
);
|
|
1124
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
1125
|
-
(row) => row.removeAttribute("aria-selected")
|
|
1126
|
-
);
|
|
1127
|
-
}
|
|
1128
|
-
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
1129
|
-
Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
|
|
1130
|
-
(cell) => cell.removeAttribute("aria-selected")
|
|
1131
|
-
);
|
|
1132
|
-
Array.from(this.querySelectorAll('[role="row"]')).forEach(
|
|
1133
|
-
(row) => !row.hasAttribute("aria-selected") && row.setAttribute("aria-selected", "false")
|
|
1134
|
-
);
|
|
1135
|
-
}
|
|
1136
|
-
};
|
|
576
|
+
#handleKeypress;
|
|
577
|
+
#handleClick;
|
|
578
|
+
#handleCellSelection;
|
|
579
|
+
#handleRowSelection;
|
|
580
|
+
#changeHandler;
|
|
581
|
+
#setSelectedState;
|
|
582
|
+
#resetSelection;
|
|
583
|
+
#initSelections;
|
|
1137
584
|
static generateColumns(rowData) {
|
|
1138
585
|
return Object.keys(rowData).map((property, index) => {
|
|
1139
586
|
return {
|
|
@@ -1142,13 +589,54 @@ class DataGrid extends DataGrid$1 {
|
|
|
1142
589
|
};
|
|
1143
590
|
});
|
|
1144
591
|
}
|
|
1145
|
-
}
|
|
592
|
+
};
|
|
593
|
+
__decorateClass$2([
|
|
594
|
+
defineVividComponent.attr({ attribute: "no-tabbing", mode: "boolean" })
|
|
595
|
+
], _DataGrid.prototype, "noTabbing");
|
|
596
|
+
__decorateClass$2([
|
|
597
|
+
defineVividComponent.attr({ attribute: "generate-header" })
|
|
598
|
+
], _DataGrid.prototype, "generateHeader");
|
|
599
|
+
// @ts-expect-error Type is incorrectly non-optional
|
|
600
|
+
__decorateClass$2([
|
|
601
|
+
defineVividComponent.attr({ attribute: "grid-template-columns" })
|
|
602
|
+
], _DataGrid.prototype, "gridTemplateColumns");
|
|
603
|
+
__decorateClass$2([
|
|
604
|
+
defineVividComponent.observable
|
|
605
|
+
], _DataGrid.prototype, "rowsData");
|
|
606
|
+
__decorateClass$2([
|
|
607
|
+
defineVividComponent.observable
|
|
608
|
+
], _DataGrid.prototype, "columnDefinitions");
|
|
609
|
+
__decorateClass$2([
|
|
610
|
+
defineVividComponent.observable
|
|
611
|
+
], _DataGrid.prototype, "rowItemTemplate");
|
|
612
|
+
__decorateClass$2([
|
|
613
|
+
defineVividComponent.observable
|
|
614
|
+
], _DataGrid.prototype, "cellItemTemplate");
|
|
615
|
+
__decorateClass$2([
|
|
616
|
+
defineVividComponent.observable
|
|
617
|
+
], _DataGrid.prototype, "headerCellItemTemplate");
|
|
1146
618
|
__decorateClass$2([
|
|
1147
|
-
|
|
1148
|
-
],
|
|
619
|
+
defineVividComponent.observable
|
|
620
|
+
], _DataGrid.prototype, "focusRowIndex");
|
|
1149
621
|
__decorateClass$2([
|
|
1150
|
-
|
|
1151
|
-
],
|
|
622
|
+
defineVividComponent.observable
|
|
623
|
+
], _DataGrid.prototype, "focusColumnIndex");
|
|
624
|
+
__decorateClass$2([
|
|
625
|
+
defineVividComponent.observable
|
|
626
|
+
], _DataGrid.prototype, "defaultRowItemTemplate");
|
|
627
|
+
__decorateClass$2([
|
|
628
|
+
defineVividComponent.observable
|
|
629
|
+
], _DataGrid.prototype, "rowElementTag");
|
|
630
|
+
__decorateClass$2([
|
|
631
|
+
defineVividComponent.observable
|
|
632
|
+
], _DataGrid.prototype, "rowElements");
|
|
633
|
+
__decorateClass$2([
|
|
634
|
+
defineVividComponent.observable
|
|
635
|
+
], _DataGrid.prototype, "slottedRowElements");
|
|
636
|
+
__decorateClass$2([
|
|
637
|
+
defineVividComponent.attr({ attribute: "selection-mode" })
|
|
638
|
+
], _DataGrid.prototype, "selectionMode");
|
|
639
|
+
let DataGrid = _DataGrid;
|
|
1152
640
|
|
|
1153
641
|
var __defProp$1 = Object.defineProperty;
|
|
1154
642
|
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
@@ -1159,19 +647,172 @@ var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
|
1159
647
|
if (result) __defProp$1(target, key, result);
|
|
1160
648
|
return result;
|
|
1161
649
|
};
|
|
1162
|
-
class DataGridRow extends
|
|
650
|
+
class DataGridRow extends vividElement.VividElement {
|
|
1163
651
|
constructor() {
|
|
1164
652
|
super(...arguments);
|
|
653
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
654
|
+
this.rowType = DataGridRowTypes.default;
|
|
655
|
+
this.rowData = null;
|
|
656
|
+
this.columnDefinitions = null;
|
|
657
|
+
this.cellsRepeatBehavior = null;
|
|
658
|
+
this.cellsPlaceholder = null;
|
|
659
|
+
/**
|
|
660
|
+
* @internal
|
|
661
|
+
*/
|
|
662
|
+
this.focusColumnIndex = 0;
|
|
663
|
+
this.updateRowStyle = () => {
|
|
664
|
+
this.style.gridTemplateColumns = this.gridTemplateColumns;
|
|
665
|
+
};
|
|
1165
666
|
this.ariaSelected = null;
|
|
1166
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* @internal
|
|
670
|
+
*/
|
|
671
|
+
gridTemplateColumnsChanged() {
|
|
672
|
+
if (this.$fastController.isConnected) {
|
|
673
|
+
this.updateRowStyle();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* @internal
|
|
678
|
+
*/
|
|
679
|
+
rowTypeChanged() {
|
|
680
|
+
if (this.$fastController.isConnected) {
|
|
681
|
+
this.updateItemTemplate();
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* @internal
|
|
686
|
+
*/
|
|
687
|
+
cellItemTemplateChanged() {
|
|
688
|
+
this.updateItemTemplate();
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* @internal
|
|
692
|
+
*/
|
|
693
|
+
headerCellItemTemplateChanged() {
|
|
694
|
+
this.updateItemTemplate();
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* @internal
|
|
698
|
+
*/
|
|
699
|
+
connectedCallback() {
|
|
700
|
+
super.connectedCallback();
|
|
701
|
+
if (this.cellsRepeatBehavior === null) {
|
|
702
|
+
this.cellsPlaceholder = document.createComment("");
|
|
703
|
+
this.appendChild(this.cellsPlaceholder);
|
|
704
|
+
this.updateItemTemplate();
|
|
705
|
+
this.cellsRepeatBehavior = new repeat.RepeatDirective(
|
|
706
|
+
(x) => x.columnDefinitions,
|
|
707
|
+
(x) => x.activeCellItemTemplate,
|
|
708
|
+
{ positioning: true }
|
|
709
|
+
).createBehavior(this.cellsPlaceholder);
|
|
710
|
+
this.$fastController.addBehaviors([this.cellsRepeatBehavior]);
|
|
711
|
+
}
|
|
712
|
+
this.addEventListener("cell-focused", this.handleCellFocus);
|
|
713
|
+
this.addEventListener(eventFocusOut, this.handleFocusout);
|
|
714
|
+
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
715
|
+
this.updateRowStyle();
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* @internal
|
|
719
|
+
*/
|
|
720
|
+
disconnectedCallback() {
|
|
721
|
+
super.disconnectedCallback();
|
|
722
|
+
this.removeEventListener("cell-focused", this.handleCellFocus);
|
|
723
|
+
this.removeEventListener(
|
|
724
|
+
eventFocusOut,
|
|
725
|
+
this.handleFocusout
|
|
726
|
+
);
|
|
727
|
+
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
728
|
+
}
|
|
729
|
+
handleFocusout(_) {
|
|
730
|
+
if (!this.contains(document.activeElement)) {
|
|
731
|
+
this.focusColumnIndex = 0;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
handleCellFocus(e) {
|
|
735
|
+
this.focusColumnIndex = this.cellElements.indexOf(e.target);
|
|
736
|
+
this.$emit("row-focused", this);
|
|
737
|
+
}
|
|
738
|
+
handleKeydown(e) {
|
|
739
|
+
if (e.defaultPrevented) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
let newFocusColumnIndex = 0;
|
|
743
|
+
switch (e.key) {
|
|
744
|
+
case keyCodes.keyArrowLeft:
|
|
745
|
+
newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
|
|
746
|
+
this.cellElements[newFocusColumnIndex].focus();
|
|
747
|
+
e.preventDefault();
|
|
748
|
+
break;
|
|
749
|
+
case keyCodes.keyArrowRight:
|
|
750
|
+
newFocusColumnIndex = Math.min(
|
|
751
|
+
this.cellElements.length - 1,
|
|
752
|
+
this.focusColumnIndex + 1
|
|
753
|
+
);
|
|
754
|
+
this.cellElements[newFocusColumnIndex].focus();
|
|
755
|
+
e.preventDefault();
|
|
756
|
+
break;
|
|
757
|
+
case keyCodes.keyHome:
|
|
758
|
+
if (!e.ctrlKey) {
|
|
759
|
+
this.cellElements[0].focus();
|
|
760
|
+
e.preventDefault();
|
|
761
|
+
}
|
|
762
|
+
break;
|
|
763
|
+
case keyCodes.keyEnd:
|
|
764
|
+
if (!e.ctrlKey) {
|
|
765
|
+
this.cellElements[this.cellElements.length - 1].focus();
|
|
766
|
+
e.preventDefault();
|
|
767
|
+
}
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
updateItemTemplate() {
|
|
772
|
+
this.activeCellItemTemplate = this.rowType === DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
|
|
773
|
+
}
|
|
1167
774
|
}
|
|
775
|
+
// @ts-expect-error Type is incorrectly non-optional
|
|
776
|
+
__decorateClass$1([
|
|
777
|
+
defineVividComponent.attr({ attribute: "grid-template-columns" })
|
|
778
|
+
], DataGridRow.prototype, "gridTemplateColumns");
|
|
779
|
+
__decorateClass$1([
|
|
780
|
+
defineVividComponent.attr({ attribute: "row-type" })
|
|
781
|
+
], DataGridRow.prototype, "rowType");
|
|
782
|
+
__decorateClass$1([
|
|
783
|
+
defineVividComponent.observable
|
|
784
|
+
], DataGridRow.prototype, "rowData");
|
|
785
|
+
__decorateClass$1([
|
|
786
|
+
defineVividComponent.observable
|
|
787
|
+
], DataGridRow.prototype, "columnDefinitions");
|
|
1168
788
|
__decorateClass$1([
|
|
1169
|
-
|
|
789
|
+
defineVividComponent.observable
|
|
790
|
+
], DataGridRow.prototype, "cellItemTemplate");
|
|
791
|
+
__decorateClass$1([
|
|
792
|
+
defineVividComponent.observable
|
|
793
|
+
], DataGridRow.prototype, "headerCellItemTemplate");
|
|
794
|
+
__decorateClass$1([
|
|
795
|
+
defineVividComponent.observable
|
|
796
|
+
], DataGridRow.prototype, "rowIndex");
|
|
797
|
+
__decorateClass$1([
|
|
798
|
+
defineVividComponent.observable
|
|
799
|
+
], DataGridRow.prototype, "activeCellItemTemplate");
|
|
800
|
+
__decorateClass$1([
|
|
801
|
+
defineVividComponent.observable
|
|
802
|
+
], DataGridRow.prototype, "defaultCellItemTemplate");
|
|
803
|
+
__decorateClass$1([
|
|
804
|
+
defineVividComponent.observable
|
|
805
|
+
], DataGridRow.prototype, "defaultHeaderCellItemTemplate");
|
|
806
|
+
__decorateClass$1([
|
|
807
|
+
defineVividComponent.observable
|
|
808
|
+
], DataGridRow.prototype, "cellElements");
|
|
809
|
+
__decorateClass$1([
|
|
810
|
+
defineVividComponent.attr({ attribute: "aria-selected" })
|
|
1170
811
|
], DataGridRow.prototype, "ariaSelected");
|
|
1171
812
|
|
|
1172
813
|
function createRowItemTemplate(context) {
|
|
1173
814
|
const rowTag = context.tagFor(DataGridRow);
|
|
1174
|
-
return
|
|
815
|
+
return defineVividComponent.html`
|
|
1175
816
|
<${rowTag}
|
|
1176
817
|
:rowData="${(x) => x}"
|
|
1177
818
|
:cellItemTemplate="${(_, c) => c.parent.cellItemTemplate}"
|
|
@@ -1199,7 +840,7 @@ function handleColumnSort(_, { event }) {
|
|
|
1199
840
|
const DataGridTemplate = (context) => {
|
|
1200
841
|
const rowItemTemplate = createRowItemTemplate(context);
|
|
1201
842
|
const rowTag = context.tagFor(DataGridRow);
|
|
1202
|
-
return
|
|
843
|
+
return defineVividComponent.html`
|
|
1203
844
|
<template
|
|
1204
845
|
aria-multiselectable="${getMultiSelectAriaState}"
|
|
1205
846
|
role="grid"
|
|
@@ -1229,11 +870,25 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
1229
870
|
if (result) __defProp(target, key, result);
|
|
1230
871
|
return result;
|
|
1231
872
|
};
|
|
1232
|
-
|
|
873
|
+
const defaultCellContentsTemplate = defineVividComponent.html`
|
|
874
|
+
<template>
|
|
875
|
+
${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
|
|
876
|
+
</template>
|
|
877
|
+
`;
|
|
878
|
+
const defaultHeaderCellContentsTemplate = defineVividComponent.html`
|
|
879
|
+
<template>
|
|
880
|
+
${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
|
|
881
|
+
</template>
|
|
882
|
+
`;
|
|
883
|
+
class DataGridCell extends vividElement.VividElement {
|
|
1233
884
|
constructor() {
|
|
1234
|
-
super();
|
|
1235
|
-
|
|
1236
|
-
this.
|
|
885
|
+
super(...arguments);
|
|
886
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
887
|
+
this.cellType = DataGridCellTypes.default;
|
|
888
|
+
this.rowData = null;
|
|
889
|
+
this.columnDefinition = null;
|
|
890
|
+
this.isActiveCell = false;
|
|
891
|
+
this.customCellView = null;
|
|
1237
892
|
this.updateCellStyle = () => {
|
|
1238
893
|
if (this.gridColumn && !this.gridColumn.includes("undefined")) {
|
|
1239
894
|
this.style.gridColumn = this.gridColumn;
|
|
@@ -1241,24 +896,173 @@ class DataGridCell extends DataGridCell$1 {
|
|
|
1241
896
|
this.style.removeProperty("grid-column");
|
|
1242
897
|
}
|
|
1243
898
|
};
|
|
899
|
+
this.ariaSelected = null;
|
|
900
|
+
this.ariaSort = null;
|
|
1244
901
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
)
|
|
902
|
+
/**
|
|
903
|
+
* @internal
|
|
904
|
+
*/
|
|
905
|
+
cellTypeChanged() {
|
|
906
|
+
if (this.$fastController.isConnected) {
|
|
907
|
+
this.updateCellView();
|
|
908
|
+
}
|
|
1250
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* @internal
|
|
912
|
+
*/
|
|
913
|
+
gridColumnChanged() {
|
|
914
|
+
if (this.$fastController.isConnected) {
|
|
915
|
+
this.updateCellStyle();
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* @internal
|
|
920
|
+
*/
|
|
921
|
+
columnDefinitionChanged(_oldValue, _newValue) {
|
|
922
|
+
if (this.$fastController.isConnected) {
|
|
923
|
+
this.updateCellView();
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* @internal
|
|
928
|
+
*/
|
|
1251
929
|
connectedCallback() {
|
|
1252
930
|
super.connectedCallback();
|
|
931
|
+
this.addEventListener(eventFocusIn, this.handleFocusin);
|
|
932
|
+
this.addEventListener(eventFocusOut, this.handleFocusout);
|
|
933
|
+
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
934
|
+
this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
|
|
935
|
+
this.updateCellView();
|
|
936
|
+
this.updateCellStyle();
|
|
1253
937
|
this.ariaSelectedChanged(null, this.ariaSelected);
|
|
1254
938
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
939
|
+
/**
|
|
940
|
+
* @internal
|
|
941
|
+
*/
|
|
942
|
+
disconnectedCallback() {
|
|
943
|
+
super.disconnectedCallback();
|
|
944
|
+
this.removeEventListener(eventFocusIn, this.handleFocusin);
|
|
945
|
+
this.removeEventListener(
|
|
946
|
+
eventFocusOut,
|
|
947
|
+
this.handleFocusout
|
|
948
|
+
);
|
|
949
|
+
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
950
|
+
this.disconnectCellView();
|
|
951
|
+
}
|
|
952
|
+
handleFocusin(_) {
|
|
1257
953
|
this.shadowRoot.querySelector(".base").classList.add("active");
|
|
954
|
+
if (this.isActiveCell) {
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
this.isActiveCell = true;
|
|
958
|
+
switch (this.cellType) {
|
|
959
|
+
case DataGridCellTypes.columnHeader:
|
|
960
|
+
if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
|
|
961
|
+
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
962
|
+
if (focusTarget !== null) {
|
|
963
|
+
focusTarget.focus();
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
break;
|
|
967
|
+
default:
|
|
968
|
+
if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
|
|
969
|
+
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
970
|
+
if (focusTarget !== null) {
|
|
971
|
+
focusTarget.focus();
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
break;
|
|
975
|
+
}
|
|
976
|
+
this.$emit("cell-focused", this);
|
|
1258
977
|
}
|
|
1259
|
-
handleFocusout(
|
|
1260
|
-
super.handleFocusout(e);
|
|
978
|
+
handleFocusout(_) {
|
|
1261
979
|
this.shadowRoot.querySelector(".base").classList.remove("active");
|
|
980
|
+
if (this !== document.activeElement && !this.contains(document.activeElement)) {
|
|
981
|
+
this.isActiveCell = false;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
handleKeydown(e) {
|
|
985
|
+
if (e.defaultPrevented || this.columnDefinition === null || this.cellType === DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) {
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
switch (e.key) {
|
|
989
|
+
case keyCodes.keyEnter:
|
|
990
|
+
case keyCodes.keyFunction2:
|
|
991
|
+
if (this.contains(document.activeElement) && document.activeElement !== this) {
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
switch (this.cellType) {
|
|
995
|
+
case DataGridCellTypes.columnHeader:
|
|
996
|
+
if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
|
|
997
|
+
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
998
|
+
if (focusTarget !== null) {
|
|
999
|
+
focusTarget.focus();
|
|
1000
|
+
}
|
|
1001
|
+
e.preventDefault();
|
|
1002
|
+
}
|
|
1003
|
+
break;
|
|
1004
|
+
default:
|
|
1005
|
+
if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
|
|
1006
|
+
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
1007
|
+
if (focusTarget !== null) {
|
|
1008
|
+
focusTarget.focus();
|
|
1009
|
+
}
|
|
1010
|
+
e.preventDefault();
|
|
1011
|
+
}
|
|
1012
|
+
break;
|
|
1013
|
+
}
|
|
1014
|
+
break;
|
|
1015
|
+
case keyCodes.keyEscape:
|
|
1016
|
+
if (this.contains(document.activeElement) && document.activeElement !== this) {
|
|
1017
|
+
this.focus();
|
|
1018
|
+
e.preventDefault();
|
|
1019
|
+
}
|
|
1020
|
+
break;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
updateCellView() {
|
|
1024
|
+
this.disconnectCellView();
|
|
1025
|
+
if (this.columnDefinition === null) {
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
switch (this.cellType) {
|
|
1029
|
+
case DataGridCellTypes.columnHeader:
|
|
1030
|
+
if (this.columnDefinition.headerCellTemplate !== void 0) {
|
|
1031
|
+
this.customCellView = this.columnDefinition.headerCellTemplate.render(
|
|
1032
|
+
this,
|
|
1033
|
+
this
|
|
1034
|
+
);
|
|
1035
|
+
} else {
|
|
1036
|
+
this.customCellView = defaultHeaderCellContentsTemplate.render(
|
|
1037
|
+
this,
|
|
1038
|
+
this
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
break;
|
|
1042
|
+
case DataGridCellTypes.rowHeader:
|
|
1043
|
+
case DataGridCellTypes.default:
|
|
1044
|
+
if (this.columnDefinition.cellTemplate !== void 0) {
|
|
1045
|
+
this.customCellView = this.columnDefinition.cellTemplate.render(
|
|
1046
|
+
this,
|
|
1047
|
+
this
|
|
1048
|
+
);
|
|
1049
|
+
} else {
|
|
1050
|
+
this.customCellView = defaultCellContentsTemplate.render(this, this);
|
|
1051
|
+
}
|
|
1052
|
+
break;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
disconnectCellView() {
|
|
1056
|
+
if (this.customCellView !== null) {
|
|
1057
|
+
this.customCellView.dispose();
|
|
1058
|
+
this.customCellView = null;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
ariaSelectedChanged(_, selectedState) {
|
|
1062
|
+
this.shadowRoot.querySelector(".base")?.classList.toggle(
|
|
1063
|
+
"selected",
|
|
1064
|
+
selectedState === "true"
|
|
1065
|
+
);
|
|
1262
1066
|
}
|
|
1263
1067
|
#getColumnDataKey() {
|
|
1264
1068
|
return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
|
|
@@ -1288,15 +1092,27 @@ class DataGridCell extends DataGridCell$1 {
|
|
|
1288
1092
|
}
|
|
1289
1093
|
}
|
|
1290
1094
|
__decorateClass([
|
|
1291
|
-
|
|
1095
|
+
defineVividComponent.attr({ attribute: "cell-type" })
|
|
1096
|
+
], DataGridCell.prototype, "cellType");
|
|
1097
|
+
__decorateClass([
|
|
1098
|
+
defineVividComponent.attr({ attribute: "grid-column" })
|
|
1099
|
+
], DataGridCell.prototype, "gridColumn");
|
|
1100
|
+
__decorateClass([
|
|
1101
|
+
defineVividComponent.observable
|
|
1102
|
+
], DataGridCell.prototype, "rowData");
|
|
1103
|
+
__decorateClass([
|
|
1104
|
+
defineVividComponent.observable
|
|
1105
|
+
], DataGridCell.prototype, "columnDefinition");
|
|
1106
|
+
__decorateClass([
|
|
1107
|
+
defineVividComponent.attr({ attribute: "aria-selected", mode: "fromView" })
|
|
1292
1108
|
], DataGridCell.prototype, "ariaSelected");
|
|
1293
1109
|
__decorateClass([
|
|
1294
|
-
|
|
1110
|
+
defineVividComponent.attr({ attribute: "aria-sort" })
|
|
1295
1111
|
], DataGridCell.prototype, "ariaSort");
|
|
1296
1112
|
|
|
1297
1113
|
function createCellItemTemplate(context) {
|
|
1298
1114
|
const cellTag = context.tagFor(DataGridCell);
|
|
1299
|
-
return
|
|
1115
|
+
return defineVividComponent.html`
|
|
1300
1116
|
<${cellTag}
|
|
1301
1117
|
cell-type="${(x) => x.isRowHeader ? "rowheader" : void 0}"
|
|
1302
1118
|
grid-column="${(_, c) => c.index + 1}"
|
|
@@ -1308,7 +1124,7 @@ function createCellItemTemplate(context) {
|
|
|
1308
1124
|
}
|
|
1309
1125
|
function createHeaderCellItemTemplate(context) {
|
|
1310
1126
|
const cellTag = context.tagFor(DataGridCell);
|
|
1311
|
-
return
|
|
1127
|
+
return defineVividComponent.html`
|
|
1312
1128
|
<${cellTag}
|
|
1313
1129
|
cell-type="columnheader"
|
|
1314
1130
|
grid-column="${(_, c) => c.index + 1}"
|
|
@@ -1319,7 +1135,7 @@ function createHeaderCellItemTemplate(context) {
|
|
|
1319
1135
|
const DataGridRowTemplate = (context) => {
|
|
1320
1136
|
const cellItemTemplate = createCellItemTemplate(context);
|
|
1321
1137
|
const headerCellItemTemplate = createHeaderCellItemTemplate(context);
|
|
1322
|
-
return
|
|
1138
|
+
return defineVividComponent.html`
|
|
1323
1139
|
<template
|
|
1324
1140
|
role="row"
|
|
1325
1141
|
class="${(x) => x.rowType !== "default" ? x.rowType : ""}"
|
|
@@ -1352,24 +1168,24 @@ function getSortIcon(x) {
|
|
|
1352
1168
|
return x.ariaSort === DataGridCellSortStates.ascending ? "sort-asc-solid" : x.ariaSort === DataGridCellSortStates.descending ? "sort-desc-solid" : "sort-solid";
|
|
1353
1169
|
}
|
|
1354
1170
|
function renderSortIcons(c) {
|
|
1355
|
-
const iconTag = c.tagFor(
|
|
1356
|
-
return
|
|
1171
|
+
const iconTag = c.tagFor(definition.Icon);
|
|
1172
|
+
return defineVividComponent.html`
|
|
1357
1173
|
${when.when(
|
|
1358
1174
|
shouldShowSortIcons,
|
|
1359
|
-
|
|
1175
|
+
defineVividComponent.html`
|
|
1360
1176
|
<${iconTag} class="header-icon" name="${getSortIcon}"></${iconTag}>
|
|
1361
1177
|
`
|
|
1362
1178
|
)}
|
|
1363
1179
|
`;
|
|
1364
1180
|
}
|
|
1365
1181
|
function handleKeyDown(x, e) {
|
|
1366
|
-
if (e.key === keyCodes
|
|
1182
|
+
if (e.key === keyCodes.keyEnter || e.key === keyCodes.keySpace) {
|
|
1367
1183
|
x._handleInteraction();
|
|
1368
1184
|
}
|
|
1369
1185
|
return true;
|
|
1370
1186
|
}
|
|
1371
|
-
|
|
1372
|
-
return
|
|
1187
|
+
const DataGridCellTemplate = (context) => {
|
|
1188
|
+
return defineVividComponent.html`
|
|
1373
1189
|
<template
|
|
1374
1190
|
tabindex="-1"
|
|
1375
1191
|
role="${(x) => DataGridCellRole[x.cellType] ?? DataGridCellRole.default}"
|
|
@@ -1382,33 +1198,38 @@ function DataGridCellTemplate(context) {
|
|
|
1382
1198
|
</div>
|
|
1383
1199
|
</template>
|
|
1384
1200
|
`;
|
|
1385
|
-
}
|
|
1201
|
+
};
|
|
1386
1202
|
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1203
|
+
const dataGridCellDefinition = defineVividComponent.defineVividComponent(
|
|
1204
|
+
"data-grid-cell",
|
|
1205
|
+
DataGridCell,
|
|
1206
|
+
DataGridCellTemplate,
|
|
1207
|
+
[definition.iconDefinition],
|
|
1208
|
+
{
|
|
1209
|
+
styles: dataGridCellStyles
|
|
1210
|
+
}
|
|
1211
|
+
);
|
|
1212
|
+
const dataGridRowDefinition = defineVividComponent.defineVividComponent(
|
|
1213
|
+
"data-grid-row",
|
|
1214
|
+
DataGridRow,
|
|
1215
|
+
DataGridRowTemplate,
|
|
1216
|
+
[dataGridCellDefinition],
|
|
1217
|
+
{
|
|
1218
|
+
styles: dataGridRowStyles
|
|
1219
|
+
}
|
|
1220
|
+
);
|
|
1221
|
+
const dataGridDefinition = defineVividComponent.defineVividComponent(
|
|
1222
|
+
"data-grid",
|
|
1223
|
+
DataGrid,
|
|
1224
|
+
DataGridTemplate,
|
|
1225
|
+
[dataGridRowDefinition],
|
|
1226
|
+
{
|
|
1227
|
+
styles: dataGridStyles
|
|
1228
|
+
}
|
|
1229
|
+
);
|
|
1230
|
+
const registerDataGrid = defineVividComponent.createRegisterFunction(dataGridDefinition);
|
|
1409
1231
|
|
|
1410
|
-
exports.
|
|
1411
|
-
exports.
|
|
1412
|
-
exports.
|
|
1413
|
-
exports.dataGridRow = dataGridRow;
|
|
1232
|
+
exports.dataGridCellDefinition = dataGridCellDefinition;
|
|
1233
|
+
exports.dataGridDefinition = dataGridDefinition;
|
|
1234
|
+
exports.dataGridRowDefinition = dataGridRowDefinition;
|
|
1414
1235
|
exports.registerDataGrid = registerDataGrid;
|