@vonage/vivid 5.17.0 → 5.19.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/accordion/definition.cjs +5 -6
- package/accordion/definition.js +0 -1
- package/accordion/index.cjs +2 -2
- package/accordion/index.js +4 -5
- package/accordion-item/definition.cjs +4 -5
- package/accordion-item/definition.js +0 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +1 -3
- package/action-group/index.cjs +4 -4
- package/action-group/index.js +7 -7
- package/alert/definition.cjs +4 -5
- package/alert/definition.js +0 -1
- package/alert/index.cjs +5 -5
- package/alert/index.js +23 -23
- package/audio-player/definition.cjs +4 -5
- package/audio-player/definition.js +0 -1
- package/audio-player/index.cjs +13 -13
- package/audio-player/index.js +76 -76
- package/avatar/definition.cjs +4 -5
- package/avatar/definition.js +0 -1
- package/avatar/index.cjs +8 -8
- package/avatar/index.js +23 -23
- package/badge/definition.cjs +4 -5
- package/badge/definition.js +0 -1
- package/badge/index.cjs +1 -4
- package/badge/index.js +2 -20
- package/banner/definition.cjs +4 -5
- package/banner/definition.js +0 -1
- package/banner/index.cjs +4 -4
- package/banner/index.js +20 -20
- package/breadcrumb/index.cjs +2 -2
- package/breadcrumb/index.js +3 -3
- package/breadcrumb-item/definition.cjs +3 -4
- package/breadcrumb-item/definition.js +0 -1
- package/breadcrumb-item/index.cjs +5 -5
- package/breadcrumb-item/index.js +7 -7
- package/bundled/affix.cjs +2 -2
- package/bundled/affix.js +6 -6
- package/bundled/anchored.cjs +1 -1
- package/bundled/anchored.js +1 -1
- package/bundled/aria-binding-directive.cjs +1 -0
- package/bundled/aria-binding-directive.js +29 -0
- package/bundled/base-color-picker.cjs +3 -3
- package/bundled/base-color-picker.js +1 -1
- package/bundled/base-progress.cjs +1 -1
- package/bundled/base-progress.js +2 -2
- package/bundled/breadcrumb-item.cjs +1 -1
- package/bundled/breadcrumb-item.js +3 -3
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +3 -3
- package/bundled/calendar-event.cjs +1 -1
- package/bundled/calendar-event.js +4 -4
- package/bundled/calendar-picker.template.cjs +20 -20
- package/bundled/calendar-picker.template.js +10 -10
- package/bundled/char-count.cjs +2 -2
- package/bundled/char-count.js +3 -3
- package/bundled/children.cjs +1 -1
- package/bundled/children.js +6 -6
- package/bundled/decorate.js +1 -1
- package/bundled/definition.cjs +1 -1
- package/bundled/definition.js +2 -2
- package/bundled/definition10.cjs +3 -3
- package/bundled/definition10.js +19 -19
- package/bundled/definition11.cjs +2 -2
- package/bundled/definition11.js +9 -9
- package/bundled/definition12.cjs +7 -7
- package/bundled/definition12.js +19 -19
- package/bundled/definition13.cjs +3 -3
- package/bundled/definition13.js +8 -8
- package/bundled/definition14.cjs +2 -2
- package/bundled/definition14.js +3 -3
- package/bundled/definition15.cjs +7 -7
- package/bundled/definition15.js +18 -18
- package/bundled/definition16.cjs +3 -3
- package/bundled/definition16.js +19 -19
- package/bundled/definition17.cjs +7 -7
- package/bundled/definition17.js +16 -16
- package/bundled/definition18.cjs +7 -7
- package/bundled/definition18.js +23 -23
- package/bundled/definition19.cjs +2 -2
- package/bundled/definition19.js +3 -3
- package/bundled/definition2.cjs +4 -15
- package/bundled/definition2.js +23 -56
- package/bundled/definition20.cjs +10 -10
- package/bundled/definition20.js +19 -20
- package/bundled/definition21.cjs +5 -5
- package/bundled/definition21.js +26 -26
- package/bundled/definition22.cjs +4 -39
- package/bundled/definition22.js +18 -70
- package/bundled/definition23.cjs +12 -0
- package/bundled/definition23.js +37 -0
- package/bundled/definition24.cjs +39 -0
- package/bundled/definition24.js +72 -0
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +39 -36
- package/bundled/definition4.cjs +4 -4
- package/bundled/definition4.js +13 -13
- package/bundled/definition5.cjs +5 -5
- package/bundled/definition5.js +10 -10
- package/bundled/definition6.cjs +12 -12
- package/bundled/definition6.js +61 -45
- package/bundled/definition7.cjs +2 -2
- package/bundled/definition7.js +6 -6
- package/bundled/definition8.cjs +4 -4
- package/bundled/definition8.js +15 -15
- package/bundled/definition9.cjs +2 -2
- package/bundled/definition9.js +18 -18
- package/bundled/delegates-aria.cjs +1 -1
- package/bundled/delegates-aria.js +10 -49
- package/bundled/divider.cjs +1 -1
- package/bundled/divider.js +3 -3
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +6 -6
- package/bundled/form-element.cjs +1 -1
- package/bundled/form-element.js +8 -6
- package/bundled/host-semantics.cjs +1 -1
- package/bundled/host-semantics.js +10 -39
- package/bundled/linkable.cjs +2 -2
- package/bundled/linkable.js +1 -1
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +12 -12
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +7 -6
- package/bundled/mixins.cjs +6 -6
- package/bundled/mixins.js +14 -14
- package/bundled/normalize.cjs +1 -1
- package/bundled/normalize.js +2 -2
- package/bundled/numberConverter.cjs +12 -0
- package/bundled/numberConverter.js +38 -0
- package/bundled/picker-field.template.cjs +2 -1
- package/bundled/picker-field.template.js +25 -23
- package/bundled/ref.cjs +1 -1
- package/bundled/ref.js +1 -1
- package/bundled/repeat.cjs +1 -1
- package/bundled/repeat.js +54 -54
- package/bundled/slider.template.cjs +7 -7
- package/bundled/slider.template.js +13 -13
- package/bundled/slottable-request.cjs +1 -1
- package/bundled/slottable-request.js +1 -1
- package/bundled/slotted.cjs +1 -1
- package/bundled/slotted.js +1 -1
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.js +1 -1
- package/bundled/time-selection-picker.template.cjs +4 -4
- package/bundled/time-selection-picker.template.js +23 -23
- package/bundled/utils.cjs +1 -0
- package/bundled/utils.js +1420 -0
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +21 -19
- package/bundled/when.cjs +1 -1
- package/bundled/when.js +1 -1
- package/bundled/with-contextual-help.cjs +1 -1
- package/bundled/with-contextual-help.js +1 -1
- package/bundled/with-error-text.cjs +1 -1
- package/bundled/with-error-text.js +1 -1
- package/bundled/with-success-text.cjs +1 -1
- package/bundled/with-success-text.js +1 -1
- package/button/definition.cjs +4 -5
- package/button/definition.js +0 -1
- package/button/index.cjs +1 -1
- package/button/index.js +0 -2
- package/calendar/index.cjs +8 -8
- package/calendar/index.js +10 -10
- package/calendar-event/index.cjs +6 -6
- package/calendar-event/index.js +8 -8
- package/card/definition.cjs +4 -5
- package/card/definition.js +0 -1
- package/card/index.cjs +15 -15
- package/card/index.js +37 -37
- package/checkbox/definition.cjs +4 -5
- package/checkbox/definition.js +0 -1
- package/checkbox/index.cjs +1 -1
- package/checkbox/index.js +0 -2
- package/color-picker/definition.cjs +4 -5
- package/color-picker/definition.js +0 -1
- package/color-picker/index.cjs +19 -19
- package/color-picker/index.js +94 -93
- package/combobox/definition.cjs +4 -5
- package/combobox/definition.js +0 -1
- package/combobox/index.cjs +4 -4
- package/combobox/index.js +23 -23
- package/contextual-help/definition.cjs +4 -5
- package/contextual-help/definition.js +0 -1
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +0 -2
- package/country/definition.cjs +4 -5
- package/country/definition.js +0 -1
- package/country/index.cjs +1 -12
- package/country/index.js +2 -1216
- package/country-group/definition.cjs +5 -0
- package/country-group/definition.js +2 -0
- package/country-group/index.cjs +43 -0
- package/country-group/index.js +166 -0
- package/custom-elements.json +3535 -3017
- package/data-grid/definition.cjs +8 -9
- package/data-grid/definition.js +1 -2
- package/data-grid/index.cjs +14 -14
- package/data-grid/index.js +105 -105
- package/date-picker/definition.cjs +4 -5
- package/date-picker/definition.js +1 -2
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -3
- package/date-range-picker/definition.cjs +4 -5
- package/date-range-picker/definition.js +1 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +6 -7
- package/date-time-picker/definition.cjs +4 -5
- package/date-time-picker/definition.js +1 -2
- package/date-time-picker/index.cjs +2 -2
- package/date-time-picker/index.js +8 -9
- package/dial-pad/definition.cjs +4 -5
- package/dial-pad/definition.js +1 -2
- package/dial-pad/index.cjs +9 -9
- package/dial-pad/index.js +19 -19
- package/dialog/definition.cjs +4 -5
- package/dialog/definition.js +1 -2
- package/dialog/index.cjs +14 -11
- package/dialog/index.js +39 -36
- package/divider/definition.cjs +1 -1
- package/divider/definition.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +0 -1
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +0 -1
- package/empty-state/definition.cjs +4 -5
- package/empty-state/definition.js +1 -2
- package/empty-state/index.cjs +4 -4
- package/empty-state/index.js +12 -12
- package/fab/definition.cjs +4 -5
- package/fab/definition.js +1 -2
- package/fab/index.cjs +3 -3
- package/fab/index.js +12 -12
- package/file-picker/definition.cjs +4 -5
- package/file-picker/definition.js +1 -2
- package/file-picker/index.cjs +10 -10
- package/file-picker/index.js +26 -26
- package/flag/definition.cjs +5 -0
- package/flag/definition.js +2 -0
- package/flag/index.cjs +10 -0
- package/flag/index.js +61 -0
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/header/index.cjs +5 -5
- package/header/index.js +11 -11
- package/icon/index.cjs +1 -1
- package/icon/index.js +0 -1
- package/index.cjs +182 -174
- package/index.js +47 -45
- package/layout/definition.cjs +1 -1
- package/layout/definition.js +1 -1
- package/layout/index.cjs +2 -2
- package/layout/index.js +3 -3
- package/lib/avatar/avatar.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/button/button.d.ts +2 -1
- package/lib/card/card.d.ts +1 -1
- package/lib/components.d.ts +2 -0
- package/lib/country/countries-data.d.ts +1 -0
- package/lib/country/{country-code-to-flag-icon.d.ts → utils.d.ts} +0 -3
- package/lib/country-group/country-group.d.ts +829 -0
- package/lib/country-group/country-group.template.d.ts +3 -0
- package/lib/country-group/definition.d.ts +3 -0
- package/lib/country-group/index.d.ts +1 -0
- package/lib/country-group/locale.d.ts +3 -0
- package/lib/date-picker/date-picker.d.ts +4 -0
- package/lib/date-range-picker/date-range-picker.d.ts +2 -0
- package/lib/date-time-picker/date-time-picker.d.ts +4 -0
- package/lib/flag/definition.d.ts +3 -0
- package/lib/flag/flag.d.ts +8 -0
- package/lib/flag/flag.template.d.ts +3 -0
- package/lib/flag/index.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -2
- package/lib/nav-item/nav-item.d.ts +1 -1
- package/lib/rich-text-editor/rte/utils/ui.d.ts +2 -1
- package/lib/searchable-select/option-tag.d.ts +3 -1
- package/lib/searchable-select/searchable-select.d.ts +3 -1
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/time-picker/time-picker.d.ts +2 -0
- package/locales/de-DE.cjs +2 -1
- package/locales/de-DE.js +1 -0
- package/locales/en-GB.cjs +2 -1
- package/locales/en-GB.js +1 -0
- package/locales/en-US.cjs +2 -1
- package/locales/en-US.js +1 -0
- package/locales/ja-JP.cjs +2 -1
- package/locales/ja-JP.js +1 -0
- package/locales/zh-CN.cjs +2 -1
- package/locales/zh-CN.js +1 -0
- package/menu/definition.cjs +4 -5
- package/menu/definition.js +0 -1
- package/menu/index.cjs +1 -1
- package/menu/index.js +0 -2
- package/menu-item/definition.cjs +5 -6
- package/menu-item/definition.js +0 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +0 -2
- package/nav/definition.cjs +1 -1
- package/nav/definition.js +1 -1
- package/nav/index.cjs +2 -2
- package/nav/index.js +2 -2
- package/nav-disclosure/definition.cjs +4 -5
- package/nav-disclosure/definition.js +1 -2
- package/nav-disclosure/index.cjs +4 -4
- package/nav-disclosure/index.js +18 -18
- package/nav-item/definition.cjs +4 -5
- package/nav-item/definition.js +1 -2
- package/nav-item/index.cjs +2 -2
- package/nav-item/index.js +13 -13
- package/note/definition.cjs +4 -5
- package/note/definition.js +1 -2
- package/note/index.cjs +2 -2
- package/note/index.js +10 -10
- package/number-field/definition.cjs +4 -5
- package/number-field/definition.js +1 -2
- package/number-field/index.cjs +5 -5
- package/number-field/index.js +19 -19
- package/option/definition.cjs +4 -5
- package/option/definition.js +0 -1
- package/option/index.cjs +1 -1
- package/option/index.js +0 -2
- package/package.json +23 -23
- package/pagination/definition.cjs +4 -5
- package/pagination/definition.js +1 -2
- package/pagination/index.cjs +4 -4
- package/pagination/index.js +11 -12
- package/popover/definition.cjs +4 -5
- package/popover/definition.js +1 -2
- package/popover/index.cjs +8 -8
- package/popover/index.js +31 -31
- package/popup/definition.cjs +3 -4
- package/popup/definition.js +0 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +0 -2
- package/progress/definition.cjs +1 -1
- package/progress/definition.js +1 -1
- package/progress/index.cjs +5 -5
- package/progress/index.js +10 -10
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +0 -1
- package/radio/definition.cjs +1 -1
- package/radio/definition.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +0 -1
- package/radio-group/definition.cjs +4 -5
- package/radio-group/definition.js +1 -2
- package/radio-group/index.cjs +6 -6
- package/radio-group/index.js +21 -21
- package/range-slider/definition.cjs +4 -5
- package/range-slider/definition.js +1 -2
- package/range-slider/index.cjs +5 -5
- package/range-slider/index.js +69 -67
- package/rich-text-editor/definition.cjs +31 -32
- package/rich-text-editor/definition.js +1 -2
- package/rich-text-editor/index.cjs +9 -9
- package/rich-text-editor/index.js +2016 -1947
- package/rich-text-view/definition.cjs +1 -1
- package/rich-text-view/definition.js +1 -1
- package/rich-text-view/index.cjs +1 -1
- package/rich-text-view/index.js +2 -2
- package/searchable-select/definition.cjs +3 -4
- package/searchable-select/definition.js +1 -2
- package/searchable-select/index.cjs +25 -23
- package/searchable-select/index.js +72 -68
- package/select/definition.cjs +4 -5
- package/select/definition.js +1 -2
- package/select/index.cjs +1 -1
- package/select/index.js +0 -2
- package/selectable-box/definition.cjs +4 -5
- package/selectable-box/definition.js +1 -2
- package/selectable-box/index.cjs +9 -9
- package/selectable-box/index.js +19 -20
- package/shared/aria/aria-binding-directive.d.ts +21 -0
- package/shared/aria/aria-change-subscription.d.ts +1 -0
- package/shared/aria/delegates-aria.d.ts +1 -1
- package/shared/aria/host-semantics.d.ts +1 -1
- package/shared/icon/utils.d.ts +1 -0
- package/shared/localization/Locale.d.ts +2 -0
- package/shared/patterns/linkable.d.ts +1 -1
- package/shared/picker-field/mixins/calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +1 -0
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-date-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-value-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +2 -0
- package/shared/picker-field/picker-field.d.ts +2 -0
- package/side-drawer/definition.cjs +1 -1
- package/side-drawer/definition.js +1 -1
- package/side-drawer/index.cjs +3 -3
- package/side-drawer/index.js +4 -4
- package/simple-color-picker/definition.cjs +4 -5
- package/simple-color-picker/definition.js +1 -2
- package/simple-color-picker/index.cjs +2 -2
- package/simple-color-picker/index.js +22 -22
- package/slider/definition.cjs +4 -5
- package/slider/definition.js +0 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +0 -2
- package/split-button/definition.cjs +4 -5
- package/split-button/definition.js +1 -2
- package/split-button/index.cjs +6 -6
- package/split-button/index.js +20 -20
- package/status/definition.cjs +4 -5
- package/status/definition.js +1 -2
- package/status/index.cjs +2 -2
- package/status/index.js +11 -11
- package/switch/definition.cjs +4 -5
- package/switch/definition.js +1 -2
- package/switch/index.cjs +5 -5
- package/switch/index.js +12 -12
- package/tab/definition.cjs +4 -5
- package/tab/definition.js +1 -2
- package/tab/index.cjs +1 -1
- package/tab/index.js +0 -2
- package/tab-panel/definition.cjs +1 -1
- package/tab-panel/definition.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +0 -1
- package/table/definition.cjs +16 -17
- package/table/definition.js +1 -2
- package/table/index.cjs +9 -9
- package/table/index.js +24 -24
- package/tabs/definition.cjs +5 -6
- package/tabs/definition.js +1 -2
- package/tabs/index.cjs +2 -2
- package/tabs/index.js +25 -26
- package/tag/definition.cjs +4 -5
- package/tag/definition.js +1 -2
- package/tag/index.cjs +12 -12
- package/tag/index.js +24 -24
- package/tag-group/definition.cjs +1 -1
- package/tag-group/definition.js +1 -1
- package/tag-group/index.cjs +4 -4
- package/tag-group/index.js +6 -6
- package/text-area/definition.cjs +4 -5
- package/text-area/definition.js +1 -2
- package/text-area/index.cjs +4 -4
- package/text-area/index.js +24 -25
- package/text-field/definition.cjs +4 -5
- package/text-field/definition.js +0 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +0 -2
- package/time-picker/definition.cjs +3 -4
- package/time-picker/definition.js +1 -2
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +2 -3
- package/toggletip/definition.cjs +4 -5
- package/toggletip/definition.js +0 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +0 -2
- package/tooltip/definition.cjs +4 -5
- package/tooltip/definition.js +0 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +0 -2
- package/tree-item/definition.cjs +4 -5
- package/tree-item/definition.js +1 -2
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +0 -2
- package/tree-view/definition.cjs +4 -5
- package/tree-view/definition.js +1 -2
- package/tree-view/index.cjs +2 -2
- package/tree-view/index.js +5 -5
- package/unbundled/aria-binding-directive.cjs +42 -0
- package/unbundled/aria-binding-directive.js +36 -0
- package/unbundled/calendar-picker.template.cjs +1 -1
- package/unbundled/calendar-picker.template.js +1 -1
- package/unbundled/char-count.cjs +2 -1
- package/unbundled/char-count.js +2 -1
- package/unbundled/decorate.cjs +1 -1
- package/unbundled/decorate.js +1 -1
- package/unbundled/definition.js +1 -1
- package/unbundled/definition10.cjs +5 -4
- package/unbundled/definition10.js +6 -5
- package/unbundled/definition11.cjs +17 -7
- package/unbundled/definition11.js +18 -8
- package/unbundled/definition12.cjs +2 -2
- package/unbundled/definition12.js +3 -3
- package/unbundled/definition13.cjs +7 -6
- package/unbundled/definition13.js +8 -7
- package/unbundled/definition14.cjs +67 -57
- package/unbundled/definition14.js +68 -58
- package/unbundled/definition15.js +1 -1
- package/unbundled/definition16.js +1 -1
- package/unbundled/definition17.cjs +10 -8
- package/unbundled/definition17.js +11 -9
- package/unbundled/definition18.js +1 -1
- package/unbundled/definition19.js +1 -1
- package/unbundled/definition2.cjs +9 -77
- package/unbundled/definition2.js +6 -74
- package/unbundled/definition20.js +1 -1
- package/unbundled/definition21.js +1 -1
- package/unbundled/definition22.js +1 -1
- package/unbundled/definition23.cjs +1 -1
- package/unbundled/definition23.js +2 -2
- package/unbundled/definition24.cjs +17 -13
- package/unbundled/definition24.js +18 -14
- package/unbundled/definition25.js +1 -1
- package/unbundled/definition26.cjs +17 -1
- package/unbundled/definition26.js +18 -2
- package/unbundled/definition27.cjs +15 -12
- package/unbundled/definition27.js +16 -13
- package/unbundled/definition28.cjs +10 -6
- package/unbundled/definition28.js +11 -7
- package/unbundled/definition29.js +1 -1
- package/unbundled/definition3.js +1 -1
- package/unbundled/definition30.cjs +4 -2
- package/unbundled/definition30.js +5 -3
- package/unbundled/definition31.cjs +2 -1189
- package/unbundled/definition31.js +2 -1189
- package/unbundled/definition32.cjs +215 -1836
- package/unbundled/definition32.js +212 -1809
- package/unbundled/definition33.cjs +85 -311
- package/unbundled/definition33.js +82 -236
- package/unbundled/definition34.cjs +2039 -25
- package/unbundled/definition34.js +2009 -24
- package/unbundled/definition35.cjs +315 -121
- package/unbundled/definition35.js +236 -114
- package/unbundled/definition36.cjs +25 -405
- package/unbundled/definition36.js +23 -398
- package/unbundled/definition37.cjs +47 -142
- package/unbundled/definition37.js +45 -140
- package/unbundled/definition38.cjs +346 -330
- package/unbundled/definition38.js +344 -328
- package/unbundled/definition39.cjs +183 -235
- package/unbundled/definition39.js +181 -233
- package/unbundled/definition4.cjs +6 -0
- package/unbundled/definition4.js +7 -1
- package/unbundled/definition40.cjs +377 -47
- package/unbundled/definition40.js +373 -43
- package/unbundled/definition41.cjs +261 -57
- package/unbundled/definition41.js +260 -56
- package/unbundled/definition42.cjs +45 -432
- package/unbundled/definition42.js +42 -429
- package/unbundled/definition43.cjs +63 -49
- package/unbundled/definition43.js +61 -47
- package/unbundled/definition44.cjs +439 -30
- package/unbundled/definition44.js +436 -26
- package/unbundled/definition45.cjs +46 -84
- package/unbundled/definition45.js +43 -81
- package/unbundled/definition46.cjs +29 -54
- package/unbundled/definition46.js +24 -50
- package/unbundled/definition47.cjs +94 -21
- package/unbundled/definition47.js +92 -16
- package/unbundled/definition48.cjs +49 -33
- package/unbundled/definition48.js +46 -30
- package/unbundled/definition49.cjs +22 -347
- package/unbundled/definition49.js +17 -345
- package/unbundled/definition5.js +1 -1
- package/unbundled/definition50.cjs +34 -211
- package/unbundled/definition50.js +31 -208
- package/unbundled/definition51.cjs +282 -242
- package/unbundled/definition51.js +276 -236
- package/unbundled/definition52.cjs +211 -51
- package/unbundled/definition52.js +209 -48
- package/unbundled/definition53.cjs +279 -131
- package/unbundled/definition53.js +277 -128
- package/unbundled/definition54.cjs +50 -261
- package/unbundled/definition54.js +48 -260
- package/unbundled/definition55.cjs +128 -443
- package/unbundled/definition55.js +126 -442
- package/unbundled/definition56.cjs +235 -3596
- package/unbundled/definition56.js +231 -3429
- package/unbundled/definition57.cjs +419 -729
- package/unbundled/definition57.js +417 -727
- package/unbundled/definition58.cjs +3626 -106
- package/unbundled/definition58.js +3458 -101
- package/unbundled/definition59.cjs +624 -868
- package/unbundled/definition59.js +619 -863
- package/unbundled/definition6.js +1 -1
- package/unbundled/definition60.cjs +106 -108
- package/unbundled/definition60.js +103 -105
- package/unbundled/definition61.cjs +1045 -71
- package/unbundled/definition61.js +1041 -66
- package/unbundled/definition62.cjs +105 -169
- package/unbundled/definition62.js +102 -166
- package/unbundled/definition63.cjs +70 -113
- package/unbundled/definition63.js +66 -110
- package/unbundled/definition64.cjs +184 -53
- package/unbundled/definition64.js +182 -51
- package/unbundled/definition65.cjs +109 -76
- package/unbundled/definition65.js +110 -76
- package/unbundled/definition66.cjs +58 -21
- package/unbundled/definition66.js +56 -16
- package/unbundled/definition67.cjs +81 -74
- package/unbundled/definition67.js +80 -74
- package/unbundled/definition68.cjs +19 -344
- package/unbundled/definition68.js +15 -336
- package/unbundled/definition69.cjs +88 -26
- package/unbundled/definition69.js +86 -23
- package/unbundled/definition7.cjs +18 -3
- package/unbundled/definition7.js +19 -4
- package/unbundled/definition70.cjs +335 -111
- package/unbundled/definition70.js +326 -109
- package/unbundled/definition71.cjs +26 -271
- package/unbundled/definition71.js +22 -268
- package/unbundled/definition72.cjs +135 -27
- package/unbundled/definition72.js +126 -25
- package/unbundled/definition73.cjs +257 -113
- package/unbundled/definition73.js +255 -105
- package/unbundled/definition74.cjs +28 -212
- package/unbundled/definition74.js +26 -202
- package/unbundled/definition75.cjs +117 -479
- package/unbundled/definition75.js +110 -476
- package/unbundled/definition76.cjs +233 -0
- package/unbundled/definition76.js +214 -0
- package/unbundled/definition77.cjs +533 -0
- package/unbundled/definition77.js +513 -0
- package/unbundled/definition8.js +1 -1
- package/unbundled/definition9.cjs +9 -7
- package/unbundled/definition9.js +10 -8
- package/unbundled/delegates-aria.cjs +5 -60
- package/unbundled/delegates-aria.js +6 -60
- package/unbundled/divider.cjs +6 -0
- package/unbundled/divider.js +6 -0
- package/unbundled/form-element.cjs +7 -5
- package/unbundled/form-element.js +7 -5
- package/unbundled/host-semantics.cjs +10 -45
- package/unbundled/host-semantics.js +10 -44
- package/unbundled/mixins.js +1 -1
- package/unbundled/numberConverter.cjs +91 -0
- package/unbundled/numberConverter.js +74 -0
- package/unbundled/picker-field.template.cjs +22 -15
- package/unbundled/picker-field.template.js +22 -15
- package/unbundled/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +4 -3
- package/unbundled/time-selection-picker.template.js +5 -4
- package/unbundled/utils.cjs +1439 -0
- package/unbundled/utils.js +1428 -0
- package/unbundled/vivid-element.cjs +10 -1
- package/unbundled/vivid-element.js +5 -2
- package/video-player/definition.cjs +1 -1
- package/video-player/definition.js +1 -1
- package/video-player/index.cjs +24 -24
- package/video-player/index.js +3087 -3010
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +0 -1
- package/vivid.api.json +514 -1
- package/bundled/attribute-binding-behaviour.cjs +0 -1
- package/bundled/attribute-binding-behaviour.js +0 -18
- package/bundled/strings.cjs +0 -1
- package/bundled/strings.js +0 -7
- package/shared/aria/delegate-aria-behavior.d.ts +0 -23
- package/shared/aria/host-semantics-behavior.d.ts +0 -19
- package/shared/templating/attribute-binding-behaviour.d.ts +0 -14
- package/unbundled/attribute-binding-behaviour.cjs +0 -37
- package/unbundled/attribute-binding-behaviour.js +0 -31
- /package/{lib/icon/icon.placeholder.d.ts → shared/icon/icon-placeholder.d.ts} +0 -0
|
@@ -1,33 +1,2018 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { c as createRegisterFunction, s as defineVividComponent, t as VividElement } from "./vivid-element.js";
|
|
2
|
+
import { n as visuallyHiddenDefinition, r as VisuallyHidden } from "./definition.js";
|
|
3
|
+
import { r as Icon, t as iconDefinition } from "./definition2.js";
|
|
4
|
+
import { t as __decorate } from "./decorate.js";
|
|
5
|
+
import { t as Localized } from "./localized.js";
|
|
6
|
+
import { n as keyArrowRight$1, t as keyArrowLeft$1 } from "./key-codes.js";
|
|
7
|
+
import { n as applyHostSemantics, t as HostSemantics } from "./host-semantics.js";
|
|
8
|
+
import { a as GenerateHeaderOptions, i as DataGridRowTypes, n as DataGridCellSortStates, r as DataGridCellTypes, t as DataGridCellRole } from "./data-grid.options.js";
|
|
9
|
+
import { Observable, RepeatDirective, Updates, attr, children, elements, html, normalizeBinding, nullableNumberConverter, observable, slotted, when } from "@microsoft/fast-element";
|
|
10
|
+
import { classNames, eventFocus, eventFocusIn, eventFocusOut, eventKeyDown, keyArrowDown, keyArrowUp, keyEnd, keyEnter, keyEscape, keyFunction2, keyHome, keyPageDown, keyPageUp, keySpace } from "@microsoft/fast-web-utilities";
|
|
11
|
+
//#region src/lib/data-grid/data-grid.scss?inline
|
|
12
|
+
var data_grid_default = ":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%);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{background-color:var(--scrollbar-fallback-track-color,var(--scrollbar-thumb-color));border:0;border-radius:4px}.base{block-size:inherit;inline-size:100%;max-block-size:inherit;position:relative;overflow:auto}";
|
|
8
13
|
//#endregion
|
|
9
|
-
//#region src/lib/
|
|
10
|
-
var
|
|
11
|
-
var getAriaOrientation = ({ role, orientation }) => role === DividerRole.presentation ? null : orientation;
|
|
14
|
+
//#region src/lib/data-grid/data-grid-row.scss?inline
|
|
15
|
+
var data_grid_row_default = ".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}@media (hover:hover){.base: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.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.selected:where(:not(.disabled,:disabled)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-soft);--_appearance-color-outline:transparent}@media (hover:hover){.base.selected: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.selected.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{box-sizing:border-box;width:100%;color:var(--vvd-color-canvas-text);display:grid}:host([row-type=sticky-header]) .base{z-index:9;background:var(--data-grid-row-background,var(--vvd-color-canvas));position:sticky;top:0}:host([row-type=hidden-header]) .base{display:none}:host([selected]:not([row-type*=header])) .base{background-color:var(--_appearance-color-fill)}";
|
|
12
16
|
//#endregion
|
|
13
|
-
//#region src/lib/
|
|
17
|
+
//#region src/lib/data-grid/data-grid-cell.scss?inline
|
|
18
|
+
var data_grid_cell_default = ":host{block-size:100%;min-inline-size:80px}:host(:focus-visible){outline:none}:host([data-fixed]){z-index:5;background:var(--data-grid-cell-background,var(--vvd-color-surface-2dp));position:sticky}:host([data-fixed]):before{z-index:1;width:1px;content:\"\";pointer-events:none;block-size:100%;position:absolute;top:0;right:0;box-shadow:4px 0 4px #0000001a,2px 0 2px #0000000d,1px 0 1px #0000000d}.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}@media (hover:hover){.base: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.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.selected:where(:not(.disabled,:disabled)){--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:var(--_connotation-color-soft);--_appearance-color-outline:transparent}@media (hover:hover){.base.selected: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.selected.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{box-sizing:border-box;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 * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) + 8));align-items:center;padding-block:13px 14px;padding-inline:12px;display:flex}:host(:focus-visible) .base{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - 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 * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) + 8));--_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([selected]:not([cell-type=columnheader])) .base{background-color:var(--_appearance-color-fill)}.content{align-items:center;display:flex;overflow:hidden}.content[role=button]{cursor:pointer}slot:not([name]){text-overflow:ellipsis;white-space:var(--data-grid-cell-white-space,var(--_data-grid-cell-default-white-space));display:block;overflow:hidden}:host(:not([cell-type=columnheader][aria-sort])) slot:not([name]){inline-size:100%}.header-icon{flex-shrink:0;margin-inline-start:16px}slot[name=action-items]{flex-shrink:0;align-items:center;display:flex}.base.has-action-items slot[name=action-items]{margin-inline-start:16px}";
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ../../node_modules/.pnpm/@microsoft+fast-element@2.8.3/node_modules/@microsoft/fast-element/dist/esm/interfaces.js
|
|
21
|
+
var kernelMode;
|
|
22
|
+
var kernelAttr = "fast-kernel";
|
|
23
|
+
try {
|
|
24
|
+
if (document.currentScript) kernelMode = document.currentScript.getAttribute(kernelAttr);
|
|
25
|
+
else {
|
|
26
|
+
const scripts = document.getElementsByTagName("script");
|
|
27
|
+
kernelMode = scripts[scripts.length - 1].getAttribute(kernelAttr);
|
|
28
|
+
}
|
|
29
|
+
} catch (e) {
|
|
30
|
+
kernelMode = "isolate";
|
|
31
|
+
}
|
|
32
|
+
var KernelServiceId;
|
|
33
|
+
switch (kernelMode) {
|
|
34
|
+
case "share":
|
|
35
|
+
KernelServiceId = Object.freeze({
|
|
36
|
+
updateQueue: 1,
|
|
37
|
+
observable: 2,
|
|
38
|
+
contextEvent: 3,
|
|
39
|
+
elementRegistry: 4
|
|
40
|
+
});
|
|
41
|
+
break;
|
|
42
|
+
case "share-v2":
|
|
43
|
+
KernelServiceId = Object.freeze({
|
|
44
|
+
updateQueue: 1.2,
|
|
45
|
+
observable: 2.2,
|
|
46
|
+
contextEvent: 3.2,
|
|
47
|
+
elementRegistry: 4.2
|
|
48
|
+
});
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
const postfix = `-${Math.random().toString(36).substring(2, 8)}`;
|
|
52
|
+
KernelServiceId = Object.freeze({
|
|
53
|
+
updateQueue: `1.2${postfix}`,
|
|
54
|
+
observable: `2.2${postfix}`,
|
|
55
|
+
contextEvent: `3.2${postfix}`,
|
|
56
|
+
elementRegistry: `4.2${postfix}`
|
|
57
|
+
});
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Determines whether or not an object is a function.
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
var isFunction = (object) => typeof object === "function";
|
|
65
|
+
/**
|
|
66
|
+
* Determines whether or not an object is a string.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
var isString = (object) => typeof object === "string";
|
|
70
|
+
/**
|
|
71
|
+
* A function which does nothing.
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
var noop = () => void 0;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region ../../node_modules/.pnpm/@microsoft+fast-element@2.8.3/node_modules/@microsoft/fast-element/dist/esm/polyfills.js
|
|
77
|
+
(function ensureGlobalThis() {
|
|
78
|
+
if (typeof globalThis !== "undefined") return;
|
|
79
|
+
if (typeof global !== "undefined") global.globalThis = global;
|
|
80
|
+
else if (typeof self !== "undefined") self.globalThis = self;
|
|
81
|
+
else if (typeof window !== "undefined") window.globalThis = window;
|
|
82
|
+
else {
|
|
83
|
+
const result = new Function("return this")();
|
|
84
|
+
result.globalThis = result;
|
|
85
|
+
}
|
|
86
|
+
})();
|
|
87
|
+
(function requestIdleCallbackPolyfill() {
|
|
88
|
+
if ("requestIdleCallback" in globalThis) return;
|
|
89
|
+
/**
|
|
90
|
+
* A polyfill for requestIdleCallback that falls back to setTimeout.
|
|
91
|
+
*
|
|
92
|
+
* @param callback - The function to call when the browser is idle.
|
|
93
|
+
* @param options - Options object that may contain a timeout property.
|
|
94
|
+
* @returns An ID that can be used to cancel the callback.
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
globalThis.requestIdleCallback = function requestIdleCallback(callback, options) {
|
|
98
|
+
const start = Date.now();
|
|
99
|
+
return setTimeout(() => {
|
|
100
|
+
callback({
|
|
101
|
+
didTimeout: (options === null || options === void 0 ? void 0 : options.timeout) ? Date.now() - start >= options.timeout : false,
|
|
102
|
+
timeRemaining: () => 0
|
|
103
|
+
});
|
|
104
|
+
}, 1);
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* A polyfill for cancelIdleCallback that falls back to clearTimeout.
|
|
108
|
+
*
|
|
109
|
+
* @param id - The ID of the callback to cancel.
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
globalThis.cancelIdleCallback = function cancelIdleCallback(id) {
|
|
113
|
+
clearTimeout(id);
|
|
114
|
+
};
|
|
115
|
+
})();
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region ../../node_modules/.pnpm/@microsoft+fast-element@2.8.3/node_modules/@microsoft/fast-element/dist/esm/platform.js
|
|
118
|
+
var propConfig = {
|
|
119
|
+
configurable: false,
|
|
120
|
+
enumerable: false,
|
|
121
|
+
writable: false
|
|
122
|
+
};
|
|
123
|
+
if (globalThis.FAST === void 0) Reflect.defineProperty(globalThis, "FAST", Object.assign({ value: Object.create(null) }, propConfig));
|
|
124
|
+
/**
|
|
125
|
+
* The FAST global.
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
var FAST = globalThis.FAST;
|
|
129
|
+
if (FAST.getById === void 0) {
|
|
130
|
+
const storage = Object.create(null);
|
|
131
|
+
Reflect.defineProperty(FAST, "getById", Object.assign({ value(id, initialize) {
|
|
132
|
+
let found = storage[id];
|
|
133
|
+
if (found === void 0) found = initialize ? storage[id] = initialize() : null;
|
|
134
|
+
return found;
|
|
135
|
+
} }, propConfig));
|
|
136
|
+
}
|
|
137
|
+
if (FAST.error === void 0) Object.assign(FAST, {
|
|
138
|
+
warn() {},
|
|
139
|
+
error(code) {
|
|
140
|
+
return /* @__PURE__ */ new Error(`Error ${code}`);
|
|
141
|
+
},
|
|
142
|
+
addMessages() {}
|
|
143
|
+
});
|
|
144
|
+
Object.freeze([]);
|
|
145
|
+
/**
|
|
146
|
+
* Creates a function capable of locating metadata associated with a type.
|
|
147
|
+
* @returns A metadata locator function.
|
|
148
|
+
* @internal
|
|
149
|
+
*/
|
|
150
|
+
function createMetadataLocator() {
|
|
151
|
+
const metadataLookup = /* @__PURE__ */ new WeakMap();
|
|
152
|
+
return function(target) {
|
|
153
|
+
let metadata = metadataLookup.get(target);
|
|
154
|
+
if (metadata === void 0) {
|
|
155
|
+
let currentTarget = Reflect.getPrototypeOf(target);
|
|
156
|
+
while (metadata === void 0 && currentTarget !== null) {
|
|
157
|
+
metadata = metadataLookup.get(currentTarget);
|
|
158
|
+
currentTarget = Reflect.getPrototypeOf(currentTarget);
|
|
159
|
+
}
|
|
160
|
+
metadata = metadata === void 0 ? [] : metadata.slice(0);
|
|
161
|
+
metadataLookup.set(target, metadata);
|
|
162
|
+
}
|
|
163
|
+
return metadata;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
14
166
|
/**
|
|
167
|
+
* Makes a type noop for JSON serialization.
|
|
168
|
+
* @param type - The type to make noop for JSON serialization.
|
|
15
169
|
* @internal
|
|
16
170
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
171
|
+
function makeSerializationNoop(type) {
|
|
172
|
+
type.prototype.toJSON = noop;
|
|
173
|
+
}
|
|
174
|
+
Object.freeze({
|
|
175
|
+
/**
|
|
176
|
+
* Not aspected.
|
|
177
|
+
*/
|
|
178
|
+
none: 0,
|
|
179
|
+
/**
|
|
180
|
+
* An attribute.
|
|
181
|
+
*/
|
|
182
|
+
attribute: 1,
|
|
183
|
+
/**
|
|
184
|
+
* A boolean attribute.
|
|
185
|
+
*/
|
|
186
|
+
booleanAttribute: 2,
|
|
187
|
+
/**
|
|
188
|
+
* A property.
|
|
189
|
+
*/
|
|
190
|
+
property: 3,
|
|
191
|
+
/**
|
|
192
|
+
* Content
|
|
193
|
+
*/
|
|
194
|
+
content: 4,
|
|
195
|
+
/**
|
|
196
|
+
* A token list.
|
|
197
|
+
*/
|
|
198
|
+
tokenList: 5,
|
|
199
|
+
/**
|
|
200
|
+
* An event.
|
|
201
|
+
*/
|
|
202
|
+
event: 6
|
|
203
|
+
});
|
|
204
|
+
var createHTML = (html) => html;
|
|
205
|
+
var fastTrustedType = globalThis.trustedTypes ? globalThis.trustedTypes.createPolicy("fast-html", { createHTML }) : { createHTML };
|
|
206
|
+
var defaultPolicy = Object.freeze({
|
|
207
|
+
createHTML(value) {
|
|
208
|
+
return fastTrustedType.createHTML(value);
|
|
209
|
+
},
|
|
210
|
+
protect(tagName, aspect, aspectName, sink) {
|
|
211
|
+
return sink;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
var fastPolicy = defaultPolicy;
|
|
215
|
+
/**
|
|
216
|
+
* Common DOM APIs.
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
var DOM$1 = Object.freeze({
|
|
220
|
+
/**
|
|
221
|
+
* Gets the dom policy used by the templating system.
|
|
222
|
+
*/
|
|
223
|
+
get policy() {
|
|
224
|
+
return defaultPolicy;
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* Sets the dom policy used by the templating system.
|
|
228
|
+
* @param policy - The policy to set.
|
|
229
|
+
* @remarks
|
|
230
|
+
* This API can only be called once, for security reasons. It should be
|
|
231
|
+
* called by the application developer at the start of their program.
|
|
232
|
+
*/
|
|
233
|
+
setPolicy(value) {
|
|
234
|
+
if (defaultPolicy !== fastPolicy) throw FAST.error(1201);
|
|
235
|
+
defaultPolicy = value;
|
|
236
|
+
},
|
|
237
|
+
/**
|
|
238
|
+
* Sets an attribute value on an element.
|
|
239
|
+
* @param element - The element to set the attribute value on.
|
|
240
|
+
* @param attributeName - The attribute name to set.
|
|
241
|
+
* @param value - The value of the attribute to set.
|
|
242
|
+
* @remarks
|
|
243
|
+
* If the value is `null` or `undefined`, the attribute is removed, otherwise
|
|
244
|
+
* it is set to the provided value using the standard `setAttribute` API.
|
|
245
|
+
*/
|
|
246
|
+
setAttribute(element, attributeName, value) {
|
|
247
|
+
value === null || value === void 0 ? element.removeAttribute(attributeName) : element.setAttribute(attributeName, value);
|
|
248
|
+
},
|
|
249
|
+
/**
|
|
250
|
+
* Sets a boolean attribute value.
|
|
251
|
+
* @param element - The element to set the boolean attribute value on.
|
|
252
|
+
* @param attributeName - The attribute name to set.
|
|
253
|
+
* @param value - The value of the attribute to set.
|
|
254
|
+
* @remarks
|
|
255
|
+
* If the value is true, the attribute is added; otherwise it is removed.
|
|
256
|
+
*/
|
|
257
|
+
setBooleanAttribute(element, attributeName, value) {
|
|
258
|
+
value ? element.setAttribute(attributeName, "") : element.removeAttribute(attributeName);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region ../../node_modules/.pnpm/@microsoft+fast-element@2.8.3/node_modules/@microsoft/fast-element/dist/esm/observation/update-queue.js
|
|
263
|
+
/**
|
|
264
|
+
* The default UpdateQueue.
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
267
|
+
var Updates$1 = FAST.getById(KernelServiceId.updateQueue, () => {
|
|
268
|
+
const tasks = [];
|
|
269
|
+
const pendingErrors = [];
|
|
270
|
+
const rAF = globalThis.requestAnimationFrame;
|
|
271
|
+
let updateAsync = true;
|
|
272
|
+
function throwFirstError() {
|
|
273
|
+
if (pendingErrors.length) throw pendingErrors.shift();
|
|
274
|
+
}
|
|
275
|
+
function tryRunTask(task) {
|
|
276
|
+
try {
|
|
277
|
+
task.call();
|
|
278
|
+
} catch (error) {
|
|
279
|
+
if (updateAsync) {
|
|
280
|
+
pendingErrors.push(error);
|
|
281
|
+
setTimeout(throwFirstError, 0);
|
|
282
|
+
} else {
|
|
283
|
+
tasks.length = 0;
|
|
284
|
+
throw error;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function process() {
|
|
289
|
+
const capacity = 1024;
|
|
290
|
+
let index = 0;
|
|
291
|
+
while (index < tasks.length) {
|
|
292
|
+
tryRunTask(tasks[index]);
|
|
293
|
+
index++;
|
|
294
|
+
if (index > capacity) {
|
|
295
|
+
for (let scan = 0, newLength = tasks.length - index; scan < newLength; scan++) tasks[scan] = tasks[scan + index];
|
|
296
|
+
tasks.length -= index;
|
|
297
|
+
index = 0;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
tasks.length = 0;
|
|
301
|
+
}
|
|
302
|
+
function enqueue(callable) {
|
|
303
|
+
tasks.push(callable);
|
|
304
|
+
if (tasks.length < 2) updateAsync ? rAF(process) : process();
|
|
305
|
+
}
|
|
306
|
+
return Object.freeze({
|
|
307
|
+
enqueue,
|
|
308
|
+
next: () => new Promise(enqueue),
|
|
309
|
+
process,
|
|
310
|
+
setMode: (isAsync) => updateAsync = isAsync
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region ../../node_modules/.pnpm/@microsoft+fast-element@2.8.3/node_modules/@microsoft/fast-element/dist/esm/observation/notifier.js
|
|
315
|
+
/**
|
|
316
|
+
* An implementation of {@link Notifier} that efficiently keeps track of
|
|
317
|
+
* subscribers interested in a specific change notification on an
|
|
318
|
+
* observable subject.
|
|
319
|
+
*
|
|
320
|
+
* @remarks
|
|
321
|
+
* This set is optimized for the most common scenario of 1 or 2 subscribers.
|
|
322
|
+
* With this in mind, it can store a subscriber in an internal field, allowing it to avoid Array#push operations.
|
|
323
|
+
* If the set ever exceeds two subscribers, it upgrades to an array automatically.
|
|
324
|
+
* @public
|
|
325
|
+
*/
|
|
326
|
+
var SubscriberSet = class {
|
|
327
|
+
/**
|
|
328
|
+
* Creates an instance of SubscriberSet for the specified subject.
|
|
329
|
+
* @param subject - The subject that subscribers will receive notifications from.
|
|
330
|
+
* @param initialSubscriber - An initial subscriber to changes.
|
|
331
|
+
*/
|
|
332
|
+
constructor(subject, initialSubscriber) {
|
|
333
|
+
this.sub1 = void 0;
|
|
334
|
+
this.sub2 = void 0;
|
|
335
|
+
this.spillover = void 0;
|
|
336
|
+
this.subject = subject;
|
|
337
|
+
this.sub1 = initialSubscriber;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Checks whether the provided subscriber has been added to this set.
|
|
341
|
+
* @param subscriber - The subscriber to test for inclusion in this set.
|
|
342
|
+
*/
|
|
343
|
+
has(subscriber) {
|
|
344
|
+
return this.spillover === void 0 ? this.sub1 === subscriber || this.sub2 === subscriber : this.spillover.indexOf(subscriber) !== -1;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Subscribes to notification of changes in an object's state.
|
|
348
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
349
|
+
*/
|
|
350
|
+
subscribe(subscriber) {
|
|
351
|
+
const spillover = this.spillover;
|
|
352
|
+
if (spillover === void 0) {
|
|
353
|
+
if (this.has(subscriber)) return;
|
|
354
|
+
if (this.sub1 === void 0) {
|
|
355
|
+
this.sub1 = subscriber;
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
if (this.sub2 === void 0) {
|
|
359
|
+
this.sub2 = subscriber;
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
this.spillover = [
|
|
363
|
+
this.sub1,
|
|
364
|
+
this.sub2,
|
|
365
|
+
subscriber
|
|
366
|
+
];
|
|
367
|
+
this.sub1 = void 0;
|
|
368
|
+
this.sub2 = void 0;
|
|
369
|
+
} else if (spillover.indexOf(subscriber) === -1) spillover.push(subscriber);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Unsubscribes from notification of changes in an object's state.
|
|
373
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
374
|
+
*/
|
|
375
|
+
unsubscribe(subscriber) {
|
|
376
|
+
const spillover = this.spillover;
|
|
377
|
+
if (spillover === void 0) {
|
|
378
|
+
if (this.sub1 === subscriber) this.sub1 = void 0;
|
|
379
|
+
else if (this.sub2 === subscriber) this.sub2 = void 0;
|
|
380
|
+
} else {
|
|
381
|
+
const index = spillover.indexOf(subscriber);
|
|
382
|
+
if (index !== -1) spillover.splice(index, 1);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Notifies all subscribers.
|
|
387
|
+
* @param args - Data passed along to subscribers during notification.
|
|
388
|
+
*/
|
|
389
|
+
notify(args) {
|
|
390
|
+
const spillover = this.spillover;
|
|
391
|
+
const subject = this.subject;
|
|
392
|
+
if (spillover === void 0) {
|
|
393
|
+
const sub1 = this.sub1;
|
|
394
|
+
const sub2 = this.sub2;
|
|
395
|
+
if (sub1 !== void 0) sub1.handleChange(subject, args);
|
|
396
|
+
if (sub2 !== void 0) sub2.handleChange(subject, args);
|
|
397
|
+
} else for (let i = 0, ii = spillover.length; i < ii; ++i) spillover[i].handleChange(subject, args);
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* An implementation of Notifier that allows subscribers to be notified
|
|
402
|
+
* of individual property changes on an object.
|
|
403
|
+
* @public
|
|
404
|
+
*/
|
|
405
|
+
var PropertyChangeNotifier = class {
|
|
406
|
+
/**
|
|
407
|
+
* Creates an instance of PropertyChangeNotifier for the specified subject.
|
|
408
|
+
* @param subject - The object that subscribers will receive notifications for.
|
|
409
|
+
*/
|
|
410
|
+
constructor(subject) {
|
|
411
|
+
this.subscribers = {};
|
|
412
|
+
this.subjectSubscribers = null;
|
|
413
|
+
this.subject = subject;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Notifies all subscribers, based on the specified property.
|
|
417
|
+
* @param propertyName - The property name, passed along to subscribers during notification.
|
|
418
|
+
*/
|
|
419
|
+
notify(propertyName) {
|
|
420
|
+
var _a, _b;
|
|
421
|
+
(_a = this.subscribers[propertyName]) === null || _a === void 0 || _a.notify(propertyName);
|
|
422
|
+
(_b = this.subjectSubscribers) === null || _b === void 0 || _b.notify(propertyName);
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Subscribes to notification of changes in an object's state.
|
|
426
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
427
|
+
* @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
|
|
428
|
+
*/
|
|
429
|
+
subscribe(subscriber, propertyToWatch) {
|
|
430
|
+
var _a, _b;
|
|
431
|
+
let subscribers;
|
|
432
|
+
if (propertyToWatch) subscribers = (_a = this.subscribers[propertyToWatch]) !== null && _a !== void 0 ? _a : this.subscribers[propertyToWatch] = new SubscriberSet(this.subject);
|
|
433
|
+
else subscribers = (_b = this.subjectSubscribers) !== null && _b !== void 0 ? _b : this.subjectSubscribers = new SubscriberSet(this.subject);
|
|
434
|
+
subscribers.subscribe(subscriber);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Unsubscribes from notification of changes in an object's state.
|
|
438
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
439
|
+
* @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
|
|
440
|
+
*/
|
|
441
|
+
unsubscribe(subscriber, propertyToUnwatch) {
|
|
442
|
+
var _a, _b;
|
|
443
|
+
if (propertyToUnwatch) (_a = this.subscribers[propertyToUnwatch]) === null || _a === void 0 || _a.unsubscribe(subscriber);
|
|
444
|
+
else (_b = this.subjectSubscribers) === null || _b === void 0 || _b.unsubscribe(subscriber);
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region ../../node_modules/.pnpm/@microsoft+fast-element@2.8.3/node_modules/@microsoft/fast-element/dist/esm/observation/observable.js
|
|
449
|
+
/**
|
|
450
|
+
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
451
|
+
* @public
|
|
452
|
+
*/
|
|
453
|
+
var SourceLifetime = Object.freeze({
|
|
454
|
+
/**
|
|
455
|
+
* The source to controller lifetime relationship is unknown.
|
|
456
|
+
*/
|
|
457
|
+
unknown: void 0,
|
|
458
|
+
/**
|
|
459
|
+
* The source and controller lifetimes are coupled to one another.
|
|
460
|
+
* They can/will be GC'd together.
|
|
461
|
+
*/
|
|
462
|
+
coupled: 1
|
|
463
|
+
});
|
|
464
|
+
FAST.getById(KernelServiceId.observable, () => {
|
|
465
|
+
const queueUpdate = Updates$1.enqueue;
|
|
466
|
+
const volatileRegex = /(:|&&|\|\||if|\?\.)/;
|
|
467
|
+
const notifierLookup = /* @__PURE__ */ new WeakMap();
|
|
468
|
+
let watcher = void 0;
|
|
469
|
+
let createArrayObserver = (array) => {
|
|
470
|
+
throw FAST.error(1101);
|
|
471
|
+
};
|
|
472
|
+
function getNotifier(source) {
|
|
473
|
+
var _a;
|
|
474
|
+
let found = (_a = source.$fastController) !== null && _a !== void 0 ? _a : notifierLookup.get(source);
|
|
475
|
+
if (found === void 0) Array.isArray(source) ? found = createArrayObserver(source) : notifierLookup.set(source, found = new PropertyChangeNotifier(source));
|
|
476
|
+
return found;
|
|
477
|
+
}
|
|
478
|
+
const getAccessors = createMetadataLocator();
|
|
479
|
+
class DefaultObservableAccessor {
|
|
480
|
+
constructor(name) {
|
|
481
|
+
this.name = name;
|
|
482
|
+
this.field = `_${name}`;
|
|
483
|
+
this.callback = `${name}Changed`;
|
|
484
|
+
}
|
|
485
|
+
getValue(source) {
|
|
486
|
+
if (watcher !== void 0) watcher.watch(source, this.name);
|
|
487
|
+
return source[this.field];
|
|
488
|
+
}
|
|
489
|
+
setValue(source, newValue) {
|
|
490
|
+
const field = this.field;
|
|
491
|
+
const oldValue = source[field];
|
|
492
|
+
if (oldValue !== newValue) {
|
|
493
|
+
source[field] = newValue;
|
|
494
|
+
const callback = source[this.callback];
|
|
495
|
+
if (isFunction(callback)) callback.call(source, oldValue, newValue);
|
|
496
|
+
getNotifier(source).notify(this.name);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
class ExpressionNotifierImplementation extends SubscriberSet {
|
|
501
|
+
constructor(expression, initialSubscriber, isVolatileBinding = false) {
|
|
502
|
+
super(expression, initialSubscriber);
|
|
503
|
+
this.expression = expression;
|
|
504
|
+
this.isVolatileBinding = isVolatileBinding;
|
|
505
|
+
this.needsRefresh = true;
|
|
506
|
+
this.needsQueue = true;
|
|
507
|
+
this.isAsync = true;
|
|
508
|
+
this.first = this;
|
|
509
|
+
this.last = null;
|
|
510
|
+
this.propertySource = void 0;
|
|
511
|
+
this.propertyName = void 0;
|
|
512
|
+
this.notifier = void 0;
|
|
513
|
+
this.next = void 0;
|
|
514
|
+
}
|
|
515
|
+
setMode(isAsync) {
|
|
516
|
+
this.isAsync = this.needsQueue = isAsync;
|
|
517
|
+
}
|
|
518
|
+
bind(controller) {
|
|
519
|
+
this.controller = controller;
|
|
520
|
+
const value = this.observe(controller.source, controller.context);
|
|
521
|
+
if (!controller.isBound && this.requiresUnbind(controller)) controller.onUnbind(this);
|
|
522
|
+
return value;
|
|
523
|
+
}
|
|
524
|
+
requiresUnbind(controller) {
|
|
525
|
+
return controller.sourceLifetime !== SourceLifetime.coupled || this.first !== this.last || this.first.propertySource !== controller.source;
|
|
526
|
+
}
|
|
527
|
+
unbind(controller) {
|
|
528
|
+
this.dispose();
|
|
529
|
+
}
|
|
530
|
+
observe(source, context) {
|
|
531
|
+
if (this.needsRefresh && this.last !== null) this.dispose();
|
|
532
|
+
const previousWatcher = watcher;
|
|
533
|
+
watcher = this.needsRefresh ? this : void 0;
|
|
534
|
+
this.needsRefresh = this.isVolatileBinding;
|
|
535
|
+
let result;
|
|
536
|
+
try {
|
|
537
|
+
result = this.expression(source, context);
|
|
538
|
+
} finally {
|
|
539
|
+
watcher = previousWatcher;
|
|
540
|
+
}
|
|
541
|
+
return result;
|
|
542
|
+
}
|
|
543
|
+
disconnect() {
|
|
544
|
+
this.dispose();
|
|
545
|
+
}
|
|
546
|
+
dispose() {
|
|
547
|
+
if (this.last !== null) {
|
|
548
|
+
let current = this.first;
|
|
549
|
+
while (current !== void 0) {
|
|
550
|
+
current.notifier.unsubscribe(this, current.propertyName);
|
|
551
|
+
current = current.next;
|
|
552
|
+
}
|
|
553
|
+
this.last = null;
|
|
554
|
+
this.needsRefresh = this.needsQueue = this.isAsync;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
watch(propertySource, propertyName) {
|
|
558
|
+
const prev = this.last;
|
|
559
|
+
const notifier = getNotifier(propertySource);
|
|
560
|
+
const current = prev === null ? this.first : {};
|
|
561
|
+
current.propertySource = propertySource;
|
|
562
|
+
current.propertyName = propertyName;
|
|
563
|
+
current.notifier = notifier;
|
|
564
|
+
notifier.subscribe(this, propertyName);
|
|
565
|
+
if (prev !== null) {
|
|
566
|
+
if (!this.needsRefresh) {
|
|
567
|
+
let prevValue;
|
|
568
|
+
watcher = void 0;
|
|
569
|
+
prevValue = prev.propertySource[prev.propertyName];
|
|
570
|
+
watcher = this;
|
|
571
|
+
if (propertySource === prevValue) this.needsRefresh = true;
|
|
572
|
+
}
|
|
573
|
+
prev.next = current;
|
|
574
|
+
}
|
|
575
|
+
this.last = current;
|
|
576
|
+
}
|
|
577
|
+
handleChange() {
|
|
578
|
+
if (this.needsQueue) {
|
|
579
|
+
this.needsQueue = false;
|
|
580
|
+
queueUpdate(this);
|
|
581
|
+
} else if (!this.isAsync) this.call();
|
|
582
|
+
}
|
|
583
|
+
call() {
|
|
584
|
+
if (this.last !== null) {
|
|
585
|
+
this.needsQueue = this.isAsync;
|
|
586
|
+
this.notify(this);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
*records() {
|
|
590
|
+
let next = this.first;
|
|
591
|
+
while (next !== void 0) {
|
|
592
|
+
yield next;
|
|
593
|
+
next = next.next;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
makeSerializationNoop(ExpressionNotifierImplementation);
|
|
598
|
+
return Object.freeze({
|
|
599
|
+
/**
|
|
600
|
+
* @internal
|
|
601
|
+
* @param factory - The factory used to create array observers.
|
|
602
|
+
*/
|
|
603
|
+
setArrayObserverFactory(factory) {
|
|
604
|
+
createArrayObserver = factory;
|
|
605
|
+
},
|
|
606
|
+
/**
|
|
607
|
+
* Gets a notifier for an object or Array.
|
|
608
|
+
* @param source - The object or Array to get the notifier for.
|
|
609
|
+
*/
|
|
610
|
+
getNotifier,
|
|
611
|
+
/**
|
|
612
|
+
* Records a property change for a source object.
|
|
613
|
+
* @param source - The object to record the change against.
|
|
614
|
+
* @param propertyName - The property to track as changed.
|
|
615
|
+
*/
|
|
616
|
+
track(source, propertyName) {
|
|
617
|
+
watcher && watcher.watch(source, propertyName);
|
|
618
|
+
},
|
|
619
|
+
/**
|
|
620
|
+
* Notifies watchers that the currently executing property getter or function is volatile
|
|
621
|
+
* with respect to its observable dependencies.
|
|
622
|
+
*/
|
|
623
|
+
trackVolatile() {
|
|
624
|
+
watcher && (watcher.needsRefresh = true);
|
|
625
|
+
},
|
|
626
|
+
/**
|
|
627
|
+
* Notifies subscribers of a source object of changes.
|
|
628
|
+
* @param source - the object to notify of changes.
|
|
629
|
+
* @param args - The change args to pass to subscribers.
|
|
630
|
+
*/
|
|
631
|
+
notify(source, args) {
|
|
632
|
+
getNotifier(source).notify(args);
|
|
633
|
+
},
|
|
634
|
+
/**
|
|
635
|
+
* Defines an observable property on an object or prototype.
|
|
636
|
+
* @param target - The target object to define the observable on.
|
|
637
|
+
* @param nameOrAccessor - The name of the property to define as observable;
|
|
638
|
+
* or a custom accessor that specifies the property name and accessor implementation.
|
|
639
|
+
*/
|
|
640
|
+
defineProperty(target, nameOrAccessor) {
|
|
641
|
+
if (isString(nameOrAccessor)) nameOrAccessor = new DefaultObservableAccessor(nameOrAccessor);
|
|
642
|
+
getAccessors(target).push(nameOrAccessor);
|
|
643
|
+
Reflect.defineProperty(target, nameOrAccessor.name, {
|
|
644
|
+
enumerable: true,
|
|
645
|
+
get() {
|
|
646
|
+
return nameOrAccessor.getValue(this);
|
|
647
|
+
},
|
|
648
|
+
set(newValue) {
|
|
649
|
+
nameOrAccessor.setValue(this, newValue);
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
},
|
|
653
|
+
/**
|
|
654
|
+
* Finds all the observable accessors defined on the target,
|
|
655
|
+
* including its prototype chain.
|
|
656
|
+
* @param target - The target object to search for accessor on.
|
|
657
|
+
*/
|
|
658
|
+
getAccessors,
|
|
659
|
+
/**
|
|
660
|
+
* Creates a {@link ExpressionNotifier} that can watch the
|
|
661
|
+
* provided {@link Expression} for changes.
|
|
662
|
+
* @param expression - The binding to observe.
|
|
663
|
+
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
664
|
+
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
665
|
+
*/
|
|
666
|
+
binding(expression, initialSubscriber, isVolatileBinding = this.isVolatileBinding(expression)) {
|
|
667
|
+
return new ExpressionNotifierImplementation(expression, initialSubscriber, isVolatileBinding);
|
|
668
|
+
},
|
|
669
|
+
/**
|
|
670
|
+
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
671
|
+
* on every evaluation of the value.
|
|
672
|
+
* @param expression - The binding to inspect.
|
|
673
|
+
*/
|
|
674
|
+
isVolatileBinding(expression) {
|
|
675
|
+
return volatileRegex.test(expression.toString());
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
});
|
|
679
|
+
var contextEvent = FAST.getById(KernelServiceId.contextEvent, () => {
|
|
680
|
+
let current = null;
|
|
681
|
+
return {
|
|
682
|
+
get() {
|
|
683
|
+
return current;
|
|
684
|
+
},
|
|
685
|
+
set(event) {
|
|
686
|
+
current = event;
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
});
|
|
690
|
+
/**
|
|
691
|
+
* Provides additional contextual information available to behaviors and expressions.
|
|
692
|
+
* @public
|
|
693
|
+
*/
|
|
694
|
+
var ExecutionContext$1 = Object.freeze({
|
|
695
|
+
/**
|
|
696
|
+
* A default execution context.
|
|
697
|
+
*/
|
|
698
|
+
default: {
|
|
699
|
+
index: 0,
|
|
700
|
+
length: 0,
|
|
701
|
+
get event() {
|
|
702
|
+
return ExecutionContext$1.getEvent();
|
|
703
|
+
},
|
|
704
|
+
eventDetail() {
|
|
705
|
+
return this.event.detail;
|
|
706
|
+
},
|
|
707
|
+
eventTarget() {
|
|
708
|
+
return this.event.target;
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
/**
|
|
712
|
+
* Gets the current event.
|
|
713
|
+
* @returns An event object.
|
|
714
|
+
*/
|
|
715
|
+
getEvent() {
|
|
716
|
+
return contextEvent.get();
|
|
717
|
+
},
|
|
718
|
+
/**
|
|
719
|
+
* Sets the current event.
|
|
720
|
+
* @param event - An event object.
|
|
721
|
+
*/
|
|
722
|
+
setEvent(event) {
|
|
723
|
+
contextEvent.set(event);
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
//#endregion
|
|
727
|
+
//#region ../../node_modules/.pnpm/@microsoft+fast-element@2.8.3/node_modules/@microsoft/fast-element/dist/esm/templating/markup.js
|
|
728
|
+
var marker = `fast-${Math.random().toString(36).substring(2, 8)}`;
|
|
729
|
+
var interpolationStart = `${marker}{`;
|
|
730
|
+
var interpolationEnd = `}${marker}`;
|
|
731
|
+
var interpolationEndLength = interpolationEnd.length;
|
|
732
|
+
var id = 0;
|
|
733
|
+
/** @internal */
|
|
734
|
+
var nextId = () => `${marker}-${++id}`;
|
|
735
|
+
Object.freeze({
|
|
736
|
+
/**
|
|
737
|
+
* Creates a placeholder string suitable for marking out a location *within*
|
|
738
|
+
* an attribute value or HTML content.
|
|
739
|
+
* @param index - The directive index to create the placeholder for.
|
|
740
|
+
* @remarks
|
|
741
|
+
* Used internally by binding directives.
|
|
742
|
+
*/
|
|
743
|
+
interpolation: (id) => `${interpolationStart}${id}${interpolationEnd}`,
|
|
744
|
+
/**
|
|
745
|
+
* Creates a placeholder that manifests itself as an attribute on an
|
|
746
|
+
* element.
|
|
747
|
+
* @param attributeName - The name of the custom attribute.
|
|
748
|
+
* @param index - The directive index to create the placeholder for.
|
|
749
|
+
* @remarks
|
|
750
|
+
* Used internally by attribute directives such as `ref`, `slotted`, and `children`.
|
|
751
|
+
*/
|
|
752
|
+
attribute: (id) => `${nextId()}="${interpolationStart}${id}${interpolationEnd}"`,
|
|
753
|
+
/**
|
|
754
|
+
* Creates a placeholder that manifests itself as a marker within the DOM structure.
|
|
755
|
+
* @param index - The directive index to create the placeholder for.
|
|
756
|
+
* @remarks
|
|
757
|
+
* Used internally by structural directives such as `repeat`.
|
|
758
|
+
*/
|
|
759
|
+
comment: (id) => `<!--${interpolationStart}${id}${interpolationEnd}-->`
|
|
760
|
+
});
|
|
761
|
+
Object.freeze({
|
|
762
|
+
/**
|
|
763
|
+
* Parses text content or HTML attribute content, separating out the static strings
|
|
764
|
+
* from the directives.
|
|
765
|
+
* @param value - The content or attribute string to parse.
|
|
766
|
+
* @param factories - A list of directives to search for in the string.
|
|
767
|
+
* @returns A heterogeneous array of static strings interspersed with
|
|
768
|
+
* directives or null if no directives are found in the string.
|
|
769
|
+
*/
|
|
770
|
+
parse(value, factories) {
|
|
771
|
+
const parts = value.split(interpolationStart);
|
|
772
|
+
if (parts.length === 1) return null;
|
|
773
|
+
const result = [];
|
|
774
|
+
for (let i = 0, ii = parts.length; i < ii; ++i) {
|
|
775
|
+
const current = parts[i];
|
|
776
|
+
const index = current.indexOf(interpolationEnd);
|
|
777
|
+
let literal;
|
|
778
|
+
if (index === -1) literal = current;
|
|
779
|
+
else {
|
|
780
|
+
const factoryId = current.substring(0, index);
|
|
781
|
+
result.push(factories[factoryId]);
|
|
782
|
+
literal = current.substring(index + interpolationEndLength);
|
|
783
|
+
}
|
|
784
|
+
if (literal !== "") result.push(literal);
|
|
785
|
+
}
|
|
786
|
+
return result;
|
|
787
|
+
} });
|
|
788
|
+
//#endregion
|
|
789
|
+
//#region ../../node_modules/.pnpm/@microsoft+fast-element@2.8.3/node_modules/@microsoft/fast-element/dist/esm/utilities.js
|
|
790
|
+
/**
|
|
791
|
+
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
792
|
+
* control ViewBehaviors.
|
|
793
|
+
* @public
|
|
794
|
+
*/
|
|
795
|
+
var ViewBehaviorOrchestrator = Object.freeze({
|
|
796
|
+
/**
|
|
797
|
+
* Creates a ViewBehaviorOrchestrator.
|
|
798
|
+
* @param source - The source to to associate behaviors with.
|
|
799
|
+
* @returns A ViewBehaviorOrchestrator.
|
|
800
|
+
*/
|
|
801
|
+
create(source) {
|
|
802
|
+
const behaviors = [];
|
|
803
|
+
const targets = {};
|
|
804
|
+
let unbindables = null;
|
|
805
|
+
let isConnected = false;
|
|
806
|
+
return {
|
|
807
|
+
source,
|
|
808
|
+
context: ExecutionContext$1.default,
|
|
809
|
+
targets,
|
|
810
|
+
get isBound() {
|
|
811
|
+
return isConnected;
|
|
812
|
+
},
|
|
813
|
+
addBehaviorFactory(factory, target) {
|
|
814
|
+
var _a, _b, _c, _d;
|
|
815
|
+
const compiled = factory;
|
|
816
|
+
compiled.id = (_a = compiled.id) !== null && _a !== void 0 ? _a : nextId();
|
|
817
|
+
compiled.targetNodeId = (_b = compiled.targetNodeId) !== null && _b !== void 0 ? _b : nextId();
|
|
818
|
+
compiled.targetTagName = (_c = target.tagName) !== null && _c !== void 0 ? _c : null;
|
|
819
|
+
compiled.policy = (_d = compiled.policy) !== null && _d !== void 0 ? _d : DOM$1.policy;
|
|
820
|
+
this.addTarget(compiled.targetNodeId, target);
|
|
821
|
+
this.addBehavior(compiled.createBehavior());
|
|
822
|
+
},
|
|
823
|
+
addTarget(nodeId, target) {
|
|
824
|
+
targets[nodeId] = target;
|
|
825
|
+
},
|
|
826
|
+
addBehavior(behavior) {
|
|
827
|
+
behaviors.push(behavior);
|
|
828
|
+
if (isConnected) behavior.bind(this);
|
|
829
|
+
},
|
|
830
|
+
onUnbind(unbindable) {
|
|
831
|
+
if (unbindables === null) unbindables = [];
|
|
832
|
+
unbindables.push(unbindable);
|
|
833
|
+
},
|
|
834
|
+
connectedCallback(controller) {
|
|
835
|
+
if (!isConnected) {
|
|
836
|
+
isConnected = true;
|
|
837
|
+
behaviors.forEach((x) => x.bind(this));
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
disconnectedCallback(controller) {
|
|
841
|
+
if (isConnected) {
|
|
842
|
+
isConnected = false;
|
|
843
|
+
if (unbindables !== null) unbindables.forEach((x) => x.unbind(this));
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
} });
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/lib/data-grid/data-grid.ts
|
|
850
|
+
var DataGridSelectionMode = {
|
|
851
|
+
none: "none",
|
|
852
|
+
singleRow: "single-row",
|
|
853
|
+
multiRow: "multi-row",
|
|
854
|
+
singleCell: "single-cell",
|
|
855
|
+
multiCell: "multi-cell"
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
* @public
|
|
859
|
+
* @component data-grid
|
|
860
|
+
* @slot - Default slot.
|
|
861
|
+
* @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
|
|
862
|
+
*/
|
|
863
|
+
var DataGrid = class DataGrid extends VividElement {
|
|
864
|
+
/**
|
|
865
|
+
* generates a gridTemplateColumns based on columndata array
|
|
866
|
+
*/
|
|
867
|
+
static generateTemplateColumns(columnDefinitions) {
|
|
868
|
+
let templateColumns = "";
|
|
869
|
+
columnDefinitions.forEach((_) => {
|
|
870
|
+
templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}1fr`;
|
|
871
|
+
});
|
|
872
|
+
return templateColumns;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* @internal
|
|
876
|
+
*/
|
|
877
|
+
noTabbingChanged() {
|
|
878
|
+
if (this.$fastController.isConnected) this.#setTabIndex();
|
|
879
|
+
}
|
|
880
|
+
#setTabIndex() {
|
|
881
|
+
this.setAttribute("tabIndex", this.noTabbing || this.contains(document.activeElement) ? "-1" : "0");
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* @internal
|
|
885
|
+
*/
|
|
886
|
+
generateHeaderChanged() {
|
|
887
|
+
if (this.$fastController.isConnected) this.toggleGeneratedHeader();
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* @internal
|
|
891
|
+
*/
|
|
892
|
+
gridTemplateColumnsChanged() {
|
|
893
|
+
/* v8 ignore if -- @preserve */
|
|
894
|
+
if (this.$fastController.isConnected) {
|
|
895
|
+
this.updateRowIndexes();
|
|
896
|
+
if (this.fixedColumns && this.fixedColumns > 0) this.applyFixedColumns();
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* @internal
|
|
901
|
+
*/
|
|
902
|
+
rowsDataChanged() {
|
|
903
|
+
if (this.columnDefinitions === null && this.rowsData.length > 0) this.columnDefinitions = DataGrid.generateColumns(this.rowsData[0]);
|
|
904
|
+
if (this.$fastController.isConnected) this.toggleGeneratedHeader();
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* @internal
|
|
908
|
+
*/
|
|
909
|
+
columnDefinitionsChanged() {
|
|
910
|
+
if (this.columnDefinitions === null) {
|
|
911
|
+
this.generatedGridTemplateColumns = "";
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
this.generatedGridTemplateColumns = DataGrid.generateTemplateColumns(this.columnDefinitions);
|
|
915
|
+
/* v8 ignore if -- @preserve */
|
|
916
|
+
if (this.$fastController.isConnected) {
|
|
917
|
+
this.columnDefinitionsStale = true;
|
|
918
|
+
this.queueRowIndexUpdate();
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* @internal
|
|
923
|
+
*/
|
|
924
|
+
headerCellItemTemplateChanged() {
|
|
925
|
+
/* v8 ignore if -- @preserve */
|
|
926
|
+
if (this.$fastController.isConnected) {
|
|
927
|
+
if (this.generatedHeader !== null) this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* @internal
|
|
932
|
+
*/
|
|
933
|
+
focusRowIndexChanged() {
|
|
934
|
+
if (this.$fastController.isConnected) this.queueFocusUpdate();
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* @internal
|
|
938
|
+
*/
|
|
939
|
+
focusColumnIndexChanged() {
|
|
940
|
+
if (this.$fastController.isConnected) this.queueFocusUpdate();
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* @internal
|
|
944
|
+
*/
|
|
945
|
+
fixedColumnsChanged() {
|
|
946
|
+
/* v8 ignore if -- @preserve */
|
|
947
|
+
if (this.$fastController.isConnected) {
|
|
948
|
+
this.applyFixedColumns();
|
|
949
|
+
this.setupResizeObserver();
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* @internal
|
|
954
|
+
*/
|
|
955
|
+
setupResizeObserver() {
|
|
956
|
+
if (this.resizeObserver) {
|
|
957
|
+
this.resizeObserver.disconnect();
|
|
958
|
+
this.resizeObserver = void 0;
|
|
959
|
+
}
|
|
960
|
+
if (typeof ResizeObserver !== "undefined" && this.fixedColumns && this.fixedColumns > 0) {
|
|
961
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
962
|
+
this.applyFixedColumns();
|
|
963
|
+
});
|
|
964
|
+
this.resizeObserver.observe(this);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* @internal
|
|
969
|
+
*/
|
|
970
|
+
connectedCallback() {
|
|
971
|
+
super.connectedCallback();
|
|
972
|
+
/* v8 ignore else -- @preserve */
|
|
973
|
+
if (this.rowItemTemplate === void 0) this.rowItemTemplate = this.defaultRowItemTemplate;
|
|
974
|
+
/* v8 ignore else -- @preserve */
|
|
975
|
+
if (this.behaviorOrchestrator === null) {
|
|
976
|
+
this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
|
|
977
|
+
this.$fastController.addBehavior(this.behaviorOrchestrator);
|
|
978
|
+
this.behaviorOrchestrator.addBehaviorFactory(new RepeatDirective(normalizeBinding((x) => x.rowsData), normalizeBinding((x) => x.rowItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
|
|
979
|
+
}
|
|
980
|
+
this.toggleGeneratedHeader();
|
|
981
|
+
this.addEventListener("row-focused", this.handleRowFocus);
|
|
982
|
+
this.addEventListener(eventFocus, this.handleFocus);
|
|
983
|
+
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
984
|
+
this.addEventListener(eventFocusOut, this.handleFocusOut);
|
|
985
|
+
this.observer = new MutationObserver(this.onChildListChange);
|
|
986
|
+
this.observer.observe(this, { childList: true });
|
|
987
|
+
this.setupResizeObserver();
|
|
988
|
+
Updates.enqueue(this.queueRowIndexUpdate);
|
|
989
|
+
this.#setTabIndex();
|
|
990
|
+
Observable.getNotifier(this).subscribe(this.#changeHandler, "columnDefinitions");
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* @internal
|
|
994
|
+
*/
|
|
995
|
+
disconnectedCallback() {
|
|
996
|
+
super.disconnectedCallback();
|
|
997
|
+
this.removeEventListener("row-focused", this.handleRowFocus);
|
|
998
|
+
this.removeEventListener(eventFocus, this.handleFocus);
|
|
999
|
+
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
1000
|
+
this.removeEventListener(eventFocusOut, this.handleFocusOut);
|
|
1001
|
+
this.observer.disconnect();
|
|
1002
|
+
if (this.resizeObserver) {
|
|
1003
|
+
this.resizeObserver.disconnect();
|
|
1004
|
+
this.resizeObserver = void 0;
|
|
1005
|
+
}
|
|
1006
|
+
this.generatedHeader = null;
|
|
1007
|
+
Observable.getNotifier(this).unsubscribe(this.#changeHandler, "columnDefinitions");
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* @internal
|
|
1011
|
+
*/
|
|
1012
|
+
handleRowFocus(e) {
|
|
1013
|
+
this.isUpdatingFocus = true;
|
|
1014
|
+
const focusRow = e.target;
|
|
1015
|
+
this.focusRowIndex = this.rowElements.indexOf(focusRow);
|
|
1016
|
+
this.focusColumnIndex = focusRow.focusColumnIndex;
|
|
1017
|
+
this.setAttribute("tabIndex", "-1");
|
|
1018
|
+
this.isUpdatingFocus = false;
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* @internal
|
|
1022
|
+
*/
|
|
1023
|
+
handleFocus(_) {
|
|
1024
|
+
this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* @internal
|
|
1028
|
+
*/
|
|
1029
|
+
handleFocusOut(e) {
|
|
1030
|
+
if (e.relatedTarget === null || !this.contains(e.relatedTarget)) this.setAttribute("tabIndex", this.noTabbing ? "-1" : "0");
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* @internal
|
|
1034
|
+
*/
|
|
1035
|
+
handleKeydown(e) {
|
|
1036
|
+
if (e.defaultPrevented) return;
|
|
1037
|
+
let newFocusRowIndex;
|
|
1038
|
+
const maxIndex = this.rowElements.length - 1;
|
|
1039
|
+
const currentGridBottom = this.offsetHeight + this.scrollTop;
|
|
1040
|
+
const lastRow = this.rowElements[maxIndex];
|
|
1041
|
+
switch (e.key) {
|
|
1042
|
+
case keyArrowUp:
|
|
1043
|
+
e.preventDefault();
|
|
1044
|
+
this.focusOnCell(this.focusRowIndex - 1, this.focusColumnIndex, true);
|
|
1045
|
+
break;
|
|
1046
|
+
case keyArrowDown:
|
|
1047
|
+
e.preventDefault();
|
|
1048
|
+
this.focusOnCell(this.focusRowIndex + 1, this.focusColumnIndex, true);
|
|
1049
|
+
break;
|
|
1050
|
+
case keyPageUp:
|
|
1051
|
+
e.preventDefault();
|
|
1052
|
+
if (this.rowElements.length === 0) {
|
|
1053
|
+
this.focusOnCell(0, 0, false);
|
|
1054
|
+
break;
|
|
1055
|
+
}
|
|
1056
|
+
if (this.focusRowIndex === 0) {
|
|
1057
|
+
this.focusOnCell(0, this.focusColumnIndex, false);
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
newFocusRowIndex = this.focusRowIndex - 1;
|
|
1061
|
+
for (; newFocusRowIndex >= 0; newFocusRowIndex--) {
|
|
1062
|
+
const thisRow = this.rowElements[newFocusRowIndex];
|
|
1063
|
+
if (thisRow.offsetTop < this.scrollTop) {
|
|
1064
|
+
this.scrollTop = thisRow.offsetTop + thisRow.clientHeight - this.clientHeight;
|
|
1065
|
+
break;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
|
|
1069
|
+
break;
|
|
1070
|
+
case keyPageDown:
|
|
1071
|
+
e.preventDefault();
|
|
1072
|
+
if (this.rowElements.length === 0) {
|
|
1073
|
+
this.focusOnCell(0, 0, false);
|
|
1074
|
+
break;
|
|
1075
|
+
}
|
|
1076
|
+
if (this.focusRowIndex >= maxIndex || lastRow.offsetTop + lastRow.offsetHeight <= currentGridBottom) {
|
|
1077
|
+
this.focusOnCell(maxIndex, this.focusColumnIndex, false);
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
newFocusRowIndex = this.focusRowIndex + 1;
|
|
1081
|
+
for (; newFocusRowIndex <= maxIndex; newFocusRowIndex++) {
|
|
1082
|
+
const thisRow = this.rowElements[newFocusRowIndex];
|
|
1083
|
+
if (thisRow.offsetTop + thisRow.offsetHeight > currentGridBottom) {
|
|
1084
|
+
let stickyHeaderOffset = 0;
|
|
1085
|
+
if (this.generateHeader === GenerateHeaderOptions.sticky && this.generatedHeader !== null) stickyHeaderOffset = this.generatedHeader.clientHeight;
|
|
1086
|
+
this.scrollTop = thisRow.offsetTop - stickyHeaderOffset;
|
|
1087
|
+
break;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
|
|
1091
|
+
break;
|
|
1092
|
+
case keyHome:
|
|
1093
|
+
/* v8 ignore else -- @preserve */
|
|
1094
|
+
if (e.ctrlKey) {
|
|
1095
|
+
e.preventDefault();
|
|
1096
|
+
this.focusOnCell(0, 0, true);
|
|
1097
|
+
}
|
|
1098
|
+
break;
|
|
1099
|
+
case keyEnd:
|
|
1100
|
+
/* v8 ignore else -- @preserve */
|
|
1101
|
+
if (e.ctrlKey && this.columnDefinitions !== null) {
|
|
1102
|
+
e.preventDefault();
|
|
1103
|
+
this.focusOnCell(this.rowElements.length - 1, this.columnDefinitions.length - 1, true);
|
|
1104
|
+
}
|
|
1105
|
+
break;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
queueFocusUpdate() {
|
|
1109
|
+
if (this.isUpdatingFocus && this.contains(document.activeElement)) return;
|
|
1110
|
+
if (this.pendingFocusUpdate === false) {
|
|
1111
|
+
this.pendingFocusUpdate = true;
|
|
1112
|
+
Updates.enqueue(() => this.updateFocus());
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
updateFocus() {
|
|
1116
|
+
this.pendingFocusUpdate = false;
|
|
1117
|
+
this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
|
|
1118
|
+
}
|
|
1119
|
+
toggleGeneratedHeader() {
|
|
1120
|
+
if (this.generatedHeader !== null) {
|
|
1121
|
+
this.removeChild(this.generatedHeader);
|
|
1122
|
+
this.generatedHeader = null;
|
|
1123
|
+
}
|
|
1124
|
+
if (this.generateHeader !== GenerateHeaderOptions.none && this.columnDefinitions !== null) {
|
|
1125
|
+
const generatedHeaderElement = document.createElement(this.rowElementTag);
|
|
1126
|
+
this.generatedHeader = generatedHeaderElement;
|
|
1127
|
+
this.generatedHeader.columnDefinitions = this.columnDefinitions;
|
|
1128
|
+
this.generatedHeader.gridTemplateColumns = this.gridTemplateColumns;
|
|
1129
|
+
this.generatedHeader.rowType = this.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : DataGridRowTypes.header;
|
|
1130
|
+
/* v8 ignore else -- @preserve */
|
|
1131
|
+
if (this.firstChild !== null) this.insertBefore(generatedHeaderElement, this.firstChild);
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
*
|
|
1137
|
+
*
|
|
1138
|
+
* @internal
|
|
1139
|
+
*/
|
|
1140
|
+
slottedRowElementsChanged(_oldValue, _newValue) {
|
|
1141
|
+
this._resetSelection();
|
|
1142
|
+
}
|
|
1143
|
+
get #selectedRows() {
|
|
1144
|
+
return this.rowElements.filter((row) => row.selected);
|
|
1145
|
+
}
|
|
1146
|
+
get #selectedCells() {
|
|
1147
|
+
return this.rowElements.reduce((acc, row) => {
|
|
1148
|
+
const selectedCells = Array.from(row.children).filter((cell) => cell.selected);
|
|
1149
|
+
return acc.concat(selectedCells);
|
|
1150
|
+
}, []);
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* @internal
|
|
1154
|
+
*/
|
|
1155
|
+
selectionModeChanged(oldValue) {
|
|
1156
|
+
if (oldValue === void 0) {
|
|
1157
|
+
Updates.enqueue(this._resetSelection);
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
this._resetSelection(true);
|
|
1161
|
+
}
|
|
1162
|
+
#handleKeypress;
|
|
1163
|
+
#handleClick;
|
|
1164
|
+
#handleCellSelection;
|
|
1165
|
+
#handleRowSelection;
|
|
1166
|
+
constructor() {
|
|
1167
|
+
super();
|
|
1168
|
+
this.noTabbing = false;
|
|
1169
|
+
this.generateHeader = GenerateHeaderOptions.default;
|
|
1170
|
+
this.rowsData = [];
|
|
1171
|
+
this.columnDefinitions = null;
|
|
1172
|
+
this.focusRowIndex = 0;
|
|
1173
|
+
this.focusColumnIndex = 0;
|
|
1174
|
+
this.fixedColumnsPositions = [];
|
|
1175
|
+
this.behaviorOrchestrator = null;
|
|
1176
|
+
this.generatedHeader = null;
|
|
1177
|
+
this.isUpdatingFocus = false;
|
|
1178
|
+
this.pendingFocusUpdate = false;
|
|
1179
|
+
this.rowindexUpdateQueued = false;
|
|
1180
|
+
this.columnDefinitionsStale = true;
|
|
1181
|
+
this.generatedGridTemplateColumns = "";
|
|
1182
|
+
this.focusOnCell = (rowIndex, columnIndex, scrollIntoView) => {
|
|
1183
|
+
if (this.rowElements.length === 0) {
|
|
1184
|
+
this.focusRowIndex = 0;
|
|
1185
|
+
this.focusColumnIndex = 0;
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
const focusRowIndex = Math.max(0, Math.min(this.rowElements.length - 1, rowIndex));
|
|
1189
|
+
const cells = this.rowElements[focusRowIndex].querySelectorAll("[role=\"cell\"], [role=\"gridcell\"], [role=\"columnheader\"], [role=\"rowheader\"], [data-vvd-component=\"data-grid-cell\"]");
|
|
1190
|
+
const focusTarget = cells[Math.max(0, Math.min(cells.length - 1, columnIndex))];
|
|
1191
|
+
if (scrollIntoView && this.scrollHeight !== this.clientHeight && (focusRowIndex < this.focusRowIndex && this.scrollTop > 0 || focusRowIndex > this.focusRowIndex && this.scrollTop < this.scrollHeight - this.clientHeight)) focusTarget.scrollIntoView({
|
|
1192
|
+
block: "center",
|
|
1193
|
+
inline: "center"
|
|
1194
|
+
});
|
|
1195
|
+
focusTarget.focus();
|
|
1196
|
+
};
|
|
1197
|
+
this.onChildListChange = (mutations, _) => {
|
|
1198
|
+
/* v8 ignore else -- @preserve */
|
|
1199
|
+
if (mutations && mutations.length) {
|
|
1200
|
+
mutations.forEach((mutation) => {
|
|
1201
|
+
mutation.addedNodes.forEach((newNode) => {
|
|
1202
|
+
if (newNode.nodeType === 1 && (newNode.getAttribute("role") === "row" || newNode.getAttribute("row-type") === "default")) newNode.columnDefinitions = this.columnDefinitions;
|
|
1203
|
+
});
|
|
1204
|
+
});
|
|
1205
|
+
this.queueRowIndexUpdate();
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
this.queueRowIndexUpdate = () => {
|
|
1209
|
+
if (!this.rowindexUpdateQueued) {
|
|
1210
|
+
this.rowindexUpdateQueued = true;
|
|
1211
|
+
Updates.enqueue(this.updateRowIndexes);
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
this.updateRowIndexes = () => {
|
|
1215
|
+
let newGridTemplateColumns = this.gridTemplateColumns;
|
|
1216
|
+
if (newGridTemplateColumns === void 0) {
|
|
1217
|
+
if (this.generatedGridTemplateColumns === "" && this.rowElements.length > 0) {
|
|
1218
|
+
const firstRow = this.rowElements[0];
|
|
1219
|
+
this.generatedGridTemplateColumns = new Array(firstRow.cellElements.length).fill("1fr").join(" ");
|
|
1220
|
+
}
|
|
1221
|
+
newGridTemplateColumns = this.generatedGridTemplateColumns;
|
|
1222
|
+
}
|
|
1223
|
+
this.rowElements.forEach((element, index) => {
|
|
1224
|
+
const thisRow = element;
|
|
1225
|
+
thisRow.rowIndex = index;
|
|
1226
|
+
thisRow.gridTemplateColumns = newGridTemplateColumns;
|
|
1227
|
+
if (this.columnDefinitionsStale) thisRow.columnDefinitions = this.columnDefinitions;
|
|
1228
|
+
});
|
|
1229
|
+
this.rowindexUpdateQueued = false;
|
|
1230
|
+
this.columnDefinitionsStale = false;
|
|
1231
|
+
};
|
|
1232
|
+
this.#handleKeypress = (e) => {
|
|
1233
|
+
if (e.key === "Enter" || e.key === " ") this.#handleClick(e);
|
|
1234
|
+
};
|
|
1235
|
+
this.#handleClick = ({ target, ctrlKey, shiftKey, metaKey }) => {
|
|
1236
|
+
if (target.getAttribute("role") !== "gridcell" || target.getAttribute("cell-type") !== "default") return;
|
|
1237
|
+
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
1238
|
+
this.#handleCellSelection({
|
|
1239
|
+
target,
|
|
1240
|
+
ctrlKey,
|
|
1241
|
+
shiftKey,
|
|
1242
|
+
metaKey
|
|
1243
|
+
});
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) this.#handleRowSelection({
|
|
1247
|
+
target,
|
|
1248
|
+
ctrlKey,
|
|
1249
|
+
shiftKey,
|
|
1250
|
+
metaKey
|
|
1251
|
+
});
|
|
1252
|
+
};
|
|
1253
|
+
this.#handleCellSelection = ({ target, ctrlKey, shiftKey, metaKey }) => {
|
|
1254
|
+
const cell = target;
|
|
1255
|
+
if (this.selectionMode === DataGridSelectionMode.multiCell && (ctrlKey || shiftKey || metaKey)) cell.selected = !this.#selectedCells.includes(cell);
|
|
1256
|
+
else {
|
|
1257
|
+
const cacheTargetSelection = cell.selected;
|
|
1258
|
+
this._resetSelection(true);
|
|
1259
|
+
cell.selected = !cacheTargetSelection;
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
this.#handleRowSelection = ({ target, ctrlKey, shiftKey, metaKey }) => {
|
|
1263
|
+
const row = target.parentNode;
|
|
1264
|
+
if (this.selectionMode === DataGridSelectionMode.multiRow && (ctrlKey || shiftKey || metaKey)) row.selected = !this.#selectedRows.includes(row);
|
|
1265
|
+
else {
|
|
1266
|
+
const cacheTargetSelection = row.selected;
|
|
1267
|
+
this._resetSelection(true);
|
|
1268
|
+
row.selected = !cacheTargetSelection;
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
this.#changeHandler = { handleChange(dataGrid, propertyName) {
|
|
1272
|
+
/* v8 ignore else -- @preserve */
|
|
1273
|
+
if (propertyName === "columnDefinitions") {
|
|
1274
|
+
/* v8 ignore else -- @preserve */
|
|
1275
|
+
if (dataGrid.$fastController.isConnected) dataGrid.toggleGeneratedHeader();
|
|
1276
|
+
}
|
|
1277
|
+
} };
|
|
1278
|
+
this._resetSelection = (clear = false) => {
|
|
1279
|
+
const cells = Array.from(this.querySelectorAll("[role=\"gridcell\"], [cell-type=\"default\"]"));
|
|
1280
|
+
const rows = Array.from(this.querySelectorAll("[role=\"row\"], [row-type=\"default\"]"));
|
|
1281
|
+
if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
|
|
1282
|
+
for (const cell of cells) {
|
|
1283
|
+
cell._selectable = true;
|
|
1284
|
+
cell.selected = clear ? false : cell.selected || false;
|
|
1285
|
+
}
|
|
1286
|
+
for (const row of rows) {
|
|
1287
|
+
row._selectable = false;
|
|
1288
|
+
row.selected = false;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
if (this.selectionMode === DataGridSelectionMode.none) for (const element of [...cells, ...rows]) {
|
|
1292
|
+
element._selectable = false;
|
|
1293
|
+
element.selected = false;
|
|
1294
|
+
}
|
|
1295
|
+
if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
|
|
1296
|
+
for (const cell of cells) {
|
|
1297
|
+
cell._selectable = false;
|
|
1298
|
+
cell.selected = false;
|
|
1299
|
+
}
|
|
1300
|
+
for (const row of rows) {
|
|
1301
|
+
row._selectable = true;
|
|
1302
|
+
row.selected = clear ? false : row.selected || false;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
this.addEventListener("click", this.#handleClick);
|
|
1307
|
+
this.addEventListener("keydown", this.#handleKeypress);
|
|
1308
|
+
}
|
|
1309
|
+
#changeHandler;
|
|
1310
|
+
static generateColumns(rowData) {
|
|
1311
|
+
return Object.keys(rowData).map((property, index) => {
|
|
1312
|
+
return {
|
|
1313
|
+
columnDataKey: property,
|
|
1314
|
+
gridColumn: `${index}`
|
|
1315
|
+
};
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* @internal
|
|
1320
|
+
*/
|
|
1321
|
+
applyFixedColumns() {
|
|
1322
|
+
if (!this.fixedColumns || this.fixedColumns <= 0) {
|
|
1323
|
+
this.clearFixedColumns();
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
this.calculateFixedColumnPositions();
|
|
1327
|
+
this.applyFixedColumnStyling();
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Applies fixed columns styling using cached positions
|
|
1331
|
+
* @internal
|
|
1332
|
+
*/
|
|
1333
|
+
applyFixedColumnStyling() {
|
|
1334
|
+
this.rowElements.forEach((row) => {
|
|
1335
|
+
const cells = row.querySelectorAll("[role=\"cell\"], [role=\"gridcell\"], [role=\"columnheader\"], [cell-type=\"default\"], [cell-type=\"columnheader\"]");
|
|
1336
|
+
this.fixedColumnsPositions.forEach((position, index) => {
|
|
1337
|
+
/* v8 ignore else -- @preserve */
|
|
1338
|
+
if (index < cells.length) {
|
|
1339
|
+
const gridCell = cells[index];
|
|
1340
|
+
/* v8 ignore else -- @preserve */
|
|
1341
|
+
if (typeof gridCell.setFixedPosition === "function") gridCell.setFixedPosition(`${position}px`);
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Calculates and caches fixed columns positions based on current layout
|
|
1348
|
+
* @internal
|
|
1349
|
+
*/
|
|
1350
|
+
calculateFixedColumnPositions() {
|
|
1351
|
+
this.fixedColumnsPositions = [];
|
|
1352
|
+
if (this.rowElements.length === 0) return;
|
|
1353
|
+
const cells = this.rowElements[0].querySelectorAll("[role=\"cell\"], [role=\"gridcell\"], [role=\"columnheader\"], [cell-type=\"default\"], [cell-type=\"columnheader\"]");
|
|
1354
|
+
let accumulator = 0;
|
|
1355
|
+
for (let i = 0; i < Math.min(this.fixedColumns, cells.length); i++) {
|
|
1356
|
+
this.fixedColumnsPositions.push(accumulator);
|
|
1357
|
+
accumulator += cells[i].offsetWidth;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Clears all fixed columns state and styling
|
|
1362
|
+
* @internal
|
|
1363
|
+
*/
|
|
1364
|
+
clearFixedColumns() {
|
|
1365
|
+
if (this.rowElements.length === 0) {
|
|
1366
|
+
this.fixedColumnsPositions = [];
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
this.rowElements.forEach((row) => {
|
|
1370
|
+
const cells = row.querySelectorAll("[role=\"cell\"], [role=\"gridcell\"], [role=\"columnheader\"], [cell-type=\"default\"], [cell-type=\"columnheader\"]");
|
|
1371
|
+
this.fixedColumnsPositions.forEach((_, index) => {
|
|
1372
|
+
/* v8 ignore else -- @preserve */
|
|
1373
|
+
if (index < cells.length) {
|
|
1374
|
+
const gridCell = cells[index];
|
|
1375
|
+
/* v8 ignore else -- @preserve */
|
|
1376
|
+
if (typeof gridCell.setFixedPosition === "function") gridCell.setFixedPosition(void 0);
|
|
1377
|
+
}
|
|
1378
|
+
});
|
|
1379
|
+
});
|
|
1380
|
+
this.fixedColumnsPositions = [];
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
__decorate([attr({
|
|
1384
|
+
attribute: "no-tabbing",
|
|
1385
|
+
mode: "boolean"
|
|
1386
|
+
})], DataGrid.prototype, "noTabbing", void 0);
|
|
1387
|
+
__decorate([attr({ attribute: "generate-header" })], DataGrid.prototype, "generateHeader", void 0);
|
|
1388
|
+
__decorate([attr({ attribute: "grid-template-columns" })], DataGrid.prototype, "gridTemplateColumns", void 0);
|
|
1389
|
+
__decorate([observable], DataGrid.prototype, "rowsData", void 0);
|
|
1390
|
+
__decorate([observable], DataGrid.prototype, "columnDefinitions", void 0);
|
|
1391
|
+
__decorate([observable], DataGrid.prototype, "rowItemTemplate", void 0);
|
|
1392
|
+
__decorate([observable], DataGrid.prototype, "cellItemTemplate", void 0);
|
|
1393
|
+
__decorate([observable], DataGrid.prototype, "headerCellItemTemplate", void 0);
|
|
1394
|
+
__decorate([observable], DataGrid.prototype, "focusRowIndex", void 0);
|
|
1395
|
+
__decorate([observable], DataGrid.prototype, "focusColumnIndex", void 0);
|
|
1396
|
+
__decorate([attr({
|
|
1397
|
+
attribute: "fixed-columns",
|
|
1398
|
+
converter: nullableNumberConverter
|
|
1399
|
+
})], DataGrid.prototype, "fixedColumns", void 0);
|
|
1400
|
+
__decorate([observable], DataGrid.prototype, "defaultRowItemTemplate", void 0);
|
|
1401
|
+
__decorate([observable], DataGrid.prototype, "rowElementTag", void 0);
|
|
1402
|
+
__decorate([observable], DataGrid.prototype, "rowElements", void 0);
|
|
1403
|
+
__decorate([observable], DataGrid.prototype, "slottedRowElements", void 0);
|
|
1404
|
+
__decorate([attr({ attribute: "selection-mode" })], DataGrid.prototype, "selectionMode", void 0);
|
|
1405
|
+
//#endregion
|
|
1406
|
+
//#region src/lib/data-grid/data-grid-row.ts
|
|
1407
|
+
/**
|
|
1408
|
+
* @public
|
|
1409
|
+
* @component data-grid-row
|
|
1410
|
+
* @slot - Default slot.
|
|
1411
|
+
* @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
|
|
1412
|
+
* @event {CustomEvent<HTMLElement>} row-focused - Fires a custom 'row-focused' event when focus is on an element (usually a cell or its contents) in the row
|
|
1413
|
+
*/
|
|
1414
|
+
var DataGridRow = class extends HostSemantics(VividElement) {
|
|
1415
|
+
constructor(..._args) {
|
|
1416
|
+
super(..._args);
|
|
1417
|
+
this.rowType = DataGridRowTypes.default;
|
|
1418
|
+
this.rowData = null;
|
|
1419
|
+
this.columnDefinitions = null;
|
|
1420
|
+
this.behaviorOrchestrator = null;
|
|
1421
|
+
this.focusColumnIndex = 0;
|
|
1422
|
+
this.updateRowStyle = () => {
|
|
1423
|
+
this.style.gridTemplateColumns = this.gridTemplateColumns;
|
|
1424
|
+
};
|
|
1425
|
+
this.ariaSelected = null;
|
|
1426
|
+
this._selectable = false;
|
|
1427
|
+
this.selected = false;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* @internal
|
|
1431
|
+
*/
|
|
1432
|
+
gridTemplateColumnsChanged() {
|
|
1433
|
+
if (this.$fastController.isConnected) this.updateRowStyle();
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* @internal
|
|
1437
|
+
*/
|
|
1438
|
+
rowTypeChanged() {
|
|
1439
|
+
if (this.$fastController.isConnected) this.updateItemTemplate();
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* @internal
|
|
1443
|
+
*/
|
|
1444
|
+
cellItemTemplateChanged() {
|
|
1445
|
+
this.updateItemTemplate();
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* @internal
|
|
1449
|
+
*/
|
|
1450
|
+
headerCellItemTemplateChanged() {
|
|
1451
|
+
this.updateItemTemplate();
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* @internal
|
|
1455
|
+
*/
|
|
1456
|
+
connectedCallback() {
|
|
1457
|
+
super.connectedCallback();
|
|
1458
|
+
/* v8 ignore else -- @preserve */
|
|
1459
|
+
if (this.behaviorOrchestrator === null) {
|
|
1460
|
+
this.updateItemTemplate();
|
|
1461
|
+
this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
|
|
1462
|
+
this.$fastController.addBehavior(this.behaviorOrchestrator);
|
|
1463
|
+
this.behaviorOrchestrator.addBehaviorFactory(new RepeatDirective(normalizeBinding((x) => x.columnDefinitions), normalizeBinding((x) => x.activeCellItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
|
|
1464
|
+
}
|
|
1465
|
+
this.addEventListener("cell-focused", this.handleCellFocus);
|
|
1466
|
+
this.addEventListener(eventFocusOut, this.handleFocusout);
|
|
1467
|
+
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
1468
|
+
this.updateRowStyle();
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* @internal
|
|
1472
|
+
*/
|
|
1473
|
+
disconnectedCallback() {
|
|
1474
|
+
super.disconnectedCallback();
|
|
1475
|
+
this.removeEventListener("cell-focused", this.handleCellFocus);
|
|
1476
|
+
this.removeEventListener(eventFocusOut, this.handleFocusout);
|
|
1477
|
+
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* @internal
|
|
1481
|
+
*/
|
|
1482
|
+
handleFocusout(_) {
|
|
1483
|
+
/* v8 ignore else -- @preserve */
|
|
1484
|
+
if (!this.contains(document.activeElement)) this.focusColumnIndex = 0;
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* @internal
|
|
1488
|
+
*/
|
|
1489
|
+
handleCellFocus(e) {
|
|
1490
|
+
this.focusColumnIndex = this.cellElements.indexOf(e.target);
|
|
1491
|
+
this.$emit("row-focused", this);
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* @internal
|
|
1495
|
+
*/
|
|
1496
|
+
handleKeydown(e) {
|
|
1497
|
+
if (e.defaultPrevented) return;
|
|
1498
|
+
let newFocusColumnIndex = 0;
|
|
1499
|
+
switch (e.key) {
|
|
1500
|
+
case keyArrowLeft$1:
|
|
1501
|
+
newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
|
|
1502
|
+
this.cellElements[newFocusColumnIndex].focus();
|
|
1503
|
+
e.preventDefault();
|
|
1504
|
+
break;
|
|
1505
|
+
case keyArrowRight$1:
|
|
1506
|
+
newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
|
|
1507
|
+
this.cellElements[newFocusColumnIndex].focus();
|
|
1508
|
+
e.preventDefault();
|
|
1509
|
+
break;
|
|
1510
|
+
case keyHome:
|
|
1511
|
+
if (!e.ctrlKey) {
|
|
1512
|
+
this.cellElements[0].focus();
|
|
1513
|
+
e.preventDefault();
|
|
1514
|
+
}
|
|
1515
|
+
break;
|
|
1516
|
+
case keyEnd:
|
|
1517
|
+
if (!e.ctrlKey) {
|
|
1518
|
+
this.cellElements[this.cellElements.length - 1].focus();
|
|
1519
|
+
e.preventDefault();
|
|
1520
|
+
}
|
|
1521
|
+
break;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
updateItemTemplate() {
|
|
1525
|
+
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;
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* @internal
|
|
1529
|
+
*/
|
|
1530
|
+
ariaSelectedChanged(oldValue, newValue) {
|
|
1531
|
+
super.ariaSelectedChanged(oldValue, newValue);
|
|
1532
|
+
this._selectable = newValue !== null;
|
|
1533
|
+
this.selected = newValue === "true";
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
__decorate([attr({ attribute: "grid-template-columns" })], DataGridRow.prototype, "gridTemplateColumns", void 0);
|
|
1537
|
+
__decorate([attr({ attribute: "row-type" })], DataGridRow.prototype, "rowType", void 0);
|
|
1538
|
+
__decorate([observable], DataGridRow.prototype, "rowData", void 0);
|
|
1539
|
+
__decorate([observable], DataGridRow.prototype, "columnDefinitions", void 0);
|
|
1540
|
+
__decorate([observable], DataGridRow.prototype, "cellItemTemplate", void 0);
|
|
1541
|
+
__decorate([observable], DataGridRow.prototype, "headerCellItemTemplate", void 0);
|
|
1542
|
+
__decorate([observable], DataGridRow.prototype, "rowIndex", void 0);
|
|
1543
|
+
__decorate([observable], DataGridRow.prototype, "activeCellItemTemplate", void 0);
|
|
1544
|
+
__decorate([observable], DataGridRow.prototype, "defaultCellItemTemplate", void 0);
|
|
1545
|
+
__decorate([observable], DataGridRow.prototype, "defaultHeaderCellItemTemplate", void 0);
|
|
1546
|
+
__decorate([observable], DataGridRow.prototype, "cellElements", void 0);
|
|
1547
|
+
__decorate([observable], DataGridRow.prototype, "_selectable", void 0);
|
|
1548
|
+
__decorate([attr({ mode: "boolean" })], DataGridRow.prototype, "selected", void 0);
|
|
1549
|
+
//#endregion
|
|
1550
|
+
//#region src/lib/data-grid/data-grid.template.ts
|
|
1551
|
+
function createRowItemTemplate(context) {
|
|
1552
|
+
const rowTag = context.tagFor(DataGridRow);
|
|
1553
|
+
return html`
|
|
1554
|
+
<${rowTag}
|
|
1555
|
+
:rowData="${(x) => x}"
|
|
1556
|
+
:cellItemTemplate="${(_, c) => c.parent.cellItemTemplate}"
|
|
1557
|
+
:headerCellItemTemplate="${(_, c) => c.parent.headerCellItemTemplate}"
|
|
1558
|
+
></${rowTag}>
|
|
1559
|
+
`;
|
|
1560
|
+
}
|
|
1561
|
+
function getMultiSelectAriaState(x) {
|
|
1562
|
+
return x.selectionMode === void 0 || x.selectionMode === DataGridSelectionMode.none ? null : x.selectionMode.includes("multi") ? "true" : "false";
|
|
1563
|
+
}
|
|
1564
|
+
function setHeaderRow(x) {
|
|
1565
|
+
if (x.columnDefinitions === null) {
|
|
1566
|
+
const headerRow = x.querySelector("[cell-type=\"columnheader\"]")?.parentElement;
|
|
1567
|
+
if (x.generateHeader === GenerateHeaderOptions.default && (headerRow?.getAttribute("row-type") === DataGridRowTypes.header || headerRow?.getAttribute("row-type") === DataGridRowTypes.stickyHeader)) return;
|
|
1568
|
+
if (headerRow) {
|
|
1569
|
+
const rowType = x.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : DataGridRowTypes.header;
|
|
1570
|
+
headerRow.setAttribute("row-type", rowType);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
function handleColumnSort(_, { event }) {
|
|
1575
|
+
event.stopPropagation();
|
|
1576
|
+
}
|
|
1577
|
+
var DataGridTemplate = (context) => {
|
|
1578
|
+
const rowItemTemplate = createRowItemTemplate(context);
|
|
1579
|
+
const rowTag = context.tagFor(DataGridRow, true);
|
|
1580
|
+
return html`
|
|
1581
|
+
<template
|
|
1582
|
+
aria-multiselectable="${getMultiSelectAriaState}"
|
|
1583
|
+
role="grid"
|
|
1584
|
+
tabindex="0"
|
|
1585
|
+
@sort="${handleColumnSort}"
|
|
1586
|
+
:rowElementTag="${() => rowTag}"
|
|
1587
|
+
:defaultRowItemTemplate="${rowItemTemplate}"
|
|
1588
|
+
${children({
|
|
1589
|
+
property: "rowElements",
|
|
1590
|
+
filter: elements("[role=row],[data-vvd-component=data-grid-row]")
|
|
1591
|
+
})}
|
|
1592
|
+
>
|
|
1593
|
+
<div class="base">
|
|
1594
|
+
${setHeaderRow}
|
|
1595
|
+
<slot ${slotted("slottedRowElements")}></slot>
|
|
1596
|
+
</div>
|
|
1597
|
+
</template>
|
|
1598
|
+
`;
|
|
1599
|
+
};
|
|
1600
|
+
//#endregion
|
|
1601
|
+
//#region src/lib/data-grid/data-grid-cell.ts
|
|
1602
|
+
var defaultCellContentsTemplate = html`
|
|
1603
|
+
<template>
|
|
1604
|
+
${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
|
|
1605
|
+
</template>
|
|
1606
|
+
`;
|
|
1607
|
+
var defaultHeaderCellContentsTemplate = html`
|
|
1608
|
+
<template>
|
|
1609
|
+
${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
|
|
1610
|
+
</template>
|
|
1611
|
+
`;
|
|
1612
|
+
/**
|
|
1613
|
+
* @public
|
|
1614
|
+
* @component data-grid-cell
|
|
1615
|
+
* @slot - Default slot.
|
|
1616
|
+
* @slot action-items - Add action items to the cell using this slot.
|
|
1617
|
+
* @event {CustomEvent<{columnDataKey: string, ariaSort: string | null, sortDirection: string | null}>} sort - Event that fires when a sortable column header is clicked
|
|
1618
|
+
* @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
|
|
1619
|
+
* @event {CustomEvent<HTMLElement>} cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
|
|
1620
|
+
*/
|
|
1621
|
+
var DataGridCell = class extends Localized(HostSemantics(VividElement)) {
|
|
1622
|
+
constructor(..._args) {
|
|
1623
|
+
super(..._args);
|
|
1624
|
+
this.cellType = DataGridCellTypes.default;
|
|
1625
|
+
this.rowData = null;
|
|
1626
|
+
this.columnDefinition = null;
|
|
1627
|
+
this.isActiveCell = false;
|
|
1628
|
+
this.customCellView = null;
|
|
1629
|
+
this.updateCellStyle = () => {
|
|
1630
|
+
if (this.gridColumn && !this.gridColumn.includes("undefined")) this.style.gridColumn = this.gridColumn;
|
|
1631
|
+
else this.style.removeProperty("grid-column");
|
|
1632
|
+
};
|
|
1633
|
+
this._selectable = false;
|
|
1634
|
+
this.selected = false;
|
|
1635
|
+
this.ariaSelected = null;
|
|
1636
|
+
this.ariaSort = null;
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* @internal
|
|
1640
|
+
*/
|
|
1641
|
+
cellTypeChanged() {
|
|
1642
|
+
if (this.$fastController.isConnected) this.updateCellView();
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1645
|
+
* @internal
|
|
1646
|
+
*/
|
|
1647
|
+
gridColumnChanged() {
|
|
1648
|
+
if (this.$fastController.isConnected) this.updateCellStyle();
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* @internal
|
|
1652
|
+
*/
|
|
1653
|
+
columnDefinitionChanged(_oldValue, _newValue) {
|
|
1654
|
+
if (this.$fastController.isConnected) this.updateCellView();
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* Updates the fixed column style
|
|
1658
|
+
* @internal
|
|
1659
|
+
*/
|
|
1660
|
+
updateFixedStyle() {
|
|
1661
|
+
if (this.fixedPosition !== void 0) {
|
|
1662
|
+
this.setAttribute("data-fixed", "");
|
|
1663
|
+
this.style.left = this.fixedPosition;
|
|
1664
|
+
} else {
|
|
1665
|
+
this.removeAttribute("data-fixed");
|
|
1666
|
+
this.style.removeProperty("left");
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Sets the fixed state and position for this cell
|
|
1671
|
+
* @internal
|
|
1672
|
+
*/
|
|
1673
|
+
setFixedPosition(position) {
|
|
1674
|
+
this.fixedPosition = position;
|
|
1675
|
+
this.updateFixedStyle();
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* @internal
|
|
1679
|
+
*/
|
|
1680
|
+
connectedCallback() {
|
|
1681
|
+
super.connectedCallback();
|
|
1682
|
+
this.addEventListener(eventFocusIn, this.handleFocusin);
|
|
1683
|
+
this.addEventListener(eventFocusOut, this.handleFocusout);
|
|
1684
|
+
this.addEventListener(eventKeyDown, this.handleKeydown);
|
|
1685
|
+
this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
|
|
1686
|
+
this.updateCellView();
|
|
1687
|
+
this.updateCellStyle();
|
|
1688
|
+
this.updateFixedStyle();
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* @internal
|
|
1692
|
+
*/
|
|
1693
|
+
disconnectedCallback() {
|
|
1694
|
+
super.disconnectedCallback();
|
|
1695
|
+
this.removeEventListener(eventFocusIn, this.handleFocusin);
|
|
1696
|
+
this.removeEventListener(eventFocusOut, this.handleFocusout);
|
|
1697
|
+
this.removeEventListener(eventKeyDown, this.handleKeydown);
|
|
1698
|
+
this.disconnectCellView();
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* @internal
|
|
1702
|
+
*/
|
|
1703
|
+
handleFocusin(_) {
|
|
1704
|
+
this.shadowRoot.querySelector(".base").classList.add("active");
|
|
1705
|
+
if (this.isActiveCell) return;
|
|
1706
|
+
this.isActiveCell = true;
|
|
1707
|
+
switch (this.cellType) {
|
|
1708
|
+
case DataGridCellTypes.columnHeader:
|
|
1709
|
+
if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
|
|
1710
|
+
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
1711
|
+
/* v8 ignore else -- @preserve */
|
|
1712
|
+
if (focusTarget !== null) focusTarget.focus();
|
|
1713
|
+
}
|
|
1714
|
+
break;
|
|
1715
|
+
default:
|
|
1716
|
+
if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
|
|
1717
|
+
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
1718
|
+
/* v8 ignore else -- @preserve */
|
|
1719
|
+
if (focusTarget !== null) focusTarget.focus();
|
|
1720
|
+
}
|
|
1721
|
+
break;
|
|
1722
|
+
}
|
|
1723
|
+
this.$emit("cell-focused", this);
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* @internal
|
|
1727
|
+
*/
|
|
1728
|
+
handleFocusout(_) {
|
|
1729
|
+
this.shadowRoot.querySelector(".base").classList.remove("active");
|
|
1730
|
+
/* v8 ignore else -- @preserve */
|
|
1731
|
+
if (this !== document.activeElement && !this.contains(document.activeElement)) this.isActiveCell = false;
|
|
1732
|
+
}
|
|
1733
|
+
/**
|
|
1734
|
+
* @internal
|
|
1735
|
+
*/
|
|
1736
|
+
handleKeydown(e) {
|
|
1737
|
+
if (e.defaultPrevented || this.columnDefinition === null || this.cellType === DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) return;
|
|
1738
|
+
switch (e.key) {
|
|
1739
|
+
case keyEnter:
|
|
1740
|
+
case keyFunction2:
|
|
1741
|
+
if (this.contains(document.activeElement) && document.activeElement !== this) return;
|
|
1742
|
+
switch (this.cellType) {
|
|
1743
|
+
case DataGridCellTypes.columnHeader:
|
|
1744
|
+
if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
|
|
1745
|
+
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
1746
|
+
/* v8 ignore else -- @preserve */
|
|
1747
|
+
if (focusTarget !== null) focusTarget.focus();
|
|
1748
|
+
e.preventDefault();
|
|
1749
|
+
}
|
|
1750
|
+
break;
|
|
1751
|
+
default:
|
|
1752
|
+
if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
|
|
1753
|
+
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
1754
|
+
/* v8 ignore else -- @preserve */
|
|
1755
|
+
if (focusTarget !== null) focusTarget.focus();
|
|
1756
|
+
e.preventDefault();
|
|
1757
|
+
}
|
|
1758
|
+
break;
|
|
1759
|
+
}
|
|
1760
|
+
break;
|
|
1761
|
+
case keyEscape:
|
|
1762
|
+
/* v8 ignore else -- @preserve */
|
|
1763
|
+
if (this.contains(document.activeElement) && document.activeElement !== this) {
|
|
1764
|
+
this.focus();
|
|
1765
|
+
e.preventDefault();
|
|
1766
|
+
}
|
|
1767
|
+
break;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
updateCellView() {
|
|
1771
|
+
this.disconnectCellView();
|
|
1772
|
+
if (this.columnDefinition === null) return;
|
|
1773
|
+
switch (this.cellType) {
|
|
1774
|
+
case DataGridCellTypes.columnHeader:
|
|
1775
|
+
if (this.columnDefinition.headerCellTemplate !== void 0) this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
|
|
1776
|
+
else this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
|
|
1777
|
+
break;
|
|
1778
|
+
case DataGridCellTypes.rowHeader:
|
|
1779
|
+
case DataGridCellTypes.default:
|
|
1780
|
+
if (this.columnDefinition.cellTemplate !== void 0) this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
|
|
1781
|
+
else this.customCellView = defaultCellContentsTemplate.render(this, this);
|
|
1782
|
+
break;
|
|
1783
|
+
}
|
|
1784
|
+
if (!this.columnDefinition?.sortable) this.sortDirection = void 0;
|
|
1785
|
+
else if (this.columnDefinition.sortDirection) this.sortDirection = this.columnDefinition.sortDirection;
|
|
1786
|
+
else this.sortDirection = DataGridCellSortStates.none;
|
|
1787
|
+
}
|
|
1788
|
+
disconnectCellView() {
|
|
1789
|
+
if (this.customCellView !== null) {
|
|
1790
|
+
this.customCellView.dispose();
|
|
1791
|
+
this.customCellView = null;
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
/**
|
|
1795
|
+
* @internal
|
|
1796
|
+
*/
|
|
1797
|
+
ariaSelectedChanged(prevValue, newValue) {
|
|
1798
|
+
super.ariaSelectedChanged(prevValue, newValue);
|
|
1799
|
+
this._selectable = newValue !== null;
|
|
1800
|
+
this.selected = newValue === "true";
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* @internal
|
|
1804
|
+
*/
|
|
1805
|
+
ariaSortChanged(oldValue, newValue) {
|
|
1806
|
+
super.ariaSortChanged(oldValue, newValue);
|
|
1807
|
+
if (newValue === null) {
|
|
1808
|
+
this.sortDirection = void 0;
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
this.sortDirection = newValue;
|
|
1812
|
+
}
|
|
1813
|
+
#getColumnDataKey() {
|
|
1814
|
+
return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
|
|
1815
|
+
}
|
|
1816
|
+
/**
|
|
1817
|
+
* @internal
|
|
1818
|
+
*/
|
|
1819
|
+
_handleInteraction() {
|
|
1820
|
+
const isHeaderCell = this.cellType === "columnheader";
|
|
1821
|
+
if (isHeaderCell && this.sortDirection !== void 0) this.$emit("sort", {
|
|
1822
|
+
columnDataKey: this.#getColumnDataKey(),
|
|
1823
|
+
sortDirection: this.sortDirection
|
|
1824
|
+
});
|
|
1825
|
+
if (!(isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue)) this.$emit("cell-click", {
|
|
1826
|
+
cell: this,
|
|
1827
|
+
row: this.parentElement,
|
|
1828
|
+
isHeaderCell,
|
|
1829
|
+
columnDataKey: this.#getColumnDataKey()
|
|
1830
|
+
});
|
|
1831
|
+
return true;
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
__decorate([attr({ attribute: "cell-type" })], DataGridCell.prototype, "cellType", void 0);
|
|
1835
|
+
__decorate([attr({ attribute: "grid-column" })], DataGridCell.prototype, "gridColumn", void 0);
|
|
1836
|
+
__decorate([observable], DataGridCell.prototype, "rowData", void 0);
|
|
1837
|
+
__decorate([observable], DataGridCell.prototype, "columnDefinition", void 0);
|
|
1838
|
+
__decorate([observable], DataGridCell.prototype, "_selectable", void 0);
|
|
1839
|
+
__decorate([attr({ mode: "boolean" })], DataGridCell.prototype, "selected", void 0);
|
|
1840
|
+
__decorate([attr({ attribute: "sort-direction" })], DataGridCell.prototype, "sortDirection", void 0);
|
|
1841
|
+
__decorate([observable], DataGridCell.prototype, "_actionItemsSlottedContent", void 0);
|
|
1842
|
+
//#endregion
|
|
1843
|
+
//#region src/lib/data-grid/data-grid-row.template.ts
|
|
1844
|
+
function calculateAriaSelectedValue$1(x) {
|
|
1845
|
+
if (x._selectable && x.selected) return "true";
|
|
1846
|
+
if (x._selectable && !x.selected) return "false";
|
|
1847
|
+
return null;
|
|
1848
|
+
}
|
|
1849
|
+
function createCellItemTemplate(context) {
|
|
1850
|
+
const cellTag = context.tagFor(DataGridCell);
|
|
1851
|
+
return html`
|
|
1852
|
+
<${cellTag}
|
|
1853
|
+
cell-type="${(x) => x.isRowHeader ? "rowheader" : void 0}"
|
|
1854
|
+
grid-column="${(_, c) => c.index + 1}"
|
|
1855
|
+
:rowData="${(_, c) => c.parent.rowData}"
|
|
1856
|
+
:columnDefinition="${(x) => x}"
|
|
1857
|
+
selected="${(_, c) => c.parent.ariaSelected === "true" ? true : null}"
|
|
1858
|
+
></${cellTag}>
|
|
1859
|
+
`;
|
|
1860
|
+
}
|
|
1861
|
+
function createHeaderCellItemTemplate(context) {
|
|
1862
|
+
const cellTag = context.tagFor(DataGridCell);
|
|
1863
|
+
return html`
|
|
1864
|
+
<${cellTag}
|
|
1865
|
+
cell-type="columnheader"
|
|
1866
|
+
grid-column="${(_, c) => c.index + 1}"
|
|
1867
|
+
:columnDefinition="${(x) => x}"
|
|
1868
|
+
></${cellTag}>
|
|
1869
|
+
`;
|
|
1870
|
+
}
|
|
1871
|
+
var DataGridRowTemplate = (context) => {
|
|
1872
|
+
const cellItemTemplate = createCellItemTemplate(context);
|
|
1873
|
+
const headerCellItemTemplate = createHeaderCellItemTemplate(context);
|
|
1874
|
+
const getBaseClasses = (x) => classNames("base", ["selected", !!x.selected]);
|
|
1875
|
+
return html`
|
|
1876
|
+
<template
|
|
1877
|
+
${applyHostSemantics({
|
|
1878
|
+
role: "row",
|
|
1879
|
+
ariaSelected: calculateAriaSelectedValue$1
|
|
1880
|
+
})}
|
|
1881
|
+
class="${(x) => x.rowType !== "default" ? x.rowType : ""}"
|
|
1882
|
+
:defaultCellItemTemplate="${cellItemTemplate}"
|
|
1883
|
+
:defaultHeaderCellItemTemplate="${headerCellItemTemplate}"
|
|
1884
|
+
${children({
|
|
1885
|
+
property: "cellElements",
|
|
1886
|
+
filter: elements("[role=\"cell\"],[role=\"gridcell\"],[role=\"columnheader\"],[role=\"rowheader\"],[data-vvd-component=\"data-grid-cell\"]")
|
|
1887
|
+
})}
|
|
1888
|
+
>
|
|
1889
|
+
<div
|
|
1890
|
+
class="${getBaseClasses}"
|
|
1891
|
+
style="grid-template-columns: ${(x) => x.gridTemplateColumns};"
|
|
1892
|
+
>
|
|
1893
|
+
<slot ${slotted("slottedCellElements")}></slot>
|
|
1894
|
+
</div>
|
|
1895
|
+
</template>
|
|
1896
|
+
`;
|
|
1897
|
+
};
|
|
1898
|
+
//#endregion
|
|
1899
|
+
//#region src/lib/data-grid/data-grid-cell.template.ts
|
|
1900
|
+
function shouldShowSortIcons(x) {
|
|
1901
|
+
return x.cellType === "columnheader" && x.sortDirection !== void 0 && x.sortDirection !== DataGridCellSortStates.other;
|
|
1902
|
+
}
|
|
1903
|
+
function getSortIcon(x) {
|
|
1904
|
+
if (x.sortDirection === DataGridCellSortStates.ascending) return "sort-asc-solid";
|
|
1905
|
+
if (x.sortDirection === DataGridCellSortStates.descending) return "sort-desc-solid";
|
|
1906
|
+
return "sort-solid";
|
|
1907
|
+
}
|
|
1908
|
+
function calculateAriaSelectedValue(x) {
|
|
1909
|
+
if (x._selectable && x.selected) return "true";
|
|
1910
|
+
if (x._selectable && !x.selected) return "false";
|
|
1911
|
+
return null;
|
|
1912
|
+
}
|
|
1913
|
+
function renderSortIcons(c) {
|
|
1914
|
+
const iconTag = c.tagFor(Icon);
|
|
1915
|
+
return html`
|
|
1916
|
+
${when(shouldShowSortIcons, html`
|
|
1917
|
+
<${iconTag} class="header-icon" name="${getSortIcon}"></${iconTag}>
|
|
1918
|
+
`)}
|
|
1919
|
+
`;
|
|
1920
|
+
}
|
|
1921
|
+
function shouldAnnounceSortState(x) {
|
|
1922
|
+
return x.cellType === DataGridCellTypes.columnHeader && x.sortDirection !== void 0;
|
|
1923
|
+
}
|
|
1924
|
+
function getSortStateKey(x) {
|
|
1925
|
+
return x.sortDirection ?? DataGridCellSortStates.none;
|
|
1926
|
+
}
|
|
1927
|
+
function getLocalizedSortStatus(x) {
|
|
1928
|
+
const direction = getSortStateKey(x);
|
|
1929
|
+
return x.locale.dataGrid.cell.sortStatus?.[direction];
|
|
1930
|
+
}
|
|
1931
|
+
function getLocalizedSortInstruction(x) {
|
|
1932
|
+
const direction = getSortStateKey(x);
|
|
1933
|
+
return x.locale.dataGrid.cell.sortInstruction?.[direction];
|
|
1934
|
+
}
|
|
1935
|
+
function getSortAnnouncement(x) {
|
|
1936
|
+
return [getLocalizedSortStatus(x), getLocalizedSortInstruction(x)].filter((part) => !!part).join(" ").trim();
|
|
1937
|
+
}
|
|
1938
|
+
function handleKeyDown(x, e) {
|
|
1939
|
+
if (e.key === keyEnter || e.key === keySpace) {
|
|
1940
|
+
if (e.target.closest("[slot=\"action-items\"]")) return true;
|
|
1941
|
+
x._handleInteraction();
|
|
1942
|
+
}
|
|
1943
|
+
return true;
|
|
1944
|
+
}
|
|
1945
|
+
function handleClick(x, e) {
|
|
1946
|
+
if (e.target.closest("[slot=\"action-items\"]")) return true;
|
|
1947
|
+
x._handleInteraction();
|
|
1948
|
+
return true;
|
|
1949
|
+
}
|
|
1950
|
+
var DataGridCellTemplate = (context) => {
|
|
1951
|
+
const visuallyHiddenTagName = context.tagFor(VisuallyHidden);
|
|
1952
|
+
const getBaseClasses = ({ selected, _actionItemsSlottedContent }) => classNames("base", ["selected", !!selected], ["has-action-items", Boolean(_actionItemsSlottedContent?.length)]);
|
|
1953
|
+
return html`
|
|
1954
|
+
<template
|
|
1955
|
+
tabindex="-1"
|
|
1956
|
+
${applyHostSemantics({
|
|
1957
|
+
role: (x) => DataGridCellRole[x.cellType] ?? DataGridCellRole.default,
|
|
1958
|
+
ariaSelected: calculateAriaSelectedValue,
|
|
1959
|
+
ariaSort: (x) => x.sortDirection ?? null
|
|
1960
|
+
})}
|
|
1961
|
+
@click="${(x, c) => handleClick(x, c.event)}"
|
|
1962
|
+
@keydown="${(x, c) => handleKeyDown(x, c.event)}"
|
|
1963
|
+
>
|
|
1964
|
+
<div class="${getBaseClasses}">
|
|
1965
|
+
<div
|
|
1966
|
+
class="content"
|
|
1967
|
+
role="${(x) => shouldShowSortIcons(x) ? "button" : void 0}"
|
|
1968
|
+
>
|
|
1969
|
+
${(x) => x.selected ? html`<${visuallyHiddenTagName}
|
|
1970
|
+
data-announcement="selection"
|
|
1971
|
+
>
|
|
1972
|
+
${(x) => x.locale.dataGrid.cell.selected}
|
|
1973
|
+
</${visuallyHiddenTagName}>` : null}
|
|
1974
|
+
<slot></slot>
|
|
1975
|
+
${when(shouldShowSortIcons, html`<${visuallyHiddenTagName}
|
|
1976
|
+
data-announcement="button-role"
|
|
1977
|
+
>
|
|
1978
|
+
${(x) => x.locale.dataGrid.cell.button}
|
|
1979
|
+
</${visuallyHiddenTagName}>
|
|
1980
|
+
`)}
|
|
1981
|
+
${when(shouldAnnounceSortState, html`<${visuallyHiddenTagName}
|
|
1982
|
+
aria-live="polite"
|
|
1983
|
+
data-announcement="sort-state"
|
|
1984
|
+
>
|
|
1985
|
+
${getSortAnnouncement}
|
|
1986
|
+
</${visuallyHiddenTagName}>`)}
|
|
1987
|
+
${(_) => renderSortIcons(context)}
|
|
1988
|
+
</div>
|
|
1989
|
+
<slot
|
|
1990
|
+
name="action-items"
|
|
1991
|
+
${slotted("_actionItemsSlottedContent")}
|
|
1992
|
+
></slot>
|
|
1993
|
+
</div>
|
|
1994
|
+
</template>
|
|
1995
|
+
`;
|
|
1996
|
+
};
|
|
1997
|
+
//#endregion
|
|
1998
|
+
//#region src/lib/data-grid/definition.ts
|
|
1999
|
+
/**
|
|
2000
|
+
* @internal
|
|
2001
|
+
*/
|
|
2002
|
+
var dataGridCellDefinition = defineVividComponent("data-grid-cell", DataGridCell, DataGridCellTemplate, [iconDefinition, visuallyHiddenDefinition], { styles: data_grid_cell_default });
|
|
2003
|
+
/**
|
|
2004
|
+
* @internal
|
|
2005
|
+
*/
|
|
2006
|
+
var dataGridRowDefinition = defineVividComponent("data-grid-row", DataGridRow, DataGridRowTemplate, [dataGridCellDefinition], { styles: data_grid_row_default });
|
|
2007
|
+
/**
|
|
2008
|
+
* @internal
|
|
2009
|
+
*/
|
|
2010
|
+
var dataGridDefinition = defineVividComponent("data-grid", DataGrid, DataGridTemplate, [dataGridRowDefinition], { styles: data_grid_default });
|
|
2011
|
+
/**
|
|
2012
|
+
* Registers the data-grid element with the design system.
|
|
28
2013
|
*
|
|
29
2014
|
* @param prefix - the prefix to use for the component name
|
|
30
2015
|
*/
|
|
31
|
-
var
|
|
2016
|
+
var registerDataGrid = createRegisterFunction(dataGridDefinition);
|
|
32
2017
|
//#endregion
|
|
33
|
-
export {
|
|
2018
|
+
export { DataGridCell as a, registerDataGrid as i, dataGridDefinition as n, DataGridRow as o, dataGridRowDefinition as r, DataGrid as s, dataGridCellDefinition as t };
|