@watermarkinsights/ripple 0.0.0 → 3.0.1-1
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/dist/{esm/app-globals-18876ad3.js → ripple/app-globals-b5693c90.js} +1 -1
- package/dist/{componentlibrary → ripple}/css-shim-bbdf0cc6.js +0 -0
- package/dist/{componentlibrary → ripple}/dom-1f98a75f.js +0 -0
- package/dist/{componentlibrary → ripple}/functions-316c1b23.js +0 -0
- package/dist/{componentlibrary → ripple}/http-service-5d037e16.js +0 -0
- package/dist/{esm/index-d5997567.js → ripple/index-20b65f86.js} +3 -3
- package/dist/ripple/index.esm.js +1 -0
- package/dist/{componentlibrary → ripple}/interfaces-50753346.js +0 -0
- package/dist/{componentlibrary → ripple}/priv-chart-popover.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/priv-datepicker.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/priv-navigator-button.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/priv-navigator-item.entry.js +1 -1
- package/dist/{componentlibrary/componentlibrary.css → ripple/ripple.css} +0 -0
- package/dist/ripple/ripple.esm.js +125 -0
- package/dist/{componentlibrary → ripple}/shadow-css-67b66845.js +0 -0
- package/dist/{esm → ripple}/wm-action-menu.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-button.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-chart-slice.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-chart.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-datepicker.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-input.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-menuitem.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-modal-footer.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-modal-header.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-modal.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-navigator.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-network-uploader.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-option.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-pagination.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-search.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-select.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-snackbar.entry.js +1 -1
- package/dist/{esm → ripple}/wm-tab-item.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-tab-list.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-tab-panel.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-tag-input.entry.js +31 -6
- package/dist/{componentlibrary → ripple}/wm-timepicker.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-toggletip.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-uploader.entry.js +1 -1
- package/dist/{componentlibrary → ripple}/wm-wrapper.entry.js +1 -1
- package/dist/types/components/wm-tag-input/{wm-tag-input.d.ts → wm-tag-input.d.ts~ds312_tagInputMaxTags} +4 -0
- package/dist/types/{components.d.ts → components.d.ts~ds312_tagInputMaxTags} +2 -0
- package/dist/types/{stencil-public-runtime.d.ts → stencil-public-runtime.d.ts~ds312_tagInputMaxTags} +0 -0
- package/package.json +3 -3
- package/dist/cjs/app-globals-6b0c6e80.js +0 -110
- package/dist/cjs/app-globals-f1dd8fda.js +0 -47
- package/dist/cjs/componentlibrary.cjs.js +0 -20
- package/dist/cjs/css-shim-a7379e2b.js +0 -6
- package/dist/cjs/dom-3e7d9c3b.js +0 -75
- package/dist/cjs/functions-65513c61.js +0 -8360
- package/dist/cjs/functions-f2333f02.js +0 -6129
- package/dist/cjs/global-6849642d.js +0 -38
- package/dist/cjs/http-service-494d81de.js +0 -57
- package/dist/cjs/http-service-9e8c4dd5.js +0 -57
- package/dist/cjs/index-298ebef1.js +0 -2976
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/interfaces-a3338581.js +0 -35
- package/dist/cjs/interfaces-b2beb752.js +0 -54
- package/dist/cjs/loader.cjs.js +0 -22
- package/dist/cjs/priv-chart-popover.cjs.entry.js +0 -89
- package/dist/cjs/priv-datepicker.cjs.entry.js +0 -672
- package/dist/cjs/priv-navigator-button.cjs.entry.js +0 -29
- package/dist/cjs/priv-navigator-item.cjs.entry.js +0 -34
- package/dist/cjs/shadow-css-09555044.js +0 -391
- package/dist/cjs/wm-action-menu.cjs.entry.js +0 -206
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +0 -318
- package/dist/cjs/wm-button.cjs.entry.js +0 -152
- package/dist/cjs/wm-chart-slice.cjs.entry.js +0 -22
- package/dist/cjs/wm-chart.cjs.entry.js +0 -508
- package/dist/cjs/wm-datepicker.cjs.entry.js +0 -262
- package/dist/cjs/wm-input.cjs.entry.js +0 -110
- package/dist/cjs/wm-menuitem.cjs.entry.js +0 -118
- package/dist/cjs/wm-modal-footer.cjs.entry.js +0 -43
- package/dist/cjs/wm-modal-header.cjs.entry.js +0 -45
- package/dist/cjs/wm-modal.cjs.entry.js +0 -149
- package/dist/cjs/wm-navigator.cjs.entry.js +0 -279
- package/dist/cjs/wm-network-uploader.cjs.entry.js +0 -431
- package/dist/cjs/wm-option.cjs.entry.js +0 -123
- package/dist/cjs/wm-option_2.cjs.entry.js +0 -483
- package/dist/cjs/wm-pagination.cjs.entry.js +0 -176
- package/dist/cjs/wm-search.cjs.entry.js +0 -231
- package/dist/cjs/wm-select.cjs.entry.js +0 -366
- package/dist/cjs/wm-snackbar.cjs.entry.js +0 -160
- package/dist/cjs/wm-tab-item.cjs.entry.js +0 -82
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +0 -316
- package/dist/cjs/wm-tab-list.cjs.entry.js +0 -205
- package/dist/cjs/wm-tab-panel.cjs.entry.js +0 -42
- package/dist/cjs/wm-tag-input.cjs.entry.js +0 -513
- package/dist/cjs/wm-timepicker.cjs.entry.js +0 -386
- package/dist/cjs/wm-toggletip.cjs.entry.js +0 -128
- package/dist/cjs/wm-uploader.cjs.entry.js +0 -342
- package/dist/cjs/wm-wrapper.cjs.entry.js +0 -21
- package/dist/collection/collection-manifest.json +0 -131
- package/dist/collection/components/wm-action-menu/wm-action-menu.css +0 -122
- package/dist/collection/components/wm-action-menu/wm-action-menu.js +0 -392
- package/dist/collection/components/wm-button/wm-button.css +0 -572
- package/dist/collection/components/wm-button/wm-button.js +0 -365
- package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.css +0 -132
- package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.js +0 -232
- package/dist/collection/components/wm-chart/wm-chart-slice.js +0 -64
- package/dist/collection/components/wm-chart/wm-chart.css +0 -337
- package/dist/collection/components/wm-chart/wm-chart.js +0 -710
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.css +0 -365
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +0 -1003
- package/dist/collection/components/wm-datepicker/wm-datepicker.css +0 -211
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +0 -445
- package/dist/collection/components/wm-input/wm-input.css +0 -220
- package/dist/collection/components/wm-input/wm-input.js +0 -302
- package/dist/collection/components/wm-menuitem/wm-menuitem.css +0 -118
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +0 -411
- package/dist/collection/components/wm-modal/wm-modal-footer.css +0 -84
- package/dist/collection/components/wm-modal/wm-modal-footer.js +0 -159
- package/dist/collection/components/wm-modal/wm-modal-header.css +0 -78
- package/dist/collection/components/wm-modal/wm-modal-header.js +0 -109
- package/dist/collection/components/wm-modal/wm-modal.css +0 -155
- package/dist/collection/components/wm-modal/wm-modal.js +0 -356
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.css +0 -94
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +0 -97
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.css +0 -67
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +0 -114
- package/dist/collection/components/wm-navigator/wm-navigator.css +0 -137
- package/dist/collection/components/wm-navigator/wm-navigator.js +0 -468
- package/dist/collection/components/wm-option/wm-option.css +0 -162
- package/dist/collection/components/wm-option/wm-option.js +0 -394
- package/dist/collection/components/wm-pagination/wm-pagination.css +0 -217
- package/dist/collection/components/wm-pagination/wm-pagination.js +0 -348
- package/dist/collection/components/wm-search/wm-search.css +0 -155
- package/dist/collection/components/wm-search/wm-search.js +0 -439
- package/dist/collection/components/wm-select/wm-select.css +0 -315
- package/dist/collection/components/wm-select/wm-select.js +0 -676
- package/dist/collection/components/wm-snackbar/wm-snackbar.css +0 -331
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +0 -240
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.css +0 -104
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +0 -202
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.css +0 -73
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +0 -315
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.css +0 -57
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +0 -104
- package/dist/collection/components/wm-tag-input/wm-tag-input.css +0 -408
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +0 -707
- package/dist/collection/components/wm-timepicker/wm-timepicker.css +0 -370
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +0 -567
- package/dist/collection/components/wm-toggletip/wm-toggletip.css +0 -350
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +0 -217
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.css +0 -642
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +0 -753
- package/dist/collection/components/wm-uploader/wm-uploader.css +0 -666
- package/dist/collection/components/wm-uploader/wm-uploader.js +0 -673
- package/dist/collection/components/wm-wrapper/wm-wrapper.js +0 -27
- package/dist/collection/dev/scripts.js +0 -20
- package/dist/collection/global/__mocks__/functions.js +0 -5
- package/dist/collection/global/functions.js +0 -420
- package/dist/collection/global/global.js +0 -39
- package/dist/collection/global/interfaces.js +0 -49
- package/dist/collection/global/services/__mocks__/http-service.js +0 -130
- package/dist/collection/global/services/http-service.js +0 -50
- package/dist/collection/lang/lang.js +0 -5
- package/dist/collection/lang/piglatin.js +0 -93
- package/dist/componentlibrary/app-globals-18876ad3.js +0 -45
- package/dist/componentlibrary/app-globals-307a1083.js +0 -108
- package/dist/componentlibrary/componentlibrary.esm.js +0 -1
- package/dist/componentlibrary/index-d5997567.js +0 -2938
- package/dist/componentlibrary/index.esm.js +0 -0
- package/dist/componentlibrary/p-01bdfed8.js +0 -16
- package/dist/componentlibrary/p-0ca70ed4.entry.js +0 -1
- package/dist/componentlibrary/p-126bde92.entry.js +0 -1
- package/dist/componentlibrary/p-12a67d93.entry.js +0 -1
- package/dist/componentlibrary/p-188deaf5.entry.js +0 -1
- package/dist/componentlibrary/p-2514df6f.entry.js +0 -1
- package/dist/componentlibrary/p-269b8a5f.entry.js +0 -1
- package/dist/componentlibrary/p-35e57079.entry.js +0 -1
- package/dist/componentlibrary/p-414e20f7.entry.js +0 -1
- package/dist/componentlibrary/p-43f1298b.js +0 -1
- package/dist/componentlibrary/p-4d387ec6.entry.js +0 -1
- package/dist/componentlibrary/p-59ba81d6.entry.js +0 -1
- package/dist/componentlibrary/p-5e3cbec8.entry.js +0 -1
- package/dist/componentlibrary/p-5e81e830.entry.js +0 -1
- package/dist/componentlibrary/p-64ff5040.js +0 -1
- package/dist/componentlibrary/p-68a871d3.entry.js +0 -1
- package/dist/componentlibrary/p-996a7395.entry.js +0 -1
- package/dist/componentlibrary/p-9b460452.entry.js +0 -1
- package/dist/componentlibrary/p-a416e410.entry.js +0 -1
- package/dist/componentlibrary/p-d550a94f.entry.js +0 -1
- package/dist/componentlibrary/p-e4735c23.entry.js +0 -1
- package/dist/componentlibrary/p-e725f388.entry.js +0 -1
- package/dist/componentlibrary/p-e9532ae5.entry.js +0 -1
- package/dist/componentlibrary/p-edf6f848.entry.js +0 -1
- package/dist/componentlibrary/p-fd8070fb.js +0 -1
- package/dist/componentlibrary/wm-action-menu.entry.js +0 -202
- package/dist/componentlibrary/wm-tab-item.entry.js +0 -78
- package/dist/esm/app-globals-307a1083.js +0 -108
- package/dist/esm/componentlibrary.js +0 -18
- package/dist/esm/css-shim-bbdf0cc6.js +0 -4
- package/dist/esm/dom-1f98a75f.js +0 -73
- package/dist/esm/functions-316c1b23.js +0 -8340
- package/dist/esm/functions-60034bf7.js +0 -6109
- package/dist/esm/global-430cb201.js +0 -36
- package/dist/esm/http-service-3dc3b3e7.js +0 -52
- package/dist/esm/http-service-5d037e16.js +0 -52
- package/dist/esm/index.js +0 -1
- package/dist/esm/interfaces-2b97fab2.js +0 -32
- package/dist/esm/interfaces-50753346.js +0 -51
- package/dist/esm/loader.js +0 -18
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/priv-chart-popover.entry.js +0 -85
- package/dist/esm/priv-datepicker.entry.js +0 -668
- package/dist/esm/priv-navigator-button.entry.js +0 -25
- package/dist/esm/priv-navigator-item.entry.js +0 -30
- package/dist/esm/shadow-css-67b66845.js +0 -389
- package/dist/esm/wm-action-menu_2.entry.js +0 -313
- package/dist/esm/wm-button.entry.js +0 -148
- package/dist/esm/wm-chart-slice.entry.js +0 -18
- package/dist/esm/wm-chart.entry.js +0 -504
- package/dist/esm/wm-datepicker.entry.js +0 -258
- package/dist/esm/wm-input.entry.js +0 -106
- package/dist/esm/wm-menuitem.entry.js +0 -114
- package/dist/esm/wm-modal-footer.entry.js +0 -39
- package/dist/esm/wm-modal-header.entry.js +0 -41
- package/dist/esm/wm-modal.entry.js +0 -145
- package/dist/esm/wm-navigator.entry.js +0 -275
- package/dist/esm/wm-network-uploader.entry.js +0 -427
- package/dist/esm/wm-option.entry.js +0 -119
- package/dist/esm/wm-option_2.entry.js +0 -478
- package/dist/esm/wm-pagination.entry.js +0 -172
- package/dist/esm/wm-search.entry.js +0 -227
- package/dist/esm/wm-select.entry.js +0 -362
- package/dist/esm/wm-snackbar.entry.js +0 -156
- package/dist/esm/wm-tab-item_3.entry.js +0 -310
- package/dist/esm/wm-tab-list.entry.js +0 -201
- package/dist/esm/wm-tab-panel.entry.js +0 -38
- package/dist/esm/wm-tag-input.entry.js +0 -509
- package/dist/esm/wm-timepicker.entry.js +0 -382
- package/dist/esm/wm-toggletip.entry.js +0 -124
- package/dist/esm/wm-uploader.entry.js +0 -338
- package/dist/esm/wm-wrapper.entry.js +0 -17
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/loader/cdn.js +0 -3
- package/dist/loader/index.cjs.js +0 -3
- package/dist/loader/index.d.ts +0 -13
- package/dist/loader/index.es2017.js +0 -3
- package/dist/loader/index.js +0 -4
- package/dist/loader/package.json +0 -10
- package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +0 -43
- package/dist/types/components/wm-button/wm-button.d.ts +0 -36
- package/dist/types/components/wm-chart/priv-chart-popover/priv-chart-popover.d.ts +0 -23
- package/dist/types/components/wm-chart/wm-chart-slice.d.ts +0 -8
- package/dist/types/components/wm-chart/wm-chart.d.ts +0 -77
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +0 -75
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +0 -39
- package/dist/types/components/wm-input/wm-input.d.ts +0 -30
- package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +0 -30
- package/dist/types/components/wm-modal/wm-modal-footer.d.ts +0 -15
- package/dist/types/components/wm-modal/wm-modal-header.d.ts +0 -12
- package/dist/types/components/wm-modal/wm-modal.d.ts +0 -34
- package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +0 -10
- package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +0 -13
- package/dist/types/components/wm-navigator/wm-navigator.d.ts +0 -61
- package/dist/types/components/wm-option/wm-option.d.ts +0 -28
- package/dist/types/components/wm-pagination/wm-pagination.d.ts +0 -31
- package/dist/types/components/wm-search/wm-search.d.ts +0 -78
- package/dist/types/components/wm-select/wm-select.d.ts +0 -63
- package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +0 -32
- package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +0 -35
- package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +0 -50
- package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +0 -20
- package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +0 -59
- package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +0 -25
- package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +0 -85
- package/dist/types/components/wm-uploader/wm-uploader.d.ts +0 -75
- package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +0 -7
- package/dist/types/global/__mocks__/functions.d.ts +0 -5
- package/dist/types/global/global.d.ts +0 -1
- package/dist/types/global/interfaces.d.ts +0 -33
- package/dist/types/global/services/__mocks__/http-service.d.ts +0 -6
- package/dist/types/global/services/http-service.d.ts +0 -4
- package/dist/types/lang/lang.d.ts +0 -5
|
@@ -1,504 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, f as forceUpdate, h, H as Host, g as getElement } from './index-25b6e1c5.js';
|
|
2
|
-
import { g as generateId, d as debounce, f as findParentWithScrollbar, b as getPosition, i as intl, c as checkForActiveElInShadow } from './functions-60034bf7.js';
|
|
3
|
-
|
|
4
|
-
const wmChartCss = ".component-wrapper{display:flex;flex-direction:column;align-items:center;font-size:0.875rem;position:relative;}.component-wrapper .label{display:block;margin:0;padding-bottom:0.25rem;font-weight:500;position:relative}.component-wrapper .label .subinfo{display:block;font-weight:normal;font-style:italic;bottom:0.25rem;width:100%;color:#6b6b6b}.component-wrapper .legend-wrapper{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.component-wrapper .legend-wrapper .legend{display:flex;align-items:center;flex-wrap:wrap;text-align:center;padding-top:0.25rem;padding-bottom:0.75rem;box-sizing:border-box}.component-wrapper .legend-wrapper .legend.--top{margin-top:-0.75rem}.component-wrapper .legend-wrapper .legend.--top .legend-item{padding-top:0.75rem}.component-wrapper .legend-wrapper .legend.--top .legend-color{top:0.75rem}.component-wrapper .legend-wrapper .legend.--bottom{margin-bottom:-0.75rem}.component-wrapper .legend-wrapper .legend.--bottom .legend-item{padding-bottom:0.75rem}.component-wrapper .legend-wrapper .legend.--bottom .legend-color{top:-0.75rem}.component-wrapper .legend-wrapper .legend .legend-item{position:relative}.component-wrapper .legend-wrapper .legend .legend-item:not(:last-of-type){padding-right:1.25rem}.component-wrapper .legend-wrapper .legend .legend-text{padding-left:1rem;line-height:1}.component-wrapper .legend-wrapper .legend .legend-color{position:absolute;left:0;bottom:0;margin:auto;width:0.6875rem;height:0.6875rem}.component-wrapper .legend-wrapper .cluster-warning{font-size:0.75rem;font-style:italic;max-width:100%}.component-wrapper .chart-svg{overflow:visible}.component-wrapper .chart-svg:active,.component-wrapper .chart-svg:hover,.component-wrapper .chart-svg:focus{outline:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.component-wrapper .chart-svg::-moz-focus-inner{border:0;outline:none}.component-wrapper .chart-svg path:active,.component-wrapper .chart-svg path:hover,.component-wrapper .chart-svg path:focus,.component-wrapper .chart-svg rect:active,.component-wrapper .chart-svg rect:hover,.component-wrapper .chart-svg rect:focus{outline:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:url(#wmHoverDropShadow)}.component-wrapper .chart-svg path::-moz-focus-inner,.component-wrapper .chart-svg rect::-moz-focus-inner{border:0;outline:none}.component-wrapper .bar-wrapper{flex-grow:1;width:100%}.component-wrapper .bar-wrapper rect{height:30px}.component-wrapper .doughnut-wrapper .chart-svg{-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;border-radius:4px}.component-wrapper.doughnut1 label,.component-wrapper.doughnut1 .label-text,.component-wrapper.doughnut2 label,.component-wrapper.doughnut2 .label-text,.component-wrapper.doughnut3 label,.component-wrapper.doughnut3 .label-text{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.component-wrapper.doughnut0{align-items:center}.component-wrapper.doughnut0 label{text-align:center;width:100%;padding-bottom:1.5rem}.component-wrapper.doughnut0 label .subinfo{position:absolute}.component-wrapper.doughnut0 .legend{display:flex}.component-wrapper.doughnut0 .completion-message{padding-top:0.625rem}.component-wrapper .bar-svg{width:100%}.component-wrapper .bar-svg foreignObject{width:100%;height:30px;overflow:visible}.component-wrapper.bar1{padding:1.25rem;position:relative;align-items:flex-start}.component-wrapper.bar1 label{display:flex;flex-direction:column}.component-wrapper.bar1 label .subinfo{position:initial}.component-wrapper.bar1 .legend{display:none}.component-wrapper.bar1 .completion-message{position:absolute;right:1.25rem;bottom:0}.component-wrapper.bar1 .bar-wrapper{display:flex;align-items:center}.component-wrapper.bar1 .bar-wrapper .single-perc{width:4rem}.component-wrapper.bar1 .bar-wrapper .chart-svg{flex:1;height:30px}@media screen and (min-width: 768px){.component-wrapper.bar1{flex-direction:row;align-items:center}.component-wrapper.bar1 label{width:12rem;text-align:left;padding-right:1.25rem;padding-bottom:0}.component-wrapper.bar1 .completion-message{right:5.75rem}.component-wrapper.bar1 .bar-wrapper{flex-direction:row-reverse}.component-wrapper.bar1 .bar-wrapper .single-perc{text-align:center;padding-left:0.5rem}}.component-wrapper.bar2,.component-wrapper.bar3,.component-wrapper.bar4,.component-wrapper.bar5{align-items:flex-start}.component-wrapper.bar2 .legend,.component-wrapper.bar4 .legend,.component-wrapper.bar5 .legend{padding-bottom:0}.component-wrapper.bar2 .chart-svg,.component-wrapper.bar4 .chart-svg,.component-wrapper.bar5 .chart-svg{height:30px;margin-top:20px;margin-bottom:0}.component-wrapper.bar2 .chart-svg.show-values,.component-wrapper.bar4 .chart-svg.show-values,.component-wrapper.bar5 .chart-svg.show-values{height:60px;margin-top:0;margin-bottom:0}.component-wrapper.bar2 .chart-svg .percs,.component-wrapper.bar4 .chart-svg .percs,.component-wrapper.bar5 .chart-svg .percs{transform:translateY(24px);text-anchor:middle}.component-wrapper.bar3 .legend{padding-bottom:1.25rem}.component-wrapper.bar3 .svg-wrapper{position:relative;height:100px}.component-wrapper.bar3 .svg-wrapper .chart-svg{position:absolute;top:35px;left:0;right:0;bottom:0;height:30px}.component-wrapper.bar3 .svg-wrapper .chart-svg text{fill:#4a4a4a}.component-wrapper.bar3 .svg-wrapper .chart-svg .percs{transform:translateY(-4px);text-anchor:middle}.component-wrapper.bar3 .svg-wrapper .axis{position:absolute;top:0;left:0;height:90px;width:100%;overflow:visible;transform:translateY(90px)}.component-wrapper.bar3 .svg-wrapper .axis line{stroke:#eeedf4;stroke-width:1px}.component-wrapper.bar3 .svg-wrapper .axis text{transform:translate(4px, 24px);text-anchor:middle}:host(:focus){outline:none}:host(:focus) .chart-svg.user-is-tabbing:not(.show-values){-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}:host(:focus) .chart-svg.user-is-tabbing:not(.show-values)::-moz-focus-inner{border:0}:host(:focus) .chart-svg.user-is-tabbing.show-values .tabbing-focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;width:100%;height:30px}:host(:focus) .chart-svg.user-is-tabbing.show-values .tabbing-focus::-moz-focus-inner{border:0}:host(:focus) .chart-svg.user-is-tabbing.show-values .focus-offset{transform:translateY(30px)}";
|
|
5
|
-
|
|
6
|
-
const Chart = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.chartType = "doughnut1";
|
|
10
|
-
this.showLegend = true;
|
|
11
|
-
this.notStartedColor = false;
|
|
12
|
-
this.isTabbing = false;
|
|
13
|
-
this.uid = generateId();
|
|
14
|
-
this.slicesData = [];
|
|
15
|
-
this.colors = {
|
|
16
|
-
salmon: "#ff5f4e",
|
|
17
|
-
cyan: "#19a1a9",
|
|
18
|
-
sleet: "#7f97ad",
|
|
19
|
-
midnight: "#2e1b46",
|
|
20
|
-
lavender: "#8b86ca",
|
|
21
|
-
};
|
|
22
|
-
this.types = {
|
|
23
|
-
doughnut0: {
|
|
24
|
-
size: 155,
|
|
25
|
-
colors: [this.colors.cyan, "#bfbfbf"],
|
|
26
|
-
thickness: 0.73,
|
|
27
|
-
padding: 25,
|
|
28
|
-
isBar: false,
|
|
29
|
-
},
|
|
30
|
-
doughnut1: {
|
|
31
|
-
size: 130,
|
|
32
|
-
colors: [this.colors.lavender, this.colors.midnight, "#d4d4d4"],
|
|
33
|
-
thickness: 0.5,
|
|
34
|
-
padding: 90,
|
|
35
|
-
isBar: false,
|
|
36
|
-
},
|
|
37
|
-
doughnut2: {
|
|
38
|
-
size: 130,
|
|
39
|
-
colors: [this.colors.cyan, this.colors.salmon, "#d4d4d4"],
|
|
40
|
-
thickness: 0.5,
|
|
41
|
-
padding: 90,
|
|
42
|
-
isBar: false,
|
|
43
|
-
},
|
|
44
|
-
doughnut3: {
|
|
45
|
-
size: 130,
|
|
46
|
-
colors: [this.colors.lavender, this.colors.midnight, "#919834", "#c177cf", "#c16e00", "#029af2", "#2a6993"],
|
|
47
|
-
thickness: 0.5,
|
|
48
|
-
padding: 90,
|
|
49
|
-
isBar: false,
|
|
50
|
-
},
|
|
51
|
-
bar1: {
|
|
52
|
-
size: 350,
|
|
53
|
-
colors: [this.colors.cyan, "#bfbfbf"],
|
|
54
|
-
padding: 0,
|
|
55
|
-
isBar: true,
|
|
56
|
-
},
|
|
57
|
-
bar2: {
|
|
58
|
-
size: 400,
|
|
59
|
-
colors: ["#d4d4d4", this.colors.sleet, this.colors.cyan, this.colors.salmon],
|
|
60
|
-
padding: 0,
|
|
61
|
-
isBar: true,
|
|
62
|
-
},
|
|
63
|
-
bar3: {
|
|
64
|
-
size: 300,
|
|
65
|
-
colors: ["#0d696e", this.colors.cyan, "#8e4129", this.colors.salmon],
|
|
66
|
-
padding: 0,
|
|
67
|
-
isBar: true,
|
|
68
|
-
},
|
|
69
|
-
bar4: {
|
|
70
|
-
size: 400,
|
|
71
|
-
colors: ["#d4d4d4", this.colors.sleet, "#33a919"],
|
|
72
|
-
padding: 0,
|
|
73
|
-
isBar: true,
|
|
74
|
-
},
|
|
75
|
-
bar5: {
|
|
76
|
-
size: 400,
|
|
77
|
-
colors: [
|
|
78
|
-
"#d4d4d4",
|
|
79
|
-
this.colors.lavender,
|
|
80
|
-
this.colors.midnight,
|
|
81
|
-
"#919834",
|
|
82
|
-
"#c177cf",
|
|
83
|
-
"#c16e00",
|
|
84
|
-
"#029af2",
|
|
85
|
-
"#2a6993",
|
|
86
|
-
],
|
|
87
|
-
padding: 0,
|
|
88
|
-
isBar: true,
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
/* LIFECYCLE METHODS + EVENTS FROM THE CHILDREN */
|
|
92
|
-
this.debouncedUpdate = debounce(async () => {
|
|
93
|
-
this.setHybridType();
|
|
94
|
-
await this.getData();
|
|
95
|
-
forceUpdate(this.el);
|
|
96
|
-
}, 30);
|
|
97
|
-
this.debouncedSliceUpdate = debounce(async () => {
|
|
98
|
-
await this.getData();
|
|
99
|
-
forceUpdate(this.el);
|
|
100
|
-
}, 100);
|
|
101
|
-
}
|
|
102
|
-
toggleTabbingOn() {
|
|
103
|
-
this.isTabbing = true;
|
|
104
|
-
}
|
|
105
|
-
toggleTabbingOff() {
|
|
106
|
-
this.isTabbing = false;
|
|
107
|
-
}
|
|
108
|
-
handleKeydown(ev) {
|
|
109
|
-
switch (ev.keyCode) {
|
|
110
|
-
// arrow up / left
|
|
111
|
-
case 37:
|
|
112
|
-
case 38:
|
|
113
|
-
ev.preventDefault();
|
|
114
|
-
this.isTabbing = true; // shd already be true. just in case user clicked on chart then pressed an arrow key
|
|
115
|
-
this.focusPrevious();
|
|
116
|
-
break;
|
|
117
|
-
// arrow right / down
|
|
118
|
-
case 39:
|
|
119
|
-
case 40:
|
|
120
|
-
ev.preventDefault();
|
|
121
|
-
this.isTabbing = true; // shd already be true. just in case user clicked on chart then pressed an arrow key
|
|
122
|
-
this.focusNext();
|
|
123
|
-
break;
|
|
124
|
-
// tab
|
|
125
|
-
case 9:
|
|
126
|
-
this.exitChart();
|
|
127
|
-
break;
|
|
128
|
-
case 27:
|
|
129
|
-
this.popoverEl.open = false;
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
focusNext() {
|
|
134
|
-
const activeEl = checkForActiveElInShadow(document.activeElement);
|
|
135
|
-
const index =
|
|
136
|
-
// if the active el is not in the array the first element gets focused
|
|
137
|
-
(this.sliceEls.indexOf(activeEl) + 1) % this.sliceEls.length;
|
|
138
|
-
this.focusSlice(index);
|
|
139
|
-
}
|
|
140
|
-
focusPrevious() {
|
|
141
|
-
if (this.sliceEls) {
|
|
142
|
-
const activeEl = checkForActiveElInShadow(document.activeElement);
|
|
143
|
-
let index = this.sliceEls.indexOf(activeEl);
|
|
144
|
-
if (index === -1) {
|
|
145
|
-
// not in the array : focus the first slice
|
|
146
|
-
index = 0;
|
|
147
|
-
}
|
|
148
|
-
else if (index === 0) {
|
|
149
|
-
// first slice : focus the last slice
|
|
150
|
-
index = this.sliceEls.length - 1;
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
// anything else: focus previous
|
|
154
|
-
index -= 1;
|
|
155
|
-
}
|
|
156
|
-
this.focusSlice(index);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
focusSlice(index) {
|
|
160
|
-
if (this.sliceEls && this.el) {
|
|
161
|
-
if (this.popoverEl) {
|
|
162
|
-
this.popoverEl.open = false;
|
|
163
|
-
}
|
|
164
|
-
this.el.tabIndex = -1;
|
|
165
|
-
// @ts-ignore
|
|
166
|
-
this.el.focusable = false; // for Edge
|
|
167
|
-
this.sliceEls.map((p) => {
|
|
168
|
-
p.tabIndex = -1;
|
|
169
|
-
// @ts-ignore
|
|
170
|
-
p.focusable = false; // for Edge
|
|
171
|
-
});
|
|
172
|
-
this.sliceEls[index].tabIndex = 0;
|
|
173
|
-
// @ts-ignore
|
|
174
|
-
this.sliceEls[index].focusable = true; // for Edge
|
|
175
|
-
this.sliceEls[index].focus();
|
|
176
|
-
window.setTimeout(() => {
|
|
177
|
-
if (this.popoverEl) {
|
|
178
|
-
this.popoverEl.open = true;
|
|
179
|
-
}
|
|
180
|
-
}, 10);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
exitChart() {
|
|
184
|
-
this.sliceEls &&
|
|
185
|
-
this.sliceEls.map((p) => {
|
|
186
|
-
p.tabIndex = -1;
|
|
187
|
-
// @ts-ignore
|
|
188
|
-
p.focusable = false; // for Edge
|
|
189
|
-
});
|
|
190
|
-
// delay so that we can tab out of component before chart becomes focusable again
|
|
191
|
-
// and in case user was still pressing an arrow key when they pressed tab
|
|
192
|
-
window.setTimeout(() => {
|
|
193
|
-
if (this.el) {
|
|
194
|
-
this.el.tabIndex = 0;
|
|
195
|
-
// @ts-ignore
|
|
196
|
-
this.el.focusable = true; // for Edge
|
|
197
|
-
if (this.popoverEl) {
|
|
198
|
-
this.popoverEl.open = false;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}, 100);
|
|
202
|
-
}
|
|
203
|
-
openPopover(s) {
|
|
204
|
-
if (!!this.popoverEl && !!s.title && !!s.text) {
|
|
205
|
-
this.popoverEl.popoverTitle = s.title;
|
|
206
|
-
this.popoverEl.popoverText = s.text;
|
|
207
|
-
this.popoverEl.buttonText = s.buttonText;
|
|
208
|
-
this.popoverEl.coords = s.coords;
|
|
209
|
-
this.popoverEl.sliceRef = s.sliceRef;
|
|
210
|
-
window.setTimeout(() => {
|
|
211
|
-
if (this.popoverEl) {
|
|
212
|
-
this.popoverEl.open = true;
|
|
213
|
-
}
|
|
214
|
-
}, 30);
|
|
215
|
-
const debouncedClosePopover = debounce(async () => {
|
|
216
|
-
this.popoverEl.open = false;
|
|
217
|
-
}, 10);
|
|
218
|
-
// set up event listeners for scrolling
|
|
219
|
-
// to close popover on page scroll
|
|
220
|
-
document.addEventListener("scroll", () => {
|
|
221
|
-
debouncedClosePopover();
|
|
222
|
-
});
|
|
223
|
-
// ... and on parent scroll
|
|
224
|
-
const scrollableParent = findParentWithScrollbar(this.el);
|
|
225
|
-
if (!!scrollableParent) {
|
|
226
|
-
scrollableParent.addEventListener("scroll", () => {
|
|
227
|
-
debouncedClosePopover();
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
/* UTILS */
|
|
233
|
-
amountToPercent(val, asInt) {
|
|
234
|
-
return asInt ? Math.round((val * 100) / this.total) : Math.round((val * 10000) / this.total) / 100; // with 2 decimals
|
|
235
|
-
}
|
|
236
|
-
amountToDegree(val) {
|
|
237
|
-
return (val * 360) / this.total;
|
|
238
|
-
}
|
|
239
|
-
toFixed(number) {
|
|
240
|
-
var val = parseFloat((Math.floor(number * 100) / 100).toFixed(2));
|
|
241
|
-
return val;
|
|
242
|
-
}
|
|
243
|
-
polarToCartesian(half, radius, startAngle, endAngle) {
|
|
244
|
-
var x = this.toFixed(half + half * radius * Math.cos((Math.PI * startAngle) / 180));
|
|
245
|
-
var y = this.toFixed(half + half * radius * Math.sin((Math.PI * startAngle) / 180));
|
|
246
|
-
if (endAngle !== undefined) {
|
|
247
|
-
// if a 2nd angle value was passed, return 2 pairs of coords
|
|
248
|
-
var x2 = this.toFixed(half + half * radius * Math.cos((Math.PI * endAngle) / 180));
|
|
249
|
-
var y2 = this.toFixed(half + half * radius * Math.sin((Math.PI * endAngle) / 180));
|
|
250
|
-
return { x1: x, y1: y, x2, y2 };
|
|
251
|
-
}
|
|
252
|
-
return { x, y };
|
|
253
|
-
}
|
|
254
|
-
/* CRUNCH THE NUMBERS */
|
|
255
|
-
getPathData(amount, offset) {
|
|
256
|
-
var startAngle = this.amountToDegree(offset) - 90; // start at noon, not at 3 o'clock
|
|
257
|
-
var activeAngle = (amount / this.total) * 360;
|
|
258
|
-
var endAngle = startAngle + activeAngle;
|
|
259
|
-
var largeArcFlagOuter = activeAngle > 180 ? "1 1" : "0 1";
|
|
260
|
-
var largeArcFlagInner = activeAngle > 180 ? "1 0" : "0 0";
|
|
261
|
-
var half = this.chartData.size / 2;
|
|
262
|
-
var innerRadius = this.chartData.thickness;
|
|
263
|
-
var outerRadius = 1;
|
|
264
|
-
if (activeAngle === 360) {
|
|
265
|
-
// fix to avoid bad svg shape when the path goes all around (100%)
|
|
266
|
-
endAngle -= 0.01;
|
|
267
|
-
}
|
|
268
|
-
var outerCoords = this.polarToCartesian(half, outerRadius, startAngle + 1.5, // 1.5 for slice separator
|
|
269
|
-
endAngle);
|
|
270
|
-
var innerCoords = this.polarToCartesian(half, innerRadius, startAngle + 3, // 3 for slice separator
|
|
271
|
-
endAngle);
|
|
272
|
-
const moveTo = `M ${outerCoords.x1}, ${outerCoords.y1} `;
|
|
273
|
-
const arc1 = this.getArc(outerRadius, largeArcFlagOuter, outerCoords.x2, outerCoords.y2);
|
|
274
|
-
const line = ` L ${innerCoords.x2}, ${innerCoords.y2} `;
|
|
275
|
-
const arc2 = this.getArc(innerRadius, largeArcFlagInner, innerCoords.x1, innerCoords.y1);
|
|
276
|
-
return moveTo + arc1 + line + arc2 + " z";
|
|
277
|
-
}
|
|
278
|
-
getArc(radius, largeArcFlag, x, y) {
|
|
279
|
-
var z = this.toFixed((this.chartData.size / 2) * radius);
|
|
280
|
-
return `A ${z}, ${z} 0 ${largeArcFlag} ${this.toFixed(x)}, ${this.toFixed(y)}`;
|
|
281
|
-
}
|
|
282
|
-
setHybridType() {
|
|
283
|
-
this.hybridType = window.innerWidth > 1340 ? "doughnut0" : "bar1";
|
|
284
|
-
}
|
|
285
|
-
getType() {
|
|
286
|
-
return this.chartType === "hybrid" ? this.hybridType : this.chartType;
|
|
287
|
-
}
|
|
288
|
-
/* GET THE DATA */
|
|
289
|
-
async getData() {
|
|
290
|
-
this.slicesData = [];
|
|
291
|
-
let acc = 0;
|
|
292
|
-
const children = this.el.querySelectorAll("wm-chart-slice");
|
|
293
|
-
this.total = Array.from(children).reduce((total, slice) => (total += parseInt(slice.getAttribute("amount") || "0")), 0);
|
|
294
|
-
children.forEach((c, i) => {
|
|
295
|
-
const amount = parseInt(c.getAttribute("amount") || "0");
|
|
296
|
-
const perc = this.amountToPercent(amount, true);
|
|
297
|
-
// determine whether the slice is in a cluster of small values
|
|
298
|
-
// to avoid percentage text overlap for small values
|
|
299
|
-
const prev = children[i === 0 ? children.length - 1 : i - 1];
|
|
300
|
-
const prevPerc = this.amountToPercent(parseInt(prev.getAttribute("amount") || "0"), true);
|
|
301
|
-
const next = children[i === children.length - 1 ? 0 : i + 1];
|
|
302
|
-
const nextPerc = this.amountToPercent(parseInt(next.getAttribute("amount") || "0"), true);
|
|
303
|
-
const isSmall = perc < 4;
|
|
304
|
-
const prevIsSmall = prevPerc < 5;
|
|
305
|
-
const nextIsSmall = nextPerc < 5;
|
|
306
|
-
let inSmallCluster = isSmall && (prevIsSmall || nextIsSmall);
|
|
307
|
-
// because <1% slice percentage text has an additional character
|
|
308
|
-
// the inSmallCluster threshold needs to be widened for that slice only
|
|
309
|
-
const lessThanOnePerc = perc === 0 && amount > 0;
|
|
310
|
-
if (lessThanOnePerc && (nextPerc < 8 || prevPerc < 8)) {
|
|
311
|
-
inSmallCluster = true;
|
|
312
|
-
}
|
|
313
|
-
// for bar5, first color should be skipped unless notStartedColor is set to true
|
|
314
|
-
const ind = this.getType() === "bar5" ? (this.notStartedColor ? i : i + 1) : i;
|
|
315
|
-
const color = this.types[this.getType()].colors[ind];
|
|
316
|
-
const sliceData = {
|
|
317
|
-
amount: amount,
|
|
318
|
-
perc: perc,
|
|
319
|
-
legend: c.getAttribute("legend"),
|
|
320
|
-
color: color || "#d4d4d4",
|
|
321
|
-
offset: acc,
|
|
322
|
-
id: `${this.uid}-${i + 1}`,
|
|
323
|
-
title: c.getAttribute("popover-title"),
|
|
324
|
-
text: c.getAttribute("popover-text"),
|
|
325
|
-
buttonText: c.getAttribute("popover-button-text"),
|
|
326
|
-
sliceRef: c,
|
|
327
|
-
inSmallCluster: inSmallCluster,
|
|
328
|
-
};
|
|
329
|
-
acc += amount;
|
|
330
|
-
this.slicesData.push(sliceData);
|
|
331
|
-
});
|
|
332
|
-
this.chartData = this.types[this.getType()];
|
|
333
|
-
}
|
|
334
|
-
getSliceEls() {
|
|
335
|
-
if (this.svgEl) {
|
|
336
|
-
this.sliceEls = Array.from(this.svgEl.querySelectorAll(this.chartData.isBar ? "rect" : "path"));
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
handleResize() {
|
|
340
|
-
if (this.chartType === "hybrid") {
|
|
341
|
-
this.debouncedUpdate();
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
async componentWillLoad() {
|
|
345
|
-
if (!this.label) {
|
|
346
|
-
throw new Error("For accessibility purposes, you must provide a label for the chart. See https://components.watermarkinsights.com/chart for more information.");
|
|
347
|
-
}
|
|
348
|
-
if (this.chartType === "hybrid") {
|
|
349
|
-
this.setHybridType();
|
|
350
|
-
}
|
|
351
|
-
await this.getData();
|
|
352
|
-
}
|
|
353
|
-
componentDidLoad() {
|
|
354
|
-
this.getSliceEls();
|
|
355
|
-
}
|
|
356
|
-
componentDidUpdate() {
|
|
357
|
-
this.getSliceEls();
|
|
358
|
-
}
|
|
359
|
-
handleSliceUpdate() {
|
|
360
|
-
this.debouncedSliceUpdate();
|
|
361
|
-
}
|
|
362
|
-
/* RENDERING */
|
|
363
|
-
renderFilter() {
|
|
364
|
-
return (h("defs", null, h("filter", { id: "wmHoverDropShadow" }, h("feGaussianBlur", { stdDeviation: "3" }), h("feOffset", { result: "offsetblur" }), h("feFlood", { "flood-color": "#333" }), h("feComposite", { operator: "in", in2: "offsetblur" }), h("feMerge", null, h("feMergeNode", null), h("feMergeNode", { in: "SourceGraphic" })))));
|
|
365
|
-
}
|
|
366
|
-
// DOUGHNUT
|
|
367
|
-
renderDoughnut() {
|
|
368
|
-
const outerSize = this.chartData.size + this.chartData.padding;
|
|
369
|
-
return (h("div", { class: "svg-wrapper doughnut-wrapper" }, h("svg", { width: outerSize + "px", height: outerSize + "px", ref: (el) => (this.svgEl = el), id: `graphic-${this.uid}`, class: `chart-svg doughnut-svg ${this.isTabbing ? "user-is-tabbing" : ""}` }, this.renderFilter(), this.slicesData.map((s) => this.renderPath(s)), this.getType() === "doughnut0" ? (h("text", { class: "value", x: "50%", y: "50%", "font-size": "1.5rem", "font-weight": "500", "text-anchor": "middle", "dominant-baseline": "middle" }, this.amountToPercent(this.slicesData[0].amount, true) + "%")) : (h("g", { transform: `translate(${this.chartData.padding / 2}, ${this.chartData.padding / 2})`, "text-anchor": "middle", "dominant-baseline": "middle" }, this.slicesData.map((s) => (s.amount > 0 ? this.renderDoughnutText(s) : "")))))));
|
|
370
|
-
}
|
|
371
|
-
renderPath(s) {
|
|
372
|
-
return (h("g", { transform: `translate(${this.chartData.padding / 2}, ${this.chartData.padding / 2})` }, h("path", { id: s.id, fill: s.amount ? s.color : "transparent", d: this.getPathData(s.amount, s.offset), onClick: (ev) => {
|
|
373
|
-
if (this.popoverEl) {
|
|
374
|
-
if (!this.isTabbing) {
|
|
375
|
-
s.coords = { x: ev.clientX, y: ev.clientY };
|
|
376
|
-
this.openPopover(s);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}, onFocus: (ev) => {
|
|
380
|
-
if (this.popoverEl) {
|
|
381
|
-
if (this.isTabbing) {
|
|
382
|
-
s.coords = getPosition(ev.target);
|
|
383
|
-
this.openPopover(s);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}, onKeyDown: (ev) => {
|
|
387
|
-
if (this.popoverEl && this.popoverEl.open && ev.keyCode === 13) {
|
|
388
|
-
const popoverBtn = this.popoverEl.querySelector("button");
|
|
389
|
-
popoverBtn && popoverBtn.click();
|
|
390
|
-
}
|
|
391
|
-
} }), h("text", { class: "sr-only" }, s.legend)));
|
|
392
|
-
}
|
|
393
|
-
renderDoughnutText(s) {
|
|
394
|
-
if (!s.inSmallCluster) {
|
|
395
|
-
const arcMiddle = this.amountToDegree(s.offset + s.amount / 2);
|
|
396
|
-
let { x, y } = this.polarToCartesian(this.chartData.size / 2, 1.4, arcMiddle - 90);
|
|
397
|
-
return (h("text", { class: "value", x: x + "px", y: y + "px" }, `${s.perc > 0 ? s.perc : "<1"}%`));
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
// BAR
|
|
401
|
-
renderBar() {
|
|
402
|
-
return (h("div", { class: "svg-wrapper bar-wrapper" }, this.getType() === "bar1" ? (h("div", { class: "single-perc" }, this.amountToPercent(this.slicesData[0].amount, true) + "%")) : (""), this.drawAxis(), h("svg", { ref: (el) => (this.svgEl = el), id: `graphic-${this.uid}`, class: {
|
|
403
|
-
"chart-svg bar-svg": true,
|
|
404
|
-
"user-is-tabbing": this.isTabbing,
|
|
405
|
-
"show-values": this.showValues === "percentage" || this.showValues === "amount",
|
|
406
|
-
} }, this.renderFilter(), h("foreignObject", { class: this.getType() === "bar2" || this.getType() === "bar4" || this.getType() === "bar5" ? "focus-offset" : "" }, h("div", {
|
|
407
|
-
// @ts-ignore
|
|
408
|
-
xmlns: "http://www.w3.org/1999/xhtml", class: "tabbing-focus"
|
|
409
|
-
})), this.slicesData.map((s, idx) => this.renderRect(s, idx)), this.getType() !== "bar1" ? (h("g", { class: "percs" }, this.slicesData.map((s) => (s.perc > 0 ? this.renderBarText(s) : "")))) : (""))));
|
|
410
|
-
}
|
|
411
|
-
renderRect(s, idx) {
|
|
412
|
-
let y;
|
|
413
|
-
switch (this.getType()) {
|
|
414
|
-
case "bar2":
|
|
415
|
-
case "bar4":
|
|
416
|
-
case "bar5":
|
|
417
|
-
y = this.showValues === "percentage" || this.showValues === "amount" ? "30px" : "0";
|
|
418
|
-
break;
|
|
419
|
-
default:
|
|
420
|
-
y = "0";
|
|
421
|
-
}
|
|
422
|
-
return (h("g", { class: "barcontainer" }, h("style", null, ` #${s.id} {
|
|
423
|
-
fill:${s.color};
|
|
424
|
-
x: ${`${this.amountToPercent(s.offset, false)}%`};
|
|
425
|
-
y: ${y};
|
|
426
|
-
height: 30px;
|
|
427
|
-
width: calc(${this.amountToPercent(s.amount, false)}%${idx !== this.slicesData.length - 1 ? " - 2px" : ""});
|
|
428
|
-
}`), h("rect", { id: s.id, onClick: (ev) => {
|
|
429
|
-
if (this.popoverEl) {
|
|
430
|
-
if (!this.isTabbing) {
|
|
431
|
-
s.coords = { x: ev.clientX, y: ev.clientY };
|
|
432
|
-
this.openPopover(s);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}, onFocus: (ev) => {
|
|
436
|
-
if (this.popoverEl) {
|
|
437
|
-
if (this.isTabbing) {
|
|
438
|
-
s.coords = getPosition(ev.target);
|
|
439
|
-
this.openPopover(s);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}, onKeyDown: (ev) => {
|
|
443
|
-
if (this.popoverEl && this.popoverEl.open && ev.keyCode === 13) {
|
|
444
|
-
const popoverBtn = this.popoverEl.querySelector("button");
|
|
445
|
-
popoverBtn && popoverBtn.click();
|
|
446
|
-
}
|
|
447
|
-
} }), h("text", { class: "sr-only" }, s.legend)));
|
|
448
|
-
}
|
|
449
|
-
renderBarText(s) {
|
|
450
|
-
let val;
|
|
451
|
-
if (this.showValues === "percentage") {
|
|
452
|
-
val = s.perc + "%";
|
|
453
|
-
}
|
|
454
|
-
else if (this.showValues === "amount") {
|
|
455
|
-
val = s.amount;
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
return (h("text", { class: "value", x: `${this.amountToPercent(s.offset, false) + this.amountToPercent(s.amount, false) / 2}%` }, val));
|
|
461
|
-
}
|
|
462
|
-
drawAxis() {
|
|
463
|
-
if (this.getType() === "bar3") {
|
|
464
|
-
return (h("svg", { class: "axis" }, h("line", { x1: "0", x2: "100%", y1: "0", y2: "0" }), h("line", { x1: "0", x2: "0", y1: "0", y2: "-85px" }), h("line", { class: "tick", x1: "0.5", x2: "0.5", y1: "0", y2: "6" }), h("text", { x: "0.5", y: "-6" }, "0%"), h("line", { class: "tick", x1: "100%", x2: "100%", y1: "0", y2: "6" }), h("text", { x: "100%", y: "-6" }, "100%")));
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
renderCompletionMessage() {
|
|
468
|
-
if (this.chartType === "hybrid" && this.completionMessage) {
|
|
469
|
-
return h("span", { class: "completion-message" }, this.completionMessage);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
renderLegend() {
|
|
473
|
-
// legend is hidden for bar1 type regardless of showLegend value
|
|
474
|
-
if (this.showLegend) {
|
|
475
|
-
const hasCluster = this.slicesData.reduce((hasCluster, cur) => (hasCluster = cur.inSmallCluster ? true : hasCluster), false);
|
|
476
|
-
return (h("div", { class: "legend-wrapper" }, h("div", { class: `legend ${this.chartData.isBar ? "--top" : "--bottom"}`, "aria-hidden": "true" }, this.total > 0
|
|
477
|
-
? this.slicesData.map((s) => {
|
|
478
|
-
// when both legend and amount are omitted, the legend is not shown for that particular option (it's been deactivated by the user)
|
|
479
|
-
if (!!s.amount || !!s.legend) {
|
|
480
|
-
return (h("div", { class: "legend-item" }, h("div", { class: "legend-color", style: { "background-color": s.color } }), h("div", { class: "legend-text" }, s.legend)));
|
|
481
|
-
}
|
|
482
|
-
})
|
|
483
|
-
: ""), !this.chartData.isBar && hasCluster ? (h("div", { class: "cluster-warning" }, intl.formatMessage({
|
|
484
|
-
id: "chart.hiddenPercentages",
|
|
485
|
-
defaultMessage: "Percentages smaller than 5% are not shown when too close to each other.",
|
|
486
|
-
}), h("br", null), intl.formatMessage({
|
|
487
|
-
id: "chart.clickToSeeDetails",
|
|
488
|
-
defaultMessage: "Click or use arrow keys to see details.",
|
|
489
|
-
}))) : ("")));
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
render() {
|
|
493
|
-
return (h(Host, { role: "application", "aria-label": this.label +
|
|
494
|
-
", " +
|
|
495
|
-
intl.formatMessage({
|
|
496
|
-
id: "chart.interactiveChart",
|
|
497
|
-
defaultMessage: "Interactive chart. Use arrow keys to browse elements, press Tab to exit.",
|
|
498
|
-
}), tabindex: "0" }, h("div", { class: `component-wrapper ${this.getType()}` }, h("label", { class: "label", id: `label-${this.uid}`, htmlFor: `graphic-${this.uid}` }, h("span", { class: "label-text" }, this.label), this.subinfo ? h("span", { class: "subinfo" }, this.subinfo) : ""), this.chartData.isBar ? this.renderLegend() : "", this.total > 0 && this.chartData.isBar ? this.renderBar() : this.renderDoughnut(), !this.chartData.isBar ? this.renderLegend() : "", h("priv-chart-popover", { class: this.isTabbing ? "user-is-tabbing" : "", ref: (el) => (this.popoverEl = el) }), this.renderCompletionMessage())));
|
|
499
|
-
}
|
|
500
|
-
get el() { return getElement(this); }
|
|
501
|
-
};
|
|
502
|
-
Chart.style = wmChartCss;
|
|
503
|
-
|
|
504
|
-
export { Chart as wm_chart };
|