@campus-admin/ui 1.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +138 -335
  2. package/dist/campus/card/index.d.ts +9 -0
  3. package/dist/campus/index.d.ts +7 -0
  4. package/dist/campus/parent/index.d.ts +9 -0
  5. package/dist/campus/student/index.d.ts +9 -0
  6. package/dist/campus/teacher/index.d.ts +9 -0
  7. package/dist/campus/tel/index.d.ts +9 -0
  8. package/dist/{base/empty/src/empty.vue.d.ts → components/basic/CaIcon.vue.d.ts} +4 -7
  9. package/dist/components/basic/CaPageActions.vue.d.ts +15 -0
  10. package/dist/components/basic/icons.d.ts +48 -0
  11. package/dist/components/basic/index.d.ts +838 -0
  12. package/dist/components/button/index.d.ts +348 -0
  13. package/dist/components/chart/bar-chart/CaBarChart.vue.d.ts +31 -0
  14. package/dist/components/chart/chart-math.d.ts +178 -0
  15. package/dist/components/chart/gauge/CaGauge.vue.d.ts +31 -0
  16. package/dist/components/chart/index.d.ts +195 -0
  17. package/dist/components/chart/line-chart/CaLineChart.vue.d.ts +40 -0
  18. package/dist/components/chart/parts/ChartLegend.vue.d.ts +28 -0
  19. package/dist/{atom/slogan/src/slogan.vue.d.ts → components/chart/parts/ChartStatus.vue.d.ts} +3 -5
  20. package/dist/components/chart/parts/ChartTable.vue.d.ts +19 -0
  21. package/dist/components/chart/parts/ChartTooltip.vue.d.ts +23 -0
  22. package/dist/components/chart/pie-chart/CaPieChart.vue.d.ts +25 -0
  23. package/dist/components/chart/sparkline/CaSparkline.vue.d.ts +20 -0
  24. package/dist/components/chart/use-chart.d.ts +36 -0
  25. package/dist/components/config/CaConfigProvider.vue.d.ts +16 -0
  26. package/dist/components/config/index.d.ts +33 -0
  27. package/dist/components/display/index.d.ts +99 -0
  28. package/dist/{base/copyright/src/copyright.vue.d.ts → components/display/stat-card/CaStatCard.vue.d.ts} +7 -11
  29. package/dist/{base/skeleton/src/skeleton.vue.d.ts → components/display/status-tag/CaStatusTag.vue.d.ts} +4 -7
  30. package/dist/components/display/types.d.ts +7 -0
  31. package/dist/components/form/index.d.ts +112 -0
  32. package/dist/components/form/schema-form/CaSchemaForm.vue.d.ts +31 -0
  33. package/dist/components/form/types.d.ts +17 -0
  34. package/dist/components/index.d.ts +22 -0
  35. package/dist/components/layout/index.d.ts +34 -0
  36. package/dist/components/navigation/CaMenu.vue.d.ts +13 -0
  37. package/dist/components/navigation/index.d.ts +64 -0
  38. package/dist/components/overlay/index.d.ts +1511 -0
  39. package/dist/components/table/data-table/CaDataTable.vue.d.ts +49 -0
  40. package/dist/components/table/index.d.ts +33 -0
  41. package/dist/components/table/types.d.ts +46 -0
  42. package/dist/index.d.ts +21 -1106
  43. package/dist/index.js +2187 -0
  44. package/dist/oms/index.d.ts +3 -0
  45. package/dist/oms/school/index.d.ts +10 -0
  46. package/dist/shared/inject.d.ts +8 -0
  47. package/dist/shared/registry.d.ts +5 -0
  48. package/dist/shared/types.d.ts +9 -0
  49. package/dist/shared/wrap.d.ts +7 -0
  50. package/dist/style.css +2 -0
  51. package/package.json +17 -49
  52. package/dist/atom/attendance-badge/index.d.ts +0 -5
  53. package/dist/atom/attendance-badge/src/attendance-badge.vue.d.ts +0 -13
  54. package/dist/atom/attendance-badge/src/core.d.ts +0 -11
  55. package/dist/atom/avatar/index.d.ts +0 -3
  56. package/dist/atom/avatar/src/avatar.vue.d.ts +0 -14
  57. package/dist/atom/button/index.d.ts +0 -3
  58. package/dist/atom/button/src/button.vue.d.ts +0 -40
  59. package/dist/atom/checkbox/index.d.ts +0 -3
  60. package/dist/atom/checkbox/src/checkbox.vue.d.ts +0 -24
  61. package/dist/atom/icon/index.d.ts +0 -3
  62. package/dist/atom/icon/src/icon.vue.d.ts +0 -27
  63. package/dist/atom/index.d.ts +0 -444
  64. package/dist/atom/input/index.d.ts +0 -3
  65. package/dist/atom/input/src/input.vue.d.ts +0 -43
  66. package/dist/atom/progress/index.d.ts +0 -4
  67. package/dist/atom/progress/src/core.d.ts +0 -9
  68. package/dist/atom/progress/src/progress.vue.d.ts +0 -19
  69. package/dist/atom/select/index.d.ts +0 -5
  70. package/dist/atom/select/src/core.d.ts +0 -9
  71. package/dist/atom/select/src/select.vue.d.ts +0 -22
  72. package/dist/atom/slogan/index.d.ts +0 -3
  73. package/dist/atom/switch/index.d.ts +0 -3
  74. package/dist/atom/switch/src/switch.vue.d.ts +0 -16
  75. package/dist/atom/tag/index.d.ts +0 -3
  76. package/dist/atom/tag/src/tag.vue.d.ts +0 -31
  77. package/dist/atom/textarea/index.d.ts +0 -3
  78. package/dist/atom/textarea/src/textarea.vue.d.ts +0 -19
  79. package/dist/base/breadcrumb/index.d.ts +0 -4
  80. package/dist/base/breadcrumb/src/breadcrumb.vue.d.ts +0 -29
  81. package/dist/base/class-tree/index.d.ts +0 -5
  82. package/dist/base/class-tree/src/class-tree.vue.d.ts +0 -29
  83. package/dist/base/class-tree/src/core.d.ts +0 -30
  84. package/dist/base/copyright/index.d.ts +0 -3
  85. package/dist/base/drawer/index.d.ts +0 -3
  86. package/dist/base/drawer/src/drawer.vue.d.ts +0 -36
  87. package/dist/base/empty/index.d.ts +0 -3
  88. package/dist/base/index.d.ts +0 -651
  89. package/dist/base/menu/core.d.ts +0 -34
  90. package/dist/base/menu/index.d.ts +0 -13
  91. package/dist/base/menu/side-menu/index.d.ts +0 -5
  92. package/dist/base/menu/side-menu/src/side-menu.vue.d.ts +0 -59
  93. package/dist/base/modal/index.d.ts +0 -4
  94. package/dist/base/modal/src/core.d.ts +0 -8
  95. package/dist/base/modal/src/modal.vue.d.ts +0 -46
  96. package/dist/base/page-header/index.d.ts +0 -3
  97. package/dist/base/page-header/src/page-header.vue.d.ts +0 -27
  98. package/dist/base/pagination/index.d.ts +0 -5
  99. package/dist/base/pagination/src/core.d.ts +0 -11
  100. package/dist/base/pagination/src/pagination.vue.d.ts +0 -26
  101. package/dist/base/search-form/index.d.ts +0 -3
  102. package/dist/base/search-form/src/search-form.vue.d.ts +0 -34
  103. package/dist/base/skeleton/index.d.ts +0 -3
  104. package/dist/base/statistic/index.d.ts +0 -3
  105. package/dist/base/statistic/src/statistic.vue.d.ts +0 -16
  106. package/dist/base/table/index.d.ts +0 -5
  107. package/dist/base/table/src/core.d.ts +0 -25
  108. package/dist/base/table/src/table.vue.d.ts +0 -44
  109. package/dist/base/toast/index.d.ts +0 -5
  110. package/dist/base/toast/src/store.d.ts +0 -56
  111. package/dist/base/toast/src/toast-container.vue.d.ts +0 -3
  112. package/dist/campus-ui.css +0 -2
  113. package/dist/campus-ui.js +0 -2229
  114. package/dist/campus-ui.umd.cjs +0 -1
  115. package/dist/core/index.d.ts +0 -4
  116. package/dist/core/namespace.d.ts +0 -16
  117. package/dist/core/theme.d.ts +0 -49
  118. package/dist/feature/daily-agenda/index.d.ts +0 -5
  119. package/dist/feature/daily-agenda/src/core.d.ts +0 -25
  120. package/dist/feature/daily-agenda/src/daily-agenda.vue.d.ts +0 -12
  121. package/dist/feature/daily-agenda/src/data.d.ts +0 -3
  122. package/dist/feature/index.d.ts +0 -61
  123. package/dist/feature/student-picker/index.d.ts +0 -5
  124. package/dist/feature/student-picker/src/core.d.ts +0 -19
  125. package/dist/feature/student-picker/src/student-picker.vue.d.ts +0 -26
  126. package/dist/feature/weekly-timetable/index.d.ts +0 -6
  127. package/dist/feature/weekly-timetable/src/core.d.ts +0 -33
  128. package/dist/feature/weekly-timetable/src/data.d.ts +0 -3
  129. package/dist/feature/weekly-timetable/src/weekly-timetable.vue.d.ts +0 -7
