@refinitiv-ui/elements 5.3.3 → 5.7.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/CHANGELOG.md +70 -0
- package/lib/accordion/custom-elements.json +49 -0
- package/lib/accordion/custom-elements.md +18 -0
- package/lib/accordion/index.d.ts +76 -0
- package/lib/accordion/index.js +136 -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/custom-elements.md +22 -0
- package/lib/appstate-bar/index.d.ts +65 -0
- package/lib/appstate-bar/index.js +100 -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 +233 -0
- package/lib/autosuggest/custom-elements.md +47 -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 +75 -0
- package/lib/autosuggest/index.d.ts +534 -0
- package/lib/autosuggest/index.js +1251 -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/custom-elements.md +23 -0
- package/lib/button/index.d.ts +132 -0
- package/lib/button/index.js +223 -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/custom-elements.md +9 -0
- package/lib/button-bar/index.d.ts +76 -0
- package/lib/button-bar/index.js +155 -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/constants.d.ts +22 -0
- package/lib/calendar/constants.js +23 -0
- package/lib/calendar/custom-elements.json +199 -0
- package/lib/calendar/custom-elements.md +35 -0
- package/lib/calendar/index.d.ts +321 -0
- package/lib/calendar/index.js +906 -0
- package/lib/calendar/locales.d.ts +1 -0
- package/lib/calendar/locales.js +40 -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 +29 -0
- package/lib/calendar/types.js +1 -0
- package/lib/calendar/utils.d.ts +42 -0
- package/lib/calendar/utils.js +119 -0
- package/lib/canvas/custom-elements.json +69 -0
- package/lib/canvas/custom-elements.md +27 -0
- package/lib/canvas/index.d.ts +100 -0
- package/lib/canvas/index.js +172 -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/custom-elements.md +24 -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 +246 -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/custom-elements.md +16 -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 +491 -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 +67 -0
- package/lib/checkbox/custom-elements.md +18 -0
- package/lib/checkbox/index.d.ts +95 -0
- package/lib/checkbox/index.js +193 -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 +121 -0
- package/lib/clock/custom-elements.md +28 -0
- package/lib/clock/index.d.ts +319 -0
- package/lib/clock/index.js +581 -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/custom-elements.md +27 -0
- package/lib/collapse/index.d.ts +119 -0
- package/lib/collapse/index.js +197 -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/custom-elements.md +39 -0
- package/lib/color-dialog/elements/color-palettes.d.ts +52 -0
- package/lib/color-dialog/elements/color-palettes.js +101 -0
- package/lib/color-dialog/elements/grayscale-palettes.d.ts +67 -0
- package/lib/color-dialog/elements/grayscale-palettes.js +161 -0
- package/lib/color-dialog/elements/palettes.d.ts +65 -0
- package/lib/color-dialog/elements/palettes.js +132 -0
- package/lib/color-dialog/helpers/color-helpers.d.ts +16 -0
- package/lib/color-dialog/helpers/color-helpers.js +161 -0
- package/lib/color-dialog/helpers/value-model.d.ts +75 -0
- package/lib/color-dialog/helpers/value-model.js +141 -0
- package/lib/color-dialog/index.d.ts +232 -0
- package/lib/color-dialog/index.js +459 -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 +210 -0
- package/lib/combo-box/custom-elements.md +35 -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/custom-elements.md +11 -0
- package/lib/counter/index.d.ts +89 -0
- package/lib/counter/index.js +152 -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/custom-elements.md +49 -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 +57 -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/custom-elements.md +47 -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/custom-elements.md +35 -0
- package/lib/email-field/index.d.ts +152 -0
- package/lib/email-field/index.js +286 -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 +1 -0
- package/lib/flag/custom-elements.json +35 -0
- package/lib/flag/custom-elements.md +10 -0
- package/lib/flag/index.d.ts +94 -0
- package/lib/flag/index.js +166 -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/custom-elements.md +18 -0
- package/lib/header/index.d.ts +46 -0
- package/lib/header/index.js +73 -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/custom-elements.md +26 -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 +1103 -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 +36 -0
- package/lib/icon/custom-elements.md +8 -0
- package/lib/icon/index.d.ts +88 -0
- package/lib/icon/index.js +169 -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 +52 -0
- package/lib/icon/utils/IconLoader.js +93 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/interactive-chart/custom-elements.json +86 -0
- package/lib/interactive-chart/custom-elements.md +32 -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 +1090 -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 +151 -0
- package/lib/item/custom-elements.md +29 -0
- package/lib/item/helpers/types.d.ts +57 -0
- package/lib/item/helpers/types.js +1 -0
- package/lib/item/index.d.ts +158 -0
- package/lib/item/index.js +271 -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/custom-elements.md +11 -0
- package/lib/label/index.d.ts +102 -0
- package/lib/label/index.js +244 -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/custom-elements.md +26 -0
- package/lib/layout/index.d.ts +107 -0
- package/lib/layout/index.js +212 -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/custom-elements.md +17 -0
- package/lib/led-gauge/index.d.ts +143 -0
- package/lib/led-gauge/index.js +437 -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/custom-elements.md +30 -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 +600 -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/custom-elements.md +5 -0
- package/lib/loader/index.d.ts +41 -0
- package/lib/loader/index.js +61 -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/custom-elements.md +43 -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 +590 -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/custom-elements.md +26 -0
- package/lib/notification/elements/notification-tray.d.ts +97 -0
- package/lib/notification/elements/notification-tray.js +167 -0
- package/lib/notification/elements/notification.d.ts +90 -0
- package/lib/notification/elements/notification.js +154 -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/custom-elements.md +37 -0
- package/lib/number-field/index.d.ts +294 -0
- package/lib/number-field/index.js +707 -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 +345 -0
- package/lib/overlay/custom-elements.md +54 -0
- package/lib/overlay/elements/overlay-backdrop.d.ts +46 -0
- package/lib/overlay/elements/overlay-backdrop.js +64 -0
- package/lib/overlay/elements/overlay-viewport.d.ts +40 -0
- package/lib/overlay/elements/overlay-viewport.js +52 -0
- package/lib/overlay/elements/overlay.d.ts +403 -0
- package/lib/overlay/elements/overlay.js +1426 -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 +211 -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 +194 -0
- package/lib/overlay-menu/custom-elements.md +44 -0
- package/lib/overlay-menu/helpers/types.d.ts +8 -0
- package/lib/overlay-menu/helpers/types.js +1 -0
- package/lib/overlay-menu/index.d.ts +385 -0
- package/lib/overlay-menu/index.js +933 -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/custom-elements.md +27 -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 +398 -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/custom-elements.md +11 -0
- package/lib/panel/index.d.ts +48 -0
- package/lib/panel/index.js +74 -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/custom-elements.md +31 -0
- package/lib/password-field/index.d.ts +141 -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/custom-elements.md +22 -0
- package/lib/pill/index.d.ts +97 -0
- package/lib/pill/index.js +160 -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/custom-elements.md +18 -0
- package/lib/progress-bar/index.d.ts +82 -0
- package/lib/progress-bar/index.js +157 -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 +82 -0
- package/lib/radio-button/custom-elements.md +19 -0
- package/lib/radio-button/index.d.ts +122 -0
- package/lib/radio-button/index.js +257 -0
- package/lib/radio-button/radio-button-registry.d.ts +22 -0
- package/lib/radio-button/radio-button-registry.js +93 -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/custom-elements.md +17 -0
- package/lib/rating/index.d.ts +91 -0
- package/lib/rating/index.js +157 -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/custom-elements.md +33 -0
- package/lib/search-field/index.d.ts +134 -0
- package/lib/search-field/index.js +253 -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/custom-elements.md +24 -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/custom-elements.md +22 -0
- package/lib/sidebar-layout/index.d.ts +69 -0
- package/lib/sidebar-layout/index.js +134 -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/custom-elements.md +28 -0
- package/lib/slider/index.d.ts +409 -0
- package/lib/slider/index.js +1187 -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/custom-elements.md +16 -0
- package/lib/sparkline/index.d.ts +107 -0
- package/lib/sparkline/index.js +186 -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/custom-elements.md +17 -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/custom-elements.md +22 -0
- package/lib/tab/index.d.ts +118 -0
- package/lib/tab/index.js +208 -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/custom-elements.md +11 -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 +218 -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/custom-elements.md +37 -0
- package/lib/text-field/index.d.ts +193 -0
- package/lib/text-field/index.js +409 -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/custom-elements.md +28 -0
- package/lib/time-picker/index.d.ts +379 -0
- package/lib/time-picker/index.js +775 -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 +82 -0
- package/lib/toggle/custom-elements.md +19 -0
- package/lib/toggle/index.d.ts +86 -0
- package/lib/toggle/index.js +152 -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/custom-elements.md +14 -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 +477 -0
- package/lib/tooltip/managers/tooltip-manager.d.ts +15 -0
- package/lib/tooltip/managers/tooltip-manager.js +140 -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/custom-elements.md +18 -0
- package/lib/tornado-chart/elements/tornado-chart.d.ts +78 -0
- package/lib/tornado-chart/elements/tornado-chart.js +122 -0
- package/lib/tornado-chart/elements/tornado-item.d.ts +110 -0
- package/lib/tornado-chart/elements/tornado-item.js +207 -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 +113 -0
- package/lib/tree/custom-elements.md +32 -0
- package/lib/tree/elements/tree-item.d.ts +96 -0
- package/lib/tree/elements/tree-item.js +179 -0
- package/lib/tree/elements/tree.d.ts +201 -0
- package/lib/tree/elements/tree.js +412 -0
- package/lib/tree/helpers/filter.d.ts +8 -0
- package/lib/tree/helpers/filter.js +33 -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 +25 -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 +248 -0
- package/lib/tree/managers/tree-manager.js +395 -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/custom-elements.md +26 -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 +402 -0
- package/lib/tree-select/index.js +890 -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/lib/version.d.ts +1 -0
- package/lib/version.js +1 -0
- package/package.json +298 -15
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
|
|
3
|
+
import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
|
|
4
|
+
import { VERSION } from '../../version.js';
|
|
5
|
+
import { List } from '../../list/index.js';
|
|
6
|
+
import { TreeRenderer } from '../helpers/renderer.js';
|
|
7
|
+
import { defaultFilter } from '../helpers/filter.js';
|
|
8
|
+
import { TreeManager, TreeManagerMode } from '../managers/tree-manager.js';
|
|
9
|
+
const EXPAND_TOGGLE_ATTR = 'expand-toggle';
|
|
10
|
+
/**
|
|
11
|
+
* Displays a tree structure
|
|
12
|
+
* to be used for menus and group selections
|
|
13
|
+
*
|
|
14
|
+
* @fires value-changed - Fired when the users changed selection item.
|
|
15
|
+
* @fires expanded-changed - Fired when an item's expanded state has changed.
|
|
16
|
+
*
|
|
17
|
+
* @attr {boolean} [stateless=false] - Disable selections
|
|
18
|
+
* @prop {boolean} [stateless=false] - Disable selections
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
let Tree = class Tree extends List {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
/**
|
|
25
|
+
* Tree manager used for manipulation
|
|
26
|
+
*/
|
|
27
|
+
this.manager = new TreeManager(this.composer);
|
|
28
|
+
/**
|
|
29
|
+
* Allows multiple items to be selected
|
|
30
|
+
*/
|
|
31
|
+
this.multiple = false;
|
|
32
|
+
/**
|
|
33
|
+
* Breaks the relationship when multiple
|
|
34
|
+
* selection mode is enabled
|
|
35
|
+
*/
|
|
36
|
+
this.noRelation = false;
|
|
37
|
+
/**
|
|
38
|
+
* Query string applied to tree
|
|
39
|
+
*/
|
|
40
|
+
this.query = '';
|
|
41
|
+
/**
|
|
42
|
+
* Custom filter for static data
|
|
43
|
+
* @type {TreeFilter<T> | null}
|
|
44
|
+
* @ignore set to protected for now and need to discuss before set to public API
|
|
45
|
+
*/
|
|
46
|
+
this.filter = defaultFilter(this);
|
|
47
|
+
/**
|
|
48
|
+
* Renderer used for generating tree items
|
|
49
|
+
* @type {TreeRenderer}
|
|
50
|
+
*/
|
|
51
|
+
this.renderer = new TreeRenderer(this);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Element version number
|
|
55
|
+
* @returns version number
|
|
56
|
+
*/
|
|
57
|
+
static get version() {
|
|
58
|
+
return VERSION;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Expands all groups
|
|
62
|
+
* @returns {void}
|
|
63
|
+
*/
|
|
64
|
+
expandAll() {
|
|
65
|
+
this.manager.expandAllItems();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Collapses all groups
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
collapseAll() {
|
|
72
|
+
this.manager.collapseAllItems();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Checks all editable items
|
|
76
|
+
* @returns {void}
|
|
77
|
+
*/
|
|
78
|
+
checkAll() {
|
|
79
|
+
if (!this.multiple) {
|
|
80
|
+
throw new RangeError('You cannot check all items in single selection mode');
|
|
81
|
+
}
|
|
82
|
+
this.manager.checkAllItems();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Unchecks all editable items
|
|
86
|
+
* @returns {void}
|
|
87
|
+
*/
|
|
88
|
+
uncheckAll() {
|
|
89
|
+
this.manager.uncheckAllItems();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @override
|
|
93
|
+
* @ignore
|
|
94
|
+
*/
|
|
95
|
+
selectItem(item) {
|
|
96
|
+
// Stateless tree
|
|
97
|
+
if (this.stateless) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
// Multiple selection
|
|
101
|
+
if (this.multiple) {
|
|
102
|
+
return this.manager.toggleItem(item);
|
|
103
|
+
}
|
|
104
|
+
// Single selection - expand/collapse group (parent)
|
|
105
|
+
if (this.manager.isItemParent(item)) {
|
|
106
|
+
this.toggleExpandedState(item);
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
// Single selection - check item
|
|
110
|
+
if (this.manager.checkItem(item)) {
|
|
111
|
+
this.manager.checkedItems.forEach(checkedItem => {
|
|
112
|
+
checkedItem !== item && this.manager.uncheckItem(checkedItem);
|
|
113
|
+
});
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Dispatches an event, detailing which item has recently changed it's expanded state.
|
|
120
|
+
* @param item Data item of which the expanded property changed
|
|
121
|
+
* @returns {void}
|
|
122
|
+
*/
|
|
123
|
+
dispatchExpandedChangedEvent(item) {
|
|
124
|
+
/**
|
|
125
|
+
* Property `detail.value` is the current expanded state.
|
|
126
|
+
* Property `detail.item` is the original data item of which the property has been modified.
|
|
127
|
+
*/
|
|
128
|
+
const event = new CustomEvent('expanded-changed', {
|
|
129
|
+
bubbles: false,
|
|
130
|
+
cancelable: false,
|
|
131
|
+
composed: true,
|
|
132
|
+
detail: {
|
|
133
|
+
value: this.manager.isItemExpanded(item),
|
|
134
|
+
item
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
this.dispatchEvent(event);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Handles tap event when composed path contains
|
|
141
|
+
* an element with an `expand-toggle` attribute.
|
|
142
|
+
* @param event Tap event to try and handle
|
|
143
|
+
* @returns True or False depending if the event was handled
|
|
144
|
+
*/
|
|
145
|
+
handleExpandCollapse(event) {
|
|
146
|
+
const containsToggle = event.composedPath().some((target) => target instanceof HTMLElement && target.hasAttribute(EXPAND_TOGGLE_ATTR));
|
|
147
|
+
const itemElement = containsToggle && this.findItemElementFromTarget(event.target);
|
|
148
|
+
const item = itemElement && this.itemFromElement(itemElement);
|
|
149
|
+
if (item) {
|
|
150
|
+
this.toggleExpandedState(item);
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @override
|
|
157
|
+
*/
|
|
158
|
+
onTap(event) {
|
|
159
|
+
if (this.handleExpandCollapse(event)) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
super.onTap(event);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @override
|
|
166
|
+
*/
|
|
167
|
+
onKeyDown(event) {
|
|
168
|
+
switch (event.key) {
|
|
169
|
+
case 'Left':
|
|
170
|
+
case 'ArrowLeft':
|
|
171
|
+
this.left();
|
|
172
|
+
break;
|
|
173
|
+
case 'Right':
|
|
174
|
+
case 'ArrowRight':
|
|
175
|
+
this.right();
|
|
176
|
+
break;
|
|
177
|
+
default:
|
|
178
|
+
return super.onKeyDown(event);
|
|
179
|
+
}
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Performs left arrow keyboard action,
|
|
184
|
+
* collapsing a group item if possible.
|
|
185
|
+
* @returns {void}
|
|
186
|
+
*/
|
|
187
|
+
left() {
|
|
188
|
+
const item = this.highlightElement && this.itemFromElement(this.highlightElement);
|
|
189
|
+
if (item && this.manager.isItemExpanded(item)) {
|
|
190
|
+
this.manager.collapseItem(item);
|
|
191
|
+
this.dispatchExpandedChangedEvent(item);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Performs right arrow keyboard action,
|
|
196
|
+
* expanding a group item if possible.
|
|
197
|
+
* @returns {void}
|
|
198
|
+
*/
|
|
199
|
+
right() {
|
|
200
|
+
const item = this.highlightElement && this.itemFromElement(this.highlightElement);
|
|
201
|
+
if (item && !this.manager.isItemExpanded(item)) {
|
|
202
|
+
this.manager.expandItem(item);
|
|
203
|
+
this.dispatchExpandedChangedEvent(item);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Toggles the expanded state of an item.
|
|
208
|
+
* Executed when a user taps on an item to expand/collapse the group.
|
|
209
|
+
* @param item Original data item
|
|
210
|
+
* @returns {void}
|
|
211
|
+
*/
|
|
212
|
+
toggleExpandedState(item) {
|
|
213
|
+
if (this.manager.isItemExpanded(item)) {
|
|
214
|
+
this.manager.collapseItem(item);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
this.manager.expandItem(item);
|
|
218
|
+
}
|
|
219
|
+
this.dispatchExpandedChangedEvent(item);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* @override
|
|
223
|
+
*/
|
|
224
|
+
queryItems(engine) {
|
|
225
|
+
return this.composer.queryItems(engine, Infinity);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* @override
|
|
229
|
+
*/
|
|
230
|
+
queryItemsByPropertyValue(property, value) {
|
|
231
|
+
return this.composer.queryItemsByPropertyValue(property, value, Infinity);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* @override
|
|
235
|
+
*/
|
|
236
|
+
update(changedProperties) {
|
|
237
|
+
if (changedProperties.has('noRelation') || changedProperties.has('multiple')) {
|
|
238
|
+
this.manager.setMode(this.mode);
|
|
239
|
+
}
|
|
240
|
+
if (changedProperties.has('query') || changedProperties.has('data')) {
|
|
241
|
+
this.filterItems();
|
|
242
|
+
}
|
|
243
|
+
super.update(changedProperties);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Filter the internal items by query changes items' hidden state
|
|
247
|
+
* @returns {void}
|
|
248
|
+
*/
|
|
249
|
+
filterItems() {
|
|
250
|
+
// if filter is null, it is off and external app is responsible
|
|
251
|
+
if (this.filter) {
|
|
252
|
+
const filter = this.filter;
|
|
253
|
+
const items = this.queryItems((item) => {
|
|
254
|
+
// Do not filter hidden items
|
|
255
|
+
if (item.hidden) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
const result = filter(item);
|
|
259
|
+
if (result) {
|
|
260
|
+
this.manager.includeItem(item);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
this.manager.excludeItem(item);
|
|
264
|
+
}
|
|
265
|
+
return result;
|
|
266
|
+
}).slice();
|
|
267
|
+
// Do not expand tree if there is no filter applied
|
|
268
|
+
if (this.query) {
|
|
269
|
+
/**
|
|
270
|
+
* Add all descendants of item list to make the descendants
|
|
271
|
+
* are accessible which user can navigate into the nested data
|
|
272
|
+
*/
|
|
273
|
+
this.addItemDescendantsToRender(items);
|
|
274
|
+
/**
|
|
275
|
+
* Add all parents of item list which they must be shown
|
|
276
|
+
* when some descendant is shown.
|
|
277
|
+
*/
|
|
278
|
+
this.addExpandedAncestorsToRender(items);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Utility method
|
|
284
|
+
* Adds descendants for each item passed
|
|
285
|
+
* @param items List of child items
|
|
286
|
+
* @returns {void}
|
|
287
|
+
*/
|
|
288
|
+
addItemDescendantsToRender(items) {
|
|
289
|
+
items.forEach((item) => {
|
|
290
|
+
/**
|
|
291
|
+
* Collapse an item to prevent tree show too many nested expanded
|
|
292
|
+
*/
|
|
293
|
+
if (this.manager.isItemExpanded(item)) {
|
|
294
|
+
this.manager.collapseItem(item);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* show all descendants of items to make them all are selectable
|
|
298
|
+
* and user can navigate into nested data
|
|
299
|
+
*/
|
|
300
|
+
const children = this.composer.getItemChildren(item);
|
|
301
|
+
if (children.length) {
|
|
302
|
+
this.addNestedItemsToRender(children, items, false);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Utility method
|
|
308
|
+
* Add nested children of item list
|
|
309
|
+
* @param items List of items
|
|
310
|
+
* @param excludeItems List of exclude items
|
|
311
|
+
* @param [includeHidden=false] Include hidden items
|
|
312
|
+
* @returns {void}
|
|
313
|
+
*/
|
|
314
|
+
addNestedItemsToRender(items, excludeItems, includeHidden = false) {
|
|
315
|
+
items.forEach(item => {
|
|
316
|
+
// Skip hidden and exclude item
|
|
317
|
+
if (!item.hidden && !excludeItems.includes(item)) {
|
|
318
|
+
// Add item and nested children
|
|
319
|
+
this.manager.includeItem(item);
|
|
320
|
+
const children = this.manager.getItemChildren(item);
|
|
321
|
+
if (children.length) {
|
|
322
|
+
this.addNestedItemsToRender(children, excludeItems, includeHidden);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Utility method
|
|
329
|
+
* Adds ancestors for each item passed and expand
|
|
330
|
+
* @param items List of child items
|
|
331
|
+
* @returns {void}
|
|
332
|
+
*/
|
|
333
|
+
addExpandedAncestorsToRender(items) {
|
|
334
|
+
// Establish unique ancestors set
|
|
335
|
+
const ancestors = new Set();
|
|
336
|
+
// we iterate each item match so as to find ancestors
|
|
337
|
+
items.forEach((item) => {
|
|
338
|
+
// Get the ancestors
|
|
339
|
+
const parent = this.manager.getItemParent(item);
|
|
340
|
+
if (parent && !ancestors.has(parent)) {
|
|
341
|
+
this.manager.getItemAncestors(item).forEach((ancestor) => {
|
|
342
|
+
ancestors.add(ancestor); // track ancestors
|
|
343
|
+
this.addExpandedAncestorToRender(ancestor);
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Utility method
|
|
350
|
+
* Adds parent and expands
|
|
351
|
+
* @param ancestor parent item
|
|
352
|
+
* @returns {void}
|
|
353
|
+
*/
|
|
354
|
+
addExpandedAncestorToRender(ancestor) {
|
|
355
|
+
this.manager.includeItem(ancestor);
|
|
356
|
+
this.manager.expandItem(ancestor);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Selected items in tree
|
|
360
|
+
* @override
|
|
361
|
+
* @type {string[]}
|
|
362
|
+
*/
|
|
363
|
+
get values() {
|
|
364
|
+
return this.manager.checkedItems.map(item => {
|
|
365
|
+
return this.composer.getItemPropertyValue(item, 'value') || '';
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
set values(value) {
|
|
369
|
+
super.values = value;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Data object to be used for creating tree
|
|
373
|
+
* @override
|
|
374
|
+
* @type {TreeData<T>}
|
|
375
|
+
*/
|
|
376
|
+
get data() {
|
|
377
|
+
return super.data;
|
|
378
|
+
}
|
|
379
|
+
set data(data) {
|
|
380
|
+
super.data = data;
|
|
381
|
+
this.manager = new TreeManager(this.composer, this.mode);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* @override
|
|
385
|
+
*/
|
|
386
|
+
get renderItems() {
|
|
387
|
+
return this.manager.visibleItems;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Mode to use in the tree manager
|
|
391
|
+
*/
|
|
392
|
+
get mode() {
|
|
393
|
+
return !this.multiple || !this.noRelation
|
|
394
|
+
? TreeManagerMode.RELATIONAL : TreeManagerMode.INDEPENDENT;
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
__decorate([
|
|
398
|
+
property({ type: Boolean })
|
|
399
|
+
], Tree.prototype, "multiple", void 0);
|
|
400
|
+
__decorate([
|
|
401
|
+
property({ attribute: 'no-relation', type: Boolean })
|
|
402
|
+
], Tree.prototype, "noRelation", void 0);
|
|
403
|
+
__decorate([
|
|
404
|
+
property({ type: String })
|
|
405
|
+
], Tree.prototype, "query", void 0);
|
|
406
|
+
__decorate([
|
|
407
|
+
property({ attribute: false })
|
|
408
|
+
], Tree.prototype, "renderer", void 0);
|
|
409
|
+
Tree = __decorate([
|
|
410
|
+
customElement('ef-tree')
|
|
411
|
+
], Tree);
|
|
412
|
+
export { Tree };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Tree, TreeDataItem } from '../index';
|
|
2
|
+
import type { TreeFilter } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Default filter used by tree
|
|
5
|
+
* @param el Tree instance to filter
|
|
6
|
+
* @returns Filter accepting an item
|
|
7
|
+
*/
|
|
8
|
+
export declare const defaultFilter: <T extends TreeDataItem = TreeDataItem>(el: Tree<T>) => TreeFilter<T>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default filter used by tree
|
|
3
|
+
* @param el Tree instance to filter
|
|
4
|
+
* @returns Filter accepting an item
|
|
5
|
+
*/
|
|
6
|
+
export const defaultFilter = (el) => {
|
|
7
|
+
// reference query string for validating queryRegExp cache state
|
|
8
|
+
let query = '';
|
|
9
|
+
// cache RegExp
|
|
10
|
+
let queryRegExp;
|
|
11
|
+
// Get current RegExp, or renew if out of date
|
|
12
|
+
// this is fetched on demand by filter/renderer
|
|
13
|
+
// only created once per query
|
|
14
|
+
const getRegularExpressionOfQuery = () => {
|
|
15
|
+
if (el.query !== query || !queryRegExp) {
|
|
16
|
+
query = el.query || '';
|
|
17
|
+
queryRegExp = new RegExp(query.replace(/(\W)/g, '\\$1'), 'i');
|
|
18
|
+
}
|
|
19
|
+
return queryRegExp;
|
|
20
|
+
};
|
|
21
|
+
// return scoped custom filter
|
|
22
|
+
return (item) => {
|
|
23
|
+
const label = item.label;
|
|
24
|
+
if (!label) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const regex = getRegularExpressionOfQuery();
|
|
28
|
+
const result = regex.test(label);
|
|
29
|
+
// this regex uses global scope, so the index needs resetting
|
|
30
|
+
regex.lastIndex = 0;
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TreeManager, TreeManagerMode, CheckedState } from '../managers/tree-manager.js';
|
|
2
|
+
import { Renderer } from '../../list/renderer.js';
|
|
3
|
+
import '../elements/tree-item.js';
|
|
4
|
+
export class TreeRenderer extends Renderer {
|
|
5
|
+
constructor(scope) {
|
|
6
|
+
let manager;
|
|
7
|
+
let currentMode;
|
|
8
|
+
let currentComposer;
|
|
9
|
+
super((item, composer, element = document.createElement('ef-tree-item')) => {
|
|
10
|
+
const el = element;
|
|
11
|
+
const multiple = !!scope && scope.multiple === true;
|
|
12
|
+
const noRelation = !!scope && scope.noRelation === true;
|
|
13
|
+
const mode = !multiple || !noRelation ? TreeManagerMode.RELATIONAL : TreeManagerMode.INDEPENDENT;
|
|
14
|
+
if (currentComposer !== composer || currentMode !== mode) {
|
|
15
|
+
currentMode = mode;
|
|
16
|
+
currentComposer = composer;
|
|
17
|
+
manager = new TreeManager(composer, mode);
|
|
18
|
+
}
|
|
19
|
+
el.multiple = multiple;
|
|
20
|
+
el.item = item;
|
|
21
|
+
el.depth = composer.getItemDepth(item);
|
|
22
|
+
el.parent = composer.getItemChildren(item).length > 0;
|
|
23
|
+
el.expanded = manager.isItemExpanded(item);
|
|
24
|
+
el.checkedState = !multiple && el.parent ? CheckedState.UNCHECKED : manager.getItemCheckedState(item);
|
|
25
|
+
el.icon = composer.getItemPropertyValue(item, 'icon');
|
|
26
|
+
el.label = composer.getItemPropertyValue(item, 'label');
|
|
27
|
+
el.disabled = composer.getItemPropertyValue(item, 'disabled') === true;
|
|
28
|
+
el.readonly = composer.getItemPropertyValue(item, 'readonly') === true;
|
|
29
|
+
el.highlighted = composer.getItemPropertyValue(item, 'highlighted') === true;
|
|
30
|
+
return el;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CollectionComposer, DataItem } from '@refinitiv-ui/utils/lib/collection';
|
|
2
|
+
export declare type TreeData<T extends TreeDataItem = TreeDataItem> = T[] | CollectionComposer<T> | null;
|
|
3
|
+
export interface TreeDataItem extends DataItem {
|
|
4
|
+
/**
|
|
5
|
+
* Icon to show, when rendering the item.
|
|
6
|
+
*/
|
|
7
|
+
icon?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Label to show, when rendering the item.
|
|
10
|
+
*/
|
|
11
|
+
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Expanded state of child items.
|
|
14
|
+
* If `true`, child items will be visible
|
|
15
|
+
*/
|
|
16
|
+
expanded?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Predicate callback
|
|
20
|
+
* Matches item against filter function
|
|
21
|
+
*
|
|
22
|
+
* @param item Item to filter
|
|
23
|
+
* @return Does item match filter
|
|
24
|
+
*/
|
|
25
|
+
export declare type TreeFilter<T extends TreeDataItem = TreeDataItem> = (item: T) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|