origam 2.38.0 → 2.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/src/assets/locales/en.json +1 -1
- package/dist/src/assets/locales/fr.json +2 -2
- package/dist/src/components/Alert/OrigamAlert.vue +739 -165
- package/dist/src/components/App/OrigamApp.vue +95 -19
- package/dist/src/components/App/OrigamAppBar.vue +751 -158
- package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
- package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
- package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
- package/dist/src/components/Badge/OrigamBadge.vue +548 -135
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
- package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
- package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
- package/dist/src/components/Btn/OrigamBtn.vue +928 -249
- package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
- package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
- package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
- package/dist/src/components/Card/OrigamCard.vue +938 -194
- package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
- package/dist/src/components/Card/OrigamCardText.vue +536 -84
- package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
- package/dist/src/components/Chart/OrigamChart.vue +942 -452
- package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
- package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
- package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
- package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
- package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
- package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
- package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
- package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
- package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
- package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
- package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
- package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
- package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
- package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
- package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
- package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
- package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
- package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
- package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
- package/dist/src/components/Chip/OrigamChip.vue +867 -202
- package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
- package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
- package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
- package/dist/src/components/Code/OrigamCode.vue +844 -206
- package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
- package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
- package/dist/src/components/Counter/OrigamCounter.vue +588 -96
- package/dist/src/components/DataList/OrigamDataList.vue +619 -113
- package/dist/src/components/DataList/OrigamDataText.vue +295 -65
- package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
- package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
- package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
- package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
- package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
- package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
- package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
- package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
- package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
- package/dist/src/components/Divider/OrigamDivider.vue +210 -50
- package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
- package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
- package/dist/src/components/Field/OrigamField.vue +1118 -306
- package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
- package/dist/src/components/Form/OrigamForm.vue +197 -74
- package/dist/src/components/Grid/OrigamGrid.vue +707 -147
- package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
- package/dist/src/components/Grids/OrigamCol.vue +593 -110
- package/dist/src/components/Grids/OrigamContainer.vue +461 -80
- package/dist/src/components/Grids/OrigamRow.vue +573 -112
- package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
- package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
- package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
- package/dist/src/components/Icon/OrigamIcon.vue +561 -98
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
- package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
- package/dist/src/components/Img/OrigamImg.vue +869 -228
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
- package/dist/src/components/Input/OrigamInput.vue +747 -180
- package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
- package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
- package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
- package/dist/src/components/Label/OrigamLabel.vue +584 -95
- package/dist/src/components/Layout/OrigamLayout.vue +563 -94
- package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
- package/dist/src/components/List/OrigamList.vue +755 -170
- package/dist/src/components/List/OrigamListChildren.vue +59 -19
- package/dist/src/components/List/OrigamListGroup.vue +631 -134
- package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
- package/dist/src/components/List/OrigamListItem.vue +890 -224
- package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
- package/dist/src/components/List/OrigamListSubheader.vue +542 -93
- package/dist/src/components/Loader/OrigamLoader.vue +110 -25
- package/dist/src/components/Main/OrigamMain.vue +565 -96
- package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
- package/dist/src/components/Media/OrigamMediaController.vue +465 -182
- package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
- package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
- package/dist/src/components/Messages/OrigamMessages.vue +606 -97
- package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
- package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
- package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
- package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
- package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
- package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
- package/dist/src/components/Picker/OrigamPicker.vue +655 -108
- package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
- package/dist/src/components/Progress/OrigamProgress.vue +436 -70
- package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
- package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
- package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
- package/dist/src/components/Radio/OrigamRadio.vue +772 -132
- package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
- package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
- package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
- package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
- package/dist/src/components/Select/OrigamSelect.vue +1639 -567
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
- package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
- package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
- package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
- package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
- package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
- package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
- package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
- package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
- package/dist/src/components/Table/OrigamTable.vue +585 -124
- package/dist/src/components/Tabs/OrigamTab.vue +239 -73
- package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
- package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
- package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
- package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
- package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
- package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
- package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
- package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
- package/dist/src/components/Title/OrigamTitle.vue +505 -82
- package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
- package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
- package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
- package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
- package/dist/src/components/Transition/OrigamFade.vue +47 -9
- package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
- package/dist/src/components/Transition/OrigamSnack.vue +52 -10
- package/dist/src/components/Transition/OrigamTransition.vue +40 -12
- package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
- package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
- package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
- package/dist/src/components/Video/OrigamVideo.vue +1178 -331
- package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
- package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
- package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
- package/dist/src/components/Window/OrigamWindow.vue +745 -175
- package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
- package/dist/src/composables/Commons/display.composable.cjs +2 -0
- package/dist/src/composables/Commons/display.composable.js +1 -1
- package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
- package/package.json +8 -8
|
@@ -165,10 +165,7 @@
|
|
|
165
165
|
|
|
166
166
|
<script lang="ts" setup>
|
|
167
167
|
import { CHART_ASPECT_RATIO, CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
|
|
168
|
-
import {
|
|
169
|
-
computed,
|
|
170
|
-
ref
|
|
171
|
-
} from "vue";
|
|
168
|
+
import { computed, ref } from "vue";
|
|
172
169
|
import OrigamChartLegend from "./OrigamChartLegend.vue";
|
|
173
170
|
import OrigamChartTooltip from "./OrigamChartTooltip.vue";
|
|
174
171
|
import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
|
|
@@ -183,70 +180,416 @@ import { useMargin } from "../../composables/Commons/margin.composable";
|
|
|
183
180
|
import { usePadding } from "../../composables/Commons/padding.composable";
|
|
184
181
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
185
182
|
import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
/*********************************************************
|
|
184
|
+
* Global
|
|
185
|
+
*
|
|
186
|
+
* @description
|
|
187
|
+
* Sunburst chart family. Renders a hierarchical multi-level
|
|
188
|
+
* donut where each ring represents one depth level of the tree.
|
|
189
|
+
*
|
|
190
|
+
* - Root nodes form the innermost ring, proportional to value.
|
|
191
|
+
* - Child nodes subdivide their parent's angular span.
|
|
192
|
+
* - `innerRadius` controls the centre hole size (0 = full pie).
|
|
193
|
+
* - Children inherit parent colour via `color-mix` lightening.
|
|
194
|
+
*
|
|
195
|
+
* `withDefaults` literals only, per CLAUDE.md.
|
|
196
|
+
********************************************************/
|
|
197
|
+
defineOptions({ name: "OrigamChartSunburst" });
|
|
189
198
|
const props = defineProps({
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
199
|
+
innerRadius: {
|
|
200
|
+
type: Number,
|
|
201
|
+
required: false,
|
|
202
|
+
default: .15
|
|
203
|
+
},
|
|
204
|
+
ringPadding: {
|
|
205
|
+
type: Number,
|
|
206
|
+
required: false,
|
|
207
|
+
default: 1
|
|
208
|
+
},
|
|
209
|
+
showLabel: {
|
|
210
|
+
type: Boolean,
|
|
211
|
+
required: false,
|
|
212
|
+
default: true
|
|
213
|
+
},
|
|
214
|
+
yAxisFormat: {
|
|
215
|
+
type: Function,
|
|
216
|
+
required: false,
|
|
217
|
+
default: undefined
|
|
218
|
+
},
|
|
219
|
+
series: {
|
|
220
|
+
type: Array,
|
|
221
|
+
required: true
|
|
222
|
+
},
|
|
223
|
+
title: {
|
|
224
|
+
type: String,
|
|
225
|
+
required: false,
|
|
226
|
+
default: undefined
|
|
227
|
+
},
|
|
228
|
+
subtitle: {
|
|
229
|
+
type: String,
|
|
230
|
+
required: false,
|
|
231
|
+
default: undefined
|
|
232
|
+
},
|
|
233
|
+
showLegend: {
|
|
234
|
+
type: Boolean,
|
|
235
|
+
required: false,
|
|
236
|
+
default: true
|
|
237
|
+
},
|
|
238
|
+
legendPosition: {
|
|
239
|
+
type: null,
|
|
240
|
+
required: false,
|
|
241
|
+
default: "bottom"
|
|
242
|
+
},
|
|
243
|
+
showTooltip: {
|
|
244
|
+
type: Boolean,
|
|
245
|
+
required: false,
|
|
246
|
+
default: true
|
|
247
|
+
},
|
|
248
|
+
animated: {
|
|
249
|
+
type: Boolean,
|
|
250
|
+
required: false,
|
|
251
|
+
default: true
|
|
252
|
+
},
|
|
253
|
+
animationDuration: {
|
|
254
|
+
type: Number,
|
|
255
|
+
required: false,
|
|
256
|
+
default: 600
|
|
257
|
+
},
|
|
258
|
+
colorScheme: {
|
|
259
|
+
type: Array,
|
|
260
|
+
required: false,
|
|
261
|
+
default: () => []
|
|
262
|
+
},
|
|
263
|
+
aspectRatio: {
|
|
264
|
+
type: String,
|
|
265
|
+
required: false,
|
|
266
|
+
default: undefined
|
|
267
|
+
},
|
|
268
|
+
id: {
|
|
269
|
+
type: String,
|
|
270
|
+
required: false
|
|
271
|
+
},
|
|
272
|
+
class: {
|
|
273
|
+
type: [
|
|
274
|
+
String,
|
|
275
|
+
Array,
|
|
276
|
+
Object
|
|
277
|
+
],
|
|
278
|
+
required: false
|
|
279
|
+
},
|
|
280
|
+
style: {
|
|
281
|
+
type: [
|
|
282
|
+
String,
|
|
283
|
+
Array,
|
|
284
|
+
Object,
|
|
285
|
+
Boolean,
|
|
286
|
+
null
|
|
287
|
+
],
|
|
288
|
+
required: false,
|
|
289
|
+
skipCheck: true
|
|
290
|
+
},
|
|
291
|
+
height: {
|
|
292
|
+
type: [Number, String],
|
|
293
|
+
required: false
|
|
294
|
+
},
|
|
295
|
+
maxHeight: {
|
|
296
|
+
type: [Number, String],
|
|
297
|
+
required: false
|
|
298
|
+
},
|
|
299
|
+
maxWidth: {
|
|
300
|
+
type: [Number, String],
|
|
301
|
+
required: false
|
|
302
|
+
},
|
|
303
|
+
minHeight: {
|
|
304
|
+
type: [Number, String],
|
|
305
|
+
required: false
|
|
306
|
+
},
|
|
307
|
+
minWidth: {
|
|
308
|
+
type: [Number, String],
|
|
309
|
+
required: false
|
|
310
|
+
},
|
|
311
|
+
width: {
|
|
312
|
+
type: [Number, String],
|
|
313
|
+
required: false
|
|
314
|
+
},
|
|
315
|
+
margin: {
|
|
316
|
+
type: [
|
|
317
|
+
Boolean,
|
|
318
|
+
Number,
|
|
319
|
+
String
|
|
320
|
+
],
|
|
321
|
+
required: false
|
|
322
|
+
},
|
|
323
|
+
marginTop: {
|
|
324
|
+
type: [
|
|
325
|
+
Boolean,
|
|
326
|
+
Number,
|
|
327
|
+
String
|
|
328
|
+
],
|
|
329
|
+
required: false
|
|
330
|
+
},
|
|
331
|
+
marginLeft: {
|
|
332
|
+
type: [
|
|
333
|
+
Boolean,
|
|
334
|
+
Number,
|
|
335
|
+
String
|
|
336
|
+
],
|
|
337
|
+
required: false
|
|
338
|
+
},
|
|
339
|
+
marginBottom: {
|
|
340
|
+
type: [
|
|
341
|
+
Boolean,
|
|
342
|
+
Number,
|
|
343
|
+
String
|
|
344
|
+
],
|
|
345
|
+
required: false
|
|
346
|
+
},
|
|
347
|
+
marginRight: {
|
|
348
|
+
type: [
|
|
349
|
+
Boolean,
|
|
350
|
+
Number,
|
|
351
|
+
String
|
|
352
|
+
],
|
|
353
|
+
required: false
|
|
354
|
+
},
|
|
355
|
+
marginBlock: {
|
|
356
|
+
type: [
|
|
357
|
+
Boolean,
|
|
358
|
+
Number,
|
|
359
|
+
String
|
|
360
|
+
],
|
|
361
|
+
required: false
|
|
362
|
+
},
|
|
363
|
+
marginInline: {
|
|
364
|
+
type: [
|
|
365
|
+
Boolean,
|
|
366
|
+
Number,
|
|
367
|
+
String
|
|
368
|
+
],
|
|
369
|
+
required: false
|
|
370
|
+
},
|
|
371
|
+
marginInlineStart: {
|
|
372
|
+
type: [
|
|
373
|
+
Boolean,
|
|
374
|
+
Number,
|
|
375
|
+
String
|
|
376
|
+
],
|
|
377
|
+
required: false
|
|
378
|
+
},
|
|
379
|
+
marginInlineEnd: {
|
|
380
|
+
type: [
|
|
381
|
+
Boolean,
|
|
382
|
+
Number,
|
|
383
|
+
String
|
|
384
|
+
],
|
|
385
|
+
required: false
|
|
386
|
+
},
|
|
387
|
+
marginBlockStart: {
|
|
388
|
+
type: [
|
|
389
|
+
Boolean,
|
|
390
|
+
Number,
|
|
391
|
+
String
|
|
392
|
+
],
|
|
393
|
+
required: false
|
|
394
|
+
},
|
|
395
|
+
marginBlockEnd: {
|
|
396
|
+
type: [
|
|
397
|
+
Boolean,
|
|
398
|
+
Number,
|
|
399
|
+
String
|
|
400
|
+
],
|
|
401
|
+
required: false
|
|
402
|
+
},
|
|
403
|
+
padding: {
|
|
404
|
+
type: [
|
|
405
|
+
Boolean,
|
|
406
|
+
Number,
|
|
407
|
+
String
|
|
408
|
+
],
|
|
409
|
+
required: false
|
|
410
|
+
},
|
|
411
|
+
paddingTop: {
|
|
412
|
+
type: [
|
|
413
|
+
Boolean,
|
|
414
|
+
Number,
|
|
415
|
+
String
|
|
416
|
+
],
|
|
417
|
+
required: false
|
|
418
|
+
},
|
|
419
|
+
paddingLeft: {
|
|
420
|
+
type: [
|
|
421
|
+
Boolean,
|
|
422
|
+
Number,
|
|
423
|
+
String
|
|
424
|
+
],
|
|
425
|
+
required: false
|
|
426
|
+
},
|
|
427
|
+
paddingBottom: {
|
|
428
|
+
type: [
|
|
429
|
+
Boolean,
|
|
430
|
+
Number,
|
|
431
|
+
String
|
|
432
|
+
],
|
|
433
|
+
required: false
|
|
434
|
+
},
|
|
435
|
+
paddingRight: {
|
|
436
|
+
type: [
|
|
437
|
+
Boolean,
|
|
438
|
+
Number,
|
|
439
|
+
String
|
|
440
|
+
],
|
|
441
|
+
required: false
|
|
442
|
+
},
|
|
443
|
+
paddingBlock: {
|
|
444
|
+
type: [
|
|
445
|
+
Boolean,
|
|
446
|
+
Number,
|
|
447
|
+
String
|
|
448
|
+
],
|
|
449
|
+
required: false
|
|
450
|
+
},
|
|
451
|
+
paddingInline: {
|
|
452
|
+
type: [
|
|
453
|
+
Boolean,
|
|
454
|
+
Number,
|
|
455
|
+
String
|
|
456
|
+
],
|
|
457
|
+
required: false
|
|
458
|
+
},
|
|
459
|
+
paddingInlineStart: {
|
|
460
|
+
type: [
|
|
461
|
+
Boolean,
|
|
462
|
+
Number,
|
|
463
|
+
String
|
|
464
|
+
],
|
|
465
|
+
required: false
|
|
466
|
+
},
|
|
467
|
+
paddingInlineEnd: {
|
|
468
|
+
type: [
|
|
469
|
+
Boolean,
|
|
470
|
+
Number,
|
|
471
|
+
String
|
|
472
|
+
],
|
|
473
|
+
required: false
|
|
474
|
+
},
|
|
475
|
+
paddingBlockStart: {
|
|
476
|
+
type: [
|
|
477
|
+
Boolean,
|
|
478
|
+
Number,
|
|
479
|
+
String
|
|
480
|
+
],
|
|
481
|
+
required: false
|
|
482
|
+
},
|
|
483
|
+
paddingBlockEnd: {
|
|
484
|
+
type: [
|
|
485
|
+
Boolean,
|
|
486
|
+
Number,
|
|
487
|
+
String
|
|
488
|
+
],
|
|
489
|
+
required: false
|
|
490
|
+
},
|
|
491
|
+
rounded: {
|
|
492
|
+
type: [
|
|
493
|
+
Boolean,
|
|
494
|
+
Number,
|
|
495
|
+
String,
|
|
496
|
+
null
|
|
497
|
+
],
|
|
498
|
+
required: false,
|
|
499
|
+
skipCheck: true
|
|
500
|
+
},
|
|
501
|
+
roundedTopRight: {
|
|
502
|
+
type: [
|
|
503
|
+
Boolean,
|
|
504
|
+
Number,
|
|
505
|
+
String
|
|
506
|
+
],
|
|
507
|
+
required: false
|
|
508
|
+
},
|
|
509
|
+
roundedTopLeft: {
|
|
510
|
+
type: [
|
|
511
|
+
Boolean,
|
|
512
|
+
Number,
|
|
513
|
+
String
|
|
514
|
+
],
|
|
515
|
+
required: false
|
|
516
|
+
},
|
|
517
|
+
roundedBottomLeft: {
|
|
518
|
+
type: [
|
|
519
|
+
Boolean,
|
|
520
|
+
Number,
|
|
521
|
+
String
|
|
522
|
+
],
|
|
523
|
+
required: false
|
|
524
|
+
},
|
|
525
|
+
roundedBottomRight: {
|
|
526
|
+
type: [
|
|
527
|
+
Boolean,
|
|
528
|
+
Number,
|
|
529
|
+
String
|
|
530
|
+
],
|
|
531
|
+
required: false
|
|
532
|
+
},
|
|
533
|
+
roundedStartStart: {
|
|
534
|
+
type: [
|
|
535
|
+
Boolean,
|
|
536
|
+
Number,
|
|
537
|
+
String
|
|
538
|
+
],
|
|
539
|
+
required: false
|
|
540
|
+
},
|
|
541
|
+
roundedStartEnd: {
|
|
542
|
+
type: [
|
|
543
|
+
Boolean,
|
|
544
|
+
Number,
|
|
545
|
+
String
|
|
546
|
+
],
|
|
547
|
+
required: false
|
|
548
|
+
},
|
|
549
|
+
roundedEndStart: {
|
|
550
|
+
type: [
|
|
551
|
+
Boolean,
|
|
552
|
+
Number,
|
|
553
|
+
String
|
|
554
|
+
],
|
|
555
|
+
required: false
|
|
556
|
+
},
|
|
557
|
+
roundedEndEnd: {
|
|
558
|
+
type: [
|
|
559
|
+
Boolean,
|
|
560
|
+
Number,
|
|
561
|
+
String
|
|
562
|
+
],
|
|
563
|
+
required: false
|
|
564
|
+
},
|
|
565
|
+
elevation: {
|
|
566
|
+
type: [Number, String],
|
|
567
|
+
required: false
|
|
568
|
+
},
|
|
569
|
+
bgColor: {
|
|
570
|
+
type: [
|
|
571
|
+
String,
|
|
572
|
+
Object,
|
|
573
|
+
Boolean,
|
|
574
|
+
null
|
|
575
|
+
],
|
|
576
|
+
required: false,
|
|
577
|
+
skipCheck: true
|
|
578
|
+
},
|
|
579
|
+
fontSize: {
|
|
580
|
+
type: null,
|
|
581
|
+
required: false
|
|
582
|
+
},
|
|
583
|
+
fontWeight: {
|
|
584
|
+
type: null,
|
|
585
|
+
required: false
|
|
586
|
+
}
|
|
248
587
|
});
|
|
249
|
-
const emit = defineEmits([
|
|
588
|
+
const emit = defineEmits([
|
|
589
|
+
"point-click",
|
|
590
|
+
"legend-click",
|
|
591
|
+
"series-toggle"
|
|
592
|
+
]);
|
|
250
593
|
defineSlots();
|
|
251
594
|
const { t } = useLocale();
|
|
252
595
|
const { dimensionStyles } = useDimension(props);
|
|
@@ -257,390 +600,458 @@ const { paddingClasses, paddingStyles } = usePadding(props);
|
|
|
257
600
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
258
601
|
const { headerTypographyStyles } = useChartHeaderTypography(props);
|
|
259
602
|
const chartAnimationStyle = useChartAnimationStyle(props);
|
|
603
|
+
/*********************************************************
|
|
604
|
+
* Static SVG box — square coordinate space; CSS scales it.
|
|
605
|
+
********************************************************/
|
|
260
606
|
const { resizeRef: svgRef, width: svgWidth } = useChartSize(CHART_SIZE_FALLBACK.sunburst, { aspectRatio: CHART_ASPECT_RATIO.radial });
|
|
261
607
|
const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
|
|
262
608
|
const center = computed(() => svgWidth.value / 2);
|
|
263
609
|
const MAX_DEPTH_CAP = 4;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
610
|
+
/**
|
|
611
|
+
* Angular-span thresholds for label rendering strategy:
|
|
612
|
+
* - ≥ LABEL_ANGLE_INLINE (~5.7°): render label horizontally inside the arc.
|
|
613
|
+
* - ≥ LABEL_ANGLE_ROTATED (~2.9°): render label rotated along the arc midpoint.
|
|
614
|
+
* - < LABEL_ANGLE_ROTATED : render label outside via leader line.
|
|
615
|
+
*/
|
|
616
|
+
const LABEL_ANGLE_INLINE = .1;
|
|
617
|
+
const LABEL_ANGLE_ROTATED = .05;
|
|
618
|
+
/** Estimated character width factor (fraction of font-size) for truncation. */
|
|
619
|
+
const CHAR_WIDTH_FACTOR = .6;
|
|
620
|
+
/** Font size in SVG units (matches CSS 0.625rem at 16px base). */
|
|
267
621
|
const LABEL_FONT_SIZE = 10;
|
|
622
|
+
/** Extra radial clearance beyond outerR for leader elbow. */
|
|
268
623
|
const LEADER_ELBOW_OFFSET = 18;
|
|
624
|
+
/** Horizontal extension past the elbow for the label anchor. */
|
|
269
625
|
const LEADER_HORIZ_OFFSET = 28;
|
|
626
|
+
/*********************************************************
|
|
627
|
+
* Default colour palette — mirrors the DS intent cycle
|
|
628
|
+
********************************************************/
|
|
270
629
|
const DEFAULT_PALETTE = [
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
630
|
+
"primary",
|
|
631
|
+
"success",
|
|
632
|
+
"warning",
|
|
633
|
+
"danger",
|
|
634
|
+
"info",
|
|
635
|
+
"secondary",
|
|
636
|
+
"ghost",
|
|
637
|
+
"neutral"
|
|
279
638
|
];
|
|
280
639
|
const resolveColor = (raw) => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
640
|
+
if (!raw) return "currentColor";
|
|
641
|
+
if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
|
|
642
|
+
return raw;
|
|
643
|
+
}
|
|
644
|
+
if (isIntent(raw)) {
|
|
645
|
+
return intentBgExpr(raw, "default");
|
|
646
|
+
}
|
|
647
|
+
return "currentColor";
|
|
289
648
|
};
|
|
290
649
|
const rootColorFor = (rootIndex) => {
|
|
291
|
-
|
|
292
|
-
|
|
650
|
+
const scheme = props.colorScheme?.length ? props.colorScheme : DEFAULT_PALETTE;
|
|
651
|
+
return resolveColor(scheme[rootIndex % scheme.length]);
|
|
293
652
|
};
|
|
653
|
+
/*********************************************************
|
|
654
|
+
* Child colour — lighten toward white per depth level.
|
|
655
|
+
* Uses color-mix when CSS custom properties are involved;
|
|
656
|
+
* falls back to a simple inlined color-mix expression.
|
|
657
|
+
********************************************************/
|
|
294
658
|
const childColor = (parentColor, depth) => {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
659
|
+
const cappedDepth = Math.min(depth, MAX_DEPTH_CAP);
|
|
660
|
+
const pct = cappedDepth * 15;
|
|
661
|
+
return `color-mix(in srgb, ${parentColor} calc(100% - ${pct}%), white)`;
|
|
298
662
|
};
|
|
663
|
+
/*********************************************************
|
|
664
|
+
* Tree value resolution — fill in missing internal values
|
|
665
|
+
********************************************************/
|
|
299
666
|
const resolveValue = (datum) => {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
667
|
+
if (!datum.children?.length) {
|
|
668
|
+
return datum.value ?? 0;
|
|
669
|
+
}
|
|
670
|
+
const childSum = datum.children.reduce((acc, c) => acc + resolveValue(c), 0);
|
|
671
|
+
return datum.value ?? childSum;
|
|
305
672
|
};
|
|
673
|
+
/*********************************************************
|
|
674
|
+
* Arc path generator (standard SVG arc notation)
|
|
675
|
+
********************************************************/
|
|
306
676
|
const arcPath = (innerR, outerR, startAngle, endAngle) => {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
677
|
+
const sweep = endAngle - startAngle;
|
|
678
|
+
if (sweep <= 0) return "";
|
|
679
|
+
const fullCircle = sweep >= 2 * Math.PI - 1e-6;
|
|
680
|
+
const cos0 = Math.cos(startAngle);
|
|
681
|
+
const sin0 = Math.sin(startAngle);
|
|
682
|
+
const cos1 = Math.cos(endAngle);
|
|
683
|
+
const sin1 = Math.sin(endAngle);
|
|
684
|
+
const largeArc = sweep > Math.PI ? 1 : 0;
|
|
685
|
+
if (fullCircle) {
|
|
686
|
+
const midAngle = startAngle + Math.PI;
|
|
687
|
+
const cosM = Math.cos(midAngle);
|
|
688
|
+
const sinM = Math.sin(midAngle);
|
|
689
|
+
const ox0 = outerR * cosM;
|
|
690
|
+
const oy0 = outerR * sinM;
|
|
691
|
+
const ox1 = outerR * cos0;
|
|
692
|
+
const oy1 = outerR * sin0;
|
|
693
|
+
const ix0 = innerR * cosM;
|
|
694
|
+
const iy0 = innerR * sinM;
|
|
695
|
+
const ix1 = innerR * cos0;
|
|
696
|
+
const iy1 = innerR * sin0;
|
|
697
|
+
if (innerR < .001) {
|
|
698
|
+
return [
|
|
699
|
+
`M ${ox0},${oy0}`,
|
|
700
|
+
`A ${outerR},${outerR} 0 1,1 ${ox1},${oy1}`,
|
|
701
|
+
`A ${outerR},${outerR} 0 1,1 ${ox0},${oy0}`,
|
|
702
|
+
"Z"
|
|
703
|
+
].join(" ");
|
|
704
|
+
}
|
|
705
|
+
return [
|
|
706
|
+
`M ${ox0},${oy0}`,
|
|
707
|
+
`A ${outerR},${outerR} 0 1,1 ${ox1},${oy1}`,
|
|
708
|
+
`A ${outerR},${outerR} 0 1,1 ${ox0},${oy0}`,
|
|
709
|
+
`L ${ix0},${iy0}`,
|
|
710
|
+
`A ${innerR},${innerR} 0 1,0 ${ix1},${iy1}`,
|
|
711
|
+
`A ${innerR},${innerR} 0 1,0 ${ix0},${iy0}`,
|
|
712
|
+
"Z"
|
|
713
|
+
].join(" ");
|
|
714
|
+
}
|
|
715
|
+
const ox0 = outerR * cos0;
|
|
716
|
+
const oy0 = outerR * sin0;
|
|
717
|
+
const ox1 = outerR * cos1;
|
|
718
|
+
const oy1 = outerR * sin1;
|
|
719
|
+
const ix0 = innerR * cos0;
|
|
720
|
+
const iy0 = innerR * sin0;
|
|
721
|
+
const ix1 = innerR * cos1;
|
|
722
|
+
const iy1 = innerR * sin1;
|
|
723
|
+
if (innerR < .001) {
|
|
724
|
+
return [
|
|
725
|
+
`M 0,0`,
|
|
726
|
+
`L ${ox0},${oy0}`,
|
|
727
|
+
`A ${outerR},${outerR} 0 ${largeArc},1 ${ox1},${oy1}`,
|
|
728
|
+
"Z"
|
|
729
|
+
].join(" ");
|
|
730
|
+
}
|
|
731
|
+
/*
|
|
732
|
+
* Donut wedge: start at outer-START, sweep clockwise to
|
|
733
|
+
* outer-END (sweep=1), radial line in to inner-END, then
|
|
734
|
+
* sweep counter-clockwise back to inner-START (sweep=0).
|
|
735
|
+
*
|
|
736
|
+
* Prior agent inverted both directions (started at inner
|
|
737
|
+
* end, swept the WRONG way around the circle) which made
|
|
738
|
+
* each wedge draw across the entire ring — visible as
|
|
739
|
+
* petals / bulges in the rendered chart.
|
|
740
|
+
*/
|
|
741
|
+
return [
|
|
742
|
+
`M ${ox0},${oy0}`,
|
|
743
|
+
`A ${outerR},${outerR} 0 ${largeArc},1 ${ox1},${oy1}`,
|
|
744
|
+
`L ${ix1},${iy1}`,
|
|
745
|
+
`A ${innerR},${innerR} 0 ${largeArc},0 ${ix0},${iy0}`,
|
|
746
|
+
"Z"
|
|
747
|
+
].join(" ");
|
|
368
748
|
};
|
|
749
|
+
/*********************************************************
|
|
750
|
+
* Max-depth calculation — must precede allNodes
|
|
751
|
+
********************************************************/
|
|
369
752
|
const computeMaxDepth = (data) => {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
753
|
+
const walkDepth = (nodes, current) => {
|
|
754
|
+
let max = current;
|
|
755
|
+
for (const node of nodes) {
|
|
756
|
+
if (node.children?.length) {
|
|
757
|
+
max = Math.max(max, walkDepth(node.children, current + 1));
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return max;
|
|
761
|
+
};
|
|
762
|
+
return walkDepth(data, 1);
|
|
380
763
|
};
|
|
381
|
-
|
|
764
|
+
/*********************************************************
|
|
765
|
+
* Legend — hidden-root set keyed by root node name
|
|
766
|
+
********************************************************/
|
|
767
|
+
const hiddenRoots = ref(new Set());
|
|
768
|
+
/*********************************************************
|
|
769
|
+
* Geometry engine — flatten tree into node descriptors
|
|
770
|
+
********************************************************/
|
|
382
771
|
const allNodes = computed(() => {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
772
|
+
const series = props.series?.[0];
|
|
773
|
+
if (!series || !series.data?.length) return [];
|
|
774
|
+
const rawData = series.data;
|
|
775
|
+
if (!rawData.length) return [];
|
|
776
|
+
const maxDepth = Math.min(computeMaxDepth(rawData), MAX_DEPTH_CAP);
|
|
777
|
+
if (maxDepth === 0) return [];
|
|
778
|
+
const totalR = center.value - 4;
|
|
779
|
+
const holeR = totalR * props.innerRadius;
|
|
780
|
+
const ringWidth = (totalR - holeR) / maxDepth;
|
|
781
|
+
const totalValue = rawData.reduce((acc, d) => acc + resolveValue(d), 0);
|
|
782
|
+
if (totalValue <= 0) return [];
|
|
783
|
+
const TWO_PI = 2 * Math.PI;
|
|
784
|
+
const result = [];
|
|
785
|
+
const walkTree = (datum, depth, parentStartAngle, parentEndAngle, rootIdx, parentColor, ancestorPath) => {
|
|
786
|
+
if (depth > MAX_DEPTH_CAP) return;
|
|
787
|
+
const val = resolveValue(datum);
|
|
788
|
+
if (val <= 0) return;
|
|
789
|
+
const nodePath = ancestorPath ? `${ancestorPath} > ${datum.name}` : datum.name;
|
|
790
|
+
const isHidden = hiddenRoots.value.has(depth === 0 ? datum.name : nodePath.split(" > ")[0]);
|
|
791
|
+
const innerR = holeR + depth * (ringWidth + props.ringPadding);
|
|
792
|
+
const outerR = innerR + ringWidth;
|
|
793
|
+
const nodeColor = datum.color ? resolveColor(datum.color) : depth === 0 ? parentColor : childColor(parentColor, depth);
|
|
794
|
+
const d = arcPath(innerR, outerR, parentStartAngle, parentEndAngle);
|
|
795
|
+
const arcSpan = parentEndAngle - parentStartAngle;
|
|
796
|
+
const labelMode = arcSpan >= LABEL_ANGLE_INLINE ? "inline" : arcSpan >= LABEL_ANGLE_ROTATED ? "rotated" : "leader";
|
|
797
|
+
result.push({
|
|
798
|
+
id: nodePath,
|
|
799
|
+
name: datum.name,
|
|
800
|
+
value: val,
|
|
801
|
+
depth,
|
|
802
|
+
rootIndex: rootIdx,
|
|
803
|
+
startAngle: parentStartAngle,
|
|
804
|
+
endAngle: parentEndAngle,
|
|
805
|
+
innerR,
|
|
806
|
+
outerR,
|
|
807
|
+
d,
|
|
808
|
+
color: nodeColor,
|
|
809
|
+
visible: !isHidden,
|
|
810
|
+
path: nodePath,
|
|
811
|
+
labelMode
|
|
812
|
+
});
|
|
813
|
+
if (datum.children?.length && depth + 1 <= MAX_DEPTH_CAP) {
|
|
814
|
+
const parentSpan = parentEndAngle - parentStartAngle;
|
|
815
|
+
let childAngle = parentStartAngle;
|
|
816
|
+
for (const child of datum.children) {
|
|
817
|
+
const childVal = resolveValue(child);
|
|
818
|
+
if (childVal <= 0) continue;
|
|
819
|
+
const childSpan = childVal / val * parentSpan;
|
|
820
|
+
const childEnd = childAngle + childSpan;
|
|
821
|
+
walkTree(child, depth + 1, childAngle, childEnd, rootIdx, nodeColor, nodePath);
|
|
822
|
+
childAngle = childEnd;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
let currentAngle = 0;
|
|
827
|
+
rawData.forEach((datum, rootIdx) => {
|
|
828
|
+
const rootVal = resolveValue(datum);
|
|
829
|
+
if (rootVal <= 0) return;
|
|
830
|
+
const rootColor = datum.color ? resolveColor(datum.color) : rootColorFor(rootIdx);
|
|
831
|
+
const span = rootVal / totalValue * TWO_PI;
|
|
832
|
+
walkTree(datum, 0, currentAngle, currentAngle + span, rootIdx, rootColor, "");
|
|
833
|
+
currentAngle += span;
|
|
834
|
+
});
|
|
835
|
+
return result;
|
|
447
836
|
});
|
|
448
|
-
const visibleNodes = computed(
|
|
449
|
-
() => allNodes.value.filter((n) => n.visible)
|
|
450
|
-
);
|
|
837
|
+
const visibleNodes = computed(() => allNodes.value.filter((n) => n.visible));
|
|
451
838
|
const inlineOrRotatedLabelNodes = computed(() => {
|
|
452
|
-
|
|
453
|
-
|
|
839
|
+
if (!props.showLabel) return [];
|
|
840
|
+
return visibleNodes.value.filter((n) => n.labelMode === "inline" || n.labelMode === "rotated");
|
|
454
841
|
});
|
|
455
842
|
const leaderLabelNodes = computed(() => {
|
|
456
|
-
|
|
457
|
-
|
|
843
|
+
if (!props.showLabel) return [];
|
|
844
|
+
return visibleNodes.value.filter((n) => n.labelMode === "leader");
|
|
458
845
|
});
|
|
846
|
+
/*********************************************************
|
|
847
|
+
* Text truncation helpers
|
|
848
|
+
********************************************************/
|
|
459
849
|
const chordBudget = (node) => {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
850
|
+
const midR = (node.innerR + node.outerR) / 2;
|
|
851
|
+
const span = node.endAngle - node.startAngle;
|
|
852
|
+
return midR * 2 * Math.sin(span / 2);
|
|
463
853
|
};
|
|
464
854
|
const truncatedLabel = (node) => {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
855
|
+
const budget = chordBudget(node);
|
|
856
|
+
const maxChars = Math.floor(budget / (LABEL_FONT_SIZE * CHAR_WIDTH_FACTOR));
|
|
857
|
+
if (maxChars <= 0) return "";
|
|
858
|
+
if (node.name.length <= maxChars) return node.name;
|
|
859
|
+
if (maxChars <= 1) return "…";
|
|
860
|
+
return node.name.slice(0, maxChars - 1) + "…";
|
|
471
861
|
};
|
|
472
862
|
const truncatedLabelLeader = (node) => {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
863
|
+
const maxChars = 14;
|
|
864
|
+
if (node.name.length <= maxChars) return node.name;
|
|
865
|
+
return node.name.slice(0, maxChars - 1) + "…";
|
|
476
866
|
};
|
|
867
|
+
/*********************************************************
|
|
868
|
+
* Label geometry — inline / rotated (centred in arc)
|
|
869
|
+
*
|
|
870
|
+
* inline — rotate so text reads tangentially (same direction as arc)
|
|
871
|
+
* but flip 180° on the left half so it never reads upside-down.
|
|
872
|
+
* rotated — same tangential rotation; the only visual difference is the
|
|
873
|
+
* narrower budget tracked by truncatedLabel().
|
|
874
|
+
********************************************************/
|
|
477
875
|
const labelTransform = (node) => {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
876
|
+
const midAngle = (node.startAngle + node.endAngle) / 2;
|
|
877
|
+
const midR = (node.innerR + node.outerR) / 2;
|
|
878
|
+
const x = midR * Math.cos(midAngle);
|
|
879
|
+
const y = midR * Math.sin(midAngle);
|
|
880
|
+
const degrees = midAngle * 180 / Math.PI;
|
|
881
|
+
const rotation = degrees > 90 && degrees < 270 ? degrees + 180 : degrees;
|
|
882
|
+
return `translate(${x},${y}) rotate(${rotation})`;
|
|
485
883
|
};
|
|
884
|
+
/*********************************************************
|
|
885
|
+
* Leader-line geometry — outside-chart labels
|
|
886
|
+
*
|
|
887
|
+
* Strategy: elbow at outerR + LEADER_ELBOW_OFFSET along the midpoint
|
|
888
|
+
* radial, then horizontal to LEADER_HORIZ_OFFSET. Label sits at the
|
|
889
|
+
* end of the horizontal leg.
|
|
890
|
+
********************************************************/
|
|
486
891
|
const leaderElbow = (node) => {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
892
|
+
const midAngle = (node.startAngle + node.endAngle) / 2;
|
|
893
|
+
const elbowR = node.outerR + LEADER_ELBOW_OFFSET;
|
|
894
|
+
return {
|
|
895
|
+
x: elbowR * Math.cos(midAngle),
|
|
896
|
+
y: elbowR * Math.sin(midAngle)
|
|
897
|
+
};
|
|
493
898
|
};
|
|
494
899
|
const leaderEnd = (node) => {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
900
|
+
const elbow = leaderElbow(node);
|
|
901
|
+
const sign = elbow.x >= 0 ? 1 : -1;
|
|
902
|
+
return {
|
|
903
|
+
x: elbow.x + sign * LEADER_HORIZ_OFFSET,
|
|
904
|
+
y: elbow.y
|
|
905
|
+
};
|
|
501
906
|
};
|
|
502
907
|
const leaderStartPoint = (node) => {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
908
|
+
const midAngle = (node.startAngle + node.endAngle) / 2;
|
|
909
|
+
return {
|
|
910
|
+
x: node.outerR * Math.cos(midAngle),
|
|
911
|
+
y: node.outerR * Math.sin(midAngle)
|
|
912
|
+
};
|
|
508
913
|
};
|
|
509
914
|
const leaderLinePoints = (node) => {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
915
|
+
const start = leaderStartPoint(node);
|
|
916
|
+
const elbow = leaderElbow(node);
|
|
917
|
+
const end = leaderEnd(node);
|
|
918
|
+
return `${start.x},${start.y} ${elbow.x},${elbow.y} ${end.x},${end.y}`;
|
|
514
919
|
};
|
|
515
920
|
const leaderTextAnchor = (node) => {
|
|
516
|
-
|
|
517
|
-
|
|
921
|
+
const elbow = leaderElbow(node);
|
|
922
|
+
return elbow.x >= 0 ? "start" : "end";
|
|
518
923
|
};
|
|
519
924
|
const leaderTextTransform = (node) => {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
925
|
+
const end = leaderEnd(node);
|
|
926
|
+
const sign = end.x >= 0 ? 1 : -1;
|
|
927
|
+
return `translate(${end.x + sign * 3},${end.y})`;
|
|
523
928
|
};
|
|
929
|
+
/*********************************************************
|
|
930
|
+
* Legend items — root-level nodes only
|
|
931
|
+
********************************************************/
|
|
524
932
|
const legendItems = computed(() => {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
933
|
+
const series = props.series?.[0];
|
|
934
|
+
if (!series) return [];
|
|
935
|
+
const roots = allNodes.value.filter((n) => n.depth === 0);
|
|
936
|
+
return roots.map((node) => ({
|
|
937
|
+
series: {
|
|
938
|
+
...series,
|
|
939
|
+
name: node.name,
|
|
940
|
+
data: [node.value],
|
|
941
|
+
visible: node.visible
|
|
942
|
+
},
|
|
943
|
+
index: node.rootIndex,
|
|
944
|
+
color: node.color,
|
|
945
|
+
visible: node.visible
|
|
946
|
+
}));
|
|
947
|
+
});
|
|
948
|
+
/*********************************************************
|
|
949
|
+
* Hover / tooltip
|
|
950
|
+
********************************************************/
|
|
951
|
+
const mousePos = ref({
|
|
952
|
+
x: 0,
|
|
953
|
+
y: 0
|
|
539
954
|
});
|
|
540
|
-
const mousePos = ref({ x: 0, y: 0 });
|
|
541
955
|
const hoveredId = ref(null);
|
|
542
956
|
const hoveredNode = computed(() => {
|
|
543
|
-
|
|
544
|
-
|
|
957
|
+
if (!hoveredId.value) return null;
|
|
958
|
+
return visibleNodes.value.find((n) => n.id === hoveredId.value) ?? null;
|
|
545
959
|
});
|
|
546
960
|
const hoveredPoint = computed(() => {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
961
|
+
const n = hoveredNode.value;
|
|
962
|
+
if (!n || !props.series?.[0]) return null;
|
|
963
|
+
return {
|
|
964
|
+
seriesIndex: 0,
|
|
965
|
+
seriesName: props.series[0].name,
|
|
966
|
+
dataIndex: n.rootIndex,
|
|
967
|
+
x: n.name,
|
|
968
|
+
y: n.value,
|
|
969
|
+
color: n.color
|
|
970
|
+
};
|
|
557
971
|
});
|
|
558
972
|
const hoveredSeries = computed(() => {
|
|
559
|
-
|
|
560
|
-
|
|
973
|
+
if (!hoveredNode.value || !props.series?.[0]) return null;
|
|
974
|
+
return props.series[0];
|
|
561
975
|
});
|
|
562
|
-
const hoveredCategory = computed(
|
|
563
|
-
() => hoveredNode.value?.name ?? ""
|
|
564
|
-
);
|
|
976
|
+
const hoveredCategory = computed(() => hoveredNode.value?.name ?? "");
|
|
565
977
|
const showEmpty = computed(() => {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
978
|
+
if (!props.series?.length) return true;
|
|
979
|
+
const first = props.series[0];
|
|
980
|
+
if (!first?.data?.length) return true;
|
|
981
|
+
return visibleNodes.value.length === 0;
|
|
570
982
|
});
|
|
983
|
+
/*********************************************************
|
|
984
|
+
* Root classes / styles
|
|
985
|
+
********************************************************/
|
|
571
986
|
const rootClasses = computed(() => [
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
987
|
+
{
|
|
988
|
+
[`origam-chart-sunburst--legend-${props.legendPosition}`]: true,
|
|
989
|
+
"origam-chart-sunburst--no-animation": !props.animated
|
|
990
|
+
},
|
|
991
|
+
backgroundColorClasses.value,
|
|
992
|
+
elevationClasses.value,
|
|
993
|
+
marginClasses.value,
|
|
994
|
+
paddingClasses.value,
|
|
995
|
+
roundedClasses.value,
|
|
996
|
+
props.class
|
|
582
997
|
]);
|
|
583
998
|
const rootStyles = computed(() => {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
999
|
+
const out = {};
|
|
1000
|
+
if (props.aspectRatio) {
|
|
1001
|
+
out.aspectRatio = props.aspectRatio;
|
|
1002
|
+
}
|
|
1003
|
+
Object.assign(out, chartAnimationStyle.value);
|
|
1004
|
+
return [out, props.style];
|
|
590
1005
|
});
|
|
591
|
-
const bodyClasses = computed(() => ({
|
|
592
|
-
|
|
593
|
-
}));
|
|
594
|
-
const svgClasses = computed(() => ({
|
|
595
|
-
"origam-chart__svg--animated": props.animated
|
|
596
|
-
}));
|
|
1006
|
+
const bodyClasses = computed(() => ({ "origam-chart-sunburst__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
|
|
1007
|
+
const svgClasses = computed(() => ({ "origam-chart__svg--animated": props.animated }));
|
|
597
1008
|
const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
|
|
1009
|
+
/*********************************************************
|
|
1010
|
+
* ARIA
|
|
1011
|
+
********************************************************/
|
|
598
1012
|
const defaultAriaLabel = computed(() => t("origam.chart.sunburst.aria_label"));
|
|
599
1013
|
const ariaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
600
1014
|
const svgAriaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
601
1015
|
const svgTitle = computed(() => props.title ?? defaultAriaLabel.value);
|
|
602
|
-
const svgDesc = computed(
|
|
603
|
-
() => t(
|
|
604
|
-
"origam.chart.sunburst.desc",
|
|
605
|
-
visibleNodes.value.filter((nd) => nd.depth === 0).length,
|
|
606
|
-
{ chart: defaultAriaLabel.value }
|
|
607
|
-
)
|
|
608
|
-
);
|
|
1016
|
+
const svgDesc = computed(() => t("origam.chart.sunburst.desc", visibleNodes.value.filter((nd) => nd.depth === 0).length, { chart: defaultAriaLabel.value }));
|
|
609
1017
|
const nodeAriaLabel = (node) => {
|
|
610
|
-
|
|
611
|
-
|
|
1018
|
+
const formatted = props.yAxisFormat ? props.yAxisFormat(node.value) : String(node.value);
|
|
1019
|
+
return `${node.path}: ${formatted}`;
|
|
612
1020
|
};
|
|
1021
|
+
/*********************************************************
|
|
1022
|
+
* Interaction
|
|
1023
|
+
********************************************************/
|
|
613
1024
|
const onNodeEnter = (node) => {
|
|
614
|
-
|
|
1025
|
+
hoveredId.value = node.id;
|
|
615
1026
|
};
|
|
616
1027
|
const onNodeLeave = () => {
|
|
617
|
-
|
|
1028
|
+
hoveredId.value = null;
|
|
618
1029
|
};
|
|
619
1030
|
const onSvgMouseMove = (event) => {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
1031
|
+
const target = svgRef.value;
|
|
1032
|
+
if (!target) return;
|
|
1033
|
+
const rect = target.getBoundingClientRect();
|
|
1034
|
+
mousePos.value = {
|
|
1035
|
+
x: event.clientX - rect.left,
|
|
1036
|
+
y: event.clientY - rect.top
|
|
1037
|
+
};
|
|
627
1038
|
};
|
|
628
1039
|
const onSvgMouseLeave = () => {
|
|
629
|
-
|
|
1040
|
+
onNodeLeave();
|
|
630
1041
|
};
|
|
631
1042
|
const onNodeActivate = (node, event) => {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
1043
|
+
hoveredId.value = node.id;
|
|
1044
|
+
if (hoveredPoint.value) {
|
|
1045
|
+
emit("point-click", hoveredPoint.value, event);
|
|
1046
|
+
}
|
|
636
1047
|
};
|
|
637
1048
|
const onLegendClick = (series, index) => {
|
|
638
|
-
|
|
1049
|
+
emit("legend-click", series, index);
|
|
639
1050
|
};
|
|
640
1051
|
const onSeriesToggle = (series, nextVisible) => {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
1052
|
+
if (nextVisible) hiddenRoots.value.delete(series.name);
|
|
1053
|
+
else hiddenRoots.value.add(series.name);
|
|
1054
|
+
emit("series-toggle", series, nextVisible);
|
|
644
1055
|
};
|
|
645
1056
|
</script>
|
|
646
1057
|
|