@3t-transform/threeteeui 1.9.101 → 1.9.103
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/cjs/{auto-be8ad100.js → auto-356ad09b.js} +177 -177
- package/dist/cjs/{domsanitiser.options-55ce2d65.js → domsanitiser.options-065dbed8.js} +12 -12
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{tttx-action-dropdown_1_9_101.cjs.entry.js → tttx-action-dropdown_1_9_103.cjs.entry.js} +51 -51
- package/dist/cjs/{tttx-button-v2_1_9_101.cjs.entry.js → tttx-button-v2_1_9_103.cjs.entry.js} +147 -147
- package/dist/cjs/{tttx-button_1_9_101.cjs.entry.js → tttx-button_1_9_103.cjs.entry.js} +26 -26
- package/dist/cjs/{tttx-chart_1_9_101.cjs.entry.js → tttx-chart_1_9_103.cjs.entry.js} +524 -524
- package/dist/cjs/{tttx-checkbox-group-caption_1_9_101.cjs.entry.js → tttx-checkbox-group-caption_1_9_103.cjs.entry.js} +9 -9
- package/dist/cjs/{tttx-checkbox-group-heading_1_9_101.cjs.entry.js → tttx-checkbox-group-heading_1_9_103.cjs.entry.js} +9 -9
- package/dist/cjs/{tttx-checkbox-group_1_9_101.cjs.entry.js → tttx-checkbox-group_1_9_103.cjs.entry.js} +9 -9
- package/dist/cjs/{tttx-checkbox_1_9_101.cjs.entry.js → tttx-checkbox_1_9_103.cjs.entry.js} +33 -33
- package/dist/cjs/{tttx-comments_1_9_101.cjs.entry.js → tttx-comments_1_9_103.cjs.entry.js} +204 -204
- package/dist/cjs/{tttx-data-pattern_1_9_101.cjs.entry.js → tttx-data-pattern_1_9_103.cjs.entry.js} +20 -20
- package/dist/cjs/{tttx-datacard_1_9_101.cjs.entry.js → tttx-datacard_1_9_103.cjs.entry.js} +43 -43
- package/dist/cjs/tttx-date-range-picker.cjs.entry.js +212 -212
- package/dist/cjs/{tttx-dialog-box_1_9_101.cjs.entry.js → tttx-dialog-box_1_9_103.cjs.entry.js} +94 -94
- package/dist/cjs/{tttx-dialog_1_9_101.cjs.entry.js → tttx-dialog_1_9_103.cjs.entry.js} +69 -69
- package/dist/cjs/{tttx-expander_1_9_101.cjs.entry.js → tttx-expander_1_9_103.cjs.entry.js} +28 -28
- package/dist/cjs/{tttx-filter_1_9_101_4.cjs.entry.js → tttx-filter_1_9_103_4.cjs.entry.js} +386 -386
- package/dist/cjs/{tttx-form_1_9_101.cjs.entry.js → tttx-form_1_9_103.cjs.entry.js} +985 -985
- package/dist/cjs/{tttx-graph_1_9_101.cjs.entry.js → tttx-graph_1_9_103.cjs.entry.js} +124 -124
- package/dist/cjs/{tttx-icon_1_9_101.cjs.entry.js → tttx-icon_1_9_103.cjs.entry.js} +24 -24
- package/dist/cjs/{tttx-keyvalue-block_1_9_101.cjs.entry.js → tttx-keyvalue-block_1_9_103.cjs.entry.js} +62 -62
- package/dist/cjs/{tttx-loading-spinner_1_9_101_3.cjs.entry.js → tttx-loading-spinner_1_9_103_3.cjs.entry.js} +172 -172
- package/dist/cjs/{tttx-multiselect-box_1_9_101.cjs.entry.js → tttx-multiselect-box_1_9_103.cjs.entry.js} +175 -175
- package/dist/cjs/{tttx-percentage-bar_1_9_101.cjs.entry.js → tttx-percentage-bar_1_9_103.cjs.entry.js} +56 -56
- package/dist/cjs/{tttx-qrcode_1_9_101.cjs.entry.js → tttx-qrcode_1_9_103.cjs.entry.js} +28 -28
- package/dist/cjs/{tttx-range-slider_1_9_101.cjs.entry.js → tttx-range-slider_1_9_103.cjs.entry.js} +185 -185
- package/dist/cjs/{tttx-select-box_1_9_101.cjs.entry.js → tttx-select-box_1_9_103.cjs.entry.js} +239 -239
- package/dist/cjs/{tttx-skeleton_loader_1_9_101.cjs.entry.js → tttx-skeleton_loader_1_9_103.cjs.entry.js} +30 -30
- package/dist/cjs/{tttx-table_1_9_101.cjs.entry.js → tttx-table_1_9_103.cjs.entry.js} +72 -72
- package/dist/cjs/{tttx-tabs_1_9_101.cjs.entry.js → tttx-tabs_1_9_103.cjs.entry.js} +103 -103
- package/dist/cjs/{tttx-tag-v2_1_9_101.cjs.entry.js → tttx-tag-v2_1_9_103.cjs.entry.js} +72 -72
- package/dist/cjs/{tttx-textarea_1_9_101.cjs.entry.js → tttx-textarea_1_9_103.cjs.entry.js} +50 -50
- package/dist/cjs/{tttx-toggle_1_9_101.cjs.entry.js → tttx-toggle_1_9_103.cjs.entry.js} +30 -30
- package/dist/cjs/{tttx-tooltip_1_9_101.cjs.entry.js → tttx-tooltip_1_9_103.cjs.entry.js} +87 -87
- package/dist/cjs/{tttx-tree-view_1_9_101.cjs.entry.js → tttx-tree-view_1_9_103.cjs.entry.js} +342 -342
- package/dist/cjs/tttx.cjs.js +1 -1
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +129 -129
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +40 -40
- package/dist/collection/components/atoms/tttx-button-v2/tttx-button-v2.css +1 -1
- package/dist/collection/components/atoms/tttx-button-v2/tttx-button-v2.js +436 -436
- package/dist/collection/components/atoms/tttx-button-v2/tttx-button-v2.stories.js +143 -143
- package/dist/collection/components/atoms/tttx-checkbox/tttx-checkbox.js +154 -154
- package/dist/collection/components/atoms/tttx-checkbox/tttx-checkbox.stories.js +58 -58
- package/dist/collection/components/atoms/tttx-datacard/tttx-datacard.js +186 -186
- package/dist/collection/components/atoms/tttx-datacard/tttx-datacard.stories.js +92 -92
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +92 -92
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +26 -26
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +137 -137
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +94 -94
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +194 -194
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +53 -53
- package/dist/collection/components/atoms/tttx-percentage-bar/tttx-percentage-bar.js +168 -168
- package/dist/collection/components/atoms/tttx-percentage-bar/tttx-percentage-bar.stories.js +52 -52
- package/dist/collection/components/atoms/tttx-qrcode/tttx-qrcode.js +81 -81
- package/dist/collection/components/atoms/tttx-qrcode/tttx-qrcode.stories.js +22 -22
- package/dist/collection/components/atoms/tttx-skeleton-loader/tttx-skeleton-loader.js +225 -225
- package/dist/collection/components/atoms/tttx-skeleton-loader/tttx-skeleton-loader.stories.js +44 -44
- package/dist/collection/components/atoms/tttx-tag/tttx-tag.js +157 -157
- package/dist/collection/components/atoms/tttx-tag/tttx-tag.stories.js +53 -53
- package/dist/collection/components/atoms/tttx-tag-v2/tttx-tag-v2.js +281 -281
- package/dist/collection/components/atoms/tttx-tag-v2/tttx-tag-v2.stories.js +84 -84
- package/dist/collection/components/atoms/tttx-toggle/tttx-toggle.js +84 -84
- package/dist/collection/components/atoms/tttx-toggle/tttx-toggle.stories.js +8 -8
- package/dist/collection/components/domsanitiser.options.js +14 -14
- package/dist/collection/components/molecules/tttx-action-dropdown/tttx-action-dropdown.js +213 -213
- package/dist/collection/components/molecules/tttx-action-dropdown/tttx-action-dropdown.stories.js +55 -55
- package/dist/collection/components/molecules/tttx-chart/tttx-chart.js +793 -793
- package/dist/collection/components/molecules/tttx-chart/tttx-chart.stories.js +209 -209
- package/dist/collection/components/molecules/tttx-checkbox-group/components/tttx-checkbox-group-caption.js +17 -17
- package/dist/collection/components/molecules/tttx-checkbox-group/components/tttx-checkbox-group-heading.js +17 -17
- package/dist/collection/components/molecules/tttx-checkbox-group/tttx-checkbox-group.js +18 -18
- package/dist/collection/components/molecules/tttx-checkbox-group/tttx-checkbox-group.stories.js +62 -62
- package/dist/collection/components/molecules/tttx-comments/tttx-comments.js +536 -536
- package/dist/collection/components/molecules/tttx-comments/tttx-comments.stories.js +151 -151
- package/dist/collection/components/molecules/tttx-date-range-picker/tttx-date-range-picker.js +292 -292
- package/dist/collection/components/molecules/tttx-date-range-picker/tttx-date-range-picker.stories.js +48 -48
- package/dist/collection/components/molecules/tttx-dialog/icon-types.js +6 -6
- package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.js +218 -218
- package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.stories.js +50 -50
- package/dist/collection/components/molecules/tttx-dialog-box/tttx-dialog-box.js +246 -246
- package/dist/collection/components/molecules/tttx-dialog-box/tttx-dialog-box.stories.js +314 -314
- package/dist/collection/components/molecules/tttx-expander/tttx-expander.js +134 -134
- package/dist/collection/components/molecules/tttx-expander/tttx-expander.stories.js +46 -46
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +416 -416
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +81 -81
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +49 -49
- package/dist/collection/components/molecules/tttx-form/lib/timecomparatorChecks.js +64 -64
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +76 -76
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +1267 -1267
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +595 -595
- package/dist/collection/components/molecules/tttx-graph/gauge-label-plugin.js +14 -14
- package/dist/collection/components/molecules/tttx-graph/tttx-graph.js +184 -184
- package/dist/collection/components/molecules/tttx-graph/tttx-graph.stories.js +32 -32
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +165 -165
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +134 -134
- package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.js +499 -499
- package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.stories.js +151 -151
- package/dist/collection/components/molecules/tttx-range-slider/tttx-range-slider.js +304 -304
- package/dist/collection/components/molecules/tttx-range-slider/tttx-range-slider.stories.js +22 -22
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.js +671 -671
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.stories.js +140 -140
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +253 -253
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +43 -43
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +764 -764
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +191 -191
- package/dist/collection/components/molecules/tttx-table/tttx-table.css +1 -1
- package/dist/collection/components/molecules/tttx-table/tttx-table.js +318 -318
- package/dist/collection/components/molecules/tttx-table/tttx-table.stories.js +191 -191
- package/dist/collection/components/molecules/tttx-table/tttx-table.types.js +1 -1
- package/dist/collection/components/molecules/tttx-tabs/tttx-tabs.js +253 -253
- package/dist/collection/components/molecules/tttx-tabs/tttx-tabs.stories.js +82 -82
- package/dist/collection/components/molecules/tttx-textarea/tttx-textarea.js +420 -420
- package/dist/collection/components/molecules/tttx-textarea/tttx-textarea.stories.js +81 -81
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +73 -73
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +97 -97
- package/dist/collection/components/molecules/tttx-tooltip/tttx-tooltip.js +253 -253
- package/dist/collection/components/molecules/tttx-tooltip/tttx-tootip.stories.js +117 -117
- package/dist/collection/components/molecules/tttx-tree-view/helper/helper.js +1 -1
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.css +1 -1
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.js +463 -463
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.stories.js +402 -402
- package/dist/collection/components/organisms/tttx-data-pattern/tttx-data-pattern.js +176 -176
- package/dist/collection/components/organisms/tttx-data-pattern/tttx-data-pattern.stories.js +28 -28
- package/dist/collection/components/palette.stories.js +7 -7
- package/dist/collection/icons.js +2838 -2838
- package/dist/collection/index.js +1 -1
- package/dist/collection/shared/domsanitiser.options.js +14 -14
- package/dist/components/auto.js +177 -177
- package/dist/components/domsanitiser.options.js +12 -12
- package/dist/components/index.d.ts +38 -38
- package/dist/components/index.js +38 -38
- package/dist/components/tttx-action-dropdown_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-action-dropdown_1_9_101.js → tttx-action-dropdown_1_9_103.js} +81 -81
- package/dist/components/tttx-button-v2.js +182 -182
- package/dist/components/tttx-button-v2_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-button-v2_1_9_101.js → tttx-button-v2_1_9_103.js} +2 -2
- package/dist/components/tttx-button.js +51 -51
- package/dist/components/{tttx-dialog_1_9_101.d.ts → tttx-button_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-button_1_9_101.js → tttx-button_1_9_103.js} +2 -2
- package/dist/components/{tttx-table_1_9_101.d.ts → tttx-chart_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-chart_1_9_101.js → tttx-chart_1_9_103.js} +574 -574
- package/dist/components/tttx-checkbox-group-caption_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-checkbox-group-caption_1_9_101.js → tttx-checkbox-group-caption_1_9_103.js} +24 -24
- package/dist/components/tttx-checkbox-group-heading_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-checkbox-group-heading_1_9_101.js → tttx-checkbox-group-heading_1_9_103.js} +24 -24
- package/dist/components/tttx-checkbox-group_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-checkbox-group_1_9_101.js → tttx-checkbox-group_1_9_103.js} +25 -25
- package/dist/components/tttx-checkbox_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-checkbox_1_9_101.js → tttx-checkbox_1_9_103.js} +59 -59
- package/dist/components/tttx-comments_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-comments_1_9_101.js → tttx-comments_1_9_103.js} +241 -241
- package/dist/components/tttx-data-pattern_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-data-pattern_1_9_101.js → tttx-data-pattern_1_9_103.js} +80 -80
- package/dist/components/tttx-datacard_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-datacard_1_9_101.js → tttx-datacard_1_9_103.js} +79 -79
- package/dist/components/tttx-date-range-picker.js +242 -242
- package/dist/components/tttx-dialog-box_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-dialog-box_1_9_101.js → tttx-dialog-box_1_9_103.js} +125 -125
- package/dist/components/{tttx-filter_1_9_101.d.ts → tttx-dialog_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-dialog_1_9_101.js → tttx-dialog_1_9_103.js} +103 -103
- package/dist/components/tttx-expander_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-expander_1_9_101.js → tttx-expander_1_9_103.js} +55 -55
- package/dist/components/tttx-filter.js +217 -217
- package/dist/components/{tttx-button_1_9_101.d.ts → tttx-filter_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-filter_1_9_101.js → tttx-filter_1_9_103.js} +2 -2
- package/dist/components/{tttx-form_1_9_101.d.ts → tttx-form_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-form_1_9_101.js → tttx-form_1_9_103.js} +1039 -1039
- package/dist/components/tttx-graph.js +143 -143
- package/dist/components/{tttx-graph_1_9_101.d.ts → tttx-graph_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-graph_1_9_101.js → tttx-graph_1_9_103.js} +2 -2
- package/dist/components/tttx-icon.js +42 -42
- package/dist/components/{tttx-list_1_9_101.d.ts → tttx-icon_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-icon_1_9_101.js → tttx-icon_1_9_103.js} +2 -2
- package/dist/components/tttx-keyvalue-block_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-keyvalue-block_1_9_101.js → tttx-keyvalue-block_1_9_103.js} +83 -83
- package/dist/components/tttx-list.js +92 -92
- package/dist/components/{tttx-tabs_1_9_101.d.ts → tttx-list_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-list_1_9_101.js → tttx-list_1_9_103.js} +2 -2
- package/dist/components/tttx-loading-spinner.js +92 -92
- package/dist/components/tttx-loading-spinner_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-loading-spinner_1_9_101.js → tttx-loading-spinner_1_9_103.js} +2 -2
- package/dist/components/tttx-multiselect-box_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-multiselect-box_1_9_101.js → tttx-multiselect-box_1_9_103.js} +231 -231
- package/dist/components/tttx-percentage-bar_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-percentage-bar_1_9_101.js → tttx-percentage-bar_1_9_103.js} +80 -80
- package/dist/components/tttx-qrcode_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-qrcode_1_9_101.js → tttx-qrcode_1_9_103.js} +47 -47
- package/dist/components/tttx-range-slider_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-range-slider_1_9_101.js → tttx-range-slider_1_9_103.js} +208 -208
- package/dist/components/tttx-select-box.js +295 -295
- package/dist/components/tttx-select-box_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-select-box_1_9_101.js → tttx-select-box_1_9_103.js} +2 -2
- package/dist/components/tttx-skeleton_loader_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-skeleton_loader_1_9_101.js → tttx-skeleton_loader_1_9_103.js} +57 -57
- package/dist/components/tttx-sorter.js +136 -136
- package/dist/components/tttx-sorter_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-sorter_1_9_101.js → tttx-sorter_1_9_103.js} +2 -2
- package/dist/components/tttx-standalone-input.js +136 -136
- package/dist/components/tttx-standalone-input_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-standalone-input_1_9_101.js → tttx-standalone-input_1_9_103.js} +2 -2
- package/dist/components/{tttx-chart_1_9_101.d.ts → tttx-table_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-table_1_9_101.js → tttx-table_1_9_103.js} +109 -109
- package/dist/components/{tttx-icon_1_9_101.d.ts → tttx-tabs_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-tabs_1_9_101.js → tttx-tabs_1_9_103.js} +128 -128
- package/dist/components/{tttx-tag-v2_1_9_101.d.ts → tttx-tag-v2_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-tag-v2_1_9_101.js → tttx-tag-v2_1_9_103.js} +105 -105
- package/dist/components/tttx-tag.js +44 -44
- package/dist/components/{tttx-tag_1_9_101.d.ts → tttx-tag_1_9_103.d.ts} +4 -4
- package/dist/components/{tttx-tag_1_9_101.js → tttx-tag_1_9_103.js} +2 -2
- package/dist/components/tttx-textarea_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-textarea_1_9_101.js → tttx-textarea_1_9_103.js} +83 -83
- package/dist/components/tttx-toggle_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-toggle_1_9_101.js → tttx-toggle_1_9_103.js} +49 -49
- package/dist/components/tttx-toolbar.js +42 -42
- package/dist/components/tttx-toolbar_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-toolbar_1_9_101.js → tttx-toolbar_1_9_103.js} +2 -2
- package/dist/components/tttx-tooltip_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-tooltip_1_9_101.js → tttx-tooltip_1_9_103.js} +114 -114
- package/dist/components/tttx-tree-view_1_9_103.d.ts +11 -0
- package/dist/components/{tttx-tree-view_1_9_101.js → tttx-tree-view_1_9_103.js} +371 -371
- package/dist/esm/{auto-421f2656.js → auto-a07ee1b1.js} +177 -177
- package/dist/esm/{domsanitiser.options-38a67458.js → domsanitiser.options-2c1ef894.js} +12 -12
- package/dist/esm/loader.js +1 -1
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/{tttx-action-dropdown_1_9_101.entry.js → tttx-action-dropdown_1_9_103.entry.js} +51 -51
- package/dist/esm/{tttx-button-v2_1_9_101.entry.js → tttx-button-v2_1_9_103.entry.js} +147 -147
- package/dist/esm/{tttx-button_1_9_101.entry.js → tttx-button_1_9_103.entry.js} +26 -26
- package/dist/esm/{tttx-chart_1_9_101.entry.js → tttx-chart_1_9_103.entry.js} +524 -524
- package/dist/esm/{tttx-checkbox-group-caption_1_9_101.entry.js → tttx-checkbox-group-caption_1_9_103.entry.js} +9 -9
- package/dist/esm/{tttx-checkbox-group-heading_1_9_101.entry.js → tttx-checkbox-group-heading_1_9_103.entry.js} +9 -9
- package/dist/esm/{tttx-checkbox-group_1_9_101.entry.js → tttx-checkbox-group_1_9_103.entry.js} +9 -9
- package/dist/esm/{tttx-checkbox_1_9_101.entry.js → tttx-checkbox_1_9_103.entry.js} +33 -33
- package/dist/esm/{tttx-comments_1_9_101.entry.js → tttx-comments_1_9_103.entry.js} +204 -204
- package/dist/esm/{tttx-data-pattern_1_9_101.entry.js → tttx-data-pattern_1_9_103.entry.js} +20 -20
- package/dist/esm/{tttx-datacard_1_9_101.entry.js → tttx-datacard_1_9_103.entry.js} +43 -43
- package/dist/esm/tttx-date-range-picker.entry.js +212 -212
- package/dist/esm/{tttx-dialog-box_1_9_101.entry.js → tttx-dialog-box_1_9_103.entry.js} +94 -94
- package/dist/esm/{tttx-dialog_1_9_101.entry.js → tttx-dialog_1_9_103.entry.js} +69 -69
- package/dist/esm/{tttx-expander_1_9_101.entry.js → tttx-expander_1_9_103.entry.js} +28 -28
- package/dist/esm/{tttx-filter_1_9_101_4.entry.js → tttx-filter_1_9_103_4.entry.js} +383 -383
- package/dist/esm/{tttx-form_1_9_101.entry.js → tttx-form_1_9_103.entry.js} +985 -985
- package/dist/esm/{tttx-graph_1_9_101.entry.js → tttx-graph_1_9_103.entry.js} +124 -124
- package/dist/esm/{tttx-icon_1_9_101.entry.js → tttx-icon_1_9_103.entry.js} +24 -24
- package/dist/esm/{tttx-keyvalue-block_1_9_101.entry.js → tttx-keyvalue-block_1_9_103.entry.js} +62 -62
- package/dist/esm/{tttx-loading-spinner_1_9_101_3.entry.js → tttx-loading-spinner_1_9_103_3.entry.js} +170 -170
- package/dist/esm/{tttx-multiselect-box_1_9_101.entry.js → tttx-multiselect-box_1_9_103.entry.js} +175 -175
- package/dist/esm/{tttx-percentage-bar_1_9_101.entry.js → tttx-percentage-bar_1_9_103.entry.js} +56 -56
- package/dist/esm/{tttx-qrcode_1_9_101.entry.js → tttx-qrcode_1_9_103.entry.js} +28 -28
- package/dist/esm/{tttx-range-slider_1_9_101.entry.js → tttx-range-slider_1_9_103.entry.js} +185 -185
- package/dist/esm/{tttx-select-box_1_9_101.entry.js → tttx-select-box_1_9_103.entry.js} +239 -239
- package/dist/esm/{tttx-skeleton_loader_1_9_101.entry.js → tttx-skeleton_loader_1_9_103.entry.js} +30 -30
- package/dist/esm/{tttx-table_1_9_101.entry.js → tttx-table_1_9_103.entry.js} +72 -72
- package/dist/esm/{tttx-tabs_1_9_101.entry.js → tttx-tabs_1_9_103.entry.js} +103 -103
- package/dist/esm/{tttx-tag-v2_1_9_101.entry.js → tttx-tag-v2_1_9_103.entry.js} +72 -72
- package/dist/esm/{tttx-textarea_1_9_101.entry.js → tttx-textarea_1_9_103.entry.js} +50 -50
- package/dist/esm/{tttx-toggle_1_9_101.entry.js → tttx-toggle_1_9_103.entry.js} +30 -30
- package/dist/esm/{tttx-tooltip_1_9_101.entry.js → tttx-tooltip_1_9_103.entry.js} +87 -87
- package/dist/esm/{tttx-tree-view_1_9_101.entry.js → tttx-tree-view_1_9_103.entry.js} +342 -342
- package/dist/esm/tttx.js +1 -1
- package/dist/tttx/{p-b3f49d83.entry.js → p-0c5bc253.entry.js} +1 -1
- package/dist/tttx/{p-82b4e575.entry.js → p-10d2d044.entry.js} +1 -1
- package/dist/tttx/p-1623f3cf.entry.js +1 -1
- package/dist/tttx/{p-b161205b.entry.js → p-16aa3f67.entry.js} +1 -1
- package/dist/tttx/p-21707b8d.entry.js +1 -1
- package/dist/tttx/p-2251ab85.entry.js +1 -1
- package/dist/tttx/p-2d19c46c.entry.js +1 -1
- package/dist/tttx/p-358eaa44.entry.js +1 -1
- package/dist/tttx/p-362999b3.entry.js +1 -1
- package/dist/tttx/p-3ec67d75.entry.js +1 -1
- package/dist/tttx/p-44f0af69.entry.js +1 -1
- package/dist/tttx/p-4664d065.entry.js +1 -1
- package/dist/tttx/{p-00a849cf.entry.js → p-486ca932.entry.js} +1 -1
- package/dist/tttx/{p-e21e3a9c.entry.js → p-59115c8f.entry.js} +1 -1
- package/dist/tttx/p-5d289334.entry.js +1 -1
- package/dist/tttx/p-6ec18b4a.entry.js +1 -1
- package/dist/tttx/{p-a59ad197.entry.js → p-700c2816.entry.js} +1 -1
- package/dist/tttx/p-7b5b0670.entry.js +1 -1
- package/dist/tttx/p-7d1712fe.entry.js +1 -1
- package/dist/tttx/{p-41b69e01.entry.js → p-8f85ab3e.entry.js} +1 -1
- package/dist/tttx/p-a1b8ecda.entry.js +1 -1
- package/dist/tttx/p-a43e2c5e.entry.js +1 -1
- package/dist/tttx/p-b8cc0cb2.entry.js +1 -1
- package/dist/tttx/p-b9003a76.entry.js +1 -1
- package/dist/tttx/p-bb59054f.entry.js +1 -1
- package/dist/tttx/p-c66bc14c.entry.js +1 -1
- package/dist/tttx/p-c8051143.entry.js +1 -1
- package/dist/tttx/p-ca93f786.entry.js +1 -1
- package/dist/tttx/p-d21b0507.entry.js +1 -1
- package/dist/tttx/p-d945d492.entry.js +1 -1
- package/dist/tttx/{p-34e0e487.entry.js → p-df708b75.entry.js} +2 -2
- package/dist/tttx/p-f0c1380f.entry.js +1 -1
- package/dist/tttx/{p-0bb158ce.js → p-f411d1e5.js} +2 -2
- package/dist/tttx/{p-d4c4edbd.entry.js → p-fa25ee03.entry.js} +1 -1
- package/dist/tttx/{p-41f0bf7f.entry.js → p-fbdd1046.entry.js} +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +11 -11
- package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +11 -11
- package/dist/types/components/atoms/tttx-button-v2/tttx-button-v2.d.ts +36 -36
- package/dist/types/components/atoms/tttx-button-v2/tttx-button-v2.stories.d.ts +68 -68
- package/dist/types/components/atoms/tttx-checkbox/tttx-checkbox.d.ts +17 -17
- package/dist/types/components/atoms/tttx-datacard/tttx-datacard.d.ts +21 -21
- package/dist/types/components/atoms/tttx-datacard/tttx-datacard.stories.d.ts +44 -44
- package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +9 -9
- package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +25 -25
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +13 -13
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +11 -11
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +23 -23
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +47 -47
- package/dist/types/components/atoms/tttx-percentage-bar/tttx-percentage-bar.d.ts +22 -22
- package/dist/types/components/atoms/tttx-percentage-bar/tttx-percentage-bar.stories.d.ts +10 -10
- package/dist/types/components/atoms/tttx-qrcode/tttx-qrcode.d.ts +8 -8
- package/dist/types/components/atoms/tttx-qrcode/tttx-qrcode.stories.d.ts +23 -23
- package/dist/types/components/atoms/tttx-skeleton-loader/tttx-skeleton-loader.d.ts +14 -14
- package/dist/types/components/atoms/tttx-tag/tttx-tag.d.ts +10 -10
- package/dist/types/components/atoms/tttx-tag/tttx-tag.stories.d.ts +51 -51
- package/dist/types/components/atoms/tttx-tag-v2/tttx-tag-v2.d.ts +15 -15
- package/dist/types/components/atoms/tttx-tag-v2/tttx-tag-v2.stories.d.ts +48 -48
- package/dist/types/components/atoms/tttx-toggle/tttx-toggle.d.ts +11 -11
- package/dist/types/components/atoms/tttx-toggle/tttx-toggle.stories.d.ts +6 -6
- package/dist/types/components/domsanitiser.options.d.ts +10 -10
- package/dist/types/components/molecules/tttx-action-dropdown/tttx-action-dropdown.d.ts +21 -21
- package/dist/types/components/molecules/tttx-chart/tttx-chart.d.ts +60 -60
- package/dist/types/components/molecules/tttx-chart/tttx-chart.stories.d.ts +38 -38
- package/dist/types/components/molecules/tttx-checkbox-group/components/tttx-checkbox-group-caption.d.ts +3 -3
- package/dist/types/components/molecules/tttx-checkbox-group/components/tttx-checkbox-group-heading.d.ts +3 -3
- package/dist/types/components/molecules/tttx-checkbox-group/tttx-checkbox-group.d.ts +3 -3
- package/dist/types/components/molecules/tttx-checkbox-group/tttx-checkbox-group.stories.d.ts +15 -15
- package/dist/types/components/molecules/tttx-comments/tttx-comments.d.ts +68 -68
- package/dist/types/components/molecules/tttx-date-range-picker/tttx-date-range-picker.d.ts +42 -42
- package/dist/types/components/molecules/tttx-dialog/icon-types.d.ts +18 -18
- package/dist/types/components/molecules/tttx-dialog/tttx-dialog.d.ts +27 -27
- package/dist/types/components/molecules/tttx-dialog-box/tttx-dialog-box.d.ts +26 -26
- package/dist/types/components/molecules/tttx-dialog-box/tttx-dialog-box.stories.d.ts +24 -24
- package/dist/types/components/molecules/tttx-expander/tttx-expander.d.ts +16 -16
- package/dist/types/components/molecules/tttx-filter/tttx-filter.d.ts +44 -44
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +14 -14
- package/dist/types/components/molecules/tttx-form/lib/timecomparatorChecks.d.ts +4 -4
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +15 -15
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +297 -297
- package/dist/types/components/molecules/tttx-graph/gauge-label-plugin.d.ts +4 -4
- package/dist/types/components/molecules/tttx-graph/tttx-graph.d.ts +13 -13
- package/dist/types/components/molecules/tttx-graph/tttx-graph.stories.d.ts +26 -26
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +23 -23
- package/dist/types/components/molecules/tttx-multiselect-box/tttx-multiselect-box.d.ts +50 -50
- package/dist/types/components/molecules/tttx-range-slider/tttx-range-slider.d.ts +45 -45
- package/dist/types/components/molecules/tttx-range-slider/tttx-range-slider.stories.d.ts +7 -7
- package/dist/types/components/molecules/tttx-select-box/tttx-select-box.d.ts +55 -55
- package/dist/types/components/molecules/tttx-select-box/tttx-select-box.stories.d.ts +28 -28
- package/dist/types/components/molecules/tttx-sorter/tttx-sorter.d.ts +21 -21
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +69 -69
- package/dist/types/components/molecules/tttx-table/tttx-table.d.ts +32 -32
- package/dist/types/components/molecules/tttx-table/tttx-table.types.d.ts +6 -6
- package/dist/types/components/molecules/tttx-tabs/tttx-tabs.d.ts +25 -25
- package/dist/types/components/molecules/tttx-textarea/tttx-textarea.d.ts +42 -42
- package/dist/types/components/molecules/tttx-textarea/tttx-textarea.stories.d.ts +89 -89
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +8 -8
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +19 -19
- package/dist/types/components/molecules/tttx-tooltip/tttx-tooltip.d.ts +37 -37
- package/dist/types/components/molecules/tttx-tooltip/tttx-tootip.stories.d.ts +12 -12
- package/dist/types/components/molecules/tttx-tree-view/helper/helper.d.ts +24 -24
- package/dist/types/components/molecules/tttx-tree-view/tttx-tree-view.d.ts +57 -57
- package/dist/types/components/organisms/tttx-data-pattern/tttx-data-pattern.d.ts +11 -11
- package/dist/types/components/organisms/tttx-data-pattern/tttx-data-pattern.stories.d.ts +13 -13
- package/dist/types/components/palette.stories.d.ts +6 -6
- package/dist/types/components.d.ts +451 -451
- package/dist/types/icons.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/shared/domsanitiser.options.d.ts +10 -10
- package/package.json +1 -1
- package/dist/components/tttx-action-dropdown_1_9_101.d.ts +0 -11
- package/dist/components/tttx-button-v2_1_9_101.d.ts +0 -11
- package/dist/components/tttx-checkbox-group-caption_1_9_101.d.ts +0 -11
- package/dist/components/tttx-checkbox-group-heading_1_9_101.d.ts +0 -11
- package/dist/components/tttx-checkbox-group_1_9_101.d.ts +0 -11
- package/dist/components/tttx-checkbox_1_9_101.d.ts +0 -11
- package/dist/components/tttx-comments_1_9_101.d.ts +0 -11
- package/dist/components/tttx-data-pattern_1_9_101.d.ts +0 -11
- package/dist/components/tttx-datacard_1_9_101.d.ts +0 -11
- package/dist/components/tttx-dialog-box_1_9_101.d.ts +0 -11
- package/dist/components/tttx-expander_1_9_101.d.ts +0 -11
- package/dist/components/tttx-keyvalue-block_1_9_101.d.ts +0 -11
- package/dist/components/tttx-loading-spinner_1_9_101.d.ts +0 -11
- package/dist/components/tttx-multiselect-box_1_9_101.d.ts +0 -11
- package/dist/components/tttx-percentage-bar_1_9_101.d.ts +0 -11
- package/dist/components/tttx-qrcode_1_9_101.d.ts +0 -11
- package/dist/components/tttx-range-slider_1_9_101.d.ts +0 -11
- package/dist/components/tttx-select-box_1_9_101.d.ts +0 -11
- package/dist/components/tttx-skeleton_loader_1_9_101.d.ts +0 -11
- package/dist/components/tttx-sorter_1_9_101.d.ts +0 -11
- package/dist/components/tttx-standalone-input_1_9_101.d.ts +0 -11
- package/dist/components/tttx-textarea_1_9_101.d.ts +0 -11
- package/dist/components/tttx-toggle_1_9_101.d.ts +0 -11
- package/dist/components/tttx-toolbar_1_9_101.d.ts +0 -11
- package/dist/components/tttx-tooltip_1_9_101.d.ts +0 -11
- package/dist/components/tttx-tree-view_1_9_101.d.ts +0 -11
- package/dist/types/components/atoms/tttx-checkbox/tttx-checkbox.stories.d.ts +0 -47
- package/dist/types/components/atoms/tttx-skeleton-loader/tttx-skeleton-loader.stories.d.ts +0 -58
- package/dist/types/components/molecules/tttx-action-dropdown/tttx-action-dropdown.stories.d.ts +0 -36
- package/dist/types/components/molecules/tttx-comments/tttx-comments.stories.d.ts +0 -8
- package/dist/types/components/molecules/tttx-date-range-picker/tttx-date-range-picker.stories.d.ts +0 -28
- package/dist/types/components/molecules/tttx-dialog/tttx-dialog.stories.d.ts +0 -42
- package/dist/types/components/molecules/tttx-expander/tttx-expander.stories.d.ts +0 -27
- package/dist/types/components/molecules/tttx-filter/tttx-filter.stories.d.ts +0 -76
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +0 -718
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +0 -15
- package/dist/types/components/molecules/tttx-multiselect-box/tttx-multiselect-box.stories.d.ts +0 -17
- package/dist/types/components/molecules/tttx-sorter/tttx-sorter.stories.d.ts +0 -30
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +0 -150
- package/dist/types/components/molecules/tttx-table/tttx-table.stories.d.ts +0 -79
- package/dist/types/components/molecules/tttx-tabs/tttx-tabs.stories.d.ts +0 -13
- package/dist/types/components/molecules/tttx-tree-view/tttx-tree-view.stories.d.ts +0 -15
- /package/dist/tttx/{p-55799798.js → p-62d92a44.js} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2c07dc57.js');
|
|
6
|
-
const auto = require('./auto-
|
|
6
|
+
const auto = require('./auto-356ad09b.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @module constants
|
|
@@ -7168,528 +7168,528 @@ auto.adapters._date.override({
|
|
|
7168
7168
|
|
|
7169
7169
|
const tttxChartCss = ".chart-wrapper{position:relative;width:100%;height:100%;display:flex;flex-direction:column}.chart-canvas-container{flex:1;min-height:0;position:relative;width:100%}canvas{display:block;width:100% !important;height:100% !important}.export-buttons{display:flex;gap:0.5rem;justify-content:flex-end;padding-top:0.5rem;padding-bottom:0.5rem}.chart-loading{width:100%;height:100%;align-items:center;justify-content:center;display:flex}.error-content{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;align-self:stretch;background-color:#FAFAFA}.error-content .error-heading{color:var(--Text-Default-Default, #111);text-align:center;font-family:Roboto;font-size:14px;font-style:normal;font-weight:600;line-height:20px}.error-content .error-message{color:var(--Text-Neutral-Default, #737373);text-align:center;font-family:Roboto;font-size:14px;font-style:normal;font-weight:400;line-height:20px}.error-content .error-actions{display:flex;align-items:flex-start;gap:12px;margin-top:16px}";
|
|
7170
7170
|
|
|
7171
|
-
const TttxChart = class {
|
|
7172
|
-
constructor(hostRef) {
|
|
7173
|
-
index.registerInstance(this, hostRef);
|
|
7174
|
-
this.exportCSV = index.createEvent(this, "exportCSV", 7);
|
|
7175
|
-
this.chartType = undefined;
|
|
7176
|
-
this.chartData = undefined;
|
|
7177
|
-
this.chartOptions = undefined;
|
|
7178
|
-
this.loading = false;
|
|
7179
|
-
this.error = undefined;
|
|
7180
|
-
this.fallbackText = 'No data available';
|
|
7181
|
-
this.width = '100%';
|
|
7182
|
-
this.height = 'auto';
|
|
7183
|
-
this.isYAxisPercentageValues = false;
|
|
7184
|
-
this.showActiveSegmentLabel = false;
|
|
7185
|
-
this.initialActiveIndex = 0;
|
|
7186
|
-
this.activeSegmentChangeCallback = undefined;
|
|
7187
|
-
this.exportable = false;
|
|
7188
|
-
this.chartInstance = undefined;
|
|
7189
|
-
this.showPngSvgExport = false;
|
|
7190
|
-
this.selectedSegmentIndex = null;
|
|
7191
|
-
this.hoverSegmentIndex = null;
|
|
7192
|
-
}
|
|
7193
|
-
handleUpdate(newData) {
|
|
7194
|
-
if (!newData || !newData.datasets || newData.datasets.length === 0) {
|
|
7195
|
-
this.destroyChart();
|
|
7196
|
-
return;
|
|
7197
|
-
}
|
|
7198
|
-
if (this.chartType === 'line') {
|
|
7199
|
-
setTimeout(() => {
|
|
7200
|
-
this.renderChart();
|
|
7201
|
-
}, 0);
|
|
7202
|
-
return;
|
|
7203
|
-
}
|
|
7204
|
-
if (this.chartType === 'doughnut-v2') {
|
|
7205
|
-
if (this.hasChartDataChanged()) {
|
|
7206
|
-
this.renderChart();
|
|
7207
|
-
this.previousChartData = this.deepClone(this.chartData);
|
|
7208
|
-
}
|
|
7209
|
-
return;
|
|
7210
|
-
}
|
|
7211
|
-
this.renderChart();
|
|
7212
|
-
}
|
|
7213
|
-
componentDidLoad() {
|
|
7214
|
-
if (this.chartType === 'doughnut-v2') {
|
|
7215
|
-
this.previousChartData = this.deepClone(this.chartData);
|
|
7216
|
-
}
|
|
7217
|
-
this.renderChart();
|
|
7218
|
-
this.notifyActiveSegment();
|
|
7219
|
-
}
|
|
7220
|
-
hasChartDataChanged() {
|
|
7221
|
-
if (!this.previousChartData)
|
|
7222
|
-
return true;
|
|
7223
|
-
try {
|
|
7224
|
-
return JSON.stringify(this.previousChartData) !== JSON.stringify(this.chartData);
|
|
7225
|
-
}
|
|
7226
|
-
catch (_a) {
|
|
7227
|
-
return true;
|
|
7228
|
-
}
|
|
7229
|
-
}
|
|
7230
|
-
deepClone(obj) {
|
|
7231
|
-
try {
|
|
7232
|
-
return JSON.parse(JSON.stringify(obj));
|
|
7233
|
-
}
|
|
7234
|
-
catch (_a) {
|
|
7235
|
-
return obj;
|
|
7236
|
-
}
|
|
7237
|
-
}
|
|
7238
|
-
disconnectedCallback() {
|
|
7239
|
-
this.destroyChart();
|
|
7240
|
-
}
|
|
7241
|
-
renderChart() {
|
|
7242
|
-
var _a, _b, _c;
|
|
7243
|
-
if (!this.canvasEl || !this.chartData || !this.chartType)
|
|
7244
|
-
return;
|
|
7245
|
-
this.destroyChart();
|
|
7246
|
-
const chartData = Object.assign(Object.assign({}, this.chartData), { datasets: ((_a = this.chartData.datasets) === null || _a === void 0 ? void 0 : _a.map(d => (Object.assign({}, d)))) || [] });
|
|
7247
|
-
const config = {
|
|
7248
|
-
type: this.getChartJsType(),
|
|
7249
|
-
data: chartData,
|
|
7250
|
-
options: this.getChartOptions(),
|
|
7251
|
-
plugins: []
|
|
7252
|
-
};
|
|
7253
|
-
if (this.chartType === 'doughnut' || this.chartType === 'semi-gauge' || this.chartType === 'doughnut-v2') {
|
|
7254
|
-
const total = ((_c = (_b = chartData.datasets[0]) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.map((d) => Number(d) || 0).reduce((a, b) => a + b, 0)) || 0;
|
|
7255
|
-
config.plugins.push(this.getCenterTextPlugin(total.toLocaleString()));
|
|
7256
|
-
}
|
|
7257
|
-
if (this.chartType === 'doughnut-v2') {
|
|
7258
|
-
config.plugins.push(this.getLegendHoverPlugin());
|
|
7259
|
-
}
|
|
7260
|
-
// create chart
|
|
7261
|
-
this.chartInstance = new auto.Chart(this.canvasEl, config);
|
|
7262
|
-
// Initialize colors for doughnut-v2
|
|
7263
|
-
if (this.chartType === 'doughnut-v2') {
|
|
7264
|
-
this.chartInstance.setDatasetVisibility(0, true);
|
|
7265
|
-
this.updateChartColors();
|
|
7266
|
-
}
|
|
7267
|
-
}
|
|
7268
|
-
destroyChart() {
|
|
7269
|
-
if (this.chartInstance) {
|
|
7270
|
-
this.chartInstance.destroy();
|
|
7271
|
-
this.chartInstance = undefined;
|
|
7272
|
-
}
|
|
7273
|
-
}
|
|
7274
|
-
getChartJsType() {
|
|
7275
|
-
if (this.chartType === 'semi-gauge' || this.chartType === 'doughnut-v2')
|
|
7276
|
-
return 'doughnut';
|
|
7277
|
-
return this.chartType;
|
|
7278
|
-
}
|
|
7279
|
-
getBaseOptions() {
|
|
7280
|
-
return {
|
|
7281
|
-
responsive: true,
|
|
7282
|
-
maintainAspectRatio: false,
|
|
7283
|
-
plugins: {
|
|
7284
|
-
legend: {
|
|
7285
|
-
display: true,
|
|
7286
|
-
position: 'bottom',
|
|
7287
|
-
labels: {
|
|
7288
|
-
usePointStyle: true,
|
|
7289
|
-
pointStyle: 'circle',
|
|
7290
|
-
font: {
|
|
7291
|
-
size: 14
|
|
7292
|
-
}
|
|
7293
|
-
},
|
|
7294
|
-
},
|
|
7295
|
-
tooltip: {
|
|
7296
|
-
callbacks: {
|
|
7297
|
-
label: (ctx) => {
|
|
7298
|
-
const label = ctx.label || ctx.dataset.label || '';
|
|
7299
|
-
// Convert value to number and fix to 2 decimal places
|
|
7300
|
-
const value = Number(ctx.raw);
|
|
7301
|
-
const formattedValue = isNaN(value) ? ctx.formattedValue : value.toFixed(2);
|
|
7302
|
-
return `${label}: ${formattedValue}`;
|
|
7303
|
-
},
|
|
7304
|
-
},
|
|
7305
|
-
backgroundColor: '#17272B'
|
|
7306
|
-
},
|
|
7307
|
-
},
|
|
7308
|
-
};
|
|
7309
|
-
}
|
|
7310
|
-
getLineChartConfig() {
|
|
7311
|
-
const startOfCurrentMonth = new Date();
|
|
7312
|
-
startOfCurrentMonth.setDate(1);
|
|
7313
|
-
startOfCurrentMonth.setHours(0, 0, 0, 0);
|
|
7314
|
-
return {
|
|
7315
|
-
responsive: true,
|
|
7316
|
-
maintainAspectRatio: false,
|
|
7317
|
-
animation: { duration: 0 },
|
|
7318
|
-
elements: {
|
|
7319
|
-
point: { radius: 0, hoverRadius: 4 },
|
|
7320
|
-
},
|
|
7321
|
-
plugins: {
|
|
7322
|
-
legend: {
|
|
7323
|
-
labels: {
|
|
7324
|
-
padding: 20,
|
|
7325
|
-
generateLabels: (chart) => {
|
|
7326
|
-
return chart.data.datasets.map((dataset, i) => ({
|
|
7327
|
-
text: dataset.label || '',
|
|
7328
|
-
strokeStyle: dataset.borderColor,
|
|
7329
|
-
fillStyle: dataset.backgroundColor || 'transparent',
|
|
7330
|
-
lineDash: dataset.borderDash || [],
|
|
7331
|
-
lineWidth: dataset.borderWidth || 2,
|
|
7332
|
-
hidden: !chart.isDatasetVisible(i),
|
|
7333
|
-
datasetIndex: i,
|
|
7334
|
-
pointStyle: 'line',
|
|
7335
|
-
}));
|
|
7336
|
-
},
|
|
7337
|
-
},
|
|
7338
|
-
},
|
|
7339
|
-
tooltip: {
|
|
7340
|
-
mode: 'index',
|
|
7341
|
-
intersect: false,
|
|
7342
|
-
backgroundColor: '#17272B',
|
|
7343
|
-
titleFont: { size: 14, weight: 'bold' },
|
|
7344
|
-
bodyFont: { size: 12 },
|
|
7345
|
-
callbacks: {
|
|
7346
|
-
title: (context) => {
|
|
7347
|
-
var _a, _b;
|
|
7348
|
-
if (!context || !context.length)
|
|
7349
|
-
return '';
|
|
7350
|
-
const date = new Date((_b = (_a = context[0].parsed) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : context[0].label);
|
|
7351
|
-
return date.toLocaleDateString(undefined, {
|
|
7352
|
-
day: '2-digit',
|
|
7353
|
-
month: 'short',
|
|
7354
|
-
year: 'numeric',
|
|
7355
|
-
});
|
|
7356
|
-
},
|
|
7357
|
-
label: (ctx) => {
|
|
7358
|
-
const rawValue = ctx.parsed && ctx.parsed.y !== undefined ? ctx.parsed.y : ctx.raw;
|
|
7359
|
-
// Format to max 2 decimal places
|
|
7360
|
-
const value = Number(rawValue);
|
|
7361
|
-
const formattedValue = isNaN(value) ? rawValue : value.toFixed(2);
|
|
7362
|
-
return `${ctx.dataset.label}: ${formattedValue}${this.isYAxisPercentageValues ? '%' : ''}`;
|
|
7363
|
-
},
|
|
7364
|
-
labelColor: (ctx) => {
|
|
7365
|
-
if (ctx.dataset.label !== 'Overall') {
|
|
7366
|
-
return {
|
|
7367
|
-
borderWidth: 2
|
|
7368
|
-
};
|
|
7369
|
-
}
|
|
7370
|
-
return {
|
|
7371
|
-
borderWidth: 2,
|
|
7372
|
-
borderColor: ctx.dataset.borderColor,
|
|
7373
|
-
backgroundColor: ctx.dataset.borderColor,
|
|
7374
|
-
};
|
|
7375
|
-
}
|
|
7376
|
-
},
|
|
7377
|
-
},
|
|
7378
|
-
},
|
|
7379
|
-
interaction: {
|
|
7380
|
-
mode: 'index',
|
|
7381
|
-
intersect: false,
|
|
7382
|
-
},
|
|
7383
|
-
scales: {
|
|
7384
|
-
x: {
|
|
7385
|
-
type: 'time',
|
|
7386
|
-
time: {
|
|
7387
|
-
unit: 'month',
|
|
7388
|
-
displayFormats: {
|
|
7389
|
-
month: 'MMM yyyy',
|
|
7390
|
-
},
|
|
7391
|
-
tooltipFormat: 'dd MMM yyyy',
|
|
7392
|
-
},
|
|
7393
|
-
grid: { color: '#E5E5E5' },
|
|
7394
|
-
border: { dash: [4, 4] },
|
|
7395
|
-
ticks: {
|
|
7396
|
-
autoSkip: true,
|
|
7397
|
-
maxRotation: 0,
|
|
7398
|
-
},
|
|
7399
|
-
},
|
|
7400
|
-
y: {
|
|
7401
|
-
min: 0,
|
|
7402
|
-
max: 100,
|
|
7403
|
-
beginAtZero: true,
|
|
7404
|
-
ticks: {
|
|
7405
|
-
stepSize: 20,
|
|
7406
|
-
callback: (value) => {
|
|
7407
|
-
const numValue = Number(value);
|
|
7408
|
-
const formatted = isNaN(numValue) ? value : (Number.isInteger(numValue) ? numValue : numValue.toFixed(2));
|
|
7409
|
-
return this.isYAxisPercentageValues ? `${formatted}%` : formatted;
|
|
7410
|
-
},
|
|
7411
|
-
},
|
|
7412
|
-
grid: { color: '#E5E5E5' },
|
|
7413
|
-
border: { dash: [4, 4] },
|
|
7414
|
-
},
|
|
7415
|
-
},
|
|
7416
|
-
};
|
|
7417
|
-
}
|
|
7418
|
-
getDoughnutChartConfig() {
|
|
7419
|
-
return {
|
|
7420
|
-
plugins: {
|
|
7421
|
-
legend: { labels: { pointStyle: 'circle', padding: 16, } },
|
|
7422
|
-
},
|
|
7423
|
-
cutout: '60%'
|
|
7424
|
-
};
|
|
7425
|
-
}
|
|
7426
|
-
getDoughnutV2ChartConfig() {
|
|
7427
|
-
return {
|
|
7428
|
-
plugins: {
|
|
7429
|
-
legend: {
|
|
7430
|
-
labels: {
|
|
7431
|
-
pointStyle: 'circle',
|
|
7432
|
-
padding: 16
|
|
7433
|
-
},
|
|
7434
|
-
onClick: (e, legendItem) => {
|
|
7435
|
-
e.stopPropagation();
|
|
7436
|
-
const index = legendItem.index;
|
|
7437
|
-
if (this.selectedSegmentIndex !== index) {
|
|
7438
|
-
this.selectedSegmentIndex = index;
|
|
7439
|
-
this.updateChartColors();
|
|
7440
|
-
this.notifyActiveSegment();
|
|
7441
|
-
}
|
|
7442
|
-
}
|
|
7443
|
-
},
|
|
7444
|
-
tooltip: {
|
|
7445
|
-
enabled: false
|
|
7446
|
-
}
|
|
7447
|
-
},
|
|
7448
|
-
cutout: '60%',
|
|
7449
|
-
onHover: (_event, activeElements) => {
|
|
7450
|
-
if (activeElements && activeElements.length > 0) {
|
|
7451
|
-
this.hoverSegmentIndex = activeElements[0].index;
|
|
7452
|
-
this.updateChartColors();
|
|
7453
|
-
}
|
|
7454
|
-
else {
|
|
7455
|
-
this.hoverSegmentIndex = null;
|
|
7456
|
-
this.updateChartColors();
|
|
7457
|
-
}
|
|
7458
|
-
},
|
|
7459
|
-
onClick: (_event, activeElements) => {
|
|
7460
|
-
if (activeElements && activeElements.length > 0) {
|
|
7461
|
-
const clickedIndex = activeElements[0].index;
|
|
7462
|
-
if (this.selectedSegmentIndex !== clickedIndex) {
|
|
7463
|
-
this.selectedSegmentIndex = clickedIndex;
|
|
7464
|
-
this.updateChartColors();
|
|
7465
|
-
this.notifyActiveSegment();
|
|
7466
|
-
}
|
|
7467
|
-
}
|
|
7468
|
-
},
|
|
7469
|
-
};
|
|
7470
|
-
}
|
|
7471
|
-
updateChartColors() {
|
|
7472
|
-
var _a, _b, _c, _d;
|
|
7473
|
-
if (!this.chartInstance || this.chartType !== 'doughnut-v2')
|
|
7474
|
-
return;
|
|
7475
|
-
const dataset = this.chartInstance.data.datasets[0];
|
|
7476
|
-
const chartDataDataset = (_b = (_a = this.chartData) === null || _a === void 0 ? void 0 : _a.datasets) === null || _b === void 0 ? void 0 : _b[0];
|
|
7477
|
-
if (this.chartType === 'doughnut-v2' && this.chartInstance.isDatasetVisible(0) === false) {
|
|
7478
|
-
this.chartInstance.setDatasetVisibility(0, true);
|
|
7479
|
-
}
|
|
7480
|
-
// Default color for doughnut-v2
|
|
7481
|
-
const defaultSelectedColor = '#45C9B0';
|
|
7482
|
-
const defaultHoverColor = '#A3A3A3';
|
|
7483
|
-
const defaultInactiveColor = '#E5E5E5';
|
|
7484
|
-
const selectedColors = chartDataDataset === null || chartDataDataset === void 0 ? void 0 : chartDataDataset.selectedColors;
|
|
7485
|
-
const hoverColors = chartDataDataset === null || chartDataDataset === void 0 ? void 0 : chartDataDataset.hoverColors;
|
|
7486
|
-
const inactiveColors = chartDataDataset === null || chartDataDataset === void 0 ? void 0 : chartDataDataset.inactiveColors;
|
|
7487
|
-
let newColors = [];
|
|
7488
|
-
if (this.selectedSegmentIndex !== null) {
|
|
7489
|
-
newColors = dataset.data.map((_, index) => {
|
|
7490
|
-
if (index === this.hoverSegmentIndex) {
|
|
7491
|
-
return (hoverColors === null || hoverColors === void 0 ? void 0 : hoverColors[index]) || defaultHoverColor;
|
|
7492
|
-
}
|
|
7493
|
-
else if (index === this.selectedSegmentIndex) {
|
|
7494
|
-
return (selectedColors === null || selectedColors === void 0 ? void 0 : selectedColors[index]) || defaultSelectedColor;
|
|
7495
|
-
}
|
|
7496
|
-
else {
|
|
7497
|
-
return (inactiveColors === null || inactiveColors === void 0 ? void 0 : inactiveColors[index]) || defaultInactiveColor;
|
|
7498
|
-
}
|
|
7499
|
-
});
|
|
7500
|
-
}
|
|
7501
|
-
else if (this.hoverSegmentIndex !== null) {
|
|
7502
|
-
const activeIndex = (_c = this.initialActiveIndex) !== null && _c !== void 0 ? _c : 0;
|
|
7503
|
-
newColors = dataset.data.map((_, index) => {
|
|
7504
|
-
if (index === this.hoverSegmentIndex) {
|
|
7505
|
-
return (hoverColors === null || hoverColors === void 0 ? void 0 : hoverColors[index]) || defaultHoverColor;
|
|
7506
|
-
}
|
|
7507
|
-
else if (index === activeIndex) {
|
|
7508
|
-
return (selectedColors === null || selectedColors === void 0 ? void 0 : selectedColors[index]) || defaultSelectedColor;
|
|
7509
|
-
}
|
|
7510
|
-
else {
|
|
7511
|
-
return (inactiveColors === null || inactiveColors === void 0 ? void 0 : inactiveColors[index]) || defaultInactiveColor;
|
|
7512
|
-
}
|
|
7513
|
-
});
|
|
7514
|
-
}
|
|
7515
|
-
else {
|
|
7516
|
-
// No hover or selection: show initial active state
|
|
7517
|
-
const activeIndex = (_d = this.initialActiveIndex) !== null && _d !== void 0 ? _d : 0;
|
|
7518
|
-
newColors = dataset.data.map((_, index) => {
|
|
7519
|
-
if (index === activeIndex) {
|
|
7520
|
-
return (selectedColors === null || selectedColors === void 0 ? void 0 : selectedColors[index]) || defaultSelectedColor;
|
|
7521
|
-
}
|
|
7522
|
-
return (inactiveColors === null || inactiveColors === void 0 ? void 0 : inactiveColors[index]) || defaultInactiveColor;
|
|
7523
|
-
});
|
|
7524
|
-
}
|
|
7525
|
-
dataset.backgroundColor = newColors;
|
|
7526
|
-
this.chartInstance.update('active');
|
|
7527
|
-
}
|
|
7528
|
-
lightenColor(color, percent) {
|
|
7529
|
-
if (!color || !color.startsWith('#'))
|
|
7530
|
-
return color;
|
|
7531
|
-
const num = parseInt(color.replace('#', ''), 16);
|
|
7532
|
-
const r = Math.min(255, ((num >> 16) & 0xFF) + percent);
|
|
7533
|
-
const g = Math.min(255, ((num >> 8) & 0xFF) + percent);
|
|
7534
|
-
const b = Math.min(255, (num & 0xFF) + percent);
|
|
7535
|
-
return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;
|
|
7536
|
-
}
|
|
7537
|
-
getCenterTextPlugin(value) {
|
|
7538
|
-
return {
|
|
7539
|
-
id: 'centerText',
|
|
7540
|
-
afterDatasetsDraw: (chart) => {
|
|
7541
|
-
var _a, _b;
|
|
7542
|
-
const { ctx } = chart;
|
|
7543
|
-
ctx.save();
|
|
7544
|
-
const x = chart.getDatasetMeta(0).data[0].x;
|
|
7545
|
-
let y = chart.getDatasetMeta(0).data[0].y;
|
|
7546
|
-
if (this.chartType === 'semi-gauge') {
|
|
7547
|
-
y -= 20;
|
|
7548
|
-
}
|
|
7549
|
-
let displayValue = value;
|
|
7550
|
-
if (this.chartType === 'doughnut-v2') {
|
|
7551
|
-
const activeIndex = this.selectedSegmentIndex !== null
|
|
7552
|
-
? this.selectedSegmentIndex
|
|
7553
|
-
: ((_a = this.initialActiveIndex) !== null && _a !== void 0 ? _a : 0);
|
|
7554
|
-
const segmentValue = (_b = this.chartData.datasets[0]) === null || _b === void 0 ? void 0 : _b.data[activeIndex];
|
|
7555
|
-
displayValue = Number(segmentValue || 0).toLocaleString();
|
|
7556
|
-
}
|
|
7557
|
-
ctx.font = 'bold 20px Roboto';
|
|
7558
|
-
ctx.fillStyle = '#111';
|
|
7559
|
-
ctx.textAlign = 'center';
|
|
7560
|
-
ctx.textBaseline = 'middle';
|
|
7561
|
-
ctx.fillText(displayValue, x, y);
|
|
7562
|
-
},
|
|
7563
|
-
};
|
|
7564
|
-
}
|
|
7565
|
-
getLegendHoverPlugin() {
|
|
7566
|
-
return {
|
|
7567
|
-
id: 'legendHover',
|
|
7568
|
-
afterDraw: (chart) => {
|
|
7569
|
-
if (this.hoverSegmentIndex === null)
|
|
7570
|
-
return;
|
|
7571
|
-
const legend = chart.legend;
|
|
7572
|
-
if (!legend || !legend.legendItems)
|
|
7573
|
-
return;
|
|
7574
|
-
const ctx = chart.ctx;
|
|
7575
|
-
const legendItem = legend.legendItems[this.hoverSegmentIndex];
|
|
7576
|
-
if (!legendItem)
|
|
7577
|
-
return;
|
|
7578
|
-
const boxes = legend.legendHitBoxes;
|
|
7579
|
-
if (!boxes || !boxes[this.hoverSegmentIndex])
|
|
7580
|
-
return;
|
|
7581
|
-
const box = boxes[this.hoverSegmentIndex];
|
|
7582
|
-
const padding = 8;
|
|
7583
|
-
const borderRadius = 4;
|
|
7584
|
-
ctx.save();
|
|
7585
|
-
ctx.fillStyle = '#f5f5f5';
|
|
7586
|
-
ctx.beginPath();
|
|
7587
|
-
ctx.roundRect(box.left - padding, box.top - padding, box.width + padding * 2, box.height + padding * 2, borderRadius);
|
|
7588
|
-
ctx.fill();
|
|
7589
|
-
const pointRadius = 8;
|
|
7590
|
-
const pointX = box.left + pointRadius;
|
|
7591
|
-
const pointY = box.top + box.height / 2;
|
|
7592
|
-
ctx.fillStyle = '#D1D5DB';
|
|
7593
|
-
ctx.beginPath();
|
|
7594
|
-
ctx.arc(pointX, pointY, pointRadius, 0, 2 * Math.PI);
|
|
7595
|
-
ctx.fill();
|
|
7596
|
-
ctx.fillStyle = '#9CA3AF';
|
|
7597
|
-
ctx.font = '14px Roboto, sans-serif';
|
|
7598
|
-
ctx.textBaseline = 'middle';
|
|
7599
|
-
ctx.textAlign = 'left';
|
|
7600
|
-
ctx.fillText(legendItem.text, box.left + pointRadius * 2 + 4, pointY);
|
|
7601
|
-
ctx.restore();
|
|
7602
|
-
},
|
|
7603
|
-
};
|
|
7604
|
-
}
|
|
7605
|
-
getSemiGaugeChartConfig() {
|
|
7606
|
-
return {
|
|
7607
|
-
plugins: {
|
|
7608
|
-
legend: { labels: { pointStyle: 'circle', padding: 16, } },
|
|
7609
|
-
},
|
|
7610
|
-
rotation: -90,
|
|
7611
|
-
circumference: 180,
|
|
7612
|
-
cutout: '70%',
|
|
7613
|
-
};
|
|
7614
|
-
}
|
|
7615
|
-
merge(target, source) {
|
|
7616
|
-
if (typeof target !== 'object' || typeof source !== 'object')
|
|
7617
|
-
return source;
|
|
7618
|
-
for (const key of Object.keys(source)) {
|
|
7619
|
-
if (source[key] instanceof Object && key in target) {
|
|
7620
|
-
target[key] = this.merge(Object.assign({}, target[key]), source[key]);
|
|
7621
|
-
}
|
|
7622
|
-
else {
|
|
7623
|
-
target[key] = source[key];
|
|
7624
|
-
}
|
|
7625
|
-
}
|
|
7626
|
-
return target;
|
|
7627
|
-
}
|
|
7628
|
-
getChartOptions() {
|
|
7629
|
-
const base = this.getBaseOptions();
|
|
7630
|
-
let specific = {};
|
|
7631
|
-
if (this.chartType === 'line')
|
|
7632
|
-
specific = this.getLineChartConfig();
|
|
7633
|
-
else if (this.chartType === 'doughnut')
|
|
7634
|
-
specific = this.getDoughnutChartConfig();
|
|
7635
|
-
else if (this.chartType === 'semi-gauge')
|
|
7636
|
-
specific = this.getSemiGaugeChartConfig();
|
|
7637
|
-
else if (this.chartType === 'doughnut-v2')
|
|
7638
|
-
specific = this.getDoughnutV2ChartConfig();
|
|
7639
|
-
return this.merge(this.merge(base, specific), this.chartOptions || {});
|
|
7640
|
-
}
|
|
7641
|
-
exportChart(format) {
|
|
7642
|
-
if (!this.chartInstance)
|
|
7643
|
-
return;
|
|
7644
|
-
const link = document.createElement('a');
|
|
7645
|
-
link.download = `chart-export.${format}`;
|
|
7646
|
-
if (format === 'png') {
|
|
7647
|
-
link.href = this.chartInstance.toBase64Image('image/png');
|
|
7648
|
-
}
|
|
7649
|
-
else {
|
|
7650
|
-
const svgData = new XMLSerializer().serializeToString(this.canvasEl);
|
|
7651
|
-
const blob = new Blob([svgData], { type: 'image/svg+xml' });
|
|
7652
|
-
link.href = URL.createObjectURL(blob);
|
|
7653
|
-
}
|
|
7654
|
-
link.click();
|
|
7655
|
-
}
|
|
7656
|
-
getErrorContent() {
|
|
7657
|
-
return this.commonContent('warning', 'Something went wrong', 'We ran into an issue while trying to load this widget.', '#DC0000', true);
|
|
7658
|
-
}
|
|
7659
|
-
getNoDataContent() {
|
|
7660
|
-
return this.commonContent('ssid_chart', 'No data available', 'There is currently no data available to show performance trends.', '#111');
|
|
7661
|
-
}
|
|
7662
|
-
commonContent(iconName, heading, message, iconColor, showActions = false) {
|
|
7663
|
-
return (index.h("div", { class: "error-content" }, index.h("tttx-
|
|
7664
|
-
}
|
|
7665
|
-
notifyActiveSegment() {
|
|
7666
|
-
var _a, _b;
|
|
7667
|
-
if (this.chartType !== 'doughnut-v2' || !this.chartData)
|
|
7668
|
-
return;
|
|
7669
|
-
const activeIndex = this.selectedSegmentIndex !== null
|
|
7670
|
-
? this.selectedSegmentIndex
|
|
7671
|
-
: ((_a = this.initialActiveIndex) !== null && _a !== void 0 ? _a : 0);
|
|
7672
|
-
const label = ((_b = this.chartData.labels) === null || _b === void 0 ? void 0 : _b[activeIndex]) || '';
|
|
7673
|
-
if (this.activeSegmentChangeCallback) {
|
|
7674
|
-
this.activeSegmentChangeCallback(label);
|
|
7675
|
-
}
|
|
7676
|
-
}
|
|
7677
|
-
render() {
|
|
7678
|
-
var _a, _b, _c;
|
|
7679
|
-
return (index.h("div", { class: "chart-wrapper", style: { width: this.width, height: this.height } }, this.loading && index.h("div", { class: "chart-loading" }, index.h("tttx-loading-
|
|
7680
|
-
width: '100%',
|
|
7681
|
-
height: '100%',
|
|
7682
|
-
cursor: this.chartType === 'doughnut-v2' ? 'pointer' : 'default'
|
|
7683
|
-
} }))), this.exportable && !this.loading && !this.error && (index.h("div", { class: "export-buttons" }, this.showPngSvgExport && index.h("tttx-
|
|
7684
|
-
}
|
|
7685
|
-
get el() { return index.getElement(this); }
|
|
7686
|
-
static get watchers() { return {
|
|
7687
|
-
"chartData": ["handleUpdate", "notifyActiveSegment"],
|
|
7688
|
-
"chartOptions": ["handleUpdate"],
|
|
7689
|
-
"selectedSegmentIndex": ["notifyActiveSegment"],
|
|
7690
|
-
"initialActiveIndex": ["notifyActiveSegment"]
|
|
7691
|
-
}; }
|
|
7692
|
-
};
|
|
7171
|
+
const TttxChart = class {
|
|
7172
|
+
constructor(hostRef) {
|
|
7173
|
+
index.registerInstance(this, hostRef);
|
|
7174
|
+
this.exportCSV = index.createEvent(this, "exportCSV", 7);
|
|
7175
|
+
this.chartType = undefined;
|
|
7176
|
+
this.chartData = undefined;
|
|
7177
|
+
this.chartOptions = undefined;
|
|
7178
|
+
this.loading = false;
|
|
7179
|
+
this.error = undefined;
|
|
7180
|
+
this.fallbackText = 'No data available';
|
|
7181
|
+
this.width = '100%';
|
|
7182
|
+
this.height = 'auto';
|
|
7183
|
+
this.isYAxisPercentageValues = false;
|
|
7184
|
+
this.showActiveSegmentLabel = false;
|
|
7185
|
+
this.initialActiveIndex = 0;
|
|
7186
|
+
this.activeSegmentChangeCallback = undefined;
|
|
7187
|
+
this.exportable = false;
|
|
7188
|
+
this.chartInstance = undefined;
|
|
7189
|
+
this.showPngSvgExport = false;
|
|
7190
|
+
this.selectedSegmentIndex = null;
|
|
7191
|
+
this.hoverSegmentIndex = null;
|
|
7192
|
+
}
|
|
7193
|
+
handleUpdate(newData) {
|
|
7194
|
+
if (!newData || !newData.datasets || newData.datasets.length === 0) {
|
|
7195
|
+
this.destroyChart();
|
|
7196
|
+
return;
|
|
7197
|
+
}
|
|
7198
|
+
if (this.chartType === 'line') {
|
|
7199
|
+
setTimeout(() => {
|
|
7200
|
+
this.renderChart();
|
|
7201
|
+
}, 0);
|
|
7202
|
+
return;
|
|
7203
|
+
}
|
|
7204
|
+
if (this.chartType === 'doughnut-v2') {
|
|
7205
|
+
if (this.hasChartDataChanged()) {
|
|
7206
|
+
this.renderChart();
|
|
7207
|
+
this.previousChartData = this.deepClone(this.chartData);
|
|
7208
|
+
}
|
|
7209
|
+
return;
|
|
7210
|
+
}
|
|
7211
|
+
this.renderChart();
|
|
7212
|
+
}
|
|
7213
|
+
componentDidLoad() {
|
|
7214
|
+
if (this.chartType === 'doughnut-v2') {
|
|
7215
|
+
this.previousChartData = this.deepClone(this.chartData);
|
|
7216
|
+
}
|
|
7217
|
+
this.renderChart();
|
|
7218
|
+
this.notifyActiveSegment();
|
|
7219
|
+
}
|
|
7220
|
+
hasChartDataChanged() {
|
|
7221
|
+
if (!this.previousChartData)
|
|
7222
|
+
return true;
|
|
7223
|
+
try {
|
|
7224
|
+
return JSON.stringify(this.previousChartData) !== JSON.stringify(this.chartData);
|
|
7225
|
+
}
|
|
7226
|
+
catch (_a) {
|
|
7227
|
+
return true;
|
|
7228
|
+
}
|
|
7229
|
+
}
|
|
7230
|
+
deepClone(obj) {
|
|
7231
|
+
try {
|
|
7232
|
+
return JSON.parse(JSON.stringify(obj));
|
|
7233
|
+
}
|
|
7234
|
+
catch (_a) {
|
|
7235
|
+
return obj;
|
|
7236
|
+
}
|
|
7237
|
+
}
|
|
7238
|
+
disconnectedCallback() {
|
|
7239
|
+
this.destroyChart();
|
|
7240
|
+
}
|
|
7241
|
+
renderChart() {
|
|
7242
|
+
var _a, _b, _c;
|
|
7243
|
+
if (!this.canvasEl || !this.chartData || !this.chartType)
|
|
7244
|
+
return;
|
|
7245
|
+
this.destroyChart();
|
|
7246
|
+
const chartData = Object.assign(Object.assign({}, this.chartData), { datasets: ((_a = this.chartData.datasets) === null || _a === void 0 ? void 0 : _a.map(d => (Object.assign({}, d)))) || [] });
|
|
7247
|
+
const config = {
|
|
7248
|
+
type: this.getChartJsType(),
|
|
7249
|
+
data: chartData,
|
|
7250
|
+
options: this.getChartOptions(),
|
|
7251
|
+
plugins: []
|
|
7252
|
+
};
|
|
7253
|
+
if (this.chartType === 'doughnut' || this.chartType === 'semi-gauge' || this.chartType === 'doughnut-v2') {
|
|
7254
|
+
const total = ((_c = (_b = chartData.datasets[0]) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.map((d) => Number(d) || 0).reduce((a, b) => a + b, 0)) || 0;
|
|
7255
|
+
config.plugins.push(this.getCenterTextPlugin(total.toLocaleString()));
|
|
7256
|
+
}
|
|
7257
|
+
if (this.chartType === 'doughnut-v2') {
|
|
7258
|
+
config.plugins.push(this.getLegendHoverPlugin());
|
|
7259
|
+
}
|
|
7260
|
+
// create chart
|
|
7261
|
+
this.chartInstance = new auto.Chart(this.canvasEl, config);
|
|
7262
|
+
// Initialize colors for doughnut-v2
|
|
7263
|
+
if (this.chartType === 'doughnut-v2') {
|
|
7264
|
+
this.chartInstance.setDatasetVisibility(0, true);
|
|
7265
|
+
this.updateChartColors();
|
|
7266
|
+
}
|
|
7267
|
+
}
|
|
7268
|
+
destroyChart() {
|
|
7269
|
+
if (this.chartInstance) {
|
|
7270
|
+
this.chartInstance.destroy();
|
|
7271
|
+
this.chartInstance = undefined;
|
|
7272
|
+
}
|
|
7273
|
+
}
|
|
7274
|
+
getChartJsType() {
|
|
7275
|
+
if (this.chartType === 'semi-gauge' || this.chartType === 'doughnut-v2')
|
|
7276
|
+
return 'doughnut';
|
|
7277
|
+
return this.chartType;
|
|
7278
|
+
}
|
|
7279
|
+
getBaseOptions() {
|
|
7280
|
+
return {
|
|
7281
|
+
responsive: true,
|
|
7282
|
+
maintainAspectRatio: false,
|
|
7283
|
+
plugins: {
|
|
7284
|
+
legend: {
|
|
7285
|
+
display: true,
|
|
7286
|
+
position: 'bottom',
|
|
7287
|
+
labels: {
|
|
7288
|
+
usePointStyle: true,
|
|
7289
|
+
pointStyle: 'circle',
|
|
7290
|
+
font: {
|
|
7291
|
+
size: 14
|
|
7292
|
+
}
|
|
7293
|
+
},
|
|
7294
|
+
},
|
|
7295
|
+
tooltip: {
|
|
7296
|
+
callbacks: {
|
|
7297
|
+
label: (ctx) => {
|
|
7298
|
+
const label = ctx.label || ctx.dataset.label || '';
|
|
7299
|
+
// Convert value to number and fix to 2 decimal places
|
|
7300
|
+
const value = Number(ctx.raw);
|
|
7301
|
+
const formattedValue = isNaN(value) ? ctx.formattedValue : value.toFixed(2);
|
|
7302
|
+
return `${label}: ${formattedValue}`;
|
|
7303
|
+
},
|
|
7304
|
+
},
|
|
7305
|
+
backgroundColor: '#17272B'
|
|
7306
|
+
},
|
|
7307
|
+
},
|
|
7308
|
+
};
|
|
7309
|
+
}
|
|
7310
|
+
getLineChartConfig() {
|
|
7311
|
+
const startOfCurrentMonth = new Date();
|
|
7312
|
+
startOfCurrentMonth.setDate(1);
|
|
7313
|
+
startOfCurrentMonth.setHours(0, 0, 0, 0);
|
|
7314
|
+
return {
|
|
7315
|
+
responsive: true,
|
|
7316
|
+
maintainAspectRatio: false,
|
|
7317
|
+
animation: { duration: 0 },
|
|
7318
|
+
elements: {
|
|
7319
|
+
point: { radius: 0, hoverRadius: 4 },
|
|
7320
|
+
},
|
|
7321
|
+
plugins: {
|
|
7322
|
+
legend: {
|
|
7323
|
+
labels: {
|
|
7324
|
+
padding: 20,
|
|
7325
|
+
generateLabels: (chart) => {
|
|
7326
|
+
return chart.data.datasets.map((dataset, i) => ({
|
|
7327
|
+
text: dataset.label || '',
|
|
7328
|
+
strokeStyle: dataset.borderColor,
|
|
7329
|
+
fillStyle: dataset.backgroundColor || 'transparent',
|
|
7330
|
+
lineDash: dataset.borderDash || [],
|
|
7331
|
+
lineWidth: dataset.borderWidth || 2,
|
|
7332
|
+
hidden: !chart.isDatasetVisible(i),
|
|
7333
|
+
datasetIndex: i,
|
|
7334
|
+
pointStyle: 'line',
|
|
7335
|
+
}));
|
|
7336
|
+
},
|
|
7337
|
+
},
|
|
7338
|
+
},
|
|
7339
|
+
tooltip: {
|
|
7340
|
+
mode: 'index',
|
|
7341
|
+
intersect: false,
|
|
7342
|
+
backgroundColor: '#17272B',
|
|
7343
|
+
titleFont: { size: 14, weight: 'bold' },
|
|
7344
|
+
bodyFont: { size: 12 },
|
|
7345
|
+
callbacks: {
|
|
7346
|
+
title: (context) => {
|
|
7347
|
+
var _a, _b;
|
|
7348
|
+
if (!context || !context.length)
|
|
7349
|
+
return '';
|
|
7350
|
+
const date = new Date((_b = (_a = context[0].parsed) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : context[0].label);
|
|
7351
|
+
return date.toLocaleDateString(undefined, {
|
|
7352
|
+
day: '2-digit',
|
|
7353
|
+
month: 'short',
|
|
7354
|
+
year: 'numeric',
|
|
7355
|
+
});
|
|
7356
|
+
},
|
|
7357
|
+
label: (ctx) => {
|
|
7358
|
+
const rawValue = ctx.parsed && ctx.parsed.y !== undefined ? ctx.parsed.y : ctx.raw;
|
|
7359
|
+
// Format to max 2 decimal places
|
|
7360
|
+
const value = Number(rawValue);
|
|
7361
|
+
const formattedValue = isNaN(value) ? rawValue : value.toFixed(2);
|
|
7362
|
+
return `${ctx.dataset.label}: ${formattedValue}${this.isYAxisPercentageValues ? '%' : ''}`;
|
|
7363
|
+
},
|
|
7364
|
+
labelColor: (ctx) => {
|
|
7365
|
+
if (ctx.dataset.label !== 'Overall') {
|
|
7366
|
+
return {
|
|
7367
|
+
borderWidth: 2
|
|
7368
|
+
};
|
|
7369
|
+
}
|
|
7370
|
+
return {
|
|
7371
|
+
borderWidth: 2,
|
|
7372
|
+
borderColor: ctx.dataset.borderColor,
|
|
7373
|
+
backgroundColor: ctx.dataset.borderColor,
|
|
7374
|
+
};
|
|
7375
|
+
}
|
|
7376
|
+
},
|
|
7377
|
+
},
|
|
7378
|
+
},
|
|
7379
|
+
interaction: {
|
|
7380
|
+
mode: 'index',
|
|
7381
|
+
intersect: false,
|
|
7382
|
+
},
|
|
7383
|
+
scales: {
|
|
7384
|
+
x: {
|
|
7385
|
+
type: 'time',
|
|
7386
|
+
time: {
|
|
7387
|
+
unit: 'month',
|
|
7388
|
+
displayFormats: {
|
|
7389
|
+
month: 'MMM yyyy',
|
|
7390
|
+
},
|
|
7391
|
+
tooltipFormat: 'dd MMM yyyy',
|
|
7392
|
+
},
|
|
7393
|
+
grid: { color: '#E5E5E5' },
|
|
7394
|
+
border: { dash: [4, 4] },
|
|
7395
|
+
ticks: {
|
|
7396
|
+
autoSkip: true,
|
|
7397
|
+
maxRotation: 0,
|
|
7398
|
+
},
|
|
7399
|
+
},
|
|
7400
|
+
y: {
|
|
7401
|
+
min: 0,
|
|
7402
|
+
max: 100,
|
|
7403
|
+
beginAtZero: true,
|
|
7404
|
+
ticks: {
|
|
7405
|
+
stepSize: 20,
|
|
7406
|
+
callback: (value) => {
|
|
7407
|
+
const numValue = Number(value);
|
|
7408
|
+
const formatted = isNaN(numValue) ? value : (Number.isInteger(numValue) ? numValue : numValue.toFixed(2));
|
|
7409
|
+
return this.isYAxisPercentageValues ? `${formatted}%` : formatted;
|
|
7410
|
+
},
|
|
7411
|
+
},
|
|
7412
|
+
grid: { color: '#E5E5E5' },
|
|
7413
|
+
border: { dash: [4, 4] },
|
|
7414
|
+
},
|
|
7415
|
+
},
|
|
7416
|
+
};
|
|
7417
|
+
}
|
|
7418
|
+
getDoughnutChartConfig() {
|
|
7419
|
+
return {
|
|
7420
|
+
plugins: {
|
|
7421
|
+
legend: { labels: { pointStyle: 'circle', padding: 16, } },
|
|
7422
|
+
},
|
|
7423
|
+
cutout: '60%'
|
|
7424
|
+
};
|
|
7425
|
+
}
|
|
7426
|
+
getDoughnutV2ChartConfig() {
|
|
7427
|
+
return {
|
|
7428
|
+
plugins: {
|
|
7429
|
+
legend: {
|
|
7430
|
+
labels: {
|
|
7431
|
+
pointStyle: 'circle',
|
|
7432
|
+
padding: 16
|
|
7433
|
+
},
|
|
7434
|
+
onClick: (e, legendItem) => {
|
|
7435
|
+
e.stopPropagation();
|
|
7436
|
+
const index = legendItem.index;
|
|
7437
|
+
if (this.selectedSegmentIndex !== index) {
|
|
7438
|
+
this.selectedSegmentIndex = index;
|
|
7439
|
+
this.updateChartColors();
|
|
7440
|
+
this.notifyActiveSegment();
|
|
7441
|
+
}
|
|
7442
|
+
}
|
|
7443
|
+
},
|
|
7444
|
+
tooltip: {
|
|
7445
|
+
enabled: false
|
|
7446
|
+
}
|
|
7447
|
+
},
|
|
7448
|
+
cutout: '60%',
|
|
7449
|
+
onHover: (_event, activeElements) => {
|
|
7450
|
+
if (activeElements && activeElements.length > 0) {
|
|
7451
|
+
this.hoverSegmentIndex = activeElements[0].index;
|
|
7452
|
+
this.updateChartColors();
|
|
7453
|
+
}
|
|
7454
|
+
else {
|
|
7455
|
+
this.hoverSegmentIndex = null;
|
|
7456
|
+
this.updateChartColors();
|
|
7457
|
+
}
|
|
7458
|
+
},
|
|
7459
|
+
onClick: (_event, activeElements) => {
|
|
7460
|
+
if (activeElements && activeElements.length > 0) {
|
|
7461
|
+
const clickedIndex = activeElements[0].index;
|
|
7462
|
+
if (this.selectedSegmentIndex !== clickedIndex) {
|
|
7463
|
+
this.selectedSegmentIndex = clickedIndex;
|
|
7464
|
+
this.updateChartColors();
|
|
7465
|
+
this.notifyActiveSegment();
|
|
7466
|
+
}
|
|
7467
|
+
}
|
|
7468
|
+
},
|
|
7469
|
+
};
|
|
7470
|
+
}
|
|
7471
|
+
updateChartColors() {
|
|
7472
|
+
var _a, _b, _c, _d;
|
|
7473
|
+
if (!this.chartInstance || this.chartType !== 'doughnut-v2')
|
|
7474
|
+
return;
|
|
7475
|
+
const dataset = this.chartInstance.data.datasets[0];
|
|
7476
|
+
const chartDataDataset = (_b = (_a = this.chartData) === null || _a === void 0 ? void 0 : _a.datasets) === null || _b === void 0 ? void 0 : _b[0];
|
|
7477
|
+
if (this.chartType === 'doughnut-v2' && this.chartInstance.isDatasetVisible(0) === false) {
|
|
7478
|
+
this.chartInstance.setDatasetVisibility(0, true);
|
|
7479
|
+
}
|
|
7480
|
+
// Default color for doughnut-v2
|
|
7481
|
+
const defaultSelectedColor = '#45C9B0';
|
|
7482
|
+
const defaultHoverColor = '#A3A3A3';
|
|
7483
|
+
const defaultInactiveColor = '#E5E5E5';
|
|
7484
|
+
const selectedColors = chartDataDataset === null || chartDataDataset === void 0 ? void 0 : chartDataDataset.selectedColors;
|
|
7485
|
+
const hoverColors = chartDataDataset === null || chartDataDataset === void 0 ? void 0 : chartDataDataset.hoverColors;
|
|
7486
|
+
const inactiveColors = chartDataDataset === null || chartDataDataset === void 0 ? void 0 : chartDataDataset.inactiveColors;
|
|
7487
|
+
let newColors = [];
|
|
7488
|
+
if (this.selectedSegmentIndex !== null) {
|
|
7489
|
+
newColors = dataset.data.map((_, index) => {
|
|
7490
|
+
if (index === this.hoverSegmentIndex) {
|
|
7491
|
+
return (hoverColors === null || hoverColors === void 0 ? void 0 : hoverColors[index]) || defaultHoverColor;
|
|
7492
|
+
}
|
|
7493
|
+
else if (index === this.selectedSegmentIndex) {
|
|
7494
|
+
return (selectedColors === null || selectedColors === void 0 ? void 0 : selectedColors[index]) || defaultSelectedColor;
|
|
7495
|
+
}
|
|
7496
|
+
else {
|
|
7497
|
+
return (inactiveColors === null || inactiveColors === void 0 ? void 0 : inactiveColors[index]) || defaultInactiveColor;
|
|
7498
|
+
}
|
|
7499
|
+
});
|
|
7500
|
+
}
|
|
7501
|
+
else if (this.hoverSegmentIndex !== null) {
|
|
7502
|
+
const activeIndex = (_c = this.initialActiveIndex) !== null && _c !== void 0 ? _c : 0;
|
|
7503
|
+
newColors = dataset.data.map((_, index) => {
|
|
7504
|
+
if (index === this.hoverSegmentIndex) {
|
|
7505
|
+
return (hoverColors === null || hoverColors === void 0 ? void 0 : hoverColors[index]) || defaultHoverColor;
|
|
7506
|
+
}
|
|
7507
|
+
else if (index === activeIndex) {
|
|
7508
|
+
return (selectedColors === null || selectedColors === void 0 ? void 0 : selectedColors[index]) || defaultSelectedColor;
|
|
7509
|
+
}
|
|
7510
|
+
else {
|
|
7511
|
+
return (inactiveColors === null || inactiveColors === void 0 ? void 0 : inactiveColors[index]) || defaultInactiveColor;
|
|
7512
|
+
}
|
|
7513
|
+
});
|
|
7514
|
+
}
|
|
7515
|
+
else {
|
|
7516
|
+
// No hover or selection: show initial active state
|
|
7517
|
+
const activeIndex = (_d = this.initialActiveIndex) !== null && _d !== void 0 ? _d : 0;
|
|
7518
|
+
newColors = dataset.data.map((_, index) => {
|
|
7519
|
+
if (index === activeIndex) {
|
|
7520
|
+
return (selectedColors === null || selectedColors === void 0 ? void 0 : selectedColors[index]) || defaultSelectedColor;
|
|
7521
|
+
}
|
|
7522
|
+
return (inactiveColors === null || inactiveColors === void 0 ? void 0 : inactiveColors[index]) || defaultInactiveColor;
|
|
7523
|
+
});
|
|
7524
|
+
}
|
|
7525
|
+
dataset.backgroundColor = newColors;
|
|
7526
|
+
this.chartInstance.update('active');
|
|
7527
|
+
}
|
|
7528
|
+
lightenColor(color, percent) {
|
|
7529
|
+
if (!color || !color.startsWith('#'))
|
|
7530
|
+
return color;
|
|
7531
|
+
const num = parseInt(color.replace('#', ''), 16);
|
|
7532
|
+
const r = Math.min(255, ((num >> 16) & 0xFF) + percent);
|
|
7533
|
+
const g = Math.min(255, ((num >> 8) & 0xFF) + percent);
|
|
7534
|
+
const b = Math.min(255, (num & 0xFF) + percent);
|
|
7535
|
+
return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;
|
|
7536
|
+
}
|
|
7537
|
+
getCenterTextPlugin(value) {
|
|
7538
|
+
return {
|
|
7539
|
+
id: 'centerText',
|
|
7540
|
+
afterDatasetsDraw: (chart) => {
|
|
7541
|
+
var _a, _b;
|
|
7542
|
+
const { ctx } = chart;
|
|
7543
|
+
ctx.save();
|
|
7544
|
+
const x = chart.getDatasetMeta(0).data[0].x;
|
|
7545
|
+
let y = chart.getDatasetMeta(0).data[0].y;
|
|
7546
|
+
if (this.chartType === 'semi-gauge') {
|
|
7547
|
+
y -= 20;
|
|
7548
|
+
}
|
|
7549
|
+
let displayValue = value;
|
|
7550
|
+
if (this.chartType === 'doughnut-v2') {
|
|
7551
|
+
const activeIndex = this.selectedSegmentIndex !== null
|
|
7552
|
+
? this.selectedSegmentIndex
|
|
7553
|
+
: ((_a = this.initialActiveIndex) !== null && _a !== void 0 ? _a : 0);
|
|
7554
|
+
const segmentValue = (_b = this.chartData.datasets[0]) === null || _b === void 0 ? void 0 : _b.data[activeIndex];
|
|
7555
|
+
displayValue = Number(segmentValue || 0).toLocaleString();
|
|
7556
|
+
}
|
|
7557
|
+
ctx.font = 'bold 20px Roboto';
|
|
7558
|
+
ctx.fillStyle = '#111';
|
|
7559
|
+
ctx.textAlign = 'center';
|
|
7560
|
+
ctx.textBaseline = 'middle';
|
|
7561
|
+
ctx.fillText(displayValue, x, y);
|
|
7562
|
+
},
|
|
7563
|
+
};
|
|
7564
|
+
}
|
|
7565
|
+
getLegendHoverPlugin() {
|
|
7566
|
+
return {
|
|
7567
|
+
id: 'legendHover',
|
|
7568
|
+
afterDraw: (chart) => {
|
|
7569
|
+
if (this.hoverSegmentIndex === null)
|
|
7570
|
+
return;
|
|
7571
|
+
const legend = chart.legend;
|
|
7572
|
+
if (!legend || !legend.legendItems)
|
|
7573
|
+
return;
|
|
7574
|
+
const ctx = chart.ctx;
|
|
7575
|
+
const legendItem = legend.legendItems[this.hoverSegmentIndex];
|
|
7576
|
+
if (!legendItem)
|
|
7577
|
+
return;
|
|
7578
|
+
const boxes = legend.legendHitBoxes;
|
|
7579
|
+
if (!boxes || !boxes[this.hoverSegmentIndex])
|
|
7580
|
+
return;
|
|
7581
|
+
const box = boxes[this.hoverSegmentIndex];
|
|
7582
|
+
const padding = 8;
|
|
7583
|
+
const borderRadius = 4;
|
|
7584
|
+
ctx.save();
|
|
7585
|
+
ctx.fillStyle = '#f5f5f5';
|
|
7586
|
+
ctx.beginPath();
|
|
7587
|
+
ctx.roundRect(box.left - padding, box.top - padding, box.width + padding * 2, box.height + padding * 2, borderRadius);
|
|
7588
|
+
ctx.fill();
|
|
7589
|
+
const pointRadius = 8;
|
|
7590
|
+
const pointX = box.left + pointRadius;
|
|
7591
|
+
const pointY = box.top + box.height / 2;
|
|
7592
|
+
ctx.fillStyle = '#D1D5DB';
|
|
7593
|
+
ctx.beginPath();
|
|
7594
|
+
ctx.arc(pointX, pointY, pointRadius, 0, 2 * Math.PI);
|
|
7595
|
+
ctx.fill();
|
|
7596
|
+
ctx.fillStyle = '#9CA3AF';
|
|
7597
|
+
ctx.font = '14px Roboto, sans-serif';
|
|
7598
|
+
ctx.textBaseline = 'middle';
|
|
7599
|
+
ctx.textAlign = 'left';
|
|
7600
|
+
ctx.fillText(legendItem.text, box.left + pointRadius * 2 + 4, pointY);
|
|
7601
|
+
ctx.restore();
|
|
7602
|
+
},
|
|
7603
|
+
};
|
|
7604
|
+
}
|
|
7605
|
+
getSemiGaugeChartConfig() {
|
|
7606
|
+
return {
|
|
7607
|
+
plugins: {
|
|
7608
|
+
legend: { labels: { pointStyle: 'circle', padding: 16, } },
|
|
7609
|
+
},
|
|
7610
|
+
rotation: -90,
|
|
7611
|
+
circumference: 180,
|
|
7612
|
+
cutout: '70%',
|
|
7613
|
+
};
|
|
7614
|
+
}
|
|
7615
|
+
merge(target, source) {
|
|
7616
|
+
if (typeof target !== 'object' || typeof source !== 'object')
|
|
7617
|
+
return source;
|
|
7618
|
+
for (const key of Object.keys(source)) {
|
|
7619
|
+
if (source[key] instanceof Object && key in target) {
|
|
7620
|
+
target[key] = this.merge(Object.assign({}, target[key]), source[key]);
|
|
7621
|
+
}
|
|
7622
|
+
else {
|
|
7623
|
+
target[key] = source[key];
|
|
7624
|
+
}
|
|
7625
|
+
}
|
|
7626
|
+
return target;
|
|
7627
|
+
}
|
|
7628
|
+
getChartOptions() {
|
|
7629
|
+
const base = this.getBaseOptions();
|
|
7630
|
+
let specific = {};
|
|
7631
|
+
if (this.chartType === 'line')
|
|
7632
|
+
specific = this.getLineChartConfig();
|
|
7633
|
+
else if (this.chartType === 'doughnut')
|
|
7634
|
+
specific = this.getDoughnutChartConfig();
|
|
7635
|
+
else if (this.chartType === 'semi-gauge')
|
|
7636
|
+
specific = this.getSemiGaugeChartConfig();
|
|
7637
|
+
else if (this.chartType === 'doughnut-v2')
|
|
7638
|
+
specific = this.getDoughnutV2ChartConfig();
|
|
7639
|
+
return this.merge(this.merge(base, specific), this.chartOptions || {});
|
|
7640
|
+
}
|
|
7641
|
+
exportChart(format) {
|
|
7642
|
+
if (!this.chartInstance)
|
|
7643
|
+
return;
|
|
7644
|
+
const link = document.createElement('a');
|
|
7645
|
+
link.download = `chart-export.${format}`;
|
|
7646
|
+
if (format === 'png') {
|
|
7647
|
+
link.href = this.chartInstance.toBase64Image('image/png');
|
|
7648
|
+
}
|
|
7649
|
+
else {
|
|
7650
|
+
const svgData = new XMLSerializer().serializeToString(this.canvasEl);
|
|
7651
|
+
const blob = new Blob([svgData], { type: 'image/svg+xml' });
|
|
7652
|
+
link.href = URL.createObjectURL(blob);
|
|
7653
|
+
}
|
|
7654
|
+
link.click();
|
|
7655
|
+
}
|
|
7656
|
+
getErrorContent() {
|
|
7657
|
+
return this.commonContent('warning', 'Something went wrong', 'We ran into an issue while trying to load this widget.', '#DC0000', true);
|
|
7658
|
+
}
|
|
7659
|
+
getNoDataContent() {
|
|
7660
|
+
return this.commonContent('ssid_chart', 'No data available', 'There is currently no data available to show performance trends.', '#111');
|
|
7661
|
+
}
|
|
7662
|
+
commonContent(iconName, heading, message, iconColor, showActions = false) {
|
|
7663
|
+
return (index.h("div", { class: "error-content" }, index.h("tttx-icon_1_9_103", { icon: iconName, color: iconColor, size: 48 }), index.h("span", { class: 'error-heading' }, heading), index.h("span", { class: 'error-message' }, message), showActions && index.h("div", { class: "error-actions" }, index.h("tttx-button_1_9_103", { class: 'support-btn', icon: "help", design: "primary", onClick: () => this.renderChart() }, "Contact support"))));
|
|
7664
|
+
}
|
|
7665
|
+
notifyActiveSegment() {
|
|
7666
|
+
var _a, _b;
|
|
7667
|
+
if (this.chartType !== 'doughnut-v2' || !this.chartData)
|
|
7668
|
+
return;
|
|
7669
|
+
const activeIndex = this.selectedSegmentIndex !== null
|
|
7670
|
+
? this.selectedSegmentIndex
|
|
7671
|
+
: ((_a = this.initialActiveIndex) !== null && _a !== void 0 ? _a : 0);
|
|
7672
|
+
const label = ((_b = this.chartData.labels) === null || _b === void 0 ? void 0 : _b[activeIndex]) || '';
|
|
7673
|
+
if (this.activeSegmentChangeCallback) {
|
|
7674
|
+
this.activeSegmentChangeCallback(label);
|
|
7675
|
+
}
|
|
7676
|
+
}
|
|
7677
|
+
render() {
|
|
7678
|
+
var _a, _b, _c;
|
|
7679
|
+
return (index.h("div", { class: "chart-wrapper", style: { width: this.width, height: this.height } }, this.loading && index.h("div", { class: "chart-loading" }, index.h("tttx-loading-spinner_1_9_103", { size: 'large', color: '#2b9ab7' })), this.error && this.getErrorContent(), !this.loading && !this.error && (!this.chartData || !((_a = this.chartData.datasets) === null || _a === void 0 ? void 0 : _a.length)) && (this.getNoDataContent()), !this.loading && !this.error && ((_c = (_b = this.chartData) === null || _b === void 0 ? void 0 : _b.datasets) === null || _c === void 0 ? void 0 : _c.length) > 0 && (index.h("div", { class: "chart-canvas-container", style: { width: '100%', height: '100%' } }, index.h("canvas", { ref: el => (this.canvasEl = el), "aria-label": "Chart canvas", role: "img", style: {
|
|
7680
|
+
width: '100%',
|
|
7681
|
+
height: '100%',
|
|
7682
|
+
cursor: this.chartType === 'doughnut-v2' ? 'pointer' : 'default'
|
|
7683
|
+
} }))), this.exportable && !this.loading && !this.error && (index.h("div", { class: "export-buttons" }, this.showPngSvgExport && index.h("tttx-button_1_9_103", { class: 'export-png', design: "primary", onClick: () => this.exportChart('png') }, "Export PNG"), this.showPngSvgExport && index.h("tttx-button_1_9_103", { class: 'export-svg', design: "primary", onClick: () => this.exportChart('svg') }, "Export SVG"), index.h("tttx-button_1_9_103", { class: 'export-csv', design: "primary", onClick: () => this.exportCSV.emit({ name: this.chartType }) }, "Export CSV")))));
|
|
7684
|
+
}
|
|
7685
|
+
get el() { return index.getElement(this); }
|
|
7686
|
+
static get watchers() { return {
|
|
7687
|
+
"chartData": ["handleUpdate", "notifyActiveSegment"],
|
|
7688
|
+
"chartOptions": ["handleUpdate"],
|
|
7689
|
+
"selectedSegmentIndex": ["notifyActiveSegment"],
|
|
7690
|
+
"initialActiveIndex": ["notifyActiveSegment"]
|
|
7691
|
+
}; }
|
|
7692
|
+
};
|
|
7693
7693
|
TttxChart.style = tttxChartCss;
|
|
7694
7694
|
|
|
7695
|
-
exports.
|
|
7695
|
+
exports.tttx_chart_1_9_103 = TttxChart;
|