@campus-admin/ui 2.0.6 → 2.0.7
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/README.md +71 -0
- package/dist/CaDocPdf-BMSfqmuh.js +132 -0
- package/dist/CaDocWord-BYX69Eoh.js +52 -0
- package/dist/button-CNxlqu0z.js +13 -0
- package/dist/components/display/doc-viewer/CaDocDialog.vue.d.ts +24 -0
- package/dist/components/display/doc-viewer/CaDocPdf.vue.d.ts +13 -0
- package/dist/components/display/doc-viewer/CaDocViewer.vue.d.ts +46 -0
- package/dist/components/display/doc-viewer/CaDocWord.vue.d.ts +12 -0
- package/dist/components/display/doc-viewer/loaders.d.ts +4 -0
- package/dist/components/display/doc-viewer/markdown.d.ts +19 -0
- package/dist/components/display/doc-viewer/sheets.d.ts +12 -0
- package/dist/components/display/doc-viewer/source.d.ts +13 -0
- package/dist/components/display/doc-viewer/types.d.ts +27 -0
- package/dist/components/display/index.d.ts +8 -1
- package/dist/components/navigation/CaMenu.vue.d.ts +4 -1
- package/dist/components/overlay/index.d.ts +34 -34
- package/dist/index.js +1572 -873
- package/dist/loaders-DAfXYCem.js +38 -0
- package/dist/style.css +1 -1
- package/package.json +30 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import './style.css'
|
|
2
|
-
import {
|
|
2
|
+
import { i as e, n as t, r as n, t as r } from "./button-CNxlqu0z.js";
|
|
3
|
+
import { a as i, i as a, n as o, o as s, r as c, s as l, t as u } from "./loaders-DAfXYCem.js";
|
|
4
|
+
import { ElAffix as d, ElAlert as f, ElAnchor as p, ElAnchorLink as m, ElAside as h, ElAutoResizer as g, ElAutocomplete as _, ElAvatar as v, ElAvatarGroup as y, ElBacktop as b, ElBadge as x, ElBreadcrumb as S, ElBreadcrumbItem as C, ElButton as w, ElCalendar as T, ElCard as E, ElCarousel as D, ElCarouselItem as O, ElCascader as ee, ElCascaderPanel as k, ElCheckTag as A, ElCheckbox as j, ElCheckboxButton as M, ElCheckboxGroup as te, ElCol as ne, ElCollapse as re, ElCollapseItem as ie, ElColorPicker as ae, ElColorPickerPanel as oe, ElConfigProvider as se, ElContainer as ce, ElCountdown as le, ElDatePicker as ue, ElDatePickerPanel as de, ElDescriptions as fe, ElDescriptionsItem as pe, ElDialog as me, ElDivider as he, ElDrawer as ge, ElDropdown as _e, ElDropdownItem as ve, ElDropdownMenu as ye, ElEmpty as be, ElFooter as xe, ElForm as Se, ElFormItem as Ce, ElHeader as we, ElIcon as Te, ElImage as Ee, ElImageViewer as De, ElInfiniteScroll as Oe, ElInput as ke, ElInputNumber as Ae, ElInputOtp as je, ElInputTag as Me, ElLink as Ne, ElLoadingDirective as Pe, ElMain as Fe, ElMention as Ie, ElMenu as Le, ElMenuItem as Re, ElMenuItemGroup as ze, ElOption as Be, ElOptionGroup as Ve, ElPageHeader as He, ElPagination as Ue, ElPopconfirm as We, ElPopover as Ge, ElProgress as Ke, ElRadio as qe, ElRadioButton as Je, ElRadioGroup as Ye, ElRate as Xe, ElResult as Ze, ElRow as Qe, ElScrollbar as $e, ElSegmented as et, ElSelect as tt, ElSelectV2 as nt, ElSkeleton as rt, ElSkeletonItem as it, ElSlider as at, ElSpace as ot, ElSplitter as st, ElSplitterPanel as ct, ElStatistic as lt, ElStep as ut, ElSteps as dt, ElSubMenu as ft, ElSwitch as pt, ElTabPane as mt, ElTable as ht, ElTableColumn as gt, ElTableV2 as _t, ElTabs as vt, ElTag as yt, ElText as bt, ElTimePicker as xt, ElTimeSelect as St, ElTimeline as Ct, ElTimelineItem as wt, ElTooltip as Tt, ElTour as Et, ElTourStep as Dt, ElTransfer as Ot, ElTree as kt, ElTreeSelect as At, ElTreeV2 as jt, ElUpload as Mt, ElWatermark as Nt, vLoading as Pt } from "element-plus";
|
|
3
5
|
import "element-plus/es/components/loading/style/css";
|
|
4
6
|
import "element-plus/es/components/link/style/css";
|
|
5
7
|
import "element-plus/es/components/text/style/css";
|
|
@@ -10,12 +12,10 @@ import "element-plus/es/components/alert/style/css";
|
|
|
10
12
|
import "element-plus/es/components/card/style/css";
|
|
11
13
|
import "element-plus/es/components/tag/style/css";
|
|
12
14
|
import "element-plus/es/components/icon/style/css";
|
|
13
|
-
import { Fragment as
|
|
14
|
-
import { ArrowDown as
|
|
15
|
-
import "element-plus/es/
|
|
16
|
-
import "element-plus/es/
|
|
17
|
-
import Fn from "element-plus/es/locale/lang/en";
|
|
18
|
-
import In from "element-plus/es/locale/lang/zh-cn";
|
|
15
|
+
import { Fragment as N, Teleport as Ft, computed as P, createBlock as F, createCommentVNode as I, createElementBlock as L, createElementVNode as R, createSlots as It, createTextVNode as z, createVNode as B, defineAsyncComponent as Lt, defineComponent as V, guardReactiveProps as Rt, nextTick as zt, normalizeClass as H, normalizeProps as Bt, normalizeStyle as U, onActivated as Vt, onBeforeUnmount as Ht, onDeactivated as Ut, onMounted as Wt, openBlock as W, reactive as Gt, ref as G, renderList as K, renderSlot as q, resolveDynamicComponent as Kt, shallowRef as qt, toDisplayString as J, unref as Y, useId as Jt, useSlots as Yt, vShow as Xt, watch as Zt, withCtx as X, withDirectives as Qt, withModifiers as $t } from "vue";
|
|
16
|
+
import { ArrowDown as en, ArrowLeft as tn, Bell as nn, Brush as rn, ChatDotRound as an, Check as on, Close as sn, Collection as cn, DataAnalysis as ln, Delete as un, Document as dn, Download as fn, EditPen as pn, Expand as mn, Files as hn, Fold as gn, FullScreen as _n, Grid as vn, Hide as yn, Histogram as bn, HomeFilled as xn, Location as Sn, Menu as Cn, Message as wn, Monitor as Tn, Moon as En, MoreFilled as Dn, Odometer as On, Paperclip as kn, Phone as An, Picture as jn, Plus as Mn, Promotion as Nn, Refresh as Pn, ScaleToOriginal as Fn, Search as In, Setting as Ln, Star as Rn, Sunny as zn, Tickets as Bn, Top as Vn, User as Hn, VideoCamera as Un, View as Wn, Warning as Gn } from "@element-plus/icons-vue";
|
|
17
|
+
import Kn from "element-plus/es/locale/lang/en";
|
|
18
|
+
import qn from "element-plus/es/locale/lang/zh-cn";
|
|
19
19
|
import "element-plus/es/components/config-provider/style/css";
|
|
20
20
|
import "element-plus/es/components/avatar/style/css";
|
|
21
21
|
import "element-plus/es/components/avatar-group/style/css";
|
|
@@ -45,6 +45,16 @@ import "element-plus/es/components/segmented/style/css";
|
|
|
45
45
|
import "element-plus/es/components/statistic/style/css";
|
|
46
46
|
import "element-plus/es/components/countdown/style/css";
|
|
47
47
|
import "element-plus/es/components/check-tag/style/css";
|
|
48
|
+
import Jn from "markdown-it";
|
|
49
|
+
import Yn from "markdown-it-anchor";
|
|
50
|
+
import Xn from "markdown-it-footnote";
|
|
51
|
+
import Zn from "markdown-it-container";
|
|
52
|
+
import Qn from "dompurify";
|
|
53
|
+
import "element-plus/es/components/popover/style/css";
|
|
54
|
+
import "element-plus/es/components/popconfirm/style/css";
|
|
55
|
+
import "element-plus/es/components/tooltip/style/css";
|
|
56
|
+
import "element-plus/es/components/dialog/style/css";
|
|
57
|
+
import "element-plus/es/components/drawer/style/css";
|
|
48
58
|
import "element-plus/es/components/container/style/css";
|
|
49
59
|
import "element-plus/es/components/header/style/css";
|
|
50
60
|
import "element-plus/es/components/aside/style/css";
|
|
@@ -105,16 +115,11 @@ import "element-plus/es/components/dropdown-menu/style/css";
|
|
|
105
115
|
import "element-plus/es/components/menu/style/css";
|
|
106
116
|
import "element-plus/es/components/menu-item/style/css";
|
|
107
117
|
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
118
|
import "element-plus/es/components/table-v2/style/css";
|
|
114
119
|
import "element-plus/es/components/table/style/css";
|
|
115
120
|
import "element-plus/es/components/table-column/style/css";
|
|
116
121
|
// packages/ui/src/shared/registry.ts
|
|
117
|
-
function
|
|
122
|
+
function $n(...e) {
|
|
118
123
|
let t = {};
|
|
119
124
|
for (let n of e) for (let [e, r] of Object.entries(n)) {
|
|
120
125
|
if (e in t) throw Error(`[campus/ui] 组件名重复:${e}(所有域、所有分类的组件名必须唯一)`);
|
|
@@ -122,12 +127,8 @@ function Ln(...e) {
|
|
|
122
127
|
}
|
|
123
128
|
return t;
|
|
124
129
|
}
|
|
125
|
-
// packages/ui/src/shared/wrap.ts
|
|
126
|
-
function q(e) {
|
|
127
|
-
return e;
|
|
128
|
-
}
|
|
129
130
|
// packages/ui/src/components/basic/icon-font.ts
|
|
130
|
-
async function
|
|
131
|
+
async function er(e) {
|
|
131
132
|
let t = getComputedStyle(e, "::before");
|
|
132
133
|
if (!t.content || [
|
|
133
134
|
"none",
|
|
@@ -142,151 +143,141 @@ async function Rn(e) {
|
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
// packages/ui/src/components/basic/icons.ts
|
|
145
|
-
var
|
|
146
|
-
home:
|
|
147
|
-
chart:
|
|
148
|
-
document:
|
|
149
|
-
grid:
|
|
150
|
-
setting:
|
|
151
|
-
user:
|
|
152
|
-
bell:
|
|
153
|
-
edit:
|
|
154
|
-
monitor:
|
|
155
|
-
brush:
|
|
156
|
-
collection:
|
|
157
|
-
warning:
|
|
158
|
-
files:
|
|
159
|
-
tickets:
|
|
160
|
-
histogram:
|
|
161
|
-
menu:
|
|
162
|
-
message:
|
|
163
|
-
gauge:
|
|
164
|
-
search:
|
|
165
|
-
check:
|
|
166
|
-
delete:
|
|
167
|
-
star:
|
|
168
|
-
plus:
|
|
169
|
-
download:
|
|
170
|
-
fullscreen:
|
|
171
|
-
refresh:
|
|
172
|
-
exitFullscreen:
|
|
173
|
-
chat:
|
|
174
|
-
sunny:
|
|
175
|
-
moon:
|
|
176
|
-
expand:
|
|
177
|
-
fold:
|
|
178
|
-
hide:
|
|
179
|
-
view:
|
|
180
|
-
arrowDown:
|
|
181
|
-
close:
|
|
182
|
-
location:
|
|
183
|
-
back:
|
|
184
|
-
more:
|
|
185
|
-
attachment:
|
|
186
|
-
phone:
|
|
187
|
-
image:
|
|
188
|
-
send:
|
|
189
|
-
pin:
|
|
190
|
-
video:
|
|
191
|
-
},
|
|
146
|
+
var tr = {
|
|
147
|
+
home: xn,
|
|
148
|
+
chart: ln,
|
|
149
|
+
document: dn,
|
|
150
|
+
grid: vn,
|
|
151
|
+
setting: Ln,
|
|
152
|
+
user: Hn,
|
|
153
|
+
bell: nn,
|
|
154
|
+
edit: pn,
|
|
155
|
+
monitor: Tn,
|
|
156
|
+
brush: rn,
|
|
157
|
+
collection: cn,
|
|
158
|
+
warning: Gn,
|
|
159
|
+
files: hn,
|
|
160
|
+
tickets: Bn,
|
|
161
|
+
histogram: bn,
|
|
162
|
+
menu: Cn,
|
|
163
|
+
message: wn,
|
|
164
|
+
gauge: On,
|
|
165
|
+
search: In,
|
|
166
|
+
check: on,
|
|
167
|
+
delete: un,
|
|
168
|
+
star: Rn,
|
|
169
|
+
plus: Mn,
|
|
170
|
+
download: fn,
|
|
171
|
+
fullscreen: _n,
|
|
172
|
+
refresh: Pn,
|
|
173
|
+
exitFullscreen: Fn,
|
|
174
|
+
chat: an,
|
|
175
|
+
sunny: zn,
|
|
176
|
+
moon: En,
|
|
177
|
+
expand: mn,
|
|
178
|
+
fold: gn,
|
|
179
|
+
hide: yn,
|
|
180
|
+
view: Wn,
|
|
181
|
+
arrowDown: en,
|
|
182
|
+
close: sn,
|
|
183
|
+
location: Sn,
|
|
184
|
+
back: tn,
|
|
185
|
+
more: Dn,
|
|
186
|
+
attachment: kn,
|
|
187
|
+
phone: An,
|
|
188
|
+
image: jn,
|
|
189
|
+
send: Nn,
|
|
190
|
+
pin: Vn,
|
|
191
|
+
video: Un
|
|
192
|
+
}, nr = /*#__PURE__*/ l(/* @__PURE__ */ V({
|
|
192
193
|
__name: "CaIcon",
|
|
193
194
|
props: {
|
|
194
195
|
name: {},
|
|
195
196
|
fallback: {}
|
|
196
197
|
},
|
|
197
198
|
setup(e) {
|
|
198
|
-
let t = e, n =
|
|
199
|
-
return
|
|
200
|
-
|
|
199
|
+
let t = e, n = P(() => t.name && Object.hasOwn(tr, t.name) ? tr[t.name] : void 0), r = P(() => !n.value && !!t.name?.trim()), i = G(), a = G(!1), o = P(() => n.value ?? (!a.value && t.fallback ? tr[t.fallback] : void 0));
|
|
200
|
+
return Wt(() => {
|
|
201
|
+
Zt(() => t.name, async (e, t, n) => {
|
|
201
202
|
a.value = !1;
|
|
202
203
|
let o = !1;
|
|
203
204
|
if (n(() => {
|
|
204
205
|
o = !0;
|
|
205
206
|
}), !r.value || !i.value) return;
|
|
206
|
-
let s = await
|
|
207
|
+
let s = await er(i.value);
|
|
207
208
|
o || (a.value = s);
|
|
208
209
|
}, {
|
|
209
210
|
immediate: !0,
|
|
210
211
|
flush: "post"
|
|
211
212
|
});
|
|
212
|
-
}), (t, n) =>
|
|
213
|
-
default:
|
|
213
|
+
}), (t, n) => Qt((W(), F(Y(Te), { class: "ca-icon" }, {
|
|
214
|
+
default: X(() => [r.value ? (W(), L("i", {
|
|
214
215
|
key: 0,
|
|
215
216
|
ref_key: "glyph",
|
|
216
217
|
ref: i,
|
|
217
|
-
class:
|
|
218
|
-
style:
|
|
218
|
+
class: H(e.name),
|
|
219
|
+
style: U({
|
|
219
220
|
position: a.value ? void 0 : "absolute",
|
|
220
221
|
visibility: a.value ? void 0 : "hidden"
|
|
221
222
|
}),
|
|
222
223
|
"aria-hidden": "true"
|
|
223
|
-
}, null, 6)) :
|
|
224
|
+
}, null, 6)) : I("v-if", !0), o.value ? (W(), F(Kt(o.value), { key: 1 })) : r.value ? I("v-if", !0) : q(t.$slots, "default", {}, void 0, !0, 2)]),
|
|
224
225
|
_: 3
|
|
225
|
-
}, 512)), [[
|
|
226
|
+
}, 512)), [[Xt, o.value || a.value || !e.name]]);
|
|
226
227
|
}
|
|
227
|
-
}),
|
|
228
|
-
let n = e.__vccOpts || e;
|
|
229
|
-
for (let [e, r] of t) n[e] = r;
|
|
230
|
-
return n;
|
|
231
|
-
}, Hn = /*#__PURE__*/ Vn(Bn, [["__scopeId", "data-v-b4ddb60c"]]), Un = {
|
|
228
|
+
}), [["__scopeId", "data-v-b4ddb60c"]]), rr = {
|
|
232
229
|
key: 1,
|
|
233
230
|
class: "ca-page-actions"
|
|
234
|
-
},
|
|
231
|
+
}, ir = /* @__PURE__ */ V({
|
|
235
232
|
__name: "CaPageActions",
|
|
236
233
|
setup(e) {
|
|
237
|
-
let t =
|
|
238
|
-
return
|
|
234
|
+
let t = G(null), n = G(!0);
|
|
235
|
+
return Wt(() => {
|
|
239
236
|
t.value = document.getElementById("ca-page-actions");
|
|
240
|
-
}),
|
|
237
|
+
}), Vt(() => n.value = !0), Ut(() => n.value = !1), (e, r) => t.value ? (W(), F(Ft, {
|
|
241
238
|
key: 0,
|
|
242
239
|
to: t.value
|
|
243
|
-
}, [n.value ?
|
|
240
|
+
}, [n.value ? q(e.$slots, "default", {}, void 0, void 0, 0) : I("v-if", !0)], 8, ["to"])) : (W(), L("div", rr, [q(e.$slots, "default")]));
|
|
244
241
|
}
|
|
245
|
-
}),
|
|
246
|
-
CaLink:
|
|
247
|
-
CaText:
|
|
248
|
-
CaScrollbar:
|
|
249
|
-
CaDivider:
|
|
250
|
-
CaWatermark:
|
|
251
|
-
CaAlert:
|
|
252
|
-
CaCard:
|
|
253
|
-
CaIcon:
|
|
254
|
-
CaPageActions:
|
|
255
|
-
CaTag:
|
|
256
|
-
}
|
|
257
|
-
CaButton: er,
|
|
258
|
-
CaButtonGroup: tr
|
|
259
|
-
}, rr = Symbol("campus-translate");
|
|
260
|
-
function J() {
|
|
261
|
-
return At(rr, (e) => e);
|
|
262
|
-
}
|
|
242
|
+
}), ar = e(f), or = e(E), sr = e(yt), cr = e(Ne), lr = e(bt), ur = e($e), dr = e(he), fr = e(Nt), pr = {
|
|
243
|
+
CaLink: cr,
|
|
244
|
+
CaText: lr,
|
|
245
|
+
CaScrollbar: ur,
|
|
246
|
+
CaDivider: dr,
|
|
247
|
+
CaWatermark: fr,
|
|
248
|
+
CaAlert: ar,
|
|
249
|
+
CaCard: or,
|
|
250
|
+
CaIcon: nr,
|
|
251
|
+
CaPageActions: ir,
|
|
252
|
+
CaTag: sr
|
|
253
|
+
};
|
|
263
254
|
// packages/ui/src/components/chart/chart-math.ts
|
|
264
|
-
function
|
|
255
|
+
function Z(e) {
|
|
265
256
|
return typeof e == "number" && Number.isFinite(e);
|
|
266
257
|
}
|
|
267
|
-
function
|
|
258
|
+
function Q(e) {
|
|
268
259
|
let t = e.toFixed(2).replace(/\.?0+$/, "");
|
|
269
260
|
return t === "-0" || t === "" ? "0" : t;
|
|
270
261
|
}
|
|
271
|
-
function
|
|
262
|
+
function mr(e, t, n) {
|
|
272
263
|
return Math.min(n, Math.max(t, e));
|
|
273
264
|
}
|
|
274
|
-
function
|
|
265
|
+
function hr(e, t) {
|
|
275
266
|
let n = Math.floor(Math.log10(e)), r = e / 10 ** n, i;
|
|
276
267
|
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;
|
|
277
268
|
}
|
|
278
|
-
function
|
|
269
|
+
function gr(e, t) {
|
|
279
270
|
let n = Math.max(0, -Math.floor(Math.log10(t)) + 2);
|
|
280
271
|
return Number(e.toFixed(Math.min(n, 12)));
|
|
281
272
|
}
|
|
282
|
-
function
|
|
273
|
+
function _r(e, t, n = 5, r = !0) {
|
|
283
274
|
let i = Number.isFinite(e) ? e : 0, a = Number.isFinite(t) ? t : 1;
|
|
284
275
|
if (i > a && ([i, a] = [a, i]), r && (i = Math.min(i, 0), a = Math.max(a, 0)), i === a) {
|
|
285
276
|
let e = i === 0 ? 1 : Math.abs(i) * .1;
|
|
286
277
|
i = r && i >= 0 ? 0 : i - e, a += e;
|
|
287
278
|
}
|
|
288
|
-
let o = Math.max(2, Math.floor(n)), s =
|
|
289
|
-
for (let e = 0; e <= d; e++) u.push(
|
|
279
|
+
let o = Math.max(2, Math.floor(n)), s = hr(hr(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);
|
|
280
|
+
for (let e = 0; e <= d; e++) u.push(gr(c + e * s, s));
|
|
290
281
|
return {
|
|
291
282
|
min: u[0],
|
|
292
283
|
max: u[u.length - 1],
|
|
@@ -294,12 +285,12 @@ function or(e, t, n = 5, r = !0) {
|
|
|
294
285
|
ticks: u
|
|
295
286
|
};
|
|
296
287
|
}
|
|
297
|
-
function
|
|
288
|
+
function vr(e, t, n, r) {
|
|
298
289
|
let i = t - e;
|
|
299
290
|
return i === 0 ? () => (n + r) / 2 : (t) => n + (t - e) / i * (r - n);
|
|
300
291
|
}
|
|
301
|
-
function
|
|
302
|
-
let i = Math.max(1, Math.floor(e)), a = (n - t) / i, o = a * (1 -
|
|
292
|
+
function yr(e, t, n, r = .2) {
|
|
293
|
+
let i = Math.max(1, Math.floor(e)), a = (n - t) / i, o = a * (1 - mr(r, 0, .9));
|
|
303
294
|
return {
|
|
304
295
|
step: a,
|
|
305
296
|
bandwidth: o,
|
|
@@ -307,13 +298,13 @@ function cr(e, t, n, r = .2) {
|
|
|
307
298
|
center: (e) => t + e * a + a / 2
|
|
308
299
|
};
|
|
309
300
|
}
|
|
310
|
-
function
|
|
301
|
+
function br(e, t, n) {
|
|
311
302
|
if (e <= 0) return [];
|
|
312
303
|
let r = Math.max(1, Math.floor(t / Math.max(1, n))), i = Math.max(1, Math.ceil(e / r)), a = [];
|
|
313
304
|
for (let t = 0; t < e; t += i) a.push(t);
|
|
314
305
|
return a;
|
|
315
306
|
}
|
|
316
|
-
function
|
|
307
|
+
function xr(e, t) {
|
|
317
308
|
if (!e.length) return -1;
|
|
318
309
|
let n = 0, r = e.length - 1;
|
|
319
310
|
for (; n < r;) {
|
|
@@ -322,12 +313,12 @@ function ur(e, t) {
|
|
|
322
313
|
}
|
|
323
314
|
return n > 0 && t - e[n - 1] <= e[n] - t ? n - 1 : n;
|
|
324
315
|
}
|
|
325
|
-
function
|
|
316
|
+
function Sr(e) {
|
|
326
317
|
let t = [], n = [];
|
|
327
|
-
for (let r of e) r &&
|
|
318
|
+
for (let r of e) r && Z(r.x) && Z(r.y) ? n.push(r) : n.length && (t.push(n), n = []);
|
|
328
319
|
return n.length && t.push(n), t;
|
|
329
320
|
}
|
|
330
|
-
function
|
|
321
|
+
function Cr(e) {
|
|
331
322
|
let t = e.length, n = [], r = [];
|
|
332
323
|
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]);
|
|
333
324
|
let i = Array(t);
|
|
@@ -346,30 +337,30 @@ function fr(e) {
|
|
|
346
337
|
}
|
|
347
338
|
return i;
|
|
348
339
|
}
|
|
349
|
-
function
|
|
340
|
+
function wr(e, t) {
|
|
350
341
|
if (e.length < 2) return "";
|
|
351
|
-
if (!t || e.length === 2) return e.slice(1).map((e) => `L${
|
|
352
|
-
let n =
|
|
342
|
+
if (!t || e.length === 2) return e.slice(1).map((e) => `L${Q(e.x)} ${Q(e.y)}`).join("");
|
|
343
|
+
let n = Cr(e), r = "";
|
|
353
344
|
for (let t = 0; t < e.length - 1; t++) {
|
|
354
345
|
let i = e[t], a = e[t + 1], o = (a.x - i.x) / 3;
|
|
355
|
-
r += `C${
|
|
346
|
+
r += `C${Q(i.x + o)} ${Q(i.y + n[t] * o)} ${Q(a.x - o)} ${Q(a.y - n[t + 1] * o)} ${Q(a.x)} ${Q(a.y)}`;
|
|
356
347
|
}
|
|
357
348
|
return r;
|
|
358
349
|
}
|
|
359
|
-
function
|
|
360
|
-
return
|
|
350
|
+
function Tr(e, t = !1) {
|
|
351
|
+
return Sr(e).filter((e) => e.length >= 2).map((e) => `M${Q(e[0].x)} ${Q(e[0].y)}${wr(e, t)}`).join("");
|
|
361
352
|
}
|
|
362
|
-
function
|
|
363
|
-
return
|
|
353
|
+
function Er(e, t, n = !1) {
|
|
354
|
+
return Sr(e).filter((e) => e.length >= 2).map((e) => {
|
|
364
355
|
let r = e[0], i = e[e.length - 1];
|
|
365
|
-
return `M${
|
|
356
|
+
return `M${Q(r.x)} ${Q(t)}L${Q(r.x)} ${Q(r.y)}${wr(e, n)}L${Q(i.x)} ${Q(t)}Z`;
|
|
366
357
|
}).join("");
|
|
367
358
|
}
|
|
368
|
-
function
|
|
359
|
+
function Dr(e) {
|
|
369
360
|
let t = Math.max(0, ...e.map((e) => e.length)), n = Array(t).fill(0), r = Array(t).fill(0);
|
|
370
361
|
return e.map((e) => Array.from({ length: t }, (t, i) => {
|
|
371
362
|
let a = e[i];
|
|
372
|
-
if (!
|
|
363
|
+
if (!Z(a)) return null;
|
|
373
364
|
if (a >= 0) {
|
|
374
365
|
let e = n[i];
|
|
375
366
|
return n[i] = e + a, {
|
|
@@ -384,25 +375,25 @@ function gr(e) {
|
|
|
384
375
|
};
|
|
385
376
|
}));
|
|
386
377
|
}
|
|
387
|
-
function
|
|
378
|
+
function Or(e) {
|
|
388
379
|
let t = Infinity, n = -Infinity;
|
|
389
|
-
for (let r of e)
|
|
380
|
+
for (let r of e) Z(r) && (r < t && (t = r), r > n && (n = r));
|
|
390
381
|
return t === Infinity ? null : [t, n];
|
|
391
382
|
}
|
|
392
|
-
function
|
|
383
|
+
function kr(e, t, n, r, i, a) {
|
|
393
384
|
if (n <= 0 || r <= 0) return "";
|
|
394
|
-
let o =
|
|
395
|
-
if (o === 0) return `M${
|
|
385
|
+
let o = mr(i, 0, Math.min(n, r) / 2), s = e + n, c = t + r;
|
|
386
|
+
if (o === 0) return `M${Q(e)} ${Q(t)}H${Q(s)}V${Q(c)}H${Q(e)}Z`;
|
|
396
387
|
switch (a) {
|
|
397
|
-
case "top": return `M${
|
|
398
|
-
case "bottom": return `M${
|
|
399
|
-
case "right": return `M${
|
|
400
|
-
case "left": return `M${
|
|
388
|
+
case "top": return `M${Q(e)} ${Q(c)}V${Q(t + o)}Q${Q(e)} ${Q(t)} ${Q(e + o)} ${Q(t)}H${Q(s - o)}Q${Q(s)} ${Q(t)} ${Q(s)} ${Q(t + o)}V${Q(c)}Z`;
|
|
389
|
+
case "bottom": return `M${Q(e)} ${Q(t)}H${Q(s)}V${Q(c - o)}Q${Q(s)} ${Q(c)} ${Q(s - o)} ${Q(c)}H${Q(e + o)}Q${Q(e)} ${Q(c)} ${Q(e)} ${Q(c - o)}Z`;
|
|
390
|
+
case "right": return `M${Q(e)} ${Q(t)}H${Q(s - o)}Q${Q(s)} ${Q(t)} ${Q(s)} ${Q(t + o)}V${Q(c - o)}Q${Q(s)} ${Q(c)} ${Q(s - o)} ${Q(c)}H${Q(e)}Z`;
|
|
391
|
+
case "left": return `M${Q(s)} ${Q(t)}H${Q(e + o)}Q${Q(e)} ${Q(t)} ${Q(e)} ${Q(t + o)}V${Q(c - o)}Q${Q(e)} ${Q(c)} ${Q(e + o)} ${Q(c)}H${Q(s)}Z`;
|
|
401
392
|
}
|
|
402
393
|
}
|
|
403
|
-
var
|
|
404
|
-
function
|
|
405
|
-
let r = e.map((e) =>
|
|
394
|
+
var Ar = Math.PI * 2;
|
|
395
|
+
function jr(e, t = 0, n = Ar) {
|
|
396
|
+
let r = e.map((e) => Z(e) && e > 0 ? e : 0), i = r.reduce((e, t) => e + t, 0);
|
|
406
397
|
if (i <= 0) return [];
|
|
407
398
|
let a = t;
|
|
408
399
|
return r.map((e, t) => {
|
|
@@ -416,40 +407,40 @@ function br(e, t = 0, n = yr) {
|
|
|
416
407
|
return a = o.end, o;
|
|
417
408
|
});
|
|
418
409
|
}
|
|
419
|
-
function
|
|
410
|
+
function $(e, t, n, r) {
|
|
420
411
|
return {
|
|
421
412
|
x: e + n * Math.sin(r),
|
|
422
413
|
y: t - n * Math.cos(r)
|
|
423
414
|
};
|
|
424
415
|
}
|
|
425
|
-
function
|
|
416
|
+
function Mr(e, t, n, r, i, a) {
|
|
426
417
|
let o = a - i;
|
|
427
418
|
if (o <= 0 || n <= 0) return "";
|
|
428
|
-
let s =
|
|
429
|
-
if (o >=
|
|
430
|
-
let r =
|
|
419
|
+
let s = mr(r, 0, n);
|
|
420
|
+
if (o >= Ar - 1e-6) {
|
|
421
|
+
let r = $(e, t, n, i), a = $(e, t, n, i + Math.PI), o = `M${Q(r.x)} ${Q(r.y)}A${Q(n)} ${Q(n)} 0 1 1 ${Q(a.x)} ${Q(a.y)}A${Q(n)} ${Q(n)} 0 1 1 ${Q(r.x)} ${Q(r.y)}Z`;
|
|
431
422
|
if (s > 0) {
|
|
432
|
-
let n =
|
|
433
|
-
o += `M${
|
|
423
|
+
let n = $(e, t, s, i), r = $(e, t, s, i + Math.PI);
|
|
424
|
+
o += `M${Q(n.x)} ${Q(n.y)}A${Q(s)} ${Q(s)} 0 1 0 ${Q(r.x)} ${Q(r.y)}A${Q(s)} ${Q(s)} 0 1 0 ${Q(n.x)} ${Q(n.y)}Z`;
|
|
434
425
|
}
|
|
435
426
|
return o;
|
|
436
427
|
}
|
|
437
|
-
let c = +(o > Math.PI), l =
|
|
438
|
-
if (s === 0) return `M${
|
|
439
|
-
let d =
|
|
440
|
-
return `M${
|
|
428
|
+
let c = +(o > Math.PI), l = $(e, t, n, i), u = $(e, t, n, a);
|
|
429
|
+
if (s === 0) return `M${Q(e)} ${Q(t)}L${Q(l.x)} ${Q(l.y)}A${Q(n)} ${Q(n)} 0 ${c} 1 ${Q(u.x)} ${Q(u.y)}Z`;
|
|
430
|
+
let d = $(e, t, s, a), f = $(e, t, s, i);
|
|
431
|
+
return `M${Q(l.x)} ${Q(l.y)}A${Q(n)} ${Q(n)} 0 ${c} 1 ${Q(u.x)} ${Q(u.y)}L${Q(d.x)} ${Q(d.y)}A${Q(s)} ${Q(s)} 0 ${c} 0 ${Q(f.x)} ${Q(f.y)}Z`;
|
|
441
432
|
}
|
|
442
|
-
function
|
|
433
|
+
function Nr(e, t, n, r, i) {
|
|
443
434
|
let a = i - r;
|
|
444
435
|
if (a <= 0 || n <= 0) return "";
|
|
445
|
-
if (a >=
|
|
446
|
-
let i =
|
|
447
|
-
return `M${
|
|
436
|
+
if (a >= Ar - 1e-6) {
|
|
437
|
+
let i = $(e, t, n, r), a = $(e, t, n, r + Math.PI);
|
|
438
|
+
return `M${Q(i.x)} ${Q(i.y)}A${Q(n)} ${Q(n)} 0 1 1 ${Q(a.x)} ${Q(a.y)}A${Q(n)} ${Q(n)} 0 1 1 ${Q(i.x)} ${Q(i.y)}`;
|
|
448
439
|
}
|
|
449
|
-
let o =
|
|
450
|
-
return `M${
|
|
440
|
+
let o = $(e, t, n, r), s = $(e, t, n, i);
|
|
441
|
+
return `M${Q(o.x)} ${Q(o.y)}A${Q(n)} ${Q(n)} 0 ${+(a > Math.PI)} 1 ${Q(s.x)} ${Q(s.y)}`;
|
|
451
442
|
}
|
|
452
|
-
function
|
|
443
|
+
function Pr(e) {
|
|
453
444
|
return e === "gauge" ? {
|
|
454
445
|
start: -3 * Math.PI / 4,
|
|
455
446
|
sweep: 3 * Math.PI / 2
|
|
@@ -458,67 +449,67 @@ function Cr(e) {
|
|
|
458
449
|
sweep: Math.PI
|
|
459
450
|
} : {
|
|
460
451
|
start: 0,
|
|
461
|
-
sweep:
|
|
452
|
+
sweep: Ar
|
|
462
453
|
};
|
|
463
454
|
}
|
|
464
|
-
function
|
|
455
|
+
function Fr(e, t, n) {
|
|
465
456
|
if (!t?.length) return n;
|
|
466
457
|
let r = [...t].sort((e, t) => e.at - t.at), i = n;
|
|
467
458
|
for (let t of r) e >= t.at && (i = t.color);
|
|
468
459
|
return i;
|
|
469
460
|
}
|
|
470
|
-
function
|
|
471
|
-
return !
|
|
461
|
+
function Ir(e, t) {
|
|
462
|
+
return !Z(e) || !Z(t) || t <= 0 ? 0 : mr(e / t * 100, 0, 100);
|
|
472
463
|
}
|
|
473
|
-
function
|
|
474
|
-
return
|
|
464
|
+
function Lr(e) {
|
|
465
|
+
return Z(e) ? e.toLocaleString("en-US", { maximumFractionDigits: 2 }) : "";
|
|
475
466
|
}
|
|
476
|
-
var
|
|
467
|
+
var Rr = [[1e8, "亿"], [1e4, "万"]], zr = [
|
|
477
468
|
[1e9, "B"],
|
|
478
469
|
[1e6, "M"],
|
|
479
470
|
[1e3, "K"]
|
|
480
471
|
];
|
|
481
|
-
function
|
|
482
|
-
if (!
|
|
472
|
+
function Br(e, t = Rr) {
|
|
473
|
+
if (!Z(e)) return "";
|
|
483
474
|
let n = Math.abs(e);
|
|
484
475
|
for (let [r, i] of t) if (n >= r) return `${Number((e / r).toFixed(2))}${i}`;
|
|
485
|
-
return
|
|
476
|
+
return Lr(e);
|
|
486
477
|
}
|
|
487
|
-
function
|
|
488
|
-
let t =
|
|
478
|
+
function Vr(e) {
|
|
479
|
+
let t = Or(e);
|
|
489
480
|
if (!t) return null;
|
|
490
481
|
let n = -1;
|
|
491
482
|
return e.forEach((e, t) => {
|
|
492
|
-
|
|
483
|
+
Z(e) && (n = t);
|
|
493
484
|
}), {
|
|
494
|
-
count: e.filter(
|
|
485
|
+
count: e.filter(Z).length,
|
|
495
486
|
min: t[0],
|
|
496
487
|
max: t[1],
|
|
497
488
|
last: e[n],
|
|
498
489
|
lastIndex: n
|
|
499
490
|
};
|
|
500
491
|
}
|
|
501
|
-
function
|
|
492
|
+
function Hr(e) {
|
|
502
493
|
return `${Number((e * 100).toFixed(1))}%`;
|
|
503
494
|
}
|
|
504
|
-
function
|
|
505
|
-
let t =
|
|
506
|
-
return
|
|
495
|
+
function Ur(e) {
|
|
496
|
+
let t = G(), n = G(0), r;
|
|
497
|
+
return Wt(() => {
|
|
507
498
|
let e = t.value;
|
|
508
499
|
e && (n.value = Math.round(e.getBoundingClientRect().width), typeof ResizeObserver < "u" && (r = new ResizeObserver((e) => {
|
|
509
500
|
let t = Math.round(e[e.length - 1]?.contentRect.width ?? 0);
|
|
510
501
|
t > 0 && (n.value = t);
|
|
511
502
|
}), r.observe(e)));
|
|
512
|
-
}),
|
|
503
|
+
}), Ht(() => r?.disconnect()), {
|
|
513
504
|
el: t,
|
|
514
|
-
width:
|
|
505
|
+
width: P(() => {
|
|
515
506
|
let t = e?.();
|
|
516
507
|
return t && t > 0 ? t : n.value > 0 ? n.value : 480;
|
|
517
508
|
})
|
|
518
509
|
};
|
|
519
510
|
}
|
|
520
|
-
function
|
|
521
|
-
let e =
|
|
511
|
+
function Wr() {
|
|
512
|
+
let e = G(/* @__PURE__ */ new Set());
|
|
522
513
|
function t(t, n) {
|
|
523
514
|
let r = new Set(e.value);
|
|
524
515
|
r.has(t) ? r.delete(t) : n - r.size > 1 && r.add(t), e.value = r;
|
|
@@ -528,11 +519,11 @@ function Mr() {
|
|
|
528
519
|
toggle: t
|
|
529
520
|
};
|
|
530
521
|
}
|
|
531
|
-
function
|
|
522
|
+
function Gr(e, t) {
|
|
532
523
|
return t ?? `var(--ca-chart-${e % 8 + 1})`;
|
|
533
524
|
}
|
|
534
525
|
// packages/ui/src/components/chart/parts/ChartLegend.vue?vue&type=script&setup=true&lang.ts
|
|
535
|
-
var
|
|
526
|
+
var Kr = { class: "ca-chart__legend" }, qr = /* @__PURE__ */ V({
|
|
536
527
|
__name: "ChartLegend",
|
|
537
528
|
props: {
|
|
538
529
|
items: {},
|
|
@@ -541,16 +532,16 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
541
532
|
},
|
|
542
533
|
emits: ["toggle"],
|
|
543
534
|
setup(e) {
|
|
544
|
-
return (t, n) => (
|
|
545
|
-
class:
|
|
535
|
+
return (t, n) => (W(), L("ul", Kr, [(W(!0), L(N, null, K(e.items, (n, r) => (W(), L("li", { key: r }, [(W(), F(Kt(e.interactive ? "button" : "span"), {
|
|
536
|
+
class: H(["ca-chart__legend-item", { "is-off": n.off }]),
|
|
546
537
|
type: e.interactive ? "button" : void 0,
|
|
547
538
|
"aria-pressed": e.interactive ? !n.off : void 0,
|
|
548
539
|
onClick: (n) => e.interactive && t.$emit("toggle", r)
|
|
549
540
|
}, {
|
|
550
|
-
default:
|
|
551
|
-
class:
|
|
552
|
-
style:
|
|
553
|
-
}, null, 6),
|
|
541
|
+
default: X(() => [R("span", {
|
|
542
|
+
class: H(["ca-chart__key", `ca-chart__key--${e.shape ?? "box"}`]),
|
|
543
|
+
style: U({ "--key": n.color })
|
|
544
|
+
}, null, 6), R("span", null, J(n.name), 1)]),
|
|
554
545
|
_: 2
|
|
555
546
|
}, 1032, [
|
|
556
547
|
"class",
|
|
@@ -559,21 +550,21 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
559
550
|
"onClick"
|
|
560
551
|
]))]))), 128))]));
|
|
561
552
|
}
|
|
562
|
-
}),
|
|
553
|
+
}), Jr = ["role"], Yr = /* @__PURE__ */ V({
|
|
563
554
|
__name: "ChartStatus",
|
|
564
555
|
props: {
|
|
565
556
|
loading: { type: Boolean },
|
|
566
557
|
empty: { type: Boolean }
|
|
567
558
|
},
|
|
568
559
|
setup(e) {
|
|
569
|
-
let t =
|
|
570
|
-
return (n, r) => e.loading || e.empty ? (
|
|
560
|
+
let t = s();
|
|
561
|
+
return (n, r) => e.loading || e.empty ? (W(), L("div", {
|
|
571
562
|
key: 0,
|
|
572
563
|
class: "ca-chart__status",
|
|
573
564
|
role: e.loading ? "status" : void 0
|
|
574
|
-
},
|
|
565
|
+
}, J(e.loading ? Y(t)("campus.chart.loading") : Y(t)("campus.chart.empty")), 9, Jr)) : I("v-if", !0);
|
|
575
566
|
}
|
|
576
|
-
}),
|
|
567
|
+
}), Xr = { class: "ca-chart__sr" }, Zr = { key: 0 }, Qr = { scope: "row" }, $r = /* @__PURE__ */ V({
|
|
577
568
|
__name: "ChartTable",
|
|
578
569
|
props: {
|
|
579
570
|
caption: {},
|
|
@@ -581,19 +572,19 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
581
572
|
rows: {}
|
|
582
573
|
},
|
|
583
574
|
setup(e) {
|
|
584
|
-
return (t, n) => (
|
|
585
|
-
e.caption ? (
|
|
586
|
-
|
|
575
|
+
return (t, n) => (W(), L("div", Xr, [R("table", null, [
|
|
576
|
+
e.caption ? (W(), L("caption", Zr, J(e.caption), 1)) : I("v-if", !0),
|
|
577
|
+
R("thead", null, [R("tr", null, [(W(!0), L(N, null, K(e.head, (e, t) => (W(), L("th", {
|
|
587
578
|
key: t,
|
|
588
579
|
scope: "col"
|
|
589
|
-
},
|
|
590
|
-
|
|
580
|
+
}, J(e), 1))), 128))])]),
|
|
581
|
+
R("tbody", null, [(W(!0), L(N, null, K(e.rows, (e, t) => (W(), L("tr", { key: t }, [R("th", Qr, J(e[0]), 1), (W(!0), L(N, null, K(e.slice(1), (e, t) => (W(), L("td", { key: t }, J(e), 1))), 128))]))), 128))])
|
|
591
582
|
])]));
|
|
592
583
|
}
|
|
593
|
-
}),
|
|
584
|
+
}), ei = {
|
|
594
585
|
key: 0,
|
|
595
586
|
class: "ca-chart__tip-title"
|
|
596
|
-
},
|
|
587
|
+
}, ti = { class: "ca-chart__tip-name" }, ni = { class: "ca-chart__tip-value" }, ri = /* @__PURE__ */ V({
|
|
597
588
|
__name: "ChartTooltip",
|
|
598
589
|
props: {
|
|
599
590
|
x: {},
|
|
@@ -603,50 +594,50 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
603
594
|
rows: {}
|
|
604
595
|
},
|
|
605
596
|
setup(e) {
|
|
606
|
-
return (t, n) => (
|
|
597
|
+
return (t, n) => (W(), L("div", {
|
|
607
598
|
class: "ca-chart__tip",
|
|
608
|
-
style:
|
|
599
|
+
style: U({
|
|
609
600
|
left: `${e.x}px`,
|
|
610
601
|
top: `${e.y}px`,
|
|
611
602
|
transform: e.x > e.width / 2 ? "translateX(calc(-100% - 12px))" : "translateX(12px)"
|
|
612
603
|
})
|
|
613
|
-
}, [e.title ? (
|
|
604
|
+
}, [e.title ? (W(), L("div", ei, J(e.title), 1)) : I("v-if", !0), (W(!0), L(N, null, K(e.rows, (e, t) => (W(), L("div", {
|
|
614
605
|
key: t,
|
|
615
606
|
class: "ca-chart__tip-row"
|
|
616
607
|
}, [
|
|
617
|
-
|
|
608
|
+
R("span", {
|
|
618
609
|
class: "ca-chart__key",
|
|
619
|
-
style:
|
|
610
|
+
style: U({ "--key": e.color })
|
|
620
611
|
}, null, 4),
|
|
621
|
-
|
|
622
|
-
|
|
612
|
+
R("span", ti, J(e.name), 1),
|
|
613
|
+
R("span", ni, J(e.value), 1)
|
|
623
614
|
]))), 128))], 4));
|
|
624
615
|
}
|
|
625
|
-
}),
|
|
616
|
+
}), ii = ["aria-busy"], ai = { class: "ca-chart__canvas" }, oi = [
|
|
626
617
|
"aria-label",
|
|
627
618
|
"width",
|
|
628
619
|
"height",
|
|
629
620
|
"viewBox"
|
|
630
|
-
],
|
|
621
|
+
], si = [
|
|
631
622
|
"x1",
|
|
632
623
|
"x2",
|
|
633
624
|
"y1",
|
|
634
625
|
"y2"
|
|
635
|
-
],
|
|
626
|
+
], ci = ["x", "y"], li = [
|
|
636
627
|
"x1",
|
|
637
628
|
"x2",
|
|
638
629
|
"y1",
|
|
639
630
|
"y2"
|
|
640
|
-
],
|
|
631
|
+
], ui = [
|
|
641
632
|
"x",
|
|
642
633
|
"y",
|
|
643
634
|
"text-anchor"
|
|
644
|
-
],
|
|
635
|
+
], di = [
|
|
645
636
|
"x1",
|
|
646
637
|
"x2",
|
|
647
638
|
"y1",
|
|
648
639
|
"y2"
|
|
649
|
-
],
|
|
640
|
+
], fi = { class: "ca-chart__reveal" }, pi = ["d"], mi = ["d"], hi = { class: "ca-chart__fade" }, gi = ["cx", "cy"], _i = ["cx", "cy"], vi = 400, yi = /* @__PURE__ */ V({
|
|
650
641
|
__name: "CaLineChart",
|
|
651
642
|
props: {
|
|
652
643
|
categories: {},
|
|
@@ -681,28 +672,28 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
681
672
|
}
|
|
682
673
|
},
|
|
683
674
|
setup(e) {
|
|
684
|
-
let t = e, n =
|
|
675
|
+
let t = e, n = s(), { el: r, width: i } = Ur(() => t.width), { hidden: a, toggle: o } = Wr(), c = P(() => t.categories.length), l = P(() => t.series.map((e, t) => ({
|
|
685
676
|
index: t,
|
|
686
677
|
name: e.name,
|
|
687
|
-
data: e.data.slice(0,
|
|
688
|
-
color:
|
|
689
|
-
}))),
|
|
690
|
-
let e =
|
|
691
|
-
return
|
|
692
|
-
}),
|
|
678
|
+
data: e.data.slice(0, c.value),
|
|
679
|
+
color: Gr(t, e.color)
|
|
680
|
+
}))), u = P(() => l.value.filter((e) => !a.value.has(e.index))), d = P(() => c.value > 0 && l.value.some((e) => Or(e.data))), f = (e) => (t.valueFormatter ?? Lr)(e), p = P(() => n("campus.chart.compact") === "latin" ? zr : Rr), m = (e) => (t.yFormatter ?? ((e) => Br(e, p.value)))(e), h = P(() => {
|
|
681
|
+
let e = Or(u.value.flatMap((e) => e.data)) ?? [0, 1];
|
|
682
|
+
return _r(t.yMin ?? e[0], t.yMax ?? e[1], 5, t.area || t.zero);
|
|
683
|
+
}), g = P(() => h.value.ticks.map((e) => ({
|
|
693
684
|
tick: e,
|
|
694
|
-
text:
|
|
695
|
-
}))),
|
|
685
|
+
text: m(e)
|
|
686
|
+
}))), _ = P(() => Math.max(32, Math.max(...g.value.map((e) => e.text.length)) * 7 + 14)), v = {
|
|
696
687
|
top: 12,
|
|
697
688
|
right: 16,
|
|
698
689
|
bottom: 28
|
|
699
|
-
},
|
|
700
|
-
let e =
|
|
701
|
-
return Array.from({ length:
|
|
702
|
-
}),
|
|
690
|
+
}, y = P(() => Math.max(10, i.value - _.value - v.right)), b = P(() => Math.max(10, t.height - v.top - v.bottom)), x = P(() => vr(h.value.min, h.value.max, v.top + b.value, v.top)), S = P(() => {
|
|
691
|
+
let e = yr(c.value, _.value, _.value + y.value, 0);
|
|
692
|
+
return Array.from({ length: c.value }, (t, n) => e.center(n));
|
|
693
|
+
}), C = P(() => x.value(Math.max(h.value.min, Math.min(0, h.value.max)))), w = P(() => {
|
|
703
694
|
let e = Math.max(1, ...t.categories.map((e) => e.length));
|
|
704
|
-
return
|
|
705
|
-
let n =
|
|
695
|
+
return br(c.value, y.value, Math.max(40, e * 7 + 16)).map((e) => {
|
|
696
|
+
let n = S.value[e], r = n - _.value < 20 ? "start" : i.value - n < 20 ? "end" : "middle";
|
|
706
697
|
return {
|
|
707
698
|
i: e,
|
|
708
699
|
x: n,
|
|
@@ -710,229 +701,229 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
710
701
|
anchor: r
|
|
711
702
|
};
|
|
712
703
|
});
|
|
713
|
-
}),
|
|
714
|
-
let n = e.data.map((e, t) =>
|
|
715
|
-
x:
|
|
716
|
-
y:
|
|
717
|
-
} : null), r = e.data.reduce((e, t, n) =>
|
|
704
|
+
}), T = P(() => u.value.map((e) => {
|
|
705
|
+
let n = e.data.map((e, t) => Z(e) ? {
|
|
706
|
+
x: S.value[t],
|
|
707
|
+
y: x.value(e)
|
|
708
|
+
} : null), r = e.data.reduce((e, t, n) => Z(t) ? n : e, -1);
|
|
718
709
|
return {
|
|
719
710
|
...e,
|
|
720
|
-
line:
|
|
721
|
-
area: t.area ?
|
|
711
|
+
line: Tr(n, t.smooth),
|
|
712
|
+
area: t.area ? Er(n, C.value, t.smooth) : "",
|
|
722
713
|
end: r >= 0 ? n[r] : null,
|
|
723
714
|
points: n
|
|
724
715
|
};
|
|
725
|
-
})),
|
|
726
|
-
function
|
|
716
|
+
})), E = G(-1);
|
|
717
|
+
function D(e) {
|
|
727
718
|
let t = e.currentTarget.getBoundingClientRect();
|
|
728
|
-
|
|
719
|
+
E.value = xr(S.value, e.clientX - t.left);
|
|
729
720
|
}
|
|
730
|
-
function
|
|
731
|
-
let t =
|
|
732
|
-
if (e.key === "ArrowRight") n =
|
|
733
|
-
else if (e.key === "ArrowLeft") n =
|
|
721
|
+
function O(e) {
|
|
722
|
+
let t = c.value - 1, n = E.value;
|
|
723
|
+
if (e.key === "ArrowRight") n = E.value < 0 ? 0 : Math.min(t, E.value + 1);
|
|
724
|
+
else if (e.key === "ArrowLeft") n = E.value < 0 ? t : Math.max(0, E.value - 1);
|
|
734
725
|
else if (e.key === "Home") n = 0;
|
|
735
726
|
else if (e.key === "End") n = t;
|
|
736
727
|
else if (e.key === "Escape") n = -1;
|
|
737
728
|
else return;
|
|
738
|
-
e.preventDefault(),
|
|
729
|
+
e.preventDefault(), E.value = n;
|
|
739
730
|
}
|
|
740
|
-
function
|
|
741
|
-
e.target.matches?.(":focus-visible") &&
|
|
731
|
+
function ee(e) {
|
|
732
|
+
e.target.matches?.(":focus-visible") && E.value < 0 && (E.value = Math.max(0, c.value - 1));
|
|
742
733
|
}
|
|
743
|
-
let
|
|
744
|
-
let e =
|
|
745
|
-
return e < 0 || e >=
|
|
746
|
-
x:
|
|
734
|
+
let k = P(() => {
|
|
735
|
+
let e = E.value;
|
|
736
|
+
return e < 0 || e >= c.value ? null : {
|
|
737
|
+
x: S.value[e],
|
|
747
738
|
title: t.categories[e],
|
|
748
|
-
rows:
|
|
739
|
+
rows: u.value.map((t) => ({
|
|
749
740
|
name: t.name,
|
|
750
741
|
color: t.color,
|
|
751
|
-
value:
|
|
742
|
+
value: Z(t.data[e]) ? f(t.data[e]) : "—"
|
|
752
743
|
}))
|
|
753
744
|
};
|
|
754
|
-
}),
|
|
745
|
+
}), A = P(() => t.legend ?? t.series.length > 1), j = P(() => l.value.map((e) => ({
|
|
755
746
|
name: e.name,
|
|
756
747
|
color: e.color,
|
|
757
748
|
off: a.value.has(e.index)
|
|
758
|
-
}))),
|
|
749
|
+
}))), M = P(() => {
|
|
759
750
|
let e = [n("campus.chart.summaryLine", {
|
|
760
751
|
title: t.title ?? "",
|
|
761
|
-
categories:
|
|
762
|
-
series:
|
|
752
|
+
categories: c.value,
|
|
753
|
+
series: l.value.length
|
|
763
754
|
})];
|
|
764
|
-
for (let r of
|
|
765
|
-
let i =
|
|
755
|
+
for (let r of l.value.slice(0, 6)) {
|
|
756
|
+
let i = Vr(r.data);
|
|
766
757
|
i && e.push(n("campus.chart.summarySeries", {
|
|
767
758
|
name: r.name,
|
|
768
|
-
min:
|
|
769
|
-
max:
|
|
770
|
-
last:
|
|
759
|
+
min: f(i.min),
|
|
760
|
+
max: f(i.max),
|
|
761
|
+
last: f(i.last),
|
|
771
762
|
category: t.categories[i.lastIndex] ?? ""
|
|
772
763
|
}));
|
|
773
764
|
}
|
|
774
765
|
return e.join(" ");
|
|
775
|
-
}),
|
|
776
|
-
return (t, n) => (
|
|
766
|
+
}), te = P(() => t.categories.slice(0, vi).map((e, t) => [e, ...l.value.map((e) => Z(e.data[t]) ? f(e.data[t]) : "")])), ne = P(() => [n("campus.chart.category"), ...l.value.map((e) => e.name)]);
|
|
767
|
+
return (t, n) => (W(), L("div", {
|
|
777
768
|
ref_key: "el",
|
|
778
769
|
ref: r,
|
|
779
|
-
class:
|
|
770
|
+
class: H(["ca-chart ca-line-chart", {
|
|
780
771
|
"is-loading": e.loading,
|
|
781
772
|
"is-animated": e.animated
|
|
782
773
|
}]),
|
|
783
774
|
"aria-busy": e.loading || void 0
|
|
784
775
|
}, [
|
|
785
|
-
|
|
776
|
+
A.value && d.value ? (W(), F(qr, {
|
|
786
777
|
key: 0,
|
|
787
|
-
items:
|
|
778
|
+
items: j.value,
|
|
788
779
|
shape: "line",
|
|
789
780
|
interactive: "",
|
|
790
|
-
onToggle: n[0] ||= (e) =>
|
|
791
|
-
}, null, 8, ["items"])) :
|
|
792
|
-
|
|
781
|
+
onToggle: n[0] ||= (e) => Y(o)(e, l.value.length)
|
|
782
|
+
}, null, 8, ["items"])) : I("v-if", !0),
|
|
783
|
+
R("div", {
|
|
793
784
|
class: "ca-chart__plot",
|
|
794
|
-
style:
|
|
785
|
+
style: U({ height: `${e.height}px` })
|
|
795
786
|
}, [
|
|
796
|
-
|
|
787
|
+
R("div", ai, [d.value ? (W(), L("svg", {
|
|
797
788
|
key: 0,
|
|
798
789
|
class: "ca-chart__svg",
|
|
799
790
|
role: "img",
|
|
800
791
|
tabindex: "0",
|
|
801
|
-
"aria-label":
|
|
802
|
-
width:
|
|
792
|
+
"aria-label": M.value,
|
|
793
|
+
width: Y(i),
|
|
803
794
|
height: e.height,
|
|
804
|
-
viewBox: `0 0 ${
|
|
805
|
-
onPointermove:
|
|
806
|
-
onPointerdown:
|
|
807
|
-
onPointerleave: n[1] ||= (e) =>
|
|
808
|
-
onKeydown:
|
|
809
|
-
onFocus:
|
|
810
|
-
onBlur: n[2] ||= (e) =>
|
|
795
|
+
viewBox: `0 0 ${Y(i)} ${e.height}`,
|
|
796
|
+
onPointermove: D,
|
|
797
|
+
onPointerdown: D,
|
|
798
|
+
onPointerleave: n[1] ||= (e) => E.value = -1,
|
|
799
|
+
onKeydown: O,
|
|
800
|
+
onFocus: ee,
|
|
801
|
+
onBlur: n[2] ||= (e) => E.value = -1
|
|
811
802
|
}, [
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
(
|
|
815
|
-
class:
|
|
816
|
-
x1:
|
|
817
|
-
x2:
|
|
818
|
-
y1:
|
|
819
|
-
y2:
|
|
820
|
-
}, null, 10,
|
|
803
|
+
I(" 网格与纵轴刻度 "),
|
|
804
|
+
R("g", null, [
|
|
805
|
+
(W(!0), L(N, null, K(g.value, (e) => (W(), L(N, { key: e.tick }, [R("line", {
|
|
806
|
+
class: H(e.tick === h.value.min ? "ca-chart__baseline" : "ca-chart__grid"),
|
|
807
|
+
x1: _.value,
|
|
808
|
+
x2: _.value + y.value,
|
|
809
|
+
y1: x.value(e.tick),
|
|
810
|
+
y2: x.value(e.tick)
|
|
811
|
+
}, null, 10, si), R("text", {
|
|
821
812
|
class: "ca-chart__tick",
|
|
822
|
-
x:
|
|
823
|
-
y:
|
|
813
|
+
x: _.value - 8,
|
|
814
|
+
y: x.value(e.tick),
|
|
824
815
|
dy: "0.32em",
|
|
825
816
|
"text-anchor": "end"
|
|
826
|
-
},
|
|
827
|
-
|
|
828
|
-
|
|
817
|
+
}, J(e.text), 9, ci)], 64))), 128)),
|
|
818
|
+
I(" 有负值时,0 线单独加深,表示正负分界 "),
|
|
819
|
+
h.value.min < 0 ? (W(), L("line", {
|
|
829
820
|
key: 0,
|
|
830
821
|
class: "ca-chart__baseline",
|
|
831
|
-
x1:
|
|
832
|
-
x2:
|
|
833
|
-
y1:
|
|
834
|
-
y2:
|
|
835
|
-
}, null, 8,
|
|
822
|
+
x1: _.value,
|
|
823
|
+
x2: _.value + y.value,
|
|
824
|
+
y1: x.value(0),
|
|
825
|
+
y2: x.value(0)
|
|
826
|
+
}, null, 8, li)) : I("v-if", !0)
|
|
836
827
|
]),
|
|
837
|
-
|
|
828
|
+
R("g", null, [(W(!0), L(N, null, K(w.value, (e) => (W(), L("text", {
|
|
838
829
|
key: e.i,
|
|
839
830
|
class: "ca-chart__tick",
|
|
840
831
|
x: e.x,
|
|
841
|
-
y:
|
|
832
|
+
y: v.top + b.value + 18,
|
|
842
833
|
"text-anchor": e.anchor
|
|
843
|
-
},
|
|
844
|
-
|
|
845
|
-
|
|
834
|
+
}, J(e.text), 9, ui))), 128))]),
|
|
835
|
+
I(" 悬停十字线:贴着最近的数据位置,读者只需要瞄准某个类目 "),
|
|
836
|
+
k.value ? (W(), L("line", {
|
|
846
837
|
key: 0,
|
|
847
838
|
class: "ca-chart__cross",
|
|
848
|
-
x1:
|
|
849
|
-
x2:
|
|
850
|
-
y1:
|
|
851
|
-
y2:
|
|
852
|
-
}, null, 8,
|
|
853
|
-
|
|
854
|
-
|
|
839
|
+
x1: k.value.x,
|
|
840
|
+
x2: k.value.x,
|
|
841
|
+
y1: v.top,
|
|
842
|
+
y2: v.top + b.value
|
|
843
|
+
}, null, 8, di)) : I("v-if", !0),
|
|
844
|
+
I(" 数据 "),
|
|
845
|
+
R("g", fi, [(W(!0), L(N, null, K(T.value, (e) => (W(), L(N, { key: e.index }, [e.area ? (W(), L("path", {
|
|
855
846
|
key: 0,
|
|
856
847
|
class: "ca-chart__area",
|
|
857
848
|
d: e.area,
|
|
858
|
-
style:
|
|
859
|
-
}, null, 12,
|
|
849
|
+
style: U({ fill: e.color })
|
|
850
|
+
}, null, 12, pi)) : I("v-if", !0), R("path", {
|
|
860
851
|
class: "ca-chart__line",
|
|
861
852
|
d: e.line,
|
|
862
|
-
style:
|
|
863
|
-
}, null, 12,
|
|
864
|
-
|
|
853
|
+
style: U({ stroke: e.color })
|
|
854
|
+
}, null, 12, mi)], 64))), 128))]),
|
|
855
|
+
R("g", hi, [I(" 没有悬停时在每条线末端放一个点,帮助读出“最新值” "), k.value ? (W(!0), L(N, { key: 1 }, K(T.value, (e) => (W(), L(N, { key: e.index }, [e.points[E.value] ? (W(), L("circle", {
|
|
865
856
|
key: 0,
|
|
866
857
|
class: "ca-chart__dot",
|
|
867
|
-
cx: e.points[
|
|
868
|
-
cy: e.points[
|
|
858
|
+
cx: e.points[E.value].x,
|
|
859
|
+
cy: e.points[E.value].y,
|
|
869
860
|
r: "4.5",
|
|
870
|
-
style:
|
|
871
|
-
}, null, 12,
|
|
861
|
+
style: U({ fill: e.color })
|
|
862
|
+
}, null, 12, _i)) : I("v-if", !0)], 64))), 128)) : (W(!0), L(N, { key: 0 }, K(T.value, (e) => Qt((W(), L("circle", {
|
|
872
863
|
key: e.index,
|
|
873
864
|
class: "ca-chart__dot",
|
|
874
865
|
cx: e.end?.x,
|
|
875
866
|
cy: e.end?.y,
|
|
876
867
|
r: "4",
|
|
877
|
-
style:
|
|
878
|
-
}, null, 12,
|
|
879
|
-
], 40,
|
|
880
|
-
|
|
868
|
+
style: U({ fill: e.color })
|
|
869
|
+
}, null, 12, gi)), [[Xt, e.end]])), 128))])
|
|
870
|
+
], 40, oi)) : I("v-if", !0)]),
|
|
871
|
+
k.value ? (W(), F(ri, {
|
|
881
872
|
key: 0,
|
|
882
|
-
x:
|
|
883
|
-
y:
|
|
884
|
-
width:
|
|
885
|
-
title:
|
|
886
|
-
rows:
|
|
873
|
+
x: k.value.x,
|
|
874
|
+
y: v.top,
|
|
875
|
+
width: Y(i),
|
|
876
|
+
title: k.value.title,
|
|
877
|
+
rows: k.value.rows
|
|
887
878
|
}, null, 8, [
|
|
888
879
|
"x",
|
|
889
880
|
"y",
|
|
890
881
|
"width",
|
|
891
882
|
"title",
|
|
892
883
|
"rows"
|
|
893
|
-
])) :
|
|
894
|
-
|
|
884
|
+
])) : I("v-if", !0),
|
|
885
|
+
B(Yr, {
|
|
895
886
|
loading: e.loading,
|
|
896
|
-
empty: !
|
|
887
|
+
empty: !d.value && !e.loading
|
|
897
888
|
}, null, 8, ["loading", "empty"])
|
|
898
889
|
], 4),
|
|
899
|
-
|
|
890
|
+
d.value ? (W(), F($r, {
|
|
900
891
|
key: 1,
|
|
901
892
|
caption: e.title,
|
|
902
|
-
head:
|
|
903
|
-
rows:
|
|
893
|
+
head: ne.value,
|
|
894
|
+
rows: te.value
|
|
904
895
|
}, null, 8, [
|
|
905
896
|
"caption",
|
|
906
897
|
"head",
|
|
907
898
|
"rows"
|
|
908
|
-
])) :
|
|
909
|
-
], 10,
|
|
899
|
+
])) : I("v-if", !0)
|
|
900
|
+
], 10, ii));
|
|
910
901
|
}
|
|
911
|
-
}),
|
|
902
|
+
}), bi = ["aria-busy"], xi = { class: "ca-chart__canvas" }, Si = [
|
|
912
903
|
"aria-label",
|
|
913
904
|
"width",
|
|
914
905
|
"height",
|
|
915
906
|
"viewBox"
|
|
916
|
-
],
|
|
907
|
+
], Ci = { key: 0 }, wi = [
|
|
917
908
|
"x1",
|
|
918
909
|
"x2",
|
|
919
910
|
"y1",
|
|
920
911
|
"y2"
|
|
921
|
-
],
|
|
912
|
+
], Ti = ["x", "y"], Ei = { key: 1 }, Di = [
|
|
922
913
|
"x1",
|
|
923
914
|
"x2",
|
|
924
915
|
"y1",
|
|
925
916
|
"y2"
|
|
926
|
-
],
|
|
917
|
+
], Oi = ["x", "y"], ki = ["x", "y"], Ai = ["x", "y"], ji = [
|
|
927
918
|
"x",
|
|
928
919
|
"y",
|
|
929
920
|
"width",
|
|
930
921
|
"height"
|
|
931
|
-
],
|
|
922
|
+
], Mi = ["d"], Ni = { class: "ca-chart__fade" }, Pi = [
|
|
932
923
|
"x",
|
|
933
924
|
"y",
|
|
934
925
|
"text-anchor"
|
|
935
|
-
],
|
|
926
|
+
], Fi = 2, Ii = 4, Li = 400, Ri = /* @__PURE__ */ V({
|
|
936
927
|
__name: "CaBarChart",
|
|
937
928
|
props: {
|
|
938
929
|
categories: {},
|
|
@@ -966,58 +957,58 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
966
957
|
}
|
|
967
958
|
},
|
|
968
959
|
setup(e) {
|
|
969
|
-
let t = e, n =
|
|
960
|
+
let t = e, n = s(), { el: r, width: i } = Ur(() => t.width), { hidden: a, toggle: o } = Wr(), c = P(() => t.categories.length), l = P(() => t.series.map((e, t) => ({
|
|
970
961
|
index: t,
|
|
971
962
|
name: e.name,
|
|
972
|
-
data: e.data.slice(0,
|
|
973
|
-
color:
|
|
974
|
-
}))),
|
|
963
|
+
data: e.data.slice(0, c.value),
|
|
964
|
+
color: Gr(t, e.color)
|
|
965
|
+
}))), u = P(() => l.value.filter((e) => !a.value.has(e.index))), d = P(() => c.value > 0 && l.value.some((e) => Or(e.data))), f = (e) => (t.valueFormatter ?? Lr)(e), p = P(() => n("campus.chart.compact") === "latin" ? zr : Rr), m = (e) => (t.yFormatter ?? ((e) => Br(e, p.value)))(e), h = P(() => Dr(u.value.map((e) => e.data))), g = P(() => {
|
|
975
966
|
let e = [];
|
|
976
|
-
if (t.stacked) for (let t of
|
|
977
|
-
else for (let t of
|
|
978
|
-
let n =
|
|
979
|
-
return
|
|
980
|
-
}),
|
|
967
|
+
if (t.stacked) for (let t of h.value) for (let n of t) n && e.push(n.from, n.to);
|
|
968
|
+
else for (let t of u.value) for (let n of t.data) Z(n) && e.push(n);
|
|
969
|
+
let n = Or(e) ?? [0, 1];
|
|
970
|
+
return _r(n[0], n[1], 5, !0);
|
|
971
|
+
}), _ = P(() => g.value.ticks.map((e) => ({
|
|
981
972
|
tick: e,
|
|
982
|
-
text:
|
|
983
|
-
}))),
|
|
973
|
+
text: m(e)
|
|
974
|
+
}))), v = P(() => {
|
|
984
975
|
let e = 12 + (t.showValues && !t.horizontal ? 14 : 0);
|
|
985
976
|
if (!t.horizontal) return {
|
|
986
977
|
top: e,
|
|
987
978
|
right: 16,
|
|
988
979
|
bottom: 28,
|
|
989
|
-
left: Math.max(32, Math.max(...
|
|
980
|
+
left: Math.max(32, Math.max(..._.value.map((e) => e.text.length)) * 7 + 14)
|
|
990
981
|
};
|
|
991
|
-
let n =
|
|
982
|
+
let n = mr(Math.max(1, ...t.categories.map((e) => e.length)) * 13 + 16, 48, Math.max(48, i.value * .4));
|
|
992
983
|
return {
|
|
993
984
|
top: e,
|
|
994
985
|
right: t.showValues ? 56 : 24,
|
|
995
986
|
bottom: 28,
|
|
996
987
|
left: n
|
|
997
988
|
};
|
|
998
|
-
}),
|
|
999
|
-
|
|
1000
|
-
function
|
|
989
|
+
}), y = P(() => Math.max(10, i.value - v.value.left - v.value.right)), b = P(() => Math.max(10, t.height - v.value.top - v.value.bottom)), x = P(() => t.horizontal ? vr(g.value.min, g.value.max, v.value.left, v.value.left + y.value) : vr(g.value.min, g.value.max, v.value.top + b.value, v.value.top)), S = P(() => t.horizontal ? yr(c.value, v.value.top, v.value.top + b.value, .3) : yr(c.value, v.value.left, v.value.left + y.value, .3));
|
|
990
|
+
P(() => x.value(0));
|
|
991
|
+
function C(e) {
|
|
1001
992
|
if (!t.horizontal) return e;
|
|
1002
|
-
let n = Math.max(2, Math.floor((
|
|
993
|
+
let n = Math.max(2, Math.floor((v.value.left - 16) / 13));
|
|
1003
994
|
return e.length > n ? `${e.slice(0, n - 1)}…` : e;
|
|
1004
995
|
}
|
|
1005
|
-
let
|
|
996
|
+
let w = P(() => {
|
|
1006
997
|
if (t.horizontal) return t.categories.map((e, t) => ({
|
|
1007
998
|
i: t,
|
|
1008
|
-
text:
|
|
1009
|
-
pos:
|
|
999
|
+
text: C(e),
|
|
1000
|
+
pos: S.value.center(t)
|
|
1010
1001
|
}));
|
|
1011
1002
|
let e = Math.max(1, ...t.categories.map((e) => e.length));
|
|
1012
|
-
return
|
|
1003
|
+
return br(c.value, y.value, Math.max(40, e * 7 + 16)).map((e) => ({
|
|
1013
1004
|
i: e,
|
|
1014
1005
|
text: t.categories[e],
|
|
1015
|
-
pos:
|
|
1006
|
+
pos: S.value.center(e)
|
|
1016
1007
|
}));
|
|
1017
|
-
}),
|
|
1018
|
-
let e = [], n = [], r =
|
|
1008
|
+
}), T = (e) => e.length * 6.5, E = P(() => {
|
|
1009
|
+
let e = [], n = [], r = u.value.length, i = t.barSize, a = t.stacked ? S.value.bandwidth : (S.value.bandwidth - Fi * (r - 1)) / r, o = Math.max(1, Math.min(i, a)), s = t.stacked ? o : o * r + Fi * (r - 1), l = Array.from({ length: c.value }, (e, t) => {
|
|
1019
1010
|
let n = 0, r = 0;
|
|
1020
|
-
for (let e of
|
|
1011
|
+
for (let e of h.value) {
|
|
1021
1012
|
let i = e[t];
|
|
1022
1013
|
i && (n = Math.max(n, i.to), r = Math.min(r, i.to));
|
|
1023
1014
|
}
|
|
@@ -1026,47 +1017,47 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1026
1017
|
bottom: r
|
|
1027
1018
|
};
|
|
1028
1019
|
});
|
|
1029
|
-
return
|
|
1030
|
-
for (let
|
|
1031
|
-
let
|
|
1032
|
-
if (!
|
|
1033
|
-
let
|
|
1020
|
+
return u.value.forEach((r, i) => {
|
|
1021
|
+
for (let u = 0; u < c.value; u++) {
|
|
1022
|
+
let c = r.data[u];
|
|
1023
|
+
if (!Z(c)) continue;
|
|
1024
|
+
let d = S.value.center(u) - s / 2 + (t.stacked ? 0 : i * (o + Fi)), p = 0, m = c;
|
|
1034
1025
|
if (t.stacked) {
|
|
1035
|
-
let e =
|
|
1026
|
+
let e = h.value[i][u];
|
|
1036
1027
|
if (!e) continue;
|
|
1037
|
-
p = e.from,
|
|
1028
|
+
p = e.from, m = e.to;
|
|
1038
1029
|
}
|
|
1039
|
-
let g =
|
|
1030
|
+
let g = c >= 0, _ = t.stacked && p !== 0 ? Fi : 0, v = x.value(p), y = x.value(m), b = !t.stacked || (g ? m === l[u].top : m === l[u].bottom), C = b ? Ii : 0, w, E;
|
|
1040
1031
|
if (t.horizontal) {
|
|
1041
|
-
let e = Math.min(v, y) + (g ? _ : 0), t = Math.max(v, y) - (g ? 0 : _), n = Math.max(t - e,
|
|
1042
|
-
w =
|
|
1032
|
+
let e = Math.min(v, y) + (g ? _ : 0), t = Math.max(v, y) - (g ? 0 : _), n = Math.max(t - e, c === 0 ? 0 : 1);
|
|
1033
|
+
w = kr(g ? e : t - n, d, n, o, C, g ? "right" : "left"), E = g ? "0% 50%" : "100% 50%";
|
|
1043
1034
|
} else {
|
|
1044
|
-
let e = Math.min(v, y) + (g ? 0 : _), t = Math.max(v, y) - (g ? _ : 0), n = Math.max(t - e,
|
|
1045
|
-
w =
|
|
1035
|
+
let e = Math.min(v, y) + (g ? 0 : _), t = Math.max(v, y) - (g ? _ : 0), n = Math.max(t - e, c === 0 ? 0 : 1);
|
|
1036
|
+
w = kr(d, g ? t - n : e, o, n, C, g ? "top" : "bottom"), E = g ? "50% 100%" : "50% 0%";
|
|
1046
1037
|
}
|
|
1047
1038
|
if (e.push({
|
|
1048
|
-
key: `${r.index}-${
|
|
1039
|
+
key: `${r.index}-${u}`,
|
|
1049
1040
|
d: w,
|
|
1050
1041
|
color: r.color,
|
|
1051
|
-
origin:
|
|
1052
|
-
}), t.showValues && (!t.stacked ||
|
|
1053
|
-
let e = t.stacked ? g ? u
|
|
1042
|
+
origin: E
|
|
1043
|
+
}), t.showValues && (!t.stacked || b)) {
|
|
1044
|
+
let e = t.stacked ? g ? l[u].top : l[u].bottom : c, i = f(e);
|
|
1054
1045
|
if (t.horizontal) {
|
|
1055
|
-
let t =
|
|
1046
|
+
let t = x.value(e);
|
|
1056
1047
|
n.push({
|
|
1057
|
-
key: `${r.index}-${
|
|
1048
|
+
key: `${r.index}-${u}`,
|
|
1058
1049
|
x: t + (g ? 6 : -6),
|
|
1059
|
-
y:
|
|
1050
|
+
y: d + o / 2 + 4,
|
|
1060
1051
|
text: i,
|
|
1061
1052
|
anchor: "start"
|
|
1062
1053
|
});
|
|
1063
1054
|
} else {
|
|
1064
|
-
let s = t.stacked ?
|
|
1065
|
-
if (
|
|
1066
|
-
let t =
|
|
1055
|
+
let s = t.stacked ? S.value.step : o + 4 + (a - o);
|
|
1056
|
+
if (T(i) <= s) {
|
|
1057
|
+
let t = x.value(e);
|
|
1067
1058
|
n.push({
|
|
1068
|
-
key: `${r.index}-${
|
|
1069
|
-
x:
|
|
1059
|
+
key: `${r.index}-${u}`,
|
|
1060
|
+
x: d + o / 2,
|
|
1070
1061
|
y: g ? t - 5 : t + 15,
|
|
1071
1062
|
text: i,
|
|
1072
1063
|
anchor: "middle"
|
|
@@ -1079,217 +1070,217 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1079
1070
|
bars: e,
|
|
1080
1071
|
labels: n
|
|
1081
1072
|
};
|
|
1082
|
-
}),
|
|
1083
|
-
function
|
|
1084
|
-
let n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = t.horizontal ? i : r, o = t.horizontal ?
|
|
1085
|
-
|
|
1073
|
+
}), D = G(-1), O = G(0);
|
|
1074
|
+
function ee(e) {
|
|
1075
|
+
let n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = t.horizontal ? i : r, o = t.horizontal ? v.value.top : v.value.left, s = Math.floor((a - o) / S.value.step);
|
|
1076
|
+
D.value = s >= 0 && s < c.value ? s : -1, O.value = r;
|
|
1086
1077
|
}
|
|
1087
|
-
function
|
|
1088
|
-
let n =
|
|
1089
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") r =
|
|
1090
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") r =
|
|
1078
|
+
function k(e) {
|
|
1079
|
+
let n = c.value - 1, r = D.value;
|
|
1080
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") r = D.value < 0 ? 0 : Math.min(n, D.value + 1);
|
|
1081
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") r = D.value < 0 ? n : Math.max(0, D.value - 1);
|
|
1091
1082
|
else if (e.key === "Home") r = 0;
|
|
1092
1083
|
else if (e.key === "End") r = n;
|
|
1093
1084
|
else if (e.key === "Escape") r = -1;
|
|
1094
1085
|
else return;
|
|
1095
|
-
e.preventDefault(),
|
|
1086
|
+
e.preventDefault(), D.value = r, r >= 0 && !t.horizontal && (O.value = S.value.center(r)), r >= 0 && t.horizontal && (O.value = v.value.left + y.value / 2);
|
|
1096
1087
|
}
|
|
1097
|
-
function
|
|
1098
|
-
e.target.matches?.(":focus-visible") &&
|
|
1088
|
+
function A(e) {
|
|
1089
|
+
e.target.matches?.(":focus-visible") && D.value < 0 && k(new KeyboardEvent("keydown", { key: "Home" }));
|
|
1099
1090
|
}
|
|
1100
|
-
let
|
|
1101
|
-
let e =
|
|
1102
|
-
if (e < 0 || e >=
|
|
1103
|
-
let n =
|
|
1091
|
+
let j = P(() => {
|
|
1092
|
+
let e = D.value;
|
|
1093
|
+
if (e < 0 || e >= c.value) return null;
|
|
1094
|
+
let n = S.value.center(e);
|
|
1104
1095
|
return {
|
|
1105
|
-
x: t.horizontal ?
|
|
1106
|
-
y: t.horizontal ? n :
|
|
1096
|
+
x: t.horizontal ? mr(O.value, v.value.left, v.value.left + y.value) : n,
|
|
1097
|
+
y: t.horizontal ? n : v.value.top,
|
|
1107
1098
|
title: t.categories[e],
|
|
1108
|
-
rows:
|
|
1099
|
+
rows: u.value.map((t) => ({
|
|
1109
1100
|
name: t.name,
|
|
1110
1101
|
color: t.color,
|
|
1111
|
-
value:
|
|
1102
|
+
value: Z(t.data[e]) ? f(t.data[e]) : "—"
|
|
1112
1103
|
}))
|
|
1113
1104
|
};
|
|
1114
|
-
}),
|
|
1115
|
-
if (!
|
|
1116
|
-
let e =
|
|
1105
|
+
}), M = P(() => {
|
|
1106
|
+
if (!j.value) return null;
|
|
1107
|
+
let e = D.value;
|
|
1117
1108
|
return t.horizontal ? {
|
|
1118
|
-
x:
|
|
1119
|
-
y:
|
|
1120
|
-
w:
|
|
1121
|
-
h:
|
|
1109
|
+
x: v.value.left,
|
|
1110
|
+
y: S.value.center(e) - S.value.step / 2,
|
|
1111
|
+
w: y.value,
|
|
1112
|
+
h: S.value.step
|
|
1122
1113
|
} : {
|
|
1123
|
-
x:
|
|
1124
|
-
y:
|
|
1125
|
-
w:
|
|
1126
|
-
h:
|
|
1114
|
+
x: S.value.center(e) - S.value.step / 2,
|
|
1115
|
+
y: v.value.top,
|
|
1116
|
+
w: S.value.step,
|
|
1117
|
+
h: b.value
|
|
1127
1118
|
};
|
|
1128
|
-
}),
|
|
1119
|
+
}), te = P(() => t.legend ?? t.series.length > 1), ne = P(() => l.value.map((e) => ({
|
|
1129
1120
|
name: e.name,
|
|
1130
1121
|
color: e.color,
|
|
1131
1122
|
off: a.value.has(e.index)
|
|
1132
|
-
}))),
|
|
1123
|
+
}))), re = P(() => {
|
|
1133
1124
|
let e = [n("campus.chart.summaryBar", {
|
|
1134
1125
|
title: t.title ?? "",
|
|
1135
|
-
categories:
|
|
1136
|
-
series:
|
|
1126
|
+
categories: c.value,
|
|
1127
|
+
series: l.value.length
|
|
1137
1128
|
})];
|
|
1138
|
-
for (let r of
|
|
1139
|
-
let i =
|
|
1129
|
+
for (let r of l.value.slice(0, 6)) {
|
|
1130
|
+
let i = Vr(r.data);
|
|
1140
1131
|
i && e.push(n("campus.chart.summarySeries", {
|
|
1141
1132
|
name: r.name,
|
|
1142
|
-
min:
|
|
1143
|
-
max:
|
|
1144
|
-
last:
|
|
1133
|
+
min: f(i.min),
|
|
1134
|
+
max: f(i.max),
|
|
1135
|
+
last: f(i.last),
|
|
1145
1136
|
category: t.categories[i.lastIndex] ?? ""
|
|
1146
1137
|
}));
|
|
1147
1138
|
}
|
|
1148
1139
|
return e.join(" ");
|
|
1149
|
-
}),
|
|
1150
|
-
return (t, n) => (
|
|
1140
|
+
}), ie = P(() => t.categories.slice(0, Li).map((e, t) => [e, ...l.value.map((e) => Z(e.data[t]) ? f(e.data[t]) : "")])), ae = P(() => [n("campus.chart.category"), ...l.value.map((e) => e.name)]);
|
|
1141
|
+
return (t, n) => (W(), L("div", {
|
|
1151
1142
|
ref_key: "el",
|
|
1152
1143
|
ref: r,
|
|
1153
|
-
class:
|
|
1144
|
+
class: H(["ca-chart ca-bar-chart", {
|
|
1154
1145
|
"is-loading": e.loading,
|
|
1155
1146
|
"is-animated": e.animated
|
|
1156
1147
|
}]),
|
|
1157
1148
|
"aria-busy": e.loading || void 0
|
|
1158
1149
|
}, [
|
|
1159
|
-
|
|
1150
|
+
te.value && d.value ? (W(), F(qr, {
|
|
1160
1151
|
key: 0,
|
|
1161
|
-
items:
|
|
1152
|
+
items: ne.value,
|
|
1162
1153
|
interactive: "",
|
|
1163
|
-
onToggle: n[0] ||= (e) =>
|
|
1164
|
-
}, null, 8, ["items"])) :
|
|
1165
|
-
|
|
1154
|
+
onToggle: n[0] ||= (e) => Y(o)(e, l.value.length)
|
|
1155
|
+
}, null, 8, ["items"])) : I("v-if", !0),
|
|
1156
|
+
R("div", {
|
|
1166
1157
|
class: "ca-chart__plot",
|
|
1167
|
-
style:
|
|
1158
|
+
style: U({ height: `${e.height}px` })
|
|
1168
1159
|
}, [
|
|
1169
|
-
|
|
1160
|
+
R("div", xi, [d.value ? (W(), L("svg", {
|
|
1170
1161
|
key: 0,
|
|
1171
1162
|
class: "ca-chart__svg",
|
|
1172
1163
|
role: "img",
|
|
1173
1164
|
tabindex: "0",
|
|
1174
|
-
"aria-label":
|
|
1175
|
-
width:
|
|
1165
|
+
"aria-label": re.value,
|
|
1166
|
+
width: Y(i),
|
|
1176
1167
|
height: e.height,
|
|
1177
|
-
viewBox: `0 0 ${
|
|
1178
|
-
onPointermove:
|
|
1179
|
-
onPointerdown:
|
|
1180
|
-
onPointerleave: n[1] ||= (e) =>
|
|
1181
|
-
onKeydown:
|
|
1182
|
-
onFocus:
|
|
1183
|
-
onBlur: n[2] ||= (e) =>
|
|
1168
|
+
viewBox: `0 0 ${Y(i)} ${e.height}`,
|
|
1169
|
+
onPointermove: ee,
|
|
1170
|
+
onPointerdown: ee,
|
|
1171
|
+
onPointerleave: n[1] ||= (e) => D.value = -1,
|
|
1172
|
+
onKeydown: k,
|
|
1173
|
+
onFocus: A,
|
|
1174
|
+
onBlur: n[2] ||= (e) => D.value = -1
|
|
1184
1175
|
}, [
|
|
1185
|
-
|
|
1186
|
-
e.horizontal ? (
|
|
1187
|
-
class:
|
|
1188
|
-
x1:
|
|
1189
|
-
x2:
|
|
1190
|
-
y1:
|
|
1191
|
-
y2:
|
|
1192
|
-
}, null, 10,
|
|
1176
|
+
I(" 数值轴的网格与刻度 "),
|
|
1177
|
+
e.horizontal ? (W(), L("g", Ei, [(W(!0), L(N, null, K(_.value, (e) => (W(), L(N, { key: e.tick }, [R("line", {
|
|
1178
|
+
class: H(e.tick === 0 ? "ca-chart__baseline" : "ca-chart__grid"),
|
|
1179
|
+
x1: x.value(e.tick),
|
|
1180
|
+
x2: x.value(e.tick),
|
|
1181
|
+
y1: v.value.top,
|
|
1182
|
+
y2: v.value.top + b.value
|
|
1183
|
+
}, null, 10, Di), R("text", {
|
|
1193
1184
|
class: "ca-chart__tick",
|
|
1194
|
-
x:
|
|
1195
|
-
y:
|
|
1185
|
+
x: x.value(e.tick),
|
|
1186
|
+
y: v.value.top + b.value + 18,
|
|
1196
1187
|
"text-anchor": "middle"
|
|
1197
|
-
},
|
|
1198
|
-
class:
|
|
1199
|
-
x1:
|
|
1200
|
-
x2:
|
|
1201
|
-
y1:
|
|
1202
|
-
y2:
|
|
1203
|
-
}, null, 10,
|
|
1188
|
+
}, J(e.text), 9, Oi)], 64))), 128))])) : (W(), L("g", Ci, [(W(!0), L(N, null, K(_.value, (e) => (W(), L(N, { key: e.tick }, [R("line", {
|
|
1189
|
+
class: H(e.tick === 0 ? "ca-chart__baseline" : "ca-chart__grid"),
|
|
1190
|
+
x1: v.value.left,
|
|
1191
|
+
x2: v.value.left + y.value,
|
|
1192
|
+
y1: x.value(e.tick),
|
|
1193
|
+
y2: x.value(e.tick)
|
|
1194
|
+
}, null, 10, wi), R("text", {
|
|
1204
1195
|
class: "ca-chart__tick",
|
|
1205
|
-
x:
|
|
1206
|
-
y:
|
|
1196
|
+
x: v.value.left - 8,
|
|
1197
|
+
y: x.value(e.tick),
|
|
1207
1198
|
dy: "0.32em",
|
|
1208
1199
|
"text-anchor": "end"
|
|
1209
|
-
},
|
|
1210
|
-
|
|
1211
|
-
|
|
1200
|
+
}, J(e.text), 9, Ti)], 64))), 128))])),
|
|
1201
|
+
I(" 类目轴标签 "),
|
|
1202
|
+
R("g", null, [e.horizontal ? (W(!0), L(N, { key: 1 }, K(w.value, (e) => (W(), L("text", {
|
|
1212
1203
|
key: e.i,
|
|
1213
1204
|
class: "ca-chart__tick",
|
|
1214
|
-
x:
|
|
1205
|
+
x: v.value.left - 8,
|
|
1215
1206
|
y: e.pos,
|
|
1216
1207
|
dy: "0.32em",
|
|
1217
1208
|
"text-anchor": "end"
|
|
1218
|
-
},
|
|
1209
|
+
}, J(e.text), 9, Ai))), 128)) : (W(!0), L(N, { key: 0 }, K(w.value, (e) => (W(), L("text", {
|
|
1219
1210
|
key: e.i,
|
|
1220
1211
|
class: "ca-chart__tick",
|
|
1221
1212
|
x: e.pos,
|
|
1222
|
-
y:
|
|
1213
|
+
y: v.value.top + b.value + 18,
|
|
1223
1214
|
"text-anchor": "middle"
|
|
1224
|
-
},
|
|
1225
|
-
|
|
1215
|
+
}, J(e.text), 9, ki))), 128))]),
|
|
1216
|
+
M.value ? (W(), L("rect", {
|
|
1226
1217
|
key: 2,
|
|
1227
1218
|
class: "ca-chart__band",
|
|
1228
|
-
x:
|
|
1229
|
-
y:
|
|
1230
|
-
width:
|
|
1231
|
-
height:
|
|
1232
|
-
}, null, 8,
|
|
1233
|
-
|
|
1219
|
+
x: M.value.x,
|
|
1220
|
+
y: M.value.y,
|
|
1221
|
+
width: M.value.w,
|
|
1222
|
+
height: M.value.h
|
|
1223
|
+
}, null, 8, ji)) : I("v-if", !0),
|
|
1224
|
+
R("g", null, [(W(!0), L(N, null, K(E.value.bars, (t) => (W(), L("path", {
|
|
1234
1225
|
key: t.key,
|
|
1235
|
-
class:
|
|
1226
|
+
class: H(["ca-chart__bar", e.horizontal ? "ca-chart__grow-x" : "ca-chart__grow-y"]),
|
|
1236
1227
|
d: t.d,
|
|
1237
|
-
style:
|
|
1228
|
+
style: U({
|
|
1238
1229
|
fill: t.color,
|
|
1239
1230
|
transformOrigin: t.origin
|
|
1240
1231
|
})
|
|
1241
|
-
}, null, 14,
|
|
1242
|
-
|
|
1232
|
+
}, null, 14, Mi))), 128))]),
|
|
1233
|
+
R("g", Ni, [(W(!0), L(N, null, K(E.value.labels, (e) => (W(), L("text", {
|
|
1243
1234
|
key: e.key,
|
|
1244
1235
|
class: "ca-chart__value",
|
|
1245
1236
|
x: e.x,
|
|
1246
1237
|
y: e.y,
|
|
1247
1238
|
"text-anchor": e.anchor
|
|
1248
|
-
},
|
|
1249
|
-
], 40,
|
|
1250
|
-
|
|
1239
|
+
}, J(e.text), 9, Pi))), 128))])
|
|
1240
|
+
], 40, Si)) : I("v-if", !0)]),
|
|
1241
|
+
j.value ? (W(), F(ri, {
|
|
1251
1242
|
key: 0,
|
|
1252
|
-
x:
|
|
1253
|
-
y:
|
|
1254
|
-
width:
|
|
1255
|
-
title:
|
|
1256
|
-
rows:
|
|
1243
|
+
x: j.value.x,
|
|
1244
|
+
y: j.value.y,
|
|
1245
|
+
width: Y(i),
|
|
1246
|
+
title: j.value.title,
|
|
1247
|
+
rows: j.value.rows
|
|
1257
1248
|
}, null, 8, [
|
|
1258
1249
|
"x",
|
|
1259
1250
|
"y",
|
|
1260
1251
|
"width",
|
|
1261
1252
|
"title",
|
|
1262
1253
|
"rows"
|
|
1263
|
-
])) :
|
|
1264
|
-
|
|
1254
|
+
])) : I("v-if", !0),
|
|
1255
|
+
B(Yr, {
|
|
1265
1256
|
loading: e.loading,
|
|
1266
|
-
empty: !
|
|
1257
|
+
empty: !d.value && !e.loading
|
|
1267
1258
|
}, null, 8, ["loading", "empty"])
|
|
1268
1259
|
], 4),
|
|
1269
|
-
|
|
1260
|
+
d.value ? (W(), F($r, {
|
|
1270
1261
|
key: 1,
|
|
1271
1262
|
caption: e.title,
|
|
1272
|
-
head:
|
|
1273
|
-
rows:
|
|
1263
|
+
head: ae.value,
|
|
1264
|
+
rows: ie.value
|
|
1274
1265
|
}, null, 8, [
|
|
1275
1266
|
"caption",
|
|
1276
1267
|
"head",
|
|
1277
1268
|
"rows"
|
|
1278
|
-
])) :
|
|
1279
|
-
], 10,
|
|
1269
|
+
])) : I("v-if", !0)
|
|
1270
|
+
], 10, bi));
|
|
1280
1271
|
}
|
|
1281
|
-
}),
|
|
1272
|
+
}), zi = ["aria-busy"], Bi = { class: "ca-pie-chart__body" }, Vi = { class: "ca-chart__canvas" }, Hi = [
|
|
1282
1273
|
"aria-label",
|
|
1283
1274
|
"width",
|
|
1284
1275
|
"height",
|
|
1285
1276
|
"viewBox"
|
|
1286
|
-
],
|
|
1277
|
+
], Ui = { class: "ca-chart__fade" }, Wi = ["d", "onPointerenter"], Gi = { class: "ca-pie-chart__label" }, Ki = {
|
|
1287
1278
|
key: 0,
|
|
1288
1279
|
class: "ca-pie-chart__sub"
|
|
1289
|
-
},
|
|
1280
|
+
}, qi = {
|
|
1290
1281
|
key: 0,
|
|
1291
1282
|
class: "ca-pie-chart__legend"
|
|
1292
|
-
},
|
|
1283
|
+
}, Ji = ["onPointerenter"], Yi = { class: "ca-pie-chart__name" }, Xi = { class: "ca-pie-chart__num" }, Zi = { class: "ca-pie-chart__pct" }, Qi = 6, $i = /*#__PURE__*/ l(/* @__PURE__ */ V({
|
|
1293
1284
|
__name: "CaPieChart",
|
|
1294
1285
|
props: {
|
|
1295
1286
|
items: {},
|
|
@@ -1313,195 +1304,195 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1313
1304
|
}
|
|
1314
1305
|
},
|
|
1315
1306
|
setup(e) {
|
|
1316
|
-
let t = e, n =
|
|
1307
|
+
let t = e, n = s(), { el: r, width: i } = Ur(), a = (e) => (t.valueFormatter ?? Lr)(e), o = P(() => mr(Math.min(t.size, i.value), 96, t.size)), c = P(() => o.value / 2 - Qi), l = P(() => t.donut ? c.value * .64 : 0), u = P(() => t.items.map((e, t) => ({
|
|
1317
1308
|
index: t,
|
|
1318
1309
|
name: e.name,
|
|
1319
|
-
value:
|
|
1320
|
-
color:
|
|
1321
|
-
}))),
|
|
1322
|
-
let t =
|
|
1310
|
+
value: Z(e.value) ? e.value : 0,
|
|
1311
|
+
color: Gr(t, e.color)
|
|
1312
|
+
}))), d = P(() => jr(u.value.map((e) => e.value))), f = P(() => u.value.reduce((e, t) => e + (t.value > 0 ? t.value : 0), 0)), p = P(() => d.value.length > 0), m = G(-1), h = P(() => d.value.filter((e) => e.end > e.start).map((e) => {
|
|
1313
|
+
let t = u.value[e.index], n = m.value === e.index ? 4 : 0;
|
|
1323
1314
|
return {
|
|
1324
1315
|
...e,
|
|
1325
1316
|
name: t.name,
|
|
1326
1317
|
color: t.color,
|
|
1327
|
-
d:
|
|
1318
|
+
d: Mr(o.value / 2, o.value / 2, c.value + n, l.value, e.start, e.end)
|
|
1328
1319
|
};
|
|
1329
|
-
})),
|
|
1330
|
-
let e =
|
|
1331
|
-
return e >= 0 &&
|
|
1332
|
-
label:
|
|
1333
|
-
value: a(
|
|
1334
|
-
sub:
|
|
1320
|
+
})), g = (e) => d.value[e]?.ratio ?? 0, _ = P(() => {
|
|
1321
|
+
let e = m.value;
|
|
1322
|
+
return e >= 0 && u.value[e] ? {
|
|
1323
|
+
label: u.value[e].name,
|
|
1324
|
+
value: a(u.value[e].value),
|
|
1325
|
+
sub: Hr(g(e))
|
|
1335
1326
|
} : {
|
|
1336
1327
|
label: t.centerLabel ?? n("campus.chart.total"),
|
|
1337
|
-
value: t.centerValue ?? a(
|
|
1328
|
+
value: t.centerValue ?? a(f.value),
|
|
1338
1329
|
sub: ""
|
|
1339
1330
|
};
|
|
1340
|
-
}),
|
|
1331
|
+
}), v = G({
|
|
1341
1332
|
x: 0,
|
|
1342
1333
|
y: 0
|
|
1343
1334
|
});
|
|
1344
|
-
function
|
|
1335
|
+
function y(e) {
|
|
1345
1336
|
let t = e.currentTarget.closest("svg").getBoundingClientRect();
|
|
1346
|
-
|
|
1337
|
+
v.value = {
|
|
1347
1338
|
x: e.clientX - t.left,
|
|
1348
1339
|
y: e.clientY - t.top
|
|
1349
1340
|
};
|
|
1350
1341
|
}
|
|
1351
|
-
let
|
|
1352
|
-
if (t.donut ||
|
|
1353
|
-
let e =
|
|
1342
|
+
let b = P(() => {
|
|
1343
|
+
if (t.donut || m.value < 0 || !u.value[m.value]) return null;
|
|
1344
|
+
let e = u.value[m.value];
|
|
1354
1345
|
return {
|
|
1355
|
-
x:
|
|
1356
|
-
y:
|
|
1346
|
+
x: v.value.x,
|
|
1347
|
+
y: v.value.y,
|
|
1357
1348
|
title: e.name,
|
|
1358
1349
|
rows: [{
|
|
1359
|
-
name:
|
|
1350
|
+
name: Hr(g(m.value)),
|
|
1360
1351
|
color: e.color,
|
|
1361
1352
|
value: a(e.value)
|
|
1362
1353
|
}]
|
|
1363
1354
|
};
|
|
1364
1355
|
});
|
|
1365
|
-
function
|
|
1366
|
-
let t =
|
|
1356
|
+
function x(e) {
|
|
1357
|
+
let t = h.value.map((e) => e.index);
|
|
1367
1358
|
if (!t.length) return;
|
|
1368
|
-
let n = t.indexOf(
|
|
1359
|
+
let n = t.indexOf(m.value), r = m.value;
|
|
1369
1360
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") r = t[n < 0 ? 0 : Math.min(t.length - 1, n + 1)];
|
|
1370
1361
|
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") r = t[n < 0 ? t.length - 1 : Math.max(0, n - 1)];
|
|
1371
1362
|
else if (e.key === "Escape") r = -1;
|
|
1372
1363
|
else return;
|
|
1373
|
-
e.preventDefault(),
|
|
1374
|
-
let i =
|
|
1375
|
-
i && (
|
|
1364
|
+
e.preventDefault(), m.value = r;
|
|
1365
|
+
let i = d.value[r];
|
|
1366
|
+
i && (v.value = $(o.value / 2, o.value / 2, (c.value + l.value) / 2, (i.start + i.end) / 2));
|
|
1376
1367
|
}
|
|
1377
|
-
function
|
|
1378
|
-
e.target.matches?.(":focus-visible") &&
|
|
1368
|
+
function S(e) {
|
|
1369
|
+
e.target.matches?.(":focus-visible") && m.value < 0 && x(new KeyboardEvent("keydown", { key: "ArrowRight" }));
|
|
1379
1370
|
}
|
|
1380
|
-
let
|
|
1371
|
+
let C = P(() => mr(Math.floor(l.value * 1.7 / Math.max(1, _.value.value.length * .62)), 13, 22)), w = P(() => {
|
|
1381
1372
|
let e = [n("campus.chart.summaryPie", {
|
|
1382
1373
|
title: t.title ?? "",
|
|
1383
|
-
count:
|
|
1384
|
-
total: a(
|
|
1374
|
+
count: u.value.length,
|
|
1375
|
+
total: a(f.value)
|
|
1385
1376
|
})];
|
|
1386
|
-
for (let t of
|
|
1377
|
+
for (let t of u.value.slice(0, 8)) e.push(n("campus.chart.summaryPieItem", {
|
|
1387
1378
|
name: t.name,
|
|
1388
1379
|
value: a(t.value),
|
|
1389
|
-
percent:
|
|
1380
|
+
percent: Hr(g(t.index))
|
|
1390
1381
|
}));
|
|
1391
1382
|
return e.join(" ");
|
|
1392
|
-
}),
|
|
1383
|
+
}), T = P(() => [
|
|
1393
1384
|
n("campus.chart.category"),
|
|
1394
1385
|
n("campus.chart.value"),
|
|
1395
1386
|
n("campus.chart.percent")
|
|
1396
|
-
]),
|
|
1387
|
+
]), E = P(() => u.value.map((e) => [
|
|
1397
1388
|
e.name,
|
|
1398
1389
|
a(e.value),
|
|
1399
|
-
|
|
1390
|
+
Hr(g(e.index))
|
|
1400
1391
|
]));
|
|
1401
|
-
return (t, n) => (
|
|
1392
|
+
return (t, n) => (W(), L("div", {
|
|
1402
1393
|
ref_key: "el",
|
|
1403
1394
|
ref: r,
|
|
1404
|
-
class:
|
|
1395
|
+
class: H(["ca-chart ca-pie-chart", {
|
|
1405
1396
|
"is-loading": e.loading,
|
|
1406
1397
|
"is-animated": e.animated
|
|
1407
1398
|
}]),
|
|
1408
1399
|
"aria-busy": e.loading || void 0
|
|
1409
|
-
}, [
|
|
1410
|
-
|
|
1400
|
+
}, [R("div", Bi, [
|
|
1401
|
+
R("div", {
|
|
1411
1402
|
class: "ca-chart__plot",
|
|
1412
|
-
style:
|
|
1403
|
+
style: U({
|
|
1413
1404
|
width: `${o.value}px`,
|
|
1414
1405
|
height: `${o.value}px`
|
|
1415
1406
|
})
|
|
1416
1407
|
}, [
|
|
1417
|
-
|
|
1408
|
+
R("div", Vi, [p.value ? (W(), L("svg", {
|
|
1418
1409
|
key: 0,
|
|
1419
1410
|
class: "ca-chart__svg",
|
|
1420
1411
|
role: "img",
|
|
1421
1412
|
tabindex: "0",
|
|
1422
|
-
"aria-label":
|
|
1413
|
+
"aria-label": w.value,
|
|
1423
1414
|
width: o.value,
|
|
1424
1415
|
height: o.value,
|
|
1425
1416
|
viewBox: `0 0 ${o.value} ${o.value}`,
|
|
1426
|
-
onKeydown:
|
|
1427
|
-
onFocus:
|
|
1428
|
-
onBlur: n[1] ||= (e) =>
|
|
1429
|
-
}, [
|
|
1417
|
+
onKeydown: x,
|
|
1418
|
+
onFocus: S,
|
|
1419
|
+
onBlur: n[1] ||= (e) => m.value = -1
|
|
1420
|
+
}, [R("g", Ui, [(W(!0), L(N, null, K(h.value, (e) => (W(), L("path", {
|
|
1430
1421
|
key: e.index,
|
|
1431
|
-
class:
|
|
1422
|
+
class: H(["ca-chart__slice", { "is-dim": m.value >= 0 && m.value !== e.index }]),
|
|
1432
1423
|
d: e.d,
|
|
1433
|
-
style:
|
|
1434
|
-
onPointerenter: (t) =>
|
|
1435
|
-
onPointermove:
|
|
1436
|
-
onPointerleave: n[0] ||= (e) =>
|
|
1437
|
-
}, null, 46,
|
|
1438
|
-
|
|
1439
|
-
e.donut &&
|
|
1424
|
+
style: U({ fill: e.color }),
|
|
1425
|
+
onPointerenter: (t) => m.value = e.index,
|
|
1426
|
+
onPointermove: y,
|
|
1427
|
+
onPointerleave: n[0] ||= (e) => m.value = -1
|
|
1428
|
+
}, null, 46, Wi))), 128))])], 40, Hi)) : I("v-if", !0)]),
|
|
1429
|
+
I(" 环形图中心文字:HTML 叠在 SVG 上,方便按内圈宽度换行与省略 "),
|
|
1430
|
+
e.donut && p.value ? (W(), L("div", {
|
|
1440
1431
|
key: 0,
|
|
1441
1432
|
class: "ca-pie-chart__center",
|
|
1442
|
-
style:
|
|
1433
|
+
style: U({ width: `${l.value * 1.7}px` })
|
|
1443
1434
|
}, [
|
|
1444
|
-
|
|
1445
|
-
|
|
1435
|
+
R("span", Gi, J(_.value.label), 1),
|
|
1436
|
+
R("strong", {
|
|
1446
1437
|
class: "ca-pie-chart__value",
|
|
1447
|
-
style:
|
|
1448
|
-
},
|
|
1449
|
-
|
|
1450
|
-
], 4)) :
|
|
1451
|
-
|
|
1438
|
+
style: U({ fontSize: `${C.value}px` })
|
|
1439
|
+
}, J(_.value.value), 5),
|
|
1440
|
+
_.value.sub ? (W(), L("span", Ki, J(_.value.sub), 1)) : I("v-if", !0)
|
|
1441
|
+
], 4)) : I("v-if", !0),
|
|
1442
|
+
b.value ? (W(), F(ri, {
|
|
1452
1443
|
key: 1,
|
|
1453
|
-
x:
|
|
1454
|
-
y:
|
|
1444
|
+
x: b.value.x,
|
|
1445
|
+
y: b.value.y,
|
|
1455
1446
|
width: o.value,
|
|
1456
|
-
title:
|
|
1457
|
-
rows:
|
|
1447
|
+
title: b.value.title,
|
|
1448
|
+
rows: b.value.rows
|
|
1458
1449
|
}, null, 8, [
|
|
1459
1450
|
"x",
|
|
1460
1451
|
"y",
|
|
1461
1452
|
"width",
|
|
1462
1453
|
"title",
|
|
1463
1454
|
"rows"
|
|
1464
|
-
])) :
|
|
1465
|
-
|
|
1455
|
+
])) : I("v-if", !0),
|
|
1456
|
+
B(Yr, {
|
|
1466
1457
|
loading: e.loading,
|
|
1467
|
-
empty: !
|
|
1458
|
+
empty: !p.value && !e.loading
|
|
1468
1459
|
}, null, 8, ["loading", "empty"])
|
|
1469
1460
|
], 4),
|
|
1470
|
-
|
|
1471
|
-
e.legend &&
|
|
1461
|
+
I(" 图例清单:名称 / 数值 / 占比,悬停与扇区联动 "),
|
|
1462
|
+
e.legend && u.value.length ? (W(), L("ul", qi, [(W(!0), L(N, null, K(u.value, (e) => (W(), L("li", {
|
|
1472
1463
|
key: e.index,
|
|
1473
|
-
class:
|
|
1474
|
-
onPointerenter: (t) =>
|
|
1475
|
-
onPointerleave: n[2] ||= (e) =>
|
|
1464
|
+
class: H(["ca-pie-chart__row", { "is-active": m.value === e.index }]),
|
|
1465
|
+
onPointerenter: (t) => m.value = e.value > 0 ? e.index : -1,
|
|
1466
|
+
onPointerleave: n[2] ||= (e) => m.value = -1
|
|
1476
1467
|
}, [
|
|
1477
|
-
|
|
1468
|
+
R("span", {
|
|
1478
1469
|
class: "ca-chart__key ca-chart__key--box",
|
|
1479
|
-
style:
|
|
1470
|
+
style: U({ "--key": e.color })
|
|
1480
1471
|
}, null, 4),
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
], 42,
|
|
1485
|
-
]),
|
|
1472
|
+
R("span", Yi, J(e.name), 1),
|
|
1473
|
+
R("span", Xi, J(a(e.value)), 1),
|
|
1474
|
+
R("span", Zi, J(Y(Hr)(g(e.index))), 1)
|
|
1475
|
+
], 42, Ji))), 128))])) : I("v-if", !0)
|
|
1476
|
+
]), p.value ? (W(), F($r, {
|
|
1486
1477
|
key: 0,
|
|
1487
1478
|
caption: e.title,
|
|
1488
|
-
head:
|
|
1489
|
-
rows:
|
|
1479
|
+
head: T.value,
|
|
1480
|
+
rows: E.value
|
|
1490
1481
|
}, null, 8, [
|
|
1491
1482
|
"caption",
|
|
1492
1483
|
"head",
|
|
1493
1484
|
"rows"
|
|
1494
|
-
])) :
|
|
1485
|
+
])) : I("v-if", !0)], 10, zi));
|
|
1495
1486
|
}
|
|
1496
|
-
}), [["__scopeId", "data-v-75e32682"]]),
|
|
1487
|
+
}), [["__scopeId", "data-v-75e32682"]]), ea = [
|
|
1497
1488
|
"aria-label",
|
|
1498
1489
|
"width",
|
|
1499
1490
|
"height",
|
|
1500
1491
|
"viewBox"
|
|
1501
|
-
],
|
|
1492
|
+
], ta = {
|
|
1502
1493
|
key: 0,
|
|
1503
1494
|
class: "ca-chart__reveal"
|
|
1504
|
-
},
|
|
1495
|
+
}, na = ["d"], ra = ["d"], ia = ["cx", "cy"], aa = { key: 1 }, oa = ["d"], sa = 4, ca = 5, la = 2, ua = /* @__PURE__ */ V({
|
|
1505
1496
|
__name: "CaSparkline",
|
|
1506
1497
|
props: {
|
|
1507
1498
|
data: {},
|
|
@@ -1525,32 +1516,32 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1525
1516
|
}
|
|
1526
1517
|
},
|
|
1527
1518
|
setup(e) {
|
|
1528
|
-
let t = e, n =
|
|
1519
|
+
let t = e, n = s(), { el: r, width: i } = Ur(() => t.width), a = (e) => (t.valueFormatter ?? Lr)(e), o = P(() => Or(t.data)), c = P(() => Math.max(1, i.value - 8)), l = P(() => {
|
|
1529
1520
|
let e = t.data.length, n = o.value;
|
|
1530
1521
|
if (!e || !n) return null;
|
|
1531
1522
|
if (t.type === "bar") {
|
|
1532
|
-
let r = Math.max(n[1], 0), i = Math.min(n[0], 0), a =
|
|
1523
|
+
let r = Math.max(n[1], 0), i = Math.min(n[0], 0), a = vr(i, r === i ? i + 1 : r, t.height - 1, ca), o = (c.value - la * (e - 1)) / e, s = Math.max(1, Math.min(o, 14)), l = s * e + la * (e - 1), u = sa + (c.value - l) / 2;
|
|
1533
1524
|
return {
|
|
1534
1525
|
kind: "bar",
|
|
1535
1526
|
bars: t.data.flatMap((e, t) => {
|
|
1536
|
-
if (!
|
|
1537
|
-
let n = a(0), r = a(e), i =
|
|
1527
|
+
if (!Z(e)) return [];
|
|
1528
|
+
let n = a(0), r = a(e), i = kr(u + t * (s + la), Math.min(n, r), s, Math.max(Math.abs(n - r), e === 0 ? 0 : 1), 2, e >= 0 ? "top" : "bottom");
|
|
1538
1529
|
return i ? [i] : [];
|
|
1539
1530
|
})
|
|
1540
1531
|
};
|
|
1541
1532
|
}
|
|
1542
|
-
let r =
|
|
1533
|
+
let r = vr(n[0], n[1], t.height - ca, ca), a = (t) => e === 1 ? i.value / 2 : sa + t / (e - 1) * c.value, s = t.data.map((e, t) => Z(e) ? {
|
|
1543
1534
|
x: a(t),
|
|
1544
1535
|
y: r(e)
|
|
1545
|
-
} : null), l = [...
|
|
1536
|
+
} : null), l = [...s].reverse().find((e) => e) ?? null;
|
|
1546
1537
|
return {
|
|
1547
1538
|
kind: "line",
|
|
1548
|
-
line:
|
|
1549
|
-
area: t.area ?
|
|
1539
|
+
line: Tr(s, t.smooth),
|
|
1540
|
+
area: t.area ? Er(s, t.height - 1, t.smooth) : "",
|
|
1550
1541
|
last: l
|
|
1551
1542
|
};
|
|
1552
|
-
}),
|
|
1553
|
-
let e =
|
|
1543
|
+
}), u = P(() => {
|
|
1544
|
+
let e = Vr(t.data);
|
|
1554
1545
|
return e ? n("campus.chart.summarySpark", {
|
|
1555
1546
|
title: t.title ?? "",
|
|
1556
1547
|
count: e.count,
|
|
@@ -1559,59 +1550,59 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1559
1550
|
last: a(e.last)
|
|
1560
1551
|
}) : t.title ?? "";
|
|
1561
1552
|
});
|
|
1562
|
-
return (t, n) => (
|
|
1553
|
+
return (t, n) => (W(), L("div", {
|
|
1563
1554
|
ref_key: "el",
|
|
1564
1555
|
ref: r,
|
|
1565
|
-
class:
|
|
1566
|
-
style:
|
|
1567
|
-
}, [
|
|
1556
|
+
class: H(["ca-chart ca-sparkline", { "is-animated": e.animated }]),
|
|
1557
|
+
style: U({ height: `${e.height}px` })
|
|
1558
|
+
}, [l.value ? (W(), L("svg", {
|
|
1568
1559
|
key: 0,
|
|
1569
1560
|
class: "ca-chart__svg",
|
|
1570
1561
|
role: "img",
|
|
1571
|
-
"aria-label":
|
|
1572
|
-
width:
|
|
1562
|
+
"aria-label": u.value,
|
|
1563
|
+
width: Y(i),
|
|
1573
1564
|
height: e.height,
|
|
1574
|
-
viewBox: `0 0 ${
|
|
1575
|
-
}, [
|
|
1576
|
-
|
|
1565
|
+
viewBox: `0 0 ${Y(i)} ${e.height}`
|
|
1566
|
+
}, [l.value.kind === "line" ? (W(), L("g", ta, [
|
|
1567
|
+
l.value.area ? (W(), L("path", {
|
|
1577
1568
|
key: 0,
|
|
1578
1569
|
class: "ca-chart__area",
|
|
1579
|
-
d:
|
|
1580
|
-
style:
|
|
1581
|
-
}, null, 12,
|
|
1582
|
-
|
|
1570
|
+
d: l.value.area,
|
|
1571
|
+
style: U({ fill: e.color })
|
|
1572
|
+
}, null, 12, na)) : I("v-if", !0),
|
|
1573
|
+
R("path", {
|
|
1583
1574
|
class: "ca-chart__line",
|
|
1584
|
-
d:
|
|
1585
|
-
style:
|
|
1586
|
-
}, null, 12,
|
|
1587
|
-
|
|
1575
|
+
d: l.value.line,
|
|
1576
|
+
style: U({ stroke: e.color })
|
|
1577
|
+
}, null, 12, ra),
|
|
1578
|
+
l.value.last ? (W(), L("circle", {
|
|
1588
1579
|
key: 1,
|
|
1589
1580
|
class: "ca-chart__dot",
|
|
1590
|
-
cx:
|
|
1591
|
-
cy:
|
|
1581
|
+
cx: l.value.last.x,
|
|
1582
|
+
cy: l.value.last.y,
|
|
1592
1583
|
r: "3.5",
|
|
1593
|
-
style:
|
|
1594
|
-
}, null, 12,
|
|
1595
|
-
])) : (
|
|
1584
|
+
style: U({ fill: e.color })
|
|
1585
|
+
}, null, 12, ia)) : I("v-if", !0)
|
|
1586
|
+
])) : (W(), L("g", aa, [(W(!0), L(N, null, K(l.value.bars, (t, n) => (W(), L("path", {
|
|
1596
1587
|
key: n,
|
|
1597
1588
|
class: "ca-chart__grow-y",
|
|
1598
1589
|
d: t,
|
|
1599
|
-
style:
|
|
1600
|
-
}, null, 12,
|
|
1590
|
+
style: U({ fill: e.color })
|
|
1591
|
+
}, null, 12, oa))), 128))]))], 8, ea)) : I("v-if", !0)], 6));
|
|
1601
1592
|
}
|
|
1602
|
-
}),
|
|
1593
|
+
}), da = ["aria-busy"], fa = [
|
|
1603
1594
|
"aria-label",
|
|
1604
1595
|
"width",
|
|
1605
1596
|
"height",
|
|
1606
1597
|
"viewBox"
|
|
1607
|
-
],
|
|
1598
|
+
], pa = ["d", "stroke-width"], ma = [
|
|
1608
1599
|
"d",
|
|
1609
1600
|
"stroke-width",
|
|
1610
1601
|
"stroke-dasharray"
|
|
1611
|
-
],
|
|
1602
|
+
], ha = { class: "ca-gauge__value" }, ga = {
|
|
1612
1603
|
key: 0,
|
|
1613
1604
|
class: "ca-gauge__label"
|
|
1614
|
-
},
|
|
1605
|
+
}, _a = /*#__PURE__*/ l(/* @__PURE__ */ V({
|
|
1615
1606
|
__name: "CaGauge",
|
|
1616
1607
|
props: {
|
|
1617
1608
|
value: {},
|
|
@@ -1630,71 +1621,775 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1630
1621
|
}
|
|
1631
1622
|
},
|
|
1632
1623
|
setup(e) {
|
|
1633
|
-
let t = e, n =
|
|
1624
|
+
let t = e, n = s(), r = P(() => Ir(t.value, t.max)), i = P(() => Fr(r.value, t.thresholds, t.color)), a = P(() => Pr(t.shape)), o = P(() => t.size / 2), c = P(() => (t.size - t.thickness) / 2 - 1), l = P(() => t.shape === "half" ? o.value + t.thickness / 2 + 2 : t.size), u = P(() => Nr(o.value, o.value, c.value, a.value.start, a.value.start + a.value.sweep)), d = P(() => `${Number(r.value.toFixed(1))}%`), f = P(() => n("campus.chart.summaryGauge", {
|
|
1634
1625
|
title: t.title ?? t.label ?? "",
|
|
1635
|
-
value:
|
|
1636
|
-
max:
|
|
1637
|
-
percent:
|
|
1626
|
+
value: Lr(typeof t.value == "number" ? t.value : 0),
|
|
1627
|
+
max: Lr(t.max),
|
|
1628
|
+
percent: d.value
|
|
1638
1629
|
}));
|
|
1639
|
-
return (t, n) => (
|
|
1640
|
-
class:
|
|
1630
|
+
return (t, n) => (W(), L("div", {
|
|
1631
|
+
class: H(["ca-chart ca-gauge", {
|
|
1641
1632
|
"is-loading": e.loading,
|
|
1642
1633
|
"is-animated": e.animated
|
|
1643
1634
|
}]),
|
|
1644
|
-
style:
|
|
1635
|
+
style: U({
|
|
1645
1636
|
width: `${e.size}px`,
|
|
1646
|
-
height: `${
|
|
1637
|
+
height: `${l.value}px`
|
|
1647
1638
|
}),
|
|
1648
1639
|
"aria-busy": e.loading || void 0
|
|
1649
|
-
}, [(
|
|
1640
|
+
}, [(W(), L("svg", {
|
|
1650
1641
|
class: "ca-chart__svg",
|
|
1651
1642
|
role: "img",
|
|
1652
|
-
"aria-label":
|
|
1643
|
+
"aria-label": f.value,
|
|
1653
1644
|
width: e.size,
|
|
1654
|
-
height:
|
|
1655
|
-
viewBox: `0 0 ${e.size} ${
|
|
1645
|
+
height: l.value,
|
|
1646
|
+
viewBox: `0 0 ${e.size} ${l.value}`
|
|
1656
1647
|
}, [
|
|
1657
|
-
|
|
1648
|
+
R("path", {
|
|
1658
1649
|
class: "ca-chart__track",
|
|
1659
|
-
d:
|
|
1650
|
+
d: u.value,
|
|
1660
1651
|
"stroke-width": e.thickness,
|
|
1661
1652
|
"stroke-linecap": "round"
|
|
1662
|
-
}, null, 8,
|
|
1663
|
-
|
|
1664
|
-
r.value > 0 ? (
|
|
1653
|
+
}, null, 8, pa),
|
|
1654
|
+
I(" pathLength=100:dasharray 的第一个数就是百分比;0% 时不画(圆头线帽会在起点留一个小点,误导成“有进度”) "),
|
|
1655
|
+
r.value > 0 ? (W(), L("path", {
|
|
1665
1656
|
key: 0,
|
|
1666
1657
|
class: "ca-chart__progress",
|
|
1667
|
-
d:
|
|
1658
|
+
d: u.value,
|
|
1668
1659
|
pathLength: "100",
|
|
1669
1660
|
"stroke-width": e.thickness,
|
|
1670
1661
|
"stroke-dasharray": `${r.value} 100`,
|
|
1671
|
-
style:
|
|
1672
|
-
}, null, 12,
|
|
1673
|
-
], 8,
|
|
1662
|
+
style: U({ stroke: i.value })
|
|
1663
|
+
}, null, 12, ma)) : I("v-if", !0)
|
|
1664
|
+
], 8, fa)), R("div", { class: H(["ca-gauge__center", { "is-half": e.shape === "half" }]) }, [q(t.$slots, "center", {}, () => [R("strong", ha, J(d.value), 1), e.label ? (W(), L("span", ga, J(e.label), 1)) : I("v-if", !0)], !0)], 2)], 14, da));
|
|
1674
1665
|
}
|
|
1675
|
-
}), [["__scopeId", "data-v-83314498"]]),
|
|
1676
|
-
CaLineChart:
|
|
1677
|
-
CaBarChart:
|
|
1678
|
-
CaPieChart:
|
|
1679
|
-
CaSparkline:
|
|
1680
|
-
CaGauge:
|
|
1681
|
-
},
|
|
1666
|
+
}), [["__scopeId", "data-v-83314498"]]), va = {
|
|
1667
|
+
CaLineChart: yi,
|
|
1668
|
+
CaBarChart: Ri,
|
|
1669
|
+
CaPieChart: $i,
|
|
1670
|
+
CaSparkline: ua,
|
|
1671
|
+
CaGauge: _a
|
|
1672
|
+
}, ya = /* @__PURE__ */ V({
|
|
1682
1673
|
__name: "CaConfigProvider",
|
|
1683
1674
|
props: { locale: {} },
|
|
1684
1675
|
setup(e) {
|
|
1685
|
-
let t = e, n =
|
|
1686
|
-
return (e, t) => (
|
|
1687
|
-
default:
|
|
1676
|
+
let t = e, n = P(() => t.locale === "en-US" ? Kn : qn);
|
|
1677
|
+
return (e, t) => (W(), F(Y(se), { locale: n.value }, {
|
|
1678
|
+
default: X(() => [q(e.$slots, "default")]),
|
|
1688
1679
|
_: 3
|
|
1689
1680
|
}, 8, ["locale"]));
|
|
1690
1681
|
}
|
|
1691
|
-
}),
|
|
1682
|
+
}), ba = { CaConfigProvider: ya };
|
|
1683
|
+
// packages/ui/src/components/display/doc-viewer/source.ts
|
|
1684
|
+
function xa(e = "", t = "") {
|
|
1685
|
+
let n = e.split(/[?#]/)[0].split(".").pop()?.toLowerCase();
|
|
1686
|
+
return n === "doc" || n === "ppt" ? "legacy" : n === "md" || n === "markdown" ? "md" : n === "xls" || n === "xlsx" ? "xlsx" : [
|
|
1687
|
+
"pdf",
|
|
1688
|
+
"docx",
|
|
1689
|
+
"csv",
|
|
1690
|
+
"txt"
|
|
1691
|
+
].includes(n ?? "") ? n : /pdf/.test(t) ? "pdf" : /wordprocessingml/.test(t) ? "docx" : /spreadsheetml|ms-excel/.test(t) ? "xlsx" : /markdown/.test(t) ? "md" : /csv/.test(t) ? "csv" : /^text\//.test(t) ? "txt" : "unsupported";
|
|
1692
|
+
}
|
|
1693
|
+
function Sa(e, t) {
|
|
1694
|
+
let n = typeof t == "number" ? t : t?.[e] ?? a[e] ?? 20 * 1024 ** 2;
|
|
1695
|
+
if (!Number.isFinite(n) || n <= 0) throw new c("invalidSize");
|
|
1696
|
+
return n;
|
|
1697
|
+
}
|
|
1698
|
+
function Ca(e, t) {
|
|
1699
|
+
if (e > t) throw new c("tooLarge");
|
|
1700
|
+
}
|
|
1701
|
+
function wa(e) {
|
|
1702
|
+
try {
|
|
1703
|
+
let t = new TextDecoder("utf-8", { fatal: !0 }).decode(e);
|
|
1704
|
+
if (t.includes("\0")) throw Error("binary");
|
|
1705
|
+
return t;
|
|
1706
|
+
} catch {
|
|
1707
|
+
throw new c("invalidFile");
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
function Ta(e, t) {
|
|
1711
|
+
let n = new Uint8Array(e), r = (...e) => e.every((e, t) => n[t] === e);
|
|
1712
|
+
if (t === "pdf" && !r(37, 80, 68, 70, 45) || t === "docx" && !r(80, 75, 3, 4) || t === "xlsx" && !r(80, 75, 3, 4) && !r(208, 207, 17, 224, 161, 177, 26, 225)) throw new c("invalidFile");
|
|
1713
|
+
if (r(80, 75, 3, 4) && Da(e, t), [
|
|
1714
|
+
"md",
|
|
1715
|
+
"csv",
|
|
1716
|
+
"txt"
|
|
1717
|
+
].includes(t)) {
|
|
1718
|
+
if (r(37, 80, 68, 70, 45) || r(80, 75) || r(208, 207, 17, 224)) throw new c("invalidFile");
|
|
1719
|
+
wa(e);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
async function Ea(e, t, n) {
|
|
1723
|
+
let r, i = t.filename ?? "";
|
|
1724
|
+
if (typeof e == "string" && t.type === "md") r = new Blob([e], { type: "text/markdown" });
|
|
1725
|
+
else if (typeof e == "string") {
|
|
1726
|
+
let a = new URL(e, location.href);
|
|
1727
|
+
if (![
|
|
1728
|
+
"http:",
|
|
1729
|
+
"https:",
|
|
1730
|
+
"blob:"
|
|
1731
|
+
].includes(a.protocol)) throw new c("invalidFile");
|
|
1732
|
+
i ||= a.pathname;
|
|
1733
|
+
let o = await fetch(a, {
|
|
1734
|
+
...t.fetchInit,
|
|
1735
|
+
signal: n
|
|
1736
|
+
});
|
|
1737
|
+
if (!o.ok) throw new c("fetchFailed", String(o.status));
|
|
1738
|
+
let s = o.headers.get("content-type") ?? "", l = Sa(t.type ?? xa(i, s), t.maxSize), u = o.headers.get("content-length");
|
|
1739
|
+
u && Ca(Number(u), l);
|
|
1740
|
+
let d = o.body?.getReader();
|
|
1741
|
+
if (!d) throw new c("fetchFailed");
|
|
1742
|
+
let f = [], p = 0;
|
|
1743
|
+
try {
|
|
1744
|
+
for (;;) {
|
|
1745
|
+
let { done: e, value: t } = await d.read();
|
|
1746
|
+
if (e) break;
|
|
1747
|
+
p += t.byteLength, Ca(p, l), f.push(t);
|
|
1748
|
+
}
|
|
1749
|
+
} catch (e) {
|
|
1750
|
+
throw await d.cancel(), e;
|
|
1751
|
+
} finally {
|
|
1752
|
+
d.releaseLock();
|
|
1753
|
+
}
|
|
1754
|
+
r = new Blob(f, { type: s });
|
|
1755
|
+
} else r = e instanceof Blob ? e : new Blob([e]);
|
|
1756
|
+
let a = t.type ?? xa(i, r.type);
|
|
1757
|
+
if (a === "unsupported" && r.size <= Sa("txt", t.maxSize)) try {
|
|
1758
|
+
wa(await r.arrayBuffer()), a = "txt";
|
|
1759
|
+
} catch {}
|
|
1760
|
+
return Ca(r.size, Sa(a, t.maxSize)), {
|
|
1761
|
+
blob: r,
|
|
1762
|
+
filename: i,
|
|
1763
|
+
type: a
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
function Da(e, t) {
|
|
1767
|
+
let n = new DataView(e), r = -1;
|
|
1768
|
+
for (let t = e.byteLength - 22; t >= Math.max(0, e.byteLength - 65557); t--) if (n.getUint32(t, !0) === 101010256 && t + 22 + n.getUint16(t + 20, !0) === e.byteLength) {
|
|
1769
|
+
r = t;
|
|
1770
|
+
break;
|
|
1771
|
+
}
|
|
1772
|
+
if (r < 0) throw new c("invalidFile");
|
|
1773
|
+
let i = n.getUint16(r + 10, !0), a = n.getUint32(r + 12, !0), o = n.getUint32(r + 16, !0), s = 0;
|
|
1774
|
+
if (i > 1e4 || o + a !== r || n.getUint16(r + 4, !0) !== 0 || n.getUint16(r + 6, !0) !== 0) throw new c("complex");
|
|
1775
|
+
let l = /* @__PURE__ */ new Set();
|
|
1776
|
+
for (let t = 0; t < i; t++) {
|
|
1777
|
+
if (o + 46 > r || n.getUint32(o, !0) !== 33639248) throw new c("invalidFile");
|
|
1778
|
+
let t = n.getUint32(o + 24, !0);
|
|
1779
|
+
if (s += t, t > 20 * 1024 ** 2 || s > 50 * 1024 ** 2 || n.getUint16(o + 8, !0) & 1) throw new c("complex");
|
|
1780
|
+
let i = n.getUint16(o + 28, !0), a = o + 46 + i + n.getUint16(o + 30, !0) + n.getUint16(o + 32, !0);
|
|
1781
|
+
if (a > r) throw new c("invalidFile");
|
|
1782
|
+
l.add(new TextDecoder().decode(new Uint8Array(e, o + 46, i))), o = a;
|
|
1783
|
+
}
|
|
1784
|
+
if (o !== r || !l.has("[Content_Types].xml") || !l.has(t === "docx" ? "word/document.xml" : "xl/workbook.xml")) throw new c("invalidFile");
|
|
1785
|
+
}
|
|
1786
|
+
// packages/ui/src/components/display/doc-viewer/markdown.ts
|
|
1787
|
+
function Oa(e) {
|
|
1788
|
+
return /^(https?:\/\/|mailto:)/i.test(e);
|
|
1789
|
+
}
|
|
1790
|
+
function ka(e = "ca-doc-") {
|
|
1791
|
+
let t = new Jn({
|
|
1792
|
+
html: !1,
|
|
1793
|
+
linkify: !0,
|
|
1794
|
+
typographer: !1,
|
|
1795
|
+
maxNesting: 32
|
|
1796
|
+
}).use(Yn, { slugify: (t) => e + encodeURIComponent(t.toLowerCase().replace(/\s+/g, "-")) }).use(Xn);
|
|
1797
|
+
for (let e of [
|
|
1798
|
+
"tip",
|
|
1799
|
+
"info",
|
|
1800
|
+
"warning",
|
|
1801
|
+
"danger"
|
|
1802
|
+
]) t.use(Zn, e);
|
|
1803
|
+
return t.block.ruler.before("fence", "ca-math", (e, t, n, r) => {
|
|
1804
|
+
let i = (t) => e.src.slice(e.bMarks[t] + e.tShift[t], e.eMarks[t]);
|
|
1805
|
+
if (e.sCount[t] - e.blkIndent >= 4 || i(t).trim() !== "$$") return !1;
|
|
1806
|
+
let a = t + 1;
|
|
1807
|
+
for (; a < n && i(a).trim() !== "$$";) a++;
|
|
1808
|
+
if (a === n) return !1;
|
|
1809
|
+
if (r) return !0;
|
|
1810
|
+
let o = e.push("fence", "code", 0);
|
|
1811
|
+
return o.info = "math", o.content = Array.from({ length: a - t - 1 }, (e, n) => i(t + n + 1)).join("\n"), e.line = a + 1, !0;
|
|
1812
|
+
}, { alt: [
|
|
1813
|
+
"paragraph",
|
|
1814
|
+
"reference",
|
|
1815
|
+
"blockquote",
|
|
1816
|
+
"list"
|
|
1817
|
+
] }), t.core.ruler.after("inline", "ca-task-list", (e) => {
|
|
1818
|
+
for (let t = 0; t < e.tokens.length; t++) {
|
|
1819
|
+
let n = e.tokens[t];
|
|
1820
|
+
if (n.type !== "inline" || e.tokens[t - 1]?.type !== "paragraph_open" || e.tokens[t - 2]?.type !== "list_item_open") continue;
|
|
1821
|
+
let r = n.children?.[0], i = r?.content.match(/^\[([ xX])\] /);
|
|
1822
|
+
if (!i || !r || r.type !== "text") continue;
|
|
1823
|
+
r.content = r.content.slice(4);
|
|
1824
|
+
let a = new e.Token("html_inline", "", 0);
|
|
1825
|
+
a.content = `<input type="checkbox" disabled${i[1].toLowerCase() === "x" ? " checked" : ""}>`, n.children.unshift(a);
|
|
1826
|
+
}
|
|
1827
|
+
}), t;
|
|
1828
|
+
}
|
|
1829
|
+
function Aa(e, t = !1) {
|
|
1830
|
+
let n = Qn.sanitize(e, {
|
|
1831
|
+
RETURN_DOM_FRAGMENT: !0,
|
|
1832
|
+
ADD_TAGS: ["input"],
|
|
1833
|
+
ADD_ATTR: ["checked", "disabled"],
|
|
1834
|
+
FORBID_TAGS: [
|
|
1835
|
+
"style",
|
|
1836
|
+
"iframe",
|
|
1837
|
+
"script",
|
|
1838
|
+
"object",
|
|
1839
|
+
"embed",
|
|
1840
|
+
"form"
|
|
1841
|
+
]
|
|
1842
|
+
});
|
|
1843
|
+
for (let e of n.querySelectorAll("[style]")) {
|
|
1844
|
+
let t = e.getAttribute("style") ?? "";
|
|
1845
|
+
/url\s*\(|expression|@import|[\\<>]/i.test(t) && e.removeAttribute("style");
|
|
1846
|
+
}
|
|
1847
|
+
for (let e of n.querySelectorAll("a")) {
|
|
1848
|
+
let t = e.getAttribute("href") ?? "";
|
|
1849
|
+
!Oa(t) && !(t.startsWith("#") && Array.from(n.querySelectorAll("[id]")).some((e) => "#" + e.id === t)) && e.removeAttribute("href"), e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer"), t.startsWith("#") && e.removeAttribute("target");
|
|
1850
|
+
}
|
|
1851
|
+
for (let e of n.querySelectorAll("img")) !t || !/^https?:\/\//i.test(e.getAttribute("src") ?? "") ? e.remove() : (e.removeAttribute("srcset"), e.setAttribute("loading", "lazy"), e.setAttribute("referrerpolicy", "no-referrer"));
|
|
1852
|
+
let r = document.createElement("div");
|
|
1853
|
+
return r.append(n), r.innerHTML;
|
|
1854
|
+
}
|
|
1855
|
+
async function ja(e, t, n) {
|
|
1856
|
+
if (e.split("\n").some((e) => e.length > 1e5) || e.split("\n").length > 2e4) throw new c("complex");
|
|
1857
|
+
let r = ka(n), i = { docId: n }, a = r.parse(e, i), o = [], s = /* @__PURE__ */ new Set(), l = [];
|
|
1858
|
+
for (let e = 0; e < a.length; e++) {
|
|
1859
|
+
let t = a[e];
|
|
1860
|
+
if (t.type === "heading_open" && o.push({
|
|
1861
|
+
id: String(t.attrGet("id") ?? ""),
|
|
1862
|
+
level: Number(t.tag.slice(1)),
|
|
1863
|
+
text: a[e + 1]?.content ?? ""
|
|
1864
|
+
}), t.type !== "fence") continue;
|
|
1865
|
+
let i = t.info.trim().split(/\s/)[0] ?? "";
|
|
1866
|
+
if (i === "math" || i === "latex") try {
|
|
1867
|
+
let e = await u("katex");
|
|
1868
|
+
t.type = "html_block", t.content = e.renderToString(t.content, {
|
|
1869
|
+
displayMode: !0,
|
|
1870
|
+
throwOnError: !1,
|
|
1871
|
+
trust: !1,
|
|
1872
|
+
maxExpand: 1e3,
|
|
1873
|
+
maxSize: 20
|
|
1874
|
+
});
|
|
1875
|
+
} catch {
|
|
1876
|
+
s.add("katex");
|
|
1877
|
+
}
|
|
1878
|
+
else if (i === "mermaid") {
|
|
1879
|
+
let e = n + "diagram-" + l.length;
|
|
1880
|
+
l.push({
|
|
1881
|
+
id: e,
|
|
1882
|
+
source: t.content
|
|
1883
|
+
}), t.type = "html_block", t.content = `<div data-ca-diagram="${e}"><pre>${r.utils.escapeHtml(t.content)}</pre></div>`;
|
|
1884
|
+
} else try {
|
|
1885
|
+
let { codeToHtml: e } = await u("shiki"), n = {
|
|
1886
|
+
lang: i || "text",
|
|
1887
|
+
themes: {
|
|
1888
|
+
light: "github-light",
|
|
1889
|
+
dark: "github-dark"
|
|
1890
|
+
}
|
|
1891
|
+
}, r = await e(t.content, n).catch(() => e(t.content, {
|
|
1892
|
+
...n,
|
|
1893
|
+
lang: "text"
|
|
1894
|
+
}));
|
|
1895
|
+
t.type = "html_block", t.content = r;
|
|
1896
|
+
} catch {
|
|
1897
|
+
s.add("shiki");
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
let d = async (e) => {
|
|
1901
|
+
for (let t of e) if (t.children && await d(t.children), t.type === "text" && /\$[^$]+\$/.test(t.content)) try {
|
|
1902
|
+
let e = await u("katex");
|
|
1903
|
+
t.content = t.content.split(/(\$\$[\s\S]+?\$\$|\$[^$\n]+?\$)/g).map((t) => {
|
|
1904
|
+
if (!t.startsWith("$")) return r.utils.escapeHtml(t);
|
|
1905
|
+
let n = t.startsWith("$$");
|
|
1906
|
+
return e.renderToString(t.slice(n ? 2 : 1, n ? -2 : -1), {
|
|
1907
|
+
displayMode: n,
|
|
1908
|
+
throwOnError: !1,
|
|
1909
|
+
trust: !1,
|
|
1910
|
+
maxExpand: 1e3,
|
|
1911
|
+
maxSize: 20
|
|
1912
|
+
});
|
|
1913
|
+
}).join(""), t.type = "html_inline";
|
|
1914
|
+
} catch {
|
|
1915
|
+
s.add("katex");
|
|
1916
|
+
}
|
|
1917
|
+
};
|
|
1918
|
+
return await d(a), {
|
|
1919
|
+
html: Aa(r.renderer.render(a, r.options, i), t),
|
|
1920
|
+
headings: o,
|
|
1921
|
+
diagrams: l,
|
|
1922
|
+
warnings: [...s]
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
function Ma(e) {
|
|
1926
|
+
let t = Qn.sanitize(e, {
|
|
1927
|
+
RETURN_DOM_FRAGMENT: !0,
|
|
1928
|
+
USE_PROFILES: {
|
|
1929
|
+
svg: !0,
|
|
1930
|
+
svgFilters: !0
|
|
1931
|
+
},
|
|
1932
|
+
FORBID_TAGS: [
|
|
1933
|
+
"foreignObject",
|
|
1934
|
+
"image",
|
|
1935
|
+
"a"
|
|
1936
|
+
],
|
|
1937
|
+
FORBID_ATTR: ["href", "xlink:href"]
|
|
1938
|
+
});
|
|
1939
|
+
for (let e of t.querySelectorAll("*")) for (let t of Array.from(e.attributes)) /url\s*\(\s*['"]?(?!#)|[\\<>]/i.test(t.value) && e.removeAttribute(t.name);
|
|
1940
|
+
for (let e of t.querySelectorAll("[style], style")) {
|
|
1941
|
+
let t = e.tagName.toLowerCase() === "style" ? e.textContent ?? "" : e.getAttribute("style") ?? "";
|
|
1942
|
+
/@import|[\\<>]|url\s*\(\s*['"]?(?!#)/i.test(t) && (e.tagName.toLowerCase() === "style" ? e.remove() : e.removeAttribute("style"));
|
|
1943
|
+
}
|
|
1944
|
+
let n = document.createElement("div");
|
|
1945
|
+
return n.append(t), n.innerHTML;
|
|
1946
|
+
}
|
|
1947
|
+
// packages/ui/src/components/display/doc-viewer/sheets.ts
|
|
1948
|
+
function Na(e, t) {
|
|
1949
|
+
let n = e["!ref"] ?? "A1", r = (e) => {
|
|
1950
|
+
let t = /^([A-Z]+)([1-9]\d*)$/.exec(e);
|
|
1951
|
+
if (!t) throw new c("invalidFile");
|
|
1952
|
+
let n = 0;
|
|
1953
|
+
for (let e of t[1]) n = n * 26 + e.charCodeAt(0) - 64;
|
|
1954
|
+
return {
|
|
1955
|
+
r: Number(t[2]) - 1,
|
|
1956
|
+
c: n - 1
|
|
1957
|
+
};
|
|
1958
|
+
}, [i, a = i] = n.split(":"), o = r(i), s = r(a);
|
|
1959
|
+
if (![
|
|
1960
|
+
o.r,
|
|
1961
|
+
o.c,
|
|
1962
|
+
s.r,
|
|
1963
|
+
s.c
|
|
1964
|
+
].every(Number.isSafeInteger) || Math.max(o.c, s.c) > 16383) throw new c("invalidFile");
|
|
1965
|
+
let l = s.c - o.c + 1;
|
|
1966
|
+
if (l > 256 || l < 1 || s.r < o.r || s.r > 1048575) throw new c("complex");
|
|
1967
|
+
let u = Math.min(t, Math.floor(1e5 / l), s.r - o.r + 1), d = e["!merges"] ?? [];
|
|
1968
|
+
if (d.length > 1e4) throw new c("complex");
|
|
1969
|
+
let f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = 0;
|
|
1970
|
+
for (let e of d) {
|
|
1971
|
+
let t = Math.max(o.r, e.s.r), n = Math.min(o.r + u - 1, e.e.r), r = Math.max(o.c, e.s.c), i = Math.min(s.c, e.e.c);
|
|
1972
|
+
if (!(t > n || r > i)) {
|
|
1973
|
+
if (m += (n - t + 1) * (i - r + 1), m > 1e5) throw new c("complex");
|
|
1974
|
+
p.set(`${t},${r}`, {
|
|
1975
|
+
colspan: i - r + 1,
|
|
1976
|
+
rowspan: n - t + 1
|
|
1977
|
+
});
|
|
1978
|
+
for (let e = t; e <= n; e++) for (let n = r; n <= i; n++) (e !== t || n !== r) && f.add(`${e},${n}`);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
let h = (e, t) => {
|
|
1982
|
+
let n = "";
|
|
1983
|
+
for (let e = t + 1; e; e = Math.floor((e - 1) / 26)) n = String.fromCharCode(65 + (e - 1) % 26) + n;
|
|
1984
|
+
return n + (e + 1);
|
|
1985
|
+
}, g = [];
|
|
1986
|
+
for (let t = o.r; t < o.r + u; t++) {
|
|
1987
|
+
let n = [];
|
|
1988
|
+
for (let r = o.c; r <= s.c; r++) {
|
|
1989
|
+
if (f.has(`${t},${r}`)) continue;
|
|
1990
|
+
let i = e[h(t, r)];
|
|
1991
|
+
n.push({
|
|
1992
|
+
text: i?.v == null ? "" : String(i.w ?? i.v),
|
|
1993
|
+
...p.get(`${t},${r}`) ?? {
|
|
1994
|
+
colspan: 1,
|
|
1995
|
+
rowspan: 1
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
}
|
|
1999
|
+
g.push(n);
|
|
2000
|
+
}
|
|
2001
|
+
return {
|
|
2002
|
+
rows: g,
|
|
2003
|
+
shown: u,
|
|
2004
|
+
total: s.r - o.r + 1,
|
|
2005
|
+
capped: u < Math.min(t, s.r - o.r + 1)
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
// packages/ui/src/components/display/doc-viewer/CaDocViewer.vue?vue&type=script&setup=true&lang.ts
|
|
2009
|
+
var Pa = ["aria-busy"], Fa = { class: "ca-doc-controls" }, Ia = { class: "ca-doc-filename" }, La = {
|
|
2010
|
+
key: 1,
|
|
2011
|
+
class: "ca-doc-state",
|
|
2012
|
+
role: "alert"
|
|
2013
|
+
}, Ra = {
|
|
2014
|
+
key: 0,
|
|
2015
|
+
class: "ca-doc-state"
|
|
2016
|
+
}, za = {
|
|
2017
|
+
key: 1,
|
|
2018
|
+
class: "ca-doc-state"
|
|
2019
|
+
}, Ba = {
|
|
2020
|
+
key: 2,
|
|
2021
|
+
class: "ca-doc-markdown-layout"
|
|
2022
|
+
}, Va = ["aria-label"], Ha = ["href", "onClick"], Ua = ["innerHTML"], Wa = {
|
|
2023
|
+
key: 3,
|
|
2024
|
+
class: "ca-doc-state"
|
|
2025
|
+
}, Ga = {
|
|
2026
|
+
key: 4,
|
|
2027
|
+
class: "ca-doc-text"
|
|
2028
|
+
}, Ka = ["aria-label"], qa = ["aria-label"], Ja = { key: 0 }, Ya = { key: 1 }, Xa = /* @__PURE__ */ V({
|
|
2029
|
+
__name: "CaDocViewer",
|
|
2030
|
+
props: {
|
|
2031
|
+
source: {},
|
|
2032
|
+
filename: {},
|
|
2033
|
+
type: {},
|
|
2034
|
+
loading: { type: Boolean },
|
|
2035
|
+
error: {},
|
|
2036
|
+
maxSize: {},
|
|
2037
|
+
toc: {
|
|
2038
|
+
type: Boolean,
|
|
2039
|
+
default: !0
|
|
2040
|
+
},
|
|
2041
|
+
allowImages: {
|
|
2042
|
+
type: Boolean,
|
|
2043
|
+
default: !1
|
|
2044
|
+
},
|
|
2045
|
+
converter: {},
|
|
2046
|
+
fetchInit: {},
|
|
2047
|
+
textLayer: { type: Boolean }
|
|
2048
|
+
},
|
|
2049
|
+
emits: [
|
|
2050
|
+
"load",
|
|
2051
|
+
"error",
|
|
2052
|
+
"retry",
|
|
2053
|
+
"download"
|
|
2054
|
+
],
|
|
2055
|
+
setup(e, { emit: t }) {
|
|
2056
|
+
let n = Lt(() => import("./CaDocPdf-BMSfqmuh.js")), i = Lt(() => import("./CaDocWord-BYX69Eoh.js")), a = e, o = t, l = s(), d = "ca-doc-" + Jt().replace(/[^\w-]/g, "") + "-", f = G(), p = G(), m = G(!1), h = G(""), g = G([]), _ = G(""), v = G(""), y = G([]), b = G("unsupported"), x = qt(), S = qt(), C = qt(), w = G(""), T = G(2e3), E = G(0), D = P(() => a.filename ?? "document"), O = P(() => C.value && w.value ? Na(C.value.Sheets[w.value], T.value) : void 0), ee = P(() => a.loading || m.value), k = P(() => a.error || h.value), A = 0, j;
|
|
2057
|
+
function M(e) {
|
|
2058
|
+
let t = e instanceof Error ? e : Error(String(e));
|
|
2059
|
+
h.value = t instanceof c ? l(`campus.doc.${t.key}`, { name: t.detail }) : l("campus.doc.renderFailed"), m.value = !1, o("error", t);
|
|
2060
|
+
}
|
|
2061
|
+
function te() {
|
|
2062
|
+
m.value = !1, o("load", {
|
|
2063
|
+
type: b.value,
|
|
2064
|
+
filename: D.value
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
function ne() {
|
|
2068
|
+
o("retry"), E.value++;
|
|
2069
|
+
}
|
|
2070
|
+
function re(e) {
|
|
2071
|
+
let t = Array.from(p.value?.querySelectorAll("[id]") ?? []).find((t) => t.id === e);
|
|
2072
|
+
t?.scrollIntoView({ block: "start" }), t?.setAttribute("tabindex", "-1"), t?.focus({ preventScroll: !0 });
|
|
2073
|
+
}
|
|
2074
|
+
function ie(e) {
|
|
2075
|
+
let t = e.target.closest("a");
|
|
2076
|
+
t?.getAttribute("href")?.startsWith("#") && (e.preventDefault(), re(t.getAttribute("href").slice(1)));
|
|
2077
|
+
}
|
|
2078
|
+
async function ae() {
|
|
2079
|
+
let e = new Event("download", { cancelable: !0 });
|
|
2080
|
+
if (o("download", {
|
|
2081
|
+
source: a.source,
|
|
2082
|
+
filename: D.value
|
|
2083
|
+
}, e), e.defaultPrevented) return;
|
|
2084
|
+
let t;
|
|
2085
|
+
try {
|
|
2086
|
+
if (S.value) t = URL.createObjectURL(S.value);
|
|
2087
|
+
else if (typeof a.source == "string" && a.type !== "md") {
|
|
2088
|
+
let e = new URL(a.source, location.href);
|
|
2089
|
+
[
|
|
2090
|
+
"http:",
|
|
2091
|
+
"https:",
|
|
2092
|
+
"blob:"
|
|
2093
|
+
].includes(e.protocol) && (t = e.href);
|
|
2094
|
+
}
|
|
2095
|
+
if (!t) return;
|
|
2096
|
+
let e = document.createElement("a");
|
|
2097
|
+
if (e.href = t, e.download = D.value, e.rel = "noopener noreferrer", e.target = "_blank", e.click(), S.value) {
|
|
2098
|
+
let e = t;
|
|
2099
|
+
setTimeout(() => URL.revokeObjectURL(e), 1e3);
|
|
2100
|
+
}
|
|
2101
|
+
} catch (e) {
|
|
2102
|
+
M(e);
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
return Zt(() => [
|
|
2106
|
+
a.source,
|
|
2107
|
+
a.filename,
|
|
2108
|
+
a.type,
|
|
2109
|
+
a.maxSize,
|
|
2110
|
+
a.allowImages,
|
|
2111
|
+
a.converter,
|
|
2112
|
+
a.fetchInit,
|
|
2113
|
+
E.value
|
|
2114
|
+
], async () => {
|
|
2115
|
+
let e = ++A;
|
|
2116
|
+
j?.abort(), j = new AbortController();
|
|
2117
|
+
let t = j.signal, n = setTimeout(() => {
|
|
2118
|
+
e === A && (j?.abort(), A++, M(new c("timeout")));
|
|
2119
|
+
}, 3e4);
|
|
2120
|
+
if (h.value = "", g.value = [], _.value = "", v.value = "", y.value = [], x.value = void 0, S.value = void 0, C.value = void 0, w.value = "", T.value = 2e3, a.source instanceof Blob ? S.value = a.source : (a.source instanceof ArrayBuffer || a.type === "md" && a.source !== void 0) && (S.value = new Blob([a.source])), a.source === void 0) m.value = !1, clearTimeout(n);
|
|
2121
|
+
else {
|
|
2122
|
+
m.value = !0;
|
|
2123
|
+
try {
|
|
2124
|
+
let n = await Ea(a.source, a, t);
|
|
2125
|
+
if (t.aborted || e !== A) return;
|
|
2126
|
+
if (S.value = n.blob, n.type === "legacy" && a.converter) {
|
|
2127
|
+
let r = await a.converter({
|
|
2128
|
+
blob: n.blob,
|
|
2129
|
+
filename: D.value
|
|
2130
|
+
});
|
|
2131
|
+
if (t.aborted || e !== A) return;
|
|
2132
|
+
let i = xa("file." + r.type, r.type);
|
|
2133
|
+
Ca(r.blob.size, Sa(i, a.maxSize)), n = {
|
|
2134
|
+
blob: r.blob,
|
|
2135
|
+
filename: n.filename,
|
|
2136
|
+
type: i
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
if (b.value = n.type, n.type === "legacy" || n.type === "unsupported") {
|
|
2140
|
+
m.value = !1;
|
|
2141
|
+
return;
|
|
2142
|
+
}
|
|
2143
|
+
let r = await n.blob.arrayBuffer();
|
|
2144
|
+
if (Ta(r, n.type), t.aborted || e !== A) return;
|
|
2145
|
+
if (n.type === "md") {
|
|
2146
|
+
let n = await ja(wa(r), a.allowImages, d);
|
|
2147
|
+
if (t.aborted || e !== A) return;
|
|
2148
|
+
_.value = n.html, y.value = n.headings, g.value = n.warnings, await zt();
|
|
2149
|
+
for (let r of n.diagrams) {
|
|
2150
|
+
let n;
|
|
2151
|
+
try {
|
|
2152
|
+
n = (await u("mermaid")).default;
|
|
2153
|
+
} catch {
|
|
2154
|
+
g.value.push("mermaid");
|
|
2155
|
+
continue;
|
|
2156
|
+
}
|
|
2157
|
+
if (t.aborted || e !== A) return;
|
|
2158
|
+
n.initialize({
|
|
2159
|
+
startOnLoad: !1,
|
|
2160
|
+
securityLevel: "strict",
|
|
2161
|
+
maxTextSize: 5e4,
|
|
2162
|
+
suppressErrorRendering: !0
|
|
2163
|
+
});
|
|
2164
|
+
try {
|
|
2165
|
+
let i = await n.render(r.id, r.source);
|
|
2166
|
+
if (t.aborted || e !== A) return;
|
|
2167
|
+
let a = Array.from(p.value?.querySelectorAll("[data-ca-diagram]") ?? []).find((e) => e.dataset.caDiagram === r.id);
|
|
2168
|
+
a && (a.innerHTML = Ma(i.svg));
|
|
2169
|
+
} catch {
|
|
2170
|
+
throw new c("diagramFailed");
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
} else if (n.type === "txt") v.value = wa(r);
|
|
2174
|
+
else if (n.type === "xlsx" || n.type === "csv") {
|
|
2175
|
+
let i = await u("xlsx");
|
|
2176
|
+
if (t.aborted || e !== A) return;
|
|
2177
|
+
let a = i.read(n.type === "csv" ? wa(r) : r, {
|
|
2178
|
+
type: n.type === "csv" ? "string" : "array",
|
|
2179
|
+
raw: !0,
|
|
2180
|
+
cellHTML: !1,
|
|
2181
|
+
cellFormula: !1,
|
|
2182
|
+
bookVBA: !1
|
|
2183
|
+
});
|
|
2184
|
+
if (!a.SheetNames.length) throw new c("invalidFile");
|
|
2185
|
+
for (let e of a.SheetNames) Na(a.Sheets[e], 1);
|
|
2186
|
+
C.value = a, w.value = a.SheetNames[0];
|
|
2187
|
+
} else {
|
|
2188
|
+
x.value = r;
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
te();
|
|
2192
|
+
} catch (n) {
|
|
2193
|
+
e === A && M(t.aborted ? new c("timeout") : n);
|
|
2194
|
+
} finally {
|
|
2195
|
+
clearTimeout(n);
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
}, { immediate: !0 }), Zt(w, () => {
|
|
2199
|
+
T.value = 2e3;
|
|
2200
|
+
}), Ht(() => {
|
|
2201
|
+
A++, j?.abort();
|
|
2202
|
+
}), (t, a) => (W(), L("section", {
|
|
2203
|
+
ref_key: "host",
|
|
2204
|
+
ref: f,
|
|
2205
|
+
class: "ca-doc-viewer",
|
|
2206
|
+
"aria-busy": ee.value
|
|
2207
|
+
}, [
|
|
2208
|
+
R("div", Fa, [q(t.$slots, "toolbar", {}, () => [R("span", Ia, J(D.value), 1)]), B(Y(r), {
|
|
2209
|
+
disabled: e.source === void 0,
|
|
2210
|
+
onClick: ae
|
|
2211
|
+
}, {
|
|
2212
|
+
default: X(() => [z(J(Y(l)("campus.doc.download")), 1)]),
|
|
2213
|
+
_: 1
|
|
2214
|
+
}, 8, ["disabled"])]),
|
|
2215
|
+
ee.value ? (W(), F(Y(jo), {
|
|
2216
|
+
key: 0,
|
|
2217
|
+
animated: "",
|
|
2218
|
+
rows: 5,
|
|
2219
|
+
"aria-label": Y(l)("campus.common.loading")
|
|
2220
|
+
}, null, 8, ["aria-label"])) : I("v-if", !0),
|
|
2221
|
+
k.value ? (W(), L("div", La, [R("p", null, J(k.value), 1), B(Y(r), { onClick: ne }, {
|
|
2222
|
+
default: X(() => [z(J(Y(l)("campus.doc.retry")), 1)]),
|
|
2223
|
+
_: 1
|
|
2224
|
+
})])) : (W(), L(N, { key: 2 }, [
|
|
2225
|
+
(W(!0), L(N, null, K([...new Set(g.value)], (e) => (W(), L("p", {
|
|
2226
|
+
key: e,
|
|
2227
|
+
role: "status"
|
|
2228
|
+
}, J(Y(l)("campus.doc.dependency", { name: e })), 1))), 128)),
|
|
2229
|
+
e.source === void 0 ? (W(), L("div", Ra, [q(t.$slots, "empty", {}, () => [z(J(Y(l)("campus.doc.empty")), 1)])])) : !ee.value && (b.value === "legacy" || b.value === "unsupported") ? (W(), L("div", za, [q(t.$slots, "unsupported", { type: b.value }, () => [z(J(Y(l)(b.value === "legacy" ? "campus.doc.convert" : "campus.doc.unsupported")), 1)])])) : I("v-if", !0),
|
|
2230
|
+
b.value === "md" && _.value ? (W(), L("div", Ba, [e.toc && y.value.length ? (W(), L("nav", {
|
|
2231
|
+
key: 0,
|
|
2232
|
+
class: "ca-doc-toc",
|
|
2233
|
+
"aria-label": Y(l)("campus.doc.toc")
|
|
2234
|
+
}, [(W(!0), L(N, null, K(y.value, (e) => (W(), L("a", {
|
|
2235
|
+
key: e.id,
|
|
2236
|
+
href: "#" + e.id,
|
|
2237
|
+
style: U({ paddingInlineStart: (e.level - 1) * 10 + "px" }),
|
|
2238
|
+
onClick: $t((t) => re(e.id), ["prevent"])
|
|
2239
|
+
}, J(e.text), 13, Ha))), 128))], 8, Va)) : I("v-if", !0), R("article", {
|
|
2240
|
+
ref_key: "body",
|
|
2241
|
+
ref: p,
|
|
2242
|
+
class: "ca-doc-markdown",
|
|
2243
|
+
onClick: ie,
|
|
2244
|
+
innerHTML: _.value
|
|
2245
|
+
}, null, 8, Ua)])) : b.value === "md" && !ee.value ? (W(), L("div", Wa, J(Y(l)("campus.doc.empty")), 1)) : b.value === "txt" ? (W(), L("pre", Ga, J(v.value), 1)) : I("v-if", !0),
|
|
2246
|
+
C.value && O.value ? (W(), L(N, { key: 5 }, [
|
|
2247
|
+
R("div", {
|
|
2248
|
+
class: "ca-doc-controls",
|
|
2249
|
+
role: "tablist",
|
|
2250
|
+
"aria-label": Y(l)("campus.doc.sheets")
|
|
2251
|
+
}, [(W(!0), L(N, null, K(C.value.SheetNames, (e) => (W(), F(Y(r), {
|
|
2252
|
+
key: e,
|
|
2253
|
+
role: "tab",
|
|
2254
|
+
"aria-selected": w.value === e,
|
|
2255
|
+
type: w.value === e ? "primary" : "default",
|
|
2256
|
+
onClick: (t) => w.value = e
|
|
2257
|
+
}, {
|
|
2258
|
+
default: X(() => [z(J(e), 1)]),
|
|
2259
|
+
_: 2
|
|
2260
|
+
}, 1032, [
|
|
2261
|
+
"aria-selected",
|
|
2262
|
+
"type",
|
|
2263
|
+
"onClick"
|
|
2264
|
+
]))), 128))], 8, Ka),
|
|
2265
|
+
R("div", {
|
|
2266
|
+
class: "ca-doc-sheet",
|
|
2267
|
+
role: "region",
|
|
2268
|
+
"aria-label": w.value,
|
|
2269
|
+
tabindex: "0"
|
|
2270
|
+
}, [R("table", null, [R("tbody", null, [(W(!0), L(N, null, K(O.value.rows, (e, t) => (W(), L("tr", { key: t }, [(W(!0), L(N, null, K(e, (e, n) => (W(), F(Kt(t === 0 ? "th" : "td"), {
|
|
2271
|
+
key: n,
|
|
2272
|
+
colspan: e.colspan,
|
|
2273
|
+
rowspan: e.rowspan
|
|
2274
|
+
}, {
|
|
2275
|
+
default: X(() => [z(J(e.text), 1)]),
|
|
2276
|
+
_: 2
|
|
2277
|
+
}, 1032, ["colspan", "rowspan"]))), 128))]))), 128))])])], 8, qa),
|
|
2278
|
+
O.value.shown < O.value.total ? (W(), L("p", Ja, [z(J(Y(l)("campus.doc.rows", {
|
|
2279
|
+
shown: O.value.shown,
|
|
2280
|
+
total: O.value.total
|
|
2281
|
+
})) + " ", 1), O.value.capped ? (W(), L("span", Ya, J(Y(l)("campus.doc.complex")), 1)) : (W(), F(Y(r), {
|
|
2282
|
+
key: 0,
|
|
2283
|
+
onClick: a[0] ||= (e) => T.value += 2e3
|
|
2284
|
+
}, {
|
|
2285
|
+
default: X(() => [z(J(Y(l)("campus.doc.more")), 1)]),
|
|
2286
|
+
_: 1
|
|
2287
|
+
}))])) : I("v-if", !0)
|
|
2288
|
+
], 64)) : I("v-if", !0),
|
|
2289
|
+
b.value === "pdf" && x.value ? (W(), F(Y(n), {
|
|
2290
|
+
key: Y(A),
|
|
2291
|
+
data: x.value,
|
|
2292
|
+
"text-layer": e.textLayer,
|
|
2293
|
+
onLoad: te,
|
|
2294
|
+
onError: M
|
|
2295
|
+
}, null, 8, ["data", "text-layer"])) : I("v-if", !0),
|
|
2296
|
+
b.value === "docx" && x.value ? (W(), F(Y(i), {
|
|
2297
|
+
key: Y(A),
|
|
2298
|
+
data: x.value,
|
|
2299
|
+
onLoad: te,
|
|
2300
|
+
onError: M
|
|
2301
|
+
}, null, 8, ["data"])) : I("v-if", !0)
|
|
2302
|
+
], 64))
|
|
2303
|
+
], 8, Pa));
|
|
2304
|
+
}
|
|
2305
|
+
}), Za = e(me), Qa = e(ge), $a = e(Ge), eo = e(We), to = e(Tt), no = {
|
|
2306
|
+
CaPopover: $a,
|
|
2307
|
+
CaPopconfirm: eo,
|
|
2308
|
+
CaTooltip: to,
|
|
2309
|
+
CaDialog: Za,
|
|
2310
|
+
CaDrawer: Qa
|
|
2311
|
+
}, ro = {
|
|
2312
|
+
key: 0,
|
|
2313
|
+
class: "ca-doc-meta"
|
|
2314
|
+
}, io = { class: "ca-doc-dialog-content" }, ao = /* @__PURE__ */ V({
|
|
2315
|
+
inheritAttrs: !1,
|
|
2316
|
+
__name: "CaDocDialog",
|
|
2317
|
+
props: {
|
|
2318
|
+
source: {},
|
|
2319
|
+
filename: {},
|
|
2320
|
+
type: {},
|
|
2321
|
+
loading: { type: Boolean },
|
|
2322
|
+
error: {},
|
|
2323
|
+
maxSize: {},
|
|
2324
|
+
toc: { type: Boolean },
|
|
2325
|
+
allowImages: { type: Boolean },
|
|
2326
|
+
converter: { type: Function },
|
|
2327
|
+
fetchInit: {},
|
|
2328
|
+
modelValue: { type: Boolean },
|
|
2329
|
+
title: {},
|
|
2330
|
+
meta: {},
|
|
2331
|
+
textLayer: { type: Boolean }
|
|
2332
|
+
},
|
|
2333
|
+
emits: ["update:modelValue"],
|
|
2334
|
+
setup(e, { emit: t }) {
|
|
2335
|
+
let n = e, i = t, a = s(), o = G(!1);
|
|
2336
|
+
try {
|
|
2337
|
+
o.value = localStorage.getItem("ca-doc-expanded") === "true";
|
|
2338
|
+
} catch {}
|
|
2339
|
+
let c = P(() => {
|
|
2340
|
+
let { modelValue: e, title: t, meta: r, ...i } = n;
|
|
2341
|
+
return i;
|
|
2342
|
+
});
|
|
2343
|
+
function l() {
|
|
2344
|
+
o.value = !o.value;
|
|
2345
|
+
try {
|
|
2346
|
+
localStorage.setItem("ca-doc-expanded", String(o.value));
|
|
2347
|
+
} catch {}
|
|
2348
|
+
}
|
|
2349
|
+
return (t, n) => (W(), F(Y(Za), {
|
|
2350
|
+
"model-value": e.modelValue,
|
|
2351
|
+
title: e.title || e.filename || Y(a)("campus.doc.title"),
|
|
2352
|
+
width: "min(900px, 90vw)",
|
|
2353
|
+
fullscreen: o.value,
|
|
2354
|
+
class: "ca-doc-dialog",
|
|
2355
|
+
"destroy-on-close": "",
|
|
2356
|
+
"close-on-click-modal": !1,
|
|
2357
|
+
"lock-scroll": !0,
|
|
2358
|
+
"close-on-press-escape": !0,
|
|
2359
|
+
"onUpdate:modelValue": n[1] ||= (e) => i("update:modelValue", e)
|
|
2360
|
+
}, {
|
|
2361
|
+
header: X(() => [R("div", {
|
|
2362
|
+
class: "ca-doc-dialog-heading",
|
|
2363
|
+
onDblclick: l
|
|
2364
|
+
}, [R("span", null, J(e.title || e.filename || Y(a)("campus.doc.title")), 1), B(Y(r), {
|
|
2365
|
+
"aria-pressed": o.value,
|
|
2366
|
+
onDblclick: n[0] ||= $t(() => {}, ["stop"]),
|
|
2367
|
+
onClick: l
|
|
2368
|
+
}, {
|
|
2369
|
+
default: X(() => [z(J(Y(a)(o.value ? "campus.doc.restore" : "campus.doc.expand")), 1)]),
|
|
2370
|
+
_: 1
|
|
2371
|
+
}, 8, ["aria-pressed"])], 32)]),
|
|
2372
|
+
default: X(() => [e.meta ? (W(), L("dl", ro, [(W(!0), L(N, null, K(e.meta, (e, t) => (W(), L(N, { key: t }, [R("dt", null, J(t), 1), R("dd", null, J(e), 1)], 64))), 128))])) : I("v-if", !0), R("div", io, [B(Xa, Bt(Rt({
|
|
2373
|
+
...c.value,
|
|
2374
|
+
...t.$attrs
|
|
2375
|
+
})), It({ _: 2 }, [K(t.$slots, (e, n) => ({
|
|
2376
|
+
name: n,
|
|
2377
|
+
fn: X((e) => [q(t.$slots, n, Bt(Rt(e || {})))])
|
|
2378
|
+
}))]), 1040)])]),
|
|
2379
|
+
_: 3
|
|
2380
|
+
}, 8, [
|
|
2381
|
+
"model-value",
|
|
2382
|
+
"title",
|
|
2383
|
+
"fullscreen"
|
|
2384
|
+
]));
|
|
2385
|
+
}
|
|
2386
|
+
}), oo = { class: "ca-stat ca-card" }, so = { class: "ca-stat__head" }, co = { class: "ca-stat__title" }, lo = {
|
|
1692
2387
|
key: 0,
|
|
1693
2388
|
class: "ca-stat__tag"
|
|
1694
|
-
},
|
|
2389
|
+
}, uo = { class: "ca-stat__value" }, fo = {
|
|
1695
2390
|
key: 0,
|
|
1696
2391
|
class: "ca-stat__hint"
|
|
1697
|
-
},
|
|
2392
|
+
}, po = /*#__PURE__*/ l(/* @__PURE__ */ V({
|
|
1698
2393
|
__name: "CaStatCard",
|
|
1699
2394
|
props: {
|
|
1700
2395
|
title: {},
|
|
@@ -1704,79 +2399,81 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1704
2399
|
tag: {}
|
|
1705
2400
|
},
|
|
1706
2401
|
setup(e) {
|
|
1707
|
-
let t = e, n =
|
|
1708
|
-
return (t, r) => (
|
|
1709
|
-
|
|
1710
|
-
|
|
2402
|
+
let t = e, n = P(() => t.trend === void 0 ? "" : `${t.trend >= 0 ? "↑" : "↓"} ${Math.abs(t.trend)}%`);
|
|
2403
|
+
return (t, r) => (W(), L("div", oo, [
|
|
2404
|
+
R("div", so, [R("span", co, J(e.title), 1), e.tag ? (W(), L("span", lo, J(e.tag), 1)) : I("v-if", !0)]),
|
|
2405
|
+
R("div", uo, [z(J(e.value) + " ", 1), n.value ? (W(), L("span", {
|
|
1711
2406
|
key: 0,
|
|
1712
|
-
class:
|
|
1713
|
-
},
|
|
1714
|
-
e.hint || t.$slots.default ? (
|
|
2407
|
+
class: H(["ca-stat__trend", e.trend >= 0 ? "is-up" : "is-down"])
|
|
2408
|
+
}, J(n.value), 3)) : I("v-if", !0)]),
|
|
2409
|
+
e.hint || t.$slots.default ? (W(), L("div", fo, [q(t.$slots, "default", {}, () => [z(J(e.hint), 1)], !0)])) : I("v-if", !0)
|
|
1715
2410
|
]));
|
|
1716
2411
|
}
|
|
1717
|
-
}), [["__scopeId", "data-v-94d16941"]]),
|
|
2412
|
+
}), [["__scopeId", "data-v-94d16941"]]), mo = /* @__PURE__ */ V({
|
|
1718
2413
|
__name: "CaStatusTag",
|
|
1719
2414
|
props: {
|
|
1720
2415
|
value: {},
|
|
1721
2416
|
map: {}
|
|
1722
2417
|
},
|
|
1723
2418
|
setup(e) {
|
|
1724
|
-
let t = e, n =
|
|
2419
|
+
let t = e, n = P(() => t.map[String(t.value)] ?? {
|
|
1725
2420
|
label: String(t.value),
|
|
1726
2421
|
type: "info"
|
|
1727
2422
|
});
|
|
1728
|
-
return (e, t) => (
|
|
2423
|
+
return (e, t) => (W(), F(Y(yt), {
|
|
1729
2424
|
type: n.value.type ?? "info",
|
|
1730
2425
|
effect: "light",
|
|
1731
2426
|
size: "small"
|
|
1732
2427
|
}, {
|
|
1733
|
-
default:
|
|
2428
|
+
default: X(() => [z(J(n.value.label), 1)]),
|
|
1734
2429
|
_: 1
|
|
1735
2430
|
}, 8, ["type"]));
|
|
1736
2431
|
}
|
|
1737
|
-
}),
|
|
1738
|
-
CaAvatar:
|
|
1739
|
-
CaAvatarGroup:
|
|
1740
|
-
CaBadge:
|
|
1741
|
-
CaCalendar:
|
|
1742
|
-
CaCarousel:
|
|
1743
|
-
CaCarouselItem:
|
|
1744
|
-
CaCollapse:
|
|
1745
|
-
CaCollapseItem:
|
|
1746
|
-
CaDescriptions:
|
|
1747
|
-
CaDescriptionsItem:
|
|
1748
|
-
CaEmpty:
|
|
1749
|
-
CaImage:
|
|
1750
|
-
CaImageViewer:
|
|
1751
|
-
CaPagination:
|
|
1752
|
-
CaProgress:
|
|
1753
|
-
CaResult:
|
|
1754
|
-
CaSkeleton:
|
|
1755
|
-
CaSkeletonItem:
|
|
1756
|
-
CaTimeline:
|
|
1757
|
-
CaTimelineItem:
|
|
1758
|
-
CaTour:
|
|
1759
|
-
CaTourStep:
|
|
1760
|
-
CaTree:
|
|
1761
|
-
CaTreeV2:
|
|
1762
|
-
CaSegmented:
|
|
1763
|
-
CaStatistic:
|
|
1764
|
-
CaCountdown:
|
|
1765
|
-
CaCheckTag:
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
2432
|
+
}), ho = e(v), go = e(y), _o = e(x), vo = e(T), yo = e(D), bo = e(O), xo = e(re), So = e(ie), Co = e(fe), wo = e(pe), To = e(be), Eo = e(Ee), Do = e(De), Oo = e(Ue), ko = e(Ke), Ao = e(Ze), jo = e(rt), Mo = e(it), No = e(Ct), Po = e(wt), Fo = e(Et), Io = e(Dt), Lo = e(kt), Ro = e(jt), zo = e(et), Bo = e(lt), Vo = e(le), Ho = e(A), Uo = {
|
|
2433
|
+
CaAvatar: ho,
|
|
2434
|
+
CaAvatarGroup: go,
|
|
2435
|
+
CaBadge: _o,
|
|
2436
|
+
CaCalendar: vo,
|
|
2437
|
+
CaCarousel: yo,
|
|
2438
|
+
CaCarouselItem: bo,
|
|
2439
|
+
CaCollapse: xo,
|
|
2440
|
+
CaCollapseItem: So,
|
|
2441
|
+
CaDescriptions: Co,
|
|
2442
|
+
CaDescriptionsItem: wo,
|
|
2443
|
+
CaEmpty: To,
|
|
2444
|
+
CaImage: Eo,
|
|
2445
|
+
CaImageViewer: Do,
|
|
2446
|
+
CaPagination: Oo,
|
|
2447
|
+
CaProgress: ko,
|
|
2448
|
+
CaResult: Ao,
|
|
2449
|
+
CaSkeleton: jo,
|
|
2450
|
+
CaSkeletonItem: Mo,
|
|
2451
|
+
CaTimeline: No,
|
|
2452
|
+
CaTimelineItem: Po,
|
|
2453
|
+
CaTour: Fo,
|
|
2454
|
+
CaTourStep: Io,
|
|
2455
|
+
CaTree: Lo,
|
|
2456
|
+
CaTreeV2: Ro,
|
|
2457
|
+
CaSegmented: zo,
|
|
2458
|
+
CaStatistic: Bo,
|
|
2459
|
+
CaCountdown: Vo,
|
|
2460
|
+
CaCheckTag: Ho,
|
|
2461
|
+
CaDocViewer: Xa,
|
|
2462
|
+
CaDocDialog: ao,
|
|
2463
|
+
CaStatCard: po,
|
|
2464
|
+
CaStatusTag: mo
|
|
2465
|
+
}, Wo = e(ce), Go = e(we), Ko = e(h), qo = e(Fe), Jo = e(xe), Yo = e(Qe), Xo = e(ne), Zo = e(ot), Qo = e(st), $o = e(ct), es = {
|
|
2466
|
+
CaContainer: Wo,
|
|
2467
|
+
CaHeader: Go,
|
|
2468
|
+
CaAside: Ko,
|
|
2469
|
+
CaMain: qo,
|
|
2470
|
+
CaFooter: Jo,
|
|
2471
|
+
CaRow: Yo,
|
|
2472
|
+
CaCol: Xo,
|
|
2473
|
+
CaSpace: Zo,
|
|
2474
|
+
CaSplitter: Qo,
|
|
2475
|
+
CaSplitterPanel: $o
|
|
2476
|
+
}, ts = /* @__PURE__ */ V({
|
|
1780
2477
|
__name: "CaSchemaForm",
|
|
1781
2478
|
props: {
|
|
1782
2479
|
fields: {},
|
|
@@ -1787,14 +2484,14 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1787
2484
|
},
|
|
1788
2485
|
emits: ["update:modelValue", "submit"],
|
|
1789
2486
|
setup(e, { expose: t, emit: n }) {
|
|
1790
|
-
let r = e, i = n, a =
|
|
1791
|
-
function
|
|
2487
|
+
let r = e, i = n, a = s(), o = G();
|
|
2488
|
+
function c(e, t) {
|
|
1792
2489
|
i("update:modelValue", {
|
|
1793
2490
|
...r.modelValue,
|
|
1794
2491
|
[e]: t
|
|
1795
2492
|
});
|
|
1796
2493
|
}
|
|
1797
|
-
let
|
|
2494
|
+
let l = P(() => {
|
|
1798
2495
|
let e = {};
|
|
1799
2496
|
for (let t of r.fields) {
|
|
1800
2497
|
if (!t.required || t.type === "switch") continue;
|
|
@@ -1811,7 +2508,7 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1811
2508
|
}
|
|
1812
2509
|
return e;
|
|
1813
2510
|
});
|
|
1814
|
-
async function
|
|
2511
|
+
async function u() {
|
|
1815
2512
|
try {
|
|
1816
2513
|
await o.value?.validate();
|
|
1817
2514
|
} catch {
|
|
@@ -1819,34 +2516,34 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1819
2516
|
}
|
|
1820
2517
|
i("submit", r.modelValue);
|
|
1821
2518
|
}
|
|
1822
|
-
function
|
|
2519
|
+
function d() {
|
|
1823
2520
|
o.value?.resetFields();
|
|
1824
2521
|
}
|
|
1825
2522
|
return t({
|
|
1826
2523
|
validate: () => o.value?.validate(),
|
|
1827
|
-
reset:
|
|
1828
|
-
}), (t, n) => (
|
|
2524
|
+
reset: d
|
|
2525
|
+
}), (t, n) => (W(), F(Y(Se), {
|
|
1829
2526
|
ref_key: "formRef",
|
|
1830
2527
|
ref: o,
|
|
1831
2528
|
model: e.modelValue,
|
|
1832
|
-
rules:
|
|
2529
|
+
rules: l.value,
|
|
1833
2530
|
"label-width": e.labelWidth,
|
|
1834
|
-
onSubmit:
|
|
2531
|
+
onSubmit: $t(u, ["prevent"])
|
|
1835
2532
|
}, {
|
|
1836
|
-
default:
|
|
2533
|
+
default: X(() => [(W(!0), L(N, null, K(e.fields, (t) => (W(), F(Y(Ce), {
|
|
1837
2534
|
key: t.prop,
|
|
1838
2535
|
label: t.label,
|
|
1839
2536
|
prop: t.prop
|
|
1840
2537
|
}, {
|
|
1841
|
-
default:
|
|
2538
|
+
default: X(() => [t.type === "select" ? (W(), F(Y(tt), {
|
|
1842
2539
|
key: 0,
|
|
1843
2540
|
"model-value": e.modelValue[t.prop],
|
|
1844
2541
|
placeholder: t.placeholder,
|
|
1845
2542
|
clearable: "",
|
|
1846
2543
|
style: { width: "100%" },
|
|
1847
|
-
"onUpdate:modelValue": (e) =>
|
|
2544
|
+
"onUpdate:modelValue": (e) => c(t.prop, e)
|
|
1848
2545
|
}, {
|
|
1849
|
-
default:
|
|
2546
|
+
default: X(() => [(W(!0), L(N, null, K(t.options, (e) => (W(), F(Y(Be), {
|
|
1850
2547
|
key: String(e.value),
|
|
1851
2548
|
label: e.label,
|
|
1852
2549
|
value: e.value
|
|
@@ -1856,41 +2553,41 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1856
2553
|
"model-value",
|
|
1857
2554
|
"placeholder",
|
|
1858
2555
|
"onUpdate:modelValue"
|
|
1859
|
-
])) : t.type === "switch" ? (
|
|
2556
|
+
])) : t.type === "switch" ? (W(), F(Y(pt), {
|
|
1860
2557
|
key: 1,
|
|
1861
2558
|
"model-value": e.modelValue[t.prop],
|
|
1862
|
-
"onUpdate:modelValue": (e) =>
|
|
1863
|
-
}, null, 8, ["model-value", "onUpdate:modelValue"])) : t.type === "date" ? (
|
|
2559
|
+
"onUpdate:modelValue": (e) => c(t.prop, e)
|
|
2560
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])) : t.type === "date" ? (W(), F(Y(ue), {
|
|
1864
2561
|
key: 2,
|
|
1865
2562
|
"model-value": e.modelValue[t.prop],
|
|
1866
2563
|
type: "date",
|
|
1867
2564
|
"value-format": "YYYY-MM-DD",
|
|
1868
2565
|
placeholder: t.placeholder,
|
|
1869
2566
|
style: { width: "100%" },
|
|
1870
|
-
"onUpdate:modelValue": (e) =>
|
|
2567
|
+
"onUpdate:modelValue": (e) => c(t.prop, e)
|
|
1871
2568
|
}, null, 8, [
|
|
1872
2569
|
"model-value",
|
|
1873
2570
|
"placeholder",
|
|
1874
2571
|
"onUpdate:modelValue"
|
|
1875
|
-
])) : t.type === "number" ? (
|
|
2572
|
+
])) : t.type === "number" ? (W(), F(Y(Ae), {
|
|
1876
2573
|
key: 3,
|
|
1877
2574
|
"model-value": e.modelValue[t.prop],
|
|
1878
2575
|
min: t.min,
|
|
1879
2576
|
max: t.max,
|
|
1880
|
-
"onUpdate:modelValue": (e) =>
|
|
2577
|
+
"onUpdate:modelValue": (e) => c(t.prop, e)
|
|
1881
2578
|
}, null, 8, [
|
|
1882
2579
|
"model-value",
|
|
1883
2580
|
"min",
|
|
1884
2581
|
"max",
|
|
1885
2582
|
"onUpdate:modelValue"
|
|
1886
|
-
])) : (
|
|
2583
|
+
])) : (W(), F(Y(ke), {
|
|
1887
2584
|
key: 4,
|
|
1888
2585
|
"model-value": e.modelValue[t.prop],
|
|
1889
2586
|
type: t.type === "textarea" ? "textarea" : "text",
|
|
1890
2587
|
rows: 3,
|
|
1891
2588
|
placeholder: t.placeholder,
|
|
1892
2589
|
clearable: "",
|
|
1893
|
-
"onUpdate:modelValue": (e) =>
|
|
2590
|
+
"onUpdate:modelValue": (e) => c(t.prop, e)
|
|
1894
2591
|
}, null, 8, [
|
|
1895
2592
|
"model-value",
|
|
1896
2593
|
"type",
|
|
@@ -1898,15 +2595,15 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1898
2595
|
"onUpdate:modelValue"
|
|
1899
2596
|
]))]),
|
|
1900
2597
|
_: 2
|
|
1901
|
-
}, 1032, ["label", "prop"]))), 128)), e.hideActions ?
|
|
1902
|
-
default:
|
|
2598
|
+
}, 1032, ["label", "prop"]))), 128)), e.hideActions ? I("v-if", !0) : (W(), F(Y(Ce), { key: 0 }, {
|
|
2599
|
+
default: X(() => [q(t.$slots, "actions", {}, () => [B(Y(w), {
|
|
1903
2600
|
type: "primary",
|
|
1904
2601
|
"native-type": "submit"
|
|
1905
2602
|
}, {
|
|
1906
|
-
default:
|
|
2603
|
+
default: X(() => [z(J(e.submitText ?? Y(a)("campus.form.submit")), 1)]),
|
|
1907
2604
|
_: 1
|
|
1908
|
-
}),
|
|
1909
|
-
default:
|
|
2605
|
+
}), B(Y(w), { onClick: d }, {
|
|
2606
|
+
default: X(() => [z(J(Y(a)("campus.form.reset")), 1)]),
|
|
1910
2607
|
_: 1
|
|
1911
2608
|
})])]),
|
|
1912
2609
|
_: 3
|
|
@@ -1918,77 +2615,79 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
1918
2615
|
"label-width"
|
|
1919
2616
|
]));
|
|
1920
2617
|
}
|
|
1921
|
-
}),
|
|
1922
|
-
CaAutocomplete:
|
|
1923
|
-
CaCascader:
|
|
1924
|
-
CaCascaderPanel:
|
|
1925
|
-
CaCheckbox:
|
|
1926
|
-
CaCheckboxGroup:
|
|
1927
|
-
CaCheckboxButton:
|
|
1928
|
-
CaColorPickerPanel:
|
|
1929
|
-
CaDatePickerPanel:
|
|
1930
|
-
CaInputTag:
|
|
1931
|
-
CaInputOtp:
|
|
1932
|
-
CaMention:
|
|
1933
|
-
CaRate:
|
|
1934
|
-
CaSelectV2:
|
|
1935
|
-
CaSlider:
|
|
1936
|
-
CaTimePicker:
|
|
1937
|
-
CaTimeSelect:
|
|
1938
|
-
CaTransfer:
|
|
1939
|
-
CaTreeSelect:
|
|
1940
|
-
CaUpload:
|
|
1941
|
-
CaOptionGroup:
|
|
1942
|
-
CaRadio:
|
|
1943
|
-
CaColorPicker:
|
|
1944
|
-
CaDatePicker:
|
|
1945
|
-
CaForm:
|
|
1946
|
-
CaFormItem:
|
|
1947
|
-
CaInput:
|
|
1948
|
-
CaInputNumber:
|
|
1949
|
-
CaOption:
|
|
1950
|
-
CaRadioButton:
|
|
1951
|
-
CaRadioGroup:
|
|
1952
|
-
CaSelect:
|
|
1953
|
-
CaSwitch:
|
|
1954
|
-
CaSchemaForm:
|
|
1955
|
-
},
|
|
2618
|
+
}), ns = e(ae), rs = e(ue), is = e(Se), as = e(Ce), os = e(ke), ss = e(Ae), cs = e(Be), ls = e(Je), us = e(Ye), ds = e(tt), fs = e(pt), ps = e(_), ms = e(ee), hs = e(k), gs = e(j), _s = e(te), vs = e(M), ys = e(oe), bs = e(de), xs = e(Me), Ss = e(je), Cs = e(Ie), ws = e(Xe), Ts = e(nt), Es = e(at), Ds = e(xt), Os = e(St), ks = e(Ot), As = e(At), js = e(Mt), Ms = e(Ve), Ns = e(qe), Ps = {
|
|
2619
|
+
CaAutocomplete: ps,
|
|
2620
|
+
CaCascader: ms,
|
|
2621
|
+
CaCascaderPanel: hs,
|
|
2622
|
+
CaCheckbox: gs,
|
|
2623
|
+
CaCheckboxGroup: _s,
|
|
2624
|
+
CaCheckboxButton: vs,
|
|
2625
|
+
CaColorPickerPanel: ys,
|
|
2626
|
+
CaDatePickerPanel: bs,
|
|
2627
|
+
CaInputTag: xs,
|
|
2628
|
+
CaInputOtp: Ss,
|
|
2629
|
+
CaMention: Cs,
|
|
2630
|
+
CaRate: ws,
|
|
2631
|
+
CaSelectV2: Ts,
|
|
2632
|
+
CaSlider: Es,
|
|
2633
|
+
CaTimePicker: Ds,
|
|
2634
|
+
CaTimeSelect: Os,
|
|
2635
|
+
CaTransfer: ks,
|
|
2636
|
+
CaTreeSelect: As,
|
|
2637
|
+
CaUpload: js,
|
|
2638
|
+
CaOptionGroup: Ms,
|
|
2639
|
+
CaRadio: Ns,
|
|
2640
|
+
CaColorPicker: ns,
|
|
2641
|
+
CaDatePicker: rs,
|
|
2642
|
+
CaForm: is,
|
|
2643
|
+
CaFormItem: as,
|
|
2644
|
+
CaInput: os,
|
|
2645
|
+
CaInputNumber: ss,
|
|
2646
|
+
CaOption: cs,
|
|
2647
|
+
CaRadioButton: ls,
|
|
2648
|
+
CaRadioGroup: us,
|
|
2649
|
+
CaSelect: ds,
|
|
2650
|
+
CaSwitch: fs,
|
|
2651
|
+
CaSchemaForm: ts
|
|
2652
|
+
}, Fs = /* @__PURE__ */ V({
|
|
1956
2653
|
__name: "CaMenu",
|
|
1957
|
-
setup(e) {
|
|
1958
|
-
|
|
1959
|
-
|
|
2654
|
+
setup(e, { expose: t }) {
|
|
2655
|
+
let n = G();
|
|
2656
|
+
return t({
|
|
2657
|
+
open: (e) => n.value?.open(e),
|
|
2658
|
+
close: (e) => n.value?.close(e)
|
|
2659
|
+
}), (e, t) => (W(), F(Y(Le), {
|
|
2660
|
+
ref_key: "menu",
|
|
2661
|
+
ref: n,
|
|
2662
|
+
class: "ca-menu"
|
|
2663
|
+
}, {
|
|
2664
|
+
default: X(() => [q(e.$slots, "default")]),
|
|
1960
2665
|
_: 3
|
|
1961
|
-
}));
|
|
2666
|
+
}, 512));
|
|
1962
2667
|
}
|
|
1963
|
-
}),
|
|
1964
|
-
CaAffix:
|
|
1965
|
-
CaAnchor:
|
|
1966
|
-
CaAnchorLink:
|
|
1967
|
-
CaBacktop:
|
|
1968
|
-
CaPageHeader:
|
|
1969
|
-
CaSteps:
|
|
1970
|
-
CaStep:
|
|
1971
|
-
CaTabs:
|
|
1972
|
-
CaTabPane:
|
|
1973
|
-
CaMenuItemGroup:
|
|
1974
|
-
CaBreadcrumb:
|
|
1975
|
-
CaBreadcrumbItem:
|
|
1976
|
-
CaDropdown:
|
|
1977
|
-
CaDropdownItem:
|
|
1978
|
-
CaDropdownMenu:
|
|
1979
|
-
CaMenu:
|
|
1980
|
-
CaMenuItem:
|
|
1981
|
-
CaSubMenu:
|
|
1982
|
-
},
|
|
1983
|
-
CaPopover: as,
|
|
1984
|
-
CaPopconfirm: os,
|
|
1985
|
-
CaTooltip: ss,
|
|
1986
|
-
CaDialog: rs,
|
|
1987
|
-
CaDrawer: is
|
|
1988
|
-
}, ls = { class: "ca-data-table ca-card" }, us = {
|
|
2668
|
+
}), Is = e(S), Ls = e(C), Rs = e(_e), zs = e(ve), Bs = e(ye), Vs = e(Re), Hs = e(ft), Us = e(d), Ws = e(p), Gs = e(m), Ks = e(b), qs = e(He), Js = e(dt), Ys = e(ut), Xs = e(vt), Zs = e(mt), Qs = e(ze), $s = {
|
|
2669
|
+
CaAffix: Us,
|
|
2670
|
+
CaAnchor: Ws,
|
|
2671
|
+
CaAnchorLink: Gs,
|
|
2672
|
+
CaBacktop: Ks,
|
|
2673
|
+
CaPageHeader: qs,
|
|
2674
|
+
CaSteps: Js,
|
|
2675
|
+
CaStep: Ys,
|
|
2676
|
+
CaTabs: Xs,
|
|
2677
|
+
CaTabPane: Zs,
|
|
2678
|
+
CaMenuItemGroup: Qs,
|
|
2679
|
+
CaBreadcrumb: Is,
|
|
2680
|
+
CaBreadcrumbItem: Ls,
|
|
2681
|
+
CaDropdown: Rs,
|
|
2682
|
+
CaDropdownItem: zs,
|
|
2683
|
+
CaDropdownMenu: Bs,
|
|
2684
|
+
CaMenu: Fs,
|
|
2685
|
+
CaMenuItem: Vs,
|
|
2686
|
+
CaSubMenu: Hs
|
|
2687
|
+
}, ec = { class: "ca-data-table ca-card" }, tc = {
|
|
1989
2688
|
key: 1,
|
|
1990
2689
|
class: "ca-data-table__toolbar"
|
|
1991
|
-
},
|
|
2690
|
+
}, nc = { class: "ca-data-table__table-scroll" }, rc = { class: "ca-data-table__footer" }, ic = { class: "ca-data-table__total" }, ac = /*#__PURE__*/ l(/* @__PURE__ */ V({
|
|
1992
2691
|
__name: "CaDataTable",
|
|
1993
2692
|
props: {
|
|
1994
2693
|
columns: {},
|
|
@@ -2005,18 +2704,18 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2005
2704
|
actionsWidth: {}
|
|
2006
2705
|
},
|
|
2007
2706
|
emits: ["selection-change"],
|
|
2008
|
-
setup(e, { expose:
|
|
2009
|
-
let
|
|
2707
|
+
setup(e, { expose: t, emit: n }) {
|
|
2708
|
+
let r = e, i = n, a = s(), o = Yt(), c = Gt({}), l = G(1), u = G(r.pageSize), d = qt([]), p = G(0), m = G(!1), h = G(""), g = G(), _ = G(), v = 0;
|
|
2010
2709
|
async function y() {
|
|
2011
2710
|
let e = ++v;
|
|
2012
2711
|
m.value = !0, h.value = "";
|
|
2013
2712
|
try {
|
|
2014
|
-
let t = await
|
|
2713
|
+
let t = await r.request({
|
|
2015
2714
|
page: l.value,
|
|
2016
2715
|
pageSize: u.value,
|
|
2017
2716
|
query: {
|
|
2018
2717
|
...c,
|
|
2019
|
-
...
|
|
2718
|
+
...r.params
|
|
2020
2719
|
},
|
|
2021
2720
|
..._.value ? { sort: _.value } : {}
|
|
2022
2721
|
});
|
|
@@ -2025,10 +2724,10 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2025
2724
|
let e = Math.max(1, Math.ceil(t.total / u.value));
|
|
2026
2725
|
if (e < l.value) return l.value = e, await y();
|
|
2027
2726
|
}
|
|
2028
|
-
d.value = t.list,
|
|
2727
|
+
d.value = t.list, p.value = t.total;
|
|
2029
2728
|
} catch (t) {
|
|
2030
2729
|
if (e !== v) return;
|
|
2031
|
-
d.value = [],
|
|
2730
|
+
d.value = [], p.value = 0, h.value = t instanceof Error && t.message ? t.message : a("campus.table.loadFailed");
|
|
2032
2731
|
} finally {
|
|
2033
2732
|
e === v && (m.value = !1);
|
|
2034
2733
|
}
|
|
@@ -2046,23 +2745,23 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2046
2745
|
order: e.order
|
|
2047
2746
|
} : void 0, l.value = 1, y();
|
|
2048
2747
|
}
|
|
2049
|
-
return
|
|
2748
|
+
return Wt(y), Zt(() => JSON.stringify(r.params ?? {}), b), Zt(() => r.pageSize, (e) => {
|
|
2050
2749
|
u.value = e, b();
|
|
2051
|
-
}),
|
|
2750
|
+
}), t({
|
|
2052
2751
|
reload: y,
|
|
2053
2752
|
reset: x
|
|
2054
|
-
}), (
|
|
2055
|
-
e.search?.length ? (
|
|
2753
|
+
}), (t, n) => (W(), L("div", ec, [
|
|
2754
|
+
e.search?.length ? (W(), F(Y(Se), {
|
|
2056
2755
|
key: 0,
|
|
2057
2756
|
class: "ca-data-table__search",
|
|
2058
2757
|
inline: "",
|
|
2059
|
-
onSubmit:
|
|
2758
|
+
onSubmit: $t(b, ["prevent"])
|
|
2060
2759
|
}, {
|
|
2061
|
-
default:
|
|
2760
|
+
default: X(() => [(W(!0), L(N, null, K(e.search, (e) => (W(), F(Y(Ce), {
|
|
2062
2761
|
key: e.prop,
|
|
2063
2762
|
label: e.label
|
|
2064
2763
|
}, {
|
|
2065
|
-
default:
|
|
2764
|
+
default: X(() => [e.type === "select" ? (W(), F(Y(tt), {
|
|
2066
2765
|
key: 0,
|
|
2067
2766
|
modelValue: c[e.prop],
|
|
2068
2767
|
"onUpdate:modelValue": (t) => c[e.prop] = t,
|
|
@@ -2070,7 +2769,7 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2070
2769
|
clearable: "",
|
|
2071
2770
|
style: { width: "160px" }
|
|
2072
2771
|
}, {
|
|
2073
|
-
default:
|
|
2772
|
+
default: X(() => [(W(!0), L(N, null, K(e.options, (e) => (W(), F(Y(Be), {
|
|
2074
2773
|
key: String(e.value),
|
|
2075
2774
|
label: e.label,
|
|
2076
2775
|
value: e.value
|
|
@@ -2080,7 +2779,7 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2080
2779
|
"modelValue",
|
|
2081
2780
|
"onUpdate:modelValue",
|
|
2082
2781
|
"placeholder"
|
|
2083
|
-
])) : e.type === "date" ? (
|
|
2782
|
+
])) : e.type === "date" ? (W(), F(Y(ue), {
|
|
2084
2783
|
key: 1,
|
|
2085
2784
|
modelValue: c[e.prop],
|
|
2086
2785
|
"onUpdate:modelValue": (t) => c[e.prop] = t,
|
|
@@ -2092,7 +2791,7 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2092
2791
|
"modelValue",
|
|
2093
2792
|
"onUpdate:modelValue",
|
|
2094
2793
|
"placeholder"
|
|
2095
|
-
])) : (
|
|
2794
|
+
])) : (W(), F(Y(ke), {
|
|
2096
2795
|
key: 2,
|
|
2097
2796
|
modelValue: c[e.prop],
|
|
2098
2797
|
"onUpdate:modelValue": (t) => c[e.prop] = t,
|
|
@@ -2105,23 +2804,23 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2105
2804
|
"placeholder"
|
|
2106
2805
|
]))]),
|
|
2107
2806
|
_: 2
|
|
2108
|
-
}, 1032, ["label"]))), 128)),
|
|
2109
|
-
default:
|
|
2807
|
+
}, 1032, ["label"]))), 128)), B(Y(Ce), null, {
|
|
2808
|
+
default: X(() => [B(Y(w), {
|
|
2110
2809
|
type: "primary",
|
|
2111
2810
|
"native-type": "submit"
|
|
2112
2811
|
}, {
|
|
2113
|
-
default:
|
|
2812
|
+
default: X(() => [z(J(Y(a)("campus.table.search")), 1)]),
|
|
2114
2813
|
_: 1
|
|
2115
|
-
}),
|
|
2116
|
-
default:
|
|
2814
|
+
}), B(Y(w), { onClick: x }, {
|
|
2815
|
+
default: X(() => [z(J(Y(a)("campus.table.reset")), 1)]),
|
|
2117
2816
|
_: 1
|
|
2118
2817
|
})]),
|
|
2119
2818
|
_: 1
|
|
2120
2819
|
})]),
|
|
2121
2820
|
_: 1
|
|
2122
|
-
})) :
|
|
2123
|
-
|
|
2124
|
-
h.value ? (
|
|
2821
|
+
})) : I("v-if", !0),
|
|
2822
|
+
t.$slots.toolbar ? (W(), L("div", tc, [q(t.$slots, "toolbar", { reload: y }, void 0, !0)])) : I("v-if", !0),
|
|
2823
|
+
h.value ? (W(), F(Y(f), {
|
|
2125
2824
|
key: 2,
|
|
2126
2825
|
type: "error",
|
|
2127
2826
|
"show-icon": "",
|
|
@@ -2129,32 +2828,32 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2129
2828
|
title: h.value,
|
|
2130
2829
|
class: "ca-data-table__error"
|
|
2131
2830
|
}, {
|
|
2132
|
-
default:
|
|
2831
|
+
default: X(() => [B(Y(w), {
|
|
2133
2832
|
size: "small",
|
|
2134
2833
|
onClick: y
|
|
2135
2834
|
}, {
|
|
2136
|
-
default:
|
|
2835
|
+
default: X(() => [z(J(Y(a)("campus.table.retry")), 1)]),
|
|
2137
2836
|
_: 1
|
|
2138
2837
|
})]),
|
|
2139
2838
|
_: 1
|
|
2140
|
-
}, 8, ["title"])) :
|
|
2141
|
-
|
|
2839
|
+
}, 8, ["title"])) : I("v-if", !0),
|
|
2840
|
+
R("div", nc, [Qt((W(), F(Y(ht), {
|
|
2142
2841
|
ref_key: "tableRef",
|
|
2143
2842
|
ref: g,
|
|
2144
2843
|
data: d.value,
|
|
2145
2844
|
"row-key": e.rowKey,
|
|
2146
|
-
"empty-text":
|
|
2147
|
-
onSelectionChange:
|
|
2845
|
+
"empty-text": Y(a)("campus.table.empty"),
|
|
2846
|
+
onSelectionChange: n[0] ||= (e) => i("selection-change", e),
|
|
2148
2847
|
onSortChange: S
|
|
2149
2848
|
}, {
|
|
2150
|
-
default:
|
|
2151
|
-
e.selection ? (
|
|
2849
|
+
default: X(() => [
|
|
2850
|
+
e.selection ? (W(), F(Y(gt), {
|
|
2152
2851
|
key: 0,
|
|
2153
2852
|
type: "selection",
|
|
2154
2853
|
width: "48",
|
|
2155
2854
|
"reserve-selection": ""
|
|
2156
|
-
})) :
|
|
2157
|
-
(
|
|
2855
|
+
})) : I("v-if", !0),
|
|
2856
|
+
(W(!0), L(N, null, K(e.columns, (e) => (W(), F(Y(gt), {
|
|
2158
2857
|
key: e.prop,
|
|
2159
2858
|
prop: e.prop,
|
|
2160
2859
|
label: e.label,
|
|
@@ -2163,10 +2862,10 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2163
2862
|
align: e.align,
|
|
2164
2863
|
sortable: e.sortable ? "custom" : !1
|
|
2165
2864
|
}, {
|
|
2166
|
-
default:
|
|
2167
|
-
row:
|
|
2168
|
-
value:
|
|
2169
|
-
}, () => [
|
|
2865
|
+
default: X(({ row: n }) => [q(t.$slots, `cell-${e.prop}`, {
|
|
2866
|
+
row: n,
|
|
2867
|
+
value: n[e.prop]
|
|
2868
|
+
}, () => [z(J(e.formatter ? e.formatter(n) : n[e.prop]), 1)], !0)]),
|
|
2170
2869
|
_: 2
|
|
2171
2870
|
}, 1032, [
|
|
2172
2871
|
"prop",
|
|
@@ -2176,28 +2875,28 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2176
2875
|
"align",
|
|
2177
2876
|
"sortable"
|
|
2178
2877
|
]))), 128)),
|
|
2179
|
-
|
|
2878
|
+
Y(o).actions ? (W(), F(Y(gt), {
|
|
2180
2879
|
key: 1,
|
|
2181
2880
|
label: e.actionsLabel,
|
|
2182
2881
|
width: e.actionsWidth,
|
|
2183
2882
|
fixed: "right"
|
|
2184
2883
|
}, {
|
|
2185
|
-
default:
|
|
2884
|
+
default: X(({ row: e }) => [q(t.$slots, "actions", { row: e }, void 0, !0)]),
|
|
2186
2885
|
_: 3
|
|
2187
|
-
}, 8, ["label", "width"])) :
|
|
2886
|
+
}, 8, ["label", "width"])) : I("v-if", !0)
|
|
2188
2887
|
]),
|
|
2189
2888
|
_: 3
|
|
2190
2889
|
}, 8, [
|
|
2191
2890
|
"data",
|
|
2192
2891
|
"row-key",
|
|
2193
2892
|
"empty-text"
|
|
2194
|
-
])), [[
|
|
2195
|
-
|
|
2893
|
+
])), [[Y(Pt), m.value]])]),
|
|
2894
|
+
R("div", rc, [R("span", ic, J(Y(a)("campus.table.total", { total: p.value })), 1), B(Y(Ue), {
|
|
2196
2895
|
"current-page": l.value,
|
|
2197
|
-
"onUpdate:currentPage":
|
|
2896
|
+
"onUpdate:currentPage": n[1] ||= (e) => l.value = e,
|
|
2198
2897
|
"page-size": u.value,
|
|
2199
|
-
"onUpdate:pageSize":
|
|
2200
|
-
total:
|
|
2898
|
+
"onUpdate:pageSize": n[2] ||= (e) => u.value = e,
|
|
2899
|
+
total: p.value,
|
|
2201
2900
|
"page-sizes": [
|
|
2202
2901
|
10,
|
|
2203
2902
|
20,
|
|
@@ -2214,15 +2913,15 @@ var Pr = { class: "ca-chart__legend" }, Fr = /* @__PURE__ */ L({
|
|
|
2214
2913
|
])])
|
|
2215
2914
|
]));
|
|
2216
2915
|
}
|
|
2217
|
-
}), [["__scopeId", "data-v-7e786198"]]),
|
|
2218
|
-
CaTable:
|
|
2219
|
-
CaTableColumn:
|
|
2220
|
-
CaTableV2:
|
|
2221
|
-
CaAutoResizer:
|
|
2222
|
-
CaDataTable:
|
|
2223
|
-
},
|
|
2224
|
-
function
|
|
2225
|
-
e.directive("ca-loading",
|
|
2226
|
-
for (let [t, n] of Object.entries(
|
|
2916
|
+
}), [["__scopeId", "data-v-7e786198"]]), oc = e(ht), sc = e(gt), cc = e(_t), lc = e(g), uc = {
|
|
2917
|
+
CaTable: oc,
|
|
2918
|
+
CaTableColumn: sc,
|
|
2919
|
+
CaTableV2: cc,
|
|
2920
|
+
CaAutoResizer: lc,
|
|
2921
|
+
CaDataTable: ac
|
|
2922
|
+
}, dc = $n(pr, n, va, ba, Uo, Ps, es, $s, no, uc), fc = {}, pc = $n(fc), mc = {}, hc = {}, gc = {}, _c = {}, vc = {}, yc = $n(mc, hc, gc, _c, vc), bc = $n(dc, yc, pc);
|
|
2923
|
+
function xc(e) {
|
|
2924
|
+
e.directive("ca-loading", Pe), e.directive("ca-infinite-scroll", Oe);
|
|
2925
|
+
for (let [t, n] of Object.entries(bc)) e.component(t, n);
|
|
2227
2926
|
}
|
|
2228
|
-
export {
|
|
2927
|
+
export { Us as CaAffix, ar as CaAlert, Ws as CaAnchor, Gs as CaAnchorLink, Ko as CaAside, lc as CaAutoResizer, ps as CaAutocomplete, ho as CaAvatar, go as CaAvatarGroup, Ks as CaBacktop, _o as CaBadge, Ri as CaBarChart, Is as CaBreadcrumb, Ls as CaBreadcrumbItem, r as CaButton, t as CaButtonGroup, vo as CaCalendar, or as CaCard, yo as CaCarousel, bo as CaCarouselItem, ms as CaCascader, hs as CaCascaderPanel, Ho as CaCheckTag, gs as CaCheckbox, vs as CaCheckboxButton, _s as CaCheckboxGroup, Xo as CaCol, xo as CaCollapse, So as CaCollapseItem, ns as CaColorPicker, ys as CaColorPickerPanel, ya as CaConfigProvider, Wo as CaContainer, Vo as CaCountdown, ac as CaDataTable, rs as CaDatePicker, bs as CaDatePickerPanel, Co as CaDescriptions, wo as CaDescriptionsItem, Za as CaDialog, dr as CaDivider, ao as CaDocDialog, Xa as CaDocViewer, Qa as CaDrawer, Rs as CaDropdown, zs as CaDropdownItem, Bs as CaDropdownMenu, To as CaEmpty, Jo as CaFooter, is as CaForm, as as CaFormItem, _a as CaGauge, Go as CaHeader, nr as CaIcon, Eo as CaImage, Do as CaImageViewer, os as CaInput, ss as CaInputNumber, Ss as CaInputOtp, xs as CaInputTag, yi as CaLineChart, cr as CaLink, qo as CaMain, Cs as CaMention, Fs as CaMenu, Vs as CaMenuItem, Qs as CaMenuItemGroup, cs as CaOption, Ms as CaOptionGroup, ir as CaPageActions, qs as CaPageHeader, Oo as CaPagination, $i as CaPieChart, eo as CaPopconfirm, $a as CaPopover, ko as CaProgress, Ns as CaRadio, ls as CaRadioButton, us as CaRadioGroup, ws as CaRate, Ao as CaResult, Yo as CaRow, ts as CaSchemaForm, ur as CaScrollbar, zo as CaSegmented, ds as CaSelect, Ts as CaSelectV2, jo as CaSkeleton, Mo as CaSkeletonItem, Es as CaSlider, Zo as CaSpace, ua as CaSparkline, Qo as CaSplitter, $o as CaSplitterPanel, po as CaStatCard, Bo as CaStatistic, mo as CaStatusTag, Ys as CaStep, Js as CaSteps, Hs as CaSubMenu, fs as CaSwitch, Zs as CaTabPane, oc as CaTable, sc as CaTableColumn, cc as CaTableV2, Xs as CaTabs, sr as CaTag, lr as CaText, Ds as CaTimePicker, Os as CaTimeSelect, No as CaTimeline, Po as CaTimelineItem, to as CaTooltip, Fo as CaTour, Io as CaTourStep, ks as CaTransfer, Lo as CaTree, As as CaTreeSelect, Ro as CaTreeV2, js as CaUpload, fr as CaWatermark, tr as ICONS, pr as basicComponents, n as buttonComponents, yc as campusRegistry, mc as cardComponents, va as chartComponents, dc as componentRegistry, ba as configComponents, Uo as displayComponents, Ps as formComponents, xc as installUi, es as layoutComponents, $s as navigationComponents, pc as omsRegistry, fc as omsSchoolComponents, no as overlayComponents, hc as parentComponents, o as registerDocLoader, gc as studentComponents, uc as tableComponents, _c as teacherComponents, vc as telComponents, i as translateKey, bc as uiComponents, s as useTranslate };
|