@refinitiv-ui/elements 5.3.3 → 5.3.4
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/lib/accordion/custom-elements.json +49 -0
- package/lib/accordion/index.d.ts +76 -0
- package/lib/accordion/index.js +139 -0
- package/lib/accordion/themes/halo/dark/index.js +3 -0
- package/lib/accordion/themes/halo/light/index.js +3 -0
- package/lib/accordion/themes/solar/charcoal/index.js +3 -0
- package/lib/accordion/themes/solar/pearl/index.js +3 -0
- package/lib/appstate-bar/custom-elements.json +49 -0
- package/lib/appstate-bar/index.d.ts +65 -0
- package/lib/appstate-bar/index.js +103 -0
- package/lib/appstate-bar/themes/halo/dark/index.js +3 -0
- package/lib/appstate-bar/themes/halo/light/index.js +3 -0
- package/lib/appstate-bar/themes/solar/charcoal/index.js +3 -0
- package/lib/appstate-bar/themes/solar/pearl/index.js +3 -0
- package/lib/autosuggest/custom-elements.json +223 -0
- package/lib/autosuggest/helpers/const.d.ts +2 -0
- package/lib/autosuggest/helpers/const.js +3 -0
- package/lib/autosuggest/helpers/types.d.ts +54 -0
- package/lib/autosuggest/helpers/types.js +1 -0
- package/lib/autosuggest/helpers/utils.d.ts +39 -0
- package/lib/autosuggest/helpers/utils.js +76 -0
- package/lib/autosuggest/index.d.ts +533 -0
- package/lib/autosuggest/index.js +1248 -0
- package/lib/autosuggest/themes/halo/dark/index.js +5 -0
- package/lib/autosuggest/themes/halo/light/index.js +5 -0
- package/lib/autosuggest/themes/solar/charcoal/index.js +5 -0
- package/lib/autosuggest/themes/solar/pearl/index.js +5 -0
- package/lib/button/custom-elements.json +119 -0
- package/lib/button/index.d.ts +132 -0
- package/lib/button/index.js +213 -0
- package/lib/button/themes/halo/dark/index.js +3 -0
- package/lib/button/themes/halo/light/index.js +3 -0
- package/lib/button/themes/solar/charcoal/index.js +3 -0
- package/lib/button/themes/solar/pearl/index.js +3 -0
- package/lib/button-bar/custom-elements.json +26 -0
- package/lib/button-bar/index.d.ts +76 -0
- package/lib/button-bar/index.js +157 -0
- package/lib/button-bar/themes/halo/dark/index.js +3 -0
- package/lib/button-bar/themes/halo/light/index.js +3 -0
- package/lib/button-bar/themes/solar/charcoal/index.js +3 -0
- package/lib/button-bar/themes/solar/pearl/index.js +3 -0
- package/lib/calendar/custom-elements.json +199 -0
- package/lib/calendar/index.d.ts +321 -0
- package/lib/calendar/index.js +926 -0
- package/lib/calendar/locales.d.ts +31 -0
- package/lib/calendar/locales.js +144 -0
- package/lib/calendar/themes/halo/dark/index.js +3 -0
- package/lib/calendar/themes/halo/light/index.js +3 -0
- package/lib/calendar/themes/solar/charcoal/index.js +3 -0
- package/lib/calendar/themes/solar/pearl/index.js +3 -0
- package/lib/calendar/types.d.ts +33 -0
- package/lib/calendar/types.js +6 -0
- package/lib/calendar/utils.d.ts +12 -0
- package/lib/calendar/utils.js +17 -0
- package/lib/canvas/custom-elements.json +69 -0
- package/lib/canvas/index.d.ts +100 -0
- package/lib/canvas/index.js +175 -0
- package/lib/canvas/themes/halo/dark/index.js +2 -0
- package/lib/canvas/themes/halo/light/index.js +2 -0
- package/lib/canvas/themes/solar/charcoal/index.js +2 -0
- package/lib/canvas/themes/solar/pearl/index.js +2 -0
- package/lib/card/custom-elements.json +59 -0
- package/lib/card/helpers/types.d.ts +12 -0
- package/lib/card/helpers/types.js +1 -0
- package/lib/card/index.d.ts +140 -0
- package/lib/card/index.js +247 -0
- package/lib/card/themes/halo/dark/index.js +5 -0
- package/lib/card/themes/halo/light/index.js +5 -0
- package/lib/card/themes/solar/charcoal/index.js +5 -0
- package/lib/card/themes/solar/pearl/index.js +5 -0
- package/lib/chart/custom-elements.json +42 -0
- package/lib/chart/helpers/index.d.ts +2 -0
- package/lib/chart/helpers/index.js +2 -0
- package/lib/chart/helpers/legend.d.ts +5 -0
- package/lib/chart/helpers/legend.js +78 -0
- package/lib/chart/helpers/merge.d.ts +15 -0
- package/lib/chart/helpers/merge.js +28 -0
- package/lib/chart/helpers/types.d.ts +69 -0
- package/lib/chart/helpers/types.js +1 -0
- package/lib/chart/index.d.ts +187 -0
- package/lib/chart/index.js +493 -0
- package/lib/chart/plugins/doughnut-center-label.d.ts +3 -0
- package/lib/chart/plugins/doughnut-center-label.js +196 -0
- package/lib/chart/themes/halo/dark/index.js +4 -0
- package/lib/chart/themes/halo/light/index.js +4 -0
- package/lib/chart/themes/solar/charcoal/index.js +4 -0
- package/lib/chart/themes/solar/pearl/index.js +4 -0
- package/lib/checkbox/custom-elements.json +71 -0
- package/lib/checkbox/index.d.ts +89 -0
- package/lib/checkbox/index.js +170 -0
- package/lib/checkbox/themes/halo/dark/index.js +4 -0
- package/lib/checkbox/themes/halo/light/index.js +4 -0
- package/lib/checkbox/themes/solar/charcoal/index.js +4 -0
- package/lib/checkbox/themes/solar/pearl/index.js +4 -0
- package/lib/clock/custom-elements.json +108 -0
- package/lib/clock/index.d.ts +309 -0
- package/lib/clock/index.js +564 -0
- package/lib/clock/themes/halo/dark/index.js +2 -0
- package/lib/clock/themes/halo/light/index.js +2 -0
- package/lib/clock/themes/solar/charcoal/index.js +2 -0
- package/lib/clock/themes/solar/pearl/index.js +2 -0
- package/lib/clock/utils/TickManager.d.ts +14 -0
- package/lib/clock/utils/TickManager.js +66 -0
- package/lib/clock/utils/timestamps.d.ts +6 -0
- package/lib/clock/utils/timestamps.js +6 -0
- package/lib/collapse/custom-elements.json +79 -0
- package/lib/collapse/index.d.ts +119 -0
- package/lib/collapse/index.js +199 -0
- package/lib/collapse/themes/halo/dark/index.js +5 -0
- package/lib/collapse/themes/halo/light/index.js +5 -0
- package/lib/collapse/themes/solar/charcoal/index.js +5 -0
- package/lib/collapse/themes/solar/pearl/index.js +5 -0
- package/lib/color-dialog/custom-elements.json +193 -0
- package/lib/color-dialog/elements/color-palettes.d.ts +52 -0
- package/lib/color-dialog/elements/color-palettes.js +105 -0
- package/lib/color-dialog/elements/grayscale-palettes.d.ts +67 -0
- package/lib/color-dialog/elements/grayscale-palettes.js +164 -0
- package/lib/color-dialog/elements/palettes.d.ts +58 -0
- package/lib/color-dialog/elements/palettes.js +119 -0
- package/lib/color-dialog/helpers/color-helpers.d.ts +62 -0
- package/lib/color-dialog/helpers/color-helpers.js +258 -0
- package/lib/color-dialog/helpers/value-model.d.ts +75 -0
- package/lib/color-dialog/helpers/value-model.js +139 -0
- package/lib/color-dialog/index.d.ts +232 -0
- package/lib/color-dialog/index.js +457 -0
- package/lib/color-dialog/themes/halo/dark/index.js +7 -0
- package/lib/color-dialog/themes/halo/light/index.js +7 -0
- package/lib/color-dialog/themes/solar/charcoal/index.js +7 -0
- package/lib/color-dialog/themes/solar/pearl/index.js +7 -0
- package/lib/combo-box/custom-elements.json +207 -0
- package/lib/combo-box/helpers/filter.d.ts +10 -0
- package/lib/combo-box/helpers/filter.js +29 -0
- package/lib/combo-box/helpers/keyboard-event.d.ts +17 -0
- package/lib/combo-box/helpers/keyboard-event.js +19 -0
- package/lib/combo-box/helpers/types.d.ts +11 -0
- package/lib/combo-box/helpers/types.js +1 -0
- package/lib/combo-box/index.d.ts +523 -0
- package/lib/combo-box/index.js +1146 -0
- package/lib/combo-box/themes/halo/dark/index.js +8 -0
- package/lib/combo-box/themes/halo/light/index.js +8 -0
- package/lib/combo-box/themes/solar/charcoal/index.js +8 -0
- package/lib/combo-box/themes/solar/pearl/index.js +8 -0
- package/lib/counter/custom-elements.json +35 -0
- package/lib/counter/index.d.ts +89 -0
- package/lib/counter/index.js +155 -0
- package/lib/counter/themes/halo/dark/index.js +3 -0
- package/lib/counter/themes/halo/light/index.js +3 -0
- package/lib/counter/themes/solar/charcoal/index.js +3 -0
- package/lib/counter/themes/solar/pearl/index.js +3 -0
- package/lib/counter/utils.d.ts +13 -0
- package/lib/counter/utils.js +52 -0
- package/lib/datetime-picker/custom-elements.json +333 -0
- package/lib/datetime-picker/index.d.ts +498 -0
- package/lib/datetime-picker/index.js +1164 -0
- package/lib/datetime-picker/locales.d.ts +8 -0
- package/lib/datetime-picker/locales.js +46 -0
- package/lib/datetime-picker/themes/halo/dark/index.js +7 -0
- package/lib/datetime-picker/themes/halo/light/index.js +7 -0
- package/lib/datetime-picker/themes/solar/charcoal/index.js +7 -0
- package/lib/datetime-picker/themes/solar/pearl/index.js +7 -0
- package/lib/datetime-picker/types.d.ts +3 -0
- package/lib/datetime-picker/types.js +1 -0
- package/lib/datetime-picker/utils.d.ts +55 -0
- package/lib/datetime-picker/utils.js +92 -0
- package/lib/dialog/custom-elements.json +136 -0
- package/lib/dialog/draggable-element.d.ts +14 -0
- package/lib/dialog/draggable-element.js +221 -0
- package/lib/dialog/index.d.ts +199 -0
- package/lib/dialog/index.js +331 -0
- package/lib/dialog/themes/halo/dark/index.js +7 -0
- package/lib/dialog/themes/halo/light/index.js +7 -0
- package/lib/dialog/themes/solar/charcoal/index.js +7 -0
- package/lib/dialog/themes/solar/pearl/index.js +7 -0
- package/lib/email-field/custom-elements.json +199 -0
- package/lib/email-field/index.d.ts +152 -0
- package/lib/email-field/index.js +287 -0
- package/lib/email-field/themes/halo/dark/index.js +3 -0
- package/lib/email-field/themes/halo/light/index.js +3 -0
- package/lib/email-field/themes/solar/charcoal/index.js +3 -0
- package/lib/email-field/themes/solar/pearl/index.js +3 -0
- package/lib/events.d.ts +121 -0
- package/lib/events.js +2 -0
- package/lib/flag/custom-elements.json +35 -0
- package/lib/flag/index.d.ts +94 -0
- package/lib/flag/index.js +168 -0
- package/lib/flag/themes/halo/dark/index.js +2 -0
- package/lib/flag/themes/halo/light/index.js +2 -0
- package/lib/flag/themes/solar/charcoal/index.js +2 -0
- package/lib/flag/themes/solar/pearl/index.js +2 -0
- package/lib/flag/utils/FlagLoader.d.ts +47 -0
- package/lib/flag/utils/FlagLoader.js +86 -0
- package/lib/header/custom-elements.json +36 -0
- package/lib/header/index.d.ts +46 -0
- package/lib/header/index.js +76 -0
- package/lib/header/themes/halo/dark/index.js +2 -0
- package/lib/header/themes/halo/light/index.js +2 -0
- package/lib/header/themes/solar/charcoal/index.js +2 -0
- package/lib/header/themes/solar/pearl/index.js +2 -0
- package/lib/heatmap/custom-elements.json +151 -0
- package/lib/heatmap/helpers/color.d.ts +30 -0
- package/lib/heatmap/helpers/color.js +68 -0
- package/lib/heatmap/helpers/text.d.ts +26 -0
- package/lib/heatmap/helpers/text.js +91 -0
- package/lib/heatmap/helpers/track.d.ts +102 -0
- package/lib/heatmap/helpers/track.js +160 -0
- package/lib/heatmap/helpers/types.d.ts +40 -0
- package/lib/heatmap/helpers/types.js +1 -0
- package/lib/heatmap/index.d.ts +453 -0
- package/lib/heatmap/index.js +1104 -0
- package/lib/heatmap/themes/halo/dark/index.js +4 -0
- package/lib/heatmap/themes/halo/light/index.js +4 -0
- package/lib/heatmap/themes/solar/charcoal/index.js +4 -0
- package/lib/heatmap/themes/solar/pearl/index.js +4 -0
- package/lib/icon/custom-elements.json +34 -0
- package/lib/icon/index.d.ts +87 -0
- package/lib/icon/index.js +161 -0
- package/lib/icon/themes/halo/dark/index.js +2 -0
- package/lib/icon/themes/halo/light/index.js +2 -0
- package/lib/icon/themes/solar/charcoal/index.js +2 -0
- package/lib/icon/themes/solar/pearl/index.js +2 -0
- package/lib/icon/utils/IconLoader.d.ts +47 -0
- package/lib/icon/utils/IconLoader.js +86 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/interactive-chart/custom-elements.json +86 -0
- package/lib/interactive-chart/helpers/merge.d.ts +15 -0
- package/lib/interactive-chart/helpers/merge.js +28 -0
- package/lib/interactive-chart/helpers/types.d.ts +45 -0
- package/lib/interactive-chart/helpers/types.js +6 -0
- package/lib/interactive-chart/index.d.ts +380 -0
- package/lib/interactive-chart/index.js +1093 -0
- package/lib/interactive-chart/themes/halo/dark/index.js +3 -0
- package/lib/interactive-chart/themes/halo/light/index.js +3 -0
- package/lib/interactive-chart/themes/solar/charcoal/index.js +3 -0
- package/lib/interactive-chart/themes/solar/pearl/index.js +3 -0
- package/lib/item/custom-elements.json +153 -0
- package/lib/item/helpers/types.d.ts +57 -0
- package/lib/item/helpers/types.js +1 -0
- package/lib/item/index.d.ts +149 -0
- package/lib/item/index.js +252 -0
- package/lib/item/themes/halo/dark/index.js +4 -0
- package/lib/item/themes/halo/light/index.js +4 -0
- package/lib/item/themes/solar/charcoal/index.js +4 -0
- package/lib/item/themes/solar/pearl/index.js +4 -0
- package/lib/jsx.d.ts +223 -0
- package/lib/label/custom-elements.json +52 -0
- package/lib/label/index.d.ts +102 -0
- package/lib/label/index.js +252 -0
- package/lib/label/themes/halo/dark/index.js +3 -0
- package/lib/label/themes/halo/light/index.js +3 -0
- package/lib/label/themes/solar/charcoal/index.js +3 -0
- package/lib/label/themes/solar/pearl/index.js +3 -0
- package/lib/layout/custom-elements.json +163 -0
- package/lib/layout/index.d.ts +107 -0
- package/lib/layout/index.js +215 -0
- package/lib/layout/themes/halo/dark/index.js +2 -0
- package/lib/layout/themes/halo/light/index.js +2 -0
- package/lib/layout/themes/solar/charcoal/index.js +2 -0
- package/lib/layout/themes/solar/pearl/index.js +2 -0
- package/lib/led-gauge/custom-elements.json +113 -0
- package/lib/led-gauge/index.d.ts +143 -0
- package/lib/led-gauge/index.js +440 -0
- package/lib/led-gauge/themes/halo/dark/index.js +3 -0
- package/lib/led-gauge/themes/halo/light/index.js +3 -0
- package/lib/led-gauge/themes/solar/charcoal/index.js +3 -0
- package/lib/led-gauge/themes/solar/pearl/index.js +3 -0
- package/lib/list/custom-elements.json +111 -0
- package/lib/list/extensible-function.d.ts +8 -0
- package/lib/list/extensible-function.js +13 -0
- package/lib/list/helpers/list-renderer.d.ts +9 -0
- package/lib/list/helpers/list-renderer.js +35 -0
- package/lib/list/helpers/types.d.ts +3 -0
- package/lib/list/helpers/types.js +1 -0
- package/lib/list/index.d.ts +292 -0
- package/lib/list/index.js +604 -0
- package/lib/list/renderer.d.ts +36 -0
- package/lib/list/renderer.js +9 -0
- package/lib/list/themes/halo/dark/index.js +3 -0
- package/lib/list/themes/halo/light/index.js +3 -0
- package/lib/list/themes/solar/charcoal/index.js +3 -0
- package/lib/list/themes/solar/pearl/index.js +3 -0
- package/lib/loader/custom-elements.json +9 -0
- package/lib/loader/index.d.ts +41 -0
- package/lib/loader/index.js +65 -0
- package/lib/loader/themes/halo/dark/index.js +2 -0
- package/lib/loader/themes/halo/light/index.js +2 -0
- package/lib/loader/themes/solar/charcoal/index.js +2 -0
- package/lib/loader/themes/solar/pearl/index.js +2 -0
- package/lib/multi-input/custom-elements.json +238 -0
- package/lib/multi-input/helpers/types.d.ts +11 -0
- package/lib/multi-input/helpers/types.js +1 -0
- package/lib/multi-input/index.d.ts +297 -0
- package/lib/multi-input/index.js +591 -0
- package/lib/multi-input/themes/halo/dark/index.js +4 -0
- package/lib/multi-input/themes/halo/light/index.js +4 -0
- package/lib/multi-input/themes/solar/charcoal/index.js +4 -0
- package/lib/multi-input/themes/solar/pearl/index.js +4 -0
- package/lib/notification/custom-elements.json +95 -0
- package/lib/notification/elements/notification-tray.d.ts +97 -0
- package/lib/notification/elements/notification-tray.js +170 -0
- package/lib/notification/elements/notification.d.ts +90 -0
- package/lib/notification/elements/notification.js +157 -0
- package/lib/notification/helpers/status.d.ts +30 -0
- package/lib/notification/helpers/status.js +130 -0
- package/lib/notification/helpers/types.d.ts +10 -0
- package/lib/notification/helpers/types.js +1 -0
- package/lib/notification/index.d.ts +2 -0
- package/lib/notification/index.js +2 -0
- package/lib/notification/themes/halo/dark/index.js +5 -0
- package/lib/notification/themes/halo/light/index.js +5 -0
- package/lib/notification/themes/solar/charcoal/index.js +5 -0
- package/lib/notification/themes/solar/pearl/index.js +5 -0
- package/lib/number-field/custom-elements.json +200 -0
- package/lib/number-field/index.d.ts +294 -0
- package/lib/number-field/index.js +708 -0
- package/lib/number-field/themes/halo/dark/index.js +3 -0
- package/lib/number-field/themes/halo/light/index.js +3 -0
- package/lib/number-field/themes/solar/charcoal/index.js +3 -0
- package/lib/number-field/themes/solar/pearl/index.js +3 -0
- package/lib/overlay/custom-elements.json +342 -0
- package/lib/overlay/elements/overlay-backdrop.d.ts +46 -0
- package/lib/overlay/elements/overlay-backdrop.js +67 -0
- package/lib/overlay/elements/overlay-viewport.d.ts +40 -0
- package/lib/overlay/elements/overlay-viewport.js +56 -0
- package/lib/overlay/elements/overlay.d.ts +403 -0
- package/lib/overlay/elements/overlay.js +1427 -0
- package/lib/overlay/helpers/functions.d.ts +13 -0
- package/lib/overlay/helpers/functions.js +16 -0
- package/lib/overlay/helpers/types.d.ts +97 -0
- package/lib/overlay/helpers/types.js +16 -0
- package/lib/overlay/index.d.ts +2 -0
- package/lib/overlay/index.js +1 -0
- package/lib/overlay/managers/backdrop-manager.d.ts +45 -0
- package/lib/overlay/managers/backdrop-manager.js +96 -0
- package/lib/overlay/managers/close-manager.d.ts +54 -0
- package/lib/overlay/managers/close-manager.js +138 -0
- package/lib/overlay/managers/focus-manager.d.ts +71 -0
- package/lib/overlay/managers/focus-manager.js +228 -0
- package/lib/overlay/managers/interaction-lock-manager.d.ts +138 -0
- package/lib/overlay/managers/interaction-lock-manager.js +375 -0
- package/lib/overlay/managers/viewport-manager.d.ts +93 -0
- package/lib/overlay/managers/viewport-manager.js +207 -0
- package/lib/overlay/managers/zindex-manager.d.ts +80 -0
- package/lib/overlay/managers/zindex-manager.js +195 -0
- package/lib/overlay/themes/halo/dark/index.js +4 -0
- package/lib/overlay/themes/halo/light/index.js +4 -0
- package/lib/overlay/themes/solar/charcoal/index.js +4 -0
- package/lib/overlay/themes/solar/pearl/index.js +4 -0
- package/lib/overlay-menu/custom-elements.json +196 -0
- package/lib/overlay-menu/helpers/types.d.ts +8 -0
- package/lib/overlay-menu/helpers/types.js +1 -0
- package/lib/overlay-menu/helpers/uuid.d.ts +7 -0
- package/lib/overlay-menu/helpers/uuid.js +13 -0
- package/lib/overlay-menu/index.d.ts +380 -0
- package/lib/overlay-menu/index.js +921 -0
- package/lib/overlay-menu/managers/menu-manager.d.ts +98 -0
- package/lib/overlay-menu/managers/menu-manager.js +240 -0
- package/lib/overlay-menu/themes/halo/dark/index.js +5 -0
- package/lib/overlay-menu/themes/halo/light/index.js +5 -0
- package/lib/overlay-menu/themes/solar/charcoal/index.js +5 -0
- package/lib/overlay-menu/themes/solar/pearl/index.js +5 -0
- package/lib/pagination/custom-elements.json +93 -0
- package/lib/pagination/helpers/types.d.ts +9 -0
- package/lib/pagination/helpers/types.js +1 -0
- package/lib/pagination/index.d.ts +207 -0
- package/lib/pagination/index.js +400 -0
- package/lib/pagination/themes/halo/dark/index.js +6 -0
- package/lib/pagination/themes/halo/light/index.js +6 -0
- package/lib/pagination/themes/solar/charcoal/index.js +6 -0
- package/lib/pagination/themes/solar/pearl/index.js +6 -0
- package/lib/panel/custom-elements.json +39 -0
- package/lib/panel/index.d.ts +48 -0
- package/lib/panel/index.js +77 -0
- package/lib/panel/themes/halo/dark/index.js +2 -0
- package/lib/panel/themes/halo/light/index.js +2 -0
- package/lib/panel/themes/solar/charcoal/index.js +2 -0
- package/lib/panel/themes/solar/pearl/index.js +2 -0
- package/lib/password-field/custom-elements.json +156 -0
- package/lib/password-field/index.d.ts +140 -0
- package/lib/password-field/index.js +258 -0
- package/lib/password-field/themes/halo/dark/index.js +3 -0
- package/lib/password-field/themes/halo/light/index.js +3 -0
- package/lib/password-field/themes/solar/charcoal/index.js +3 -0
- package/lib/password-field/themes/solar/pearl/index.js +3 -0
- package/lib/pill/custom-elements.json +95 -0
- package/lib/pill/index.d.ts +97 -0
- package/lib/pill/index.js +162 -0
- package/lib/pill/themes/halo/dark/index.js +3 -0
- package/lib/pill/themes/halo/light/index.js +3 -0
- package/lib/pill/themes/solar/charcoal/index.js +3 -0
- package/lib/pill/themes/solar/pearl/index.js +3 -0
- package/lib/progress-bar/custom-elements.json +58 -0
- package/lib/progress-bar/index.d.ts +82 -0
- package/lib/progress-bar/index.js +159 -0
- package/lib/progress-bar/themes/halo/dark/index.js +2 -0
- package/lib/progress-bar/themes/halo/light/index.js +2 -0
- package/lib/progress-bar/themes/solar/charcoal/index.js +2 -0
- package/lib/progress-bar/themes/solar/pearl/index.js +2 -0
- package/lib/radio-button/custom-elements.json +84 -0
- package/lib/radio-button/index.d.ts +106 -0
- package/lib/radio-button/index.js +195 -0
- package/lib/radio-button/radio-button-registry.d.ts +21 -0
- package/lib/radio-button/radio-button-registry.js +40 -0
- package/lib/radio-button/themes/halo/dark/index.js +3 -0
- package/lib/radio-button/themes/halo/light/index.js +3 -0
- package/lib/radio-button/themes/solar/charcoal/index.js +3 -0
- package/lib/radio-button/themes/solar/pearl/index.js +3 -0
- package/lib/rating/custom-elements.json +58 -0
- package/lib/rating/index.d.ts +91 -0
- package/lib/rating/index.js +158 -0
- package/lib/rating/themes/halo/dark/index.js +2 -0
- package/lib/rating/themes/halo/light/index.js +2 -0
- package/lib/rating/themes/solar/charcoal/index.js +2 -0
- package/lib/rating/themes/solar/pearl/index.js +2 -0
- package/lib/search-field/custom-elements.json +173 -0
- package/lib/search-field/index.d.ts +134 -0
- package/lib/search-field/index.js +254 -0
- package/lib/search-field/themes/halo/dark/index.js +3 -0
- package/lib/search-field/themes/halo/light/index.js +3 -0
- package/lib/search-field/themes/solar/charcoal/index.js +3 -0
- package/lib/search-field/themes/solar/pearl/index.js +3 -0
- package/lib/select/custom-elements.json +103 -0
- package/lib/select/helpers/types.d.ts +3 -0
- package/lib/select/helpers/types.js +1 -0
- package/lib/select/index.d.ts +388 -0
- package/lib/select/index.js +942 -0
- package/lib/select/themes/halo/dark/index.js +5 -0
- package/lib/select/themes/halo/light/index.js +5 -0
- package/lib/select/themes/solar/charcoal/index.js +5 -0
- package/lib/select/themes/solar/pearl/index.js +5 -0
- package/lib/sidebar-layout/custom-elements.json +72 -0
- package/lib/sidebar-layout/index.d.ts +69 -0
- package/lib/sidebar-layout/index.js +135 -0
- package/lib/sidebar-layout/themes/halo/dark/index.js +3 -0
- package/lib/sidebar-layout/themes/halo/light/index.js +3 -0
- package/lib/sidebar-layout/themes/solar/charcoal/index.js +3 -0
- package/lib/sidebar-layout/themes/solar/pearl/index.js +3 -0
- package/lib/slider/custom-elements.json +181 -0
- package/lib/slider/index.d.ts +409 -0
- package/lib/slider/index.js +1188 -0
- package/lib/slider/themes/halo/dark/index.js +3 -0
- package/lib/slider/themes/halo/light/index.js +3 -0
- package/lib/slider/themes/solar/charcoal/index.js +3 -0
- package/lib/slider/themes/solar/pearl/index.js +3 -0
- package/lib/sparkline/custom-elements.json +59 -0
- package/lib/sparkline/index.d.ts +107 -0
- package/lib/sparkline/index.js +188 -0
- package/lib/sparkline/themes/halo/dark/index.js +2 -0
- package/lib/sparkline/themes/halo/light/index.js +2 -0
- package/lib/sparkline/themes/solar/charcoal/index.js +2 -0
- package/lib/sparkline/themes/solar/pearl/index.js +2 -0
- package/lib/swing-gauge/const.d.ts +22 -0
- package/lib/swing-gauge/const.js +26 -0
- package/lib/swing-gauge/custom-elements.json +109 -0
- package/lib/swing-gauge/helpers.d.ts +8 -0
- package/lib/swing-gauge/helpers.js +105 -0
- package/lib/swing-gauge/index.d.ts +294 -0
- package/lib/swing-gauge/index.js +762 -0
- package/lib/swing-gauge/themes/halo/dark/index.js +3 -0
- package/lib/swing-gauge/themes/halo/light/index.js +3 -0
- package/lib/swing-gauge/themes/solar/charcoal/index.js +3 -0
- package/lib/swing-gauge/themes/solar/pearl/index.js +3 -0
- package/lib/swing-gauge/types.d.ts +34 -0
- package/lib/swing-gauge/types.js +1 -0
- package/lib/tab/custom-elements.json +123 -0
- package/lib/tab/index.d.ts +118 -0
- package/lib/tab/index.js +211 -0
- package/lib/tab/themes/halo/dark/index.js +4 -0
- package/lib/tab/themes/halo/light/index.js +4 -0
- package/lib/tab/themes/solar/charcoal/index.js +4 -0
- package/lib/tab/themes/solar/pearl/index.js +4 -0
- package/lib/tab-bar/custom-elements.json +52 -0
- package/lib/tab-bar/helpers/animate.d.ts +16 -0
- package/lib/tab-bar/helpers/animate.js +53 -0
- package/lib/tab-bar/index.d.ts +108 -0
- package/lib/tab-bar/index.js +220 -0
- package/lib/tab-bar/themes/halo/dark/index.js +4 -0
- package/lib/tab-bar/themes/halo/light/index.js +4 -0
- package/lib/tab-bar/themes/solar/charcoal/index.js +4 -0
- package/lib/tab-bar/themes/solar/pearl/index.js +4 -0
- package/lib/text-field/custom-elements.json +210 -0
- package/lib/text-field/index.d.ts +171 -0
- package/lib/text-field/index.js +319 -0
- package/lib/text-field/themes/halo/dark/index.js +3 -0
- package/lib/text-field/themes/halo/light/index.js +3 -0
- package/lib/text-field/themes/solar/charcoal/index.js +3 -0
- package/lib/text-field/themes/solar/pearl/index.js +3 -0
- package/lib/time-picker/custom-elements.json +124 -0
- package/lib/time-picker/index.d.ts +379 -0
- package/lib/time-picker/index.js +777 -0
- package/lib/time-picker/themes/halo/dark/index.js +4 -0
- package/lib/time-picker/themes/halo/light/index.js +4 -0
- package/lib/time-picker/themes/solar/charcoal/index.js +4 -0
- package/lib/time-picker/themes/solar/pearl/index.js +4 -0
- package/lib/toggle/custom-elements.json +84 -0
- package/lib/toggle/index.d.ts +77 -0
- package/lib/toggle/index.js +134 -0
- package/lib/toggle/themes/halo/dark/index.js +2 -0
- package/lib/toggle/themes/halo/light/index.js +2 -0
- package/lib/toggle/themes/solar/charcoal/index.js +2 -0
- package/lib/toggle/themes/solar/pearl/index.js +2 -0
- package/lib/tooltip/custom-elements.json +62 -0
- package/lib/tooltip/elements/title-tooltip.d.ts +1 -0
- package/lib/tooltip/elements/title-tooltip.js +18 -0
- package/lib/tooltip/elements/tooltip-element.d.ts +21 -0
- package/lib/tooltip/elements/tooltip-element.js +54 -0
- package/lib/tooltip/helpers/overflow-tooltip.d.ts +9 -0
- package/lib/tooltip/helpers/overflow-tooltip.js +19 -0
- package/lib/tooltip/helpers/renderer.d.ts +8 -0
- package/lib/tooltip/helpers/renderer.js +11 -0
- package/lib/tooltip/helpers/types.d.ts +23 -0
- package/lib/tooltip/helpers/types.js +1 -0
- package/lib/tooltip/index.d.ts +232 -0
- package/lib/tooltip/index.js +479 -0
- package/lib/tooltip/managers/tooltip-manager.d.ts +15 -0
- package/lib/tooltip/managers/tooltip-manager.js +144 -0
- package/lib/tooltip/themes/halo/dark/index.js +3 -0
- package/lib/tooltip/themes/halo/light/index.js +3 -0
- package/lib/tooltip/themes/solar/charcoal/index.js +3 -0
- package/lib/tooltip/themes/solar/pearl/index.js +3 -0
- package/lib/tornado-chart/custom-elements.json +45 -0
- package/lib/tornado-chart/elements/tornado-chart.d.ts +78 -0
- package/lib/tornado-chart/elements/tornado-chart.js +125 -0
- package/lib/tornado-chart/elements/tornado-item.d.ts +110 -0
- package/lib/tornado-chart/elements/tornado-item.js +209 -0
- package/lib/tornado-chart/index.d.ts +2 -0
- package/lib/tornado-chart/index.js +2 -0
- package/lib/tornado-chart/themes/halo/dark/index.js +6 -0
- package/lib/tornado-chart/themes/halo/light/index.js +6 -0
- package/lib/tornado-chart/themes/solar/charcoal/index.js +6 -0
- package/lib/tornado-chart/themes/solar/pearl/index.js +6 -0
- package/lib/tree/custom-elements.json +100 -0
- package/lib/tree/elements/tree-item.d.ts +96 -0
- package/lib/tree/elements/tree-item.js +182 -0
- package/lib/tree/elements/tree.d.ts +156 -0
- package/lib/tree/elements/tree.js +286 -0
- package/lib/tree/helpers/renderer.d.ts +5 -0
- package/lib/tree/helpers/renderer.js +33 -0
- package/lib/tree/helpers/types.d.ts +17 -0
- package/lib/tree/helpers/types.js +1 -0
- package/lib/tree/index.d.ts +4 -0
- package/lib/tree/index.js +3 -0
- package/lib/tree/managers/tree-manager.d.ts +236 -0
- package/lib/tree/managers/tree-manager.js +379 -0
- package/lib/tree/themes/halo/dark/index.js +7 -0
- package/lib/tree/themes/halo/light/index.js +7 -0
- package/lib/tree/themes/solar/charcoal/index.js +7 -0
- package/lib/tree/themes/solar/pearl/index.js +7 -0
- package/lib/tree-select/custom-elements.json +107 -0
- package/lib/tree-select/helpers/types.d.ts +4 -0
- package/lib/tree-select/helpers/types.js +1 -0
- package/lib/tree-select/index.d.ts +400 -0
- package/lib/tree-select/index.js +881 -0
- package/lib/tree-select/themes/halo/dark/index.js +12 -0
- package/lib/tree-select/themes/halo/light/index.js +12 -0
- package/lib/tree-select/themes/solar/charcoal/index.js +12 -0
- package/lib/tree-select/themes/solar/pearl/index.js +12 -0
- package/package.json +9 -9
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var OverlayMenu_1;
|
|
8
|
+
import { html, css, customElement, property, ifDefined, WarningNotice } from '@refinitiv-ui/core';
|
|
9
|
+
import { AnimationTaskRunner, CollectionComposer } from '@refinitiv-ui/utils';
|
|
10
|
+
import '../icon';
|
|
11
|
+
import '../item';
|
|
12
|
+
import { Item } from '../item';
|
|
13
|
+
import { Overlay } from '../overlay';
|
|
14
|
+
import { getId } from './helpers/uuid';
|
|
15
|
+
import { OpenedMenusManager } from './managers/menu-manager';
|
|
16
|
+
import { VERSION } from '../';
|
|
17
|
+
/**
|
|
18
|
+
* Overlay that supports single-level and multi-level menus
|
|
19
|
+
* @fires item-trigger - Dispatched when user clicks on item
|
|
20
|
+
* @fires opened-changed - Dispatched when when opened attribute changes internally. Prevent default to stop opening/closing pipeline
|
|
21
|
+
*
|
|
22
|
+
* @attr {boolean} opened - True if the menu is currently displayed
|
|
23
|
+
* @prop {boolean} [opened=false] - True if the menu is currently displayed
|
|
24
|
+
*
|
|
25
|
+
* @attr {boolean} with-backdrop - True to show backdrop
|
|
26
|
+
* @prop {boolean} [withBackdrop=false] - True to show backdrop
|
|
27
|
+
*
|
|
28
|
+
* @attr {boolean} no-cancel-on-esc-key - Set to true to disable canceling the overlay with the ESC key
|
|
29
|
+
* @prop {boolean} [noCancelOnEscKey=false] - Set to true to disable canceling the overlay with the ESC key
|
|
30
|
+
*
|
|
31
|
+
* @attr {boolean} no-cancel-on-outside-click - Set to true to disable canceling the overlay by clicking outside it
|
|
32
|
+
* @prop {boolean} [noCancelOnOutsideClick=false] - Set to true to disable canceling the overlay by clicking outside it
|
|
33
|
+
*
|
|
34
|
+
* @attr {boolean} lock-position-target - Set to true to lock position target
|
|
35
|
+
* @prop {boolean} [lockPositionTarget=false] - Set to true to lock position target
|
|
36
|
+
*
|
|
37
|
+
* @prop {HTMLElement|null} [positionTarget=null] - Position next to the HTML element
|
|
38
|
+
*
|
|
39
|
+
* @attr {string} transition-style - Set the transition style
|
|
40
|
+
* @prop {string|null} [transitionStyle=null] - Set the transition style
|
|
41
|
+
*
|
|
42
|
+
* @prop {string} [value=] - Returns the first selected item from values.
|
|
43
|
+
*
|
|
44
|
+
* @attr {number} x - Set a specific x coordinate
|
|
45
|
+
* @prop {number} x - Set a specific x coordinate
|
|
46
|
+
*
|
|
47
|
+
* @attr {number} y - Set a specific y coordinate
|
|
48
|
+
* @prop {number} y - Set a specific y coordinate
|
|
49
|
+
*
|
|
50
|
+
* @attr {number} horizontal-offset - A pixel value that will be added to the position calculated on the horizontal axis. The offset will be applied either to the `left` or `right` depending on the `positionTarget`
|
|
51
|
+
* @prop {number} horizontalOffset - A pixel value that will be added to the position calculated on the horizontal axis. The offset will be applied either to the `left` or `right` depending on the `positionTarget`
|
|
52
|
+
*
|
|
53
|
+
* @attr {number} vertical-offset - A pixel value that will be added to the position calculated on the vertical axis. The offset will be applied either to the `top` or `bottom` depending on the `positionTarget`
|
|
54
|
+
* @prop {number} verticalOffset - A pixel value that will be added to the position calculated on the vertical axis. The offset will be applied either to the `top` or `bottom` depending on the `positionTarget`
|
|
55
|
+
*
|
|
56
|
+
* @attr {number} offset - A pixel value that will be added to the position calculated on the vertical or horizontal axis. The offset is applied dynamically depending on the `positionTarget`
|
|
57
|
+
* @prop {number} offset - A pixel value that will be added to the position calculated on the vertical or horizontal axis. The offset is applied dynamically depending on the `positionTarget`
|
|
58
|
+
*
|
|
59
|
+
* @attr {{} | undefined} position - Set position and align against the attach target.
|
|
60
|
+
* @prop {{} | undefined} position - Set position and align against the attach target.
|
|
61
|
+
*/
|
|
62
|
+
let OverlayMenu = OverlayMenu_1 = class OverlayMenu extends Overlay {
|
|
63
|
+
constructor() {
|
|
64
|
+
super();
|
|
65
|
+
this.dataDisconnectThrottler = new AnimationTaskRunner();
|
|
66
|
+
this.oldInteractiveElements = [];
|
|
67
|
+
this.menuIndex = {};
|
|
68
|
+
this.composer = new CollectionComposer([]);
|
|
69
|
+
this.lazyRendered = false; /* speed up rendering by not populating overlay on first load */
|
|
70
|
+
/**
|
|
71
|
+
* Switch to compact style menu
|
|
72
|
+
*/
|
|
73
|
+
this.compact = false;
|
|
74
|
+
/**
|
|
75
|
+
* A flag indicating that the menu is nested
|
|
76
|
+
* Used for styling
|
|
77
|
+
*/
|
|
78
|
+
this.nested = false;
|
|
79
|
+
/**
|
|
80
|
+
* @ignore
|
|
81
|
+
*/
|
|
82
|
+
this.withShadow = true;
|
|
83
|
+
/**
|
|
84
|
+
* @ignore
|
|
85
|
+
*/
|
|
86
|
+
this.lockPositionTarget = true;
|
|
87
|
+
/**
|
|
88
|
+
* @ignore
|
|
89
|
+
*/
|
|
90
|
+
this.focusBoundary = null;
|
|
91
|
+
/**
|
|
92
|
+
* @ignore
|
|
93
|
+
*/
|
|
94
|
+
this.position = ['bottom-start', 'top-start'];
|
|
95
|
+
/**
|
|
96
|
+
* @ignore
|
|
97
|
+
*/
|
|
98
|
+
this.toItem = this.toItem.bind(this);
|
|
99
|
+
/**
|
|
100
|
+
* @ignore
|
|
101
|
+
*/
|
|
102
|
+
this.modificationUpdate = this.modificationUpdate.bind(this);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Element version number
|
|
106
|
+
* @returns version number
|
|
107
|
+
*/
|
|
108
|
+
static get version() {
|
|
109
|
+
return VERSION;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A `CSSResult` that will be used
|
|
113
|
+
* to style the host, slotted children
|
|
114
|
+
* and the internal template of the element.
|
|
115
|
+
* @return CSS template
|
|
116
|
+
*/
|
|
117
|
+
static get styles() {
|
|
118
|
+
return [
|
|
119
|
+
super.styles,
|
|
120
|
+
css `
|
|
121
|
+
:host {
|
|
122
|
+
overflow-y: auto;
|
|
123
|
+
overflow-x: hidden;
|
|
124
|
+
}
|
|
125
|
+
:host([compact]:not([active])) { /* active is set in menu-manager */
|
|
126
|
+
opacity: 0;
|
|
127
|
+
}
|
|
128
|
+
`
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Array of item's values
|
|
133
|
+
* @type {string[]}
|
|
134
|
+
*/
|
|
135
|
+
get values() {
|
|
136
|
+
return this.withData ? this.getDataValues() : this.getSlottedValues();
|
|
137
|
+
}
|
|
138
|
+
set values(values) {
|
|
139
|
+
const oldValues = this.values;
|
|
140
|
+
if (String(values) === String(oldValues)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
this.withData ? this.setDataValues(values) : this.setSlottedValues(values);
|
|
144
|
+
void this.requestUpdate('values', oldValues);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Returns the first selected item value.
|
|
148
|
+
*/
|
|
149
|
+
get value() {
|
|
150
|
+
return this.values.length > 0 ? this.values[0] : '';
|
|
151
|
+
}
|
|
152
|
+
set value(value) {
|
|
153
|
+
const valueToString = String(value);
|
|
154
|
+
this.values = valueToString && value !== null ? [valueToString] : [];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Construct the menu from data object.
|
|
158
|
+
* Cannot be used with internal content
|
|
159
|
+
*/
|
|
160
|
+
get data() {
|
|
161
|
+
return this._data;
|
|
162
|
+
}
|
|
163
|
+
set data(value) {
|
|
164
|
+
const oldValue = this._data;
|
|
165
|
+
if (oldValue === value) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
else if (Array.isArray(value)) {
|
|
169
|
+
value.forEach(function (item) {
|
|
170
|
+
if (item && item.value !== undefined && item.value !== null) {
|
|
171
|
+
item.value = String(item.value);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
this.composer = new CollectionComposer(value);
|
|
175
|
+
}
|
|
176
|
+
else if (value instanceof CollectionComposer) {
|
|
177
|
+
this.composer = value;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
new WarningNotice('ef-overlay-menu: invalid data provided').show();
|
|
181
|
+
this.composer = new CollectionComposer([]);
|
|
182
|
+
}
|
|
183
|
+
this._data = value;
|
|
184
|
+
this.composer.on('modification', // Listen for modifications
|
|
185
|
+
this.modificationUpdate // Update the template
|
|
186
|
+
);
|
|
187
|
+
void this.requestUpdate('data', oldValue);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get values from data collection
|
|
191
|
+
* @returns data values
|
|
192
|
+
*/
|
|
193
|
+
getDataValues() {
|
|
194
|
+
const items = this.getDataDescendants();
|
|
195
|
+
const selected = items.filter(item => this.composer.getItemPropertyValue(item, 'selected') === true);
|
|
196
|
+
return selected.map(item => this.composer.getItemPropertyValue(item, 'value') || '');
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Set values to data collection
|
|
200
|
+
* @param values data values
|
|
201
|
+
* @returns {void}
|
|
202
|
+
*/
|
|
203
|
+
setDataValues(values) {
|
|
204
|
+
const items = this.getDataDescendants();
|
|
205
|
+
items.forEach(item => {
|
|
206
|
+
const value = this.composer.getItemPropertyValue(item, 'value') || '';
|
|
207
|
+
const found = values.some(userValue => String(userValue) === value);
|
|
208
|
+
this.composer.setItemPropertyValue(item, 'selected', found);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get values from slotted element collection
|
|
213
|
+
* @returns slotted item values
|
|
214
|
+
*/
|
|
215
|
+
getSlottedValues() {
|
|
216
|
+
const items = this.getSlottedDescendants();
|
|
217
|
+
const selected = items.filter(item => item.selected === true);
|
|
218
|
+
return selected.map(item => item.value);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Set values to slotted elements
|
|
222
|
+
* @param values element values
|
|
223
|
+
* @returns {void}
|
|
224
|
+
*/
|
|
225
|
+
setSlottedValues(values) {
|
|
226
|
+
const items = this.getSlottedDescendants();
|
|
227
|
+
items.forEach(item => {
|
|
228
|
+
item.selected = values.includes(item.value);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* A flag to check whether menu is constructed from data
|
|
233
|
+
* or from slotted content
|
|
234
|
+
* It is not possible to combine two
|
|
235
|
+
*/
|
|
236
|
+
get withData() {
|
|
237
|
+
return this._data !== undefined;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* True if menu is fully opened and is currently in focus
|
|
241
|
+
*/
|
|
242
|
+
get isActive() {
|
|
243
|
+
return this.fullyOpened && OpenedMenusManager.isActiveMenu(this);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get descendant as data item
|
|
247
|
+
* Valid only for CC
|
|
248
|
+
* @returns descendant data item
|
|
249
|
+
*/
|
|
250
|
+
getDataDescendants() {
|
|
251
|
+
return (this.parentDataItem
|
|
252
|
+
? this.composer.getItemDescendants(this.parentDataItem, Infinity)
|
|
253
|
+
: this.composer.queryItems(() => true, Infinity));
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Get descendant as item
|
|
257
|
+
* Valid only for slotted
|
|
258
|
+
* @param [parent=this] parent menu
|
|
259
|
+
* @returns descendant item
|
|
260
|
+
*/
|
|
261
|
+
getSlottedDescendants(parent = this) {
|
|
262
|
+
const items = parent.children;
|
|
263
|
+
const descendants = [];
|
|
264
|
+
for (let i = 0; i < items.length; i += 1) {
|
|
265
|
+
const item = items[i];
|
|
266
|
+
if (item instanceof Item) {
|
|
267
|
+
descendants.push(item);
|
|
268
|
+
if (item.for) {
|
|
269
|
+
const menu = document.getElementById(item.for);
|
|
270
|
+
if (menu && menu instanceof OverlayMenu_1) {
|
|
271
|
+
descendants.push(...this.getSlottedDescendants(menu));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return descendants;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Filter items out of children
|
|
280
|
+
*/
|
|
281
|
+
get items() {
|
|
282
|
+
const children = this.withData ? this.renderRoot.children : this.children;
|
|
283
|
+
const items = [];
|
|
284
|
+
for (let i = 0; i < children.length; i += 1) {
|
|
285
|
+
const item = children[i];
|
|
286
|
+
if (item instanceof Item && this.isHighlightable(item)) {
|
|
287
|
+
items.push(item);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return items;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Invoked when a component is removed from the document’s DOM.
|
|
294
|
+
* @return {void}
|
|
295
|
+
*/
|
|
296
|
+
disconnectedCallback() {
|
|
297
|
+
super.disconnectedCallback();
|
|
298
|
+
this.disconnectNestedMenus();
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Called when the element’s DOM has been updated and rendered
|
|
302
|
+
* @param changedProperties Properties that has changed
|
|
303
|
+
* @returns shouldUpdate
|
|
304
|
+
*/
|
|
305
|
+
shouldUpdate(changedProperties) {
|
|
306
|
+
const shouldUpdate = super.shouldUpdate(changedProperties);
|
|
307
|
+
return shouldUpdate
|
|
308
|
+
|| changedProperties.size === 0 /* this is to support empty requestUpdate() */
|
|
309
|
+
|| changedProperties.has('values')
|
|
310
|
+
|| changedProperties.has('data')
|
|
311
|
+
|| (this.opened && changedProperties.has('compact'))
|
|
312
|
+
|| (this.opened && changedProperties.has('modification'));
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Reflects property values to attributes and calls render to render DOM via lit-html.
|
|
316
|
+
* @param changedProperties Properties which have changed
|
|
317
|
+
* @return {void}
|
|
318
|
+
*/
|
|
319
|
+
update(changedProperties) {
|
|
320
|
+
if (changedProperties.has('opened')) {
|
|
321
|
+
if (this.opened) {
|
|
322
|
+
this.opening();
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
this.closing();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (changedProperties.has('data')) {
|
|
329
|
+
this.constructDataMenus();
|
|
330
|
+
}
|
|
331
|
+
if (changedProperties.has('opened') && this.opened) {
|
|
332
|
+
this.lazyRendered = true;
|
|
333
|
+
}
|
|
334
|
+
super.update(changedProperties);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Called after the component is first rendered
|
|
338
|
+
* @param changedProperties Properties which have changed
|
|
339
|
+
* @return {void}
|
|
340
|
+
*/
|
|
341
|
+
firstUpdated(changedProperties) {
|
|
342
|
+
super.firstUpdated(changedProperties);
|
|
343
|
+
this.addEventListener('keydown', this.onKeyDown);
|
|
344
|
+
this.addEventListener('keyup', this.onKeyUp);
|
|
345
|
+
this.renderRoot.addEventListener('tap', (event) => this.onItemTap(event));
|
|
346
|
+
this.renderRoot.addEventListener('mousemove', (event) => this.onItemMouseMove(event)); /* listen shadow root to support data */
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Called after render life-cycle finished
|
|
350
|
+
* @param changedProperties Properties which have changed
|
|
351
|
+
* @return {void}
|
|
352
|
+
*/
|
|
353
|
+
updated(changedProperties) {
|
|
354
|
+
super.updated(changedProperties);
|
|
355
|
+
if (changedProperties.has('data')) {
|
|
356
|
+
// Manages items constructed by constructDataMenus after they have been rendered
|
|
357
|
+
this.onDataChange();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Run when the overlay has closed, managers are de-registered
|
|
362
|
+
* and closing transition has finished
|
|
363
|
+
* @return {void}
|
|
364
|
+
*/
|
|
365
|
+
onClosed() {
|
|
366
|
+
// do not keep light DOM nodes and disconnect on next render
|
|
367
|
+
this.dataDisconnectThrottler.schedule(() => {
|
|
368
|
+
this.disconnectNestedMenus();
|
|
369
|
+
});
|
|
370
|
+
this.setItemHighlight();
|
|
371
|
+
if (OpenedMenusManager.isNested(this)) {
|
|
372
|
+
this.nested = false;
|
|
373
|
+
this.position = this.oldPosition;
|
|
374
|
+
this.positionTarget = this.oldPositionTarget;
|
|
375
|
+
this.interactiveElements = this.oldInteractiveElements;
|
|
376
|
+
this.oldPositionTarget = undefined;
|
|
377
|
+
this.oldPosition = undefined;
|
|
378
|
+
this.oldInteractiveElements = [];
|
|
379
|
+
}
|
|
380
|
+
super.onClosed();
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Selects all data from CollectionComposer
|
|
384
|
+
* @return all MenuItems stored in CollectionComposer
|
|
385
|
+
*/
|
|
386
|
+
getAllComposedData() {
|
|
387
|
+
const items = this.parentDataItem
|
|
388
|
+
? this.composer.getItemChildren(this.parentDataItem)
|
|
389
|
+
: this.composer.queryItems(() => true, 0);
|
|
390
|
+
return items;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Get menu depth from the collection composer
|
|
394
|
+
* @returns depth
|
|
395
|
+
*/
|
|
396
|
+
getDataDepth() {
|
|
397
|
+
return this.parentDataItem ? this.composer.getItemDepth(this.parentDataItem) + 1 : 0;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Run while overlay is opening
|
|
401
|
+
* @return {void}
|
|
402
|
+
*/
|
|
403
|
+
opening() {
|
|
404
|
+
const parentMenuItem = OpenedMenusManager.getParentMenuItem(this);
|
|
405
|
+
this.dataDisconnectThrottler.cancel();
|
|
406
|
+
if (parentMenuItem) {
|
|
407
|
+
this.nested = true;
|
|
408
|
+
this.noCancelOnOutsideClick = true;
|
|
409
|
+
this.oldPositionTarget = this.positionTarget;
|
|
410
|
+
this.oldInteractiveElements = this.interactiveElements;
|
|
411
|
+
this.oldPosition = this.position;
|
|
412
|
+
let parentMenu = OpenedMenusManager.getParentMenu(this);
|
|
413
|
+
if (!this.compact) {
|
|
414
|
+
this.positionTarget = parentMenuItem;
|
|
415
|
+
const interactiveElements = [];
|
|
416
|
+
while (parentMenu) {
|
|
417
|
+
interactiveElements.push(parentMenu, ...parentMenu.interactiveElements);
|
|
418
|
+
parentMenu = OpenedMenusManager.getParentMenu(parentMenu);
|
|
419
|
+
}
|
|
420
|
+
this.interactiveElements = (this.oldInteractiveElements || []).concat(interactiveElements);
|
|
421
|
+
this.position = ['right-start', 'left-start'];
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
this.positionTarget = parentMenu === null || parentMenu === void 0 ? void 0 : parentMenu.positionTarget;
|
|
425
|
+
this.position = parentMenu === null || parentMenu === void 0 ? void 0 : parentMenu.position;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
this.registerMenu();
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Run while overlay is closing
|
|
432
|
+
* @return {void}
|
|
433
|
+
*/
|
|
434
|
+
closing() {
|
|
435
|
+
OpenedMenusManager.deregister(this);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Run when modification has happened in CC
|
|
439
|
+
* @returns {void}
|
|
440
|
+
*/
|
|
441
|
+
modificationUpdate() {
|
|
442
|
+
this.constructDataMenus();
|
|
443
|
+
void this.requestUpdate();
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Construct menu items and nested menus from data object
|
|
447
|
+
* @return {void}
|
|
448
|
+
*/
|
|
449
|
+
constructDataMenus() {
|
|
450
|
+
const data = this.getAllComposedData();
|
|
451
|
+
const depth = this.getDataDepth();
|
|
452
|
+
const oldMenuIndex = this.menuIndex;
|
|
453
|
+
this.menuIndex = {};
|
|
454
|
+
// try to match existing menus via CC
|
|
455
|
+
// this is true if modification are done via CC APIs
|
|
456
|
+
const findMenuByDataItem = (dataItem) => {
|
|
457
|
+
var _a, _b;
|
|
458
|
+
const menuId = (((_a = this.composer) === null || _a === void 0 ? void 0 : _a.getItemPropertyValue(dataItem, 'for')) || '');
|
|
459
|
+
return (_b = oldMenuIndex[menuId]) === null || _b === void 0 ? void 0 : _b.menu;
|
|
460
|
+
};
|
|
461
|
+
// try to match existing menus by item value and depth
|
|
462
|
+
// this happens if new data has been supplied, which might be identical
|
|
463
|
+
const findMenuByDataId = (id) => {
|
|
464
|
+
for (const menuId in oldMenuIndex) {
|
|
465
|
+
const { menu, dataId } = oldMenuIndex[menuId];
|
|
466
|
+
if (dataId === id) {
|
|
467
|
+
return menu;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
data.forEach((dataItem, index) => {
|
|
472
|
+
var _a;
|
|
473
|
+
// has menu
|
|
474
|
+
if (dataItem.items && dataItem.items.length) {
|
|
475
|
+
const dataId = `${dataItem.value || index}-${depth}`;
|
|
476
|
+
const menu = findMenuByDataItem(dataItem) || findMenuByDataId(dataId) || this.toOverlayMenu();
|
|
477
|
+
menu.parentDataItem = dataItem;
|
|
478
|
+
menu.data = this.composer;
|
|
479
|
+
const menuId = menu.id;
|
|
480
|
+
this.menuIndex[menuId] = {
|
|
481
|
+
menu,
|
|
482
|
+
dataId
|
|
483
|
+
};
|
|
484
|
+
delete oldMenuIndex[menuId];
|
|
485
|
+
(_a = this.composer) === null || _a === void 0 ? void 0 : _a.setItemPropertyValue(dataItem, 'for', menuId);
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
// delete all non-required menus
|
|
489
|
+
for (const menuId in oldMenuIndex) {
|
|
490
|
+
const { menu } = oldMenuIndex[menuId];
|
|
491
|
+
if (menu.parentNode) {
|
|
492
|
+
menu.parentNode.removeChild(menu);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Remove all nested menus from the light DOM
|
|
498
|
+
* @return {void}
|
|
499
|
+
*/
|
|
500
|
+
disconnectNestedMenus() {
|
|
501
|
+
var _a;
|
|
502
|
+
for (const menuIndex in this.menuIndex) {
|
|
503
|
+
const { menu } = this.menuIndex[menuIndex];
|
|
504
|
+
(_a = menu.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(menu);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* This function must be called to register menu or menu items
|
|
509
|
+
* @return {void}
|
|
510
|
+
*/
|
|
511
|
+
registerMenu() {
|
|
512
|
+
if (this.opened) {
|
|
513
|
+
OpenedMenusManager.register(this);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Fired when mouse move event happens
|
|
518
|
+
* @param event Mouse move event
|
|
519
|
+
* @return {void}
|
|
520
|
+
*/
|
|
521
|
+
onItemMouseMove(event) {
|
|
522
|
+
if (!this.fullyOpened) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
const item = this.getItem(event.target);
|
|
526
|
+
if (item) {
|
|
527
|
+
// set focus on menu to reset item focus
|
|
528
|
+
// happens only if move on item
|
|
529
|
+
if (this.isActive) {
|
|
530
|
+
if (document.activeElement !== this) {
|
|
531
|
+
this.focus();
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
const renderRoot = this.renderRoot;
|
|
535
|
+
if (renderRoot.activeElement) {
|
|
536
|
+
renderRoot.activeElement.blur();
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
this.setItemHighlight(item);
|
|
541
|
+
if (!this.compact) {
|
|
542
|
+
this.setOpenedMenu(item);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Provide keyboard item selection
|
|
548
|
+
* @param event Keyup event
|
|
549
|
+
* @return {void}
|
|
550
|
+
*/
|
|
551
|
+
onKeyUp(event) {
|
|
552
|
+
if (!this.isActive || event.defaultPrevented) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
switch (event.key) {
|
|
556
|
+
case ' ': // space
|
|
557
|
+
case 'Spacebar': // space
|
|
558
|
+
case 'Enter':
|
|
559
|
+
this.onEnter();
|
|
560
|
+
break;
|
|
561
|
+
default:
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
event.preventDefault();
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Provide keyboard navigation
|
|
568
|
+
* @param event Keydown event
|
|
569
|
+
* @return {void}
|
|
570
|
+
*/
|
|
571
|
+
onKeyDown(event) {
|
|
572
|
+
if (!this.isActive || event.defaultPrevented) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
switch (event.key) {
|
|
576
|
+
case 'Down':
|
|
577
|
+
case 'ArrowDown':
|
|
578
|
+
this.focusElement(1, true);
|
|
579
|
+
break;
|
|
580
|
+
case 'Up':
|
|
581
|
+
case 'ArrowUp':
|
|
582
|
+
this.focusElement(-1, true);
|
|
583
|
+
break;
|
|
584
|
+
case 'Left':
|
|
585
|
+
case 'ArrowLeft':
|
|
586
|
+
this.onArrowLeft();
|
|
587
|
+
break;
|
|
588
|
+
case 'Right':
|
|
589
|
+
case 'ArrowRight':
|
|
590
|
+
this.onArrowRight();
|
|
591
|
+
break;
|
|
592
|
+
case 'Tab':
|
|
593
|
+
this.focusElement(event.shiftKey ? -1 : 1, true);
|
|
594
|
+
break;
|
|
595
|
+
default:
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
event.preventDefault();
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Fired when mouse click event happens on the menu.
|
|
602
|
+
* @param event Tap event
|
|
603
|
+
* @return {void}
|
|
604
|
+
*/
|
|
605
|
+
onItemTap(event) {
|
|
606
|
+
const item = this.getItem(event.target);
|
|
607
|
+
if (item) {
|
|
608
|
+
// set highlighted item for mobile
|
|
609
|
+
this.setItemHighlight(item);
|
|
610
|
+
this.setOpenedMenu(item);
|
|
611
|
+
this.dispatchItemTrigger(item);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Dispatch item trigger even
|
|
616
|
+
* @param item Menu item
|
|
617
|
+
* @returns {void}
|
|
618
|
+
*/
|
|
619
|
+
dispatchItemTrigger(item) {
|
|
620
|
+
const event = new CustomEvent('item-trigger', {
|
|
621
|
+
detail: {
|
|
622
|
+
value: item.value
|
|
623
|
+
},
|
|
624
|
+
bubbles: true,
|
|
625
|
+
composed: true
|
|
626
|
+
});
|
|
627
|
+
item.dispatchEvent(event);
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Run when back item is clicked in compact mode
|
|
631
|
+
* @return {void}
|
|
632
|
+
*/
|
|
633
|
+
onBackItemTap() {
|
|
634
|
+
if (!this.fullyOpened) {
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
this.setOpened(false);
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Run when mouse is over back item in compact mode
|
|
641
|
+
* @return {void}
|
|
642
|
+
*/
|
|
643
|
+
onBackItemMouseMove() {
|
|
644
|
+
if (!this.fullyOpened) {
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
this.setItemHighlight();
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Manually execute click if return key is pressed
|
|
651
|
+
* @return {void}
|
|
652
|
+
*/
|
|
653
|
+
onEnter() {
|
|
654
|
+
const menuHighlightedItem = this.menuHighlightedItem;
|
|
655
|
+
if (menuHighlightedItem) {
|
|
656
|
+
this.setOpenedMenu(menuHighlightedItem);
|
|
657
|
+
menuHighlightedItem.click();
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Highlight next or previous highlightable element if present
|
|
662
|
+
* @param direction -1 - up/next; 1 - down/previous
|
|
663
|
+
* @param [circular=false] Set to true to have circular navigation over items
|
|
664
|
+
* @return {void}
|
|
665
|
+
*/
|
|
666
|
+
focusElement(direction, circular = false) {
|
|
667
|
+
const menuHighlightedItem = this.menuHighlightedItem;
|
|
668
|
+
const children = this.items;
|
|
669
|
+
const idx = menuHighlightedItem ? children.indexOf(menuHighlightedItem) : -1;
|
|
670
|
+
let focusElement;
|
|
671
|
+
if (direction === 1) {
|
|
672
|
+
focusElement = idx === -1 ? children[0] : children[idx + 1];
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
focusElement = idx === -1 ? children[children.length - 1] : children[idx - 1];
|
|
676
|
+
}
|
|
677
|
+
if (circular && !focusElement) {
|
|
678
|
+
focusElement = direction === 1 ? children[0] : children[children.length - 1];
|
|
679
|
+
}
|
|
680
|
+
if (focusElement) {
|
|
681
|
+
focusElement.focus();
|
|
682
|
+
this.setItemHighlight(focusElement);
|
|
683
|
+
focusElement.scrollIntoView(false);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Run when left arrow is pressed.
|
|
688
|
+
* Close current menu if possible
|
|
689
|
+
* @return {void}
|
|
690
|
+
*/
|
|
691
|
+
onArrowLeft() {
|
|
692
|
+
if (OpenedMenusManager.isNested(this)) {
|
|
693
|
+
this.setOpened(false);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Run when right arrow is pressed.
|
|
698
|
+
* Open menu if possible
|
|
699
|
+
* @return {void}
|
|
700
|
+
*/
|
|
701
|
+
onArrowRight() {
|
|
702
|
+
this.setOpenedMenu(this.menuHighlightedItem);
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Open/close nested menu
|
|
706
|
+
* @param menuItem Item to open/close menu for. Undefined to close all opened nested menus
|
|
707
|
+
* @return {void}
|
|
708
|
+
*/
|
|
709
|
+
setOpenedMenu(menuItem) {
|
|
710
|
+
const menu = menuItem && menuItem.for && this.menuIndex[menuItem.for] ? this.menuIndex[menuItem.for].menu : undefined;
|
|
711
|
+
menu && this.insertNestedMenu(menu);
|
|
712
|
+
OpenedMenusManager.toggleNestedMenuFor(this, menuItem);
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Highlight an item with all ancestors to the top menu
|
|
716
|
+
* @param [item] An item to highlight
|
|
717
|
+
* @return {void}
|
|
718
|
+
*/
|
|
719
|
+
setItemHighlight(item) {
|
|
720
|
+
if (this.menuHighlightedItem === item) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
if (this.menuHighlightedItem) {
|
|
724
|
+
this.menuHighlightedItem.highlighted = false;
|
|
725
|
+
}
|
|
726
|
+
this.menuHighlightedItem = item;
|
|
727
|
+
if (item) {
|
|
728
|
+
item.highlighted = true;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Check whether an item can be highlighted
|
|
733
|
+
* @param item Item to check
|
|
734
|
+
* @return true of the item can be highlighted
|
|
735
|
+
*/
|
|
736
|
+
isHighlightable(item) {
|
|
737
|
+
return item.highlightable && !!item.offsetHeight;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Get first ef-item in the ancestor tree
|
|
741
|
+
* @param target HTML element to start searching from
|
|
742
|
+
* @return item item if found
|
|
743
|
+
*/
|
|
744
|
+
getItem(target) {
|
|
745
|
+
if (!target) {
|
|
746
|
+
return null;
|
|
747
|
+
}
|
|
748
|
+
let node = target;
|
|
749
|
+
const items = this.items;
|
|
750
|
+
while (node) {
|
|
751
|
+
if (node instanceof Item && items.includes(node)) {
|
|
752
|
+
return node;
|
|
753
|
+
}
|
|
754
|
+
if (node === this) {
|
|
755
|
+
return null;
|
|
756
|
+
}
|
|
757
|
+
node = node.parentNode;
|
|
758
|
+
}
|
|
759
|
+
return null;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Run when `data` collection has been set or updated
|
|
763
|
+
* @return {void}
|
|
764
|
+
*/
|
|
765
|
+
onDataChange() {
|
|
766
|
+
// OpenedMenusManager.toggleNestedMenuFor(this);
|
|
767
|
+
this.onMenuReHighlight();
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Run when the default slot items have changed
|
|
771
|
+
* @return {void}
|
|
772
|
+
*/
|
|
773
|
+
onSlotChange() {
|
|
774
|
+
// closes opened child menu if any
|
|
775
|
+
// OpenedMenusManager.toggleNestedMenuFor(this);
|
|
776
|
+
this.onMenuReHighlight();
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* If data has changed, try to keep the highlighted item unless
|
|
780
|
+
* highlighted item has been removed itself
|
|
781
|
+
* @returns {void}
|
|
782
|
+
*/
|
|
783
|
+
onMenuReHighlight() {
|
|
784
|
+
const highlighted = this.menuHighlightedItem;
|
|
785
|
+
if (highlighted && !this.items.includes(highlighted)) {
|
|
786
|
+
this.setItemHighlight();
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Insert nested menu if it is not attached
|
|
791
|
+
* For `data` menus only
|
|
792
|
+
* @param menu Menu element
|
|
793
|
+
* @return {void}
|
|
794
|
+
*/
|
|
795
|
+
insertNestedMenu(menu) {
|
|
796
|
+
if (menu.parentNode || !this.parentNode) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
if (this.nextElementSibling) {
|
|
800
|
+
this.parentNode.insertBefore(menu, this.nextElementSibling);
|
|
801
|
+
}
|
|
802
|
+
else {
|
|
803
|
+
this.parentNode.appendChild(menu);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Create overlay menu from items
|
|
808
|
+
* Inherit properties from current menu
|
|
809
|
+
* @return menu element
|
|
810
|
+
*/
|
|
811
|
+
toOverlayMenu() {
|
|
812
|
+
const menu = document.createElement('ef-overlay-menu');
|
|
813
|
+
menu.transitionStyle = this.transitionStyle;
|
|
814
|
+
menu.noCancelOnOutsideClick = true;
|
|
815
|
+
menu.compact = this.compact;
|
|
816
|
+
menu.id = getId();
|
|
817
|
+
return menu;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Create template for menu item
|
|
821
|
+
* @param item JSON object to parse
|
|
822
|
+
* @return template result
|
|
823
|
+
*/
|
|
824
|
+
toItem(item) {
|
|
825
|
+
const composer = this.composer;
|
|
826
|
+
const type = composer.getItemPropertyValue(item, 'type');
|
|
827
|
+
if (type === 'divider') {
|
|
828
|
+
return html `<ef-item type="divider"></ef-item>`;
|
|
829
|
+
}
|
|
830
|
+
const tooltip = composer.getItemPropertyValue(item, 'tooltip');
|
|
831
|
+
const label = composer.getItemPropertyValue(item, 'label');
|
|
832
|
+
const icon = composer.getItemPropertyValue(item, 'icon');
|
|
833
|
+
if (type === 'header') {
|
|
834
|
+
return html `<ef-item
|
|
835
|
+
type="header"
|
|
836
|
+
title=${ifDefined(tooltip || undefined)}
|
|
837
|
+
.label=${label}
|
|
838
|
+
.icon=${icon}></ef-item>`;
|
|
839
|
+
}
|
|
840
|
+
const disabled = composer.getItemPropertyValue(item, 'disabled');
|
|
841
|
+
const selected = composer.getItemPropertyValue(item, 'selected');
|
|
842
|
+
const readonly = composer.getItemPropertyValue(item, 'readonly');
|
|
843
|
+
const subLabel = composer.getItemPropertyValue(item, 'subLabel');
|
|
844
|
+
const value = composer.getItemPropertyValue(item, 'value');
|
|
845
|
+
const forMenu = composer.getItemPropertyValue(item, 'for');
|
|
846
|
+
const highlighted = composer.getItemPropertyValue(item, 'highlighted');
|
|
847
|
+
// type text
|
|
848
|
+
return html `<ef-item
|
|
849
|
+
title=${ifDefined(tooltip || undefined)}
|
|
850
|
+
?disabled=${disabled}
|
|
851
|
+
?selected=${selected}
|
|
852
|
+
?highlighted=${highlighted}
|
|
853
|
+
?readonly=${readonly}
|
|
854
|
+
.label=${label}
|
|
855
|
+
.subLabel=${subLabel}
|
|
856
|
+
.icon=${icon}
|
|
857
|
+
.value=${value}
|
|
858
|
+
.for=${ifDefined(forMenu || undefined)}>
|
|
859
|
+
</ef-item>`;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Construct items from data
|
|
863
|
+
* @returns {TemplateResult} Template result
|
|
864
|
+
*/
|
|
865
|
+
get fromDataItems() {
|
|
866
|
+
if (!this.lazyRendered) {
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
return this.getAllComposedData().map(this.toItem);
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Construct back item for compact menu
|
|
873
|
+
* @returns {TemplateResult} Template result
|
|
874
|
+
*/
|
|
875
|
+
compactBackItem() {
|
|
876
|
+
if (!this.compact || !OpenedMenusManager.isNested(this)) {
|
|
877
|
+
return undefined;
|
|
878
|
+
}
|
|
879
|
+
return html `
|
|
880
|
+
<ef-item part="menu-back" id="back" label="Back" @tap=${this.onBackItemTap} @mousemove=${this.onBackItemMouseMove}>
|
|
881
|
+
<ef-icon slot="left" icon="left"></ef-icon>
|
|
882
|
+
</ef-item>
|
|
883
|
+
`;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* A `TemplateResult` that will be used
|
|
887
|
+
* to render the updated internal template.
|
|
888
|
+
* @returns {TemplateResult} Render template
|
|
889
|
+
*/
|
|
890
|
+
render() {
|
|
891
|
+
/**
|
|
892
|
+
* Use JavaScript expressions to include property values in
|
|
893
|
+
* the element template.
|
|
894
|
+
*/
|
|
895
|
+
return html `
|
|
896
|
+
${this.compactBackItem()}
|
|
897
|
+
${this.withData ? this.fromDataItems : html `<slot @slotchange=${this.onSlotChange}></slot>`}
|
|
898
|
+
`;
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
__decorate([
|
|
902
|
+
property({ type: Boolean, reflect: true })
|
|
903
|
+
], OverlayMenu.prototype, "compact", void 0);
|
|
904
|
+
__decorate([
|
|
905
|
+
property({ type: Array, attribute: false })
|
|
906
|
+
], OverlayMenu.prototype, "values", null);
|
|
907
|
+
__decorate([
|
|
908
|
+
property({ type: String })
|
|
909
|
+
], OverlayMenu.prototype, "value", null);
|
|
910
|
+
__decorate([
|
|
911
|
+
property({ type: Object, attribute: false })
|
|
912
|
+
], OverlayMenu.prototype, "data", null);
|
|
913
|
+
__decorate([
|
|
914
|
+
property({ type: Boolean, reflect: true })
|
|
915
|
+
], OverlayMenu.prototype, "nested", void 0);
|
|
916
|
+
OverlayMenu = OverlayMenu_1 = __decorate([
|
|
917
|
+
customElement('ef-overlay-menu', {
|
|
918
|
+
alias: 'emerald-popup-menu'
|
|
919
|
+
})
|
|
920
|
+
], OverlayMenu);
|
|
921
|
+
export { OverlayMenu };
|