package/dist/index.js ADDED
@@ -0,0 +1,2187 @@
1
+ import './style.css'
2
+ import { ElAffix as e, ElAlert as t, ElAnchor as n, ElAnchorLink as r, ElAside as i, ElAutoResizer as a, ElAutocomplete as o, ElAvatar as s, ElAvatarGroup as c, ElBacktop as l, ElBadge as u, ElBreadcrumb as d, ElBreadcrumbItem as f, ElButton as p, ElButtonGroup as m, ElCalendar as h, ElCard as g, ElCarousel as _, ElCarouselItem as v, ElCascader as y, ElCascaderPanel as b, ElCheckTag as x, ElCheckbox as S, ElCheckboxButton as C, ElCheckboxGroup as ee, ElCol as w, ElCollapse as T, ElCollapseItem as te, ElColorPicker as ne, ElColorPickerPanel as E, ElConfigProvider as re, ElContainer as D, ElCountdown as O, ElDatePicker as ie, ElDatePickerPanel as ae, ElDescriptions as oe, ElDescriptionsItem as se, ElDialog as ce, ElDivider as le, ElDrawer as ue, ElDropdown as de, ElDropdownItem as fe, ElDropdownMenu as pe, ElEmpty as me, ElFooter as he, ElForm as ge, ElFormItem as _e, ElHeader as ve, ElIcon as ye, ElImage as be, ElImageViewer as xe, ElInfiniteScroll as Se, ElInput as Ce, ElInputNumber as we, ElInputOtp as Te, ElInputTag as Ee, ElLink as De, ElLoadingDirective as Oe, ElMain as ke, ElMention as Ae, ElMenu as je, ElMenuItem as Me, ElMenuItemGroup as Ne, ElOption as Pe, ElOptionGroup as Fe, ElPageHeader as Ie, ElPagination as Le, ElPopconfirm as Re, ElPopover as ze, ElProgress as Be, ElRadio as Ve, ElRadioButton as He, ElRadioGroup as Ue, ElRate as We, ElResult as Ge, ElRow as Ke, ElScrollbar as qe, ElSegmented as Je, ElSelect as Ye, ElSelectV2 as Xe, ElSkeleton as Ze, ElSkeletonItem as Qe, ElSlider as $e, ElSpace as et, ElSplitter as tt, ElSplitterPanel as nt, ElStatistic as rt, ElStep as it, ElSteps as at, ElSubMenu as ot, ElSwitch as st, ElTabPane as ct, ElTable as lt, ElTableColumn as ut, ElTableV2 as dt, ElTabs as ft, ElTag as pt, ElText as mt, ElTimePicker as ht, ElTimeSelect as gt, ElTimeline as _t, ElTimelineItem as vt, ElTooltip as yt, ElTour as bt, ElTourStep as xt, ElTransfer as St, ElTree as Ct, ElTreeSelect as wt, ElTreeV2 as Tt, ElUpload as Et, ElWatermark as Dt, vLoading as Ot } from "element-plus";
3
+ import "element-plus/es/components/loading/style/css";
4
+ import "element-plus/es/components/link/style/css";
5
+ import "element-plus/es/components/text/style/css";
6
+ import "element-plus/es/components/scrollbar/style/css";
7
+ import "element-plus/es/components/divider/style/css";
8
+ import "element-plus/es/components/watermark/style/css";
9
+ import "element-plus/es/components/alert/style/css";
10
+ import "element-plus/es/components/card/style/css";
11
+ import "element-plus/es/components/tag/style/css";
12
+ import "element-plus/es/components/icon/style/css";
13
+ import { Fragment as k, Teleport as kt, computed as A, createBlock as j, createCommentVNode as M, createElementBlock as N, createElementVNode as P, createTextVNode as F, createVNode as I, defineComponent as L, inject as At, normalizeClass as R, normalizeStyle as z, onActivated as jt, onBeforeUnmount as Mt, onDeactivated as Nt, onMounted as Pt, openBlock as B, reactive as Ft, ref as V, renderList as H, renderSlot as U, resolveDynamicComponent as It, shallowRef as Lt, toDisplayString as W, unref as G, useSlots as Rt, vShow as zt, watch as Bt, withCtx as K, withDirectives as Vt, withModifiers as Ht } from "vue";
14
+ import { ArrowDown as Ut, ArrowLeft as Wt, Bell as Gt, Brush as Kt, ChatDotRound as qt, Check as Jt, Close as Yt, Collection as Xt, DataAnalysis as Zt, Delete as Qt, Document as $t, Download as en, EditPen as tn, Expand as nn, Files as rn, Fold as an, FullScreen as on, Grid as sn, Hide as cn, Histogram as ln, HomeFilled as un, Location as dn, Menu as fn, Message as pn, Monitor as mn, Moon as hn, MoreFilled as gn, Odometer as _n, Paperclip as vn, Phone as yn, Picture as bn, Plus as xn, Promotion as Sn, Refresh as Cn, ScaleToOriginal as wn, Search as Tn, Setting as En, Star as Dn, Sunny as On, Tickets as kn, Top as An, User as jn, VideoCamera as Mn, View as Nn, Warning as Pn } from "@element-plus/icons-vue";
15
+ import "element-plus/es/components/button/style/css";
16
+ import "element-plus/es/components/button-group/style/css";
17
+ import Fn from "element-plus/es/locale/lang/en";
18
+ import In from "element-plus/es/locale/lang/zh-cn";
19
+ import "element-plus/es/components/config-provider/style/css";
20
+ import "element-plus/es/components/avatar/style/css";
21
+ import "element-plus/es/components/avatar-group/style/css";
22
+ import "element-plus/es/components/badge/style/css";
23
+ import "element-plus/es/components/calendar/style/css";
24
+ import "element-plus/es/components/carousel/style/css";
25
+ import "element-plus/es/components/carousel-item/style/css";
26
+ import "element-plus/es/components/collapse/style/css";
27
+ import "element-plus/es/components/collapse-item/style/css";
28
+ import "element-plus/es/components/descriptions/style/css";
29
+ import "element-plus/es/components/descriptions-item/style/css";
30
+ import "element-plus/es/components/empty/style/css";
31
+ import "element-plus/es/components/image/style/css";
32
+ import "element-plus/es/components/image-viewer/style/css";
33
+ import "element-plus/es/components/pagination/style/css";
34
+ import "element-plus/es/components/progress/style/css";
35
+ import "element-plus/es/components/result/style/css";
36
+ import "element-plus/es/components/skeleton/style/css";
37
+ import "element-plus/es/components/skeleton-item/style/css";
38
+ import "element-plus/es/components/timeline/style/css";
39
+ import "element-plus/es/components/timeline-item/style/css";
40
+ import "element-plus/es/components/tour/style/css";
41
+ import "element-plus/es/components/tour-step/style/css";
42
+ import "element-plus/es/components/tree/style/css";
43
+ import "element-plus/es/components/tree-v2/style/css";
44
+ import "element-plus/es/components/segmented/style/css";
45
+ import "element-plus/es/components/statistic/style/css";
46
+ import "element-plus/es/components/countdown/style/css";
47
+ import "element-plus/es/components/check-tag/style/css";
48
+ import "element-plus/es/components/container/style/css";
49
+ import "element-plus/es/components/header/style/css";
50
+ import "element-plus/es/components/aside/style/css";
51
+ import "element-plus/es/components/main/style/css";
52
+ import "element-plus/es/components/footer/style/css";
53
+ import "element-plus/es/components/row/style/css";
54
+ import "element-plus/es/components/col/style/css";
55
+ import "element-plus/es/components/space/style/css";
56
+ import "element-plus/es/components/splitter/style/css";
57
+ import "element-plus/es/components/splitter-panel/style/css";
58
+ import "element-plus/es/components/autocomplete/style/css";
59
+ import "element-plus/es/components/cascader/style/css";
60
+ import "element-plus/es/components/cascader-panel/style/css";
61
+ import "element-plus/es/components/checkbox/style/css";
62
+ import "element-plus/es/components/checkbox-group/style/css";
63
+ import "element-plus/es/components/checkbox-button/style/css";
64
+ import "element-plus/es/components/color-picker-panel/style/css";
65
+ import "element-plus/es/components/date-picker-panel/style/css";
66
+ import "element-plus/es/components/input-tag/style/css";
67
+ import "element-plus/es/components/input-otp/style/css";
68
+ import "element-plus/es/components/mention/style/css";
69
+ import "element-plus/es/components/rate/style/css";
70
+ import "element-plus/es/components/select-v2/style/css";
71
+ import "element-plus/es/components/slider/style/css";
72
+ import "element-plus/es/components/time-picker/style/css";
73
+ import "element-plus/es/components/time-select/style/css";
74
+ import "element-plus/es/components/transfer/style/css";
75
+ import "element-plus/es/components/tree-select/style/css";
76
+ import "element-plus/es/components/upload/style/css";
77
+ import "element-plus/es/components/option-group/style/css";
78
+ import "element-plus/es/components/radio/style/css";
79
+ import "element-plus/es/components/color-picker/style/css";
80
+ import "element-plus/es/components/date-picker/style/css";
81
+ import "element-plus/es/components/form/style/css";
82
+ import "element-plus/es/components/form-item/style/css";
83
+ import "element-plus/es/components/input/style/css";
84
+ import "element-plus/es/components/input-number/style/css";
85
+ import "element-plus/es/components/option/style/css";
86
+ import "element-plus/es/components/radio-button/style/css";
87
+ import "element-plus/es/components/radio-group/style/css";
88
+ import "element-plus/es/components/select/style/css";
89
+ import "element-plus/es/components/switch/style/css";
90
+ import "element-plus/es/components/affix/style/css";
91
+ import "element-plus/es/components/anchor/style/css";
92
+ import "element-plus/es/components/anchor-link/style/css";
93
+ import "element-plus/es/components/backtop/style/css";
94
+ import "element-plus/es/components/page-header/style/css";
95
+ import "element-plus/es/components/steps/style/css";
96
+ import "element-plus/es/components/step/style/css";
97
+ import "element-plus/es/components/tabs/style/css";
98
+ import "element-plus/es/components/tab-pane/style/css";
99
+ import "element-plus/es/components/menu-item-group/style/css";
100
+ import "element-plus/es/components/breadcrumb/style/css";
101
+ import "element-plus/es/components/breadcrumb-item/style/css";
102
+ import "element-plus/es/components/dropdown/style/css";
103
+ import "element-plus/es/components/dropdown-item/style/css";
104
+ import "element-plus/es/components/dropdown-menu/style/css";
105
+ import "element-plus/es/components/menu/style/css";
106
+ import "element-plus/es/components/menu-item/style/css";
107
+ import "element-plus/es/components/sub-menu/style/css";
108
+ import "element-plus/es/components/popover/style/css";
109
+ import "element-plus/es/components/popconfirm/style/css";
110
+ import "element-plus/es/components/tooltip/style/css";
111
+ import "element-plus/es/components/dialog/style/css";
112
+ import "element-plus/es/components/drawer/style/css";
113
+ import "element-plus/es/components/table-v2/style/css";
114
+ import "element-plus/es/components/table/style/css";
115
+ import "element-plus/es/components/table-column/style/css";
116
+ // packages/ui/src/shared/registry.ts
117
+ function Ln(...e) {
118
+ let t = {};
119
+ for (let n of e) for (let [e, r] of Object.entries(n)) {
120
+ if (e in t) throw Error(`[campus/ui] 组件名重复:${e}(所有域、所有分类的组件名必须唯一)`);
121
+ t[e] = r;
122
+ }
123
+ return t;
124
+ }
125
+ // packages/ui/src/shared/wrap.ts
126
+ function q(e) {
127
+ return e;
128
+ }
129
+ // packages/ui/src/components/basic/icons.ts
130
+ var Rn = {
131
+ home: un,
132
+ chart: Zt,
133
+ document: $t,
134
+ grid: sn,
135
+ setting: En,
136
+ user: jn,
137
+ bell: Gt,
138
+ edit: tn,
139
+ monitor: mn,
140
+ brush: Kt,
141
+ collection: Xt,
142
+ warning: Pn,
143
+ files: rn,
144
+ tickets: kn,
145
+ histogram: ln,
146
+ menu: fn,
147
+ message: pn,
148
+ gauge: _n,
149
+ search: Tn,
150
+ check: Jt,
151
+ delete: Qt,
152
+ star: Dn,
153
+ plus: xn,
154
+ download: en,
155
+ fullscreen: on,
156
+ refresh: Cn,
157
+ exitFullscreen: wn,
158
+ chat: qt,
159
+ sunny: On,
160
+ moon: hn,
161
+ expand: nn,
162
+ fold: an,
163
+ hide: cn,
164
+ view: Nn,
165
+ arrowDown: Ut,
166
+ close: Yt,
167
+ location: dn,
168
+ back: Wt,
169
+ more: gn,
170
+ attachment: vn,
171
+ phone: yn,
172
+ image: bn,
173
+ send: Sn,
174
+ pin: An,
175
+ video: Mn
176
+ }, zn = /* @__PURE__ */ L({
177
+ __name: "CaIcon",
178
+ props: { name: {} },
179
+ setup(e) {
180
+ let t = e, n = A(() => t.name ? Rn[t.name] : void 0);
181
+ return (e, t) => (B(), j(G(ye), null, {
182
+ default: K(() => [n.value ? (B(), j(It(n.value), { key: 0 })) : U(e.$slots, "default", {}, void 0, void 0, 1)]),
183
+ _: 3
184
+ }));
185
+ }
186
+ }), Bn = {
187
+ key: 1,
188
+ class: "ca-page-actions"
189
+ }, Vn = /* @__PURE__ */ L({
190
+ __name: "CaPageActions",
191
+ setup(e) {
192
+ let t = V(null), n = V(!0);
193
+ return Pt(() => {
194
+ t.value = document.getElementById("ca-page-actions");
195
+ }), jt(() => n.value = !0), Nt(() => n.value = !1), (e, r) => t.value ? (B(), j(kt, {
196
+ key: 0,
197
+ to: t.value
198
+ }, [n.value ? U(e.$slots, "default", {}, void 0, void 0, 0) : M("v-if", !0)], 8, ["to"])) : (B(), N("div", Bn, [U(e.$slots, "default")]));
199
+ }
200
+ }), Hn = q(t), Un = q(g), Wn = q(pt), Gn = q(De), Kn = q(mt), qn = q(qe), Jn = q(le), Yn = q(Dt), Xn = {
201
+ CaLink: Gn,
202
+ CaText: Kn,
203
+ CaScrollbar: qn,
204
+ CaDivider: Jn,
205
+ CaWatermark: Yn,
206
+ CaAlert: Hn,
207
+ CaCard: Un,
208
+ CaIcon: zn,
209
+ CaPageActions: Vn,
210
+ CaTag: Wn
211
+ }, Zn = q(p), Qn = q(m), $n = {
212
+ CaButton: Zn,
213
+ CaButtonGroup: Qn
214
+ }, er = Symbol("campus-translate");
215
+ function J() {
216
+ return At(er, (e) => e);
217
+ }
218
+ // packages/ui/src/components/chart/chart-math.ts
219
+ function Y(e) {
220
+ return typeof e == "number" && Number.isFinite(e);
221
+ }
222
+ function X(e) {
223
+ let t = e.toFixed(2).replace(/\.?0+$/, "");
224
+ return t === "-0" || t === "" ? "0" : t;
225
+ }
226
+ function Z(e, t, n) {
227
+ return Math.min(n, Math.max(t, e));
228
+ }
229
+ function tr(e, t) {
230
+ let n = Math.floor(Math.log10(e)), r = e / 10 ** n, i;
231
+ return i = t ? r < 1.5 ? 1 : r < 3 ? 2 : r < 7 ? 5 : 10 : r <= 1 ? 1 : r <= 2 ? 2 : r <= 5 ? 5 : 10, i * 10 ** n;
232
+ }
233
+ function nr(e, t) {
234
+ let n = Math.max(0, -Math.floor(Math.log10(t)) + 2);
235
+ return Number(e.toFixed(Math.min(n, 12)));
236
+ }
237
+ function rr(e, t, n = 5, r = !0) {
238
+ let i = Number.isFinite(e) ? e : 0, a = Number.isFinite(t) ? t : 1;
239
+ if (i > a && ([i, a] = [a, i]), r && (i = Math.min(i, 0), a = Math.max(a, 0)), i === a) {
240
+ let e = i === 0 ? 1 : Math.abs(i) * .1;
241
+ i = r && i >= 0 ? 0 : i - e, a += e;
242
+ }
243
+ let o = Math.max(2, Math.floor(n)), s = tr(tr(a - i, !1) / (o - 1), !0), c = Math.floor(i / s) * s, l = Math.ceil(a / s) * s, u = [], d = Math.round((l - c) / s);
244
+ for (let e = 0; e <= d; e++) u.push(nr(c + e * s, s));
245
+ return {
246
+ min: u[0],
247
+ max: u[u.length - 1],
248
+ step: s,
249
+ ticks: u
250
+ };
251
+ }
252
+ function ir(e, t, n, r) {
253
+ let i = t - e;
254
+ return i === 0 ? () => (n + r) / 2 : (t) => n + (t - e) / i * (r - n);
255
+ }
256
+ function ar(e, t, n, r = .2) {
257
+ let i = Math.max(1, Math.floor(e)), a = (n - t) / i, o = a * (1 - Z(r, 0, .9));
258
+ return {
259
+ step: a,
260
+ bandwidth: o,
261
+ start: (e) => t + e * a + (a - o) / 2,
262
+ center: (e) => t + e * a + a / 2
263
+ };
264
+ }
265
+ function or(e, t, n) {
266
+ if (e <= 0) return [];
267
+ let r = Math.max(1, Math.floor(t / Math.max(1, n))), i = Math.max(1, Math.ceil(e / r)), a = [];
268
+ for (let t = 0; t < e; t += i) a.push(t);
269
+ return a;
270
+ }
271
+ function sr(e, t) {
272
+ if (!e.length) return -1;
273
+ let n = 0, r = e.length - 1;
274
+ for (; n < r;) {
275
+ let i = n + r >> 1;
276
+ e[i] < t ? n = i + 1 : r = i;
277
+ }
278
+ return n > 0 && t - e[n - 1] <= e[n] - t ? n - 1 : n;
279
+ }
280
+ function cr(e) {
281
+ let t = [], n = [];
282
+ for (let r of e) r && Y(r.x) && Y(r.y) ? n.push(r) : n.length && (t.push(n), n = []);
283
+ return n.length && t.push(n), t;
284
+ }
285
+ function lr(e) {
286
+ let t = e.length, n = [], r = [];
287
+ for (let i = 0; i < t - 1; i++) n.push(e[i + 1].x - e[i].x), r.push(n[i] === 0 ? 0 : (e[i + 1].y - e[i].y) / n[i]);
288
+ let i = Array(t);
289
+ i[0] = r[0], i[t - 1] = r[t - 2];
290
+ for (let e = 1; e < t - 1; e++) i[e] = r[e - 1] * r[e] <= 0 ? 0 : (r[e - 1] + r[e]) / 2;
291
+ for (let e = 0; e < t - 1; e++) {
292
+ if (r[e] === 0) {
293
+ i[e] = 0, i[e + 1] = 0;
294
+ continue;
295
+ }
296
+ let t = i[e] / r[e], n = i[e + 1] / r[e], a = t * t + n * n;
297
+ if (a > 9) {
298
+ let o = 3 / Math.sqrt(a);
299
+ i[e] = o * t * r[e], i[e + 1] = o * n * r[e];
300
+ }
301
+ }
302
+ return i;
303
+ }
304
+ function ur(e, t) {
305
+ if (e.length < 2) return "";
306
+ if (!t || e.length === 2) return e.slice(1).map((e) => `L${X(e.x)} ${X(e.y)}`).join("");
307
+ let n = lr(e), r = "";
308
+ for (let t = 0; t < e.length - 1; t++) {
309
+ let i = e[t], a = e[t + 1], o = (a.x - i.x) / 3;
310
+ r += `C${X(i.x + o)} ${X(i.y + n[t] * o)} ${X(a.x - o)} ${X(a.y - n[t + 1] * o)} ${X(a.x)} ${X(a.y)}`;
311
+ }
312
+ return r;
313
+ }
314
+ function dr(e, t = !1) {
315
+ return cr(e).filter((e) => e.length >= 2).map((e) => `M${X(e[0].x)} ${X(e[0].y)}${ur(e, t)}`).join("");
316
+ }
317
+ function fr(e, t, n = !1) {
318
+ return cr(e).filter((e) => e.length >= 2).map((e) => {
319
+ let r = e[0], i = e[e.length - 1];
320
+ return `M${X(r.x)} ${X(t)}L${X(r.x)} ${X(r.y)}${ur(e, n)}L${X(i.x)} ${X(t)}Z`;
321
+ }).join("");
322
+ }
323
+ function pr(e) {
324
+ let t = Math.max(0, ...e.map((e) => e.length)), n = Array(t).fill(0), r = Array(t).fill(0);
325
+ return e.map((e) => Array.from({ length: t }, (t, i) => {
326
+ let a = e[i];
327
+ if (!Y(a)) return null;
328
+ if (a >= 0) {
329
+ let e = n[i];
330
+ return n[i] = e + a, {
331
+ from: e,
332
+ to: n[i]
333
+ };
334
+ }
335
+ let o = r[i];
336
+ return r[i] = o + a, {
337
+ from: o,
338
+ to: r[i]
339
+ };
340
+ }));
341
+ }
342
+ function mr(e) {
343
+ let t = Infinity, n = -Infinity;
344
+ for (let r of e) Y(r) && (r < t && (t = r), r > n && (n = r));
345
+ return t === Infinity ? null : [t, n];
346
+ }
347
+ function hr(e, t, n, r, i, a) {
348
+ if (n <= 0 || r <= 0) return "";
349
+ let o = Z(i, 0, Math.min(n, r) / 2), s = e + n, c = t + r;
350
+ if (o === 0) return `M${X(e)} ${X(t)}H${X(s)}V${X(c)}H${X(e)}Z`;
351
+ switch (a) {
352
+ case "top": return `M${X(e)} ${X(c)}V${X(t + o)}Q${X(e)} ${X(t)} ${X(e + o)} ${X(t)}H${X(s - o)}Q${X(s)} ${X(t)} ${X(s)} ${X(t + o)}V${X(c)}Z`;
353
+ case "bottom": return `M${X(e)} ${X(t)}H${X(s)}V${X(c - o)}Q${X(s)} ${X(c)} ${X(s - o)} ${X(c)}H${X(e + o)}Q${X(e)} ${X(c)} ${X(e)} ${X(c - o)}Z`;
354
+ case "right": return `M${X(e)} ${X(t)}H${X(s - o)}Q${X(s)} ${X(t)} ${X(s)} ${X(t + o)}V${X(c - o)}Q${X(s)} ${X(c)} ${X(s - o)} ${X(c)}H${X(e)}Z`;
355
+ case "left": return `M${X(s)} ${X(t)}H${X(e + o)}Q${X(e)} ${X(t)} ${X(e)} ${X(t + o)}V${X(c - o)}Q${X(e)} ${X(c)} ${X(e + o)} ${X(c)}H${X(s)}Z`;
356
+ }
357
+ }
358
+ var gr = Math.PI * 2;
359
+ function _r(e, t = 0, n = gr) {
360
+ let r = e.map((e) => Y(e) && e > 0 ? e : 0), i = r.reduce((e, t) => e + t, 0);
361
+ if (i <= 0) return [];
362
+ let a = t;
363
+ return r.map((e, t) => {
364
+ let r = e / i, o = {
365
+ index: t,
366
+ value: e,
367
+ ratio: r,
368
+ start: a,
369
+ end: a + r * n
370
+ };
371
+ return a = o.end, o;
372
+ });
373
+ }
374
+ function Q(e, t, n, r) {
375
+ return {
376
+ x: e + n * Math.sin(r),
377
+ y: t - n * Math.cos(r)
378
+ };
379
+ }
380
+ function vr(e, t, n, r, i, a) {
381
+ let o = a - i;
382
+ if (o <= 0 || n <= 0) return "";
383
+ let s = Z(r, 0, n);
384
+ if (o >= gr - 1e-6) {
385
+ let r = Q(e, t, n, i), a = Q(e, t, n, i + Math.PI), o = `M${X(r.x)} ${X(r.y)}A${X(n)} ${X(n)} 0 1 1 ${X(a.x)} ${X(a.y)}A${X(n)} ${X(n)} 0 1 1 ${X(r.x)} ${X(r.y)}Z`;
386
+ if (s > 0) {
387
+ let n = Q(e, t, s, i), r = Q(e, t, s, i + Math.PI);
388
+ o += `M${X(n.x)} ${X(n.y)}A${X(s)} ${X(s)} 0 1 0 ${X(r.x)} ${X(r.y)}A${X(s)} ${X(s)} 0 1 0 ${X(n.x)} ${X(n.y)}Z`;
389
+ }
390
+ return o;
391
+ }
392
+ let c = +(o > Math.PI), l = Q(e, t, n, i), u = Q(e, t, n, a);
393
+ if (s === 0) return `M${X(e)} ${X(t)}L${X(l.x)} ${X(l.y)}A${X(n)} ${X(n)} 0 ${c} 1 ${X(u.x)} ${X(u.y)}Z`;
394
+ let d = Q(e, t, s, a), f = Q(e, t, s, i);
395
+ return `M${X(l.x)} ${X(l.y)}A${X(n)} ${X(n)} 0 ${c} 1 ${X(u.x)} ${X(u.y)}L${X(d.x)} ${X(d.y)}A${X(s)} ${X(s)} 0 ${c} 0 ${X(f.x)} ${X(f.y)}Z`;
396
+ }
397
+ function yr(e, t, n, r, i) {
398
+ let a = i - r;
399
+ if (a <= 0 || n <= 0) return "";
400
+ if (a >= gr - 1e-6) {
401
+ let i = Q(e, t, n, r), a = Q(e, t, n, r + Math.PI);
402
+ return `M${X(i.x)} ${X(i.y)}A${X(n)} ${X(n)} 0 1 1 ${X(a.x)} ${X(a.y)}A${X(n)} ${X(n)} 0 1 1 ${X(i.x)} ${X(i.y)}`;
403
+ }
404
+ let o = Q(e, t, n, r), s = Q(e, t, n, i);
405
+ return `M${X(o.x)} ${X(o.y)}A${X(n)} ${X(n)} 0 ${+(a > Math.PI)} 1 ${X(s.x)} ${X(s.y)}`;
406
+ }
407
+ function br(e) {
408
+ return e === "gauge" ? {
409
+ start: -3 * Math.PI / 4,
410
+ sweep: 3 * Math.PI / 2
411
+ } : e === "half" ? {
412
+ start: -Math.PI / 2,
413
+ sweep: Math.PI
414
+ } : {
415
+ start: 0,
416
+ sweep: gr
417
+ };
418
+ }
419
+ function xr(e, t, n) {
420
+ if (!t?.length) return n;
421
+ let r = [...t].sort((e, t) => e.at - t.at), i = n;
422
+ for (let t of r) e >= t.at && (i = t.color);
423
+ return i;
424
+ }
425
+ function Sr(e, t) {
426
+ return !Y(e) || !Y(t) || t <= 0 ? 0 : Z(e / t * 100, 0, 100);
427
+ }
428
+ function $(e) {
429
+ return Y(e) ? e.toLocaleString("en-US", { maximumFractionDigits: 2 }) : "";
430
+ }
431
+ var Cr = [[1e8, "亿"], [1e4, "万"]], wr = [
432
+ [1e9, "B"],
433
+ [1e6, "M"],
434
+ [1e3, "K"]
435
+ ];
436
+ function Tr(e, t = Cr) {
437
+ if (!Y(e)) return "";
438
+ let n = Math.abs(e);
439
+ for (let [r, i] of t) if (n >= r) return `${Number((e / r).toFixed(2))}${i}`;
440
+ return $(e);
441
+ }
442
+ function Er(e) {
443
+ let t = mr(e);
444
+ if (!t) return null;
445
+ let n = -1;
446
+ return e.forEach((e, t) => {
447
+ Y(e) && (n = t);
448
+ }), {
449
+ count: e.filter(Y).length,
450
+ min: t[0],
451
+ max: t[1],
452
+ last: e[n],
453
+ lastIndex: n
454
+ };
455
+ }
456
+ function Dr(e) {
457
+ return `${Number((e * 100).toFixed(1))}%`;
458
+ }
459
+ function Or(e) {
460
+ let t = V(), n = V(0), r;
461
+ return Pt(() => {
462
+ let e = t.value;
463
+ e && (n.value = Math.round(e.getBoundingClientRect().width), typeof ResizeObserver < "u" && (r = new ResizeObserver((e) => {
464
+ let t = Math.round(e[e.length - 1]?.contentRect.width ?? 0);
465
+ t > 0 && (n.value = t);
466
+ }), r.observe(e)));
467
+ }), Mt(() => r?.disconnect()), {
468
+ el: t,
469
+ width: A(() => {
470
+ let t = e?.();
471
+ return t && t > 0 ? t : n.value > 0 ? n.value : 480;
472
+ })
473
+ };
474
+ }
475
+ function kr() {
476
+ let e = V(/* @__PURE__ */ new Set());
477
+ function t(t, n) {
478
+ let r = new Set(e.value);
479
+ r.has(t) ? r.delete(t) : n - r.size > 1 && r.add(t), e.value = r;
480
+ }
481
+ return {
482
+ hidden: e,
483
+ toggle: t
484
+ };
485
+ }
486
+ function Ar(e, t) {
487
+ return t ?? `var(--ca-chart-${e % 8 + 1})`;
488
+ }
489
+ // packages/ui/src/components/chart/parts/ChartLegend.vue?vue&type=script&setup=true&lang.ts
490
+ var jr = { class: "ca-chart__legend" }, Mr = /* @__PURE__ */ L({
491
+ __name: "ChartLegend",
492
+ props: {
493
+ items: {},
494
+ shape: {},
495
+ interactive: { type: Boolean }
496
+ },
497
+ emits: ["toggle"],
498
+ setup(e) {
499
+ return (t, n) => (B(), N("ul", jr, [(B(!0), N(k, null, H(e.items, (n, r) => (B(), N("li", { key: r }, [(B(), j(It(e.interactive ? "button" : "span"), {
500
+ class: R(["ca-chart__legend-item", { "is-off": n.off }]),
501
+ type: e.interactive ? "button" : void 0,
502
+ "aria-pressed": e.interactive ? !n.off : void 0,
503
+ onClick: (n) => e.interactive && t.$emit("toggle", r)
504
+ }, {
505
+ default: K(() => [P("span", {
506
+ class: R(["ca-chart__key", `ca-chart__key--${e.shape ?? "box"}`]),
507
+ style: z({ "--key": n.color })
508
+ }, null, 6), P("span", null, W(n.name), 1)]),
509
+ _: 2
510
+ }, 1032, [
511
+ "class",
512
+ "type",
513
+ "aria-pressed",
514
+ "onClick"
515
+ ]))]))), 128))]));
516
+ }
517
+ }), Nr = ["role"], Pr = /* @__PURE__ */ L({
518
+ __name: "ChartStatus",
519
+ props: {
520
+ loading: { type: Boolean },
521
+ empty: { type: Boolean }
522
+ },
523
+ setup(e) {
524
+ let t = J();
525
+ return (n, r) => e.loading || e.empty ? (B(), N("div", {
526
+ key: 0,
527
+ class: "ca-chart__status",
528
+ role: e.loading ? "status" : void 0
529
+ }, W(e.loading ? G(t)("campus.chart.loading") : G(t)("campus.chart.empty")), 9, Nr)) : M("v-if", !0);
530
+ }
531
+ }), Fr = { class: "ca-chart__sr" }, Ir = { key: 0 }, Lr = { scope: "row" }, Rr = /* @__PURE__ */ L({
532
+ __name: "ChartTable",
533
+ props: {
534
+ caption: {},
535
+ head: {},
536
+ rows: {}
537
+ },
538
+ setup(e) {
539
+ return (t, n) => (B(), N("div", Fr, [P("table", null, [
540
+ e.caption ? (B(), N("caption", Ir, W(e.caption), 1)) : M("v-if", !0),
541
+ P("thead", null, [P("tr", null, [(B(!0), N(k, null, H(e.head, (e, t) => (B(), N("th", {
542
+ key: t,
543
+ scope: "col"
544
+ }, W(e), 1))), 128))])]),
545
+ P("tbody", null, [(B(!0), N(k, null, H(e.rows, (e, t) => (B(), N("tr", { key: t }, [P("th", Lr, W(e[0]), 1), (B(!0), N(k, null, H(e.slice(1), (e, t) => (B(), N("td", { key: t }, W(e), 1))), 128))]))), 128))])
546
+ ])]));
547
+ }
548
+ }), zr = {
549
+ key: 0,
550
+ class: "ca-chart__tip-title"
551
+ }, Br = { class: "ca-chart__tip-name" }, Vr = { class: "ca-chart__tip-value" }, Hr = /* @__PURE__ */ L({
552
+ __name: "ChartTooltip",
553
+ props: {
554
+ x: {},
555
+ y: {},
556
+ width: {},
557
+ title: {},
558
+ rows: {}
559
+ },
560
+ setup(e) {
561
+ return (t, n) => (B(), N("div", {
562
+ class: "ca-chart__tip",
563
+ style: z({
564
+ left: `${e.x}px`,
565
+ top: `${e.y}px`,
566
+ transform: e.x > e.width / 2 ? "translateX(calc(-100% - 12px))" : "translateX(12px)"
567
+ })
568
+ }, [e.title ? (B(), N("div", zr, W(e.title), 1)) : M("v-if", !0), (B(!0), N(k, null, H(e.rows, (e, t) => (B(), N("div", {
569
+ key: t,
570
+ class: "ca-chart__tip-row"
571
+ }, [
572
+ P("span", {
573
+ class: "ca-chart__key",
574
+ style: z({ "--key": e.color })
575
+ }, null, 4),
576
+ P("span", Br, W(e.name), 1),
577
+ P("span", Vr, W(e.value), 1)
578
+ ]))), 128))], 4));
579
+ }
580
+ }), Ur = ["aria-busy"], Wr = { class: "ca-chart__canvas" }, Gr = [
581
+ "aria-label",
582
+ "width",
583
+ "height",
584
+ "viewBox"
585
+ ], Kr = [
586
+ "x1",
587
+ "x2",
588
+ "y1",
589
+ "y2"
590
+ ], qr = ["x", "y"], Jr = [
591
+ "x1",
592
+ "x2",
593
+ "y1",
594
+ "y2"
595
+ ], Yr = [
596
+ "x",
597
+ "y",
598
+ "text-anchor"
599
+ ], Xr = [
600
+ "x1",
601
+ "x2",
602
+ "y1",
603
+ "y2"
604
+ ], Zr = { class: "ca-chart__reveal" }, Qr = ["d"], $r = ["d"], ei = { class: "ca-chart__fade" }, ti = ["cx", "cy"], ni = ["cx", "cy"], ri = 400, ii = /* @__PURE__ */ L({
605
+ __name: "CaLineChart",
606
+ props: {
607
+ categories: {},
608
+ series: {},
609
+ height: { default: 260 },
610
+ width: {},
611
+ smooth: {
612
+ type: Boolean,
613
+ default: !1
614
+ },
615
+ area: {
616
+ type: Boolean,
617
+ default: !1
618
+ },
619
+ zero: {
620
+ type: Boolean,
621
+ default: !0
622
+ },
623
+ legend: {
624
+ type: Boolean,
625
+ default: void 0
626
+ },
627
+ loading: { type: Boolean },
628
+ title: {},
629
+ yFormatter: {},
630
+ valueFormatter: {},
631
+ yMin: {},
632
+ yMax: {},
633
+ animated: {
634
+ type: Boolean,
635
+ default: !0
636
+ }
637
+ },
638
+ setup(e) {
639
+ let t = e, n = J(), { el: r, width: i } = Or(() => t.width), { hidden: a, toggle: o } = kr(), s = A(() => t.categories.length), c = A(() => t.series.map((e, t) => ({
640
+ index: t,
641
+ name: e.name,
642
+ data: e.data.slice(0, s.value),
643
+ color: Ar(t, e.color)
644
+ }))), l = A(() => c.value.filter((e) => !a.value.has(e.index))), u = A(() => s.value > 0 && c.value.some((e) => mr(e.data))), d = (e) => (t.valueFormatter ?? $)(e), f = A(() => n("campus.chart.compact") === "latin" ? wr : Cr), p = (e) => (t.yFormatter ?? ((e) => Tr(e, f.value)))(e), m = A(() => {
645
+ let e = mr(l.value.flatMap((e) => e.data)) ?? [0, 1];
646
+ return rr(t.yMin ?? e[0], t.yMax ?? e[1], 5, t.area || t.zero);
647
+ }), h = A(() => m.value.ticks.map((e) => ({
648
+ tick: e,
649
+ text: p(e)
650
+ }))), g = A(() => Math.max(32, Math.max(...h.value.map((e) => e.text.length)) * 7 + 14)), _ = {
651
+ top: 12,
652
+ right: 16,
653
+ bottom: 28
654
+ }, v = A(() => Math.max(10, i.value - g.value - _.right)), y = A(() => Math.max(10, t.height - _.top - _.bottom)), b = A(() => ir(m.value.min, m.value.max, _.top + y.value, _.top)), x = A(() => {
655
+ let e = ar(s.value, g.value, g.value + v.value, 0);
656
+ return Array.from({ length: s.value }, (t, n) => e.center(n));
657
+ }), S = A(() => b.value(Math.max(m.value.min, Math.min(0, m.value.max)))), C = A(() => {
658
+ let e = Math.max(1, ...t.categories.map((e) => e.length));
659
+ return or(s.value, v.value, Math.max(40, e * 7 + 16)).map((e) => {
660
+ let n = x.value[e], r = n - g.value < 20 ? "start" : i.value - n < 20 ? "end" : "middle";
661
+ return {
662
+ i: e,
663
+ x: n,
664
+ text: t.categories[e],
665
+ anchor: r
666
+ };
667
+ });
668
+ }), ee = A(() => l.value.map((e) => {
669
+ let n = e.data.map((e, t) => Y(e) ? {
670
+ x: x.value[t],
671
+ y: b.value(e)
672
+ } : null), r = e.data.reduce((e, t, n) => Y(t) ? n : e, -1);
673
+ return {
674
+ ...e,
675
+ line: dr(n, t.smooth),
676
+ area: t.area ? fr(n, S.value, t.smooth) : "",
677
+ end: r >= 0 ? n[r] : null,
678
+ points: n
679
+ };
680
+ })), w = V(-1);
681
+ function T(e) {
682
+ let t = e.currentTarget.getBoundingClientRect();
683
+ w.value = sr(x.value, e.clientX - t.left);
684
+ }
685
+ function te(e) {
686
+ let t = s.value - 1, n = w.value;
687
+ if (e.key === "ArrowRight") n = w.value < 0 ? 0 : Math.min(t, w.value + 1);
688
+ else if (e.key === "ArrowLeft") n = w.value < 0 ? t : Math.max(0, w.value - 1);
689
+ else if (e.key === "Home") n = 0;
690
+ else if (e.key === "End") n = t;
691
+ else if (e.key === "Escape") n = -1;
692
+ else return;
693
+ e.preventDefault(), w.value = n;
694
+ }
695
+ function ne(e) {
696
+ e.target.matches?.(":focus-visible") && w.value < 0 && (w.value = Math.max(0, s.value - 1));
697
+ }
698
+ let E = A(() => {
699
+ let e = w.value;
700
+ return e < 0 || e >= s.value ? null : {
701
+ x: x.value[e],
702
+ title: t.categories[e],
703
+ rows: l.value.map((t) => ({
704
+ name: t.name,
705
+ color: t.color,
706
+ value: Y(t.data[e]) ? d(t.data[e]) : "—"
707
+ }))
708
+ };
709
+ }), re = A(() => t.legend ?? t.series.length > 1), D = A(() => c.value.map((e) => ({
710
+ name: e.name,
711
+ color: e.color,
712
+ off: a.value.has(e.index)
713
+ }))), O = A(() => {
714
+ let e = [n("campus.chart.summaryLine", {
715
+ title: t.title ?? "",
716
+ categories: s.value,
717
+ series: c.value.length
718
+ })];
719
+ for (let r of c.value.slice(0, 6)) {
720
+ let i = Er(r.data);
721
+ i && e.push(n("campus.chart.summarySeries", {
722
+ name: r.name,
723
+ min: d(i.min),
724
+ max: d(i.max),
725
+ last: d(i.last),
726
+ category: t.categories[i.lastIndex] ?? ""
727
+ }));
728
+ }
729
+ return e.join(" ");
730
+ }), ie = A(() => t.categories.slice(0, ri).map((e, t) => [e, ...c.value.map((e) => Y(e.data[t]) ? d(e.data[t]) : "")])), ae = A(() => [n("campus.chart.category"), ...c.value.map((e) => e.name)]);
731
+ return (t, n) => (B(), N("div", {
732
+ ref_key: "el",
733
+ ref: r,
734
+ class: R(["ca-chart ca-line-chart", {
735
+ "is-loading": e.loading,
736
+ "is-animated": e.animated
737
+ }]),
738
+ "aria-busy": e.loading || void 0
739
+ }, [
740
+ re.value && u.value ? (B(), j(Mr, {
741
+ key: 0,
742
+ items: D.value,
743
+ shape: "line",
744
+ interactive: "",
745
+ onToggle: n[0] ||= (e) => G(o)(e, c.value.length)
746
+ }, null, 8, ["items"])) : M("v-if", !0),
747
+ P("div", {
748
+ class: "ca-chart__plot",
749
+ style: z({ height: `${e.height}px` })
750
+ }, [
751
+ P("div", Wr, [u.value ? (B(), N("svg", {
752
+ key: 0,
753
+ class: "ca-chart__svg",
754
+ role: "img",
755
+ tabindex: "0",
756
+ "aria-label": O.value,
757
+ width: G(i),
758
+ height: e.height,
759
+ viewBox: `0 0 ${G(i)} ${e.height}`,
760
+ onPointermove: T,
761
+ onPointerdown: T,
762
+ onPointerleave: n[1] ||= (e) => w.value = -1,
763
+ onKeydown: te,
764
+ onFocus: ne,
765
+ onBlur: n[2] ||= (e) => w.value = -1
766
+ }, [
767
+ M(" 网格与纵轴刻度 "),
768
+ P("g", null, [
769
+ (B(!0), N(k, null, H(h.value, (e) => (B(), N(k, { key: e.tick }, [P("line", {
770
+ class: R(e.tick === m.value.min ? "ca-chart__baseline" : "ca-chart__grid"),
771
+ x1: g.value,
772
+ x2: g.value + v.value,
773
+ y1: b.value(e.tick),
774
+ y2: b.value(e.tick)
775
+ }, null, 10, Kr), P("text", {
776
+ class: "ca-chart__tick",
777
+ x: g.value - 8,
778
+ y: b.value(e.tick),
779
+ dy: "0.32em",
780
+ "text-anchor": "end"
781
+ }, W(e.text), 9, qr)], 64))), 128)),
782
+ M(" 有负值时,0 线单独加深,表示正负分界 "),
783
+ m.value.min < 0 ? (B(), N("line", {
784
+ key: 0,
785
+ class: "ca-chart__baseline",
786
+ x1: g.value,
787
+ x2: g.value + v.value,
788
+ y1: b.value(0),
789
+ y2: b.value(0)
790
+ }, null, 8, Jr)) : M("v-if", !0)
791
+ ]),
792
+ P("g", null, [(B(!0), N(k, null, H(C.value, (e) => (B(), N("text", {
793
+ key: e.i,
794
+ class: "ca-chart__tick",
795
+ x: e.x,
796
+ y: _.top + y.value + 18,
797
+ "text-anchor": e.anchor
798
+ }, W(e.text), 9, Yr))), 128))]),
799
+ M(" 悬停十字线:贴着最近的数据位置,读者只需要瞄准某个类目 "),
800
+ E.value ? (B(), N("line", {
801
+ key: 0,
802
+ class: "ca-chart__cross",
803
+ x1: E.value.x,
804
+ x2: E.value.x,
805
+ y1: _.top,
806
+ y2: _.top + y.value
807
+ }, null, 8, Xr)) : M("v-if", !0),
808
+ M(" 数据 "),
809
+ P("g", Zr, [(B(!0), N(k, null, H(ee.value, (e) => (B(), N(k, { key: e.index }, [e.area ? (B(), N("path", {
810
+ key: 0,
811
+ class: "ca-chart__area",
812
+ d: e.area,
813
+ style: z({ fill: e.color })
814
+ }, null, 12, Qr)) : M("v-if", !0), P("path", {
815
+ class: "ca-chart__line",
816
+ d: e.line,
817
+ style: z({ stroke: e.color })
818
+ }, null, 12, $r)], 64))), 128))]),
819
+ P("g", ei, [M(" 没有悬停时在每条线末端放一个点,帮助读出“最新值” "), E.value ? (B(!0), N(k, { key: 1 }, H(ee.value, (e) => (B(), N(k, { key: e.index }, [e.points[w.value] ? (B(), N("circle", {
820
+ key: 0,
821
+ class: "ca-chart__dot",
822
+ cx: e.points[w.value].x,
823
+ cy: e.points[w.value].y,
824
+ r: "4.5",
825
+ style: z({ fill: e.color })
826
+ }, null, 12, ni)) : M("v-if", !0)], 64))), 128)) : (B(!0), N(k, { key: 0 }, H(ee.value, (e) => Vt((B(), N("circle", {
827
+ key: e.index,
828
+ class: "ca-chart__dot",
829
+ cx: e.end?.x,
830
+ cy: e.end?.y,
831
+ r: "4",
832
+ style: z({ fill: e.color })
833
+ }, null, 12, ti)), [[zt, e.end]])), 128))])
834
+ ], 40, Gr)) : M("v-if", !0)]),
835
+ E.value ? (B(), j(Hr, {
836
+ key: 0,
837
+ x: E.value.x,
838
+ y: _.top,
839
+ width: G(i),
840
+ title: E.value.title,
841
+ rows: E.value.rows
842
+ }, null, 8, [
843
+ "x",
844
+ "y",
845
+ "width",
846
+ "title",
847
+ "rows"
848
+ ])) : M("v-if", !0),
849
+ I(Pr, {
850
+ loading: e.loading,
851
+ empty: !u.value && !e.loading
852
+ }, null, 8, ["loading", "empty"])
853
+ ], 4),
854
+ u.value ? (B(), j(Rr, {
855
+ key: 1,
856
+ caption: e.title,
857
+ head: ae.value,
858
+ rows: ie.value
859
+ }, null, 8, [
860
+ "caption",
861
+ "head",
862
+ "rows"
863
+ ])) : M("v-if", !0)
864
+ ], 10, Ur));
865
+ }
866
+ }), ai = ["aria-busy"], oi = { class: "ca-chart__canvas" }, si = [
867
+ "aria-label",
868
+ "width",
869
+ "height",
870
+ "viewBox"
871
+ ], ci = { key: 0 }, li = [
872
+ "x1",
873
+ "x2",
874
+ "y1",
875
+ "y2"
876
+ ], ui = ["x", "y"], di = { key: 1 }, fi = [
877
+ "x1",
878
+ "x2",
879
+ "y1",
880
+ "y2"
881
+ ], pi = ["x", "y"], mi = ["x", "y"], hi = ["x", "y"], gi = [
882
+ "x",
883
+ "y",
884
+ "width",
885
+ "height"
886
+ ], _i = ["d"], vi = { class: "ca-chart__fade" }, yi = [
887
+ "x",
888
+ "y",
889
+ "text-anchor"
890
+ ], bi = 2, xi = 4, Si = 400, Ci = /* @__PURE__ */ L({
891
+ __name: "CaBarChart",
892
+ props: {
893
+ categories: {},
894
+ series: {},
895
+ height: { default: 260 },
896
+ width: {},
897
+ stacked: {
898
+ type: Boolean,
899
+ default: !1
900
+ },
901
+ horizontal: {
902
+ type: Boolean,
903
+ default: !1
904
+ },
905
+ showValues: {
906
+ type: Boolean,
907
+ default: !1
908
+ },
909
+ barSize: { default: 24 },
910
+ legend: {
911
+ type: Boolean,
912
+ default: void 0
913
+ },
914
+ loading: { type: Boolean },
915
+ title: {},
916
+ yFormatter: {},
917
+ valueFormatter: {},
918
+ animated: {
919
+ type: Boolean,
920
+ default: !0
921
+ }
922
+ },
923
+ setup(e) {
924
+ let t = e, n = J(), { el: r, width: i } = Or(() => t.width), { hidden: a, toggle: o } = kr(), s = A(() => t.categories.length), c = A(() => t.series.map((e, t) => ({
925
+ index: t,
926
+ name: e.name,
927
+ data: e.data.slice(0, s.value),
928
+ color: Ar(t, e.color)
929
+ }))), l = A(() => c.value.filter((e) => !a.value.has(e.index))), u = A(() => s.value > 0 && c.value.some((e) => mr(e.data))), d = (e) => (t.valueFormatter ?? $)(e), f = A(() => n("campus.chart.compact") === "latin" ? wr : Cr), p = (e) => (t.yFormatter ?? ((e) => Tr(e, f.value)))(e), m = A(() => pr(l.value.map((e) => e.data))), h = A(() => {
930
+ let e = [];
931
+ if (t.stacked) for (let t of m.value) for (let n of t) n && e.push(n.from, n.to);
932
+ else for (let t of l.value) for (let n of t.data) Y(n) && e.push(n);
933
+ let n = mr(e) ?? [0, 1];
934
+ return rr(n[0], n[1], 5, !0);
935
+ }), g = A(() => h.value.ticks.map((e) => ({
936
+ tick: e,
937
+ text: p(e)
938
+ }))), _ = A(() => {
939
+ let e = 12 + (t.showValues && !t.horizontal ? 14 : 0);
940
+ if (!t.horizontal) return {
941
+ top: e,
942
+ right: 16,
943
+ bottom: 28,
944
+ left: Math.max(32, Math.max(...g.value.map((e) => e.text.length)) * 7 + 14)
945
+ };
946
+ let n = Z(Math.max(1, ...t.categories.map((e) => e.length)) * 13 + 16, 48, Math.max(48, i.value * .4));
947
+ return {
948
+ top: e,
949
+ right: t.showValues ? 56 : 24,
950
+ bottom: 28,
951
+ left: n
952
+ };
953
+ }), v = A(() => Math.max(10, i.value - _.value.left - _.value.right)), y = A(() => Math.max(10, t.height - _.value.top - _.value.bottom)), b = A(() => t.horizontal ? ir(h.value.min, h.value.max, _.value.left, _.value.left + v.value) : ir(h.value.min, h.value.max, _.value.top + y.value, _.value.top)), x = A(() => t.horizontal ? ar(s.value, _.value.top, _.value.top + y.value, .3) : ar(s.value, _.value.left, _.value.left + v.value, .3));
954
+ A(() => b.value(0));
955
+ function S(e) {
956
+ if (!t.horizontal) return e;
957
+ let n = Math.max(2, Math.floor((_.value.left - 16) / 13));
958
+ return e.length > n ? `${e.slice(0, n - 1)}…` : e;
959
+ }
960
+ let C = A(() => {
961
+ if (t.horizontal) return t.categories.map((e, t) => ({
962
+ i: t,
963
+ text: S(e),
964
+ pos: x.value.center(t)
965
+ }));
966
+ let e = Math.max(1, ...t.categories.map((e) => e.length));
967
+ return or(s.value, v.value, Math.max(40, e * 7 + 16)).map((e) => ({
968
+ i: e,
969
+ text: t.categories[e],
970
+ pos: x.value.center(e)
971
+ }));
972
+ }), ee = (e) => e.length * 6.5, w = A(() => {
973
+ let e = [], n = [], r = l.value.length, i = t.barSize, a = t.stacked ? x.value.bandwidth : (x.value.bandwidth - bi * (r - 1)) / r, o = Math.max(1, Math.min(i, a)), c = t.stacked ? o : o * r + bi * (r - 1), u = Array.from({ length: s.value }, (e, t) => {
974
+ let n = 0, r = 0;
975
+ for (let e of m.value) {
976
+ let i = e[t];
977
+ i && (n = Math.max(n, i.to), r = Math.min(r, i.to));
978
+ }
979
+ return {
980
+ top: n,
981
+ bottom: r
982
+ };
983
+ });
984
+ return l.value.forEach((r, i) => {
985
+ for (let l = 0; l < s.value; l++) {
986
+ let s = r.data[l];
987
+ if (!Y(s)) continue;
988
+ let f = x.value.center(l) - c / 2 + (t.stacked ? 0 : i * (o + bi)), p = 0, h = s;
989
+ if (t.stacked) {
990
+ let e = m.value[i][l];
991
+ if (!e) continue;
992
+ p = e.from, h = e.to;
993
+ }
994
+ let g = s >= 0, _ = t.stacked && p !== 0 ? bi : 0, v = b.value(p), y = b.value(h), S = !t.stacked || (g ? h === u[l].top : h === u[l].bottom), C = S ? xi : 0, w, T;
995
+ if (t.horizontal) {
996
+ let e = Math.min(v, y) + (g ? _ : 0), t = Math.max(v, y) - (g ? 0 : _), n = Math.max(t - e, s === 0 ? 0 : 1);
997
+ w = hr(g ? e : t - n, f, n, o, C, g ? "right" : "left"), T = g ? "0% 50%" : "100% 50%";
998
+ } else {
999
+ let e = Math.min(v, y) + (g ? 0 : _), t = Math.max(v, y) - (g ? _ : 0), n = Math.max(t - e, s === 0 ? 0 : 1);
1000
+ w = hr(f, g ? t - n : e, o, n, C, g ? "top" : "bottom"), T = g ? "50% 100%" : "50% 0%";
1001
+ }
1002
+ if (e.push({
1003
+ key: `${r.index}-${l}`,
1004
+ d: w,
1005
+ color: r.color,
1006
+ origin: T
1007
+ }), t.showValues && (!t.stacked || S)) {
1008
+ let e = t.stacked ? g ? u[l].top : u[l].bottom : s, i = d(e);
1009
+ if (t.horizontal) {
1010
+ let t = b.value(e);
1011
+ n.push({
1012
+ key: `${r.index}-${l}`,
1013
+ x: t + (g ? 6 : -6),
1014
+ y: f + o / 2 + 4,
1015
+ text: i,
1016
+ anchor: "start"
1017
+ });
1018
+ } else {
1019
+ let s = t.stacked ? x.value.step : o + 4 + (a - o);
1020
+ if (ee(i) <= s) {
1021
+ let t = b.value(e);
1022
+ n.push({
1023
+ key: `${r.index}-${l}`,
1024
+ x: f + o / 2,
1025
+ y: g ? t - 5 : t + 15,
1026
+ text: i,
1027
+ anchor: "middle"
1028
+ });
1029
+ }
1030
+ }
1031
+ }
1032
+ }
1033
+ }), {
1034
+ bars: e,
1035
+ labels: n
1036
+ };
1037
+ }), T = V(-1), te = V(0);
1038
+ function ne(e) {
1039
+ let n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = t.horizontal ? i : r, o = t.horizontal ? _.value.top : _.value.left, c = Math.floor((a - o) / x.value.step);
1040
+ T.value = c >= 0 && c < s.value ? c : -1, te.value = r;
1041
+ }
1042
+ function E(e) {
1043
+ let n = s.value - 1, r = T.value;
1044
+ if (e.key === "ArrowRight" || e.key === "ArrowDown") r = T.value < 0 ? 0 : Math.min(n, T.value + 1);
1045
+ else if (e.key === "ArrowLeft" || e.key === "ArrowUp") r = T.value < 0 ? n : Math.max(0, T.value - 1);
1046
+ else if (e.key === "Home") r = 0;
1047
+ else if (e.key === "End") r = n;
1048
+ else if (e.key === "Escape") r = -1;
1049
+ else return;
1050
+ e.preventDefault(), T.value = r, r >= 0 && !t.horizontal && (te.value = x.value.center(r)), r >= 0 && t.horizontal && (te.value = _.value.left + v.value / 2);
1051
+ }
1052
+ function re(e) {
1053
+ e.target.matches?.(":focus-visible") && T.value < 0 && E(new KeyboardEvent("keydown", { key: "Home" }));
1054
+ }
1055
+ let D = A(() => {
1056
+ let e = T.value;
1057
+ if (e < 0 || e >= s.value) return null;
1058
+ let n = x.value.center(e);
1059
+ return {
1060
+ x: t.horizontal ? Z(te.value, _.value.left, _.value.left + v.value) : n,
1061
+ y: t.horizontal ? n : _.value.top,
1062
+ title: t.categories[e],
1063
+ rows: l.value.map((t) => ({
1064
+ name: t.name,
1065
+ color: t.color,
1066
+ value: Y(t.data[e]) ? d(t.data[e]) : "—"
1067
+ }))
1068
+ };
1069
+ }), O = A(() => {
1070
+ if (!D.value) return null;
1071
+ let e = T.value;
1072
+ return t.horizontal ? {
1073
+ x: _.value.left,
1074
+ y: x.value.center(e) - x.value.step / 2,
1075
+ w: v.value,
1076
+ h: x.value.step
1077
+ } : {
1078
+ x: x.value.center(e) - x.value.step / 2,
1079
+ y: _.value.top,
1080
+ w: x.value.step,
1081
+ h: y.value
1082
+ };
1083
+ }), ie = A(() => t.legend ?? t.series.length > 1), ae = A(() => c.value.map((e) => ({
1084
+ name: e.name,
1085
+ color: e.color,
1086
+ off: a.value.has(e.index)
1087
+ }))), oe = A(() => {
1088
+ let e = [n("campus.chart.summaryBar", {
1089
+ title: t.title ?? "",
1090
+ categories: s.value,
1091
+ series: c.value.length
1092
+ })];
1093
+ for (let r of c.value.slice(0, 6)) {
1094
+ let i = Er(r.data);
1095
+ i && e.push(n("campus.chart.summarySeries", {
1096
+ name: r.name,
1097
+ min: d(i.min),
1098
+ max: d(i.max),
1099
+ last: d(i.last),
1100
+ category: t.categories[i.lastIndex] ?? ""
1101
+ }));
1102
+ }
1103
+ return e.join(" ");
1104
+ }), se = A(() => t.categories.slice(0, Si).map((e, t) => [e, ...c.value.map((e) => Y(e.data[t]) ? d(e.data[t]) : "")])), ce = A(() => [n("campus.chart.category"), ...c.value.map((e) => e.name)]);
1105
+ return (t, n) => (B(), N("div", {
1106
+ ref_key: "el",
1107
+ ref: r,
1108
+ class: R(["ca-chart ca-bar-chart", {
1109
+ "is-loading": e.loading,
1110
+ "is-animated": e.animated
1111
+ }]),
1112
+ "aria-busy": e.loading || void 0
1113
+ }, [
1114
+ ie.value && u.value ? (B(), j(Mr, {
1115
+ key: 0,
1116
+ items: ae.value,
1117
+ interactive: "",
1118
+ onToggle: n[0] ||= (e) => G(o)(e, c.value.length)
1119
+ }, null, 8, ["items"])) : M("v-if", !0),
1120
+ P("div", {
1121
+ class: "ca-chart__plot",
1122
+ style: z({ height: `${e.height}px` })
1123
+ }, [
1124
+ P("div", oi, [u.value ? (B(), N("svg", {
1125
+ key: 0,
1126
+ class: "ca-chart__svg",
1127
+ role: "img",
1128
+ tabindex: "0",
1129
+ "aria-label": oe.value,
1130
+ width: G(i),
1131
+ height: e.height,
1132
+ viewBox: `0 0 ${G(i)} ${e.height}`,
1133
+ onPointermove: ne,
1134
+ onPointerdown: ne,
1135
+ onPointerleave: n[1] ||= (e) => T.value = -1,
1136
+ onKeydown: E,
1137
+ onFocus: re,
1138
+ onBlur: n[2] ||= (e) => T.value = -1
1139
+ }, [
1140
+ M(" 数值轴的网格与刻度 "),
1141
+ e.horizontal ? (B(), N("g", di, [(B(!0), N(k, null, H(g.value, (e) => (B(), N(k, { key: e.tick }, [P("line", {
1142
+ class: R(e.tick === 0 ? "ca-chart__baseline" : "ca-chart__grid"),
1143
+ x1: b.value(e.tick),
1144
+ x2: b.value(e.tick),
1145
+ y1: _.value.top,
1146
+ y2: _.value.top + y.value
1147
+ }, null, 10, fi), P("text", {
1148
+ class: "ca-chart__tick",
1149
+ x: b.value(e.tick),
1150
+ y: _.value.top + y.value + 18,
1151
+ "text-anchor": "middle"
1152
+ }, W(e.text), 9, pi)], 64))), 128))])) : (B(), N("g", ci, [(B(!0), N(k, null, H(g.value, (e) => (B(), N(k, { key: e.tick }, [P("line", {
1153
+ class: R(e.tick === 0 ? "ca-chart__baseline" : "ca-chart__grid"),
1154
+ x1: _.value.left,
1155
+ x2: _.value.left + v.value,
1156
+ y1: b.value(e.tick),
1157
+ y2: b.value(e.tick)
1158
+ }, null, 10, li), P("text", {
1159
+ class: "ca-chart__tick",
1160
+ x: _.value.left - 8,
1161
+ y: b.value(e.tick),
1162
+ dy: "0.32em",
1163
+ "text-anchor": "end"
1164
+ }, W(e.text), 9, ui)], 64))), 128))])),
1165
+ M(" 类目轴标签 "),
1166
+ P("g", null, [e.horizontal ? (B(!0), N(k, { key: 1 }, H(C.value, (e) => (B(), N("text", {
1167
+ key: e.i,
1168
+ class: "ca-chart__tick",
1169
+ x: _.value.left - 8,
1170
+ y: e.pos,
1171
+ dy: "0.32em",
1172
+ "text-anchor": "end"
1173
+ }, W(e.text), 9, hi))), 128)) : (B(!0), N(k, { key: 0 }, H(C.value, (e) => (B(), N("text", {
1174
+ key: e.i,
1175
+ class: "ca-chart__tick",
1176
+ x: e.pos,
1177
+ y: _.value.top + y.value + 18,
1178
+ "text-anchor": "middle"
1179
+ }, W(e.text), 9, mi))), 128))]),
1180
+ O.value ? (B(), N("rect", {
1181
+ key: 2,
1182
+ class: "ca-chart__band",
1183
+ x: O.value.x,
1184
+ y: O.value.y,
1185
+ width: O.value.w,
1186
+ height: O.value.h
1187
+ }, null, 8, gi)) : M("v-if", !0),
1188
+ P("g", null, [(B(!0), N(k, null, H(w.value.bars, (t) => (B(), N("path", {
1189
+ key: t.key,
1190
+ class: R(["ca-chart__bar", e.horizontal ? "ca-chart__grow-x" : "ca-chart__grow-y"]),
1191
+ d: t.d,
1192
+ style: z({
1193
+ fill: t.color,
1194
+ transformOrigin: t.origin
1195
+ })
1196
+ }, null, 14, _i))), 128))]),
1197
+ P("g", vi, [(B(!0), N(k, null, H(w.value.labels, (e) => (B(), N("text", {
1198
+ key: e.key,
1199
+ class: "ca-chart__value",
1200
+ x: e.x,
1201
+ y: e.y,
1202
+ "text-anchor": e.anchor
1203
+ }, W(e.text), 9, yi))), 128))])
1204
+ ], 40, si)) : M("v-if", !0)]),
1205
+ D.value ? (B(), j(Hr, {
1206
+ key: 0,
1207
+ x: D.value.x,
1208
+ y: D.value.y,
1209
+ width: G(i),
1210
+ title: D.value.title,
1211
+ rows: D.value.rows
1212
+ }, null, 8, [
1213
+ "x",
1214
+ "y",
1215
+ "width",
1216
+ "title",
1217
+ "rows"
1218
+ ])) : M("v-if", !0),
1219
+ I(Pr, {
1220
+ loading: e.loading,
1221
+ empty: !u.value && !e.loading
1222
+ }, null, 8, ["loading", "empty"])
1223
+ ], 4),
1224
+ u.value ? (B(), j(Rr, {
1225
+ key: 1,
1226
+ caption: e.title,
1227
+ head: ce.value,
1228
+ rows: se.value
1229
+ }, null, 8, [
1230
+ "caption",
1231
+ "head",
1232
+ "rows"
1233
+ ])) : M("v-if", !0)
1234
+ ], 10, ai));
1235
+ }
1236
+ }), wi = ["aria-busy"], Ti = { class: "ca-pie-chart__body" }, Ei = { class: "ca-chart__canvas" }, Di = [
1237
+ "aria-label",
1238
+ "width",
1239
+ "height",
1240
+ "viewBox"
1241
+ ], Oi = { class: "ca-chart__fade" }, ki = ["d", "onPointerenter"], Ai = { class: "ca-pie-chart__label" }, ji = {
1242
+ key: 0,
1243
+ class: "ca-pie-chart__sub"
1244
+ }, Mi = {
1245
+ key: 0,
1246
+ class: "ca-pie-chart__legend"
1247
+ }, Ni = ["onPointerenter"], Pi = { class: "ca-pie-chart__name" }, Fi = { class: "ca-pie-chart__num" }, Ii = { class: "ca-pie-chart__pct" }, Li = 6, Ri = /*@__PURE__*/ L({
1248
+ __name: "CaPieChart",
1249
+ props: {
1250
+ items: {},
1251
+ donut: {
1252
+ type: Boolean,
1253
+ default: !1
1254
+ },
1255
+ size: { default: 180 },
1256
+ centerLabel: {},
1257
+ centerValue: {},
1258
+ legend: {
1259
+ type: Boolean,
1260
+ default: !0
1261
+ },
1262
+ loading: { type: Boolean },
1263
+ title: {},
1264
+ valueFormatter: {},
1265
+ animated: {
1266
+ type: Boolean,
1267
+ default: !0
1268
+ }
1269
+ },
1270
+ setup(e) {
1271
+ let t = e, n = J(), { el: r, width: i } = Or(), a = (e) => (t.valueFormatter ?? $)(e), o = A(() => Z(Math.min(t.size, i.value), 96, t.size)), s = A(() => o.value / 2 - Li), c = A(() => t.donut ? s.value * .64 : 0), l = A(() => t.items.map((e, t) => ({
1272
+ index: t,
1273
+ name: e.name,
1274
+ value: Y(e.value) ? e.value : 0,
1275
+ color: Ar(t, e.color)
1276
+ }))), u = A(() => _r(l.value.map((e) => e.value))), d = A(() => l.value.reduce((e, t) => e + (t.value > 0 ? t.value : 0), 0)), f = A(() => u.value.length > 0), p = V(-1), m = A(() => u.value.filter((e) => e.end > e.start).map((e) => {
1277
+ let t = l.value[e.index], n = p.value === e.index ? 4 : 0;
1278
+ return {
1279
+ ...e,
1280
+ name: t.name,
1281
+ color: t.color,
1282
+ d: vr(o.value / 2, o.value / 2, s.value + n, c.value, e.start, e.end)
1283
+ };
1284
+ })), h = (e) => u.value[e]?.ratio ?? 0, g = A(() => {
1285
+ let e = p.value;
1286
+ return e >= 0 && l.value[e] ? {
1287
+ label: l.value[e].name,
1288
+ value: a(l.value[e].value),
1289
+ sub: Dr(h(e))
1290
+ } : {
1291
+ label: t.centerLabel ?? n("campus.chart.total"),
1292
+ value: t.centerValue ?? a(d.value),
1293
+ sub: ""
1294
+ };
1295
+ }), _ = V({
1296
+ x: 0,
1297
+ y: 0
1298
+ });
1299
+ function v(e) {
1300
+ let t = e.currentTarget.closest("svg").getBoundingClientRect();
1301
+ _.value = {
1302
+ x: e.clientX - t.left,
1303
+ y: e.clientY - t.top
1304
+ };
1305
+ }
1306
+ let y = A(() => {
1307
+ if (t.donut || p.value < 0 || !l.value[p.value]) return null;
1308
+ let e = l.value[p.value];
1309
+ return {
1310
+ x: _.value.x,
1311
+ y: _.value.y,
1312
+ title: e.name,
1313
+ rows: [{
1314
+ name: Dr(h(p.value)),
1315
+ color: e.color,
1316
+ value: a(e.value)
1317
+ }]
1318
+ };
1319
+ });
1320
+ function b(e) {
1321
+ let t = m.value.map((e) => e.index);
1322
+ if (!t.length) return;
1323
+ let n = t.indexOf(p.value), r = p.value;
1324
+ if (e.key === "ArrowRight" || e.key === "ArrowDown") r = t[n < 0 ? 0 : Math.min(t.length - 1, n + 1)];
1325
+ else if (e.key === "ArrowLeft" || e.key === "ArrowUp") r = t[n < 0 ? t.length - 1 : Math.max(0, n - 1)];
1326
+ else if (e.key === "Escape") r = -1;
1327
+ else return;
1328
+ e.preventDefault(), p.value = r;
1329
+ let i = u.value[r];
1330
+ i && (_.value = Q(o.value / 2, o.value / 2, (s.value + c.value) / 2, (i.start + i.end) / 2));
1331
+ }
1332
+ function x(e) {
1333
+ e.target.matches?.(":focus-visible") && p.value < 0 && b(new KeyboardEvent("keydown", { key: "ArrowRight" }));
1334
+ }
1335
+ let S = A(() => Z(Math.floor(c.value * 1.7 / Math.max(1, g.value.value.length * .62)), 13, 22)), C = A(() => {
1336
+ let e = [n("campus.chart.summaryPie", {
1337
+ title: t.title ?? "",
1338
+ count: l.value.length,
1339
+ total: a(d.value)
1340
+ })];
1341
+ for (let t of l.value.slice(0, 8)) e.push(n("campus.chart.summaryPieItem", {
1342
+ name: t.name,
1343
+ value: a(t.value),
1344
+ percent: Dr(h(t.index))
1345
+ }));
1346
+ return e.join(" ");
1347
+ }), ee = A(() => [
1348
+ n("campus.chart.category"),
1349
+ n("campus.chart.value"),
1350
+ n("campus.chart.percent")
1351
+ ]), w = A(() => l.value.map((e) => [
1352
+ e.name,
1353
+ a(e.value),
1354
+ Dr(h(e.index))
1355
+ ]));
1356
+ return (t, n) => (B(), N("div", {
1357
+ ref_key: "el",
1358
+ ref: r,
1359
+ class: R(["ca-chart ca-pie-chart", {
1360
+ "is-loading": e.loading,
1361
+ "is-animated": e.animated
1362
+ }]),
1363
+ "aria-busy": e.loading || void 0
1364
+ }, [P("div", Ti, [
1365
+ P("div", {
1366
+ class: "ca-chart__plot",
1367
+ style: z({
1368
+ width: `${o.value}px`,
1369
+ height: `${o.value}px`
1370
+ })
1371
+ }, [
1372
+ P("div", Ei, [f.value ? (B(), N("svg", {
1373
+ key: 0,
1374
+ class: "ca-chart__svg",
1375
+ role: "img",
1376
+ tabindex: "0",
1377
+ "aria-label": C.value,
1378
+ width: o.value,
1379
+ height: o.value,
1380
+ viewBox: `0 0 ${o.value} ${o.value}`,
1381
+ onKeydown: b,
1382
+ onFocus: x,
1383
+ onBlur: n[1] ||= (e) => p.value = -1
1384
+ }, [P("g", Oi, [(B(!0), N(k, null, H(m.value, (e) => (B(), N("path", {
1385
+ key: e.index,
1386
+ class: R(["ca-chart__slice", { "is-dim": p.value >= 0 && p.value !== e.index }]),
1387
+ d: e.d,
1388
+ style: z({ fill: e.color }),
1389
+ onPointerenter: (t) => p.value = e.index,
1390
+ onPointermove: v,
1391
+ onPointerleave: n[0] ||= (e) => p.value = -1
1392
+ }, null, 46, ki))), 128))])], 40, Di)) : M("v-if", !0)]),
1393
+ M(" 环形图中心文字:HTML 叠在 SVG 上,方便按内圈宽度换行与省略 "),
1394
+ e.donut && f.value ? (B(), N("div", {
1395
+ key: 0,
1396
+ class: "ca-pie-chart__center",
1397
+ style: z({ width: `${c.value * 1.7}px` })
1398
+ }, [
1399
+ P("span", Ai, W(g.value.label), 1),
1400
+ P("strong", {
1401
+ class: "ca-pie-chart__value",
1402
+ style: z({ fontSize: `${S.value}px` })
1403
+ }, W(g.value.value), 5),
1404
+ g.value.sub ? (B(), N("span", ji, W(g.value.sub), 1)) : M("v-if", !0)
1405
+ ], 4)) : M("v-if", !0),
1406
+ y.value ? (B(), j(Hr, {
1407
+ key: 1,
1408
+ x: y.value.x,
1409
+ y: y.value.y,
1410
+ width: o.value,
1411
+ title: y.value.title,
1412
+ rows: y.value.rows
1413
+ }, null, 8, [
1414
+ "x",
1415
+ "y",
1416
+ "width",
1417
+ "title",
1418
+ "rows"
1419
+ ])) : M("v-if", !0),
1420
+ I(Pr, {
1421
+ loading: e.loading,
1422
+ empty: !f.value && !e.loading
1423
+ }, null, 8, ["loading", "empty"])
1424
+ ], 4),
1425
+ M(" 图例清单:名称 / 数值 / 占比,悬停与扇区联动 "),
1426
+ e.legend && l.value.length ? (B(), N("ul", Mi, [(B(!0), N(k, null, H(l.value, (e) => (B(), N("li", {
1427
+ key: e.index,
1428
+ class: R(["ca-pie-chart__row", { "is-active": p.value === e.index }]),
1429
+ onPointerenter: (t) => p.value = e.value > 0 ? e.index : -1,
1430
+ onPointerleave: n[2] ||= (e) => p.value = -1
1431
+ }, [
1432
+ P("span", {
1433
+ class: "ca-chart__key ca-chart__key--box",
1434
+ style: z({ "--key": e.color })
1435
+ }, null, 4),
1436
+ P("span", Pi, W(e.name), 1),
1437
+ P("span", Fi, W(a(e.value)), 1),
1438
+ P("span", Ii, W(G(Dr)(h(e.index))), 1)
1439
+ ], 42, Ni))), 128))])) : M("v-if", !0)
1440
+ ]), f.value ? (B(), j(Rr, {
1441
+ key: 0,
1442
+ caption: e.title,
1443
+ head: ee.value,
1444
+ rows: w.value
1445
+ }, null, 8, [
1446
+ "caption",
1447
+ "head",
1448
+ "rows"
1449
+ ])) : M("v-if", !0)], 10, wi));
1450
+ }
1451
+ }), zi = (e, t) => {
1452
+ let n = e.__vccOpts || e;
1453
+ for (let [e, r] of t) n[e] = r;
1454
+ return n;
1455
+ }, Bi = /*#__PURE__*/ zi(Ri, [["__scopeId", "data-v-75e32682"]]), Vi = [
1456
+ "aria-label",
1457
+ "width",
1458
+ "height",
1459
+ "viewBox"
1460
+ ], Hi = {
1461
+ key: 0,
1462
+ class: "ca-chart__reveal"
1463
+ }, Ui = ["d"], Wi = ["d"], Gi = ["cx", "cy"], Ki = { key: 1 }, qi = ["d"], Ji = 4, Yi = 5, Xi = 2, Zi = /* @__PURE__ */ L({
1464
+ __name: "CaSparkline",
1465
+ props: {
1466
+ data: {},
1467
+ type: { default: "line" },
1468
+ area: {
1469
+ type: Boolean,
1470
+ default: !1
1471
+ },
1472
+ smooth: {
1473
+ type: Boolean,
1474
+ default: !0
1475
+ },
1476
+ color: { default: "var(--ca-chart-1)" },
1477
+ height: { default: 32 },
1478
+ width: {},
1479
+ title: {},
1480
+ valueFormatter: {},
1481
+ animated: {
1482
+ type: Boolean,
1483
+ default: !0
1484
+ }
1485
+ },
1486
+ setup(e) {
1487
+ let t = e, n = J(), { el: r, width: i } = Or(() => t.width), a = (e) => (t.valueFormatter ?? $)(e), o = A(() => mr(t.data)), s = A(() => Math.max(1, i.value - 8)), c = A(() => {
1488
+ let e = t.data.length, n = o.value;
1489
+ if (!e || !n) return null;
1490
+ if (t.type === "bar") {
1491
+ let r = Math.max(n[1], 0), i = Math.min(n[0], 0), a = ir(i, r === i ? i + 1 : r, t.height - 1, Yi), o = (s.value - Xi * (e - 1)) / e, c = Math.max(1, Math.min(o, 14)), l = c * e + Xi * (e - 1), u = Ji + (s.value - l) / 2;
1492
+ return {
1493
+ kind: "bar",
1494
+ bars: t.data.flatMap((e, t) => {
1495
+ if (!Y(e)) return [];
1496
+ let n = a(0), r = a(e), i = hr(u + t * (c + Xi), Math.min(n, r), c, Math.max(Math.abs(n - r), e === 0 ? 0 : 1), 2, e >= 0 ? "top" : "bottom");
1497
+ return i ? [i] : [];
1498
+ })
1499
+ };
1500
+ }
1501
+ let r = ir(n[0], n[1], t.height - Yi, Yi), a = (t) => e === 1 ? i.value / 2 : Ji + t / (e - 1) * s.value, c = t.data.map((e, t) => Y(e) ? {
1502
+ x: a(t),
1503
+ y: r(e)
1504
+ } : null), l = [...c].reverse().find((e) => e) ?? null;
1505
+ return {
1506
+ kind: "line",
1507
+ line: dr(c, t.smooth),
1508
+ area: t.area ? fr(c, t.height - 1, t.smooth) : "",
1509
+ last: l
1510
+ };
1511
+ }), l = A(() => {
1512
+ let e = Er(t.data);
1513
+ return e ? n("campus.chart.summarySpark", {
1514
+ title: t.title ?? "",
1515
+ count: e.count,
1516
+ min: a(e.min),
1517
+ max: a(e.max),
1518
+ last: a(e.last)
1519
+ }) : t.title ?? "";
1520
+ });
1521
+ return (t, n) => (B(), N("div", {
1522
+ ref_key: "el",
1523
+ ref: r,
1524
+ class: R(["ca-chart ca-sparkline", { "is-animated": e.animated }]),
1525
+ style: z({ height: `${e.height}px` })
1526
+ }, [c.value ? (B(), N("svg", {
1527
+ key: 0,
1528
+ class: "ca-chart__svg",
1529
+ role: "img",
1530
+ "aria-label": l.value,
1531
+ width: G(i),
1532
+ height: e.height,
1533
+ viewBox: `0 0 ${G(i)} ${e.height}`
1534
+ }, [c.value.kind === "line" ? (B(), N("g", Hi, [
1535
+ c.value.area ? (B(), N("path", {
1536
+ key: 0,
1537
+ class: "ca-chart__area",
1538
+ d: c.value.area,
1539
+ style: z({ fill: e.color })
1540
+ }, null, 12, Ui)) : M("v-if", !0),
1541
+ P("path", {
1542
+ class: "ca-chart__line",
1543
+ d: c.value.line,
1544
+ style: z({ stroke: e.color })
1545
+ }, null, 12, Wi),
1546
+ c.value.last ? (B(), N("circle", {
1547
+ key: 1,
1548
+ class: "ca-chart__dot",
1549
+ cx: c.value.last.x,
1550
+ cy: c.value.last.y,
1551
+ r: "3.5",
1552
+ style: z({ fill: e.color })
1553
+ }, null, 12, Gi)) : M("v-if", !0)
1554
+ ])) : (B(), N("g", Ki, [(B(!0), N(k, null, H(c.value.bars, (t, n) => (B(), N("path", {
1555
+ key: n,
1556
+ class: "ca-chart__grow-y",
1557
+ d: t,
1558
+ style: z({ fill: e.color })
1559
+ }, null, 12, qi))), 128))]))], 8, Vi)) : M("v-if", !0)], 6));
1560
+ }
1561
+ }), Qi = ["aria-busy"], $i = [
1562
+ "aria-label",
1563
+ "width",
1564
+ "height",
1565
+ "viewBox"
1566
+ ], ea = ["d", "stroke-width"], ta = [
1567
+ "d",
1568
+ "stroke-width",
1569
+ "stroke-dasharray"
1570
+ ], na = { class: "ca-gauge__value" }, ra = {
1571
+ key: 0,
1572
+ class: "ca-gauge__label"
1573
+ }, ia = /*#__PURE__*/ zi(/* @__PURE__ */ L({
1574
+ __name: "CaGauge",
1575
+ props: {
1576
+ value: {},
1577
+ max: { default: 100 },
1578
+ shape: { default: "ring" },
1579
+ size: { default: 120 },
1580
+ thickness: { default: 10 },
1581
+ label: {},
1582
+ color: { default: "var(--ca-chart-1)" },
1583
+ thresholds: {},
1584
+ loading: { type: Boolean },
1585
+ title: {},
1586
+ animated: {
1587
+ type: Boolean,
1588
+ default: !0
1589
+ }
1590
+ },
1591
+ setup(e) {
1592
+ let t = e, n = J(), r = A(() => Sr(t.value, t.max)), i = A(() => xr(r.value, t.thresholds, t.color)), a = A(() => br(t.shape)), o = A(() => t.size / 2), s = A(() => (t.size - t.thickness) / 2 - 1), c = A(() => t.shape === "half" ? o.value + t.thickness / 2 + 2 : t.size), l = A(() => yr(o.value, o.value, s.value, a.value.start, a.value.start + a.value.sweep)), u = A(() => `${Number(r.value.toFixed(1))}%`), d = A(() => n("campus.chart.summaryGauge", {
1593
+ title: t.title ?? t.label ?? "",
1594
+ value: $(typeof t.value == "number" ? t.value : 0),
1595
+ max: $(t.max),
1596
+ percent: u.value
1597
+ }));
1598
+ return (t, n) => (B(), N("div", {
1599
+ class: R(["ca-chart ca-gauge", {
1600
+ "is-loading": e.loading,
1601
+ "is-animated": e.animated
1602
+ }]),
1603
+ style: z({
1604
+ width: `${e.size}px`,
1605
+ height: `${c.value}px`
1606
+ }),
1607
+ "aria-busy": e.loading || void 0
1608
+ }, [(B(), N("svg", {
1609
+ class: "ca-chart__svg",
1610
+ role: "img",
1611
+ "aria-label": d.value,
1612
+ width: e.size,
1613
+ height: c.value,
1614
+ viewBox: `0 0 ${e.size} ${c.value}`
1615
+ }, [
1616
+ P("path", {
1617
+ class: "ca-chart__track",
1618
+ d: l.value,
1619
+ "stroke-width": e.thickness,
1620
+ "stroke-linecap": "round"
1621
+ }, null, 8, ea),
1622
+ M(" pathLength=100:dasharray 的第一个数就是百分比;0% 时不画(圆头线帽会在起点留一个小点,误导成“有进度”) "),
1623
+ r.value > 0 ? (B(), N("path", {
1624
+ key: 0,
1625
+ class: "ca-chart__progress",
1626
+ d: l.value,
1627
+ pathLength: "100",
1628
+ "stroke-width": e.thickness,
1629
+ "stroke-dasharray": `${r.value} 100`,
1630
+ style: z({ stroke: i.value })
1631
+ }, null, 12, ta)) : M("v-if", !0)
1632
+ ], 8, $i)), P("div", { class: R(["ca-gauge__center", { "is-half": e.shape === "half" }]) }, [U(t.$slots, "center", {}, () => [P("strong", na, W(u.value), 1), e.label ? (B(), N("span", ra, W(e.label), 1)) : M("v-if", !0)], !0)], 2)], 14, Qi));
1633
+ }
1634
+ }), [["__scopeId", "data-v-83314498"]]), aa = {
1635
+ CaLineChart: ii,
1636
+ CaBarChart: Ci,
1637
+ CaPieChart: Bi,
1638
+ CaSparkline: Zi,
1639
+ CaGauge: ia
1640
+ }, oa = /* @__PURE__ */ L({
1641
+ __name: "CaConfigProvider",
1642
+ props: { locale: {} },
1643
+ setup(e) {
1644
+ let t = e, n = A(() => t.locale === "en-US" ? Fn : In);
1645
+ return (e, t) => (B(), j(G(re), { locale: n.value }, {
1646
+ default: K(() => [U(e.$slots, "default")]),
1647
+ _: 3
1648
+ }, 8, ["locale"]));
1649
+ }
1650
+ }), sa = { CaConfigProvider: oa }, ca = { class: "ca-stat ca-card" }, la = { class: "ca-stat__head" }, ua = { class: "ca-stat__title" }, da = {
1651
+ key: 0,
1652
+ class: "ca-stat__tag"
1653
+ }, fa = { class: "ca-stat__value" }, pa = {
1654
+ key: 0,
1655
+ class: "ca-stat__hint"
1656
+ }, ma = /*#__PURE__*/ zi(/* @__PURE__ */ L({
1657
+ __name: "CaStatCard",
1658
+ props: {
1659
+ title: {},
1660
+ value: {},
1661
+ hint: {},
1662
+ trend: {},
1663
+ tag: {}
1664
+ },
1665
+ setup(e) {
1666
+ let t = e, n = A(() => t.trend === void 0 ? "" : `${t.trend >= 0 ? "↑" : "↓"} ${Math.abs(t.trend)}%`);
1667
+ return (t, r) => (B(), N("div", ca, [
1668
+ P("div", la, [P("span", ua, W(e.title), 1), e.tag ? (B(), N("span", da, W(e.tag), 1)) : M("v-if", !0)]),
1669
+ P("div", fa, [F(W(e.value) + " ", 1), n.value ? (B(), N("span", {
1670
+ key: 0,
1671
+ class: R(["ca-stat__trend", e.trend >= 0 ? "is-up" : "is-down"])
1672
+ }, W(n.value), 3)) : M("v-if", !0)]),
1673
+ e.hint || t.$slots.default ? (B(), N("div", pa, [U(t.$slots, "default", {}, () => [F(W(e.hint), 1)], !0)])) : M("v-if", !0)
1674
+ ]));
1675
+ }
1676
+ }), [["__scopeId", "data-v-94d16941"]]), ha = /* @__PURE__ */ L({
1677
+ __name: "CaStatusTag",
1678
+ props: {
1679
+ value: {},
1680
+ map: {}
1681
+ },
1682
+ setup(e) {
1683
+ let t = e, n = A(() => t.map[String(t.value)] ?? {
1684
+ label: String(t.value),
1685
+ type: "info"
1686
+ });
1687
+ return (e, t) => (B(), j(G(pt), {
1688
+ type: n.value.type ?? "info",
1689
+ effect: "light",
1690
+ size: "small"
1691
+ }, {
1692
+ default: K(() => [F(W(n.value.label), 1)]),
1693
+ _: 1
1694
+ }, 8, ["type"]));
1695
+ }
1696
+ }), ga = q(s), _a = q(c), va = q(u), ya = q(h), ba = q(_), xa = q(v), Sa = q(T), Ca = q(te), wa = q(oe), Ta = q(se), Ea = q(me), Da = q(be), Oa = q(xe), ka = q(Le), Aa = q(Be), ja = q(Ge), Ma = q(Ze), Na = q(Qe), Pa = q(_t), Fa = q(vt), Ia = q(bt), La = q(xt), Ra = q(Ct), za = q(Tt), Ba = q(Je), Va = q(rt), Ha = q(O), Ua = q(x), Wa = {
1697
+ CaAvatar: ga,
1698
+ CaAvatarGroup: _a,
1699
+ CaBadge: va,
1700
+ CaCalendar: ya,
1701
+ CaCarousel: ba,
1702
+ CaCarouselItem: xa,
1703
+ CaCollapse: Sa,
1704
+ CaCollapseItem: Ca,
1705
+ CaDescriptions: wa,
1706
+ CaDescriptionsItem: Ta,
1707
+ CaEmpty: Ea,
1708
+ CaImage: Da,
1709
+ CaImageViewer: Oa,
1710
+ CaPagination: ka,
1711
+ CaProgress: Aa,
1712
+ CaResult: ja,
1713
+ CaSkeleton: Ma,
1714
+ CaSkeletonItem: Na,
1715
+ CaTimeline: Pa,
1716
+ CaTimelineItem: Fa,
1717
+ CaTour: Ia,
1718
+ CaTourStep: La,
1719
+ CaTree: Ra,
1720
+ CaTreeV2: za,
1721
+ CaSegmented: Ba,
1722
+ CaStatistic: Va,
1723
+ CaCountdown: Ha,
1724
+ CaCheckTag: Ua,
1725
+ CaStatCard: ma,
1726
+ CaStatusTag: ha
1727
+ }, Ga = q(D), Ka = q(ve), qa = q(i), Ja = q(ke), Ya = q(he), Xa = q(Ke), Za = q(w), Qa = q(et), $a = q(tt), eo = q(nt), to = {
1728
+ CaContainer: Ga,
1729
+ CaHeader: Ka,
1730
+ CaAside: qa,
1731
+ CaMain: Ja,
1732
+ CaFooter: Ya,
1733
+ CaRow: Xa,
1734
+ CaCol: Za,
1735
+ CaSpace: Qa,
1736
+ CaSplitter: $a,
1737
+ CaSplitterPanel: eo
1738
+ }, no = /* @__PURE__ */ L({
1739
+ __name: "CaSchemaForm",
1740
+ props: {
1741
+ fields: {},
1742
+ modelValue: {},
1743
+ labelWidth: { default: "110px" },
1744
+ submitText: {},
1745
+ hideActions: { type: Boolean }
1746
+ },
1747
+ emits: ["update:modelValue", "submit"],
1748
+ setup(e, { expose: t, emit: n }) {
1749
+ let r = e, i = n, a = J(), o = V();
1750
+ function s(e, t) {
1751
+ i("update:modelValue", {
1752
+ ...r.modelValue,
1753
+ [e]: t
1754
+ });
1755
+ }
1756
+ let c = A(() => {
1757
+ let e = {};
1758
+ for (let t of r.fields) {
1759
+ if (!t.required || t.type === "switch") continue;
1760
+ let n = [
1761
+ "select",
1762
+ "date",
1763
+ "number"
1764
+ ].includes(t.type ?? "input");
1765
+ e[t.prop] = [{
1766
+ required: !0,
1767
+ message: a("campus.form.required", { label: t.label }),
1768
+ trigger: n ? "change" : "blur"
1769
+ }];
1770
+ }
1771
+ return e;
1772
+ });
1773
+ async function l() {
1774
+ try {
1775
+ await o.value?.validate();
1776
+ } catch {
1777
+ return;
1778
+ }
1779
+ i("submit", r.modelValue);
1780
+ }
1781
+ function u() {
1782
+ o.value?.resetFields();
1783
+ }
1784
+ return t({
1785
+ validate: () => o.value?.validate(),
1786
+ reset: u
1787
+ }), (t, n) => (B(), j(G(ge), {
1788
+ ref_key: "formRef",
1789
+ ref: o,
1790
+ model: e.modelValue,
1791
+ rules: c.value,
1792
+ "label-width": e.labelWidth,
1793
+ onSubmit: Ht(l, ["prevent"])
1794
+ }, {
1795
+ default: K(() => [(B(!0), N(k, null, H(e.fields, (t) => (B(), j(G(_e), {
1796
+ key: t.prop,
1797
+ label: t.label,
1798
+ prop: t.prop
1799
+ }, {
1800
+ default: K(() => [t.type === "select" ? (B(), j(G(Ye), {
1801
+ key: 0,
1802
+ "model-value": e.modelValue[t.prop],
1803
+ placeholder: t.placeholder,
1804
+ clearable: "",
1805
+ style: { width: "100%" },
1806
+ "onUpdate:modelValue": (e) => s(t.prop, e)
1807
+ }, {
1808
+ default: K(() => [(B(!0), N(k, null, H(t.options, (e) => (B(), j(G(Pe), {
1809
+ key: String(e.value),
1810
+ label: e.label,
1811
+ value: e.value
1812
+ }, null, 8, ["label", "value"]))), 128))]),
1813
+ _: 2
1814
+ }, 1032, [
1815
+ "model-value",
1816
+ "placeholder",
1817
+ "onUpdate:modelValue"
1818
+ ])) : t.type === "switch" ? (B(), j(G(st), {
1819
+ key: 1,
1820
+ "model-value": e.modelValue[t.prop],
1821
+ "onUpdate:modelValue": (e) => s(t.prop, e)
1822
+ }, null, 8, ["model-value", "onUpdate:modelValue"])) : t.type === "date" ? (B(), j(G(ie), {
1823
+ key: 2,
1824
+ "model-value": e.modelValue[t.prop],
1825
+ type: "date",
1826
+ "value-format": "YYYY-MM-DD",
1827
+ placeholder: t.placeholder,
1828
+ style: { width: "100%" },
1829
+ "onUpdate:modelValue": (e) => s(t.prop, e)
1830
+ }, null, 8, [
1831
+ "model-value",
1832
+ "placeholder",
1833
+ "onUpdate:modelValue"
1834
+ ])) : t.type === "number" ? (B(), j(G(we), {
1835
+ key: 3,
1836
+ "model-value": e.modelValue[t.prop],
1837
+ min: t.min,
1838
+ max: t.max,
1839
+ "onUpdate:modelValue": (e) => s(t.prop, e)
1840
+ }, null, 8, [
1841
+ "model-value",
1842
+ "min",
1843
+ "max",
1844
+ "onUpdate:modelValue"
1845
+ ])) : (B(), j(G(Ce), {
1846
+ key: 4,
1847
+ "model-value": e.modelValue[t.prop],
1848
+ type: t.type === "textarea" ? "textarea" : "text",
1849
+ rows: 3,
1850
+ placeholder: t.placeholder,
1851
+ clearable: "",
1852
+ "onUpdate:modelValue": (e) => s(t.prop, e)
1853
+ }, null, 8, [
1854
+ "model-value",
1855
+ "type",
1856
+ "placeholder",
1857
+ "onUpdate:modelValue"
1858
+ ]))]),
1859
+ _: 2
1860
+ }, 1032, ["label", "prop"]))), 128)), e.hideActions ? M("v-if", !0) : (B(), j(G(_e), { key: 0 }, {
1861
+ default: K(() => [U(t.$slots, "actions", {}, () => [I(G(p), {
1862
+ type: "primary",
1863
+ "native-type": "submit"
1864
+ }, {
1865
+ default: K(() => [F(W(e.submitText ?? G(a)("campus.form.submit")), 1)]),
1866
+ _: 1
1867
+ }), I(G(p), { onClick: u }, {
1868
+ default: K(() => [F(W(G(a)("campus.form.reset")), 1)]),
1869
+ _: 1
1870
+ })])]),
1871
+ _: 3
1872
+ }))]),
1873
+ _: 3
1874
+ }, 8, [
1875
+ "model",
1876
+ "rules",
1877
+ "label-width"
1878
+ ]));
1879
+ }
1880
+ }), ro = q(ne), io = q(ie), ao = q(ge), oo = q(_e), so = q(Ce), co = q(we), lo = q(Pe), uo = q(He), fo = q(Ue), po = q(Ye), mo = q(st), ho = q(o), go = q(y), _o = q(b), vo = q(S), yo = q(ee), bo = q(C), xo = q(E), So = q(ae), Co = q(Ee), wo = q(Te), To = q(Ae), Eo = q(We), Do = q(Xe), Oo = q($e), ko = q(ht), Ao = q(gt), jo = q(St), Mo = q(wt), No = q(Et), Po = q(Fe), Fo = q(Ve), Io = {
1881
+ CaAutocomplete: ho,
1882
+ CaCascader: go,
1883
+ CaCascaderPanel: _o,
1884
+ CaCheckbox: vo,
1885
+ CaCheckboxGroup: yo,
1886
+ CaCheckboxButton: bo,
1887
+ CaColorPickerPanel: xo,
1888
+ CaDatePickerPanel: So,
1889
+ CaInputTag: Co,
1890
+ CaInputOtp: wo,
1891
+ CaMention: To,
1892
+ CaRate: Eo,
1893
+ CaSelectV2: Do,
1894
+ CaSlider: Oo,
1895
+ CaTimePicker: ko,
1896
+ CaTimeSelect: Ao,
1897
+ CaTransfer: jo,
1898
+ CaTreeSelect: Mo,
1899
+ CaUpload: No,
1900
+ CaOptionGroup: Po,
1901
+ CaRadio: Fo,
1902
+ CaColorPicker: ro,
1903
+ CaDatePicker: io,
1904
+ CaForm: ao,
1905
+ CaFormItem: oo,
1906
+ CaInput: so,
1907
+ CaInputNumber: co,
1908
+ CaOption: lo,
1909
+ CaRadioButton: uo,
1910
+ CaRadioGroup: fo,
1911
+ CaSelect: po,
1912
+ CaSwitch: mo,
1913
+ CaSchemaForm: no
1914
+ }, Lo = /* @__PURE__ */ L({
1915
+ __name: "CaMenu",
1916
+ setup(e) {
1917
+ return (e, t) => (B(), j(G(je), { class: "ca-menu" }, {
1918
+ default: K(() => [U(e.$slots, "default")]),
1919
+ _: 3
1920
+ }));
1921
+ }
1922
+ }), Ro = q(d), zo = q(f), Bo = q(de), Vo = q(fe), Ho = q(pe), Uo = q(Me), Wo = q(ot), Go = q(e), Ko = q(n), qo = q(r), Jo = q(l), Yo = q(Ie), Xo = q(at), Zo = q(it), Qo = q(ft), $o = q(ct), es = q(Ne), ts = {
1923
+ CaAffix: Go,
1924
+ CaAnchor: Ko,
1925
+ CaAnchorLink: qo,
1926
+ CaBacktop: Jo,
1927
+ CaPageHeader: Yo,
1928
+ CaSteps: Xo,
1929
+ CaStep: Zo,
1930
+ CaTabs: Qo,
1931
+ CaTabPane: $o,
1932
+ CaMenuItemGroup: es,
1933
+ CaBreadcrumb: Ro,
1934
+ CaBreadcrumbItem: zo,
1935
+ CaDropdown: Bo,
1936
+ CaDropdownItem: Vo,
1937
+ CaDropdownMenu: Ho,
1938
+ CaMenu: Lo,
1939
+ CaMenuItem: Uo,
1940
+ CaSubMenu: Wo
1941
+ }, ns = q(ce), rs = q(ue), is = q(ze), as = q(Re), os = q(yt), ss = {
1942
+ CaPopover: is,
1943
+ CaPopconfirm: as,
1944
+ CaTooltip: os,
1945
+ CaDialog: ns,
1946
+ CaDrawer: rs
1947
+ }, cs = { class: "ca-data-table ca-card" }, ls = {
1948
+ key: 1,
1949
+ class: "ca-data-table__toolbar"
1950
+ }, us = { class: "ca-data-table__table-scroll" }, ds = { class: "ca-data-table__footer" }, fs = { class: "ca-data-table__total" }, ps = /*#__PURE__*/ zi(/* @__PURE__ */ L({
1951
+ __name: "CaDataTable",
1952
+ props: {
1953
+ columns: {},
1954
+ request: {},
1955
+ search: {},
1956
+ rowKey: { default: "id" },
1957
+ pageSize: { default: 10 },
1958
+ params: {},
1959
+ selection: {
1960
+ type: Boolean,
1961
+ default: !1
1962
+ },
1963
+ actionsLabel: {},
1964
+ actionsWidth: {}
1965
+ },
1966
+ emits: ["selection-change"],
1967
+ setup(e, { expose: n, emit: r }) {
1968
+ let i = e, a = r, o = J(), s = Rt(), c = Ft({}), l = V(1), u = V(i.pageSize), d = Lt([]), f = V(0), m = V(!1), h = V(""), g = V(), _ = V(), v = 0;
1969
+ async function y() {
1970
+ let e = ++v;
1971
+ m.value = !0, h.value = "";
1972
+ try {
1973
+ let t = await i.request({
1974
+ page: l.value,
1975
+ pageSize: u.value,
1976
+ query: {
1977
+ ...c,
1978
+ ...i.params
1979
+ },
1980
+ ..._.value ? { sort: _.value } : {}
1981
+ });
1982
+ if (e !== v) return;
1983
+ if (!t.list.length && t.total > 0 && l.value > 1) {
1984
+ let e = Math.max(1, Math.ceil(t.total / u.value));
1985
+ if (e < l.value) return l.value = e, await y();
1986
+ }
1987
+ d.value = t.list, f.value = t.total;
1988
+ } catch (t) {
1989
+ if (e !== v) return;
1990
+ d.value = [], f.value = 0, h.value = t instanceof Error && t.message ? t.message : o("campus.table.loadFailed");
1991
+ } finally {
1992
+ e === v && (m.value = !1);
1993
+ }
1994
+ }
1995
+ function b() {
1996
+ l.value = 1, y();
1997
+ }
1998
+ function x() {
1999
+ for (let e of Object.keys(c)) delete c[e];
2000
+ _.value = void 0, g.value?.clearSort(), b();
2001
+ }
2002
+ function S(e) {
2003
+ _.value = e.prop && e.order ? {
2004
+ prop: e.prop,
2005
+ order: e.order
2006
+ } : void 0, l.value = 1, y();
2007
+ }
2008
+ return Pt(y), Bt(() => JSON.stringify(i.params ?? {}), b), Bt(() => i.pageSize, (e) => {
2009
+ u.value = e, b();
2010
+ }), n({
2011
+ reload: y,
2012
+ reset: x
2013
+ }), (n, r) => (B(), N("div", cs, [
2014
+ e.search?.length ? (B(), j(G(ge), {
2015
+ key: 0,
2016
+ class: "ca-data-table__search",
2017
+ inline: "",
2018
+ onSubmit: Ht(b, ["prevent"])
2019
+ }, {
2020
+ default: K(() => [(B(!0), N(k, null, H(e.search, (e) => (B(), j(G(_e), {
2021
+ key: e.prop,
2022
+ label: e.label
2023
+ }, {
2024
+ default: K(() => [e.type === "select" ? (B(), j(G(Ye), {
2025
+ key: 0,
2026
+ modelValue: c[e.prop],
2027
+ "onUpdate:modelValue": (t) => c[e.prop] = t,
2028
+ placeholder: e.placeholder,
2029
+ clearable: "",
2030
+ style: { width: "160px" }
2031
+ }, {
2032
+ default: K(() => [(B(!0), N(k, null, H(e.options, (e) => (B(), j(G(Pe), {
2033
+ key: String(e.value),
2034
+ label: e.label,
2035
+ value: e.value
2036
+ }, null, 8, ["label", "value"]))), 128))]),
2037
+ _: 2
2038
+ }, 1032, [
2039
+ "modelValue",
2040
+ "onUpdate:modelValue",
2041
+ "placeholder"
2042
+ ])) : e.type === "date" ? (B(), j(G(ie), {
2043
+ key: 1,
2044
+ modelValue: c[e.prop],
2045
+ "onUpdate:modelValue": (t) => c[e.prop] = t,
2046
+ type: "date",
2047
+ "value-format": "YYYY-MM-DD",
2048
+ placeholder: e.placeholder,
2049
+ style: { width: "160px" }
2050
+ }, null, 8, [
2051
+ "modelValue",
2052
+ "onUpdate:modelValue",
2053
+ "placeholder"
2054
+ ])) : (B(), j(G(Ce), {
2055
+ key: 2,
2056
+ modelValue: c[e.prop],
2057
+ "onUpdate:modelValue": (t) => c[e.prop] = t,
2058
+ placeholder: e.placeholder,
2059
+ clearable: "",
2060
+ style: { width: "200px" }
2061
+ }, null, 8, [
2062
+ "modelValue",
2063
+ "onUpdate:modelValue",
2064
+ "placeholder"
2065
+ ]))]),
2066
+ _: 2
2067
+ }, 1032, ["label"]))), 128)), I(G(_e), null, {
2068
+ default: K(() => [I(G(p), {
2069
+ type: "primary",
2070
+ "native-type": "submit"
2071
+ }, {
2072
+ default: K(() => [F(W(G(o)("campus.table.search")), 1)]),
2073
+ _: 1
2074
+ }), I(G(p), { onClick: x }, {
2075
+ default: K(() => [F(W(G(o)("campus.table.reset")), 1)]),
2076
+ _: 1
2077
+ })]),
2078
+ _: 1
2079
+ })]),
2080
+ _: 1
2081
+ })) : M("v-if", !0),
2082
+ n.$slots.toolbar ? (B(), N("div", ls, [U(n.$slots, "toolbar", { reload: y }, void 0, !0)])) : M("v-if", !0),
2083
+ h.value ? (B(), j(G(t), {
2084
+ key: 2,
2085
+ type: "error",
2086
+ "show-icon": "",
2087
+ closable: !1,
2088
+ title: h.value,
2089
+ class: "ca-data-table__error"
2090
+ }, {
2091
+ default: K(() => [I(G(p), {
2092
+ size: "small",
2093
+ onClick: y
2094
+ }, {
2095
+ default: K(() => [F(W(G(o)("campus.table.retry")), 1)]),
2096
+ _: 1
2097
+ })]),
2098
+ _: 1
2099
+ }, 8, ["title"])) : M("v-if", !0),
2100
+ P("div", us, [Vt((B(), j(G(lt), {
2101
+ ref_key: "tableRef",
2102
+ ref: g,
2103
+ data: d.value,
2104
+ "row-key": e.rowKey,
2105
+ "empty-text": G(o)("campus.table.empty"),
2106
+ onSelectionChange: r[0] ||= (e) => a("selection-change", e),
2107
+ onSortChange: S
2108
+ }, {
2109
+ default: K(() => [
2110
+ e.selection ? (B(), j(G(ut), {
2111
+ key: 0,
2112
+ type: "selection",
2113
+ width: "48",
2114
+ "reserve-selection": ""
2115
+ })) : M("v-if", !0),
2116
+ (B(!0), N(k, null, H(e.columns, (e) => (B(), j(G(ut), {
2117
+ key: e.prop,
2118
+ prop: e.prop,
2119
+ label: e.label,
2120
+ width: e.width,
2121
+ "min-width": e.minWidth,
2122
+ align: e.align,
2123
+ sortable: e.sortable ? "custom" : !1
2124
+ }, {
2125
+ default: K(({ row: t }) => [U(n.$slots, `cell-${e.prop}`, {
2126
+ row: t,
2127
+ value: t[e.prop]
2128
+ }, () => [F(W(e.formatter ? e.formatter(t) : t[e.prop]), 1)], !0)]),
2129
+ _: 2
2130
+ }, 1032, [
2131
+ "prop",
2132
+ "label",
2133
+ "width",
2134
+ "min-width",
2135
+ "align",
2136
+ "sortable"
2137
+ ]))), 128)),
2138
+ G(s).actions ? (B(), j(G(ut), {
2139
+ key: 1,
2140
+ label: e.actionsLabel,
2141
+ width: e.actionsWidth,
2142
+ fixed: "right"
2143
+ }, {
2144
+ default: K(({ row: e }) => [U(n.$slots, "actions", { row: e }, void 0, !0)]),
2145
+ _: 3
2146
+ }, 8, ["label", "width"])) : M("v-if", !0)
2147
+ ]),
2148
+ _: 3
2149
+ }, 8, [
2150
+ "data",
2151
+ "row-key",
2152
+ "empty-text"
2153
+ ])), [[G(Ot), m.value]])]),
2154
+ P("div", ds, [P("span", fs, W(G(o)("campus.table.total", { total: f.value })), 1), I(G(Le), {
2155
+ "current-page": l.value,
2156
+ "onUpdate:currentPage": r[1] ||= (e) => l.value = e,
2157
+ "page-size": u.value,
2158
+ "onUpdate:pageSize": r[2] ||= (e) => u.value = e,
2159
+ total: f.value,
2160
+ "page-sizes": [
2161
+ 10,
2162
+ 20,
2163
+ 50
2164
+ ],
2165
+ layout: "sizes, prev, pager, next",
2166
+ background: "",
2167
+ onCurrentChange: y,
2168
+ onSizeChange: b
2169
+ }, null, 8, [
2170
+ "current-page",
2171
+ "page-size",
2172
+ "total"
2173
+ ])])
2174
+ ]));
2175
+ }
2176
+ }), [["__scopeId", "data-v-7e786198"]]), ms = q(lt), hs = q(ut), gs = q(dt), _s = q(a), vs = {
2177
+ CaTable: ms,
2178
+ CaTableColumn: hs,
2179
+ CaTableV2: gs,
2180
+ CaAutoResizer: _s,
2181
+ CaDataTable: ps
2182
+ }, ys = Ln(Xn, $n, aa, sa, Wa, Io, to, ts, ss, vs), bs = {}, xs = Ln(bs), Ss = {}, Cs = {}, ws = {}, Ts = {}, Es = {}, Ds = Ln(Ss, Cs, ws, Ts, Es), Os = Ln(ys, Ds, xs);
2183
+ function ks(e) {
2184
+ e.directive("ca-loading", Oe), e.directive("ca-infinite-scroll", Se);
2185
+ for (let [t, n] of Object.entries(Os)) e.component(t, n);
2186
+ }
2187
+ export { Go as CaAffix, Hn as CaAlert, Ko as CaAnchor, qo as CaAnchorLink, qa as CaAside, _s as CaAutoResizer, ho as CaAutocomplete, ga as CaAvatar, _a as CaAvatarGroup, Jo as CaBacktop, va as CaBadge, Ci as CaBarChart, Ro as CaBreadcrumb, zo as CaBreadcrumbItem, Zn as CaButton, Qn as CaButtonGroup, ya as CaCalendar, Un as CaCard, ba as CaCarousel, xa as CaCarouselItem, go as CaCascader, _o as CaCascaderPanel, Ua as CaCheckTag, vo as CaCheckbox, bo as CaCheckboxButton, yo as CaCheckboxGroup, Za as CaCol, Sa as CaCollapse, Ca as CaCollapseItem, ro as CaColorPicker, xo as CaColorPickerPanel, oa as CaConfigProvider, Ga as CaContainer, Ha as CaCountdown, ps as CaDataTable, io as CaDatePicker, So as CaDatePickerPanel, wa as CaDescriptions, Ta as CaDescriptionsItem, ns as CaDialog, Jn as CaDivider, rs as CaDrawer, Bo as CaDropdown, Vo as CaDropdownItem, Ho as CaDropdownMenu, Ea as CaEmpty, Ya as CaFooter, ao as CaForm, oo as CaFormItem, ia as CaGauge, Ka as CaHeader, zn as CaIcon, Da as CaImage, Oa as CaImageViewer, so as CaInput, co as CaInputNumber, wo as CaInputOtp, Co as CaInputTag, ii as CaLineChart, Gn as CaLink, Ja as CaMain, To as CaMention, Lo as CaMenu, Uo as CaMenuItem, es as CaMenuItemGroup, lo as CaOption, Po as CaOptionGroup, Vn as CaPageActions, Yo as CaPageHeader, ka as CaPagination, Bi as CaPieChart, as as CaPopconfirm, is as CaPopover, Aa as CaProgress, Fo as CaRadio, uo as CaRadioButton, fo as CaRadioGroup, Eo as CaRate, ja as CaResult, Xa as CaRow, no as CaSchemaForm, qn as CaScrollbar, Ba as CaSegmented, po as CaSelect, Do as CaSelectV2, Ma as CaSkeleton, Na as CaSkeletonItem, Oo as CaSlider, Qa as CaSpace, Zi as CaSparkline, $a as CaSplitter, eo as CaSplitterPanel, ma as CaStatCard, Va as CaStatistic, ha as CaStatusTag, Zo as CaStep, Xo as CaSteps, Wo as CaSubMenu, mo as CaSwitch, $o as CaTabPane, ms as CaTable, hs as CaTableColumn, gs as CaTableV2, Qo as CaTabs, Wn as CaTag, Kn as CaText, ko as CaTimePicker, Ao as CaTimeSelect, Pa as CaTimeline, Fa as CaTimelineItem, os as CaTooltip, Ia as CaTour, La as CaTourStep, jo as CaTransfer, Ra as CaTree, Mo as CaTreeSelect, za as CaTreeV2, No as CaUpload, Yn as CaWatermark, Rn as ICONS, Xn as basicComponents, $n as buttonComponents, Ds as campusRegistry, Ss as cardComponents, aa as chartComponents, ys as componentRegistry, sa as configComponents, Wa as displayComponents, Io as formComponents, ks as installUi, to as layoutComponents, ts as navigationComponents, xs as omsRegistry, bs as omsSchoolComponents, ss as overlayComponents, Cs as parentComponents, ws as studentComponents, vs as tableComponents, Ts as teacherComponents, Es as telComponents, er as translateKey, Os as uiComponents, J as useTranslate };