@expcat/tigercat-vue 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-24F6NL3G.js +462 -0
- package/dist/{chunk-LIZZ35NQ.mjs → chunk-25P4HFCO.mjs} +13 -4
- package/dist/chunk-264DR3I2.mjs +122 -0
- package/dist/{chunk-6IXWIYWS.mjs → chunk-2EMI5OHM.mjs} +16 -4
- package/dist/chunk-2ZUEXCVJ.mjs +53 -0
- package/dist/{chunk-EQX22NAR.js → chunk-54VVFMYI.js} +10 -1
- package/dist/chunk-57MJTNDL.js +123 -0
- package/dist/{chunk-464XWWNR.mjs → chunk-5CGS2CPE.mjs} +1 -1
- package/dist/chunk-5PXTMXXS.js +152 -0
- package/dist/chunk-5WHLXWWT.mjs +68 -0
- package/dist/{chunk-PDRPZ3SX.js → chunk-5XW532JA.js} +16 -34
- package/dist/chunk-6AZFL3WJ.js +526 -0
- package/dist/{chunk-4R45JF3W.js → chunk-6SC33HJA.js} +16 -4
- package/dist/{chunk-OVXJFNLE.mjs → chunk-7WLOYIVN.mjs} +7 -7
- package/dist/{chunk-ZW36GTA3.js → chunk-AK3SVOJA.js} +68 -24
- package/dist/{chunk-SMCWBSUR.mjs → chunk-BCMEJAC7.mjs} +16 -34
- package/dist/chunk-BKTQ6RWR.js +106 -0
- package/dist/chunk-BPXVB37Q.js +356 -0
- package/dist/{chunk-XKTQJXVN.js → chunk-BR7FIC54.js} +15 -30
- package/dist/chunk-CU4M5ABS.mjs +114 -0
- package/dist/{chunk-5K74VD2K.js → chunk-D45QLF65.js} +76 -41
- package/dist/{chunk-2TX7EINR.mjs → chunk-D6ONLPQP.mjs} +1 -1
- package/dist/chunk-DPWYCNNS.mjs +295 -0
- package/dist/{chunk-7ZEFGIDX.js → chunk-ENPZERP2.js} +2 -2
- package/dist/chunk-EPE6OOV7.js +94 -0
- package/dist/chunk-ESRO3KM3.mjs +513 -0
- package/dist/chunk-F5HOHSFH.mjs +103 -0
- package/dist/{chunk-RNZZQWX7.js → chunk-FA2BQGLO.js} +8 -14
- package/dist/chunk-FCV4ML6I.js +71 -0
- package/dist/{chunk-SZA7QYD2.js → chunk-FJ2ZZHIW.js} +11 -23
- package/dist/chunk-FNWCU7HI.mjs +364 -0
- package/dist/chunk-FXGIIFGN.mjs +91 -0
- package/dist/chunk-GLI2DEV3.js +367 -0
- package/dist/{chunk-Q3JTXSIR.mjs → chunk-H6CUKJYY.mjs} +36 -10
- package/dist/chunk-HBFFINAI.js +56 -0
- package/dist/{chunk-EE3KTSR6.js → chunk-IE57VDN4.js} +4 -4
- package/dist/chunk-IVTBNUKQ.js +118 -0
- package/dist/chunk-IXFEBW6I.mjs +353 -0
- package/dist/{chunk-AHH2SBO4.mjs → chunk-J7OYLV6I.mjs} +88 -40
- package/dist/{chunk-BJNHG4Z4.mjs → chunk-JBSSXJZ2.mjs} +15 -30
- package/dist/chunk-JFZDIY7D.js +124 -0
- package/dist/{chunk-5GWL2UTZ.js → chunk-K6NKVCEO.js} +1 -2
- package/dist/{chunk-ZIG34M2R.js → chunk-L44HKVK5.js} +2 -2
- package/dist/{chunk-AQ2G46JA.mjs → chunk-LLSZZ6HH.mjs} +21 -13
- package/dist/chunk-MBJYTGF3.mjs +459 -0
- package/dist/chunk-MI6TL3CQ.mjs +120 -0
- package/dist/{chunk-W7YFSJ3Z.mjs → chunk-NF7ADPEN.mjs} +12 -24
- package/dist/{chunk-K7JDJXM5.mjs → chunk-PQQUAUFM.mjs} +2 -3
- package/dist/{chunk-JLHOX3YI.js → chunk-PVQV32JZ.js} +16 -40
- package/dist/{chunk-X27KNXVN.mjs → chunk-QZNLP67Y.mjs} +70 -26
- package/dist/{chunk-YIRWZYD3.js → chunk-R2DKSTP4.js} +2 -2
- package/dist/{chunk-Z4KMMJFD.mjs → chunk-R3YK5LUH.mjs} +77 -42
- package/dist/{chunk-YXXOKLEC.js → chunk-RBZ7ADKL.js} +12 -3
- package/dist/chunk-RMXQXTKG.js +516 -0
- package/dist/{chunk-4LGW73OD.js → chunk-RN25EUD2.js} +37 -11
- package/dist/chunk-U6JCAP2C.js +188 -0
- package/dist/{chunk-LW4Y2WHI.mjs → chunk-UAMYOMEU.mjs} +1 -1
- package/dist/{chunk-JI5MFFKJ.js → chunk-UF5MJ52T.js} +19 -11
- package/dist/{chunk-CFS7HBMY.mjs → chunk-V2F7IOSD.mjs} +9 -15
- package/dist/{chunk-YMXAQ35E.mjs → chunk-VL7GENWD.mjs} +11 -2
- package/dist/{chunk-6U2T3W7T.mjs → chunk-VP4ZSIY3.mjs} +5 -5
- package/dist/chunk-W2CCYPSO.mjs +185 -0
- package/dist/{chunk-7PCCJR4X.js → chunk-WH6OTVYF.js} +86 -38
- package/dist/{chunk-NFOFNZ5O.mjs → chunk-XZTN4VFO.mjs} +17 -41
- package/dist/chunk-Y4QBDL7S.mjs +523 -0
- package/dist/{chunk-Y7DJJOCW.js → chunk-Y4W6MMYO.js} +6 -6
- package/dist/chunk-ZFDUZQML.js +298 -0
- package/dist/chunk-ZWVA7HT3.mjs +149 -0
- package/dist/components/Alert.d.mts +4 -4
- package/dist/components/Alert.d.ts +4 -4
- package/dist/components/AreaChart.d.mts +398 -0
- package/dist/components/AreaChart.d.ts +398 -0
- package/dist/components/AreaChart.js +23 -0
- package/dist/components/AreaChart.mjs +8 -0
- package/dist/components/Badge.d.mts +2 -2
- package/dist/components/Badge.d.ts +2 -2
- package/dist/components/BarChart.d.mts +343 -0
- package/dist/components/BarChart.d.ts +343 -0
- package/dist/components/BarChart.js +23 -0
- package/dist/components/BarChart.mjs +8 -0
- package/dist/components/Button.d.mts +2 -2
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Card.d.mts +1 -1
- package/dist/components/Card.d.ts +1 -1
- package/dist/components/ChartAxis.d.mts +110 -0
- package/dist/components/ChartAxis.d.ts +110 -0
- package/dist/components/ChartAxis.js +16 -0
- package/dist/components/ChartAxis.mjs +1 -0
- package/dist/components/ChartCanvas.d.mts +60 -0
- package/dist/components/ChartCanvas.d.ts +60 -0
- package/dist/components/ChartCanvas.js +16 -0
- package/dist/components/ChartCanvas.mjs +1 -0
- package/dist/components/ChartGrid.d.mts +109 -0
- package/dist/components/ChartGrid.d.ts +109 -0
- package/dist/components/ChartGrid.js +16 -0
- package/dist/components/ChartGrid.mjs +1 -0
- package/dist/components/ChartLegend.d.mts +74 -0
- package/dist/components/ChartLegend.d.ts +74 -0
- package/dist/components/ChartLegend.js +16 -0
- package/dist/components/ChartLegend.mjs +1 -0
- package/dist/components/ChartSeries.d.mts +52 -0
- package/dist/components/ChartSeries.d.ts +52 -0
- package/dist/components/ChartSeries.js +16 -0
- package/dist/components/ChartSeries.mjs +1 -0
- package/dist/components/ChartTooltip.d.mts +58 -0
- package/dist/components/ChartTooltip.d.ts +58 -0
- package/dist/components/ChartTooltip.js +16 -0
- package/dist/components/ChartTooltip.mjs +1 -0
- package/dist/components/Container.d.mts +18 -1
- package/dist/components/Container.d.ts +18 -1
- package/dist/components/Container.js +3 -3
- package/dist/components/Container.mjs +1 -1
- package/dist/components/DatePicker.d.mts +1 -1
- package/dist/components/DatePicker.d.ts +1 -1
- package/dist/components/DonutChart.d.mts +248 -0
- package/dist/components/DonutChart.d.ts +248 -0
- package/dist/components/DonutChart.js +22 -0
- package/dist/components/DonutChart.mjs +7 -0
- package/dist/components/Drawer.d.mts +3 -3
- package/dist/components/Drawer.d.ts +3 -3
- package/dist/components/Drawer.js +4 -4
- package/dist/components/Drawer.mjs +2 -2
- package/dist/components/Dropdown.d.mts +35 -8
- package/dist/components/Dropdown.d.ts +35 -8
- package/dist/components/Dropdown.js +5 -4
- package/dist/components/Dropdown.mjs +2 -1
- package/dist/components/DropdownItem.d.mts +1 -1
- package/dist/components/DropdownItem.d.ts +1 -1
- package/dist/components/DropdownItem.js +5 -4
- package/dist/components/DropdownItem.mjs +3 -2
- package/dist/components/Icon.js +3 -3
- package/dist/components/Icon.mjs +1 -1
- package/dist/components/LineChart.d.mts +380 -0
- package/dist/components/LineChart.d.ts +380 -0
- package/dist/components/LineChart.js +23 -0
- package/dist/components/LineChart.mjs +8 -0
- package/dist/components/Link.d.mts +1 -1
- package/dist/components/Link.d.ts +1 -1
- package/dist/components/List.d.mts +3 -3
- package/dist/components/List.d.ts +3 -3
- package/dist/components/List.js +3 -3
- package/dist/components/List.mjs +1 -1
- package/dist/components/Loading.d.mts +1 -1
- package/dist/components/Loading.d.ts +1 -1
- package/dist/components/Menu.d.mts +1 -1
- package/dist/components/Menu.d.ts +1 -1
- package/dist/components/MenuItem.d.mts +1 -1
- package/dist/components/MenuItem.d.ts +1 -1
- package/dist/components/Modal.d.mts +3 -3
- package/dist/components/Modal.d.ts +3 -3
- package/dist/components/Modal.js +3 -3
- package/dist/components/Modal.mjs +1 -1
- package/dist/components/Pagination.d.mts +21 -2
- package/dist/components/Pagination.d.ts +21 -2
- package/dist/components/Pagination.js +3 -3
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/PieChart.d.mts +242 -0
- package/dist/components/PieChart.d.ts +242 -0
- package/dist/components/PieChart.js +21 -0
- package/dist/components/PieChart.mjs +6 -0
- package/dist/components/Popconfirm.d.mts +26 -9
- package/dist/components/Popconfirm.d.ts +26 -9
- package/dist/components/Popconfirm.js +4 -3
- package/dist/components/Popconfirm.mjs +2 -1
- package/dist/components/Popover.d.mts +24 -7
- package/dist/components/Popover.d.ts +24 -7
- package/dist/components/Popover.js +4 -4
- package/dist/components/Popover.mjs +2 -2
- package/dist/components/Progress.d.mts +2 -2
- package/dist/components/Progress.d.ts +2 -2
- package/dist/components/RadarChart.d.mts +364 -0
- package/dist/components/RadarChart.d.ts +364 -0
- package/dist/components/RadarChart.js +20 -0
- package/dist/components/RadarChart.mjs +5 -0
- package/dist/components/ScatterChart.d.mts +346 -0
- package/dist/components/ScatterChart.d.ts +346 -0
- package/dist/components/ScatterChart.js +23 -0
- package/dist/components/ScatterChart.mjs +8 -0
- package/dist/components/Select.js +3 -3
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Skeleton.d.mts +1 -1
- package/dist/components/Skeleton.d.ts +1 -1
- package/dist/components/Slider.d.mts +1 -1
- package/dist/components/Slider.d.ts +1 -1
- package/dist/components/Slider.js +3 -3
- package/dist/components/Slider.mjs +1 -1
- package/dist/components/Space.js +3 -3
- package/dist/components/Space.mjs +1 -1
- package/dist/components/Steps.js +4 -4
- package/dist/components/Steps.mjs +1 -1
- package/dist/components/StepsItem.d.mts +2 -2
- package/dist/components/StepsItem.d.ts +2 -2
- package/dist/components/StepsItem.js +4 -4
- package/dist/components/StepsItem.mjs +2 -2
- package/dist/components/SubMenu.d.mts +1 -1
- package/dist/components/SubMenu.d.ts +1 -1
- package/dist/components/TabPane.d.mts +2 -2
- package/dist/components/TabPane.d.ts +2 -2
- package/dist/components/TabPane.js +4 -4
- package/dist/components/TabPane.mjs +2 -2
- package/dist/components/Table.d.mts +1 -1
- package/dist/components/Table.d.ts +1 -1
- package/dist/components/Table.js +3 -3
- package/dist/components/Table.mjs +1 -1
- package/dist/components/Tabs.d.mts +2 -2
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +4 -4
- package/dist/components/Tabs.mjs +1 -1
- package/dist/components/Tag.d.mts +2 -2
- package/dist/components/Tag.d.ts +2 -2
- package/dist/components/TimePicker.d.mts +2 -2
- package/dist/components/TimePicker.d.ts +2 -2
- package/dist/components/Timeline.d.mts +2 -2
- package/dist/components/Timeline.d.ts +2 -2
- package/dist/components/Tooltip.d.mts +24 -7
- package/dist/components/Tooltip.d.ts +24 -7
- package/dist/components/Tooltip.js +4 -3
- package/dist/components/Tooltip.mjs +2 -1
- package/dist/components/Tree.d.mts +1 -1
- package/dist/components/Tree.d.ts +1 -1
- package/dist/components/Upload.d.mts +2 -2
- package/dist/components/Upload.d.ts +2 -2
- package/dist/index.d.mts +96 -2
- package/dist/index.d.ts +96 -2
- package/dist/index.js +170 -100
- package/dist/index.mjs +43 -29
- package/package.json +2 -2
- package/dist/chunk-FIPIHUJQ.mjs +0 -42
- package/dist/chunk-UTHNPU5T.js +0 -45
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkJFZDIY7D_js = require('./chunk-JFZDIY7D.js');
|
|
4
|
+
var chunk5PXTMXXS_js = require('./chunk-5PXTMXXS.js');
|
|
5
|
+
var chunkFCV4ML6I_js = require('./chunk-FCV4ML6I.js');
|
|
6
|
+
var chunk57MJTNDL_js = require('./chunk-57MJTNDL.js');
|
|
7
|
+
var chunkBKTQ6RWR_js = require('./chunk-BKTQ6RWR.js');
|
|
8
|
+
var chunkHBFFINAI_js = require('./chunk-HBFFINAI.js');
|
|
9
|
+
var chunkEPE6OOV7_js = require('./chunk-EPE6OOV7.js');
|
|
10
|
+
var vue = require('vue');
|
|
11
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
12
|
+
|
|
13
|
+
var LineChart = vue.defineComponent({
|
|
14
|
+
name: "TigerLineChart",
|
|
15
|
+
props: {
|
|
16
|
+
width: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 320
|
|
19
|
+
},
|
|
20
|
+
height: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 200
|
|
23
|
+
},
|
|
24
|
+
padding: {
|
|
25
|
+
type: [Number, Object],
|
|
26
|
+
default: 24
|
|
27
|
+
},
|
|
28
|
+
data: {
|
|
29
|
+
type: Array
|
|
30
|
+
},
|
|
31
|
+
series: {
|
|
32
|
+
type: Array
|
|
33
|
+
},
|
|
34
|
+
xScale: {
|
|
35
|
+
type: Object
|
|
36
|
+
},
|
|
37
|
+
yScale: {
|
|
38
|
+
type: Object
|
|
39
|
+
},
|
|
40
|
+
lineColor: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "var(--tiger-primary,#2563eb)"
|
|
43
|
+
},
|
|
44
|
+
strokeWidth: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 2
|
|
47
|
+
},
|
|
48
|
+
curve: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "linear"
|
|
51
|
+
},
|
|
52
|
+
showPoints: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: true
|
|
55
|
+
},
|
|
56
|
+
pointSize: {
|
|
57
|
+
type: Number,
|
|
58
|
+
default: 4
|
|
59
|
+
},
|
|
60
|
+
pointColor: {
|
|
61
|
+
type: String
|
|
62
|
+
},
|
|
63
|
+
showGrid: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: true
|
|
66
|
+
},
|
|
67
|
+
showAxis: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: true
|
|
70
|
+
},
|
|
71
|
+
showXAxis: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: true
|
|
74
|
+
},
|
|
75
|
+
showYAxis: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true
|
|
78
|
+
},
|
|
79
|
+
includeZero: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false
|
|
82
|
+
},
|
|
83
|
+
xAxisLabel: {
|
|
84
|
+
type: String
|
|
85
|
+
},
|
|
86
|
+
yAxisLabel: {
|
|
87
|
+
type: String
|
|
88
|
+
},
|
|
89
|
+
xTicks: {
|
|
90
|
+
type: Number,
|
|
91
|
+
default: 5
|
|
92
|
+
},
|
|
93
|
+
yTicks: {
|
|
94
|
+
type: Number,
|
|
95
|
+
default: 5
|
|
96
|
+
},
|
|
97
|
+
xTickValues: {
|
|
98
|
+
type: Array
|
|
99
|
+
},
|
|
100
|
+
yTickValues: {
|
|
101
|
+
type: Array
|
|
102
|
+
},
|
|
103
|
+
xTickFormat: {
|
|
104
|
+
type: Function
|
|
105
|
+
},
|
|
106
|
+
yTickFormat: {
|
|
107
|
+
type: Function
|
|
108
|
+
},
|
|
109
|
+
gridLineStyle: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: "solid"
|
|
112
|
+
},
|
|
113
|
+
gridStrokeWidth: {
|
|
114
|
+
type: Number,
|
|
115
|
+
default: 1
|
|
116
|
+
},
|
|
117
|
+
colors: {
|
|
118
|
+
type: Array
|
|
119
|
+
},
|
|
120
|
+
// Interaction props
|
|
121
|
+
hoverable: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: false
|
|
124
|
+
},
|
|
125
|
+
hoveredIndex: {
|
|
126
|
+
type: Number,
|
|
127
|
+
default: void 0
|
|
128
|
+
},
|
|
129
|
+
activeOpacity: {
|
|
130
|
+
type: Number,
|
|
131
|
+
default: 1
|
|
132
|
+
},
|
|
133
|
+
inactiveOpacity: {
|
|
134
|
+
type: Number,
|
|
135
|
+
default: 0.25
|
|
136
|
+
},
|
|
137
|
+
selectable: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: false
|
|
140
|
+
},
|
|
141
|
+
selectedIndex: {
|
|
142
|
+
type: Number,
|
|
143
|
+
default: void 0
|
|
144
|
+
},
|
|
145
|
+
// Legend props
|
|
146
|
+
showLegend: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false
|
|
149
|
+
},
|
|
150
|
+
legendPosition: {
|
|
151
|
+
type: String,
|
|
152
|
+
default: "bottom"
|
|
153
|
+
},
|
|
154
|
+
legendMarkerSize: {
|
|
155
|
+
type: Number,
|
|
156
|
+
default: 10
|
|
157
|
+
},
|
|
158
|
+
legendGap: {
|
|
159
|
+
type: Number,
|
|
160
|
+
default: 8
|
|
161
|
+
},
|
|
162
|
+
// Tooltip props
|
|
163
|
+
showTooltip: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
default: true
|
|
166
|
+
},
|
|
167
|
+
tooltipFormatter: {
|
|
168
|
+
type: Function
|
|
169
|
+
},
|
|
170
|
+
legendFormatter: {
|
|
171
|
+
type: Function
|
|
172
|
+
},
|
|
173
|
+
// Accessibility
|
|
174
|
+
title: {
|
|
175
|
+
type: String
|
|
176
|
+
},
|
|
177
|
+
desc: {
|
|
178
|
+
type: String
|
|
179
|
+
},
|
|
180
|
+
className: {
|
|
181
|
+
type: String
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
emits: [
|
|
185
|
+
"update:hoveredIndex",
|
|
186
|
+
"update:selectedIndex",
|
|
187
|
+
"series-click",
|
|
188
|
+
"series-hover",
|
|
189
|
+
"point-click",
|
|
190
|
+
"point-hover"
|
|
191
|
+
],
|
|
192
|
+
setup(props, { emit }) {
|
|
193
|
+
const hoveredPointInfo = vue.ref(null);
|
|
194
|
+
const tooltipPosition = vue.ref({ x: 0, y: 0 });
|
|
195
|
+
const innerRect = vue.computed(() => tigercatCore.getChartInnerRect(props.width, props.height, props.padding));
|
|
196
|
+
const resolvedSeries = vue.computed(() => {
|
|
197
|
+
if (props.series && props.series.length > 0) return props.series;
|
|
198
|
+
if (props.data && props.data.length > 0) return [{ data: props.data }];
|
|
199
|
+
return [];
|
|
200
|
+
});
|
|
201
|
+
const {
|
|
202
|
+
activeIndex,
|
|
203
|
+
handleMouseEnter: handleSeriesHoverEnter,
|
|
204
|
+
handleMouseLeave: handleSeriesHoverLeave,
|
|
205
|
+
handleClick: handleSeriesSelect,
|
|
206
|
+
handleLegendClick,
|
|
207
|
+
handleLegendHover,
|
|
208
|
+
handleLegendLeave,
|
|
209
|
+
wrapperClasses
|
|
210
|
+
} = chunkJFZDIY7D_js.useChartInteraction({
|
|
211
|
+
hoverable: vue.computed(() => props.hoverable),
|
|
212
|
+
hoveredIndexProp: props.hoveredIndex,
|
|
213
|
+
selectable: vue.computed(() => props.selectable),
|
|
214
|
+
selectedIndexProp: props.selectedIndex,
|
|
215
|
+
activeOpacity: vue.computed(() => props.activeOpacity),
|
|
216
|
+
inactiveOpacity: vue.computed(() => props.inactiveOpacity),
|
|
217
|
+
legendPosition: vue.computed(() => props.legendPosition),
|
|
218
|
+
emit,
|
|
219
|
+
getData: (index) => resolvedSeries.value[index],
|
|
220
|
+
eventNames: {
|
|
221
|
+
hover: "series-hover",
|
|
222
|
+
click: "series-click"
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
const allData = vue.computed(() => resolvedSeries.value.flatMap((s) => s.data));
|
|
226
|
+
const xValues = vue.computed(() => allData.value.map((d) => d.x));
|
|
227
|
+
const yValues = vue.computed(() => allData.value.map((d) => d.y));
|
|
228
|
+
const isXNumeric = vue.computed(() => xValues.value.every((v) => typeof v === "number"));
|
|
229
|
+
const resolvedXScale = vue.computed(() => {
|
|
230
|
+
if (props.xScale) return props.xScale;
|
|
231
|
+
if (isXNumeric.value) {
|
|
232
|
+
const extent = tigercatCore.getNumberExtent(xValues.value, { includeZero: false });
|
|
233
|
+
return tigercatCore.createLinearScale(extent, [0, innerRect.value.width]);
|
|
234
|
+
} else {
|
|
235
|
+
const categories = [...new Set(xValues.value.map(String))];
|
|
236
|
+
return tigercatCore.createPointScale(categories, [0, innerRect.value.width], { padding: 0.1 });
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
const resolvedYScale = vue.computed(() => {
|
|
240
|
+
if (props.yScale) return props.yScale;
|
|
241
|
+
const extent = tigercatCore.getNumberExtent(yValues.value, { includeZero: props.includeZero });
|
|
242
|
+
return tigercatCore.createLinearScale(extent, [innerRect.value.height, 0]);
|
|
243
|
+
});
|
|
244
|
+
const showXAxis = vue.computed(() => props.showAxis && props.showXAxis);
|
|
245
|
+
const showYAxis = vue.computed(() => props.showAxis && props.showYAxis);
|
|
246
|
+
const palette = vue.computed(
|
|
247
|
+
() => props.colors && props.colors.length > 0 ? props.colors : [...tigercatCore.DEFAULT_CHART_COLORS]
|
|
248
|
+
);
|
|
249
|
+
const seriesData = vue.computed(
|
|
250
|
+
() => resolvedSeries.value.map((series, seriesIndex) => {
|
|
251
|
+
const color = series.color ?? palette.value[seriesIndex % palette.value.length];
|
|
252
|
+
const points = series.data.map((datum, pointIndex) => ({
|
|
253
|
+
x: resolvedXScale.value.map(datum.x),
|
|
254
|
+
y: resolvedYScale.value.map(datum.y),
|
|
255
|
+
datum,
|
|
256
|
+
pointIndex
|
|
257
|
+
}));
|
|
258
|
+
const linePath = tigercatCore.createLinePath(points, props.curve);
|
|
259
|
+
const opacity = tigercatCore.getChartElementOpacity(seriesIndex, activeIndex.value, {
|
|
260
|
+
activeOpacity: props.activeOpacity,
|
|
261
|
+
inactiveOpacity: props.inactiveOpacity
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
series,
|
|
265
|
+
seriesIndex,
|
|
266
|
+
color,
|
|
267
|
+
linePath,
|
|
268
|
+
points,
|
|
269
|
+
opacity,
|
|
270
|
+
strokeWidth: series.strokeWidth ?? props.strokeWidth,
|
|
271
|
+
strokeDasharray: series.strokeDasharray,
|
|
272
|
+
showPoints: series.showPoints ?? props.showPoints,
|
|
273
|
+
pointSize: series.pointSize ?? props.pointSize,
|
|
274
|
+
pointColor: series.pointColor ?? color
|
|
275
|
+
};
|
|
276
|
+
})
|
|
277
|
+
);
|
|
278
|
+
const legendItems = vue.computed(
|
|
279
|
+
() => resolvedSeries.value.map((series, index) => ({
|
|
280
|
+
index,
|
|
281
|
+
label: props.legendFormatter ? props.legendFormatter(series, index) : series.name ?? `Series ${index + 1}`,
|
|
282
|
+
color: series.color ?? palette.value[index % palette.value.length],
|
|
283
|
+
active: activeIndex.value === null || activeIndex.value === index
|
|
284
|
+
}))
|
|
285
|
+
);
|
|
286
|
+
const formatTooltip = vue.computed(
|
|
287
|
+
() => props.tooltipFormatter ?? ((datum, seriesIndex, _pointIndex, series) => {
|
|
288
|
+
const seriesName = series?.name ?? `Series ${seriesIndex + 1}`;
|
|
289
|
+
const label = datum.label ?? String(datum.x);
|
|
290
|
+
return `${seriesName} \xB7 ${label}: ${datum.y}`;
|
|
291
|
+
})
|
|
292
|
+
);
|
|
293
|
+
const tooltipContent = vue.computed(() => {
|
|
294
|
+
if (!hoveredPointInfo.value) return "";
|
|
295
|
+
const { seriesIndex, pointIndex } = hoveredPointInfo.value;
|
|
296
|
+
const series = resolvedSeries.value[seriesIndex];
|
|
297
|
+
const datum = series?.data[pointIndex];
|
|
298
|
+
return datum ? formatTooltip.value(datum, seriesIndex, pointIndex, series) : "";
|
|
299
|
+
});
|
|
300
|
+
const handlePointMouseEnter = (seriesIndex, pointIndex, event) => {
|
|
301
|
+
hoveredPointInfo.value = { seriesIndex, pointIndex };
|
|
302
|
+
tooltipPosition.value = { x: event.clientX, y: event.clientY };
|
|
303
|
+
emit(
|
|
304
|
+
"point-hover",
|
|
305
|
+
seriesIndex,
|
|
306
|
+
pointIndex,
|
|
307
|
+
resolvedSeries.value[seriesIndex]?.data[pointIndex]
|
|
308
|
+
);
|
|
309
|
+
};
|
|
310
|
+
const handlePointMouseMove = (event) => {
|
|
311
|
+
tooltipPosition.value = { x: event.clientX, y: event.clientY };
|
|
312
|
+
};
|
|
313
|
+
const handlePointMouseLeave = () => {
|
|
314
|
+
hoveredPointInfo.value = null;
|
|
315
|
+
emit("point-hover", null, null, null);
|
|
316
|
+
};
|
|
317
|
+
const handlePointClick = (seriesIndex, pointIndex) => {
|
|
318
|
+
emit(
|
|
319
|
+
"point-click",
|
|
320
|
+
seriesIndex,
|
|
321
|
+
pointIndex,
|
|
322
|
+
resolvedSeries.value[seriesIndex]?.data[pointIndex]
|
|
323
|
+
);
|
|
324
|
+
handleSeriesSelect(seriesIndex);
|
|
325
|
+
};
|
|
326
|
+
const handleKeyDown = (event, seriesIndex) => {
|
|
327
|
+
if (!props.selectable) return;
|
|
328
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
329
|
+
event.preventDefault();
|
|
330
|
+
handleSeriesSelect(seriesIndex);
|
|
331
|
+
};
|
|
332
|
+
return () => {
|
|
333
|
+
const chart = vue.h(
|
|
334
|
+
chunkFCV4ML6I_js.ChartCanvas,
|
|
335
|
+
{
|
|
336
|
+
width: props.width,
|
|
337
|
+
height: props.height,
|
|
338
|
+
padding: props.padding,
|
|
339
|
+
title: props.title,
|
|
340
|
+
desc: props.desc,
|
|
341
|
+
className: tigercatCore.classNames(props.className)
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
default: () => [
|
|
345
|
+
props.showGrid ? vue.h(chunk57MJTNDL_js.ChartGrid, {
|
|
346
|
+
xScale: resolvedXScale.value,
|
|
347
|
+
yScale: resolvedYScale.value,
|
|
348
|
+
show: "both",
|
|
349
|
+
xTicks: props.xTicks,
|
|
350
|
+
yTicks: props.yTicks,
|
|
351
|
+
xTickValues: props.xTickValues,
|
|
352
|
+
yTickValues: props.yTickValues,
|
|
353
|
+
lineStyle: props.gridLineStyle,
|
|
354
|
+
strokeWidth: props.gridStrokeWidth
|
|
355
|
+
}) : null,
|
|
356
|
+
showXAxis.value ? vue.h(chunk5PXTMXXS_js.ChartAxis, {
|
|
357
|
+
scale: resolvedXScale.value,
|
|
358
|
+
orientation: "bottom",
|
|
359
|
+
y: innerRect.value.height,
|
|
360
|
+
ticks: props.xTicks,
|
|
361
|
+
tickValues: props.xTickValues,
|
|
362
|
+
tickFormat: props.xTickFormat,
|
|
363
|
+
label: props.xAxisLabel
|
|
364
|
+
}) : null,
|
|
365
|
+
showYAxis.value ? vue.h(chunk5PXTMXXS_js.ChartAxis, {
|
|
366
|
+
scale: resolvedYScale.value,
|
|
367
|
+
orientation: "left",
|
|
368
|
+
ticks: props.yTicks,
|
|
369
|
+
tickValues: props.yTickValues,
|
|
370
|
+
tickFormat: props.yTickFormat,
|
|
371
|
+
label: props.yAxisLabel
|
|
372
|
+
}) : null,
|
|
373
|
+
// Render each series
|
|
374
|
+
...seriesData.value.map(
|
|
375
|
+
(sd) => vue.h(
|
|
376
|
+
chunkHBFFINAI_js.ChartSeries,
|
|
377
|
+
{
|
|
378
|
+
key: `series-${sd.seriesIndex}`,
|
|
379
|
+
data: sd.series.data,
|
|
380
|
+
name: sd.series.name,
|
|
381
|
+
type: "line",
|
|
382
|
+
opacity: sd.opacity,
|
|
383
|
+
class: tigercatCore.classNames(
|
|
384
|
+
sd.series.className,
|
|
385
|
+
(props.hoverable || props.selectable) && "cursor-pointer"
|
|
386
|
+
),
|
|
387
|
+
onMouseenter: (e) => handleSeriesHoverEnter(sd.seriesIndex, e),
|
|
388
|
+
onMouseleave: handleSeriesHoverLeave,
|
|
389
|
+
onClick: () => handleSeriesSelect(sd.seriesIndex),
|
|
390
|
+
tabindex: props.selectable ? 0 : void 0,
|
|
391
|
+
onKeydown: (e) => handleKeyDown(e, sd.seriesIndex)
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
default: () => [
|
|
395
|
+
// Line path
|
|
396
|
+
vue.h("path", {
|
|
397
|
+
d: sd.linePath,
|
|
398
|
+
fill: "none",
|
|
399
|
+
stroke: sd.color,
|
|
400
|
+
"stroke-width": sd.strokeWidth,
|
|
401
|
+
"stroke-dasharray": sd.strokeDasharray,
|
|
402
|
+
"stroke-linecap": "round",
|
|
403
|
+
"stroke-linejoin": "round",
|
|
404
|
+
class: "transition-opacity duration-150",
|
|
405
|
+
"data-line-series": sd.seriesIndex
|
|
406
|
+
}),
|
|
407
|
+
// Data points
|
|
408
|
+
sd.showPoints ? sd.points.map(
|
|
409
|
+
(point) => vue.h("circle", {
|
|
410
|
+
key: `point-${sd.seriesIndex}-${point.pointIndex}`,
|
|
411
|
+
cx: point.x,
|
|
412
|
+
cy: point.y,
|
|
413
|
+
r: sd.pointSize,
|
|
414
|
+
fill: sd.pointColor,
|
|
415
|
+
class: "transition-all duration-150 hover:r-[6]",
|
|
416
|
+
"data-point-index": point.pointIndex,
|
|
417
|
+
onMouseenter: (e) => handlePointMouseEnter(sd.seriesIndex, point.pointIndex, e),
|
|
418
|
+
onMousemove: handlePointMouseMove,
|
|
419
|
+
onMouseleave: handlePointMouseLeave,
|
|
420
|
+
onClick: (e) => {
|
|
421
|
+
e.stopPropagation();
|
|
422
|
+
handlePointClick(sd.seriesIndex, point.pointIndex);
|
|
423
|
+
}
|
|
424
|
+
})
|
|
425
|
+
) : null
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
)
|
|
430
|
+
].filter(Boolean)
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
const tooltip = props.showTooltip ? vue.h(chunkEPE6OOV7_js.ChartTooltip, {
|
|
434
|
+
content: tooltipContent.value,
|
|
435
|
+
visible: hoveredPointInfo.value !== null && tooltipContent.value !== "",
|
|
436
|
+
x: tooltipPosition.value.x,
|
|
437
|
+
y: tooltipPosition.value.y
|
|
438
|
+
}) : null;
|
|
439
|
+
if (!props.showLegend) {
|
|
440
|
+
return vue.h("div", { class: "inline-block relative" }, [chart, tooltip]);
|
|
441
|
+
}
|
|
442
|
+
return vue.h("div", { class: wrapperClasses.value }, [
|
|
443
|
+
chart,
|
|
444
|
+
vue.h(chunkBKTQ6RWR_js.ChartLegend, {
|
|
445
|
+
items: legendItems.value,
|
|
446
|
+
position: props.legendPosition,
|
|
447
|
+
markerSize: props.legendMarkerSize,
|
|
448
|
+
gap: props.legendGap,
|
|
449
|
+
interactive: props.hoverable || props.selectable,
|
|
450
|
+
onItemClick: handleLegendClick,
|
|
451
|
+
onItemHover: handleLegendHover,
|
|
452
|
+
onItemLeave: handleLegendLeave
|
|
453
|
+
}),
|
|
454
|
+
tooltip
|
|
455
|
+
]);
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
var LineChart_default = LineChart;
|
|
460
|
+
|
|
461
|
+
exports.LineChart = LineChart;
|
|
462
|
+
exports.LineChart_default = LineChart_default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button } from './chunk-YMIO4A2U.mjs';
|
|
2
2
|
import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount, nextTick, h, Teleport } from 'vue';
|
|
3
|
-
import { getModalContentClasses, getModalContainerClasses, closeIconViewBox, closeIconPathD, closeIconPathStrokeWidth, closeIconPathStrokeLinejoin, closeIconPathStrokeLinecap, classNames, coerceClassValue, mergeStyleValues, modalHeaderClasses, modalTitleClasses, resolveLocaleText, modalCloseButtonClasses, modalBodyClasses, modalFooterClasses, modalWrapperClasses, modalMaskClasses } from '@expcat/tigercat-core';
|
|
3
|
+
import { getModalContentClasses, getModalContainerClasses, closeIconViewBox, closeIconPathD, closeIconPathStrokeWidth, closeIconPathStrokeLinejoin, closeIconPathStrokeLinecap, classNames, coerceClassValue, mergeStyleValues, modalHeaderClasses, modalTitleClasses, resolveLocaleText, modalCloseButtonClasses, modalBodyClasses, modalFooterClasses, modalWrapperClasses, modalMaskClasses, getFocusableElements, getFocusTrapNavigation } from '@expcat/tigercat-core';
|
|
4
4
|
|
|
5
5
|
var modalIdCounter = 0;
|
|
6
6
|
var createModalId = () => `tiger-modal-${++modalIdCounter}`;
|
|
@@ -179,16 +179,25 @@ var Modal = defineComponent({
|
|
|
179
179
|
handleClose();
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
|
-
const
|
|
182
|
+
const handleKeyDown = (event) => {
|
|
183
183
|
if (event.key === "Escape" && props.visible) {
|
|
184
184
|
handleClose();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (event.key === "Tab" && props.visible && dialogRef.value) {
|
|
188
|
+
const focusables = getFocusableElements(dialogRef.value);
|
|
189
|
+
const result = getFocusTrapNavigation(event, focusables, document.activeElement);
|
|
190
|
+
if (result.shouldHandle && result.next) {
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
result.next.focus();
|
|
193
|
+
}
|
|
185
194
|
}
|
|
186
195
|
};
|
|
187
196
|
onMounted(() => {
|
|
188
|
-
document.addEventListener("keydown",
|
|
197
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
189
198
|
});
|
|
190
199
|
onBeforeUnmount(() => {
|
|
191
|
-
document.removeEventListener("keydown",
|
|
200
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
192
201
|
});
|
|
193
202
|
watch(
|
|
194
203
|
() => props.visible,
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ref, computed } from 'vue';
|
|
2
|
+
import { classNames, getChartElementOpacity } from '@expcat/tigercat-core';
|
|
3
|
+
|
|
4
|
+
// src/composables/useChartInteraction.ts
|
|
5
|
+
function unref(value) {
|
|
6
|
+
return value?.value !== void 0 ? value.value : value;
|
|
7
|
+
}
|
|
8
|
+
function useChartInteraction(options) {
|
|
9
|
+
const { emit, getData, eventNames } = options;
|
|
10
|
+
const localHoveredIndex = ref(null);
|
|
11
|
+
const localSelectedIndex = ref(null);
|
|
12
|
+
const tooltipPosition = ref({ x: 0, y: 0 });
|
|
13
|
+
const resolvedHoveredIndex = computed(
|
|
14
|
+
() => options.hoveredIndexProp !== void 0 ? options.hoveredIndexProp : localHoveredIndex.value
|
|
15
|
+
);
|
|
16
|
+
const resolvedSelectedIndex = computed(
|
|
17
|
+
() => options.selectedIndexProp !== void 0 ? options.selectedIndexProp : localSelectedIndex.value
|
|
18
|
+
);
|
|
19
|
+
const activeIndex = computed(() => {
|
|
20
|
+
if (resolvedSelectedIndex.value !== null) return resolvedSelectedIndex.value;
|
|
21
|
+
if (unref(options.hoverable) && resolvedHoveredIndex.value !== null) {
|
|
22
|
+
return resolvedHoveredIndex.value;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
});
|
|
26
|
+
const getElementOpacity = (index) => {
|
|
27
|
+
return getChartElementOpacity(index, activeIndex.value, {
|
|
28
|
+
activeOpacity: unref(options.activeOpacity),
|
|
29
|
+
inactiveOpacity: unref(options.inactiveOpacity)
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const handleMouseEnter = (index, event) => {
|
|
33
|
+
if (!unref(options.hoverable)) return;
|
|
34
|
+
if (options.hoveredIndexProp === void 0) {
|
|
35
|
+
localHoveredIndex.value = index;
|
|
36
|
+
}
|
|
37
|
+
tooltipPosition.value = { x: event.clientX, y: event.clientY };
|
|
38
|
+
emit("update:hoveredIndex", index);
|
|
39
|
+
if (eventNames?.hover && getData) {
|
|
40
|
+
emit(eventNames.hover, index, getData(index));
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const handleMouseMove = (event) => {
|
|
44
|
+
tooltipPosition.value = { x: event.clientX, y: event.clientY };
|
|
45
|
+
};
|
|
46
|
+
const handleMouseLeave = () => {
|
|
47
|
+
if (!unref(options.hoverable)) return;
|
|
48
|
+
if (options.hoveredIndexProp === void 0) {
|
|
49
|
+
localHoveredIndex.value = null;
|
|
50
|
+
}
|
|
51
|
+
emit("update:hoveredIndex", null);
|
|
52
|
+
if (eventNames?.hover) {
|
|
53
|
+
emit(eventNames.hover, null, null);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const handleClick = (index) => {
|
|
57
|
+
if (!unref(options.selectable)) return;
|
|
58
|
+
const nextIndex = resolvedSelectedIndex.value === index ? null : index;
|
|
59
|
+
if (options.selectedIndexProp === void 0) {
|
|
60
|
+
localSelectedIndex.value = nextIndex;
|
|
61
|
+
}
|
|
62
|
+
emit("update:selectedIndex", nextIndex);
|
|
63
|
+
if (eventNames?.click && getData) {
|
|
64
|
+
emit(eventNames.click, index, getData(index));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const handleKeyDown = (event, index) => {
|
|
68
|
+
if (!unref(options.selectable)) return;
|
|
69
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
handleClick(index);
|
|
72
|
+
};
|
|
73
|
+
const handleLegendClick = (index) => {
|
|
74
|
+
handleClick(index);
|
|
75
|
+
};
|
|
76
|
+
const handleLegendHover = (index) => {
|
|
77
|
+
if (!unref(options.hoverable)) return;
|
|
78
|
+
if (options.hoveredIndexProp === void 0) {
|
|
79
|
+
localHoveredIndex.value = index;
|
|
80
|
+
}
|
|
81
|
+
emit("update:hoveredIndex", index);
|
|
82
|
+
};
|
|
83
|
+
const handleLegendLeave = () => {
|
|
84
|
+
handleMouseLeave();
|
|
85
|
+
};
|
|
86
|
+
const wrapperClasses = computed(() => {
|
|
87
|
+
const position = unref(options.legendPosition) ?? "bottom";
|
|
88
|
+
return classNames(
|
|
89
|
+
"inline-flex",
|
|
90
|
+
position === "right" ? "flex-row items-start gap-4" : position === "left" ? "flex-row-reverse items-start gap-4" : position === "top" ? "flex-col-reverse gap-2" : "flex-col gap-2"
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
const createLegendItems = (items, palette, labelFormatter) => {
|
|
94
|
+
return items.map((item, index) => ({
|
|
95
|
+
index,
|
|
96
|
+
label: labelFormatter ? labelFormatter(item, index) : item.label ?? String(item.x ?? index),
|
|
97
|
+
color: item.color ?? palette[index % palette.length],
|
|
98
|
+
active: activeIndex.value === null || activeIndex.value === index
|
|
99
|
+
}));
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
localHoveredIndex,
|
|
103
|
+
localSelectedIndex,
|
|
104
|
+
tooltipPosition,
|
|
105
|
+
resolvedHoveredIndex,
|
|
106
|
+
resolvedSelectedIndex,
|
|
107
|
+
activeIndex,
|
|
108
|
+
getElementOpacity,
|
|
109
|
+
handleMouseEnter,
|
|
110
|
+
handleMouseMove,
|
|
111
|
+
handleMouseLeave,
|
|
112
|
+
handleClick,
|
|
113
|
+
handleKeyDown,
|
|
114
|
+
handleLegendClick,
|
|
115
|
+
handleLegendHover,
|
|
116
|
+
handleLegendLeave,
|
|
117
|
+
wrapperClasses,
|
|
118
|
+
createLegendItems
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { useChartInteraction };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useVueEscapeKey } from './chunk-
|
|
1
|
+
import { useVueEscapeKey } from './chunk-CU4M5ABS.mjs';
|
|
2
2
|
import { defineComponent, ref, computed, onMounted, onBeforeUnmount, watch, nextTick, h, Teleport } from 'vue';
|
|
3
|
-
import { captureActiveElement, focusFirst, restoreFocus, classNames, getDrawerContainerClasses, getDrawerMaskClasses, getDrawerPanelClasses, coerceClassValue, mergeStyleValues, getDrawerHeaderClasses, getDrawerBodyClasses, getDrawerFooterClasses, getDrawerCloseButtonClasses, getDrawerTitleClasses, resolveLocaleText, closeIconViewBox, closeIconPathD, closeIconPathStrokeWidth, closeIconPathStrokeLinejoin, closeIconPathStrokeLinecap } from '@expcat/tigercat-core';
|
|
3
|
+
import { captureActiveElement, focusFirst, restoreFocus, ANIMATION_DURATION_MS, classNames, getDrawerContainerClasses, getDrawerMaskClasses, getDrawerPanelClasses, coerceClassValue, mergeStyleValues, getDrawerHeaderClasses, getDrawerBodyClasses, getDrawerFooterClasses, getDrawerCloseButtonClasses, getDrawerTitleClasses, resolveLocaleText, closeIconViewBox, closeIconPathD, closeIconPathStrokeWidth, closeIconPathStrokeLinejoin, closeIconPathStrokeLinecap, getFocusableElements, getFocusTrapNavigation } from '@expcat/tigercat-core';
|
|
4
4
|
|
|
5
5
|
var drawerIdCounter = 0;
|
|
6
6
|
var createDrawerId = () => `tiger-drawer-${++drawerIdCounter}`;
|
|
@@ -153,14 +153,26 @@ var Drawer = defineComponent({
|
|
|
153
153
|
};
|
|
154
154
|
const escapeEnabled = computed(() => props.visible);
|
|
155
155
|
let cleanupEscape;
|
|
156
|
+
const handleKeyDown = (event) => {
|
|
157
|
+
if (event.key === "Tab" && props.visible && dialogRef.value) {
|
|
158
|
+
const focusables = getFocusableElements(dialogRef.value);
|
|
159
|
+
const result = getFocusTrapNavigation(event, focusables, document.activeElement);
|
|
160
|
+
if (result.shouldHandle && result.next) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
result.next.focus();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
156
166
|
onMounted(() => {
|
|
157
167
|
cleanupEscape = useVueEscapeKey({
|
|
158
168
|
enabled: escapeEnabled,
|
|
159
169
|
onEscape: handleClose
|
|
160
170
|
});
|
|
171
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
161
172
|
});
|
|
162
173
|
onBeforeUnmount(() => {
|
|
163
174
|
cleanupEscape?.();
|
|
175
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
164
176
|
});
|
|
165
177
|
watch(
|
|
166
178
|
() => props.visible,
|
|
@@ -181,14 +193,14 @@ var Drawer = defineComponent({
|
|
|
181
193
|
if (!nextVisible) return;
|
|
182
194
|
const timer2 = window.setTimeout(() => {
|
|
183
195
|
emit("after-enter");
|
|
184
|
-
},
|
|
196
|
+
}, ANIMATION_DURATION_MS);
|
|
185
197
|
onCleanup(() => window.clearTimeout(timer2));
|
|
186
198
|
return;
|
|
187
199
|
}
|
|
188
200
|
if (nextVisible === prevVisible) return;
|
|
189
201
|
const timer = window.setTimeout(() => {
|
|
190
202
|
emit(nextVisible ? "after-enter" : "after-leave");
|
|
191
|
-
},
|
|
203
|
+
}, ANIMATION_DURATION_MS);
|
|
192
204
|
onCleanup(() => window.clearTimeout(timer));
|
|
193
205
|
},
|
|
194
206
|
{ immediate: true }
|