@refinitiv-ui/elements 7.0.0-next.0 → 7.0.0-next.2
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 +115 -0
- package/cli.mjs +21 -0
- package/lib/accordion/index.js +1 -10
- package/lib/appstate-bar/custom-elements.json +2 -2
- package/lib/appstate-bar/custom-elements.md +4 -4
- package/lib/appstate-bar/index.d.ts +2 -2
- package/lib/appstate-bar/index.js +2 -8
- package/lib/appstate-bar/themes/halo/dark/index.js +1 -1
- package/lib/appstate-bar/themes/halo/light/index.js +1 -1
- package/lib/appstate-bar/themes/solar/charcoal/index.js +1 -1
- package/lib/appstate-bar/themes/solar/pearl/index.js +1 -1
- package/lib/autosuggest/custom-elements.json +8 -8
- package/lib/autosuggest/custom-elements.md +8 -8
- package/lib/autosuggest/helpers/types.d.ts +18 -18
- package/lib/autosuggest/index.d.ts +9 -32
- package/lib/autosuggest/index.js +112 -187
- package/lib/autosuggest/themes/halo/dark/index.js +1 -1
- package/lib/autosuggest/themes/halo/light/index.js +1 -1
- package/lib/autosuggest/themes/solar/charcoal/index.js +1 -1
- package/lib/autosuggest/themes/solar/pearl/index.js +1 -1
- package/lib/button/custom-elements.json +1 -1
- package/lib/button/custom-elements.md +1 -1
- package/lib/button/index.d.ts +1 -1
- package/lib/button/index.js +1 -1
- package/lib/button/themes/halo/dark/index.js +2 -1
- package/lib/button/themes/halo/light/index.js +2 -1
- package/lib/button/themes/solar/charcoal/index.js +2 -1
- package/lib/button/themes/solar/pearl/index.js +2 -1
- package/lib/button-bar/index.js +0 -5
- package/lib/calendar/custom-elements.json +2 -2
- package/lib/calendar/custom-elements.md +4 -4
- package/lib/calendar/index.d.ts +9 -2
- package/lib/calendar/index.js +27 -29
- package/lib/calendar/themes/halo/dark/index.js +1 -1
- package/lib/calendar/themes/halo/light/index.js +1 -1
- package/lib/calendar/themes/solar/charcoal/index.js +1 -1
- package/lib/calendar/themes/solar/pearl/index.js +1 -1
- package/lib/calendar/types.d.ts +5 -5
- package/lib/calendar/utils.d.ts +2 -13
- package/lib/calendar/utils.js +2 -20
- package/lib/canvas/custom-elements.json +1 -1
- package/lib/canvas/custom-elements.md +1 -1
- package/lib/canvas/index.d.ts +1 -1
- package/lib/canvas/index.js +10 -9
- package/lib/card/custom-elements.json +1 -1
- package/lib/card/custom-elements.md +3 -3
- package/lib/card/helpers/types.d.ts +1 -1
- package/lib/card/index.d.ts +2 -1
- package/lib/card/index.js +5 -4
- package/lib/card/themes/halo/dark/index.js +1 -1
- package/lib/card/themes/halo/light/index.js +1 -1
- package/lib/card/themes/solar/charcoal/index.js +1 -1
- package/lib/card/themes/solar/pearl/index.js +1 -1
- package/lib/chart/bare.d.ts +1 -0
- package/lib/chart/bare.js +1 -0
- package/lib/chart/custom-elements.json +10 -5
- package/lib/chart/custom-elements.md +9 -8
- package/lib/chart/elements/chart.d.ts +182 -0
- package/lib/chart/elements/chart.js +509 -0
- package/lib/chart/helpers/index.d.ts +1 -1
- package/lib/chart/helpers/index.js +1 -1
- package/lib/chart/helpers/merge.d.ts +3 -3
- package/lib/chart/helpers/merge.js +1 -1
- package/lib/chart/helpers/types.d.ts +1 -66
- package/lib/chart/index.d.ts +1 -192
- package/lib/chart/index.js +5 -485
- package/lib/chart/plugins/doughnut-center-label.d.ts +22 -3
- package/lib/chart/plugins/doughnut-center-label.js +62 -51
- package/lib/chart/plugins/index.d.ts +1 -0
- package/lib/chart/plugins/index.js +1 -0
- package/lib/chart/themes/halo/dark/index.js +1 -1
- package/lib/chart/themes/halo/light/index.js +1 -1
- package/lib/chart/themes/solar/charcoal/index.js +1 -1
- package/lib/chart/themes/solar/pearl/index.js +1 -1
- package/lib/checkbox/custom-elements.json +1 -1
- package/lib/checkbox/custom-elements.md +3 -3
- package/lib/checkbox/index.d.ts +1 -1
- package/lib/checkbox/index.js +1 -2
- package/lib/checkbox/themes/halo/dark/index.js +1 -1
- package/lib/checkbox/themes/halo/light/index.js +1 -1
- package/lib/checkbox/themes/solar/charcoal/index.js +1 -1
- package/lib/checkbox/themes/solar/pearl/index.js +1 -1
- package/lib/clock/custom-elements.json +2 -2
- package/lib/clock/custom-elements.md +2 -2
- package/lib/clock/index.d.ts +2 -2
- package/lib/clock/index.js +2 -6
- package/lib/clock/utils/TickManager.d.ts +1 -1
- package/lib/collapse/custom-elements.json +1 -1
- package/lib/collapse/custom-elements.md +3 -3
- package/lib/collapse/index.d.ts +7 -1
- package/lib/collapse/index.js +27 -30
- package/lib/collapse/themes/halo/dark/index.js +1 -1
- package/lib/collapse/themes/halo/light/index.js +1 -1
- package/lib/collapse/themes/solar/charcoal/index.js +1 -1
- package/lib/collapse/themes/solar/pearl/index.js +1 -1
- package/lib/color-dialog/custom-elements.json +2 -2
- package/lib/color-dialog/custom-elements.md +4 -4
- package/lib/color-dialog/helpers/value-model.js +4 -5
- package/lib/color-dialog/index.d.ts +4 -4
- package/lib/color-dialog/index.js +4 -4
- package/lib/color-picker/custom-elements.json +1 -1
- package/lib/color-picker/custom-elements.md +3 -3
- package/lib/color-picker/index.d.ts +1 -1
- package/lib/color-picker/index.js +3 -5
- package/lib/combo-box/custom-elements.json +3 -6
- package/lib/combo-box/custom-elements.md +5 -6
- package/lib/combo-box/helpers/types.d.ts +2 -2
- package/lib/combo-box/index.d.ts +3 -12
- package/lib/combo-box/index.js +15 -30
- package/lib/combo-box/themes/halo/dark/index.js +2 -1
- package/lib/combo-box/themes/halo/light/index.js +2 -1
- package/lib/combo-box/themes/solar/charcoal/index.js +2 -1
- package/lib/combo-box/themes/solar/pearl/index.js +2 -1
- package/lib/counter/themes/halo/dark/index.js +2 -1
- package/lib/counter/themes/halo/light/index.js +2 -1
- package/lib/counter/themes/solar/charcoal/index.js +2 -1
- package/lib/counter/themes/solar/pearl/index.js +2 -1
- package/lib/datetime-field/index.d.ts +2 -2
- package/lib/datetime-field/index.js +7 -12
- package/lib/datetime-field/types.d.ts +3 -3
- package/lib/datetime-field/utils.d.ts +2 -2
- package/lib/datetime-field/utils.js +2 -2
- package/lib/datetime-picker/custom-elements.json +4 -4
- package/lib/datetime-picker/custom-elements.md +4 -4
- package/lib/datetime-picker/index.d.ts +4 -4
- package/lib/datetime-picker/index.js +9 -13
- package/lib/datetime-picker/themes/halo/dark/index.js +2 -1
- package/lib/datetime-picker/themes/halo/light/index.js +2 -1
- package/lib/datetime-picker/themes/solar/charcoal/index.js +2 -1
- package/lib/datetime-picker/themes/solar/pearl/index.js +2 -1
- package/lib/datetime-picker/types.d.ts +1 -1
- package/lib/dialog/custom-elements.json +2 -13
- package/lib/dialog/custom-elements.md +4 -5
- package/lib/dialog/index.d.ts +11 -43
- package/lib/dialog/index.js +21 -80
- package/lib/dialog/themes/halo/dark/index.js +1 -1
- package/lib/dialog/themes/halo/light/index.js +1 -1
- package/lib/dialog/themes/solar/charcoal/index.js +1 -1
- package/lib/dialog/themes/solar/pearl/index.js +1 -1
- package/lib/email-field/custom-elements.json +3 -3
- package/lib/email-field/custom-elements.md +5 -5
- package/lib/email-field/index.d.ts +3 -3
- package/lib/email-field/index.js +5 -4
- package/lib/email-field/themes/halo/dark/index.js +2 -1
- package/lib/email-field/themes/halo/light/index.js +2 -1
- package/lib/email-field/themes/solar/charcoal/index.js +2 -1
- package/lib/email-field/themes/solar/pearl/index.js +2 -1
- package/lib/events.d.ts +13 -13
- package/lib/flag/custom-elements.json +2 -14
- package/lib/flag/custom-elements.md +3 -6
- package/lib/flag/index.d.ts +21 -9
- package/lib/flag/index.js +43 -24
- package/lib/header/themes/halo/dark/index.js +1 -1
- package/lib/header/themes/halo/light/index.js +1 -1
- package/lib/header/themes/solar/charcoal/index.js +1 -1
- package/lib/header/themes/solar/pearl/index.js +1 -1
- package/lib/heatmap/helpers/color.js +2 -1
- package/lib/heatmap/helpers/text.d.ts +1 -1
- package/lib/heatmap/helpers/text.js +1 -1
- package/lib/heatmap/helpers/types.d.ts +7 -7
- package/lib/heatmap/index.js +156 -140
- package/lib/icon/custom-elements.json +0 -13
- package/lib/icon/custom-elements.md +0 -1
- package/lib/icon/index.d.ts +20 -2
- package/lib/icon/index.js +41 -14
- package/lib/icon/themes/halo/dark/index.js +1 -1
- package/lib/icon/themes/halo/light/index.js +1 -1
- package/lib/icon/themes/solar/charcoal/index.js +1 -1
- package/lib/icon/themes/solar/pearl/index.js +1 -1
- package/lib/interactive-chart/custom-elements.json +1 -1
- package/lib/interactive-chart/custom-elements.md +3 -3
- package/lib/interactive-chart/helpers/merge.d.ts +2 -2
- package/lib/interactive-chart/helpers/types.d.ts +7 -7
- package/lib/interactive-chart/index.d.ts +1 -1
- package/lib/interactive-chart/index.js +5 -3
- package/lib/item/custom-elements.json +4 -4
- package/lib/item/custom-elements.md +2 -2
- package/lib/item/helpers/types.d.ts +2 -2
- package/lib/item/index.d.ts +2 -1
- package/lib/item/index.js +2 -1
- package/lib/item/themes/halo/dark/index.js +1 -1
- package/lib/item/themes/halo/light/index.js +1 -1
- package/lib/item/themes/solar/charcoal/index.js +1 -1
- package/lib/item/themes/solar/pearl/index.js +1 -1
- package/lib/label/index.js +9 -34
- package/lib/layout/index.js +0 -13
- package/lib/led-gauge/index.js +7 -7
- package/lib/list/custom-elements.json +1 -1
- package/lib/list/custom-elements.md +3 -3
- package/lib/list/elements/list.d.ts +1 -1
- package/lib/list/elements/list.js +4 -8
- package/lib/list/helpers/renderer.d.ts +0 -4
- package/lib/list/helpers/renderer.js +5 -5
- package/lib/list/helpers/types.d.ts +1 -1
- package/lib/list/themes/halo/dark/index.js +2 -2
- package/lib/list/themes/halo/light/index.js +2 -2
- package/lib/list/themes/solar/charcoal/index.js +2 -2
- package/lib/list/themes/solar/pearl/index.js +2 -2
- package/lib/multi-input/custom-elements.json +5 -5
- package/lib/multi-input/custom-elements.md +5 -5
- package/lib/multi-input/helpers/types.d.ts +3 -3
- package/lib/multi-input/index.d.ts +5 -17
- package/lib/multi-input/index.js +8 -21
- package/lib/multi-input/themes/halo/dark/index.js +1 -1
- package/lib/multi-input/themes/halo/light/index.js +1 -1
- package/lib/multi-input/themes/solar/charcoal/index.js +1 -1
- package/lib/multi-input/themes/solar/pearl/index.js +1 -1
- package/lib/notification/custom-elements.json +2 -2
- package/lib/notification/custom-elements.md +4 -4
- package/lib/notification/elements/notification.d.ts +2 -2
- package/lib/notification/elements/notification.js +2 -2
- package/lib/notification/helpers/types.d.ts +2 -2
- package/lib/number-field/custom-elements.json +2 -2
- package/lib/number-field/custom-elements.md +4 -4
- package/lib/number-field/index.d.ts +4 -4
- package/lib/number-field/index.js +24 -19
- package/lib/number-field/themes/halo/dark/index.js +2 -1
- package/lib/number-field/themes/halo/light/index.js +2 -1
- package/lib/number-field/themes/solar/charcoal/index.js +2 -1
- package/lib/number-field/themes/solar/pearl/index.js +2 -1
- package/lib/overlay/custom-elements.json +6 -9
- package/lib/overlay/custom-elements.md +7 -8
- package/lib/overlay/elements/overlay-backdrop.d.ts +1 -8
- package/lib/overlay/elements/overlay-backdrop.js +3 -13
- package/lib/overlay/elements/overlay-viewport.d.ts +1 -8
- package/lib/overlay/elements/overlay-viewport.js +3 -13
- package/lib/overlay/elements/overlay.d.ts +7 -15
- package/lib/overlay/elements/overlay.js +13 -55
- package/lib/overlay/helpers/types.d.ts +13 -13
- package/lib/overlay/managers/close-manager.d.ts +1 -1
- package/lib/overlay/managers/close-manager.js +6 -4
- package/lib/overlay/managers/focus-manager.js +2 -1
- package/lib/overlay/managers/interaction-lock-manager.js +1 -1
- package/lib/overlay/managers/viewport-manager.js +3 -0
- package/lib/overlay/managers/zindex-manager.d.ts +1 -1
- package/lib/overlay/managers/zindex-manager.js +1 -1
- package/lib/overlay/themes/halo/dark/index.js +1 -1
- package/lib/overlay/themes/halo/light/index.js +1 -1
- package/lib/overlay/themes/solar/charcoal/index.js +1 -1
- package/lib/overlay/themes/solar/pearl/index.js +1 -1
- package/lib/overlay-menu/custom-elements.json +2 -2
- package/lib/overlay-menu/custom-elements.md +2 -2
- package/lib/overlay-menu/helpers/types.d.ts +2 -2
- package/lib/overlay-menu/index.d.ts +2 -2
- package/lib/overlay-menu/index.js +36 -42
- package/lib/overlay-menu/managers/menu-manager.d.ts +0 -1
- package/lib/overlay-menu/managers/menu-manager.js +1 -5
- package/lib/overlay-menu/themes/halo/dark/index.js +1 -1
- package/lib/overlay-menu/themes/halo/light/index.js +1 -1
- package/lib/overlay-menu/themes/solar/charcoal/index.js +1 -1
- package/lib/overlay-menu/themes/solar/pearl/index.js +1 -1
- package/lib/pagination/custom-elements.json +1 -1
- package/lib/pagination/custom-elements.md +3 -3
- package/lib/pagination/index.d.ts +1 -2
- package/lib/pagination/index.js +3 -7
- package/lib/pagination/themes/halo/dark/index.js +1 -1
- package/lib/pagination/themes/halo/light/index.js +1 -1
- package/lib/pagination/themes/solar/charcoal/index.js +1 -1
- package/lib/pagination/themes/solar/pearl/index.js +1 -1
- package/lib/password-field/custom-elements.json +2 -6
- package/lib/password-field/custom-elements.md +4 -5
- package/lib/password-field/index.d.ts +2 -3
- package/lib/password-field/index.js +2 -3
- package/lib/password-field/themes/halo/dark/index.js +2 -1
- package/lib/password-field/themes/halo/light/index.js +2 -1
- package/lib/password-field/themes/solar/charcoal/index.js +2 -1
- package/lib/password-field/themes/solar/pearl/index.js +2 -1
- package/lib/pill/custom-elements.json +1 -1
- package/lib/pill/custom-elements.md +3 -3
- package/lib/pill/index.d.ts +1 -1
- package/lib/pill/index.js +2 -2
- package/lib/pill/themes/halo/dark/index.js +2 -1
- package/lib/pill/themes/halo/light/index.js +2 -1
- package/lib/pill/themes/solar/charcoal/index.js +2 -1
- package/lib/pill/themes/solar/pearl/index.js +2 -1
- package/lib/radio-button/custom-elements.json +1 -1
- package/lib/radio-button/custom-elements.md +3 -3
- package/lib/radio-button/index.d.ts +1 -1
- package/lib/radio-button/index.js +1 -6
- package/lib/radio-button/themes/halo/dark/index.js +1 -1
- package/lib/radio-button/themes/halo/light/index.js +1 -1
- package/lib/radio-button/themes/solar/charcoal/index.js +1 -1
- package/lib/radio-button/themes/solar/pearl/index.js +1 -1
- package/lib/rating/custom-elements.json +1 -1
- package/lib/rating/custom-elements.md +3 -3
- package/lib/rating/index.d.ts +1 -1
- package/lib/rating/index.js +1 -5
- package/lib/search-field/custom-elements.json +3 -3
- package/lib/search-field/custom-elements.md +5 -5
- package/lib/search-field/index.d.ts +3 -3
- package/lib/search-field/index.js +6 -7
- package/lib/search-field/themes/halo/dark/index.js +2 -1
- package/lib/search-field/themes/halo/light/index.js +2 -1
- package/lib/search-field/themes/solar/charcoal/index.js +2 -1
- package/lib/search-field/themes/solar/pearl/index.js +2 -1
- package/lib/select/custom-elements.json +2 -2
- package/lib/select/custom-elements.md +4 -4
- package/lib/select/helpers/types.d.ts +2 -2
- package/lib/select/index.d.ts +2 -2
- package/lib/select/index.js +15 -20
- package/lib/select/themes/halo/dark/index.js +2 -1
- package/lib/select/themes/halo/light/index.js +2 -1
- package/lib/select/themes/solar/charcoal/index.js +2 -1
- package/lib/select/themes/solar/pearl/index.js +2 -1
- package/lib/sidebar-layout/index.js +2 -3
- package/lib/sidebar-layout/themes/halo/dark/index.js +1 -1
- package/lib/sidebar-layout/themes/halo/light/index.js +1 -1
- package/lib/sidebar-layout/themes/solar/charcoal/index.js +1 -1
- package/lib/sidebar-layout/themes/solar/pearl/index.js +1 -1
- package/lib/slider/custom-elements.json +3 -3
- package/lib/slider/custom-elements.md +5 -5
- package/lib/slider/index.d.ts +3 -3
- package/lib/slider/index.js +117 -111
- package/lib/swing-gauge/types.d.ts +1 -1
- package/lib/tab/custom-elements.json +1 -1
- package/lib/tab/custom-elements.md +3 -3
- package/lib/tab/index.d.ts +1 -1
- package/lib/tab/index.js +1 -1
- package/lib/tab/themes/halo/dark/index.js +1 -1
- package/lib/tab/themes/halo/light/index.js +1 -1
- package/lib/tab/themes/solar/charcoal/index.js +1 -1
- package/lib/tab/themes/solar/pearl/index.js +1 -1
- package/lib/tab-bar/custom-elements.json +1 -1
- package/lib/tab-bar/custom-elements.md +3 -3
- package/lib/tab-bar/index.d.ts +1 -1
- package/lib/tab-bar/index.js +1 -5
- package/lib/tab-bar/themes/halo/dark/index.js +1 -1
- package/lib/tab-bar/themes/halo/light/index.js +1 -1
- package/lib/text-field/custom-elements.json +3 -3
- package/lib/text-field/custom-elements.md +5 -5
- package/lib/text-field/index.d.ts +4 -10
- package/lib/text-field/index.js +11 -26
- package/lib/text-field/themes/halo/dark/index.js +2 -1
- package/lib/text-field/themes/halo/light/index.js +2 -1
- package/lib/text-field/themes/solar/charcoal/index.js +2 -1
- package/lib/text-field/themes/solar/pearl/index.js +2 -1
- package/lib/time-picker/custom-elements.json +1 -1
- package/lib/time-picker/custom-elements.md +3 -3
- package/lib/time-picker/index.d.ts +1 -1
- package/lib/time-picker/index.js +19 -20
- package/lib/time-picker/themes/halo/dark/index.js +2 -1
- package/lib/time-picker/themes/halo/light/index.js +2 -1
- package/lib/time-picker/themes/solar/charcoal/index.js +2 -1
- package/lib/time-picker/themes/solar/pearl/index.js +2 -1
- package/lib/toggle/custom-elements.json +1 -1
- package/lib/toggle/custom-elements.md +3 -3
- package/lib/toggle/index.d.ts +1 -1
- package/lib/toggle/index.js +2 -5
- package/lib/toggle/themes/halo/dark/index.js +1 -1
- package/lib/toggle/themes/halo/light/index.js +1 -1
- package/lib/toggle/themes/solar/charcoal/index.js +1 -1
- package/lib/toggle/themes/solar/pearl/index.js +1 -1
- package/lib/tooltip/elements/tooltip-element.js +1 -1
- package/lib/tooltip/helpers/types.d.ts +10 -10
- package/lib/tooltip/index.js +5 -4
- package/lib/tooltip/managers/tooltip-manager.js +2 -5
- package/lib/tornado-chart/elements/tornado-item.js +8 -9
- package/lib/tornado-chart/themes/halo/dark/index.js +2 -2
- package/lib/tornado-chart/themes/halo/light/index.js +2 -2
- package/lib/tornado-chart/themes/solar/charcoal/index.js +1 -1
- package/lib/tornado-chart/themes/solar/pearl/index.js +1 -1
- package/lib/tree/custom-elements.json +2 -2
- package/lib/tree/custom-elements.md +2 -2
- package/lib/tree/elements/tree.d.ts +2 -2
- package/lib/tree/elements/tree.js +2 -4
- package/lib/tree/helpers/renderer.d.ts +0 -4
- package/lib/tree/helpers/renderer.js +5 -5
- package/lib/tree/helpers/types.d.ts +2 -2
- package/lib/tree/themes/halo/dark/index.js +2 -2
- package/lib/tree/themes/halo/light/index.js +2 -2
- package/lib/tree/themes/solar/charcoal/index.js +2 -2
- package/lib/tree/themes/solar/pearl/index.js +2 -2
- package/lib/tree-select/custom-elements.json +7 -7
- package/lib/tree-select/custom-elements.md +7 -7
- package/lib/tree-select/helpers/types.d.ts +2 -2
- package/lib/tree-select/index.d.ts +5 -6
- package/lib/tree-select/index.js +23 -23
- package/lib/tree-select/themes/halo/dark/index.js +2 -1
- package/lib/tree-select/themes/halo/light/index.js +2 -1
- package/lib/tree-select/themes/solar/charcoal/index.js +2 -1
- package/lib/tree-select/themes/solar/pearl/index.js +2 -1
- package/lib/version.js +1 -1
- package/package.json +32 -30
- package/lib/chart/helpers/legend.d.ts +0 -5
- package/lib/chart/helpers/legend.js +0 -78
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { BasicElement, html, css, nothing } from '@refinitiv-ui/core';
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { ref, createRef } from '@refinitiv-ui/core/directives/ref.js';
|
|
6
|
+
import { color as parseColor } from '@refinitiv-ui/utils/color.js';
|
|
7
|
+
import { VERSION } from '../../version.js';
|
|
8
|
+
import { Chart as ChartJS } from 'chart.js';
|
|
9
|
+
import 'chartjs-adapter-date-fns';
|
|
10
|
+
import { merge } from '../helpers/index.js';
|
|
11
|
+
import '../../header/index.js';
|
|
12
|
+
const CSS_COLOR_PREFIX = '--chart-color-';
|
|
13
|
+
/**
|
|
14
|
+
* Charting component that uses ChartJS library
|
|
15
|
+
*/
|
|
16
|
+
let Chart = class Chart extends BasicElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
/**
|
|
20
|
+
* Chart.js object
|
|
21
|
+
* @type {ChartJS | null}
|
|
22
|
+
*/
|
|
23
|
+
this.chart = null;
|
|
24
|
+
/**
|
|
25
|
+
* Chart configurations. Same configuration as ChartJS
|
|
26
|
+
* @type {ChartConfiguration | null}
|
|
27
|
+
*/
|
|
28
|
+
this.config = null;
|
|
29
|
+
/**
|
|
30
|
+
* Canvas element used to render Chart
|
|
31
|
+
*/
|
|
32
|
+
this.canvas = createRef();
|
|
33
|
+
/**
|
|
34
|
+
* Inject theme color into each datasets
|
|
35
|
+
* @param chart Chart.js instance
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
this.decorateColors = (chart) => {
|
|
39
|
+
chart.config.data.datasets.forEach((dataset, datasetIndex) => {
|
|
40
|
+
let colors;
|
|
41
|
+
let borderColor;
|
|
42
|
+
let backgroundColor;
|
|
43
|
+
const isMultipleDatasets = (chart.config.data.datasets.length > 1);
|
|
44
|
+
// From old requirement, Only line, radar, scatter, polarArea type are opaque backgroundColor
|
|
45
|
+
switch (dataset.type ?? this.config?.type) {
|
|
46
|
+
case 'line':
|
|
47
|
+
case 'radar':
|
|
48
|
+
case 'scatter':
|
|
49
|
+
colors = this.generateColors(false, 1, datasetIndex);
|
|
50
|
+
if (!dataset.borderColor) {
|
|
51
|
+
dataset.borderColor = colors.solid;
|
|
52
|
+
}
|
|
53
|
+
if (!dataset.backgroundColor) {
|
|
54
|
+
dataset.backgroundColor = colors.opaque;
|
|
55
|
+
}
|
|
56
|
+
if (!dataset.pointBackgroundColor) {
|
|
57
|
+
dataset.pointBackgroundColor = colors.solid;
|
|
58
|
+
}
|
|
59
|
+
if (!dataset.pointBorderColor) {
|
|
60
|
+
dataset.pointBorderColor = colors.solid;
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
// These types, Colors are set to an array.
|
|
64
|
+
case 'doughnut':
|
|
65
|
+
case 'pie':
|
|
66
|
+
case 'polarArea':
|
|
67
|
+
const index = isMultipleDatasets ? 0 : datasetIndex;
|
|
68
|
+
colors = this.generateColors(true, dataset.data ? dataset.data.length : 1, index);
|
|
69
|
+
borderColor = isMultipleDatasets ? this.getComputedVariable('--multi-dataset-border-color', '#fff') : colors.solid;
|
|
70
|
+
backgroundColor = this.config?.type === 'polarArea' ? colors.opaque : colors.solid;
|
|
71
|
+
if (!dataset.borderColor) {
|
|
72
|
+
dataset.borderColor = borderColor;
|
|
73
|
+
}
|
|
74
|
+
if (!dataset.backgroundColor) {
|
|
75
|
+
dataset.backgroundColor = backgroundColor;
|
|
76
|
+
}
|
|
77
|
+
// Add more colors if items aren't enough
|
|
78
|
+
if (Array.isArray(dataset.borderColor) && Array.isArray(borderColor) && dataset.borderColor.length < borderColor.length) {
|
|
79
|
+
merge(dataset.borderColor, borderColor);
|
|
80
|
+
}
|
|
81
|
+
if (Array.isArray(dataset.backgroundColor) && Array.isArray(backgroundColor) && dataset.backgroundColor.length < backgroundColor.length) {
|
|
82
|
+
merge(dataset.backgroundColor, backgroundColor);
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
// These types, Colors could be string or array
|
|
86
|
+
case 'bar':
|
|
87
|
+
case 'bubble':
|
|
88
|
+
colors = this.generateColors(!isMultipleDatasets, !isMultipleDatasets && dataset.data ? dataset.data.length : 1, datasetIndex);
|
|
89
|
+
borderColor = colors.solid;
|
|
90
|
+
backgroundColor = this.config?.type === 'bubble' ? colors.opaque : colors.solid;
|
|
91
|
+
if (!dataset.borderColor) {
|
|
92
|
+
dataset.borderColor = borderColor;
|
|
93
|
+
}
|
|
94
|
+
if (!dataset.backgroundColor) {
|
|
95
|
+
dataset.backgroundColor = backgroundColor;
|
|
96
|
+
}
|
|
97
|
+
// Add more colors if items aren't enough
|
|
98
|
+
if (Array.isArray(dataset.borderColor) && Array.isArray(borderColor) && dataset.borderColor.length < borderColor.length) {
|
|
99
|
+
merge(dataset.borderColor, borderColor);
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(dataset.backgroundColor) && Array.isArray(backgroundColor) && dataset.backgroundColor.length < backgroundColor.length) {
|
|
102
|
+
merge(dataset.backgroundColor, backgroundColor);
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
// For other types
|
|
106
|
+
default:
|
|
107
|
+
colors = this.generateColors(false, dataset.data.length, datasetIndex);
|
|
108
|
+
if (!dataset.borderColor) {
|
|
109
|
+
dataset.borderColor = colors.solid;
|
|
110
|
+
}
|
|
111
|
+
if (!dataset.backgroundColor) {
|
|
112
|
+
dataset.backgroundColor = colors.solid;
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Generates the legend labels on a given chart
|
|
120
|
+
* @param chart Chart.js instance
|
|
121
|
+
* @returns Array of label configurations
|
|
122
|
+
*/
|
|
123
|
+
this.generateLegendLabels = (chart) => {
|
|
124
|
+
const chartType = chart.config.type;
|
|
125
|
+
if (!chartType) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
let legends = [];
|
|
129
|
+
const datasets = chart.config.data.datasets;
|
|
130
|
+
if (datasets.length
|
|
131
|
+
&& chart?.config?.options?.plugins?.legend
|
|
132
|
+
&& Array.isArray(datasets[0].backgroundColor)) {
|
|
133
|
+
if (ChartJS.overrides.pie.plugins.legend.labels.generateLabels) {
|
|
134
|
+
legends = ChartJS.overrides.pie.plugins.legend.labels.generateLabels(chart);
|
|
135
|
+
}
|
|
136
|
+
// Customize for doughnut chart change border color to background color
|
|
137
|
+
if (['pie', 'doughnut'].includes(chartType) && this.datasets.length > 1) {
|
|
138
|
+
legends.forEach((label) => {
|
|
139
|
+
label.strokeStyle = label.fillStyle;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return legends;
|
|
143
|
+
}
|
|
144
|
+
if (ChartJS.defaults.plugins.legend.labels.generateLabels) {
|
|
145
|
+
legends = ChartJS.defaults.plugins.legend.labels.generateLabels(chart);
|
|
146
|
+
}
|
|
147
|
+
legends.forEach((legend, i) => {
|
|
148
|
+
legend.lineWidth = Number(datasets[i].borderWidth) || 0;
|
|
149
|
+
switch (datasets[i].type ?? chartType) {
|
|
150
|
+
case 'line':
|
|
151
|
+
case 'radar':
|
|
152
|
+
case 'bubble':
|
|
153
|
+
case 'polarArea':
|
|
154
|
+
legend.fillStyle = datasets[i].borderColor;
|
|
155
|
+
break;
|
|
156
|
+
// For other chart types
|
|
157
|
+
default:
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
return legends;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Element version number
|
|
166
|
+
* @returns version number
|
|
167
|
+
*/
|
|
168
|
+
static get version() {
|
|
169
|
+
return VERSION;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* A `CSSResultGroup` that will be used
|
|
173
|
+
* to style the host, slotted children
|
|
174
|
+
* and the internal template of the element.
|
|
175
|
+
* @return CSS template
|
|
176
|
+
*/
|
|
177
|
+
static get styles() {
|
|
178
|
+
return css `
|
|
179
|
+
:host {
|
|
180
|
+
display: block;
|
|
181
|
+
overflow: hidden;
|
|
182
|
+
position: relative;
|
|
183
|
+
}
|
|
184
|
+
:host::before {
|
|
185
|
+
content: '';
|
|
186
|
+
display: block;
|
|
187
|
+
padding-top: 60%;
|
|
188
|
+
min-height: 300px;
|
|
189
|
+
box-sizing: border-box;
|
|
190
|
+
}
|
|
191
|
+
[part=container] {
|
|
192
|
+
position: absolute;
|
|
193
|
+
top: 0;
|
|
194
|
+
right: 0;
|
|
195
|
+
bottom: 0;
|
|
196
|
+
left: 0;
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-direction: column;
|
|
199
|
+
}
|
|
200
|
+
[part=chart] {
|
|
201
|
+
flex: 1 1 auto;
|
|
202
|
+
position: relative;
|
|
203
|
+
}
|
|
204
|
+
[part=title] {
|
|
205
|
+
margin-bottom: 12px;
|
|
206
|
+
}
|
|
207
|
+
canvas {
|
|
208
|
+
position: absolute;
|
|
209
|
+
top: 0;
|
|
210
|
+
right: 0;
|
|
211
|
+
bottom: 0;
|
|
212
|
+
left: 0;
|
|
213
|
+
}
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Required properties, needed for chart to work correctly.
|
|
218
|
+
* @returns config
|
|
219
|
+
*/
|
|
220
|
+
get requiredConfig() {
|
|
221
|
+
return {
|
|
222
|
+
responsive: true,
|
|
223
|
+
maintainAspectRatio: false,
|
|
224
|
+
plugins: {
|
|
225
|
+
title: {
|
|
226
|
+
display: false
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* List of available chart colors
|
|
233
|
+
* @type {string[]}
|
|
234
|
+
* @returns {string[]}List of available chart colors
|
|
235
|
+
*/
|
|
236
|
+
get colors() {
|
|
237
|
+
const colors = [];
|
|
238
|
+
for (let index = 1;; index++) {
|
|
239
|
+
const color = this.getComputedVariable(`${CSS_COLOR_PREFIX}${index}`);
|
|
240
|
+
if (!color) {
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
colors.push(color);
|
|
244
|
+
}
|
|
245
|
+
return colors;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Returns the chart title
|
|
249
|
+
* @returns chart title
|
|
250
|
+
*/
|
|
251
|
+
get chartTitle() {
|
|
252
|
+
const title = this.config?.options?.plugins?.title?.text;
|
|
253
|
+
if (title) {
|
|
254
|
+
return typeof title === 'string' ? title : title.join();
|
|
255
|
+
}
|
|
256
|
+
return '';
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Returns a dataset array
|
|
260
|
+
* @returns dataset array
|
|
261
|
+
*/
|
|
262
|
+
get datasets() {
|
|
263
|
+
return this.config?.data?.datasets || [];
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Invoked whenever the element is updated
|
|
267
|
+
* @param changedProperties Map of changed properties with old values
|
|
268
|
+
* @returns {void}
|
|
269
|
+
*/
|
|
270
|
+
updated(changedProperties) {
|
|
271
|
+
super.updated(changedProperties);
|
|
272
|
+
if (changedProperties.has('config')) {
|
|
273
|
+
this.onConfigChange();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Element connected
|
|
278
|
+
* @returns {void}
|
|
279
|
+
*/
|
|
280
|
+
connectedCallback() {
|
|
281
|
+
super.connectedCallback();
|
|
282
|
+
this.setGlobalConfig();
|
|
283
|
+
if (this.canvas.value) {
|
|
284
|
+
this.createChart();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Element disconnected
|
|
289
|
+
* @returns {void}
|
|
290
|
+
*/
|
|
291
|
+
disconnectedCallback() {
|
|
292
|
+
super.disconnectedCallback();
|
|
293
|
+
this.destroyChart();
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Create plugin to set our theme into ChartJS lifecycle
|
|
297
|
+
* @returns Created plugin
|
|
298
|
+
*/
|
|
299
|
+
createPlugin() {
|
|
300
|
+
return {
|
|
301
|
+
id: 'ef-chart',
|
|
302
|
+
beforeInit: (chart) => {
|
|
303
|
+
const option = this.themableChartOption;
|
|
304
|
+
merge(chart.config.options, option);
|
|
305
|
+
},
|
|
306
|
+
beforeUpdate: this.decorateColors
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Themable parts of the config.
|
|
311
|
+
* This will be merged into the configuration object.
|
|
312
|
+
* @returns Chart option with theme
|
|
313
|
+
*/
|
|
314
|
+
get themableChartOption() {
|
|
315
|
+
const boxWidth = this.cssVarAsNumber('--legend-key-box-width', '10');
|
|
316
|
+
let boxHeight = Number(getComputedStyle(this).getPropertyValue('font-size').replace('px', ''));
|
|
317
|
+
if (this.config?.options?.plugins?.legend?.labels?.usePointStyle) {
|
|
318
|
+
boxHeight = boxWidth;
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
animation: {
|
|
322
|
+
duration: this.cssVarAsNumber('--animation-duration', '0')
|
|
323
|
+
},
|
|
324
|
+
elements: {
|
|
325
|
+
line: {
|
|
326
|
+
borderWidth: this.cssVarAsNumber('--line-width', '1'),
|
|
327
|
+
tension: this.cssVarAsNumber('--line-tension', '0.5')
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
plugins: {
|
|
331
|
+
tooltip: {
|
|
332
|
+
backgroundColor: this.getComputedVariable('--tooltip-background-color', 'transparent'),
|
|
333
|
+
titleColor: this.getComputedVariable('--tooltip-title-color', 'transparent'),
|
|
334
|
+
bodyColor: this.getComputedVariable('--tooltip-body-color', 'transparent'),
|
|
335
|
+
cornerRadius: this.cssVarAsNumber('--tooltip-border-radius', '0'),
|
|
336
|
+
caretSize: this.cssVarAsNumber('--tooltip-caret-size', '0'),
|
|
337
|
+
padding: {
|
|
338
|
+
x: this.cssVarAsNumber('--tooltip-padding-x', '--tooltip-padding', '0'),
|
|
339
|
+
y: this.cssVarAsNumber('--tooltip-padding-y', '--tooltip-padding', '0')
|
|
340
|
+
},
|
|
341
|
+
titleSpacing: this.cssVarAsNumber('--tooltip-title-spacing', '0'),
|
|
342
|
+
displayColors: false
|
|
343
|
+
},
|
|
344
|
+
legend: {
|
|
345
|
+
position: ['pie', 'doughnut'].includes(this.config?.type || '') ? 'right' : 'top',
|
|
346
|
+
labels: {
|
|
347
|
+
boxWidth,
|
|
348
|
+
boxHeight,
|
|
349
|
+
generateLabels: this.generateLegendLabels
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Set global configuration of ChartJS
|
|
357
|
+
* @returns {void}
|
|
358
|
+
*/
|
|
359
|
+
setGlobalConfig() {
|
|
360
|
+
const cssStyle = getComputedStyle(this);
|
|
361
|
+
// Set font globals
|
|
362
|
+
ChartJS.defaults.color = cssStyle.getPropertyValue('color');
|
|
363
|
+
ChartJS.defaults.font.family = cssStyle.getPropertyValue('font-family');
|
|
364
|
+
ChartJS.defaults.font.size = Number(cssStyle.getPropertyValue('font-size').replace('px', ''));
|
|
365
|
+
ChartJS.defaults.font.style = cssStyle.getPropertyValue('font-style');
|
|
366
|
+
// Set global grid color
|
|
367
|
+
ChartJS.defaults.scale.grid.color = (line) => {
|
|
368
|
+
return line.index === 0 ? this.getComputedVariable('--zero-line-color', 'transparent') : this.getComputedVariable('--grid-line-color', 'transparent');
|
|
369
|
+
};
|
|
370
|
+
if (this.config?.type === 'polarArea' || this.config?.type === 'radar') {
|
|
371
|
+
ChartJS.defaults.scales.radialLinear.ticks.showLabelBackdrop = false;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Handles a change of configuration object.
|
|
376
|
+
* This does not fire when a property of the config object changes,
|
|
377
|
+
* for this use this.updateChart() to apply changes.
|
|
378
|
+
* @returns {void}
|
|
379
|
+
*/
|
|
380
|
+
onConfigChange() {
|
|
381
|
+
if (this.config) {
|
|
382
|
+
this.createChart();
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Get as CSS variable and tries to convert it into a usable number
|
|
387
|
+
* @returns The value as a number, or, undefined if NaN.
|
|
388
|
+
*/
|
|
389
|
+
cssVarAsNumber(...args) {
|
|
390
|
+
const result = Number(this.getComputedVariable(...args).replace(/\D/g, ''));
|
|
391
|
+
return isNaN(result) ? undefined : result;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Merges all the different layers of the config.
|
|
395
|
+
* @returns {void}
|
|
396
|
+
*/
|
|
397
|
+
mergeConfigs() {
|
|
398
|
+
if (!this.config) {
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
let plugins = [
|
|
402
|
+
this.createPlugin()
|
|
403
|
+
];
|
|
404
|
+
if (Array.isArray(this.config.plugins) && this.config.plugins.length > 0) {
|
|
405
|
+
plugins = [
|
|
406
|
+
...plugins,
|
|
407
|
+
...this.config.plugins
|
|
408
|
+
];
|
|
409
|
+
}
|
|
410
|
+
merge(this.config, {
|
|
411
|
+
plugins,
|
|
412
|
+
options: this.requiredConfig
|
|
413
|
+
}, true);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Generates internal solid and opaque color set for a dataset
|
|
417
|
+
* @param isArray Flag to return result in array or not e.g. doughnut, pie, etc
|
|
418
|
+
* @param amount Amount of colors required
|
|
419
|
+
* @param shift Positional shift of the color start point
|
|
420
|
+
* @returns Solid and opaque color values
|
|
421
|
+
*/
|
|
422
|
+
generateColors(isArray, amount, shift) {
|
|
423
|
+
const solid = [];
|
|
424
|
+
const opaque = [];
|
|
425
|
+
const alpha = Number(this.getComputedVariable('--fill-opacity', '0.2'));
|
|
426
|
+
amount = isArray ? amount : 1;
|
|
427
|
+
for (let i = shift; i < amount + shift; i++) {
|
|
428
|
+
const color = this.colors[i % this.colors.length];
|
|
429
|
+
solid.push(color);
|
|
430
|
+
const opaqueColor = parseColor(color);
|
|
431
|
+
if (opaqueColor) {
|
|
432
|
+
opaqueColor.opacity = alpha;
|
|
433
|
+
opaque.push(opaqueColor.toString());
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return {
|
|
437
|
+
solid: isArray ? solid : solid[0],
|
|
438
|
+
opaque: isArray ? opaque : opaque[0]
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Creates a chart after config has changed,
|
|
443
|
+
* or, the element has been connected to the DOM
|
|
444
|
+
* @returns {void}
|
|
445
|
+
*/
|
|
446
|
+
createChart() {
|
|
447
|
+
const canvas = this.canvas.value;
|
|
448
|
+
if (canvas && this.config) {
|
|
449
|
+
this.destroyChart();
|
|
450
|
+
this.mergeConfigs();
|
|
451
|
+
this.chart = new ChartJS(canvas, this.config);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Destroys the chart.js object
|
|
456
|
+
* @returns True if a chart object has been destroyed
|
|
457
|
+
*/
|
|
458
|
+
destroyChart() {
|
|
459
|
+
if (this.chart) {
|
|
460
|
+
this.chart.destroy();
|
|
461
|
+
this.chart = null;
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
return false;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Update all data, title, scales, legends and re-render the chart based on its config
|
|
468
|
+
* @param updateMode Additional configuration for control an animation in the update process.
|
|
469
|
+
* @returns {void}
|
|
470
|
+
*/
|
|
471
|
+
updateChart(updateMode) {
|
|
472
|
+
if (!this.chart || !this.config) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
this.chart.stop();
|
|
476
|
+
this.mergeConfigs();
|
|
477
|
+
this.requestUpdate();
|
|
478
|
+
this.chart?.update(updateMode);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Template for title
|
|
482
|
+
* Rendered when `config.plugins.title.text` is set
|
|
483
|
+
* @returns Header template from title of config
|
|
484
|
+
*/
|
|
485
|
+
get titleTemplate() {
|
|
486
|
+
return this.chartTitle ? html `<ef-header part="title">${this.chartTitle}</ef-header>` : nothing;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* A `TemplateResult` that will be used
|
|
490
|
+
* to render the updated internal template.
|
|
491
|
+
* @return Render template
|
|
492
|
+
*/
|
|
493
|
+
render() {
|
|
494
|
+
return html `
|
|
495
|
+
<div part="container">
|
|
496
|
+
${this.titleTemplate}
|
|
497
|
+
<div part="chart">
|
|
498
|
+
<canvas ${ref(this.canvas)}></canvas>
|
|
499
|
+
</div>
|
|
500
|
+
</div>`;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
__decorate([
|
|
504
|
+
property({ type: Object })
|
|
505
|
+
], Chart.prototype, "config", void 0);
|
|
506
|
+
Chart = __decorate([
|
|
507
|
+
customElement('ef-chart')
|
|
508
|
+
], Chart);
|
|
509
|
+
export { Chart };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './types.js';
|
|
2
2
|
export * from './merge.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './types.js';
|
|
2
2
|
export * from './merge.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
type UnknownObject = {
|
|
2
2
|
[key: string]: unknown;
|
|
3
3
|
};
|
|
4
|
-
|
|
4
|
+
type MergeObject = UnknownObject | Array<unknown>;
|
|
5
5
|
/**
|
|
6
6
|
* Merge objects recursively
|
|
7
7
|
*
|
|
8
8
|
* @param {MergeObject} object The destination object.
|
|
9
|
-
* @param {MergeObject} sources The source
|
|
9
|
+
* @param {MergeObject} sources The source object.
|
|
10
10
|
* @param {boolean} force Force merge if a key of destination object is already exists and a value is not object
|
|
11
11
|
* @param {MergeObject[]} record The record object which record merged objects recursively
|
|
12
12
|
* @returns voids
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Merge objects recursively
|
|
3
3
|
*
|
|
4
4
|
* @param {MergeObject} object The destination object.
|
|
5
|
-
* @param {MergeObject} sources The source
|
|
5
|
+
* @param {MergeObject} sources The source object.
|
|
6
6
|
* @param {boolean} force Force merge if a key of destination object is already exists and a value is not object
|
|
7
7
|
* @param {MergeObject[]} record The record object which record merged objects recursively
|
|
8
8
|
* @returns voids
|
|
@@ -1,69 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare type DatasetColors = {
|
|
1
|
+
export type DatasetColors = {
|
|
3
2
|
solid: string | string[];
|
|
4
3
|
opaque: string | string[];
|
|
5
4
|
};
|
|
6
|
-
export declare type ChartDataSetsColor = Chart.ChartColor | Chart.ChartColor[] | Chart.Scriptable<Chart.ChartColor> | undefined;
|
|
7
|
-
export declare type ChartConfig = Chart.ChartConfiguration;
|
|
8
|
-
export declare type ChartUpdateProps = Chart.ChartUpdateProps;
|
|
9
|
-
export interface MetaData {
|
|
10
|
-
_chart: Chart;
|
|
11
|
-
_datasetIndex: number;
|
|
12
|
-
_index: number;
|
|
13
|
-
_model: Model;
|
|
14
|
-
_view: Model;
|
|
15
|
-
_xScale: Chart.ChartScales;
|
|
16
|
-
_yScale: Chart.ChartScales;
|
|
17
|
-
hidden?: boolean;
|
|
18
|
-
}
|
|
19
|
-
interface Model {
|
|
20
|
-
backgroundColor: string;
|
|
21
|
-
borderAlign?: Chart.BorderAlignment;
|
|
22
|
-
borderColor: string;
|
|
23
|
-
borderWidth?: number;
|
|
24
|
-
circumference?: number;
|
|
25
|
-
controlPointNextX: number;
|
|
26
|
-
controlPointNextY: number;
|
|
27
|
-
controlPointPreviousX: number;
|
|
28
|
-
controlPointPreviousY: number;
|
|
29
|
-
endAngle?: number;
|
|
30
|
-
hitRadius: number;
|
|
31
|
-
innerRadius?: number;
|
|
32
|
-
outerRadius?: number;
|
|
33
|
-
pointStyle: string;
|
|
34
|
-
radius: string;
|
|
35
|
-
skip?: boolean;
|
|
36
|
-
startAngle?: number;
|
|
37
|
-
steppedLine?: undefined;
|
|
38
|
-
tension: number;
|
|
39
|
-
x: number;
|
|
40
|
-
y: number;
|
|
41
|
-
base: number;
|
|
42
|
-
head: number;
|
|
43
|
-
}
|
|
44
|
-
export interface ChartHelpers {
|
|
45
|
-
draw(): void;
|
|
46
|
-
}
|
|
47
|
-
export interface ChartJS extends Chart {
|
|
48
|
-
new (context: string | CanvasRenderingContext2D | HTMLCanvasElement | ArrayLike<CanvasRenderingContext2D | HTMLCanvasElement>, options: ChartConfig): Chart;
|
|
49
|
-
defaults: {
|
|
50
|
-
global: Chart.ChartOptions & Chart.ChartFontOptions & {
|
|
51
|
-
tooltips: Chart.ChartTooltipOptions;
|
|
52
|
-
defaultColor: string;
|
|
53
|
-
defaultLineHeight: number;
|
|
54
|
-
};
|
|
55
|
-
scale: {
|
|
56
|
-
gridLines: {
|
|
57
|
-
color: string;
|
|
58
|
-
zeroLineColor: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
[key: string]: any;
|
|
62
|
-
};
|
|
63
|
-
helpers: {
|
|
64
|
-
getHoverColor(value: string): string;
|
|
65
|
-
[key: string]: any;
|
|
66
|
-
};
|
|
67
|
-
isDatasetVisible(isDatasetVisible: number): boolean;
|
|
68
|
-
}
|
|
69
|
-
export {};
|