origam 2.38.1 → 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 +24 -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 +6 -6
|
@@ -163,10 +163,7 @@
|
|
|
163
163
|
|
|
164
164
|
<script lang="ts" setup>
|
|
165
165
|
import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
|
|
166
|
-
import {
|
|
167
|
-
computed,
|
|
168
|
-
ref
|
|
169
|
-
} from "vue";
|
|
166
|
+
import { computed, ref } from "vue";
|
|
170
167
|
import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
|
|
171
168
|
import { useChartSize } from "../../composables/Chart/chart-size.composable";
|
|
172
169
|
import { useLocale } from "../../composables/Commons/locale.composable";
|
|
@@ -178,70 +175,422 @@ import { useMargin } from "../../composables/Commons/margin.composable";
|
|
|
178
175
|
import { usePadding } from "../../composables/Commons/padding.composable";
|
|
179
176
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
180
177
|
import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
/*********************************************************
|
|
179
|
+
* Global
|
|
180
|
+
*
|
|
181
|
+
* @description
|
|
182
|
+
* Sparkline — tiny inline chart for table cells, KPI cards,
|
|
183
|
+
* and dashboards. No axes, no legend, no grid.
|
|
184
|
+
*
|
|
185
|
+
* Supports `line`, `area`, `column`, and `bar` rendering.
|
|
186
|
+
* A single `color` prop drives the entire paint; no palette
|
|
187
|
+
* cycling. Marker circles can be shown for all points
|
|
188
|
+
* (`showMarkers`) or exclusively for the min / max / last
|
|
189
|
+
* special points.
|
|
190
|
+
*
|
|
191
|
+
* `withDefaults` literals only, per CLAUDE.md.
|
|
192
|
+
********************************************************/
|
|
193
|
+
defineOptions({ name: "OrigamChartSparkline" });
|
|
184
194
|
const props = defineProps({
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
|
|
195
|
+
series: {
|
|
196
|
+
type: Array,
|
|
197
|
+
required: true
|
|
198
|
+
},
|
|
199
|
+
type: {
|
|
200
|
+
type: null,
|
|
201
|
+
required: false,
|
|
202
|
+
default: "line"
|
|
203
|
+
},
|
|
204
|
+
color: {
|
|
205
|
+
type: null,
|
|
206
|
+
required: false,
|
|
207
|
+
default: "primary"
|
|
208
|
+
},
|
|
209
|
+
lineWidth: {
|
|
210
|
+
type: Number,
|
|
211
|
+
required: false,
|
|
212
|
+
default: 1.5
|
|
213
|
+
},
|
|
214
|
+
showMarkers: {
|
|
215
|
+
type: Boolean,
|
|
216
|
+
required: false,
|
|
217
|
+
default: false
|
|
218
|
+
},
|
|
219
|
+
showMin: {
|
|
220
|
+
type: Boolean,
|
|
221
|
+
required: false,
|
|
222
|
+
default: false
|
|
223
|
+
},
|
|
224
|
+
showMax: {
|
|
225
|
+
type: Boolean,
|
|
226
|
+
required: false,
|
|
227
|
+
default: false
|
|
228
|
+
},
|
|
229
|
+
showLast: {
|
|
230
|
+
type: Boolean,
|
|
231
|
+
required: false,
|
|
232
|
+
default: true
|
|
233
|
+
},
|
|
234
|
+
markerSize: {
|
|
235
|
+
type: Number,
|
|
236
|
+
required: false,
|
|
237
|
+
default: 2.5
|
|
238
|
+
},
|
|
239
|
+
width: {
|
|
240
|
+
type: [Number, String],
|
|
241
|
+
required: false,
|
|
242
|
+
default: 120
|
|
243
|
+
},
|
|
244
|
+
height: {
|
|
245
|
+
type: [Number, String],
|
|
246
|
+
required: false,
|
|
247
|
+
default: 30
|
|
248
|
+
},
|
|
249
|
+
categories: {
|
|
250
|
+
type: Array,
|
|
251
|
+
required: false
|
|
252
|
+
},
|
|
253
|
+
title: {
|
|
254
|
+
type: String,
|
|
255
|
+
required: false,
|
|
256
|
+
default: undefined
|
|
257
|
+
},
|
|
258
|
+
subtitle: {
|
|
259
|
+
type: String,
|
|
260
|
+
required: false,
|
|
261
|
+
default: undefined
|
|
262
|
+
},
|
|
263
|
+
showTooltip: {
|
|
264
|
+
type: Boolean,
|
|
265
|
+
required: false,
|
|
266
|
+
default: false
|
|
267
|
+
},
|
|
268
|
+
animated: {
|
|
269
|
+
type: Boolean,
|
|
270
|
+
required: false,
|
|
271
|
+
default: false
|
|
272
|
+
},
|
|
273
|
+
animationDuration: {
|
|
274
|
+
type: Number,
|
|
275
|
+
required: false,
|
|
276
|
+
default: 600
|
|
277
|
+
},
|
|
278
|
+
aspectRatio: {
|
|
279
|
+
type: String,
|
|
280
|
+
required: false,
|
|
281
|
+
default: undefined
|
|
282
|
+
},
|
|
283
|
+
id: {
|
|
284
|
+
type: String,
|
|
285
|
+
required: false
|
|
286
|
+
},
|
|
287
|
+
class: {
|
|
288
|
+
type: [
|
|
289
|
+
String,
|
|
290
|
+
Array,
|
|
291
|
+
Object
|
|
292
|
+
],
|
|
293
|
+
required: false
|
|
294
|
+
},
|
|
295
|
+
style: {
|
|
296
|
+
type: [
|
|
297
|
+
String,
|
|
298
|
+
Array,
|
|
299
|
+
Object,
|
|
300
|
+
Boolean,
|
|
301
|
+
null
|
|
302
|
+
],
|
|
303
|
+
required: false,
|
|
304
|
+
skipCheck: true
|
|
305
|
+
},
|
|
306
|
+
maxHeight: {
|
|
307
|
+
type: [Number, String],
|
|
308
|
+
required: false
|
|
309
|
+
},
|
|
310
|
+
maxWidth: {
|
|
311
|
+
type: [Number, String],
|
|
312
|
+
required: false
|
|
313
|
+
},
|
|
314
|
+
minHeight: {
|
|
315
|
+
type: [Number, String],
|
|
316
|
+
required: false
|
|
317
|
+
},
|
|
318
|
+
minWidth: {
|
|
319
|
+
type: [Number, String],
|
|
320
|
+
required: false
|
|
321
|
+
},
|
|
322
|
+
margin: {
|
|
323
|
+
type: [
|
|
324
|
+
Boolean,
|
|
325
|
+
Number,
|
|
326
|
+
String
|
|
327
|
+
],
|
|
328
|
+
required: false
|
|
329
|
+
},
|
|
330
|
+
marginTop: {
|
|
331
|
+
type: [
|
|
332
|
+
Boolean,
|
|
333
|
+
Number,
|
|
334
|
+
String
|
|
335
|
+
],
|
|
336
|
+
required: false
|
|
337
|
+
},
|
|
338
|
+
marginLeft: {
|
|
339
|
+
type: [
|
|
340
|
+
Boolean,
|
|
341
|
+
Number,
|
|
342
|
+
String
|
|
343
|
+
],
|
|
344
|
+
required: false
|
|
345
|
+
},
|
|
346
|
+
marginBottom: {
|
|
347
|
+
type: [
|
|
348
|
+
Boolean,
|
|
349
|
+
Number,
|
|
350
|
+
String
|
|
351
|
+
],
|
|
352
|
+
required: false
|
|
353
|
+
},
|
|
354
|
+
marginRight: {
|
|
355
|
+
type: [
|
|
356
|
+
Boolean,
|
|
357
|
+
Number,
|
|
358
|
+
String
|
|
359
|
+
],
|
|
360
|
+
required: false
|
|
361
|
+
},
|
|
362
|
+
marginBlock: {
|
|
363
|
+
type: [
|
|
364
|
+
Boolean,
|
|
365
|
+
Number,
|
|
366
|
+
String
|
|
367
|
+
],
|
|
368
|
+
required: false
|
|
369
|
+
},
|
|
370
|
+
marginInline: {
|
|
371
|
+
type: [
|
|
372
|
+
Boolean,
|
|
373
|
+
Number,
|
|
374
|
+
String
|
|
375
|
+
],
|
|
376
|
+
required: false
|
|
377
|
+
},
|
|
378
|
+
marginInlineStart: {
|
|
379
|
+
type: [
|
|
380
|
+
Boolean,
|
|
381
|
+
Number,
|
|
382
|
+
String
|
|
383
|
+
],
|
|
384
|
+
required: false
|
|
385
|
+
},
|
|
386
|
+
marginInlineEnd: {
|
|
387
|
+
type: [
|
|
388
|
+
Boolean,
|
|
389
|
+
Number,
|
|
390
|
+
String
|
|
391
|
+
],
|
|
392
|
+
required: false
|
|
393
|
+
},
|
|
394
|
+
marginBlockStart: {
|
|
395
|
+
type: [
|
|
396
|
+
Boolean,
|
|
397
|
+
Number,
|
|
398
|
+
String
|
|
399
|
+
],
|
|
400
|
+
required: false
|
|
401
|
+
},
|
|
402
|
+
marginBlockEnd: {
|
|
403
|
+
type: [
|
|
404
|
+
Boolean,
|
|
405
|
+
Number,
|
|
406
|
+
String
|
|
407
|
+
],
|
|
408
|
+
required: false
|
|
409
|
+
},
|
|
410
|
+
padding: {
|
|
411
|
+
type: [
|
|
412
|
+
Boolean,
|
|
413
|
+
Number,
|
|
414
|
+
String
|
|
415
|
+
],
|
|
416
|
+
required: false
|
|
417
|
+
},
|
|
418
|
+
paddingTop: {
|
|
419
|
+
type: [
|
|
420
|
+
Boolean,
|
|
421
|
+
Number,
|
|
422
|
+
String
|
|
423
|
+
],
|
|
424
|
+
required: false
|
|
425
|
+
},
|
|
426
|
+
paddingLeft: {
|
|
427
|
+
type: [
|
|
428
|
+
Boolean,
|
|
429
|
+
Number,
|
|
430
|
+
String
|
|
431
|
+
],
|
|
432
|
+
required: false
|
|
433
|
+
},
|
|
434
|
+
paddingBottom: {
|
|
435
|
+
type: [
|
|
436
|
+
Boolean,
|
|
437
|
+
Number,
|
|
438
|
+
String
|
|
439
|
+
],
|
|
440
|
+
required: false
|
|
441
|
+
},
|
|
442
|
+
paddingRight: {
|
|
443
|
+
type: [
|
|
444
|
+
Boolean,
|
|
445
|
+
Number,
|
|
446
|
+
String
|
|
447
|
+
],
|
|
448
|
+
required: false
|
|
449
|
+
},
|
|
450
|
+
paddingBlock: {
|
|
451
|
+
type: [
|
|
452
|
+
Boolean,
|
|
453
|
+
Number,
|
|
454
|
+
String
|
|
455
|
+
],
|
|
456
|
+
required: false
|
|
457
|
+
},
|
|
458
|
+
paddingInline: {
|
|
459
|
+
type: [
|
|
460
|
+
Boolean,
|
|
461
|
+
Number,
|
|
462
|
+
String
|
|
463
|
+
],
|
|
464
|
+
required: false
|
|
465
|
+
},
|
|
466
|
+
paddingInlineStart: {
|
|
467
|
+
type: [
|
|
468
|
+
Boolean,
|
|
469
|
+
Number,
|
|
470
|
+
String
|
|
471
|
+
],
|
|
472
|
+
required: false
|
|
473
|
+
},
|
|
474
|
+
paddingInlineEnd: {
|
|
475
|
+
type: [
|
|
476
|
+
Boolean,
|
|
477
|
+
Number,
|
|
478
|
+
String
|
|
479
|
+
],
|
|
480
|
+
required: false
|
|
481
|
+
},
|
|
482
|
+
paddingBlockStart: {
|
|
483
|
+
type: [
|
|
484
|
+
Boolean,
|
|
485
|
+
Number,
|
|
486
|
+
String
|
|
487
|
+
],
|
|
488
|
+
required: false
|
|
489
|
+
},
|
|
490
|
+
paddingBlockEnd: {
|
|
491
|
+
type: [
|
|
492
|
+
Boolean,
|
|
493
|
+
Number,
|
|
494
|
+
String
|
|
495
|
+
],
|
|
496
|
+
required: false
|
|
497
|
+
},
|
|
498
|
+
rounded: {
|
|
499
|
+
type: [
|
|
500
|
+
Boolean,
|
|
501
|
+
Number,
|
|
502
|
+
String,
|
|
503
|
+
null
|
|
504
|
+
],
|
|
505
|
+
required: false,
|
|
506
|
+
skipCheck: true
|
|
507
|
+
},
|
|
508
|
+
roundedTopRight: {
|
|
509
|
+
type: [
|
|
510
|
+
Boolean,
|
|
511
|
+
Number,
|
|
512
|
+
String
|
|
513
|
+
],
|
|
514
|
+
required: false
|
|
515
|
+
},
|
|
516
|
+
roundedTopLeft: {
|
|
517
|
+
type: [
|
|
518
|
+
Boolean,
|
|
519
|
+
Number,
|
|
520
|
+
String
|
|
521
|
+
],
|
|
522
|
+
required: false
|
|
523
|
+
},
|
|
524
|
+
roundedBottomLeft: {
|
|
525
|
+
type: [
|
|
526
|
+
Boolean,
|
|
527
|
+
Number,
|
|
528
|
+
String
|
|
529
|
+
],
|
|
530
|
+
required: false
|
|
531
|
+
},
|
|
532
|
+
roundedBottomRight: {
|
|
533
|
+
type: [
|
|
534
|
+
Boolean,
|
|
535
|
+
Number,
|
|
536
|
+
String
|
|
537
|
+
],
|
|
538
|
+
required: false
|
|
539
|
+
},
|
|
540
|
+
roundedStartStart: {
|
|
541
|
+
type: [
|
|
542
|
+
Boolean,
|
|
543
|
+
Number,
|
|
544
|
+
String
|
|
545
|
+
],
|
|
546
|
+
required: false
|
|
547
|
+
},
|
|
548
|
+
roundedStartEnd: {
|
|
549
|
+
type: [
|
|
550
|
+
Boolean,
|
|
551
|
+
Number,
|
|
552
|
+
String
|
|
553
|
+
],
|
|
554
|
+
required: false
|
|
555
|
+
},
|
|
556
|
+
roundedEndStart: {
|
|
557
|
+
type: [
|
|
558
|
+
Boolean,
|
|
559
|
+
Number,
|
|
560
|
+
String
|
|
561
|
+
],
|
|
562
|
+
required: false
|
|
563
|
+
},
|
|
564
|
+
roundedEndEnd: {
|
|
565
|
+
type: [
|
|
566
|
+
Boolean,
|
|
567
|
+
Number,
|
|
568
|
+
String
|
|
569
|
+
],
|
|
570
|
+
required: false
|
|
571
|
+
},
|
|
572
|
+
elevation: {
|
|
573
|
+
type: [Number, String],
|
|
574
|
+
required: false
|
|
575
|
+
},
|
|
576
|
+
bgColor: {
|
|
577
|
+
type: [
|
|
578
|
+
String,
|
|
579
|
+
Object,
|
|
580
|
+
Boolean,
|
|
581
|
+
null
|
|
582
|
+
],
|
|
583
|
+
required: false,
|
|
584
|
+
skipCheck: true
|
|
585
|
+
},
|
|
586
|
+
fontSize: {
|
|
587
|
+
type: null,
|
|
588
|
+
required: false
|
|
589
|
+
},
|
|
590
|
+
fontWeight: {
|
|
591
|
+
type: null,
|
|
592
|
+
required: false
|
|
593
|
+
}
|
|
245
594
|
});
|
|
246
595
|
const emit = defineEmits(["point-click"]);
|
|
247
596
|
const { t } = useLocale();
|
|
@@ -251,276 +600,370 @@ const { elevationClasses, elevationStyles } = useElevation(props);
|
|
|
251
600
|
const { marginClasses, marginStyles } = useMargin(props);
|
|
252
601
|
const { paddingClasses, paddingStyles } = usePadding(props);
|
|
253
602
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
603
|
+
/*********************************************************
|
|
604
|
+
* Measured SVG coordinate space — viewBox follows the rendered box
|
|
605
|
+
* (useChartSize), 1 unit = 1 px, so strokes and markers are not
|
|
606
|
+
* stretched. 120x30 is the pre-measure fallback.
|
|
607
|
+
********************************************************/
|
|
254
608
|
const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.sparkline);
|
|
255
609
|
const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
|
|
256
610
|
const PADDING_X = 2;
|
|
257
611
|
const PADDING_Y = 2;
|
|
612
|
+
/*********************************************************
|
|
613
|
+
* Data extraction — first series, numeric values only.
|
|
614
|
+
********************************************************/
|
|
258
615
|
const activeSeries = computed(() => props.series?.[0] ?? null);
|
|
259
616
|
const values = computed(() => {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
(d) => typeof d === "number" ? d : d.y
|
|
264
|
-
).filter((v) => Number.isFinite(v));
|
|
617
|
+
const s = activeSeries.value;
|
|
618
|
+
if (!s?.data?.length) return [];
|
|
619
|
+
return s.data.map((d) => typeof d === "number" ? d : d.y).filter((v) => Number.isFinite(v));
|
|
265
620
|
});
|
|
266
621
|
const showEmpty = computed(() => values.value.length === 0);
|
|
622
|
+
/*********************************************************
|
|
623
|
+
* Colour resolution — intent token or raw CSS.
|
|
624
|
+
********************************************************/
|
|
267
625
|
const resolveColor = (raw) => {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
626
|
+
if (isIntent(raw)) return intentBgExpr(raw, "default");
|
|
627
|
+
if (/^(#|rgb|hsl|var|currentColor|transparent)/i.test(raw)) return raw;
|
|
628
|
+
return "currentColor";
|
|
271
629
|
};
|
|
272
630
|
const resolvedColor = computed(() => resolveColor(props.color));
|
|
273
631
|
const MIN_COLOR = "var(--origam-color__feedback--danger---bg, #ef4444)";
|
|
274
632
|
const MAX_COLOR = "var(--origam-color__feedback--success---bg, #22c55e)";
|
|
633
|
+
/*********************************************************
|
|
634
|
+
* Scale helpers — map data values to SVG coordinates.
|
|
635
|
+
********************************************************/
|
|
275
636
|
const plotX0 = PADDING_X;
|
|
276
637
|
const plotX1 = computed(() => svgWidth.value - PADDING_X);
|
|
277
638
|
const plotY0 = PADDING_Y;
|
|
278
639
|
const plotY1 = computed(() => svgHeight.value - PADDING_Y);
|
|
279
640
|
const dataMin = computed(() => {
|
|
280
|
-
|
|
281
|
-
|
|
641
|
+
if (!values.value.length) return 0;
|
|
642
|
+
return Math.min(...values.value);
|
|
282
643
|
});
|
|
283
644
|
const dataMax = computed(() => {
|
|
284
|
-
|
|
285
|
-
|
|
645
|
+
if (!values.value.length) return 1;
|
|
646
|
+
return Math.max(...values.value);
|
|
286
647
|
});
|
|
287
648
|
const scaleX = computed(() => {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
649
|
+
const n = values.value.length;
|
|
650
|
+
if (n < 2) return (_i) => (plotX0 + plotX1.value) / 2;
|
|
651
|
+
return (i) => plotX0 + i / (n - 1) * (plotX1.value - plotX0);
|
|
291
652
|
});
|
|
292
653
|
const scaleY = computed(() => {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
654
|
+
const min = dataMin.value;
|
|
655
|
+
const max = dataMax.value;
|
|
656
|
+
const range = max - min || 1;
|
|
657
|
+
return (v) => plotY1.value - (v - min) / range * (plotY1.value - plotY0);
|
|
297
658
|
});
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
659
|
+
/*********************************************************
|
|
660
|
+
* Point coordinates — array of {cx, cy, index}.
|
|
661
|
+
********************************************************/
|
|
662
|
+
const points = computed(() => values.value.map((v, i) => ({
|
|
663
|
+
cx: scaleX.value(i),
|
|
664
|
+
cy: scaleY.value(v),
|
|
665
|
+
index: i,
|
|
666
|
+
value: v
|
|
667
|
+
})));
|
|
668
|
+
/*********************************************************
|
|
669
|
+
* Line / area paths — built from the point list.
|
|
670
|
+
********************************************************/
|
|
306
671
|
const linePath = computed(() => {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
672
|
+
const pts = points.value;
|
|
673
|
+
if (pts.length < 2) return null;
|
|
674
|
+
const d = pts.map((p, i) => `${i === 0 ? "M" : "L"} ${p.cx} ${p.cy}`).join(" ");
|
|
675
|
+
return d;
|
|
311
676
|
});
|
|
312
677
|
const areaPath = computed(() => {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
678
|
+
const pts = points.value;
|
|
679
|
+
if (pts.length < 2) return null;
|
|
680
|
+
const line = pts.map((p, i) => `${i === 0 ? "M" : "L"} ${p.cx} ${p.cy}`).join(" ");
|
|
681
|
+
const close = `L ${pts[pts.length - 1].cx} ${plotY1.value} L ${pts[0].cx} ${plotY1.value} Z`;
|
|
682
|
+
return `${line} ${close}`;
|
|
318
683
|
});
|
|
684
|
+
/*********************************************************
|
|
685
|
+
* Regular markers — shown when showMarkers is true.
|
|
686
|
+
********************************************************/
|
|
319
687
|
const markerPoints = computed(() => {
|
|
320
|
-
|
|
321
|
-
|
|
688
|
+
if (!props.showMarkers) return [];
|
|
689
|
+
return points.value;
|
|
322
690
|
});
|
|
691
|
+
/*********************************************************
|
|
692
|
+
* Column bars — vertical rectangles for `type === 'column'`.
|
|
693
|
+
********************************************************/
|
|
323
694
|
const columnBars = computed(() => {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
695
|
+
const pts = points.value;
|
|
696
|
+
if (!pts.length) return [];
|
|
697
|
+
const n = pts.length;
|
|
698
|
+
const totalW = plotX1.value - plotX0;
|
|
699
|
+
const barW = Math.max(1, totalW / n * .7);
|
|
700
|
+
const gap = totalW / n;
|
|
701
|
+
const min = dataMin.value;
|
|
702
|
+
const max = dataMax.value;
|
|
703
|
+
const range = max - min || 1;
|
|
704
|
+
return pts.map((p, i) => {
|
|
705
|
+
const barH = Math.max(1, (p.value - min) / range * (plotY1.value - plotY0));
|
|
706
|
+
const x = plotX0 + i * gap + (gap - barW) / 2;
|
|
707
|
+
const y = plotY1.value - barH;
|
|
708
|
+
return {
|
|
709
|
+
index: i,
|
|
710
|
+
x,
|
|
711
|
+
y,
|
|
712
|
+
width: barW,
|
|
713
|
+
height: barH
|
|
714
|
+
};
|
|
715
|
+
});
|
|
339
716
|
});
|
|
717
|
+
/*********************************************************
|
|
718
|
+
* Horizontal bars — for `type === 'bar'`.
|
|
719
|
+
********************************************************/
|
|
340
720
|
const horizontalBars = computed(() => {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
721
|
+
const n = values.value.length;
|
|
722
|
+
if (!n) return [];
|
|
723
|
+
const totalH = plotY1.value - plotY0;
|
|
724
|
+
const barH = Math.max(1, totalH / n * .7);
|
|
725
|
+
const gap = totalH / n;
|
|
726
|
+
const min = dataMin.value;
|
|
727
|
+
const max = dataMax.value;
|
|
728
|
+
const range = max - min || 1;
|
|
729
|
+
return values.value.map((v, i) => {
|
|
730
|
+
const barW = Math.max(1, (v - min) / range * (plotX1.value - plotX0));
|
|
731
|
+
const y = plotY0 + i * gap + (gap - barH) / 2;
|
|
732
|
+
return {
|
|
733
|
+
index: i,
|
|
734
|
+
x: plotX0,
|
|
735
|
+
y,
|
|
736
|
+
width: barW,
|
|
737
|
+
height: barH
|
|
738
|
+
};
|
|
739
|
+
});
|
|
354
740
|
});
|
|
741
|
+
/*********************************************************
|
|
742
|
+
* Special markers — min, max, last.
|
|
743
|
+
********************************************************/
|
|
355
744
|
const minIndex = computed(() => {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
745
|
+
const vs = values.value;
|
|
746
|
+
if (!vs.length) return -1;
|
|
747
|
+
let idx = 0;
|
|
748
|
+
for (let i = 1; i < vs.length; i++) {
|
|
749
|
+
if (vs[i] < vs[idx]) idx = i;
|
|
750
|
+
}
|
|
751
|
+
return idx;
|
|
363
752
|
});
|
|
364
753
|
const maxIndex = computed(() => {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
754
|
+
const vs = values.value;
|
|
755
|
+
if (!vs.length) return -1;
|
|
756
|
+
let idx = 0;
|
|
757
|
+
for (let i = 1; i < vs.length; i++) {
|
|
758
|
+
if (vs[i] > vs[idx]) idx = i;
|
|
759
|
+
}
|
|
760
|
+
return idx;
|
|
372
761
|
});
|
|
373
762
|
const specialMarkers = computed(() => {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
763
|
+
const pts = points.value;
|
|
764
|
+
if (!pts.length) return [];
|
|
765
|
+
const result = [];
|
|
766
|
+
const r = props.markerSize;
|
|
767
|
+
if (props.showMin && minIndex.value >= 0) {
|
|
768
|
+
const p = pts[minIndex.value];
|
|
769
|
+
result.push({
|
|
770
|
+
cx: p.cx,
|
|
771
|
+
cy: p.cy,
|
|
772
|
+
r,
|
|
773
|
+
fill: MIN_COLOR,
|
|
774
|
+
role: "min",
|
|
775
|
+
dataIndex: minIndex.value
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
if (props.showMax && maxIndex.value >= 0) {
|
|
779
|
+
const p = pts[maxIndex.value];
|
|
780
|
+
result.push({
|
|
781
|
+
cx: p.cx,
|
|
782
|
+
cy: p.cy,
|
|
783
|
+
r,
|
|
784
|
+
fill: MAX_COLOR,
|
|
785
|
+
role: "max",
|
|
786
|
+
dataIndex: maxIndex.value
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
if (props.showLast && pts.length > 0) {
|
|
790
|
+
const last = pts[pts.length - 1];
|
|
791
|
+
const lastIdx = pts.length - 1;
|
|
792
|
+
const alreadyMarked = result.some((m) => m.dataIndex === lastIdx);
|
|
793
|
+
if (!alreadyMarked) {
|
|
794
|
+
result.push({
|
|
795
|
+
cx: last.cx,
|
|
796
|
+
cy: last.cy,
|
|
797
|
+
r,
|
|
798
|
+
fill: resolvedColor.value,
|
|
799
|
+
role: "last",
|
|
800
|
+
dataIndex: lastIdx
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
return result;
|
|
805
|
+
});
|
|
806
|
+
/*********************************************************
|
|
807
|
+
* Tooltip hover state.
|
|
808
|
+
********************************************************/
|
|
809
|
+
const mousePos = ref({
|
|
810
|
+
x: 0,
|
|
811
|
+
y: 0
|
|
395
812
|
});
|
|
396
|
-
const mousePos = ref({ x: 0, y: 0 });
|
|
397
813
|
const hoveredIndex = ref(null);
|
|
398
814
|
const pointAt = (index) => {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
815
|
+
if (!activeSeries.value) return null;
|
|
816
|
+
const v = values.value[index];
|
|
817
|
+
if (v === undefined) return null;
|
|
818
|
+
return {
|
|
819
|
+
seriesIndex: 0,
|
|
820
|
+
seriesName: activeSeries.value.name,
|
|
821
|
+
dataIndex: index,
|
|
822
|
+
x: index,
|
|
823
|
+
y: v,
|
|
824
|
+
color: resolvedColor.value
|
|
825
|
+
};
|
|
410
826
|
};
|
|
411
827
|
const tooltipPoint = computed(() => {
|
|
412
|
-
|
|
413
|
-
|
|
828
|
+
if (hoveredIndex.value === null) return null;
|
|
829
|
+
return pointAt(hoveredIndex.value);
|
|
414
830
|
});
|
|
415
831
|
const tooltipStyle = computed(() => ({
|
|
416
|
-
|
|
417
|
-
|
|
832
|
+
left: `${mousePos.value.x + 8}px`,
|
|
833
|
+
top: `${mousePos.value.y - 28}px`
|
|
418
834
|
}));
|
|
835
|
+
/*********************************************************
|
|
836
|
+
* nearestIndexFromEvent
|
|
837
|
+
*
|
|
838
|
+
* @description
|
|
839
|
+
* Nearest data-point index for a mouse position on the SVG — shared
|
|
840
|
+
* by hover (tooltip) and click (`point-click`) so both agree on
|
|
841
|
+
* which point the pointer is over.
|
|
842
|
+
********************************************************/
|
|
419
843
|
const nearestIndexFromEvent = (event) => {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
844
|
+
const target = svgRef.value;
|
|
845
|
+
if (!target) return null;
|
|
846
|
+
const n = values.value.length;
|
|
847
|
+
if (!n) return null;
|
|
848
|
+
const rect = target.getBoundingClientRect();
|
|
849
|
+
const relX = event.clientX - rect.left;
|
|
850
|
+
const ratio = relX / rect.width;
|
|
851
|
+
return Math.min(n - 1, Math.max(0, Math.round(ratio * (n - 1))));
|
|
428
852
|
};
|
|
429
853
|
const onSvgMouseMove = (event) => {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
854
|
+
if (!props.showTooltip) return;
|
|
855
|
+
const target = svgRef.value;
|
|
856
|
+
if (!target) return;
|
|
857
|
+
const rect = target.getBoundingClientRect();
|
|
858
|
+
mousePos.value = {
|
|
859
|
+
x: event.clientX - rect.left,
|
|
860
|
+
y: event.clientY - rect.top
|
|
861
|
+
};
|
|
862
|
+
hoveredIndex.value = nearestIndexFromEvent(event);
|
|
436
863
|
};
|
|
437
864
|
const onSvgMouseLeave = () => {
|
|
438
|
-
|
|
865
|
+
hoveredIndex.value = null;
|
|
439
866
|
};
|
|
867
|
+
/*********************************************************
|
|
868
|
+
* `point-click` — mouse / keyboard activation on a data point.
|
|
869
|
+
* Individually-rendered marks (markers, special min/max/last,
|
|
870
|
+
* bars) carry their own click/keydown handlers (see template);
|
|
871
|
+
* clicking anywhere else on the SVG falls back to the nearest
|
|
872
|
+
* point, so `line`/`area` sparklines without visible markers stay
|
|
873
|
+
* clickable too.
|
|
874
|
+
********************************************************/
|
|
440
875
|
const onPointClick = (index, event) => {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
876
|
+
const point = pointAt(index);
|
|
877
|
+
if (!point) return;
|
|
878
|
+
emit("point-click", point, event);
|
|
444
879
|
};
|
|
445
880
|
const onSvgClick = (event) => {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
881
|
+
const idx = nearestIndexFromEvent(event);
|
|
882
|
+
if (idx === null) return;
|
|
883
|
+
onPointClick(idx, event);
|
|
449
884
|
};
|
|
885
|
+
/*********************************************************
|
|
886
|
+
* pointAriaLabel
|
|
887
|
+
*
|
|
888
|
+
* @description
|
|
889
|
+
* ⛔ issue #781 — the accessible name of each `role="button"` mark.
|
|
890
|
+
* `IChartSeries.name` is typed `string`, but nothing enforces it at
|
|
891
|
+
* RUNTIME: a JavaScript consumer omitting it, or passing `''`, produced
|
|
892
|
+
* a label starting on a dangling separator — measured on `develop`,
|
|
893
|
+
* `aria-label=", 0: 1"`, read aloud as "comma zero colon one, button".
|
|
894
|
+
* The mark stayed focusable and operable, so this is a name-quality
|
|
895
|
+
* defect, not the unnameable-role defect of #747 / #660 / #653: index
|
|
896
|
+
* and value are ALWAYS available here, so the DS can always name these
|
|
897
|
+
* marks. It just has to stop emitting the separator of an absent part.
|
|
898
|
+
********************************************************/
|
|
450
899
|
const pointAriaLabel = (index) => {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
900
|
+
const point = pointAt(index);
|
|
901
|
+
if (!point) return "";
|
|
902
|
+
const seriesName = point.seriesName?.trim();
|
|
903
|
+
const value = `${index}: ${point.y}`;
|
|
904
|
+
return seriesName ? `${seriesName}, ${value}` : value;
|
|
456
905
|
};
|
|
906
|
+
/*********************************************************
|
|
907
|
+
* Root classes / styles.
|
|
908
|
+
********************************************************/
|
|
457
909
|
const rootClasses = computed(() => [
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
910
|
+
{
|
|
911
|
+
[`origam-chart-sparkline--${props.type}`]: true,
|
|
912
|
+
"origam-chart-sparkline--empty": showEmpty.value
|
|
913
|
+
},
|
|
914
|
+
backgroundColorClasses.value,
|
|
915
|
+
elevationClasses.value,
|
|
916
|
+
marginClasses.value,
|
|
917
|
+
paddingClasses.value,
|
|
918
|
+
roundedClasses.value,
|
|
919
|
+
props.class
|
|
468
920
|
]);
|
|
469
921
|
const { dimensionStyles } = useDimension(props);
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
);
|
|
482
|
-
useUnsupportedProp(
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
"fontWeight",
|
|
503
|
-
"a sparkline renders no text at all.",
|
|
504
|
-
() => props.fontWeight !== void 0
|
|
505
|
-
);
|
|
506
|
-
useUnsupportedProp(
|
|
507
|
-
"OrigamChartSparkline",
|
|
508
|
-
"subtitle",
|
|
509
|
-
"a sparkline renders no header \u2014 neither title nor subtitle.",
|
|
510
|
-
() => props.subtitle !== void 0
|
|
511
|
-
);
|
|
922
|
+
/*********************************************************
|
|
923
|
+
* Props heritees sans effet ici (#426)
|
|
924
|
+
*
|
|
925
|
+
* @description
|
|
926
|
+
* ⛔ Ces props sont declarees par `IChartBaseProps` et n'ont aucun
|
|
927
|
+
* effet sur ce composant. Elles ne sont ni retirees ni cablees a un
|
|
928
|
+
* comportement fictif : elles avertissent une fois, en dev, avec la
|
|
929
|
+
* raison exacte. Meme traitement que `OrigamChartGauge`.
|
|
930
|
+
********************************************************/
|
|
931
|
+
useUnsupportedProp("OrigamChartSparkline", "categories", "a sparkline is a bare trend line: it draws no axis and no labels.", () => props.categories !== undefined);
|
|
932
|
+
useUnsupportedProp("OrigamChartSparkline", "animated", "no animation is ever emitted — neither a CSS class nor an inline `animation` declaration.", () => props.animated === true);
|
|
933
|
+
useUnsupportedProp("OrigamChartSparkline", "animationDuration", "nothing is animated, so there is no duration to apply.", () => props.animationDuration !== undefined && props.animationDuration !== 600);
|
|
934
|
+
useUnsupportedProp("OrigamChartSparkline", "aspectRatio", "the root sizes itself from `width` / `height`; no `aspect-ratio` declaration is emitted.", () => props.aspectRatio !== undefined);
|
|
935
|
+
useUnsupportedProp("OrigamChartSparkline", "fontSize", "a sparkline renders no text at all.", () => props.fontSize !== undefined);
|
|
936
|
+
useUnsupportedProp("OrigamChartSparkline", "fontWeight", "a sparkline renders no text at all.", () => props.fontWeight !== undefined);
|
|
937
|
+
useUnsupportedProp("OrigamChartSparkline", "subtitle", "a sparkline renders no header — neither title nor subtitle.", () => props.subtitle !== undefined);
|
|
938
|
+
/*********************************************************
|
|
939
|
+
* rootStyles
|
|
940
|
+
*
|
|
941
|
+
* @description
|
|
942
|
+
* ⛔ Ce bloc convertissait `width` / `height` a la main — et ignorait les
|
|
943
|
+
* cinq autres props de dimension qu'`IDimensionProps` declare. Un
|
|
944
|
+
* consommateur passant `maxHeight` ne voyait rien se produire, sans
|
|
945
|
+
* avertissement : la « half-implemented surface » que le CLAUDE.md du
|
|
946
|
+
* projet decrit nommement.
|
|
947
|
+
*
|
|
948
|
+
* @description
|
|
949
|
+
* `useDimension` couvre les sept, et son `convertToUnit` gere des cas
|
|
950
|
+
* qu'un convertisseur maison finit toujours par manquer : nombres,
|
|
951
|
+
* longueurs CSS, references a une propriete personnalisee, raccourcis
|
|
952
|
+
* d'`aspect-ratio`.
|
|
953
|
+
********************************************************/
|
|
512
954
|
const rootStyles = computed(() => [
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
955
|
+
dimensionStyles.value,
|
|
956
|
+
{ display: "inline-block" },
|
|
957
|
+
props.style
|
|
516
958
|
]);
|
|
959
|
+
/*********************************************************
|
|
960
|
+
* ARIA.
|
|
961
|
+
********************************************************/
|
|
517
962
|
const defaultAriaLabel = computed(() => t(`origam.chart.sparkline.aria_label_${props.type}`));
|
|
518
963
|
const ariaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
519
964
|
const svgAriaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
520
965
|
const svgTitle = computed(() => props.title ?? defaultAriaLabel.value);
|
|
521
|
-
const svgDesc = computed(
|
|
522
|
-
() => t("origam.chart.sparkline.desc", values.value.length, { chart: defaultAriaLabel.value })
|
|
523
|
-
);
|
|
966
|
+
const svgDesc = computed(() => t("origam.chart.sparkline.desc", values.value.length, { chart: defaultAriaLabel.value }));
|
|
524
967
|
</script>
|
|
525
968
|
|
|
526
969
|
<style lang="scss" scoped>
|