lvc-ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3477 +0,0 @@
1
- import z from "vue";
2
- function L(t, e, i, r, n, s, a, l) {
3
- var d = typeof t == "function" ? t.options : t;
4
- return e && (d.render = e, d.staticRenderFns = i, d._compiled = !0), {
5
- exports: t,
6
- options: d
7
- };
8
- }
9
- const Se = {
10
- name: "LvcButton",
11
- props: {
12
- type: { type: String, default: "default" },
13
- plain: { type: Boolean, default: !1 },
14
- round: { type: Boolean, default: !1 },
15
- circle: { type: Boolean, default: !1 },
16
- disabled: { type: Boolean, default: !1 },
17
- loading: { type: Boolean, default: !1 },
18
- icon: { type: String, default: "" }
19
- },
20
- methods: {
21
- handleClick(t) {
22
- !this.disabled && !this.loading && this.$emit("click", t);
23
- }
24
- }
25
- };
26
- var _e = function() {
27
- var e = this, i = e._self._c;
28
- return i("button", { staticClass: "lvc-button", class: [
29
- "lvc-button--" + e.type,
30
- {
31
- "is-plain": e.plain,
32
- "is-round": e.round,
33
- "is-circle": e.circle,
34
- "is-disabled": e.disabled || e.loading
35
- }
36
- ], attrs: { disabled: e.disabled || e.loading }, on: { click: e.handleClick } }, [e.loading ? i("i", { staticClass: "lvc-icon-loading" }) : e._e(), e.icon && !e.loading ? i("i", { class: e.icon }) : e._e(), e.$slots.default ? i("span", [e._t("default")], 2) : e._e()]);
37
- }, xe = [], Ce = /* @__PURE__ */ L(
38
- Se,
39
- _e,
40
- xe
41
- );
42
- const Pe = Ce.exports, $e = {
43
- name: "LvcDialog",
44
- props: {
45
- visible: { type: Boolean, default: !1 },
46
- title: { type: String, default: "提示" },
47
- content: { type: String, default: "" },
48
- width: { type: String, default: "44.32vmin" },
49
- confirmText: { type: String, default: "确定" },
50
- cancelText: { type: String, default: "取消" },
51
- showCancel: { type: Boolean, default: !0 },
52
- showClose: { type: Boolean, default: !0 },
53
- showFooter: { type: Boolean, default: !0 },
54
- closeOnClickModal: { type: Boolean, default: !0 }
55
- },
56
- methods: {
57
- close() {
58
- this.$emit("update:visible", !1), this.$emit("close");
59
- },
60
- handleCancel() {
61
- this.$emit("cancel"), this.close();
62
- },
63
- handleConfirm() {
64
- this.$emit("confirm");
65
- },
66
- handleMaskClick() {
67
- this.closeOnClickModal && this.close();
68
- }
69
- }
70
- };
71
- var Me = function() {
72
- var e = this, i = e._self._c;
73
- return i("transition", { attrs: { name: "lvc-dialog-fade" } }, [e.visible ? i("div", { staticClass: "lvc-dialog-mask", on: { click: function(r) {
74
- return r.target !== r.currentTarget ? null : e.handleMaskClick.apply(null, arguments);
75
- } } }, [i("transition", { attrs: { name: "lvc-dialog-zoom" } }, [e.visible ? i("div", { staticClass: "lvc-dialog-box", style: { width: e.width } }, [i("div", { staticClass: "lvc-dialog-header" }, [i("span", { staticClass: "lvc-dialog-title" }, [e._v(e._s(e.title))]), e.showClose ? i("span", { staticClass: "lvc-dialog-close", on: { click: e.close } }, [e._v("×")]) : e._e()]), i("div", { staticClass: "lvc-dialog-body" }, [e._t("default", function() {
76
- return [e._v(e._s(e.content))];
77
- })], 2), e.showFooter ? i("div", { staticClass: "lvc-dialog-footer" }, [e.showCancel ? i("button", { staticClass: "lvc-dialog-btn", on: { click: e.handleCancel } }, [e._v(e._s(e.cancelText))]) : e._e(), i("button", { staticClass: "lvc-dialog-btn lvc-dialog-btn-primary", on: { click: e.handleConfirm } }, [e._v(e._s(e.confirmText))])]) : e._e()]) : e._e()])], 1) : e._e()]);
78
- }, Le = [], Te = /* @__PURE__ */ L(
79
- $e,
80
- Me,
81
- Le
82
- );
83
- const we = Te.exports;
84
- let V = [], Re = 0;
85
- const Ye = {
86
- name: "LvcSelect",
87
- props: {
88
- value: { type: [String, Number], default: "" },
89
- options: { type: Array, default: () => [] },
90
- placeholder: { type: String, default: "请选择" },
91
- clearable: { type: Boolean, default: !0 }
92
- },
93
- data() {
94
- return {
95
- isOpen: !1,
96
- dropdownElement: null,
97
- overlayElement: null,
98
- selectId: `lvc-select-${++Re}`
99
- };
100
- },
101
- computed: {
102
- selectedLabel() {
103
- const t = this.options.find((e) => e.value === this.value);
104
- return t ? t.label : "";
105
- }
106
- },
107
- methods: {
108
- toggleDropdown() {
109
- this.isOpen ? this.closeDropdown() : (this.closeOtherSelects(), this.openDropdown());
110
- },
111
- openDropdown() {
112
- this.isOpen = !0, V.push(this), this.$nextTick(() => this.createDropdown());
113
- },
114
- closeDropdown() {
115
- this.isOpen = !1, V = V.filter((t) => t.selectId !== this.selectId), this.removeDropdown();
116
- },
117
- closeOtherSelects() {
118
- V.forEach((t) => {
119
- t.selectId !== this.selectId && t.closeDropdown();
120
- });
121
- },
122
- createDropdown() {
123
- this.removeDropdown(), this.dropdownElement = document.createElement("div"), this.dropdownElement.className = "lvc-select-dropdown";
124
- const t = document.createElement("ul");
125
- t.className = "lvc-select-list", this.options.forEach((e) => {
126
- const i = document.createElement("li");
127
- i.className = `lvc-select-item ${e.value === this.value ? "is-selected" : ""} ${e.disabled ? "is-disabled" : ""}`, i.textContent = e.label, i.addEventListener("click", (r) => {
128
- r.stopPropagation(), this.selectOption(e);
129
- }), t.appendChild(i);
130
- }), this.dropdownElement.appendChild(t), document.body.appendChild(this.dropdownElement), this.overlayElement = document.createElement("div"), this.overlayElement.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;z-index:9998;", document.body.appendChild(this.overlayElement), this.updateDropdownPosition(), this.addEventListeners(), setTimeout(() => {
131
- this.dropdownElement && (this.dropdownElement.style.opacity = "1", this.dropdownElement.style.transform = "translateY(0)");
132
- }, 10);
133
- },
134
- updateDropdownPosition() {
135
- const t = this.$el.querySelector(".lvc-select-wrapper");
136
- if (t && this.dropdownElement) {
137
- const e = t.getBoundingClientRect();
138
- this.dropdownElement.style.width = `${e.width}px`, this.dropdownElement.offsetHeight;
139
- const i = this.dropdownElement.getBoundingClientRect();
140
- let r = e.bottom + 8, n = e.left;
141
- const s = window.innerHeight, a = window.innerWidth;
142
- r + i.height > s && (r = e.top - i.height - 8, r < 0 && (r = e.bottom + 8, this.dropdownElement.style.maxHeight = `${s - r - 10}px`)), n + i.width > a && (n = a - i.width - 10, n < 0 && (n = 10, this.dropdownElement.style.width = `${a - 20}px`)), this.dropdownElement.style.position = "fixed", this.dropdownElement.style.top = `${Math.round(r)}px`, this.dropdownElement.style.left = `${Math.round(n)}px`;
143
- }
144
- },
145
- addEventListeners() {
146
- this.handleScroll = this.updateDropdownPosition.bind(this), this.handleResize = this.updateDropdownPosition.bind(this), window.addEventListener("scroll", this.handleScroll, !0), window.addEventListener("resize", this.handleResize);
147
- },
148
- removeEventListeners() {
149
- this.handleScroll && window.removeEventListener("scroll", this.handleScroll, !0), this.handleResize && window.removeEventListener("resize", this.handleResize);
150
- },
151
- removeDropdown() {
152
- this.removeEventListeners(), this.overlayElement && this.overlayElement.parentNode && (document.body.removeChild(this.overlayElement), this.overlayElement = null), this.dropdownElement && this.dropdownElement.parentNode && (document.body.removeChild(this.dropdownElement), this.dropdownElement = null);
153
- },
154
- selectOption(t) {
155
- t.disabled || (this.$emit("input", t), this.$emit("change", t), this.closeDropdown());
156
- },
157
- handleClear() {
158
- this.$emit("input", ""), this.$emit("change", ""), this.$emit("clear"), this.closeDropdown();
159
- },
160
- clickOutside(t) {
161
- const e = this.$refs.selectContainer;
162
- e && !e.contains(t.target) && (!this.dropdownElement || !this.dropdownElement.contains(t.target)) && this.closeDropdown();
163
- },
164
- bindGlobalClickEvents() {
165
- if (window.top && window.top !== window)
166
- try {
167
- const t = () => this.closeDropdown();
168
- this._topHandler = t, window.top.document.addEventListener("click", t);
169
- } catch {
170
- }
171
- if (window.parent && window.parent !== window)
172
- try {
173
- const t = () => this.closeDropdown();
174
- this._parentHandler = t, window.parent.document.addEventListener("click", t);
175
- } catch {
176
- }
177
- },
178
- unbindGlobalClickEvents() {
179
- if (window.top && window.top !== window && this._topHandler)
180
- try {
181
- window.top.document.removeEventListener("click", this._topHandler);
182
- } catch {
183
- }
184
- if (window.parent && window.parent !== window && this._parentHandler)
185
- try {
186
- window.parent.document.removeEventListener("click", this._parentHandler);
187
- } catch {
188
- }
189
- }
190
- },
191
- mounted() {
192
- document.addEventListener("click", this.clickOutside), this.bindGlobalClickEvents();
193
- },
194
- beforeDestroy() {
195
- document.removeEventListener("click", this.clickOutside), this.unbindGlobalClickEvents(), this.closeDropdown();
196
- }
197
- };
198
- var Oe = function() {
199
- var e = this, i = e._self._c;
200
- return i("div", { ref: "selectContainer", staticClass: "lvc-select" }, [i("div", { staticClass: "lvc-select-wrapper", class: { "is-active": e.isOpen }, on: { click: e.toggleDropdown } }, [i("span", { staticClass: "lvc-select-label", class: { "lvc-select-placeholder": !e.selectedLabel } }, [e._v(" " + e._s(e.selectedLabel || e.placeholder) + " ")]), i("div", { staticClass: "lvc-select-suffix", class: { "is-clearable": e.clearable && e.value !== "" && e.value !== null } }, [e.clearable ? i("span", { staticClass: "lvc-icon-clear", on: { click: function(r) {
201
- return r.stopPropagation(), e.handleClear.apply(null, arguments);
202
- } } }, [e._v("✕")]) : e._e(), i("span", { staticClass: "lvc-icon-arrow", style: { transform: e.isOpen ? "rotate(180deg)" : "none" } }, [e._v("▼")])])])]);
203
- }, Ae = [], De = /* @__PURE__ */ L(
204
- Ye,
205
- Oe,
206
- Ae
207
- );
208
- const Ie = De.exports, Ne = {
209
- name: "LvcSwitch",
210
- props: {
211
- value: { type: Boolean, default: !1 },
212
- disabled: { type: Boolean, default: !1 },
213
- width: { type: Number, default: 34 },
214
- height: { type: Number, default: 18 },
215
- activeColor: { type: String, default: "#42A3D6" },
216
- inactiveColor: { type: String, default: "#395E7C" },
217
- dotColor: { type: String, default: "#ffffff" }
218
- },
219
- computed: {
220
- dotSize() {
221
- return this.height - 4;
222
- },
223
- switchStyle() {
224
- return {
225
- width: this.width + "px",
226
- height: this.height + "px",
227
- borderRadius: this.height / 2 + "px",
228
- background: this.value ? this.activeColor : this.inactiveColor,
229
- position: "relative",
230
- cursor: this.disabled ? "not-allowed" : "pointer",
231
- transition: "0.3s"
232
- };
233
- },
234
- dotStyle() {
235
- const t = this.value ? this.width - this.height + 2 : 2;
236
- return {
237
- width: this.dotSize + "px",
238
- height: this.dotSize + "px",
239
- background: this.dotColor,
240
- borderRadius: "50%",
241
- position: "absolute",
242
- top: "2px",
243
- left: t + "px",
244
- transition: "0.3s"
245
- };
246
- }
247
- },
248
- methods: {
249
- toggle() {
250
- this.disabled || (this.$emit("input", !this.value), this.$emit("change", !this.value));
251
- }
252
- }
253
- };
254
- var He = function() {
255
- var e = this, i = e._self._c;
256
- return i("div", { staticClass: "lvc-switch", class: { "is-disabled": e.disabled }, style: e.switchStyle, on: { click: e.toggle } }, [i("div", { staticClass: "lvc-dot", style: e.dotStyle })]);
257
- }, Be = [], Fe = /* @__PURE__ */ L(
258
- Ne,
259
- He,
260
- Be
261
- );
262
- const ze = Fe.exports, We = {
263
- name: "LvcTable",
264
- props: {
265
- data: { type: Array, default: () => [] },
266
- columns: { type: Array, default: () => [] },
267
- stripe: { type: Boolean, default: !0 },
268
- selection: { type: Boolean, default: !1 }
269
- },
270
- data() {
271
- return {
272
- selectedRows: [],
273
- sortProp: "",
274
- sortOrder: ""
275
- };
276
- },
277
- computed: {
278
- processedData() {
279
- let t = [...this.data];
280
- return this.sortProp && this.sortOrder && t.sort((e, i) => {
281
- const r = e[this.sortProp], n = i[this.sortProp];
282
- if (r === n) return 0;
283
- const s = r > n ? 1 : -1;
284
- return this.sortOrder === "asc" ? s : -s;
285
- }), t;
286
- },
287
- isAllSelected() {
288
- return this.data.length > 0 && this.selectedRows.length === this.data.length;
289
- }
290
- },
291
- methods: {
292
- toggleRowSelection(t) {
293
- const e = this.selectedRows.findIndex((i) => i === t);
294
- e > -1 ? this.selectedRows.splice(e, 1) : this.selectedRows.push(t), this.$emit("selection-change", [...this.selectedRows]);
295
- },
296
- toggleAllSelection() {
297
- this.isAllSelected ? this.selectedRows = [] : this.selectedRows = [...this.data], this.$emit("selection-change", [...this.selectedRows]);
298
- },
299
- handleSort(t) {
300
- t.sortable && (this.sortProp !== t.prop ? (this.sortProp = t.prop, this.sortOrder = "asc") : this.sortOrder === "asc" ? this.sortOrder = "desc" : this.sortOrder === "desc" && (this.sortOrder = "", this.sortProp = ""), this.$emit("sort-change", { prop: this.sortProp, order: this.sortOrder }));
301
- }
302
- }
303
- };
304
- var Ve = function() {
305
- var e = this, i = e._self._c;
306
- return i("div", { staticClass: "lvc-table-container" }, [i("div", { staticClass: "lvc-table-header-wrapper" }, [i("table", { staticClass: "lvc-table" }, [i("colgroup", [e.selection ? i("col", { attrs: { width: "50" } }) : e._e(), e._l(e.columns, function(r) {
307
- return i("col", { key: r.prop, attrs: { width: r.width || "" } });
308
- })], 2), i("thead", [i("tr", [e.selection ? i("th", { staticStyle: { "text-align": "center" } }, [i("div", { staticClass: "lvc-checkbox", class: { checked: e.isAllSelected }, on: { click: e.toggleAllSelection } })]) : e._e(), e._l(e.columns, function(r) {
309
- return i("th", { key: r.prop, class: [
310
- r.align ? "lvc-table-column-" + r.align : "",
311
- { "is-sortable": r.sortable },
312
- e.sortProp === r.prop ? "sorting-" + e.sortOrder : ""
313
- ], on: { click: function(n) {
314
- return e.handleSort(r);
315
- } } }, [e.$scopedSlots["header-" + r.prop.toLowerCase()] ? e._t("header-" + r.prop.toLowerCase(), null, { column: r }) : [e._v(e._s(r.label))], r.sortable ? i("span", { staticClass: "lvc-sort-box" }, [i("i", { staticClass: "lvc-sort-caret lvc-sort-up" }), i("i", { staticClass: "lvc-sort-caret lvc-sort-down" })]) : e._e()], 2);
316
- })], 2)])])]), i("div", { staticClass: "lvc-table-body-wrapper" }, [i("table", { staticClass: "lvc-table", class: { "lvc-table-stripe": e.stripe } }, [i("colgroup", [e.selection ? i("col", { attrs: { width: "50" } }) : e._e(), e._l(e.columns, function(r) {
317
- return i("col", { key: r.prop, attrs: { width: r.width || "" } });
318
- })], 2), i("tbody", e._l(e.processedData, function(r, n) {
319
- return i("tr", { key: n, class: { "is-selected": e.selectedRows.includes(r) } }, [e.selection ? i("td", { staticStyle: { "text-align": "center" } }, [i("div", { staticClass: "lvc-checkbox", class: { checked: e.selectedRows.includes(r) }, on: { click: function(s) {
320
- return e.toggleRowSelection(r);
321
- } } })]) : e._e(), e._l(e.columns, function(s) {
322
- return i("td", { key: s.prop, class: s.align ? "lvc-table-column-" + s.align : "" }, [e.$scopedSlots[s.prop.toLowerCase()] ? e._t(s.prop.toLowerCase(), null, { row: r, index: n }) : [e._v(e._s(r[s.prop]))]], 2);
323
- })], 2);
324
- }), 0)]), !e.data || e.data.length === 0 ? i("div", { staticClass: "lvc-table-empty" }, [e._v("暂无数据")]) : e._e()])]);
325
- }, je = [], Ke = /* @__PURE__ */ L(
326
- We,
327
- Ve,
328
- je
329
- );
330
- const qe = Ke.exports, Ue = {
331
- name: "LvcTimePicker",
332
- props: {
333
- value: { type: String, default: "00:00" },
334
- disabled: { type: Boolean, default: !1 }
335
- },
336
- data() {
337
- return {
338
- isPanelOpen: !1,
339
- tempHour: "00",
340
- tempMinute: "00",
341
- overlayElement: null
342
- };
343
- },
344
- computed: {
345
- hours() {
346
- const t = [];
347
- for (let e = 0; e <= 24; e++) t.push(String(e).padStart(2, "0"));
348
- return t;
349
- },
350
- minutes() {
351
- const t = [];
352
- for (let e = 0; e < 60; e++) t.push(String(e).padStart(2, "0"));
353
- return t;
354
- }
355
- },
356
- watch: {
357
- value: {
358
- immediate: !0,
359
- handler(t) {
360
- const e = t || "00:00", [i, r] = e.split(":");
361
- this.tempHour = i || "00", this.tempMinute = r || "00";
362
- }
363
- }
364
- },
365
- methods: {
366
- togglePanel() {
367
- this.isPanelOpen = !this.isPanelOpen, this.isPanelOpen ? (this.createOverlay(), this.$nextTick(() => {
368
- this.updatePosition(), this.scrollToSelected();
369
- })) : this.removeOverlay();
370
- },
371
- closePanel() {
372
- this.isPanelOpen = !1, this.removeOverlay();
373
- },
374
- createOverlay() {
375
- this.overlayElement || (this.overlayElement = document.createElement("div"), this.overlayElement.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;z-index:999998;", document.body.appendChild(this.overlayElement));
376
- },
377
- removeOverlay() {
378
- this.overlayElement && this.overlayElement.parentNode && (this.overlayElement.parentNode.removeChild(this.overlayElement), this.overlayElement = null);
379
- },
380
- selectHour(t) {
381
- this.tempHour = t, t === "24" && (this.tempMinute = "00");
382
- },
383
- selectMinute(t) {
384
- this.tempHour !== "24" && (this.tempMinute = t);
385
- },
386
- handleConfirm() {
387
- const t = `${this.tempHour}:${this.tempMinute}`;
388
- this.$emit("input", t), this.$emit("change", t), this.closePanel();
389
- },
390
- scrollToSelected() {
391
- const t = this.$refs.panel.querySelectorAll(".hour-column .lvc-time-item"), e = this.$refs.panel.querySelectorAll(".minute-column .lvc-time-item"), i = Array.from(t).find((n) => n.dataset.val === this.tempHour), r = Array.from(e).find((n) => n.dataset.val === this.tempMinute);
392
- i && i.scrollIntoView({ block: "center", behavior: "auto" }), r && r.scrollIntoView({ block: "center", behavior: "auto" });
393
- },
394
- updatePosition() {
395
- if (!this.isPanelOpen || !this.$refs.panel || !this.$refs.inputWrapper) return;
396
- const t = this.$refs.inputWrapper.getBoundingClientRect(), e = this.$refs.panel, i = e.offsetHeight || window.innerHeight * 0.25, r = 8, n = window.innerHeight - t.bottom, s = t.top;
397
- n < i && s > n ? e.style.top = `${t.top - i - r}px` : e.style.top = `${t.bottom + r}px`, e.style.left = `${t.left}px`;
398
- },
399
- handleOutsideClick(t) {
400
- const e = this.$refs.inputWrapper && this.$refs.inputWrapper.contains(t.target), i = this.$refs.panel && this.$refs.panel.contains(t.target);
401
- !e && !i && this.closePanel();
402
- },
403
- handleScroll() {
404
- this.isPanelOpen && this.updatePosition();
405
- }
406
- },
407
- mounted() {
408
- this.$refs.panel && document.body.appendChild(this.$refs.panel), document.addEventListener("click", this.handleOutsideClick), window.addEventListener("scroll", this.handleScroll, !0), window.addEventListener("resize", this.updatePosition);
409
- },
410
- beforeDestroy() {
411
- this.$refs.panel && this.$refs.panel.parentNode && this.$refs.panel.parentNode.removeChild(this.$refs.panel), document.removeEventListener("click", this.handleOutsideClick), window.removeEventListener("scroll", this.handleScroll, !0), window.removeEventListener("resize", this.updatePosition);
412
- }
413
- };
414
- var Ge = function() {
415
- var e = this, i = e._self._c;
416
- return i("div", { staticClass: "lvc-time-picker" }, [i("div", { ref: "inputWrapper", staticClass: "lvc-time-input-wrapper", class: { "is-active": e.isPanelOpen && !e.disabled }, on: { click: function(r) {
417
- return r.stopPropagation(), e.togglePanel.apply(null, arguments);
418
- } } }, [i("span", { staticClass: "lvc-time-value" }, [e._v(e._s(e.value))]), i("span", { staticClass: "lvc-time-icon" }, [e._v("▼")])]), i("div", { directives: [{ name: "show", rawName: "v-show", value: e.isPanelOpen && !e.disabled, expression: "isPanelOpen && !disabled" }], ref: "panel", staticClass: "lvc-time-panel", on: { click: function(r) {
419
- r.stopPropagation();
420
- } } }, [i("div", { staticClass: "lvc-time-spinner" }, [i("div", { staticClass: "lvc-time-column hour-column" }, e._l(e.hours, function(r) {
421
- return i("div", { key: "h" + r, staticClass: "lvc-time-item", class: { "is-selected": e.tempHour === r }, attrs: { "data-val": r }, on: { click: function(n) {
422
- return e.selectHour(r);
423
- } } }, [e._v(e._s(r))]);
424
- }), 0), i("div", { staticClass: "lvc-time-column minute-column" }, e._l(e.minutes, function(r) {
425
- return i("div", { key: "m" + r, staticClass: "lvc-time-item", class: {
426
- "is-selected": e.tempMinute === r,
427
- "is-disabled": e.tempHour === "24" && r !== "00"
428
- }, attrs: { "data-val": r }, on: { click: function(n) {
429
- return e.selectMinute(r);
430
- } } }, [e._v(e._s(r))]);
431
- }), 0)]), i("div", { staticClass: "lvc-time-footer" }, [i("button", { staticClass: "lvc-btn lvc-btn-cancel", on: { click: e.closePanel } }, [e._v("取消")]), i("button", { staticClass: "lvc-btn lvc-btn-confirm", on: { click: e.handleConfirm } }, [e._v("确定")])])])]);
432
- }, Xe = [], Qe = /* @__PURE__ */ L(
433
- Ue,
434
- Ge,
435
- Xe
436
- );
437
- const Je = Qe.exports, Ze = {
438
- name: "LvcLoadMore",
439
- props: {
440
- loading: { type: Boolean, default: !1 },
441
- finished: { type: Boolean, default: !1 },
442
- distance: { type: String, default: "0px" },
443
- container: { type: String, default: "" },
444
- loadingText: { type: String, default: "正在加载更多..." },
445
- finishedText: { type: String, default: "没有更多数据了" }
446
- },
447
- data() {
448
- return { observer: null };
449
- },
450
- mounted() {
451
- this.initObserver();
452
- },
453
- beforeDestroy() {
454
- this.observer && (this.observer.disconnect(), this.observer = null);
455
- },
456
- methods: {
457
- initObserver() {
458
- const e = {
459
- root: this.container ? document.querySelector(this.container) : null,
460
- rootMargin: `0px 0px ${this.distance} 0px`,
461
- threshold: 0
462
- };
463
- this.observer = new IntersectionObserver((i) => {
464
- i[0].isIntersecting && this.handleIntersect();
465
- }, e), this.observer.observe(this.$el);
466
- },
467
- handleIntersect() {
468
- this.loading || this.finished || this.$emit("load");
469
- }
470
- },
471
- watch: {
472
- loading(t) {
473
- !t && !this.finished && this.$nextTick(() => {
474
- this.observer && this.$el && (this.observer.unobserve(this.$el), this.observer.observe(this.$el));
475
- });
476
- }
477
- }
478
- };
479
- var et = function() {
480
- var e = this, i = e._self._c;
481
- return i("div", { staticClass: "lvc-load-more" }, [e.loading ? [i("div", { staticClass: "lvc-load-more-spinner" }), i("span", { staticClass: "lvc-load-more-text" }, [e._v(e._s(e.loadingText))])] : e.finished ? [i("span", { staticClass: "lvc-load-more-text lvc-load-more-disabled" }, [e._v(e._s(e.finishedText))])] : void 0], 2);
482
- }, tt = [], it = /* @__PURE__ */ L(
483
- Ze,
484
- et,
485
- tt
486
- );
487
- const nt = it.exports;
488
- let j = [], st = 0;
489
- const rt = {
490
- name: "LvcDatePicker",
491
- props: {
492
- value: { type: [String, Array], default: "" },
493
- type: { type: String, default: "date" },
494
- // date, datetime, daterange, datetimerange, datetimestartorend
495
- rangeSeparator: { type: String, default: "至" },
496
- singlePanel: { type: Boolean, default: !1 }
497
- },
498
- data() {
499
- const t = /* @__PURE__ */ new Date();
500
- return {
501
- isPanelOpen: !1,
502
- activeTimePop: null,
503
- timeState: {
504
- start: { h: "00", m: "00" },
505
- end: { h: "00", m: "00" }
506
- },
507
- selectingRangePart: "start",
508
- calendars: [
509
- { year: t.getFullYear(), month: t.getMonth() },
510
- {
511
- year: t.getFullYear(),
512
- month: t.getMonth() + 1 > 11 ? 0 : t.getMonth() + 1
513
- }
514
- ],
515
- panelElement: null,
516
- overlayElement: null,
517
- datePickerId: `lvc-date-picker-${++st}`,
518
- hoverDate: null
519
- };
520
- },
521
- computed: {
522
- isRangeMode() {
523
- return this.type.includes("range");
524
- },
525
- showDoubleInput() {
526
- return this.type.includes("range") || this.type === "datetimestartorend";
527
- },
528
- supportTime() {
529
- return this.type.includes("time");
530
- },
531
- displayValues() {
532
- return Array.isArray(this.value) ? [this.value[0] || "", this.value[1] || ""] : ["", ""];
533
- },
534
- visibleCalendars() {
535
- return this.singlePanel && (this.type === "daterange" || this.type === "datetimerange") ? [this.calendars[0]] : this.isRangeMode ? this.calendars : [this.calendars[0]];
536
- }
537
- },
538
- methods: {
539
- formatPad(t) {
540
- return String(t).padStart(2, "0");
541
- },
542
- handleTogglePanel() {
543
- this.isPanelOpen ? this.closePanel() : (this.closeOtherDatePickers(), this.openPanel());
544
- },
545
- openPanel() {
546
- this.isPanelOpen = !0, j.push(this), this.syncInternalStateFromValue(), this.$nextTick(() => this.createPanel());
547
- },
548
- closePanel() {
549
- this.isPanelOpen = !1, this.selectingRangePart = "start", j = j.filter((t) => t.datePickerId !== this.datePickerId), this.removePanel();
550
- },
551
- closeOtherDatePickers() {
552
- j.forEach((t) => {
553
- t.datePickerId !== this.datePickerId && t.closePanel();
554
- });
555
- },
556
- createPanel() {
557
- if (this.panelElement && document.body.contains(this.panelElement)) {
558
- this.updatePanelContent(), this.updatePanelPosition();
559
- return;
560
- }
561
- this.removePanel(), this.panelElement = document.createElement("div"), this.panelElement.className = "lvc-picker-panel", this.panelElement.style.position = "fixed", this.panelElement.style.zIndex = "9999", this.panelElement.style.opacity = "0", this.panelElement.style.transform = "translateY(1.662vmin) scale(0.98)", this.panelElement.style.transition = "opacity 0.25s cubic-bezier(0.23, 1, 0.32, 1), transform 0.25s cubic-bezier(0.23, 1, 0.32, 1)", this.panelElement.style.background = "#0b1a2a", this.panelElement.style.border = "1px solid #12bbed", this.panelElement.style.boxShadow = "0 1.385vmin 4.1551vmin rgba(0, 0, 0, 0.7)", this.panelElement.style.borderRadius = "1.108vmin", this.panelElement.style.padding = "2.0776vmin", this.panelElement.addEventListener("click", (t) => {
562
- t.stopPropagation(), this.activeTimePop = null;
563
- }), this.panelElement.innerHTML = this.generatePanelContent(), document.body.appendChild(this.panelElement), this.overlayElement = document.createElement("div"), this.overlayElement.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;z-index:9998;", this.overlayElement.addEventListener("click", () => {
564
- }), document.body.appendChild(this.overlayElement), this.updatePanelPosition(), this.addEventListeners(), setTimeout(() => {
565
- this.panelElement.style.opacity = "1", this.panelElement.style.transform = "translateY(0) scale(1)";
566
- }, 10), this.bindPanelEvents();
567
- },
568
- updatePanelContent() {
569
- this.panelElement && (this.panelElement.innerHTML = this.generatePanelContent(), this.bindPanelEvents());
570
- },
571
- generatePanelContent() {
572
- const t = this.showDoubleInput ? ["start", "end"] : ["start"], e = this.visibleCalendars;
573
- let i = "";
574
- this.supportTime && (i = `
575
- <div class="lvc-time-bar">
576
- ${t.map(
577
- (s) => `
578
- <div class="lvc-time-slot" data-mode="${s}">
579
- <div class="lvc-time-btn ${this.activeTimePop === s ? "is-active" : ""}">
580
- <span class="lvc-label">${s === "start" ? this.showDoubleInput ? "起始" : "时间" : "结束"}</span>
581
- <span class="lvc-time-val">${this.timeState[s].h}:${this.timeState[s].m}</span>
582
- </div>
583
- ${this.activeTimePop === s ? this.generateTimeDropdownHTML(s) : ""}
584
- </div>`
585
- ).join("")}
586
- </div>`);
587
- let r = `
588
- <div class="lvc-calendars-wrap">
589
- ${e.map(
590
- (s, a) => `
591
- <div class="lvc-calendar-box" data-idx="${a}">
592
- <div class="lvc-cal-head">
593
- <span class="lvc-nav-btn" data-direction="-1">❮</span>
594
- <strong>${s.year}年 ${s.month + 1}月</strong>
595
- <span class="lvc-nav-btn" data-direction="1">❯</span>
596
- </div>
597
- <div class="lvc-cal-week">
598
- ${["日", "一", "二", "三", "四", "五", "六"].map((l) => `<div>${l}</div>`).join("")}
599
- </div>
600
- <div class="lvc-cal-days">
601
- ${Array.from({ length: this.getMonthOffset(s) }, () => '<div class="lvc-day is-empty"></div>').join("")}
602
- ${Array.from({ length: this.getDaysCount(s) }, (l, d) => {
603
- const c = d + 1, h = `${s.year}-${this.formatPad(s.month + 1)}-${this.formatPad(c)}`, p = this.getDayStateClass(s, c);
604
- return `<div class="lvc-day ${Object.entries(p).filter(([E, P]) => P).map(([E]) => E).join(" ")}" data-date="${h}">${c}</div>`;
605
- }).join("")}
606
- </div>
607
- </div>`
608
- ).join("")}
609
- </div>`;
610
- return i + r + `
611
- <div class="lvc-panel-footer">
612
- <span class="lvc-action-link" data-action="clear">清空</span>
613
- <div class="lvc-right-actions">
614
- <span class="lvc-action-btn is-outline" data-action="setToNow">此刻</span>
615
- <span class="lvc-action-btn is-primary" data-action="confirm">确定</span>
616
- </div>
617
- </div>`;
618
- },
619
- generateTimeDropdownHTML(t) {
620
- return `
621
- <div class="lvc-time-dropdown">
622
- <div class="lvc-scroll-col" data-part="h">
623
- <ul>
624
- ${Array.from({ length: 24 }, (e, i) => {
625
- const r = this.formatPad(i);
626
- return `<li class="${r === this.timeState[t].h ? "is-selected" : ""}" data-value="${r}">${r}</li>`;
627
- }).join("")}
628
- </ul>
629
- </div>
630
- <div class="lvc-time-divider">:</div>
631
- <div class="lvc-scroll-col" data-part="m">
632
- <ul>
633
- ${Array.from({ length: 60 }, (e, i) => {
634
- const r = this.formatPad(i);
635
- return `<li class="${r === this.timeState[t].m ? "is-selected" : ""}" data-value="${r}">${r}</li>`;
636
- }).join("")}
637
- </ul>
638
- </div>
639
- </div>`;
640
- },
641
- bindPanelEvents() {
642
- if (!this.panelElement) return;
643
- this.panelElement.querySelectorAll(".lvc-time-slot").forEach((s) => {
644
- const a = s.dataset.mode, l = s.querySelector(".lvc-time-btn");
645
- l && l.addEventListener("click", (d) => {
646
- d.stopPropagation(), this.handleToggleTimePop(a);
647
- });
648
- }), this.panelElement.querySelectorAll(".lvc-nav-btn").forEach((s) => {
649
- const a = parseInt(s.dataset.direction), l = s.closest(".lvc-calendar-box");
650
- if (l) {
651
- const d = parseInt(l.dataset.idx);
652
- s.addEventListener("click", (c) => {
653
- c.stopPropagation(), this.handleMonthNav(d, a);
654
- });
655
- }
656
- }), this.panelElement.querySelectorAll(".lvc-day:not(.is-empty)").forEach((s) => {
657
- const a = s.dataset.date;
658
- if (a) {
659
- const [l, d, c] = a.split("-").map(Number), h = { year: l, month: d - 1 };
660
- s.addEventListener("click", (p) => {
661
- p.stopPropagation(), this.handleDateSelection(h, c);
662
- }), this.isRangeMode && (s.addEventListener("mouseenter", () => {
663
- this.selectingRangePart === "end" && this.value[0] && (this.hoverDate = a, this.updateHoverRangeStyle());
664
- }), s.addEventListener("mouseleave", () => {
665
- this.hoverDate && (this.hoverDate = null, this.clearHoverRangeStyle());
666
- }));
667
- }
668
- }), this.panelElement.querySelectorAll(".lvc-action-link, .lvc-action-btn").forEach((s) => {
669
- const a = s.dataset.action;
670
- s.addEventListener("click", (l) => {
671
- l.stopPropagation(), a === "clear" ? this.handleClear() : a === "setToNow" ? this.handleSetToNow() : a === "confirm" && this.handleConfirm();
672
- });
673
- }), this.panelElement.querySelectorAll(".lvc-time-dropdown").forEach((s) => {
674
- s.addEventListener("click", (l) => l.stopPropagation()), s.querySelectorAll(".lvc-scroll-col").forEach((l) => {
675
- const d = l.dataset.part, c = l.closest(".lvc-time-slot");
676
- if (c) {
677
- const h = c.dataset.mode;
678
- l.querySelectorAll("li").forEach((v) => {
679
- v.addEventListener("click", (E) => {
680
- E.stopPropagation(), this.handleSelectTime(h, d, v.dataset.value);
681
- });
682
- });
683
- }
684
- });
685
- });
686
- },
687
- updatePanelPosition() {
688
- const t = this.$el.querySelector(".lvc-input-wrapper");
689
- if (t && this.panelElement) {
690
- const e = t.getBoundingClientRect();
691
- let i = e.bottom + 0.1385, r = e.left;
692
- const n = window.innerHeight, s = window.innerWidth, a = this.panelElement.getBoundingClientRect();
693
- i + a.height > n && (i = e.top - a.height - 0.1385, i < 0 && (i = e.bottom + 0.1385, this.panelElement.style.maxHeight = `${n - i - 0.1731}px`)), r + a.width > s && (r = s - a.width - 0.1731, r < 0 && (r = 0.1731, this.panelElement.style.width = `${s - 0.3463}px`)), this.panelElement.style.top = `${i}px`, this.panelElement.style.left = `${r}px`;
694
- }
695
- },
696
- addEventListeners() {
697
- this.handleScroll = this.updatePanelPosition.bind(this), this.handleResize = this.updatePanelPosition.bind(this), window.addEventListener("scroll", this.handleScroll, !0), window.addEventListener("resize", this.handleResize);
698
- },
699
- removeEventListeners() {
700
- this.handleScroll && window.removeEventListener("scroll", this.handleScroll, !0), this.handleResize && window.removeEventListener("resize", this.handleResize);
701
- },
702
- removePanel() {
703
- this.removeEventListeners(), this.overlayElement && this.overlayElement.parentNode && (document.body.removeChild(this.overlayElement), this.overlayElement = null), this.panelElement && this.panelElement.parentNode && (document.body.removeChild(this.panelElement), this.panelElement = null);
704
- },
705
- handleToggleTimePop(t) {
706
- this.activeTimePop === t ? this.activeTimePop = null : this.activeTimePop = t, this.isPanelOpen && this.$nextTick(() => this.updatePanelContent());
707
- },
708
- autoScrollTime() {
709
- },
710
- handleSelectTime(t, e, i) {
711
- this.timeState[t][e] = i, this.emitInternalChange(), this.isPanelOpen && this.$nextTick(() => this.updatePanelContent());
712
- },
713
- handleMonthNav(t, e) {
714
- const i = this.calendars[t], r = new Date(i.year, i.month + e, 1);
715
- if (i.year = r.getFullYear(), i.month = r.getMonth(), this.isRangeMode) {
716
- const n = t === 0 ? 1 : 0, s = t === 0 ? 1 : -1, a = new Date(i.year, i.month + s, 1);
717
- this.calendars[n].year = a.getFullYear(), this.calendars[n].month = a.getMonth();
718
- }
719
- this.isPanelOpen && this.$nextTick(() => this.updatePanelContent());
720
- },
721
- getMonthOffset(t) {
722
- return new Date(t.year, t.month, 1).getDay();
723
- },
724
- getDaysCount(t) {
725
- return new Date(t.year, t.month + 1, 0).getDate();
726
- },
727
- handleDateSelection(t, e) {
728
- const i = `${t.year}-${this.formatPad(t.month + 1)}-${this.formatPad(e)}`;
729
- if (this.hoverDate = null, this.type === "datetimestartorend") {
730
- const r = this.supportTime ? `${i} ${this.timeState.start.h}:${this.timeState.start.m}` : i, n = this.supportTime ? `${i} ${this.timeState.end.h}:${this.timeState.end.m}` : i;
731
- this.$emit("input", [r, n]), this.isPanelOpen && this.$nextTick(() => this.updatePanelContent());
732
- } else if (this.isRangeMode) {
733
- let r = Array.isArray(this.value) ? [...this.value] : ["", ""];
734
- const n = !!r[0], s = !!r[1];
735
- if (n && s)
736
- r[0] = this.supportTime ? `${i} ${this.timeState.start.h}:${this.timeState.start.m}` : i, r[1] = "", this.selectingRangePart = "end";
737
- else if (this.selectingRangePart === "start")
738
- r[0] = this.supportTime ? `${i} ${this.timeState.start.h}:${this.timeState.start.m}` : i, r[1] && r[0] > r[1] && (r[1] = ""), this.selectingRangePart = "end";
739
- else {
740
- if (r[1] = this.supportTime ? `${i} ${this.timeState.end.h}:${this.timeState.end.m}` : i, r[1] < r[0]) {
741
- const a = r[0];
742
- r[0] = r[1], r[1] = a;
743
- }
744
- this.selectingRangePart = "start";
745
- }
746
- this.$emit("input", r), this.isPanelOpen && this.$nextTick(() => this.updatePanelContent());
747
- } else {
748
- const r = this.supportTime ? `${i} ${this.timeState.start.h}:${this.timeState.start.m}` : i;
749
- this.$emit("input", r), this.isPanelOpen && this.$nextTick(() => this.updatePanelContent());
750
- }
751
- },
752
- getDayStateClass(t, e) {
753
- const i = `${t.year}-${this.formatPad(t.month + 1)}-${this.formatPad(e)}`, r = /* @__PURE__ */ new Date(), n = `${r.getFullYear()}-${this.formatPad(r.getMonth() + 1)}-${this.formatPad(r.getDate())}`;
754
- let s = { "is-today": i === n };
755
- if (!this.value) return s;
756
- if (this.type === "datetimestartorend") {
757
- const a = Array.isArray(this.value) && this.value[0] ? this.value[0].slice(0, 10) : "";
758
- return { ...s, "is-active": a === i };
759
- }
760
- if (this.isRangeMode) {
761
- const a = (this.value[0] || "").slice(0, 10), l = (this.value[1] || "").slice(0, 10), d = {
762
- ...s,
763
- "is-active": a && i === a || l && i === l,
764
- "is-in-range": a && l && i > a && i < l
765
- };
766
- if (this.selectingRangePart === "end" && a && this.hoverDate) {
767
- const c = this.hoverDate, h = a < c ? a : c, p = a < c ? c : a;
768
- i > h && i < p && (d["is-in-hover-range"] = !0);
769
- }
770
- return d;
771
- }
772
- return { ...s, "is-active": typeof this.value == "string" && this.value.slice(0, 10) === i };
773
- },
774
- updateHoverRangeStyle() {
775
- if (!this.panelElement || !this.hoverDate || !this.value[0]) return;
776
- const t = (this.value[0] || "").slice(0, 10), e = this.hoverDate, i = t < e ? t : e, r = t < e ? e : t;
777
- this.panelElement.querySelectorAll(".lvc-day:not(.is-empty)").forEach((s) => {
778
- const a = s.dataset.date;
779
- a && a > i && a < r ? s.classList.add("is-in-hover-range") : s.classList.remove("is-in-hover-range");
780
- });
781
- },
782
- clearHoverRangeStyle() {
783
- if (!this.panelElement) return;
784
- this.panelElement.querySelectorAll(".lvc-day.is-in-hover-range").forEach((e) => e.classList.remove("is-in-hover-range"));
785
- },
786
- syncInternalStateFromValue() {
787
- if (this.showDoubleInput) {
788
- const t = Array.isArray(this.value) ? this.value : ["", ""];
789
- this.timeState.start = this.splitTime(t[0]), this.timeState.end = this.splitTime(t[1]);
790
- } else
791
- this.timeState.start = this.splitTime(this.value);
792
- },
793
- splitTime(t) {
794
- if (t && t.includes(" ")) {
795
- const e = t.split(" ")[1].split(":");
796
- return { h: e[0] || "00", m: e[1] || "00" };
797
- }
798
- return { h: "00", m: "00" };
799
- },
800
- emitInternalChange() {
801
- if (this.value)
802
- if (this.showDoubleInput) {
803
- let t = Array.isArray(this.value) ? [...this.value] : ["", ""];
804
- t[0] && (t[0] = t[0].slice(0, 10) + ` ${this.timeState.start.h}:${this.timeState.start.m}`), t[1] && (t[1] = t[1].slice(0, 10) + ` ${this.timeState.end.h}:${this.timeState.end.m}`), this.$emit("input", t);
805
- } else {
806
- let t = this.value.slice(0, 10) + ` ${this.timeState.start.h}:${this.timeState.start.m}`;
807
- this.$emit("input", t);
808
- }
809
- },
810
- handleClear() {
811
- this.$emit("input", this.showDoubleInput ? ["", ""] : ""), this.activeTimePop = null, this.selectingRangePart = "start", this.isPanelOpen && this.$nextTick(() => this.updatePanelContent());
812
- },
813
- handleSetToNow() {
814
- const t = /* @__PURE__ */ new Date(), e = `${t.getFullYear()}-${this.formatPad(t.getMonth() + 1)}-${this.formatPad(t.getDate())}`, i = this.formatPad(t.getHours()), r = this.formatPad(t.getMinutes()), n = this.supportTime ? `${e} ${i}:${r}` : e;
815
- if (this.type === "datetimestartorend")
816
- this.timeState.start = { h: i, m: r }, this.timeState.end = { h: i, m: r }, this.$emit("input", [n, n]);
817
- else if (this.isRangeMode) {
818
- let s = Array.isArray(this.value) ? [...this.value] : ["", ""];
819
- const a = this.selectingRangePart;
820
- if (this.timeState[a] = { h: i, m: r }, a === "start")
821
- !s[0] && !s[1] ? (s[0] = n, this.timeState.start = { h: i, m: r }) : n < s[1] ? (s[0] = n, this.timeState.start = { h: i, m: r }) : n > s[1] ? (s[1] = n, this.timeState.end = { h: i, m: r }) : s[1] && s[0] > s[1] && (s[1] = "");
822
- else if (n > s[0])
823
- s[1] = n, this.timeState.end = { h: i, m: r };
824
- else if (n < s[0]) {
825
- const l = s[0];
826
- s[1] = l, s[0] = n, this.timeState.start = { h: i, m: r }, this.timeState.end = { h: "00", m: "00" };
827
- } else s[0] && s[1] < s[0] && (s[0] = n, this.timeState.start = { h: i, m: r });
828
- this.$emit("input", s);
829
- } else
830
- this.timeState.start = { h: i, m: r }, this.$emit("input", n);
831
- this.activeTimePop = null, this.isPanelOpen && this.$nextTick(() => this.updatePanelContent());
832
- },
833
- handleConfirm() {
834
- this.closePanel(), this.$emit("confirm", this.value);
835
- },
836
- clickOutside(t) {
837
- const e = this.$refs.pickerContainer;
838
- e && !e.contains(t.target) && (!this.panelElement || !this.panelElement.contains(t.target)) && (this.closePanel(), this.activeTimePop = null);
839
- }
840
- },
841
- mounted() {
842
- document.addEventListener("click", this.clickOutside);
843
- },
844
- beforeDestroy() {
845
- document.removeEventListener("click", this.clickOutside), this.closePanel();
846
- }
847
- };
848
- var at = function() {
849
- var e = this, i = e._self._c;
850
- return i("div", { ref: "pickerContainer", staticClass: "lvc-date-picker" }, [i("div", { staticClass: "lvc-input-wrapper", class: { "is-active": e.isPanelOpen }, on: { click: e.handleTogglePanel } }, [e.showDoubleInput ? [i("input", { staticClass: "lvc-inner-input", attrs: { readonly: "", placeholder: "开始时间" }, domProps: { value: e.displayValues[0] } }), i("span", { staticClass: "lvc-separator" }, [e._v(e._s(e.rangeSeparator))]), i("input", { staticClass: "lvc-inner-input", attrs: { readonly: "", placeholder: "结束时间" }, domProps: { value: e.displayValues[1] } })] : [i("input", { staticClass: "lvc-inner-input", attrs: { readonly: "", placeholder: "请选择日期时间" }, domProps: { value: e.value } })], i("span", { staticClass: "lvc-icon-arrow", style: { transform: e.isPanelOpen ? "rotate(180deg)" : "none" } }, [e._v("▼")])], 2)]);
851
- }, lt = [], ot = /* @__PURE__ */ L(
852
- rt,
853
- at,
854
- lt
855
- );
856
- const ct = ot.exports;
857
- (function() {
858
- var t, e, i, r, n, s, a, l, d, c, h, p, v, E, P, $, he, T, U, de, D, G, X, Q, I, J, Z, pe, ee, te, ue, me, fe = [].slice;
859
- he = '<span class="odometer-value"></span>', E = '<span class="odometer-ribbon"><span class="odometer-ribbon-inner">' + he + "</span></span>", r = '<span class="odometer-digit"><span class="odometer-digit-spacer">8</span><span class="odometer-digit-inner">' + E + "</span></span>", a = '<span class="odometer-formatting-mark"></span>', i = "(,ddd).dd", l = /^\(?([^)]*)\)?(?:(.)(d+))?$/, d = 30, s = 2e3, t = 20, c = 2, n = 0.5, h = 1e3 / d, e = 1e3 / t, P = "transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", I = document.createElement("div").style, $ = I.transition != null || I.webkitTransition != null || I.mozTransition != null || I.oTransition != null, X = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame, p = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver, U = function(m) {
860
- var o;
861
- return o = document.createElement("div"), o.innerHTML = m, o.children[0];
862
- }, G = function(m, o) {
863
- return m.className = m.className.replace(new RegExp("(^| )" + o.split(" ").join("|") + "( |$)", "gi"), " ");
864
- }, T = function(m, o) {
865
- return G(m, o), m.className += " " + o;
866
- }, J = function(m, o) {
867
- var u;
868
- if (document.createEvent != null)
869
- return u = document.createEvent("HTMLEvents"), u.initEvent(o, !0, !0), m.dispatchEvent(u);
870
- }, D = function() {
871
- var m, o;
872
- return (m = (o = window.performance) != null && typeof o.now == "function" ? o.now() : void 0) != null ? m : +/* @__PURE__ */ new Date();
873
- }, Q = function(m, o) {
874
- return o == null && (o = 0), o ? (m *= Math.pow(10, o), m += 0.5, m = Math.floor(m), m /= Math.pow(10, o)) : Math.round(m);
875
- }, Z = function(m) {
876
- return m < 0 ? Math.ceil(m) : Math.floor(m);
877
- }, de = function(m) {
878
- return m - Q(m);
879
- }, ee = !1, (pe = function() {
880
- var m, o, u, f, g;
881
- if (!ee && window.jQuery != null) {
882
- for (ee = !0, f = ["html", "text"], g = [], o = 0, u = f.length; o < u; o++)
883
- m = f[o], g.push(
884
- function(y) {
885
- var b;
886
- return b = window.jQuery.fn[y], window.jQuery.fn[y] = function(w) {
887
- var k;
888
- return w == null || ((k = this[0]) != null ? k.odometer : void 0) == null ? b.apply(this, arguments) : this[0].odometer.update(w);
889
- };
890
- }(m)
891
- );
892
- return g;
893
- }
894
- })(), setTimeout(pe, 0), v = function() {
895
- function m(o) {
896
- var u, f, g, y, b, w, k, x, C, S = this;
897
- if (this.options = o, this.el = this.options.el, this.el.odometer != null)
898
- return this.el.odometer;
899
- this.el.odometer = this, k = m.options;
900
- for (u in k)
901
- g = k[u], this.options[u] == null && (this.options[u] = g);
902
- (y = this.options).duration == null && (y.duration = s), this.animationCount = 0, this.MAX_VALUES = this.options.duration / h / c | 0, this.resetFormat(), this.value = this.cleanValue((x = this.options.value) != null ? x : ""), this.renderInside(), this.render();
903
- try {
904
- for (C = ["innerHTML", "innerText", "textContent"], b = 0, w = C.length; b < w; b++)
905
- f = C[b], this.el[f] != null && function(_) {
906
- return Object.defineProperty(S.el, _, {
907
- get: function() {
908
- var M;
909
- return _ === "innerHTML" ? S.inside.outerHTML : (M = S.inside.innerText) != null ? M : S.inside.textContent;
910
- },
911
- set: function(M) {
912
- return S.update(M);
913
- }
914
- });
915
- }(f);
916
- } catch {
917
- this.watchForMutations();
918
- }
919
- }
920
- return m.prototype.renderInside = function() {
921
- return this.inside = document.createElement("div"), this.inside.className = "odometer-inside", this.el.innerHTML = "", this.el.appendChild(this.inside);
922
- }, m.prototype.watchForMutations = function() {
923
- var o = this;
924
- if (p != null)
925
- try {
926
- return this.observer == null && (this.observer = new p(function(u) {
927
- var f;
928
- return f = o.el.innerText, o.renderInside(), o.render(o.value), o.update(f);
929
- })), this.watchMutations = !0, this.startWatchingMutations();
930
- } catch {
931
- }
932
- }, m.prototype.startWatchingMutations = function() {
933
- if (this.watchMutations)
934
- return this.observer.observe(this.el, {
935
- childList: !0
936
- });
937
- }, m.prototype.stopWatchingMutations = function() {
938
- var o;
939
- return (o = this.observer) != null ? o.disconnect() : void 0;
940
- }, m.prototype.cleanValue = function(o) {
941
- var u;
942
- return typeof o == "string" && (o = o.replace((u = this.format.radix) != null ? u : ".", "<radix>"), o = o.replace(/[.,]/g, ""), o = o.replace("<radix>", "."), o = parseFloat(o, 10) || 0), Q(o, this.format.precision);
943
- }, m.prototype.bindTransitionEnd = function() {
944
- var o, u, f, g, y, b, w = this;
945
- if (!this.transitionEndBound) {
946
- for (this.transitionEndBound = !0, u = !1, y = P.split(" "), b = [], f = 0, g = y.length; f < g; f++)
947
- o = y[f], b.push(
948
- this.el.addEventListener(
949
- o,
950
- function() {
951
- return u || (u = !0, setTimeout(function() {
952
- return w.animationCount++, w.render(), u = !1, J(w.el, "odometerdone");
953
- }, 0)), !0;
954
- },
955
- !1
956
- )
957
- );
958
- return b;
959
- }
960
- }, m.prototype.resetFormat = function() {
961
- var o, u, f, g, y, b, w, k;
962
- if (o = (w = this.options.format) != null ? w : i, o || (o = "d"), f = l.exec(o), !f)
963
- throw new Error("Odometer: Unparsable digit format");
964
- return k = f.slice(1, 4), b = k[0], y = k[1], u = k[2], g = (u != null ? u.length : void 0) || 0, this.format = {
965
- repeating: b,
966
- radix: y,
967
- precision: g
968
- };
969
- }, m.prototype.render = function(o) {
970
- var u, f, g, y, b, w, k, x, C, S, _, M;
971
- for (o == null && (o = this.value), this.stopWatchingMutations(), this.resetFormat(), this.inside.innerHTML = "", w = this.options.theme, u = this.el.className.split(" "), b = [], x = 0, S = u.length; x < S; x++)
972
- if (f = u[x], !!f.length) {
973
- if (y = /^odometer-theme-(.+)$/.exec(f)) {
974
- w = y[1];
975
- continue;
976
- }
977
- /^odometer(-|$)/.test(f) || b.push(f);
978
- }
979
- for (b.push("odometer"), $ || b.push("odometer-no-transitions"), w ? b.push("odometer-theme-" + w) : b.push("odometer-auto-theme"), this.el.className = b.join(" "), this.ribbons = {}, this.digits = [], k = !this.format.precision || !de(o) || !1, M = o.toString().split("").reverse(), C = 0, _ = M.length; C < _; C++)
980
- g = M[C], g === "." && (k = !0), this.addDigit(g, k);
981
- return this.startWatchingMutations();
982
- }, m.prototype.update = function(o) {
983
- var u, f = this;
984
- if (o = this.cleanValue(o), !!(u = o - this.value)) {
985
- if (f.animationCount >= f.options.maxAnimations) {
986
- f.value = o, f.render();
987
- return;
988
- }
989
- return G(this.el, "odometer-animating-up odometer-animating-down odometer-animating"), u > 0 ? T(this.el, "odometer-animating-up") : T(this.el, "odometer-animating-down"), this.stopWatchingMutations(), this.animate(o), this.startWatchingMutations(), setTimeout(function() {
990
- return f.el.offsetHeight, T(f.el, "odometer-animating");
991
- }, 0), this.value = o;
992
- }
993
- }, m.prototype.renderDigit = function() {
994
- return U(r);
995
- }, m.prototype.insertDigit = function(o, u) {
996
- return u != null ? this.inside.insertBefore(o, u) : this.inside.children.length ? this.inside.insertBefore(o, this.inside.children[0]) : this.inside.appendChild(o);
997
- }, m.prototype.addSpacer = function(o, u, f) {
998
- var g;
999
- return g = U(a), g.innerHTML = o, f && T(g, f), this.insertDigit(g, u);
1000
- }, m.prototype.addDigit = function(o, u) {
1001
- var f, g, y, b;
1002
- if (u == null && (u = !0), o === "-")
1003
- return this.addSpacer(o, null, "odometer-negation-mark");
1004
- if (o === ".")
1005
- return this.addSpacer((b = this.format.radix) != null ? b : ".", null, "odometer-radix-mark");
1006
- if (u)
1007
- for (y = !1; ; ) {
1008
- if (!this.format.repeating.length) {
1009
- if (y)
1010
- throw new Error("Bad odometer format without digits");
1011
- this.resetFormat(), y = !0;
1012
- }
1013
- if (f = this.format.repeating[this.format.repeating.length - 1], this.format.repeating = this.format.repeating.substring(0, this.format.repeating.length - 1), f === "d")
1014
- break;
1015
- this.addSpacer(f);
1016
- }
1017
- return g = this.renderDigit(), g.querySelector(".odometer-value").innerHTML = o, this.digits.push(g), this.insertDigit(g);
1018
- }, m.prototype.animate = function(o) {
1019
- return !$ || this.options.animation === "count" ? this.animateCount(o) : this.animateSlide(o);
1020
- }, m.prototype.animateCount = function(o) {
1021
- var u, f, g, y, b, w = this;
1022
- if (f = +o - this.value)
1023
- return y = g = D(), u = this.value, (b = function() {
1024
- var k, x, C;
1025
- if (D() - y > w.options.duration) {
1026
- w.animationCount++, w.value = o, w.render(), J(w.el, "odometerdone");
1027
- return;
1028
- }
1029
- return k = D() - g, k > e && (g = D(), C = k / w.options.duration, x = f * C, u += x, w.render(Math.round(u))), X != null ? X(b) : setTimeout(b, e);
1030
- })();
1031
- }, m.prototype.getDigitCount = function() {
1032
- var o, u, f, g, y, b;
1033
- for (g = 1 <= arguments.length ? fe.call(arguments, 0) : [], o = y = 0, b = g.length; y < b; o = ++y)
1034
- f = g[o], g[o] = Math.abs(f);
1035
- return u = Math.max.apply(Math, g), Math.ceil(Math.log(u + 1) / Math.log(10));
1036
- }, m.prototype.getFractionalDigitCount = function() {
1037
- var o, u, f, g, y, b, w;
1038
- for (y = 1 <= arguments.length ? fe.call(arguments, 0) : [], u = /^\-?\d*\.(\d*?)0*$/, o = b = 0, w = y.length; b < w; o = ++b)
1039
- g = y[o], y[o] = g.toString(), f = u.exec(y[o]), f == null ? y[o] = 0 : y[o] = f[1].length;
1040
- return Math.max.apply(Math, y);
1041
- }, m.prototype.resetDigits = function() {
1042
- return this.digits = [], this.ribbons = [], this.inside.innerHTML = "", this.resetFormat();
1043
- }, m.prototype.animateSlide = function(o) {
1044
- var u, f, g, y, b, w, k, x, C, S, _, M, N, W, O, R, A, ve, H, ie, ne, ge, ye, be, se, re, ae;
1045
- if (R = this.value, x = this.getFractionalDigitCount(R, o), x && (o = o * Math.pow(10, x), R = R * Math.pow(10, x)), !!(g = o - R)) {
1046
- for (this.bindTransitionEnd(), y = this.getDigitCount(R, o), b = [], u = 0, _ = H = 0; 0 <= y ? H < y : H > y; _ = 0 <= y ? ++H : --H) {
1047
- if (A = Z(R / Math.pow(10, y - _ - 1)), k = Z(o / Math.pow(10, y - _ - 1)), w = k - A, Math.abs(w) > this.MAX_VALUES) {
1048
- for (S = [], M = w / (this.MAX_VALUES + this.MAX_VALUES * u * n), f = A; w > 0 && f < k || w < 0 && f > k; )
1049
- S.push(Math.round(f)), f += M;
1050
- S[S.length - 1] !== k && S.push(k), u++;
1051
- } else
1052
- S = (function() {
1053
- ae = [];
1054
- for (var B = A; A <= k ? B <= k : B >= k; A <= k ? B++ : B--)
1055
- ae.push(B);
1056
- return ae;
1057
- }).apply(this);
1058
- for (_ = ie = 0, ge = S.length; ie < ge; _ = ++ie)
1059
- C = S[_], S[_] = Math.abs(C % 10);
1060
- b.push(S);
1061
- }
1062
- for (this.resetDigits(), re = b.reverse(), _ = ne = 0, ye = re.length; ne < ye; _ = ++ne)
1063
- for (S = re[_], this.digits[_] || this.addDigit(" ", _ >= x), (ve = this.ribbons)[_] == null && (ve[_] = this.digits[_].querySelector(".odometer-ribbon-inner")), this.ribbons[_].innerHTML = "", g < 0 && (S = S.reverse()), N = se = 0, be = S.length; se < be; N = ++se)
1064
- C = S[N], O = document.createElement("div"), O.className = "odometer-value", O.innerHTML = C, this.ribbons[_].appendChild(O), N === S.length - 1 && T(O, "odometer-last-value"), N === 0 && T(O, "odometer-first-value");
1065
- if (o < 0 && this.addDigit("-"), W = this.inside.querySelector(".odometer-radix-mark"), W != null && W.parent.removeChild(W), x)
1066
- return this.addSpacer(this.format.radix, this.digits[x - 1], "odometer-radix-mark");
1067
- }
1068
- }, m;
1069
- }(), v.options = (ue = window.odometerOptions) != null ? ue : {}, v.options.maxAnimations = 1 / 0, setTimeout(function() {
1070
- var m, o, u, f, g;
1071
- if (window.odometerOptions) {
1072
- f = window.odometerOptions, g = [];
1073
- for (m in f)
1074
- o = f[m], g.push((u = v.options)[m] != null ? (u = v.options)[m] : u[m] = o);
1075
- return g;
1076
- }
1077
- }, 0), v.init = function() {
1078
- var m, o, u, f, g, y;
1079
- if (document.querySelectorAll != null) {
1080
- for (o = document.querySelectorAll(v.options.selector || ".odometer"), y = [], u = 0, f = o.length; u < f; u++)
1081
- m = o[u], y.push(
1082
- m.odometer = new v({
1083
- el: m,
1084
- value: (g = m.innerText) != null ? g : m.textContent
1085
- })
1086
- );
1087
- return y;
1088
- }
1089
- }, ((me = document.documentElement) != null ? me.doScroll : void 0) != null && document.createEventObject != null ? (te = document.onreadystatechange, document.onreadystatechange = function() {
1090
- return document.readyState === "complete" && v.options.auto !== !1 && v.init(), te != null ? te.apply(this, arguments) : void 0;
1091
- }) : document.addEventListener(
1092
- "DOMContentLoaded",
1093
- function() {
1094
- if (v.options.auto !== !1)
1095
- return v.init();
1096
- },
1097
- !1
1098
- ), window.Odometer = v;
1099
- }).call(void 0);
1100
- const ht = {
1101
- name: "LvcOdometer",
1102
- props: {
1103
- value: { type: Number, default: 0 },
1104
- duration: { type: Number, default: 1e3 },
1105
- maxAnimations: { type: Number, default: 1 / 0 },
1106
- unit: { type: String, default: "" },
1107
- unitSize: { type: String, default: "inherit" },
1108
- unitPosition: { type: String, default: "right" }
1109
- },
1110
- data() {
1111
- return { od: null };
1112
- },
1113
- mounted() {
1114
- this.od = new window.Odometer({
1115
- el: this.$refs.odo,
1116
- value: this.value,
1117
- duration: this.duration,
1118
- maxAnimations: this.maxAnimations
1119
- });
1120
- },
1121
- watch: {
1122
- value(t) {
1123
- this.od && this.od.update(t);
1124
- }
1125
- }
1126
- };
1127
- var dt = function() {
1128
- var e = this, i = e._self._c;
1129
- return i("div", { staticClass: "lvc-odometer" }, [e._t("unit-left", function() {
1130
- return [e.unit && e.unitPosition === "left" ? i("span", { staticClass: "odometer-unit odometer-unit-left", style: { fontSize: e.unitSize } }, [e._v(e._s(e.unit))]) : e._e()];
1131
- }), i("span", { ref: "odo", staticClass: "odometer-value" }), e._t("unit-right", function() {
1132
- return [e.unit && e.unitPosition === "right" ? i("span", { staticClass: "odometer-unit", style: { fontSize: e.unitSize } }, [e._v(e._s(e.unit))]) : e._e()];
1133
- })], 2);
1134
- }, pt = [], ut = /* @__PURE__ */ L(
1135
- ht,
1136
- dt,
1137
- pt
1138
- );
1139
- const mt = ut.exports;
1140
- typeof window < "u" && !window.Vue && (window.Vue = z);
1141
- (function() {
1142
- const t = document.createElement("style");
1143
- t.id = "lvc-tree-style", t.textContent = [
1144
- ".lvc-tree { user-select: none; overflow-y: auto; }",
1145
- ".lvc-tree::-webkit-scrollbar { width: 0.4vmin; }",
1146
- ".lvc-tree::-webkit-scrollbar-track { background: rgba(10, 22, 40, 0.3); }",
1147
- ".lvc-tree::-webkit-scrollbar-thumb { background: #1e3a5f; border-radius: 0.2vmin; }",
1148
- ".lvc-tree::-webkit-scrollbar-thumb:hover { background: #22a6b3; }",
1149
- ".lvc-tree-node { }",
1150
- ".lvc-tree-node-content { display: flex; align-items: stretch; }",
1151
- ".lvc-tree-node-left { display: inline-flex; align-items: center; flex-shrink: 0; }",
1152
- ".lvc-tree-node-right { display: flex; align-items: center; flex: 1; padding: 0.6vmin 0.8vmin; cursor: pointer; border-radius: 0.4vmin; transition: background 0.2s; font-size: 1.2vmin; color: #cfefff; min-width: 0; }",
1153
- ".lvc-tree-node-right:hover { background: rgba(34, 166, 179, 0.15); }",
1154
- ".lvc-tree-node-right.selected { background: rgba(34, 166, 179, 0.25); color: #22a6b3; }",
1155
- ".lvc-tree-node-arrow { width: 2vmin; font-size: 1.2vmin; color: #8ab4d4; transition: transform 0.2s; display: inline-block; text-align: center; flex-shrink: 0; }",
1156
- ".lvc-tree-node-arrow.expanded { transform: rotate(90deg); }",
1157
- ".lvc-tree-node-arrow-placeholder { width: 1.5vmin; display: inline-block; flex-shrink: 0; }",
1158
- ".lvc-tree-node-icon { width: 1.5vmin; height: 1.5vmin; margin-right: 0.8vmin; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2vmin; flex-shrink: 0; }",
1159
- '.lvc-tree-node-icon.folder::before { content: "\\1F4C1"; }',
1160
- '.lvc-tree-node-icon.meter::before { content: "\\1F4CA"; }',
1161
- '.lvc-tree-node-icon.data::before { content: "\\1F4C8"; }',
1162
- '.lvc-tree-node-icon.device::before { content: "\\2699\\FE0F"; }',
1163
- '.lvc-tree-node-icon.default::before { content: "\\1F4C4"; }',
1164
- ".lvc-tree-node-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }",
1165
- ".lvc-tree-node-children { padding-left: 1.5vmin; }",
1166
- /* 复选框样式 */
1167
- ".lvc-tree-checkbox { display: inline-flex; align-items: center; margin-right: 0.6vmin;margin-left: 0.6vmin; flex-shrink: 0; cursor: pointer; }",
1168
- ".lvc-tree-checkbox input { display: none; }",
1169
- ".lvc-tree-checkbox .checkbox-box { width: 1.4vmin; height: 1.4vmin; border: 0.15vmin solid #4a7899; border-radius: 0.2vmin; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; background: transparent; position: relative; }",
1170
- ".lvc-tree-checkbox:hover .checkbox-box { border-color: #22a6b3; }",
1171
- ".lvc-tree-checkbox.checked .checkbox-box { background: #22a6b3; border-color: #22a6b3; }",
1172
- '.lvc-tree-checkbox.checked .checkbox-box::after { content: ""; width: 0.4vmin; height: 0.7vmin; border: 0.15vmin solid #fff; border-top: none; border-left: none; transform: rotate(45deg) translate(-0.05vmin, -0.1vmin); }',
1173
- ".lvc-tree-checkbox.indeterminate .checkbox-box { background: #22a6b3; border-color: #22a6b3; }",
1174
- '.lvc-tree-checkbox.indeterminate .checkbox-box::after { content: ""; width: 0.7vmin; height: 0.15vmin; background: #fff; border-radius: 0.1vmin; }'
1175
- ].join(`
1176
- `), document.getElementById("lvc-tree-style") || document.head.appendChild(t);
1177
- function e(n, s) {
1178
- if (n.indexOf(s.id) !== -1)
1179
- return !0;
1180
- if (!s.children || s.children.length === 0)
1181
- return !1;
1182
- for (let a = 0; a < s.children.length; a++)
1183
- if (e(n, s.children[a]))
1184
- return !0;
1185
- return !1;
1186
- }
1187
- const r = {
1188
- name: "LvcTree",
1189
- components: {
1190
- "lvc-tree-node": {
1191
- name: "LvcTreeNode",
1192
- props: {
1193
- node: { type: Object, required: !0 },
1194
- selectedId: { type: [String, Number], default: null },
1195
- defaultExpandAll: { type: Boolean, default: !1 },
1196
- showCheckbox: { type: Boolean, default: !1 },
1197
- checkedKeys: { type: Array, default: () => [] },
1198
- filterText: { type: String, default: "" },
1199
- filterNodeMethod: { type: Function, default: null },
1200
- autoExpandOnFilter: { type: Boolean, default: !0 },
1201
- isRoot: { type: Boolean, default: !1 }
1202
- // 是否是一级根节点
1203
- },
1204
- data() {
1205
- return {
1206
- expanded: this.node.expanded !== void 0 ? this.node.expanded : this.defaultExpandAll
1207
- };
1208
- },
1209
- watch: {
1210
- filterText: {
1211
- handler(n) {
1212
- this.autoExpandOnFilter && n && this.hasChildren ? this._nodeMatchesFilter(this.node) && (this.expanded = !0) : this.expanded = this.isRoot;
1213
- },
1214
- immediate: !1
1215
- }
1216
- },
1217
- template: [
1218
- '<div class="lvc-tree-node" v-show="isVisible">',
1219
- ' <div class="lvc-tree-node-content">',
1220
- ' <span class="lvc-tree-node-left">',
1221
- ' <span v-if="hasChildren" class="lvc-tree-node-arrow" :class="{ expanded: expanded }" @click.stop="handleToggle">▶</span>',
1222
- ' <span v-else class="lvc-tree-node-arrow-placeholder"></span>',
1223
- ' <span v-if="showCheckbox" class="lvc-tree-checkbox" :class="checkboxClass" @click.stop.prevent="handleCheck">',
1224
- ' <span class="checkbox-box"></span>',
1225
- " </span>",
1226
- " </span>",
1227
- ' <span class="lvc-tree-node-right" :class="{ selected: node.id === selectedId }" @click="handleClick">',
1228
- ' <span v-if="nodeIcon" class="lvc-tree-node-icon" :class="nodeIcon"></span>',
1229
- ' <span class="lvc-tree-node-label" :title="node.label">{{ node.label }}</span>',
1230
- " </span>",
1231
- " </div>",
1232
- ' <div v-if="expanded && hasChildren" class="lvc-tree-node-children">',
1233
- ` <lvc-tree-node v-for="child in node.children" :key="child.id" :node="child" :selected-id="selectedId" :default-expand-all="defaultExpandAll" :show-checkbox="showCheckbox" :checked-keys="checkedKeys" :filter-text="filterText" :filter-node-method="filterNodeMethod" :auto-expand-on-filter="autoExpandOnFilter" @select="$emit('select', $event)" @toggle="$emit('toggle', $event)" @check-change="$emit('check-change', $event)"></lvc-tree-node>`,
1234
- " </div>",
1235
- "</div>"
1236
- ].join(`
1237
- `),
1238
- computed: {
1239
- hasChildren() {
1240
- return this.node.children && this.node.children.length > 0;
1241
- },
1242
- nodeIcon() {
1243
- return this.node.icon || "";
1244
- },
1245
- isChecked() {
1246
- return this.checkedKeys.indexOf(this.node.id) !== -1;
1247
- },
1248
- childCheckedCount() {
1249
- if (!this.hasChildren) return 0;
1250
- let n = 0;
1251
- for (let s = 0; s < this.node.children.length; s++) {
1252
- const a = this.node.children[s];
1253
- (this.checkedKeys.indexOf(a.id) !== -1 || e(this.checkedKeys, a)) && n++;
1254
- }
1255
- return n;
1256
- },
1257
- isIndeterminate() {
1258
- if (!this.hasChildren) return !1;
1259
- const n = this.childCheckedCount;
1260
- return n > 0 && n < this.node.children.length;
1261
- },
1262
- checkboxClass() {
1263
- return this.isChecked ? "checked" : this.isIndeterminate ? "indeterminate" : "";
1264
- },
1265
- isVisible() {
1266
- return !this.filterText || !this.filterNodeMethod || this.filterNodeMethod(this.filterText, this.node) ? !0 : this.hasChildren ? this._hasVisibleChild(this.node.children) : !1;
1267
- }
1268
- },
1269
- methods: {
1270
- handleClick() {
1271
- try {
1272
- this.showCheckbox ? this.handleCheck() : this.$emit("select", this.node);
1273
- } catch (n) {
1274
- console.error("[LvcTree] click event error:", n);
1275
- }
1276
- },
1277
- handleToggle() {
1278
- try {
1279
- this.expanded = !this.expanded, this.$emit("toggle", { node: this.node, expanded: this.expanded });
1280
- } catch (n) {
1281
- console.error("[LvcTree] toggle event error:", n);
1282
- }
1283
- },
1284
- handleCheck() {
1285
- try {
1286
- let n;
1287
- this.isIndeterminate ? n = !1 : n = !this.isChecked;
1288
- const s = this._collectVisibleDescendantIds(this.node), d = (this.filterText && this.filterNodeMethod ? this.filterNodeMethod(this.filterText, this.node) : !0) ? [this.node.id, ...s] : s;
1289
- this.$emit("check-change", {
1290
- node: this.node,
1291
- checked: n,
1292
- indeterminate: !1,
1293
- affectedIds: d
1294
- });
1295
- } catch (n) {
1296
- console.error("[LvcTree] check event error:", n);
1297
- }
1298
- },
1299
- _collectDescendantIds(n) {
1300
- const s = [];
1301
- if (n.children && n.children.length > 0)
1302
- for (let a = 0; a < n.children.length; a++) {
1303
- const l = n.children[a];
1304
- s.push(l.id), s.push(...this._collectDescendantIds(l));
1305
- }
1306
- return s;
1307
- },
1308
- // 收集可见(通过过滤)的后代节点 ID(过滤模式下只收集匹配过滤条件的节点)
1309
- _collectVisibleDescendantIds(n) {
1310
- const s = [];
1311
- if (!n.children || n.children.length === 0) return s;
1312
- for (let a = 0; a < n.children.length; a++) {
1313
- const l = n.children[a];
1314
- this._isNodeVisible(l) && ((!(this.filterText && this.filterNodeMethod) || this.filterNodeMethod(this.filterText, l)) && s.push(l.id), s.push(...this._collectVisibleDescendantIds(l)));
1315
- }
1316
- return s;
1317
- },
1318
- // 判断节点是否在当前过滤条件下可见
1319
- _isNodeVisible(n) {
1320
- if (!this.filterText || !this.filterNodeMethod || this.filterNodeMethod(this.filterText, n)) return !0;
1321
- if (n.children && n.children.length > 0) {
1322
- for (let s = 0; s < n.children.length; s++)
1323
- if (this._isNodeVisible(n.children[s])) return !0;
1324
- }
1325
- return !1;
1326
- },
1327
- _hasVisibleChild(n) {
1328
- if (!n || n.length === 0) return !1;
1329
- for (let s = 0; s < n.length; s++) {
1330
- const a = n[s];
1331
- if (this.filterNodeMethod(this.filterText, a) || a.children && a.children.length > 0 && this._hasVisibleChild(a.children))
1332
- return !0;
1333
- }
1334
- return !1;
1335
- },
1336
- // 判断节点是否匹配过滤条件(用于自动展开)
1337
- _nodeMatchesFilter(n) {
1338
- if (!this.filterText || !this.filterNodeMethod) return !1;
1339
- if (this.filterNodeMethod(this.filterText, n)) return !0;
1340
- if (n.children && n.children.length > 0) {
1341
- for (let s = 0; s < n.children.length; s++)
1342
- if (this._nodeMatchesFilter(n.children[s])) return !0;
1343
- }
1344
- return !1;
1345
- }
1346
- }
1347
- }
1348
- },
1349
- props: {
1350
- data: { type: Array, default: () => [] },
1351
- selectedId: { type: [String, Number], default: null },
1352
- defaultExpandAll: { type: Boolean, default: !1 },
1353
- showCheckbox: { type: Boolean, default: !1 },
1354
- defaultCheckedKeys: { type: Array, default: () => [] },
1355
- maxCheck: { type: Number, default: 0 },
1356
- // 0 = 不限制
1357
- filterNodeMethod: { type: Function, default: null },
1358
- // 过滤节点的方法
1359
- autoExpandOnFilter: { type: Boolean, default: !0 }
1360
- },
1361
- data() {
1362
- return {
1363
- checkedKeys: this.defaultCheckedKeys.slice(),
1364
- filterText: ""
1365
- // 过滤文本
1366
- };
1367
- },
1368
- watch: {
1369
- defaultCheckedKeys: {
1370
- handler(n) {
1371
- this.checkedKeys = n.slice();
1372
- },
1373
- deep: !0
1374
- },
1375
- filterText(n) {
1376
- this.$emit("filter-change", n);
1377
- }
1378
- },
1379
- template: [
1380
- '<div class="lvc-tree">',
1381
- ` <lvc-tree-node v-for="node in data" :key="node.id" :node="node" :selected-id="selectedId" :default-expand-all="defaultExpandAll" :show-checkbox="showCheckbox" :checked-keys="checkedKeys" :filter-text="filterText" :filter-node-method="filterNodeMethod" :auto-expand-on-filter="autoExpandOnFilter" :is-root="true" @select="$emit('select', $event)" @toggle="$emit('toggle', $event)" @check-change="onCheckChange"></lvc-tree-node>`,
1382
- ' <div v-if="!data || data.length === 0" class="lvc-tree-empty" style="text-align:center;color:#8ab4d4;padding:2vmin 0;font-size:1.2vmin;">暂无数据</div>',
1383
- "</div>"
1384
- ].join(`
1385
- `),
1386
- methods: {
1387
- /**
1388
- * 过滤树节点(外部调用)
1389
- * @param {String} text - 过滤文本
1390
- */
1391
- filter(n) {
1392
- this.checkedKeys.length > 0 && (this.checkedKeys = [], this.$emit("check-change", {
1393
- node: null,
1394
- checked: !1,
1395
- indeterminate: !1,
1396
- checkedKeys: [],
1397
- checkedNodes: []
1398
- })), this.filterText = n;
1399
- },
1400
- onCheckChange(n) {
1401
- try {
1402
- const s = n.node.id, a = n.checked, l = n.affectedIds || [];
1403
- if (a)
1404
- for (let h = 0; h < l.length; h++)
1405
- this.checkedKeys.indexOf(l[h]) === -1 && this.checkedKeys.push(l[h]);
1406
- else
1407
- for (let h = l.length - 1; h >= 0; h--) {
1408
- const p = this.checkedKeys.indexOf(l[h]);
1409
- p !== -1 && this.checkedKeys.splice(p, 1);
1410
- }
1411
- this._updateAncestors(this.data, s);
1412
- const d = this._countCheckedLeaves(this.data);
1413
- if (this.maxCheck > 0 && d > this.maxCheck) {
1414
- const h = this._collectLimitedKeys(this.maxCheck);
1415
- this.checkedKeys = h, this._updateAllAncestors(), this.$emit("max-check-exceeded", { max: this.maxCheck, actual: d });
1416
- }
1417
- const c = this._collectCheckedNodesWithAncestors(this.data);
1418
- this.$emit("check-change", {
1419
- node: n.node,
1420
- checked: a,
1421
- indeterminate: !1,
1422
- checkedKeys: this.checkedKeys.slice(),
1423
- checkedNodes: c
1424
- });
1425
- } catch (s) {
1426
- console.error("[LvcTree] check-change handler error:", s);
1427
- }
1428
- },
1429
- _updateAncestors(n, s) {
1430
- const a = this._getParentChain(this.data, s);
1431
- for (let l = 0; l < a.length; l++) {
1432
- const d = a[l];
1433
- let c = !0;
1434
- for (let h = 0; h < d.children.length; h++) {
1435
- const p = d.children[h];
1436
- if (!this._isNodeFullyChecked(p)) {
1437
- c = !1;
1438
- break;
1439
- }
1440
- }
1441
- if (c && d.children.length > 0)
1442
- this.checkedKeys.indexOf(d.id) === -1 && this.checkedKeys.push(d.id);
1443
- else {
1444
- const h = this.checkedKeys.indexOf(d.id);
1445
- h !== -1 && this.checkedKeys.splice(h, 1);
1446
- }
1447
- }
1448
- },
1449
- // 获取目标节点的所有父节点链(从直接父节点到根节点)
1450
- _getParentChain(n, s, a) {
1451
- a = a || [];
1452
- for (let l = 0; l < n.length; l++) {
1453
- const d = n[l];
1454
- if (d.children && d.children.length > 0) {
1455
- for (let h = 0; h < d.children.length; h++)
1456
- if (d.children[h].id === s)
1457
- return a.unshift(d), this._getParentChain(this.data, d.id, a), a;
1458
- const c = this._getParentChain(d.children, s, a);
1459
- if (c.length > 0)
1460
- return c;
1461
- }
1462
- }
1463
- return a;
1464
- },
1465
- // 检查节点是否"完全勾选"(该节点及其所有后代都在 checkedKeys 中)
1466
- _isNodeFullyChecked(n) {
1467
- if (this.checkedKeys.indexOf(n.id) === -1)
1468
- return !1;
1469
- if (!n.children || n.children.length === 0)
1470
- return !0;
1471
- for (let s = 0; s < n.children.length; s++)
1472
- if (!this._isNodeFullyChecked(n.children[s]))
1473
- return !1;
1474
- return !0;
1475
- },
1476
- _isDescendant(n, s) {
1477
- if (!n.children || n.children.length === 0) return !1;
1478
- for (let a = 0; a < n.children.length; a++) {
1479
- const l = n.children[a];
1480
- if (l.id === s || this._isDescendant(l, s)) return !0;
1481
- }
1482
- return !1;
1483
- },
1484
- /**
1485
- * 获取当前勾选的节点 key 数组
1486
- */
1487
- getCheckedKeys() {
1488
- return this.checkedKeys.slice();
1489
- },
1490
- /**
1491
- * 设置勾选的节点 key 数组
1492
- */
1493
- setCheckedKeys(n) {
1494
- this.checkedKeys = n.slice();
1495
- },
1496
- /**
1497
- * 获取半选状态的节点 key 数组
1498
- */
1499
- getHalfCheckedKeys() {
1500
- const n = [];
1501
- return this._collectHalfChecked(this.data, n), n;
1502
- },
1503
- _collectHalfChecked(n, s) {
1504
- for (let a = 0; a < n.length; a++) {
1505
- const l = n[a];
1506
- if (l.children && l.children.length > 0) {
1507
- let d = 0;
1508
- for (let c = 0; c < l.children.length; c++)
1509
- this.checkedKeys.indexOf(l.children[c].id) !== -1 && d++;
1510
- d > 0 && d < l.children.length && s.push(l.id), this._collectHalfChecked(l.children, s);
1511
- }
1512
- }
1513
- },
1514
- /**
1515
- * 判断节点是否在当前过滤条件下可见
1516
- */
1517
- _isNodeVisible(n) {
1518
- if (!this.filterText || !this.filterNodeMethod || this.filterNodeMethod(this.filterText, n)) return !0;
1519
- if (n.children && n.children.length > 0) {
1520
- for (let s = 0; s < n.children.length; s++)
1521
- if (this._isNodeVisible(n.children[s])) return !0;
1522
- }
1523
- return !1;
1524
- },
1525
- /**
1526
- * 统计当前勾选的叶子节点数量(过滤模式下只统计可见节点)
1527
- */
1528
- _countCheckedLeaves(n) {
1529
- n = n || this.data;
1530
- let s = 0;
1531
- for (let a = 0; a < n.length; a++) {
1532
- const l = n[a];
1533
- this._isNodeVisible(l) && (l.children && l.children.length > 0 ? s += this._countCheckedLeaves(l.children) : this.checkedKeys.indexOf(l.id) !== -1 && s++);
1534
- }
1535
- return s;
1536
- },
1537
- /**
1538
- * 收集前 N 个叶子节点及其所有祖先的 ID(过滤模式下只收集可见节点)
1539
- */
1540
- _collectLimitedKeys(n) {
1541
- const s = /* @__PURE__ */ new Set();
1542
- let a = 0;
1543
- const l = (d, c) => {
1544
- for (let h = 0; h < d.length; h++) {
1545
- const p = d[h];
1546
- if (a >= n) return;
1547
- if (this._isNodeVisible(p)) {
1548
- if (p.children && p.children.length > 0)
1549
- if (this.checkedKeys.indexOf(p.id) !== -1)
1550
- l(p.children, c.concat(p.id));
1551
- else
1552
- for (let v = 0; v < p.children.length; v++) {
1553
- if (a >= n) return;
1554
- const E = p.children[v];
1555
- (this.checkedKeys.indexOf(E.id) !== -1 || this._hasCheckedDescendant(E)) && l([E], c.concat(p.id));
1556
- }
1557
- else if (this.checkedKeys.indexOf(p.id) !== -1) {
1558
- a++;
1559
- for (let v = 0; v < c.length; v++) s.add(c[v]);
1560
- s.add(p.id);
1561
- }
1562
- }
1563
- }
1564
- };
1565
- return l(this.data, []), Array.from(s);
1566
- },
1567
- /**
1568
- * 检查节点是否有被勾选的后代
1569
- */
1570
- _hasCheckedDescendant(n) {
1571
- if (!n.children || n.children.length === 0) return !1;
1572
- for (let s = 0; s < n.children.length; s++) {
1573
- const a = n.children[s];
1574
- if (this.checkedKeys.indexOf(a.id) !== -1 || this._hasCheckedDescendant(a))
1575
- return !0;
1576
- }
1577
- return !1;
1578
- },
1579
- /**
1580
- * 重新更新所有祖先节点状态(用于限制后刷新半选状态)
1581
- */
1582
- _updateAllAncestors() {
1583
- const n = (s) => {
1584
- for (let a = 0; a < s.length; a++) {
1585
- const l = s[a];
1586
- if (l.children && l.children.length > 0) {
1587
- n(l.children);
1588
- let d = !0;
1589
- for (let c = 0; c < l.children.length; c++)
1590
- if (!this._isNodeFullyChecked(l.children[c])) {
1591
- d = !1;
1592
- break;
1593
- }
1594
- if (d && l.children.length > 0)
1595
- this.checkedKeys.indexOf(l.id) === -1 && this.checkedKeys.push(l.id);
1596
- else {
1597
- const c = this.checkedKeys.indexOf(l.id);
1598
- c !== -1 && this.checkedKeys.splice(c, 1);
1599
- }
1600
- }
1601
- }
1602
- };
1603
- n(this.data);
1604
- },
1605
- /**
1606
- * 收集所有被勾选的节点及其祖先节点对象,构建过滤后的树
1607
- * 规则:
1608
- * - 节点本身被勾选 → 包含该节点及其全部子节点(完整子树)
1609
- * - 节点未被勾选但有被勾选的后代 → 仅包含该节点及过滤后的子节点(只保留通往被勾选节点的路径)
1610
- * - 节点未被勾选且无被勾选后代 → 不包含
1611
- */
1612
- _collectCheckedNodesWithAncestors(n) {
1613
- const s = [];
1614
- for (let a = 0; a < n.length; a++) {
1615
- const l = n[a];
1616
- if (this.checkedKeys.indexOf(l.id) !== -1)
1617
- s.push(this._deepCopyNode(l));
1618
- else if (l.children && l.children.length > 0 && e(this.checkedKeys, l)) {
1619
- const c = this._collectCheckedNodesWithAncestors(l.children);
1620
- if (c.length > 0) {
1621
- const h = Object.assign({}, l);
1622
- h.children = c, s.push(h);
1623
- }
1624
- }
1625
- }
1626
- return s;
1627
- },
1628
- /**
1629
- * 深拷贝节点及其全部子树
1630
- */
1631
- _deepCopyNode(n) {
1632
- const s = Object.assign({}, n);
1633
- return n.children && n.children.length > 0 ? s.children = n.children.map((a) => this._deepCopyNode(a)) : s.children = [], s;
1634
- }
1635
- }
1636
- };
1637
- typeof Vue < "u" && Vue.component("lvc-tree", r);
1638
- })();
1639
- const ft = z.options.components["lvc-tree"];
1640
- (function() {
1641
- const t = document.createElement("style");
1642
- t.id = "lvc-month-picker-style", t.textContent = `
1643
- .lvc-month-picker {
1644
- position: relative;
1645
- display: inline-block;
1646
- font-size: 1.8vmin;
1647
- color: #fff;
1648
- user-select: none;
1649
- height: 100%;
1650
- }
1651
-
1652
- .lvc-month-input-wrapper {
1653
- background: #0d2339;
1654
- border: 1px solid #1e4469;
1655
- border-radius: 0.8vmin;
1656
- padding: 0.6vmin 1vmin;
1657
- cursor: pointer;
1658
- display: flex;
1659
- align-items: center;
1660
- gap: 0.8vmin;
1661
- min-width: 14vmin;
1662
- transition: all 0.3s;
1663
- height: 100%;
1664
- }
1665
-
1666
- .lvc-month-separator {
1667
- color: #5d758c;
1668
- font-size: 1.385vmin;
1669
- flex-shrink: 0;
1670
- }
1671
-
1672
- .lvc-month-input-wrapper:hover,
1673
- .lvc-month-input-wrapper.is-active {
1674
- border-color: #12bbed;
1675
- box-shadow: 0 0 1.2vmin rgba(18, 187, 237, 0.3);
1676
- }
1677
-
1678
- .lvc-month-inner-input {
1679
- background: transparent;
1680
- border: none;
1681
- color: #fff;
1682
- outline: none;
1683
- width: 100%;
1684
- text-align: center;
1685
- cursor: pointer;
1686
- font-size: 1.3vmin;
1687
- }
1688
-
1689
- .lvc-month-icon-arrow {
1690
- color: #12bbed;
1691
- font-size: 1.385vmin;
1692
- transition: transform 0.3s;
1693
- }
1694
-
1695
- .lvc-month-panel {
1696
- position: absolute;
1697
- top: 5vmin;
1698
- left: 50%;
1699
- transform: translateX(-50%);
1700
- background: #0b1a2a;
1701
- border: 1px solid #12bbed;
1702
- box-shadow: 0 1.2vmin 3.5vmin rgba(0, 0, 0, 0.7);
1703
- border-radius: 1vmin;
1704
- padding: 1.5vmin;
1705
- z-index: 9999;
1706
- min-width: 28vmin;
1707
- }
1708
-
1709
- .lvc-month-panel-header {
1710
- display: flex;
1711
- justify-content: space-between;
1712
- align-items: center;
1713
- margin-bottom: 1vmin;
1714
- color: #12bbed;
1715
- font-size: 1.6vmin;
1716
- }
1717
-
1718
- .lvc-month-nav-btn {
1719
- cursor: pointer;
1720
- padding: 0.3vmin 0.8vmin;
1721
- font-size: 1.4vmin;
1722
- color: #12bbed;
1723
- transition: color 0.2s;
1724
- }
1725
-
1726
- .lvc-month-nav-btn:hover {
1727
- color: #fff;
1728
- }
1729
-
1730
- .lvc-month-grid {
1731
- display: grid;
1732
- grid-template-columns: repeat(4, 1fr);
1733
- }
1734
-
1735
- .lvc-month-cell {
1736
- position: relative;
1737
- height: 4.5vmin;
1738
- line-height: 4.5vmin;
1739
- text-align: center;
1740
- font-size: 1.662vmin;
1741
- cursor: pointer;
1742
- border-radius: 0.5vmin;
1743
- color: #8ab4d4;
1744
- transition: all 0.2s;
1745
- }
1746
-
1747
- .lvc-month-cell:hover {
1748
- background: rgba(18, 187, 237, 0.2);
1749
- color: #fff;
1750
- }
1751
-
1752
- .lvc-month-cell.is-active {
1753
- background: #12bbed;
1754
- color: #fff;
1755
- font-weight: bold;
1756
- }
1757
-
1758
- .lvc-month-cell.is-in-range {
1759
- background: rgba(18, 187, 237, 0.15);
1760
- color: #12bbed;
1761
- border-radius: 0;
1762
- }
1763
-
1764
- .lvc-month-cell.is-in-hover-range {
1765
- background: rgba(18, 187, 237, 0.25);
1766
- color: #fff;
1767
- border-radius: 0;
1768
- }
1769
-
1770
- .lvc-month-cell.is-range-end {
1771
- border-top-right-radius: 0.5vmin;
1772
- border-bottom-right-radius: 0.5vmin;
1773
- }
1774
-
1775
- .lvc-month-cell.is-range-start {
1776
- border-top-left-radius: 0.5vmin;
1777
- border-bottom-left-radius: 0.5vmin;
1778
- }
1779
-
1780
- .lvc-month-cell.is-current::after {
1781
- content: "";
1782
- position: absolute;
1783
- bottom: 0.5vmin;
1784
- left: 50%;
1785
- width: 0.6vmin;
1786
- height: 0.6vmin;
1787
- background: #12bbed;
1788
- border-radius: 50%;
1789
- transform: translateX(-50%);
1790
- }
1791
-
1792
- .lvc-month-panel-footer {
1793
- border-top: 1px solid rgba(255, 255, 255, 0.05);
1794
- margin-top: 1vmin;
1795
- padding-top: 1vmin;
1796
- display: flex;
1797
- justify-content: space-between;
1798
- align-items: center;
1799
- gap: 1vmin;
1800
- }
1801
-
1802
- .lvc-month-right-actions {
1803
- display: flex;
1804
- gap: 1vmin;
1805
- }
1806
-
1807
- .lvc-month-action-btn {
1808
- font-size: 1.662vmin;
1809
- cursor: pointer;
1810
- padding: 0.554vmin 1.662vmin;
1811
- border-radius: 0.5vmin;
1812
- transition: all 0.2s;
1813
- }
1814
-
1815
- .lvc-month-action-btn.is-outline {
1816
- border: 1px solid #1e4469;
1817
- color: #8ab4d4;
1818
- }
1819
-
1820
- .lvc-month-action-btn.is-outline:hover {
1821
- border-color: #12bbed;
1822
- color: #12bbed;
1823
- }
1824
-
1825
- .lvc-month-action-btn.is-primary {
1826
- background: #12bbed;
1827
- color: #fff;
1828
- }
1829
-
1830
- .lvc-month-action-btn.is-primary:hover {
1831
- background: #0ea8d4;
1832
- }
1833
-
1834
- .lvc-month-fade-enter-active,
1835
- .lvc-month-fade-leave-active {
1836
- transition: opacity 0.25s cubic-bezier(0.23, 1, 0.32, 1), transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
1837
- }
1838
-
1839
- .lvc-month-fade-enter,
1840
- .lvc-month-fade-leave-to {
1841
- opacity: 0;
1842
- transform: translateY(1.662vmin) scale(0.98);
1843
- }
1844
- `, document.getElementById("lvc-month-picker-style") || document.head.appendChild(t);
1845
- })();
1846
- const vt = `
1847
- <div class="lvc-month-picker" ref="pickerContainer">
1848
- <div class="lvc-month-input-wrapper" :class="{ 'is-active': isPanelOpen }" @click="handleTogglePanel">
1849
- <template v-if="isRangeMode">
1850
- <input class="lvc-month-inner-input" readonly :value="displayValues[0]" :placeholder="startPlaceholder" />
1851
- <span class="lvc-month-separator">{{ rangeSeparator }}</span>
1852
- <input class="lvc-month-inner-input" readonly :value="displayValues[1]" :placeholder="endPlaceholder" />
1853
- </template>
1854
- <template v-else>
1855
- <input class="lvc-month-inner-input" readonly :value="displayValue" :placeholder="singlePlaceholder" />
1856
- </template>
1857
- <span class="lvc-month-icon-arrow" :style="{ transform: isPanelOpen ? 'rotate(180deg)' : 'none' }">▼</span>
1858
- </div>
1859
- </div>
1860
- `;
1861
- let K = [], gt = 0;
1862
- const yt = {
1863
- name: "lvcMonthPicker",
1864
- props: {
1865
- value: {
1866
- type: [String, Array],
1867
- default: ""
1868
- },
1869
- type: {
1870
- // month(选择月份), monthrange(选择月份范围)
1871
- type: String,
1872
- default: "month"
1873
- },
1874
- rangeSeparator: {
1875
- type: String,
1876
- default: "至"
1877
- },
1878
- // 单选模式下的占位符
1879
- singlePlaceholder: {
1880
- type: String,
1881
- default: "请选择月份"
1882
- },
1883
- startPlaceholder: {
1884
- type: String,
1885
- default: "开始月份"
1886
- },
1887
- endPlaceholder: {
1888
- type: String,
1889
- default: "结束月份"
1890
- }
1891
- },
1892
- template: vt,
1893
- data() {
1894
- const t = /* @__PURE__ */ new Date(), e = this.type === "monthrange";
1895
- let i, r;
1896
- if (this.value)
1897
- if (e) {
1898
- const n = Array.isArray(this.value) ? this.value : ["", ""];
1899
- if (n[0]) {
1900
- const s = new Date(n[0]);
1901
- i = s.getFullYear(), r = s.getMonth() + 1;
1902
- } else
1903
- i = t.getFullYear(), r = t.getMonth() + 1;
1904
- } else {
1905
- const n = new Date(this.value);
1906
- i = n.getFullYear(), r = n.getMonth() + 1;
1907
- }
1908
- else
1909
- i = t.getFullYear(), r = t.getMonth() + 1;
1910
- return {
1911
- isPanelOpen: !1,
1912
- currentYear: i,
1913
- currentYearNow: t.getFullYear(),
1914
- currentMonth: t.getMonth() + 1,
1915
- selectedYear: i,
1916
- selectedMonth: r,
1917
- tempYear: i,
1918
- tempMonth: r,
1919
- // 范围模式相关
1920
- tempStartYear: i,
1921
- tempStartMonth: r,
1922
- tempEndYear: i,
1923
- tempEndMonth: r,
1924
- selectingRangePart: "start",
1925
- // hover 预览
1926
- hoverMonth: null,
1927
- panelElement: null,
1928
- overlayElement: null,
1929
- monthPickerId: `lvc-month-picker-${++gt}`
1930
- };
1931
- },
1932
- watch: {
1933
- value(t) {
1934
- if (this.isRangeMode) {
1935
- const e = Array.isArray(t) ? t : ["", ""];
1936
- if (e[0]) {
1937
- const i = new Date(e[0]);
1938
- this.tempStartYear = i.getFullYear(), this.tempStartMonth = i.getMonth() + 1;
1939
- }
1940
- if (e[1]) {
1941
- const i = new Date(e[1]);
1942
- this.tempEndYear = i.getFullYear(), this.tempEndMonth = i.getMonth() + 1;
1943
- }
1944
- } else if (t) {
1945
- const e = new Date(t), i = e.getFullYear(), r = e.getMonth() + 1;
1946
- this.tempYear = i, this.tempMonth = r, this.selectedYear = i, this.selectedMonth = r;
1947
- }
1948
- }
1949
- },
1950
- computed: {
1951
- isRangeMode() {
1952
- return this.type === "monthrange";
1953
- },
1954
- displayValue() {
1955
- return this.value || "";
1956
- },
1957
- displayValues() {
1958
- return Array.isArray(this.value) ? [this.value[0] || "", this.value[1] || ""] : ["", ""];
1959
- }
1960
- },
1961
- mounted() {
1962
- this._onDocClick = (t) => {
1963
- this.clickOutside(t);
1964
- }, document.addEventListener("click", this._onDocClick);
1965
- },
1966
- beforeDestroy() {
1967
- document.removeEventListener("click", this._onDocClick), this.closePanel();
1968
- },
1969
- methods: {
1970
- _parseValue(t) {
1971
- if (!t) {
1972
- const i = /* @__PURE__ */ new Date();
1973
- return { year: i.getFullYear(), month: i.getMonth() + 1 };
1974
- }
1975
- const e = t.split("-");
1976
- return { year: parseInt(e[0]), month: parseInt(e[1]) };
1977
- },
1978
- handleTogglePanel() {
1979
- this.isPanelOpen ? this.closePanel() : (this.closeOtherMonthPickers(), this.openPanel());
1980
- },
1981
- openPanel() {
1982
- this.isPanelOpen = !0, K.push(this), this.syncInternalStateFromValue(), this.$nextTick(() => {
1983
- this.createPanel();
1984
- });
1985
- },
1986
- syncInternalStateFromValue() {
1987
- if (this.isRangeMode) {
1988
- const t = Array.isArray(this.value) ? this.value : ["", ""];
1989
- if (t[0]) {
1990
- const e = new Date(t[0]);
1991
- this.tempStartYear = e.getFullYear(), this.tempStartMonth = e.getMonth() + 1, this.currentYear = this.tempStartYear;
1992
- } else {
1993
- const e = /* @__PURE__ */ new Date();
1994
- this.tempStartYear = e.getFullYear(), this.tempStartMonth = e.getMonth() + 1, this.currentYear = this.tempStartYear;
1995
- }
1996
- if (t[1]) {
1997
- const e = new Date(t[1]);
1998
- this.tempEndYear = e.getFullYear(), this.tempEndMonth = e.getMonth() + 1;
1999
- } else
2000
- this.tempEndYear = this.tempStartYear, this.tempEndMonth = this.tempStartMonth;
2001
- this.selectingRangePart = "start";
2002
- } else {
2003
- const t = this._parseValue(this.value);
2004
- this.tempYear = t.year, this.tempMonth = t.month, this.currentYear = this.tempYear, this.selectedYear = this.tempYear, this.selectedMonth = this.tempMonth;
2005
- }
2006
- },
2007
- closePanel() {
2008
- this.isPanelOpen = !1, K = K.filter((t) => t.monthPickerId !== this.monthPickerId), this.removePanel();
2009
- },
2010
- closeOtherMonthPickers() {
2011
- K.forEach((t) => {
2012
- t.monthPickerId !== this.monthPickerId && t.closePanel();
2013
- });
2014
- },
2015
- createPanel() {
2016
- if (this.panelElement && document.body.contains(this.panelElement)) {
2017
- this.updatePanelContent(), this.updatePanelPosition();
2018
- return;
2019
- }
2020
- this.removePanel(), this.panelElement = document.createElement("div"), this.panelElement.className = "lvc-month-panel", this.panelElement.style.position = "fixed", this.panelElement.style.zIndex = "9999", this.panelElement.style.opacity = "0", this.panelElement.style.transform = "translateX(-50%) translateY(1.662vmin) scale(0.98)", this.panelElement.style.transition = "opacity 0.25s cubic-bezier(0.23, 1, 0.32, 1), transform 0.25s cubic-bezier(0.23, 1, 0.32, 1)", this.panelElement.style.background = "#0b1a2a", this.panelElement.style.border = "1px solid #12bbed", this.panelElement.style.boxShadow = "0 1.2vmin 3.5vmin rgba(0, 0, 0, 0.7)", this.panelElement.style.borderRadius = "1vmin", this.panelElement.style.padding = "1.5vmin", this.panelElement.style.minWidth = "28vmin", this.panelElement.addEventListener("click", (t) => {
2021
- t.stopPropagation();
2022
- }), this.panelElement.innerHTML = this.generatePanelContent(), document.body.appendChild(this.panelElement), this.overlayElement = document.createElement("div"), this.overlayElement.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;z-index:9998;", this.overlayElement.addEventListener("click", () => {
2023
- this.closePanel();
2024
- }), document.body.appendChild(this.overlayElement), this.updatePanelPosition(), this.addEventListeners(), setTimeout(() => {
2025
- this.panelElement.style.opacity = "1", this.panelElement.style.transform = "translateX(-50%) translateY(0) scale(1)";
2026
- }, 10), this.bindPanelEvents();
2027
- },
2028
- updatePanelContent() {
2029
- this.panelElement && (this.panelElement.innerHTML = this.generatePanelContent(), this.bindPanelEvents());
2030
- },
2031
- generatePanelContent() {
2032
- return `
2033
- <div class="lvc-month-panel-header">
2034
- <span class="lvc-month-nav-btn" data-direction="-1">◀</span>
2035
- <span>${this.currentYear}年</span>
2036
- <span class="lvc-month-nav-btn" data-direction="1">▶</span>
2037
- </div>
2038
- <div class="lvc-month-grid">
2039
- ${Array.from({ length: 12 }, (t, e) => {
2040
- const i = e + 1, r = this.getMonthCellClasses(i);
2041
- return `<span class="${Object.entries(r).filter(([s, a]) => a).map(([s, a]) => s).join(" ")}" data-month="${i}">${i}月</span>`;
2042
- }).join("")}
2043
- </div>
2044
- <div class="lvc-month-panel-footer">
2045
- <span class="lvc-month-action-btn is-outline" data-action="clear">清空</span>
2046
- <div class="lvc-month-right-actions">
2047
- <span class="lvc-month-action-btn is-outline" data-action="cancel">取消</span>
2048
- <span class="lvc-month-action-btn is-primary" data-action="confirm">确定</span>
2049
- </div>
2050
- </div>
2051
- `;
2052
- },
2053
- getMonthCellClasses(t) {
2054
- let i = { "lvc-month-cell": !0, "is-current": t === this.currentMonth && this.currentYear === this.currentYearNow };
2055
- if (this.isRangeMode) {
2056
- const r = `${this.tempStartYear}-${String(this.tempStartMonth).padStart(2, "0")}`, n = `${this.tempEndYear}-${String(this.tempEndMonth).padStart(2, "0")}`, s = `${this.currentYear}-${String(t).padStart(2, "0")}`, a = this.tempStartYear !== null, l = this.tempEndYear !== null;
2057
- i["is-active"] = a && s === r || l && s === n, i["is-in-range"] = a && l && s > r && s < n, i["is-range-start"] = a && s === r, i["is-range-end"] = l && s === n;
2058
- } else
2059
- i["is-active"] = this.tempMonth === t && this.currentYear === this.tempYear;
2060
- return i;
2061
- },
2062
- bindPanelEvents() {
2063
- if (!this.panelElement) return;
2064
- this.panelElement.querySelectorAll(".lvc-month-nav-btn").forEach((r) => {
2065
- const n = parseInt(r.dataset.direction);
2066
- r.addEventListener("click", (s) => {
2067
- s.stopPropagation(), n === -1 ? this.prevYear() : this.nextYear();
2068
- });
2069
- }), this.panelElement.querySelectorAll(".lvc-month-cell").forEach((r) => {
2070
- const n = parseInt(r.dataset.month);
2071
- r.addEventListener("click", (s) => {
2072
- s.stopPropagation(), this.selectMonth(n);
2073
- }), this.isRangeMode && (r.addEventListener("mouseenter", (s) => {
2074
- this.selectingRangePart === "end" && this.tempStartYear && (this.hoverMonth = `${this.currentYear}-${String(n).padStart(2, "0")}`, this.updateHoverRangeStyle());
2075
- }), r.addEventListener("mouseleave", (s) => {
2076
- this.hoverMonth && (this.hoverMonth = null, this.clearHoverRangeStyle());
2077
- }));
2078
- }), this.panelElement.querySelectorAll(".lvc-month-action-btn").forEach((r) => {
2079
- const n = r.dataset.action;
2080
- r.addEventListener("click", (s) => {
2081
- switch (s.stopPropagation(), n) {
2082
- case "clear":
2083
- this.handleClear();
2084
- break;
2085
- case "cancel":
2086
- this.handleCancel();
2087
- break;
2088
- case "confirm":
2089
- this.handleConfirm();
2090
- break;
2091
- }
2092
- });
2093
- });
2094
- },
2095
- updatePanelPosition() {
2096
- const t = this.$el.querySelector(".lvc-month-input-wrapper");
2097
- if (t && this.panelElement) {
2098
- const e = t.getBoundingClientRect();
2099
- let i = e.bottom + 0.1385, r = e.left + e.width / 2;
2100
- const n = window.innerHeight, s = window.innerWidth, a = this.panelElement.getBoundingClientRect();
2101
- i + a.height > n && (i = e.top - a.height - 0.1385, i < 0 && (i = e.bottom + 0.1385, this.panelElement.style.maxHeight = `${n - i - 0.1731}px`));
2102
- const l = a.width / 2;
2103
- r - l < 0 ? r = l + 0.1731 : r + l > s && (r = s - l - 0.1731), this.panelElement.style.top = `${i}px`, this.panelElement.style.left = `${r}px`;
2104
- }
2105
- },
2106
- updateHoverRangeStyle() {
2107
- if (!this.panelElement || !this.hoverMonth || !this.tempStartYear) return;
2108
- const t = `${this.tempStartYear}-${String(this.tempStartMonth).padStart(2, "0")}`, e = this.hoverMonth, i = t < e ? t : e, r = t < e ? e : t;
2109
- this.panelElement.querySelectorAll(".lvc-month-cell").forEach((s) => {
2110
- const a = parseInt(s.dataset.month), l = `${this.currentYear}-${String(a).padStart(2, "0")}`;
2111
- l > i && l < r ? s.classList.add("is-in-hover-range") : s.classList.remove("is-in-hover-range");
2112
- });
2113
- },
2114
- clearHoverRangeStyle() {
2115
- if (!this.panelElement) return;
2116
- this.panelElement.querySelectorAll(".lvc-month-cell.is-in-hover-range").forEach((e) => e.classList.remove("is-in-hover-range"));
2117
- },
2118
- addEventListeners() {
2119
- this.handleScroll = this.updatePanelPosition.bind(this), this.handleResize = this.updatePanelPosition.bind(this), window.addEventListener("scroll", this.handleScroll, !0), window.addEventListener("resize", this.handleResize);
2120
- },
2121
- removeEventListeners() {
2122
- this.handleScroll && window.removeEventListener("scroll", this.handleScroll, !0), this.handleResize && window.removeEventListener("resize", this.handleResize);
2123
- },
2124
- removePanel() {
2125
- this.removeEventListeners(), this.overlayElement && this.overlayElement.parentNode && (document.body.removeChild(this.overlayElement), this.overlayElement = null), this.panelElement && this.panelElement.parentNode && (document.body.removeChild(this.panelElement), this.panelElement = null);
2126
- },
2127
- prevYear() {
2128
- this.currentYear--, this.updatePanelContent();
2129
- },
2130
- nextYear() {
2131
- this.currentYear++, this.updatePanelContent();
2132
- },
2133
- selectMonth(t) {
2134
- if (this.hoverMonth = null, this.isRangeMode) {
2135
- const e = `${this.currentYear}-${String(t).padStart(2, "0")}`, i = this.tempStartYear ? `${this.tempStartYear}-${String(this.tempStartMonth).padStart(2, "0")}` : "", r = !!this.tempStartYear, n = !!this.tempEndYear;
2136
- if (this.selectingRangePart === "start" || r && n ? (this.tempStartYear = this.currentYear, this.tempStartMonth = t, this.tempEndYear = null, this.tempEndMonth = null, this.selectingRangePart = "end") : (e < i ? (this.tempEndYear = this.tempStartYear, this.tempEndMonth = this.tempStartMonth, this.tempStartYear = this.currentYear, this.tempStartMonth = t) : (this.tempEndYear = this.currentYear, this.tempEndMonth = t), this.selectingRangePart = "start"), this.tempStartYear && this.tempEndYear) {
2137
- const s = `${this.tempStartYear}-${String(this.tempStartMonth).padStart(2, "0")}`, a = `${this.tempEndYear}-${String(this.tempEndMonth).padStart(2, "0")}`;
2138
- this.$emit("input", [s, a]);
2139
- } else if (this.tempStartYear) {
2140
- const s = `${this.tempStartYear}-${String(this.tempStartMonth).padStart(2, "0")}`;
2141
- this.$emit("input", [s, ""]);
2142
- }
2143
- } else {
2144
- this.tempMonth = t, this.tempYear = this.currentYear;
2145
- const e = String(this.tempMonth).padStart(2, "0"), i = `${this.tempYear}-${e}`;
2146
- this.$emit("input", i);
2147
- }
2148
- this.updatePanelContent();
2149
- },
2150
- handleClear() {
2151
- this.isRangeMode ? (this.$emit("input", ["", ""]), this.tempStartYear = null, this.tempStartMonth = null, this.tempEndYear = null, this.tempEndMonth = null, this.selectingRangePart = "start") : (this.$emit("input", ""), this.tempYear = null, this.tempMonth = null), this.isPanelOpen && this.updatePanelContent();
2152
- },
2153
- handleCancel() {
2154
- this.closePanel();
2155
- },
2156
- handleConfirm() {
2157
- if (this.isRangeMode) {
2158
- if (this.tempStartYear && this.tempEndYear) {
2159
- const t = `${this.tempStartYear}-${String(this.tempStartMonth).padStart(2, "0")}`, e = `${this.tempEndYear}-${String(this.tempEndMonth).padStart(2, "0")}`;
2160
- this.$emit("input", [t, e]), this.$emit("confirm", [t, e]);
2161
- }
2162
- } else {
2163
- const t = String(this.tempMonth).padStart(2, "0"), e = `${this.tempYear}-${t}`;
2164
- this.$emit("input", e), this.$emit("confirm", e);
2165
- }
2166
- this.closePanel();
2167
- },
2168
- clickOutside(t) {
2169
- const e = this.$refs.pickerContainer;
2170
- e && !e.contains(t.target) && (!this.panelElement || !this.panelElement.contains(t.target)) && this.closePanel();
2171
- }
2172
- }
2173
- };
2174
- Vue.component("lvc-month-picker", yt);
2175
- const bt = z.options.components["lvc-month-picker"];
2176
- (function() {
2177
- const t = document.createElement("style");
2178
- t.id = "lvc-year-picker-style", t.textContent = `
2179
- .lvc-year-picker {
2180
- position: relative;
2181
- display: inline-block;
2182
- font-size: 1.8vmin;
2183
- color: #fff;
2184
- user-select: none;
2185
- height: 100%;
2186
- }
2187
-
2188
- .lvc-year-input-wrapper {
2189
- background: #0d2339;
2190
- border: 1px solid #1e4469;
2191
- border-radius: 0.8vmin;
2192
- padding: 0.6vmin 1vmin;
2193
- cursor: pointer;
2194
- display: flex;
2195
- align-items: center;
2196
- gap: 0.8vmin;
2197
- min-width: 10vmin;
2198
- transition: all 0.3s;
2199
- height: 100%;
2200
- }
2201
-
2202
- .lvc-year-separator {
2203
- color: #5d758c;
2204
- font-size: 1.385vmin;
2205
- flex-shrink: 0;
2206
- }
2207
-
2208
- .lvc-year-input-wrapper:hover,
2209
- .lvc-year-input-wrapper.is-active {
2210
- border-color: #12bbed;
2211
- box-shadow: 0 0 1.2vmin rgba(18, 187, 237, 0.3);
2212
- }
2213
-
2214
- .lvc-year-inner-input {
2215
- background: transparent;
2216
- border: none;
2217
- color: #fff;
2218
- outline: none;
2219
- width: 100%;
2220
- text-align: center;
2221
- cursor: pointer;
2222
- font-size: 1.3vmin;
2223
- }
2224
-
2225
- .lvc-year-icon-arrow {
2226
- color: #12bbed;
2227
- font-size: 1.385vmin;
2228
- transition: transform 0.3s;
2229
- }
2230
-
2231
- .lvc-year-panel {
2232
- position: absolute;
2233
- top: 5vmin;
2234
- left: 50%;
2235
- transform: translateX(-50%);
2236
- background: #0b1a2a;
2237
- border: 1px solid #12bbed;
2238
- box-shadow: 0 1.2vmin 3.5vmin rgba(0, 0, 0, 0.7);
2239
- border-radius: 1vmin;
2240
- padding: 1.5vmin;
2241
- z-index: 9999;
2242
- min-width: 24vmin;
2243
- }
2244
-
2245
- .lvc-year-panel-header {
2246
- display: flex;
2247
- justify-content: space-between;
2248
- align-items: center;
2249
- margin-bottom: 1vmin;
2250
- color: #12bbed;
2251
- font-size: 1.6vmin;
2252
- }
2253
-
2254
- .lvc-year-nav-btn {
2255
- cursor: pointer;
2256
- padding: 0.3vmin 0.8vmin;
2257
- font-size: 1.4vmin;
2258
- color: #12bbed;
2259
- transition: color 0.2s;
2260
- }
2261
-
2262
- .lvc-year-nav-btn:hover {
2263
- color: #fff;
2264
- }
2265
-
2266
- .lvc-year-grid {
2267
- display: grid;
2268
- grid-template-columns: repeat(4, 1fr);
2269
- }
2270
-
2271
- .lvc-year-cell {
2272
- position: relative;
2273
- height: 4.5vmin;
2274
- width: 6.5vmin;
2275
- line-height: 4.5vmin;
2276
- text-align: center;
2277
- font-size: 1.662vmin;
2278
- cursor: pointer;
2279
- border-radius: 0.5vmin;
2280
- color: #8ab4d4;
2281
- transition: all 0.2s;
2282
- }
2283
-
2284
- .lvc-year-cell:hover {
2285
- background: rgba(18, 187, 237, 0.2);
2286
- color: #fff;
2287
- }
2288
-
2289
- .lvc-year-cell.is-active {
2290
- background: #12bbed;
2291
- color: #fff;
2292
- font-weight: bold;
2293
- }
2294
-
2295
- .lvc-year-cell.is-in-range {
2296
- background: rgba(18, 187, 237, 0.15);
2297
- color: #12bbed;
2298
- border-radius: 0;
2299
- }
2300
-
2301
- .lvc-year-cell.is-in-hover-range {
2302
- background: rgba(18, 187, 237, 0.25);
2303
- color: #fff;
2304
- border-radius: 0;
2305
- }
2306
-
2307
- .lvc-year-cell.is-current::after {
2308
- content: "";
2309
- position: absolute;
2310
- bottom: 0.5vmin;
2311
- left: 50%;
2312
- width: 0.6vmin;
2313
- height: 0.4vmin;
2314
- background: #12bbed;
2315
- border-radius: 50%;
2316
- transform: translateX(-50%);
2317
- }
2318
-
2319
- .lvc-year-panel-footer {
2320
- border-top: 1px solid rgba(255, 255, 255, 0.05);
2321
- margin-top: 1vmin;
2322
- padding-top: 1vmin;
2323
- display: flex;
2324
- justify-content: space-between;
2325
- align-items: center;
2326
- gap: 1vmin;
2327
- }
2328
-
2329
- .lvc-year-right-actions {
2330
- display: flex;
2331
- gap: 1vmin;
2332
- }
2333
-
2334
- .lvc-year-action-btn {
2335
- font-size: 1.662vmin;
2336
- cursor: pointer;
2337
- padding: 0.554vmin 1.662vmin;
2338
- border-radius: 0.5vmin;
2339
- transition: all 0.2s;
2340
- }
2341
-
2342
- .lvc-year-action-btn.is-outline {
2343
- border: 1px solid #1e4469;
2344
- color: #8ab4d4;
2345
- }
2346
-
2347
- .lvc-year-action-btn.is-outline:hover {
2348
- border-color: #12bbed;
2349
- color: #12bbed;
2350
- }
2351
-
2352
- .lvc-year-action-btn.is-primary {
2353
- background: #12bbed;
2354
- color: #fff;
2355
- }
2356
-
2357
- .lvc-year-action-btn.is-primary:hover {
2358
- background: #0ea8d4;
2359
- }
2360
-
2361
- .lvc-year-fade-enter-active,
2362
- .lvc-year-fade-leave-active {
2363
- transition: opacity 0.25s cubic-bezier(0.23, 1, 0.32, 1), transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
2364
- }
2365
-
2366
- .lvc-year-fade-enter,
2367
- .lvc-year-fade-leave-to {
2368
- opacity: 0;
2369
- transform: translateY(1.662vmin) scale(0.98);
2370
- }
2371
- `, document.getElementById("lvc-year-picker-style") || document.head.appendChild(t);
2372
- })();
2373
- const wt = `
2374
- <div class="lvc-year-picker" ref="pickerContainer">
2375
- <div class="lvc-year-input-wrapper" :class="{ 'is-active': isPanelOpen }" @click="handleTogglePanel">
2376
- <template v-if="isRangeMode">
2377
- <input class="lvc-year-inner-input" readonly :value="displayValues[0]" placeholder="开始年份" />
2378
- <span class="lvc-year-separator">{{ rangeSeparator }}</span>
2379
- <input class="lvc-year-inner-input" readonly :value="displayValues[1]" placeholder="结束年份" />
2380
- </template>
2381
- <template v-else>
2382
- <input class="lvc-year-inner-input" readonly :value="displayValue" placeholder="请选择年份" />
2383
- </template>
2384
- <span class="lvc-year-icon-arrow" :style="{ transform: isPanelOpen ? 'rotate(180deg)' : 'none' }">▼</span>
2385
- </div>
2386
- </div>
2387
- `;
2388
- let q = [], kt = 0;
2389
- const Et = {
2390
- name: "lvcYearPicker",
2391
- props: {
2392
- value: {
2393
- type: [String, Array],
2394
- default: ""
2395
- },
2396
- yearRange: {
2397
- type: Number,
2398
- default: 5
2399
- },
2400
- type: {
2401
- // year(选择年份), yearrange(选择年份范围)
2402
- type: String,
2403
- default: "year"
2404
- },
2405
- rangeSeparator: {
2406
- type: String,
2407
- default: "至"
2408
- }
2409
- },
2410
- template: wt,
2411
- data() {
2412
- const t = /* @__PURE__ */ new Date(), e = this.type === "yearrange";
2413
- let i;
2414
- if (this.value)
2415
- if (e) {
2416
- const r = Array.isArray(this.value) ? this.value : ["", ""];
2417
- i = r[0] ? parseInt(r[0]) : t.getFullYear();
2418
- } else
2419
- i = parseInt(this.value);
2420
- else
2421
- i = t.getFullYear();
2422
- return {
2423
- isPanelOpen: !1,
2424
- currentYear: i,
2425
- currentYearNow: t.getFullYear(),
2426
- tempYear: i,
2427
- rangeStart: i - this.yearRange,
2428
- // 范围模式相关
2429
- tempStartYear: i,
2430
- tempEndYear: i,
2431
- selectingRangePart: "start",
2432
- // hover 预览
2433
- hoverYear: null,
2434
- panelElement: null,
2435
- overlayElement: null,
2436
- yearPickerId: `lvc-year-picker-${++kt}`
2437
- };
2438
- },
2439
- computed: {
2440
- isRangeMode() {
2441
- return this.type === "yearrange";
2442
- },
2443
- displayValue() {
2444
- return this.value || "";
2445
- },
2446
- displayValues() {
2447
- return Array.isArray(this.value) ? [this.value[0] || "", this.value[1] || ""] : ["", ""];
2448
- },
2449
- yearList() {
2450
- const t = [];
2451
- for (let e = 0; e < this.yearRange * 2 + 1; e++)
2452
- t.push(this.rangeStart + e);
2453
- return t;
2454
- },
2455
- displayRange() {
2456
- const t = this.rangeStart, e = this.rangeStart + this.yearRange * 2;
2457
- return `${t} - ${e}`;
2458
- }
2459
- },
2460
- mounted() {
2461
- this._onDocClick = (t) => {
2462
- this.clickOutside(t);
2463
- }, document.addEventListener("click", this._onDocClick);
2464
- },
2465
- beforeDestroy() {
2466
- document.removeEventListener("click", this._onDocClick), this.closePanel();
2467
- },
2468
- watch: {
2469
- value(t) {
2470
- if (this.isRangeMode) {
2471
- const e = Array.isArray(t) ? t : ["", ""];
2472
- e[0] && (this.tempStartYear = parseInt(e[0])), e[1] && (this.tempEndYear = parseInt(e[1]));
2473
- } else t && (this.tempYear = parseInt(t));
2474
- }
2475
- },
2476
- methods: {
2477
- handleTogglePanel() {
2478
- this.isPanelOpen ? this.closePanel() : (this.closeOtherYearPickers(), this.openPanel());
2479
- },
2480
- openPanel() {
2481
- this.isPanelOpen = !0, q.push(this), this.syncInternalStateFromValue(), this.$nextTick(() => {
2482
- this.createPanel();
2483
- });
2484
- },
2485
- syncInternalStateFromValue() {
2486
- if (this.isRangeMode) {
2487
- const t = Array.isArray(this.value) ? this.value : ["", ""];
2488
- t[0] ? this.tempStartYear = parseInt(t[0]) : this.tempStartYear = (/* @__PURE__ */ new Date()).getFullYear(), t[1] ? this.tempEndYear = parseInt(t[1]) : this.tempEndYear = this.tempStartYear, this.currentYear = this.tempStartYear, this.rangeStart = this.currentYear - this.yearRange, this.selectingRangePart = "start";
2489
- } else {
2490
- const t = this.value ? parseInt(this.value) : (/* @__PURE__ */ new Date()).getFullYear();
2491
- this.tempYear = t, this.currentYear = this.tempYear, this.rangeStart = this.currentYear - this.yearRange;
2492
- }
2493
- },
2494
- closePanel() {
2495
- this.isPanelOpen = !1, q = q.filter((t) => t.yearPickerId !== this.yearPickerId), this.removePanel();
2496
- },
2497
- closeOtherYearPickers() {
2498
- q.forEach((t) => {
2499
- t.yearPickerId !== this.yearPickerId && t.closePanel();
2500
- });
2501
- },
2502
- createPanel() {
2503
- if (this.panelElement && document.body.contains(this.panelElement)) {
2504
- this.updatePanelContent(), this.updatePanelPosition();
2505
- return;
2506
- }
2507
- this.removePanel(), this.panelElement = document.createElement("div"), this.panelElement.className = "lvc-year-panel", this.panelElement.style.position = "fixed", this.panelElement.style.zIndex = "9999", this.panelElement.style.opacity = "0", this.panelElement.style.transform = "translateX(-50%) translateY(1.662vmin) scale(0.98)", this.panelElement.style.transition = "opacity 0.25s cubic-bezier(0.23, 1, 0.32, 1), transform 0.25s cubic-bezier(0.23, 1, 0.32, 1)", this.panelElement.style.background = "#0b1a2a", this.panelElement.style.border = "1px solid #12bbed", this.panelElement.style.boxShadow = "0 1.2vmin 3.5vmin rgba(0, 0, 0, 0.7)", this.panelElement.style.borderRadius = "1vmin", this.panelElement.style.padding = "1.5vmin", this.panelElement.style.minWidth = "24vmin", this.panelElement.addEventListener("click", (t) => {
2508
- t.stopPropagation();
2509
- }), this.panelElement.innerHTML = this.generatePanelContent(), document.body.appendChild(this.panelElement), this.overlayElement = document.createElement("div"), this.overlayElement.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;z-index:9998;", this.overlayElement.addEventListener("click", () => {
2510
- this.closePanel();
2511
- }), document.body.appendChild(this.overlayElement), this.updatePanelPosition(), this.addEventListeners(), setTimeout(() => {
2512
- this.panelElement.style.opacity = "1", this.panelElement.style.transform = "translateX(-50%) translateY(0) scale(1)";
2513
- }, 10), this.bindPanelEvents();
2514
- },
2515
- updatePanelContent() {
2516
- this.panelElement && (this.panelElement.innerHTML = this.generatePanelContent(), this.bindPanelEvents());
2517
- },
2518
- generatePanelContent() {
2519
- return `
2520
- <div class="lvc-year-panel-header">
2521
- <span class="lvc-year-nav-btn" data-direction="-1">◀</span>
2522
- <span>${this.displayRange}</span>
2523
- <span class="lvc-year-nav-btn" data-direction="1">▶</span>
2524
- </div>
2525
- <div class="lvc-year-grid">
2526
- ${this.yearList.map((t) => {
2527
- const e = this.getYearCellClasses(t);
2528
- return `<span class="${Object.entries(e).filter(([r, n]) => n).map(([r, n]) => r).join(" ")}" data-year="${t}">${t}</span>`;
2529
- }).join("")}
2530
- </div>
2531
- <div class="lvc-year-panel-footer">
2532
- <span class="lvc-year-action-btn is-outline" data-action="clear">清空</span>
2533
- <div class="lvc-year-right-actions">
2534
- <span class="lvc-year-action-btn is-outline" data-action="cancel">取消</span>
2535
- <span class="lvc-year-action-btn is-primary" data-action="confirm">确定</span>
2536
- </div>
2537
- </div>
2538
- `;
2539
- },
2540
- getYearCellClasses(t) {
2541
- let i = { "lvc-year-cell": !0, "is-current": t === this.currentYearNow };
2542
- if (this.isRangeMode) {
2543
- const r = this.tempStartYear !== null, n = this.tempEndYear !== null;
2544
- i["is-active"] = r && t === this.tempStartYear || n && t === this.tempEndYear, i["is-in-range"] = r && n && t > this.tempStartYear && t < this.tempEndYear;
2545
- } else
2546
- i["is-active"] = this.tempYear === t;
2547
- return i;
2548
- },
2549
- bindPanelEvents() {
2550
- if (!this.panelElement) return;
2551
- this.panelElement.querySelectorAll(".lvc-year-nav-btn").forEach((r) => {
2552
- const n = parseInt(r.dataset.direction);
2553
- r.addEventListener("click", (s) => {
2554
- s.stopPropagation(), n === -1 ? this.prevRange() : this.nextRange();
2555
- });
2556
- }), this.panelElement.querySelectorAll(".lvc-year-cell").forEach((r) => {
2557
- const n = parseInt(r.dataset.year);
2558
- r.addEventListener("click", (s) => {
2559
- s.stopPropagation(), this.selectYear(n);
2560
- }), this.isRangeMode && (r.addEventListener("mouseenter", (s) => {
2561
- this.selectingRangePart === "end" && this.tempStartYear && (this.hoverYear = n, this.updateHoverRangeStyle());
2562
- }), r.addEventListener("mouseleave", (s) => {
2563
- this.hoverYear && (this.hoverYear = null, this.clearHoverRangeStyle());
2564
- }));
2565
- }), this.panelElement.querySelectorAll(".lvc-year-action-btn").forEach((r) => {
2566
- const n = r.dataset.action;
2567
- r.addEventListener("click", (s) => {
2568
- switch (s.stopPropagation(), n) {
2569
- case "clear":
2570
- this.handleClear();
2571
- break;
2572
- case "cancel":
2573
- this.handleCancel();
2574
- break;
2575
- case "confirm":
2576
- this.handleConfirm();
2577
- break;
2578
- }
2579
- });
2580
- });
2581
- },
2582
- updatePanelPosition() {
2583
- const t = this.$el.querySelector(".lvc-year-input-wrapper");
2584
- if (t && this.panelElement) {
2585
- const e = t.getBoundingClientRect();
2586
- let i = e.bottom + 0.1385, r = e.left + e.width / 2;
2587
- const n = window.innerHeight, s = window.innerWidth, a = this.panelElement.getBoundingClientRect();
2588
- i + a.height > n && (i = e.top - a.height - 0.1385, i < 0 && (i = e.bottom + 0.1385, this.panelElement.style.maxHeight = `${n - i - 0.1731}px`));
2589
- const l = a.width / 2;
2590
- r - l < 0 ? r = l + 0.1731 : r + l > s && (r = s - l - 0.1731), this.panelElement.style.top = `${i}px`, this.panelElement.style.left = `${r}px`;
2591
- }
2592
- },
2593
- updateHoverRangeStyle() {
2594
- if (!this.panelElement || this.hoverYear === null || this.tempStartYear === null) return;
2595
- const t = this.tempStartYear, e = this.hoverYear, i = Math.min(t, e), r = Math.max(t, e);
2596
- this.panelElement.querySelectorAll(".lvc-year-cell").forEach((s) => {
2597
- const a = parseInt(s.dataset.year);
2598
- a > i && a < r ? s.classList.add("is-in-hover-range") : s.classList.remove("is-in-hover-range");
2599
- });
2600
- },
2601
- clearHoverRangeStyle() {
2602
- if (!this.panelElement) return;
2603
- this.panelElement.querySelectorAll(".lvc-year-cell.is-in-hover-range").forEach((e) => e.classList.remove("is-in-hover-range"));
2604
- },
2605
- addEventListeners() {
2606
- this.handleScroll = this.updatePanelPosition.bind(this), this.handleResize = this.updatePanelPosition.bind(this), window.addEventListener("scroll", this.handleScroll, !0), window.addEventListener("resize", this.handleResize);
2607
- },
2608
- removeEventListeners() {
2609
- this.handleScroll && window.removeEventListener("scroll", this.handleScroll, !0), this.handleResize && window.removeEventListener("resize", this.handleResize);
2610
- },
2611
- removePanel() {
2612
- this.removeEventListeners(), this.overlayElement && this.overlayElement.parentNode && (document.body.removeChild(this.overlayElement), this.overlayElement = null), this.panelElement && this.panelElement.parentNode && (document.body.removeChild(this.panelElement), this.panelElement = null);
2613
- },
2614
- prevRange() {
2615
- this.rangeStart -= this.yearRange * 2 + 1, this.updatePanelContent();
2616
- },
2617
- nextRange() {
2618
- this.rangeStart += this.yearRange * 2 + 1, this.updatePanelContent();
2619
- },
2620
- selectYear(t) {
2621
- if (this.hoverYear = null, this.isRangeMode) {
2622
- const e = this.tempStartYear !== null, i = this.tempEndYear !== null;
2623
- this.selectingRangePart === "start" || e && i ? (this.tempStartYear = t, this.tempEndYear = null, this.selectingRangePart = "end") : (t < this.tempStartYear ? (this.tempEndYear = this.tempStartYear, this.tempStartYear = t) : this.tempEndYear = t, this.selectingRangePart = "start"), this.tempStartYear && this.tempEndYear ? this.$emit("input", [String(this.tempStartYear), String(this.tempEndYear)]) : this.tempStartYear && this.$emit("input", [String(this.tempStartYear), ""]);
2624
- } else {
2625
- this.tempYear = t;
2626
- const e = String(this.tempYear);
2627
- this.$emit("input", e);
2628
- }
2629
- this.updatePanelContent();
2630
- },
2631
- handleClear() {
2632
- this.isRangeMode ? (this.$emit("input", ["", ""]), this.tempStartYear = null, this.tempEndYear = null, this.selectingRangePart = "start") : (this.$emit("input", ""), this.tempYear = null), this.isPanelOpen && this.updatePanelContent();
2633
- },
2634
- handleCancel() {
2635
- this.closePanel();
2636
- },
2637
- handleConfirm() {
2638
- if (this.isRangeMode) {
2639
- if (this.tempStartYear && this.tempEndYear) {
2640
- const t = String(this.tempStartYear), e = String(this.tempEndYear);
2641
- this.$emit("input", [t, e]), this.$emit("confirm", [t, e]), this.$emit("change", [t, e]);
2642
- }
2643
- } else {
2644
- const t = String(this.tempYear);
2645
- this.$emit("input", t), this.$emit("confirm", t), this.$emit("change", t);
2646
- }
2647
- this.closePanel();
2648
- },
2649
- clickOutside(t) {
2650
- const e = this.$refs.pickerContainer;
2651
- e && !e.contains(t.target) && (!this.panelElement || !this.panelElement.contains(t.target)) && this.closePanel();
2652
- }
2653
- }
2654
- };
2655
- Vue.component("lvc-year-picker", Et);
2656
- const St = z.options.components["lvc-year-picker"], le = {
2657
- show(t = {}) {
2658
- typeof t == "string" && (t = { content: t });
2659
- const e = document.createElement("div");
2660
- return document.body.appendChild(e), new z({
2661
- el: e,
2662
- data() {
2663
- return {
2664
- visible: !1,
2665
- title: t.title ?? "提示",
2666
- content: t.content ?? "",
2667
- width: t.width ?? "44.32vmin",
2668
- confirmText: t.confirmText ?? "确定",
2669
- cancelText: t.cancelText ?? "取消",
2670
- showCancel: t.showCancel ?? !0,
2671
- showClose: t.showClose ?? !0,
2672
- showFooter: t.showFooter ?? !0,
2673
- closeOnClickModal: t.closeOnClickModal ?? !0
2674
- };
2675
- },
2676
- template: `
2677
- <lvc-dialog
2678
- :visible.sync="visible"
2679
- :title="title"
2680
- :content="content"
2681
- :width="width"
2682
- :confirm-text="confirmText"
2683
- :cancel-text="cancelText"
2684
- :show-cancel="showCancel"
2685
- :show-close="showClose"
2686
- :show-footer="showFooter"
2687
- :close-on-click-modal="closeOnClickModal"
2688
- @confirm="onConfirmAction"
2689
- @cancel="onCancelAction"
2690
- @close="destroy">
2691
- </lvc-dialog>
2692
- `,
2693
- components: { LvcDialog: we },
2694
- methods: {
2695
- async onConfirmAction() {
2696
- t.onConfirm && await t.onConfirm() === !1 || (this.visible = !1);
2697
- },
2698
- onCancelAction() {
2699
- t.onCancel && t.onCancel();
2700
- },
2701
- destroy() {
2702
- setTimeout(() => {
2703
- this.$destroy(), this.$el && this.$el.parentNode && this.$el.parentNode.removeChild(this.$el);
2704
- }, 500);
2705
- }
2706
- },
2707
- mounted() {
2708
- this.visible = !0;
2709
- }
2710
- });
2711
- }
2712
- };
2713
- function _t(t) {
2714
- t.prototype.$lvcDialog = le, typeof window < "u" && (window.lvcDialog = le);
2715
- }
2716
- const xt = `
2717
- .lvc-message-container {
2718
- position: fixed;
2719
- top: 3vmin;
2720
- left: 50%;
2721
- transform: translateX(-50%);
2722
- display: flex;
2723
- flex-direction: column;
2724
- align-items: center;
2725
- gap: 1.5vmin;
2726
- z-index: 9999999;
2727
- pointer-events: none;
2728
- }
2729
- .lvc-message {
2730
- display: flex;
2731
- align-items: center;
2732
- gap: 1vmin;
2733
- padding: 1vmin 2.5vmin;
2734
- border-radius: 0.5vmin;
2735
- text-align: center;
2736
- font-size: 1.6vmin;
2737
- color: #e0f2fe;
2738
- background: #0d2339;
2739
- border: 1px solid #1e4469;
2740
- box-shadow: 0 0.5vmin 1.5vmin rgba(0, 0, 0, 0.5);
2741
- pointer-events: auto;
2742
- transition: all 0.3s ease-in-out;
2743
- transform: translateY(0);
2744
- opacity: 1;
2745
- user-select: none;
2746
- }
2747
- .lvc-message--info { border-color: #12bbed; }
2748
- .lvc-message--success { border-color: #10b981; color: #10b981; }
2749
- .lvc-message--warning { border-color: #f59e0b; color: #f59e0b; }
2750
- .lvc-message--error { border-color: #ef4444; color: #ef4444; }
2751
- .lvc-message-icon { font-size: 1.6vmin; display: inline-block; }
2752
- .lvc-message-text { color: #e0f2fe; font-weight: 500; }
2753
- .lvc-message-enter,
2754
- .lvc-message-leave { opacity: 0; transform: translateY(-2vmin); }
2755
- `;
2756
- function Ct() {
2757
- if (typeof document > "u" || document.getElementById("lvc-message-style")) return;
2758
- const t = document.createElement("style");
2759
- t.id = "lvc-message-style", t.textContent = xt, document.head.appendChild(t);
2760
- }
2761
- const Y = function(t) {
2762
- typeof t == "string" && (t = { message: t });
2763
- const e = t.type || "info", i = t.message || "", r = t.duration !== void 0 ? t.duration : 2e3;
2764
- Ct();
2765
- const n = Y._container = Y._container || (() => {
2766
- const l = document.createElement("div");
2767
- return l.className = "lvc-message-container", document.body.appendChild(l), l;
2768
- })(), s = document.createElement("div"), a = { info: "ℹ", success: "✔", warning: "⚠", error: "✖" };
2769
- s.innerHTML = `
2770
- <span class="lvc-message-icon">${a[e]}</span>
2771
- <span class="lvc-message-text">${i}</span>
2772
- `, s.className = `lvc-message lvc-message--${e} lvc-message-enter`, n.appendChild(s), requestAnimationFrame(() => s.classList.remove("lvc-message-enter")), r > 0 && setTimeout(() => {
2773
- s.classList.add("lvc-message-leave");
2774
- const l = () => {
2775
- s.parentNode && s.parentNode.removeChild(s), s.removeEventListener("transitionend", l);
2776
- };
2777
- s.addEventListener("transitionend", l), setTimeout(() => {
2778
- s.parentNode && s.parentNode.removeChild(s);
2779
- }, 400);
2780
- }, r);
2781
- };
2782
- ["success", "warning", "info", "error"].forEach((t) => {
2783
- Y[t] = (e) => (typeof e == "string" && (e = { message: e }), e.type = t, Y(e));
2784
- });
2785
- function Pt(t) {
2786
- t.prototype.$lvcMessage = Y, typeof window < "u" && (window.LvcMessage = Y);
2787
- }
2788
- const $t = `
2789
- .lvc-loading-mask {
2790
- position: fixed;
2791
- top: 0; left: 0; right: 0; bottom: 0;
2792
- background-color: rgba(6, 23, 39, 0.8);
2793
- backdrop-filter: blur(2px);
2794
- z-index: 9999998;
2795
- display: flex;
2796
- flex-direction: column;
2797
- align-items: center;
2798
- justify-content: center;
2799
- opacity: 0;
2800
- transition: opacity 0.3s ease-in-out;
2801
- user-select: none;
2802
- }
2803
- .lvc-loading-mask.is-visible { opacity: 1; }
2804
- .lvc-loading-spinner {
2805
- position: relative;
2806
- width: 6vmin;
2807
- height: 6vmin;
2808
- margin-bottom: 2vmin;
2809
- }
2810
- .lvc-loading-spinner::before {
2811
- content: "";
2812
- position: absolute;
2813
- top: 0; left: 0; right: 0; bottom: 0;
2814
- border-radius: 50%;
2815
- border: 0.3vmin solid transparent;
2816
- border-top-color: #12bbed;
2817
- border-bottom-color: #12bbed;
2818
- animation: lvc-spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
2819
- }
2820
- .lvc-loading-spinner::after {
2821
- content: "";
2822
- position: absolute;
2823
- top: 1vmin; left: 1vmin; right: 1vmin; bottom: 1vmin;
2824
- border-radius: 50%;
2825
- border: 0.3vmin solid transparent;
2826
- border-left-color: #7dd3fc;
2827
- border-right-color: #7dd3fc;
2828
- animation: lvc-spin-reverse 1s linear infinite;
2829
- }
2830
- .lvc-loading-text {
2831
- color: #12bbed;
2832
- font-size: 1.6vmin;
2833
- letter-spacing: 0.2vmin;
2834
- font-weight: bold;
2835
- text-shadow: 0 0 0.5vmin rgba(18, 187, 237, 0.5);
2836
- animation: lvc-pulse 2s ease-in-out infinite;
2837
- }
2838
- @keyframes lvc-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
2839
- @keyframes lvc-spin-reverse { 0% { transform: rotate(0deg); } 100% { transform: rotate(-360deg); } }
2840
- @keyframes lvc-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
2841
- `;
2842
- function Mt() {
2843
- if (typeof document > "u" || document.getElementById("lvc-loading-style")) return;
2844
- const t = document.createElement("style");
2845
- t.id = "lvc-loading-style", t.textContent = $t, document.head.appendChild(t);
2846
- }
2847
- const F = {
2848
- show(t = {}) {
2849
- typeof t == "string" && (t = { text: t });
2850
- const e = t.text || "加载中...";
2851
- if (this._instance)
2852
- return this._instance.setText(e), this._instance;
2853
- Mt();
2854
- const i = document.createElement("div");
2855
- i.className = "lvc-loading-mask";
2856
- const r = document.createElement("div");
2857
- r.className = "lvc-loading-spinner";
2858
- const n = document.createElement("div");
2859
- n.className = "lvc-loading-text", n.textContent = e, i.appendChild(r), i.appendChild(n), document.body.appendChild(i), requestAnimationFrame(() => i.classList.add("is-visible"));
2860
- const s = {
2861
- setText(a) {
2862
- n.textContent = a;
2863
- },
2864
- close() {
2865
- if (!i.parentNode) return;
2866
- i.classList.remove("is-visible");
2867
- const a = () => {
2868
- i.parentNode && i.parentNode.removeChild(i), i.removeEventListener("transitionend", a), F._instance = null;
2869
- };
2870
- i.addEventListener("transitionend", a), setTimeout(() => {
2871
- i.parentNode && i.parentNode.removeChild(i), F._instance = null;
2872
- }, 400);
2873
- }
2874
- };
2875
- return this._instance = s, s;
2876
- },
2877
- close() {
2878
- this._instance && this._instance.close();
2879
- }
2880
- };
2881
- function Lt(t) {
2882
- t.prototype.$lvcLoading = F, typeof window < "u" && (window.LvcLoading = F);
2883
- }
2884
- function Tt() {
2885
- try {
2886
- if (window.top && window.top.location.origin === window.location.origin)
2887
- return window.top;
2888
- } catch {
2889
- }
2890
- return window;
2891
- }
2892
- const Rt = function(t) {
2893
- const e = Tt();
2894
- if (e.__BUS__)
2895
- return t.$Bus = e.__BUS__, e.__BUS__;
2896
- const i = {}, r = {}, n = Math.random().toString(36).slice(2), s = "lvc-bus", a = "BroadcastChannel" in t ? new BroadcastChannel(s) : null;
2897
- function l(h, p, v) {
2898
- (i[h] || []).forEach((E) => {
2899
- try {
2900
- E(p, v);
2901
- } catch {
2902
- }
2903
- });
2904
- }
2905
- function d(h) {
2906
- if (t === e) {
2907
- l(h.event, h.data);
2908
- for (let p = 0; p < e.frames.length; p++)
2909
- try {
2910
- e.frames[p].postMessage(h, "*");
2911
- } catch {
2912
- }
2913
- } else
2914
- e.postMessage(h, "*");
2915
- }
2916
- const c = {
2917
- on(h, p) {
2918
- (i[h] || (i[h] = [])).push(p);
2919
- },
2920
- off(h, p) {
2921
- p ? i[h] = (i[h] || []).filter((v) => v !== p) : delete i[h];
2922
- },
2923
- once(h, p) {
2924
- const v = (E) => {
2925
- p(E), c.off(h, v);
2926
- };
2927
- c.on(h, v);
2928
- },
2929
- emit(h, p) {
2930
- const v = { __bus: 1, event: h, data: p, tab: n };
2931
- l(h, p), a && a.postMessage(v);
2932
- try {
2933
- localStorage.setItem(s, JSON.stringify({ ...v, t: Date.now() }));
2934
- } catch {
2935
- }
2936
- d(v);
2937
- },
2938
- request(h, p, v = 5e3) {
2939
- const E = Date.now() + Math.random();
2940
- return new Promise((P, $) => {
2941
- r[E] = P, c.emit("__bus_req__", { id: E, event: h, data: p }), setTimeout(() => {
2942
- r[E] && (delete r[E], $("timeout"));
2943
- }, v);
2944
- });
2945
- }
2946
- };
2947
- return c.on("__bus_req__", async ({ id: h, event: p, data: v }) => {
2948
- var $;
2949
- const E = ($ = i[p]) == null ? void 0 : $[0];
2950
- if (!E) return;
2951
- const P = await E(v);
2952
- c.emit("__bus_res__", { id: h, res: P });
2953
- }), c.on("__bus_res__", ({ id: h, res: p }) => {
2954
- const v = r[h];
2955
- v && (v(p), delete r[h]);
2956
- }), a && (a.onmessage = (h) => {
2957
- const p = h.data;
2958
- p && p.__bus && p.tab !== n && l(p.event, p.data);
2959
- }), t.addEventListener("storage", (h) => {
2960
- if (h.key !== s) return;
2961
- const p = JSON.parse(h.newValue || "{}");
2962
- p.__bus && p.tab !== n && l(p.event, p.data);
2963
- }), t.addEventListener("message", (h) => {
2964
- const p = h.data;
2965
- !p || !p.__bus || (t === e && d(p), l(p.event, p.data));
2966
- }), e.__BUS__ = c, t.$Bus = c, c;
2967
- }(typeof window < "u" ? window : globalThis);
2968
- class Yt {
2969
- constructor(e, i = {}) {
2970
- this.url = e, this.options = {
2971
- heartbeatInterval: 3e4,
2972
- reconnectInterval: 5e3,
2973
- maxReconnectAttempts: 5,
2974
- pingMessage: "ping",
2975
- ...i
2976
- }, this.socket = null, this.reconnectAttempts = 0, this.isManualClose = !1, this.messageQueue = [], this.listeners = /* @__PURE__ */ new Map(), this.heartbeatTimer = null, this.serverTimeoutTimer = null, this.connect();
2977
- }
2978
- connect() {
2979
- if (!(this.socket && (this.socket.readyState === WebSocket.OPEN || this.socket.readyState === WebSocket.CONNECTING)))
2980
- try {
2981
- this.socket = new WebSocket(this.url), this.initEvents();
2982
- } catch (e) {
2983
- console.error("WebSocket 建立失败:", e), this.reconnect();
2984
- }
2985
- }
2986
- initEvents() {
2987
- this.socket.onopen = (e) => {
2988
- console.log("WebSocket 连接成功"), this.reconnectAttempts = 0, this.isManualClose = !1, this.startHeartbeat(), this.flushQueue(), this.emit("open", e);
2989
- }, this.socket.onmessage = (e) => {
2990
- this.resetHeartbeat();
2991
- let i = e.data;
2992
- try {
2993
- i = JSON.parse(e.data);
2994
- } catch {
2995
- }
2996
- const r = i.topic || i.type;
2997
- r && this.emit(r, i), this.emit("message", i);
2998
- }, this.socket.onclose = (e) => {
2999
- this.stopHeartbeat(), this.emit("close", e), this.isManualClose || this.reconnect();
3000
- }, this.socket.onerror = (e) => {
3001
- console.error("WebSocket 异常"), this.emit("error", e);
3002
- };
3003
- }
3004
- send(e) {
3005
- const i = typeof e == "object" ? JSON.stringify(e) : e;
3006
- this.socket && this.socket.readyState === WebSocket.OPEN ? this.socket.send(i) : (console.warn("WebSocket 未连接,消息已进入队列"), this.messageQueue.push(i));
3007
- }
3008
- flushQueue() {
3009
- for (; this.messageQueue.length > 0 && this.socket.readyState === WebSocket.OPEN; ) {
3010
- const e = this.messageQueue.shift();
3011
- this.socket.send(e);
3012
- }
3013
- }
3014
- reconnect() {
3015
- if (this.options.maxReconnectAttempts !== -1 && this.reconnectAttempts >= this.options.maxReconnectAttempts) {
3016
- console.error("WebSocket 重连次数达到上限");
3017
- return;
3018
- }
3019
- this.reconnectAttempts++, console.log(`WebSocket 正在尝试第 ${this.reconnectAttempts} 次重连...`);
3020
- let e = this.options.reconnectInterval * Math.pow(1.5, this.reconnectAttempts - 1);
3021
- e = Math.min(e, 6e4), setTimeout(() => this.connect(), e);
3022
- }
3023
- startHeartbeat() {
3024
- this.heartbeatTimer = setInterval(() => {
3025
- this.send(this.options.pingMessage), this.serverTimeoutTimer = setTimeout(() => {
3026
- console.warn("WebSocket 心跳超时,主动断开重连"), this.socket.close();
3027
- }, this.options.heartbeatInterval / 2);
3028
- }, this.options.heartbeatInterval);
3029
- }
3030
- resetHeartbeat() {
3031
- clearTimeout(this.serverTimeoutTimer);
3032
- }
3033
- stopHeartbeat() {
3034
- clearInterval(this.heartbeatTimer), clearTimeout(this.serverTimeoutTimer);
3035
- }
3036
- close() {
3037
- this.isManualClose = !0, this.stopHeartbeat(), this.socket && this.socket.close();
3038
- }
3039
- on(e, i) {
3040
- this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(i);
3041
- }
3042
- off(e, i) {
3043
- if (!this.listeners.has(e)) return;
3044
- if (!i) {
3045
- this.listeners.delete(e);
3046
- return;
3047
- }
3048
- const r = this.listeners.get(e), n = r.indexOf(i);
3049
- n !== -1 && r.splice(n, 1), r.length === 0 && this.listeners.delete(e);
3050
- }
3051
- emit(e, i) {
3052
- const r = this.listeners.get(e);
3053
- r && r.forEach((n) => n(i));
3054
- }
3055
- }
3056
- class ke {
3057
- constructor(e = {}) {
3058
- this.options = Object.assign(
3059
- {
3060
- lightIcon: "light.png",
3061
- closeLightIcon: "closeLight.png"
3062
- },
3063
- e
3064
- ), this.currentWebview = null, this.barcode = null, this.backVew = null, this.scanTip = null, this.mask = null, this.openLight = null, this.isOpenLight = !1, this._scanReject = null, this._backButtonHandler = this._backButtonHandler.bind(this), this._plusReadyHandler = this._plusReadyHandler.bind(this), this._webviewCloseHandler = this.destroy.bind(this), window.plus ? this._plusReadyHandler() : document.addEventListener("plusready", this._plusReadyHandler, !1);
3065
- }
3066
- _plusReadyHandler() {
3067
- this.currentWebview = plus.webview.currentWebview(), this.currentWebview.addEventListener("close", this._webviewCloseHandler), this.initStaticViews();
3068
- }
3069
- initStaticViews() {
3070
- window.plus && plus.key.hideSoftKeybord && plus.key.hideSoftKeybord(), this.currentWebview && (this.mask || (this.drawMask(), this.currentWebview.append(this.mask)), this.backVew || (this.drawBackView(), this.currentWebview.append(this.backVew)), this.scanTip || (this.drawScanTip(), this.currentWebview.append(this.scanTip)), this.openLight || (this.drawOpenLight(), this.emitOpenLight(), this.currentWebview.append(this.openLight)));
3071
- }
3072
- drawBarcode() {
3073
- this.barcode = plus.barcode.create("barcode", "", {
3074
- top: "0px",
3075
- left: "0px",
3076
- width: "100%",
3077
- height: "100%",
3078
- position: "static"
3079
- }, !0);
3080
- }
3081
- drawMask() {
3082
- this.mask = new plus.nativeObj.View("mask", {
3083
- top: "0px",
3084
- left: "0px",
3085
- height: "100%",
3086
- width: "100%"
3087
- }, [{
3088
- tag: "rect",
3089
- id: "rect",
3090
- color: "rgba(0,0,0,0)",
3091
- position: { top: "0px", left: "0px", width: "100%", height: "100%" }
3092
- }]), this.mask.interceptTouchEvent(!0);
3093
- }
3094
- drawBackView() {
3095
- this.backVew = new plus.nativeObj.View("backVew", {
3096
- top: "22px",
3097
- left: "86%",
3098
- height: "20px",
3099
- width: "40px"
3100
- }, [{
3101
- tag: "font",
3102
- id: "center",
3103
- text: "取消",
3104
- textStyles: { size: "18px", color: "#ffffff", fontWeight: "bold" },
3105
- position: { top: "0px", left: "0px" }
3106
- }]), this.backVew.interceptTouchEvent(!0), this.backVew.addEventListener("click", () => this.cancelScan(), !1);
3107
- }
3108
- drawScanTip() {
3109
- this.scanTip = new plus.nativeObj.View("scanTip", {
3110
- top: "73%",
3111
- left: "0px",
3112
- height: "40px",
3113
- width: "100%"
3114
- }, [{
3115
- tag: "font",
3116
- id: "center2",
3117
- text: "请把扫描区对准二维码/一维码",
3118
- textStyles: { size: "16px", color: "#ffffff", align: "center" },
3119
- position: { top: "0px", left: "0px", width: "100%", height: "wrap_content" }
3120
- }]);
3121
- }
3122
- drawOpenLight() {
3123
- this.openLight = new plus.nativeObj.View("openLight", {
3124
- top: "58%",
3125
- left: "40%",
3126
- height: "10%",
3127
- width: "20%"
3128
- }, this._getLightViewState(this.options.lightIcon, "轻触照亮")), this.openLight.interceptTouchEvent(!0);
3129
- }
3130
- emitOpenLight() {
3131
- this.openLight.addEventListener("click", () => {
3132
- this.isOpenLight = !this.isOpenLight, this.resetDrawOpenLight(), this.barcode && this.barcode.setFlash(this.isOpenLight);
3133
- }, !1);
3134
- }
3135
- resetDrawOpenLight() {
3136
- this.openLight && (this.isOpenLight ? this.openLight.draw(this._getLightViewState(this.options.closeLightIcon, "轻触关闭")) : this.openLight.draw(this._getLightViewState(this.options.lightIcon, "轻触照亮")));
3137
- }
3138
- _getLightViewState(e, i) {
3139
- return [
3140
- { tag: "img", id: "openLight", src: e, position: { width: "28%", left: "36%", height: "30%" } },
3141
- { tag: "font", id: "lightfont", text: i, textStyles: { size: "10px", color: "#ffffff" }, position: { width: "80%", left: "10%" } }
3142
- ];
3143
- }
3144
- _backButtonHandler() {
3145
- this.barcode ? this.cancelScan() : this.currentWebview && this.currentWebview.back();
3146
- }
3147
- emitBackButton() {
3148
- window.plus && (plus.key.removeEventListener("backbutton", this._backButtonHandler), plus.key.addEventListener("backbutton", this._backButtonHandler));
3149
- }
3150
- startScanCode() {
3151
- return new Promise((e, i) => {
3152
- window.plus && plus.key.hideSoftKeybord && plus.key.hideSoftKeybord(), this.initStaticViews(), this.barcode || (this.drawBarcode(), this.currentWebview.append(this.barcode), this.mask && this.currentWebview.append(this.mask), this.scanTip && this.currentWebview.append(this.scanTip), this.backVew && this.currentWebview.append(this.backVew), this.openLight && this.currentWebview.append(this.openLight)), this.emitBackButton(), this.resetDrawOpenLight(), this.barcode && this.mask ? (this._scanReject = i, this.barcode.start(), this.mask.show(), this.scanTip.show(), this.backVew.show(), this.openLight.show(), this.barcode.onmarked = (r, n, s) => {
3153
- this._scanReject = null, this.closeScan(), e({ type: r, result: n, file: s });
3154
- }, this.barcode.onerror = (r) => {
3155
- this._scanReject = null, this.closeScan(), i(r);
3156
- }) : i(new Error("原生扫描组件加载失败"));
3157
- });
3158
- }
3159
- cancelScan() {
3160
- this._scanReject && (this._scanReject(new Error("USER_CANCEL")), this._scanReject = null), this.closeScan();
3161
- }
3162
- closeScan() {
3163
- window.plus && plus.key.removeEventListener("backbutton", this._backButtonHandler), this.barcode && (this.barcode.setFlash(!1), this.barcode.cancel(), this.barcode.close(), this.barcode = null), this.isOpenLight = !1, this.backVew && this.backVew.hide(), this.scanTip && this.scanTip.hide(), this.openLight && this.openLight.hide(), this.mask && this.mask.hide();
3164
- }
3165
- destroy() {
3166
- this.cancelScan(), this.backVew && (this.backVew.close(), this.backVew = null), this.scanTip && (this.scanTip.close(), this.scanTip = null), this.openLight && (this.openLight.close(), this.openLight = null), this.mask && (this.mask.close(), this.mask = null), this.currentWebview && (this.currentWebview.removeEventListener("close", this._webviewCloseHandler), this.currentWebview = null), document.removeEventListener("plusready", this._plusReadyHandler, !1);
3167
- }
3168
- }
3169
- const Ee = {
3170
- isAndroid: () => navigator.userAgent.toLowerCase().indexOf("android") !== -1,
3171
- isIOS: () => !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
3172
- isApp: () => {
3173
- try {
3174
- return JSON.parse(localStorage.getItem("isapp") || "false");
3175
- } catch {
3176
- return !1;
3177
- }
3178
- },
3179
- getQuery: (t) => {
3180
- const e = new RegExp("(^|&)" + t + "=([^&]*)(&|$)"), i = window.location.search.substr(1).match(e);
3181
- return i != null ? decodeURIComponent(i[2]) : null;
3182
- },
3183
- throttle: (t, e = 2500) => {
3184
- let i = null;
3185
- return function(...r) {
3186
- const n = +/* @__PURE__ */ new Date();
3187
- (!i || n - i > e) && (t.apply(this, r), i = n);
3188
- };
3189
- }
3190
- };
3191
- typeof window < "u" && (window.scanBind = { ScanCode: ke, ...Ee });
3192
- class Ot {
3193
- constructor(e, i, r = 1280) {
3194
- this.canvas = document.getElementById(e), this.container = document.querySelector(i), this.ctx = this.canvas.getContext("2d"), this.baseWidth = r, this.scale = 1, this.imgCache = {}, this.dpr = window.devicePixelRatio || 1, this.init();
3195
- }
3196
- init() {
3197
- const e = this.container.clientWidth, i = this.container.clientHeight;
3198
- this.scale = Math.max(0.5, e / this.baseWidth), this.canvas.width = e * this.dpr, this.canvas.height = i * this.dpr, this.canvas.style.width = e + "px", this.canvas.style.height = i + "px", this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.scale(this.dpr, this.dpr);
3199
- }
3200
- s(e) {
3201
- return e * this.scale;
3202
- }
3203
- clear() {
3204
- this.ctx.clearRect(0, 0, this.canvas.width / this.dpr, this.canvas.height / this.dpr);
3205
- }
3206
- _buildPath(e) {
3207
- const i = this.ctx;
3208
- if (!(!e || e.length === 0)) {
3209
- i.beginPath(), i.moveTo(this.s(e[0][0]), this.s(e[0][1]));
3210
- for (let r = 1; r < e.length; r++) {
3211
- const n = e[r];
3212
- n.length === 2 ? i.lineTo(this.s(n[0]), this.s(n[1])) : n.length === 4 ? i.quadraticCurveTo(this.s(n[0]), this.s(n[1]), this.s(n[2]), this.s(n[3])) : n.length === 6 && i.bezierCurveTo(this.s(n[0]), this.s(n[1]), this.s(n[2]), this.s(n[3]), this.s(n[4]), this.s(n[5]));
3213
- }
3214
- }
3215
- }
3216
- drawDashLine(e, i = {}) {
3217
- const { color: r = "rgba(255,255,255,0.2)", width: n = 2, dash: s = [4, 4] } = i, a = this.ctx;
3218
- a.save(), this._buildPath(e), a.setLineDash(s.map((l) => this.s(l))), a.lineWidth = this.s(n), a.strokeStyle = r, a.stroke(), a.restore();
3219
- }
3220
- drawFlowLine(e, i = {}) {
3221
- const {
3222
- color: r = "#00e5ff",
3223
- width: n = 2,
3224
- dash: s = [10, 20],
3225
- offset: a = 0,
3226
- shadowBlur: l = 8,
3227
- shadowColor: d = "#00e5ff"
3228
- } = i, c = this.ctx;
3229
- c.save(), this._buildPath(e), c.setLineDash(s.map((h) => this.s(h))), c.lineDashOffset = -this.s(a), c.lineWidth = this.s(n), c.strokeStyle = r, c.shadowBlur = this.s(l), c.shadowColor = d, c.stroke(), c.restore();
3230
- }
3231
- drawImage(e, i, r, n, s, a = !0) {
3232
- this.imgCache[e] || (this.imgCache[e] = new Image(), this.imgCache[e].src = e);
3233
- const l = this.imgCache[e];
3234
- if (l.complete) {
3235
- const d = this.s(n), c = this.s(s), h = a ? this.s(i) - d / 2 : this.s(i), p = a ? this.s(r) - c / 2 : this.s(r);
3236
- this.ctx.drawImage(l, h, p, d, c);
3237
- }
3238
- }
3239
- drawText(e, i, r, n = {}) {
3240
- const { fontSize: s = 12, color: a = "#fff", align: l = "center", baseline: d = "top", fontWeight: c = "normal" } = n, h = this.ctx;
3241
- h.save(), h.font = `${c} ${Math.round(this.s(s))}px "PingFang SC", "Microsoft YaHei", Arial`, h.fillStyle = a, h.textAlign = l, h.textBaseline = d, h.fillText(e, this.s(i), this.s(r)), h.restore();
3242
- }
3243
- drawNodeImgText(e) {
3244
- const { url: i, x: r, y: n, w: s, h: a, text: l, fontSize: d = 12, textColor: c = "#fff", gap: h = 5 } = e;
3245
- if (this.drawImage(i, r, n, s, a, !0), l) {
3246
- const p = n + a / 2 + h;
3247
- this.drawText(l, r, p, { fontSize: d, color: c });
3248
- }
3249
- }
3250
- drawCircle(e, i, r, n = {}) {
3251
- const { fillStyle: s, strokeStyle: a, lineWidth: l = 2, shadowBlur: d = 0, shadowColor: c = "transparent" } = n, h = this.ctx;
3252
- h.save(), h.beginPath(), h.arc(this.s(e), this.s(i), this.s(r), 0, Math.PI * 2), d > 0 && (h.shadowBlur = this.s(d), h.shadowColor = c), s && (h.fillStyle = s, h.fill()), a && (h.lineWidth = this.s(l), h.strokeStyle = a, h.stroke()), h.restore();
3253
- }
3254
- drawPolygon(e, i = {}) {
3255
- const { fillStyle: r, strokeStyle: n, lineWidth: s = 2 } = i;
3256
- if (!e || e.length < 2) return;
3257
- const a = this.ctx;
3258
- a.save(), a.beginPath(), a.moveTo(this.s(e[0][0]), this.s(e[0][1]));
3259
- for (let l = 1; l < e.length; l++)
3260
- a.lineTo(this.s(e[l][0]), this.s(e[l][1]));
3261
- a.closePath(), r && (a.fillStyle = r, a.fill()), n && (a.lineWidth = this.s(s), a.strokeStyle = n, a.stroke()), a.restore();
3262
- }
3263
- drawNode(e, i, r, n, s, a = !1, l = 15, d = 12) {
3264
- const c = this.ctx, h = this.s(e), p = this.s(i), v = this.s(r), E = this.s(l);
3265
- c.save(), c.shadowBlur = this.s(15), c.shadowColor = n, c.beginPath(), c.arc(h, p, v, 0, Math.PI * 2), c.fillStyle = "#26455C", c.fill(), c.strokeStyle = n, c.lineWidth = this.s(2), c.stroke(), c.shadowBlur = 0, c.beginPath(), c.arc(h, p, v * 0.6, 0, Math.PI * 2), c.fillStyle = n, c.fill(), c.textAlign = "center", c.textBaseline = "middle";
3266
- const P = a ? this.s(d) : this.s(d + 2);
3267
- if (c.font = `${P}px sans-serif`, a && s.includes(`
3268
- `)) {
3269
- const $ = s.split(`
3270
- `);
3271
- c.fillStyle = "#fff", c.fillText($[0], h, p + v + E), c.fillStyle = n, c.font = `bold ${P + 1}px sans-serif`, c.fillText($[1], h, p + v + E * 2);
3272
- } else
3273
- c.fillStyle = "#fff", c.fillText(s, h, p - v - E);
3274
- c.restore();
3275
- }
3276
- drawFlowCurve(e, i, r) {
3277
- const n = this.ctx, s = Math.atan2(i.y - e.y, i.x - e.x), a = this.s(e.x + Math.cos(s) * e.r), l = this.s(e.y + Math.sin(s) * e.r), d = this.s(i.x - Math.cos(s) * i.r), c = this.s(i.y - Math.sin(s) * i.r), h = { x: (a + d) / 2, y: (l + c) / 2 - this.s(10) };
3278
- n.save(), n.beginPath(), n.moveTo(a, l), n.quadraticCurveTo(h.x, h.y, d, c), n.strokeStyle = "#26455C", n.lineWidth = this.s(2), n.stroke(), n.setLineDash([this.s(8), this.s(8)]), n.lineDashOffset = -this.s(r), n.strokeStyle = "rgba(0, 243, 255, 1)", n.stroke(), n.restore();
3279
- }
3280
- }
3281
- const At = {
3282
- px2Echarts(t, e = 1280, i = 800, r = !0) {
3283
- if (typeof window > "u") return t;
3284
- if (r && Math.abs(t) === 1) return 1;
3285
- const n = Math.min(window.innerWidth, window.innerHeight), s = Math.min(e, i), a = n / s;
3286
- return parseFloat((t * a).toFixed(2));
3287
- }
3288
- };
3289
- function Dt(t = {}) {
3290
- return {
3291
- vm: null,
3292
- routes: t.routes || {},
3293
- default: t.default || "",
3294
- beforeHooks: [],
3295
- current: "",
3296
- parent: t.parent || "",
3297
- level: t.level || 1,
3298
- isResolving: !1,
3299
- errorPage: t.errorPage || (t.level === 1 ? "./404.html" : "../../404.html"),
3300
- loginPage: t.loginPage || (t.level === 1 ? "./login.html" : "../../login.html"),
3301
- getRootWindow() {
3302
- try {
3303
- if (window.top && window.top.location.origin === window.location.origin)
3304
- return window.top;
3305
- } catch {
3306
- }
3307
- return window;
3308
- },
3309
- init(i) {
3310
- this.vm = i;
3311
- const r = this.getRootWindow();
3312
- typeof r.__isGoLogin__ > "u" && (r.__isGoLogin__ = !1), this.beforeEach((s, a, l) => {
3313
- var c;
3314
- const d = localStorage.getItem("emstoken");
3315
- if ((c = s.meta) != null && c.requiresAuth) {
3316
- if (d)
3317
- l();
3318
- else {
3319
- if (r.__isGoLogin__) {
3320
- l(!1);
3321
- return;
3322
- }
3323
- r.__isGoLogin__ = !0, l(!1), r.confirm("您的登录授权已到期,是否前往登录页面?") && r.location.replace(this.loginPage);
3324
- }
3325
- return;
3326
- }
3327
- l();
3328
- }), this._listener = () => this.resolve();
3329
- const n = r;
3330
- n.addEventListener("hashchange", this._listener), window.addEventListener("beforeunload", () => {
3331
- n.removeEventListener("hashchange", this._listener);
3332
- }), this.resolve();
3333
- },
3334
- getRouteConfig(i) {
3335
- const r = this.routes[i];
3336
- return r ? typeof r == "string" ? { path: r, meta: {} } : { path: r.path, meta: r.meta || {} } : null;
3337
- },
3338
- resolve() {
3339
- if (this.isResolving) return;
3340
- this.isResolving = !0;
3341
- const i = this.getRootWindow(), n = (i.location.hash || "").replace(/^#\/?/, "").split("/").filter(Boolean);
3342
- if (this.parent && n[0] !== this.parent) {
3343
- this.isResolving = !1;
3344
- return;
3345
- }
3346
- let s = n[this.level - 1];
3347
- if (!s && this.default) {
3348
- s = this.default, n[this.level - 1] = s;
3349
- const d = "/" + n.join("/");
3350
- if (i.location.hash.replace(/^#\/?/, "") !== d.replace(/^\//, "")) {
3351
- i.location.hash = d, this.isResolving = !1;
3352
- return;
3353
- }
3354
- }
3355
- const a = this.getRouteConfig(s);
3356
- if (!a) {
3357
- if (s) {
3358
- if (s === "login" || s === "login.html") {
3359
- console.warn(`[Router] login: 层级 ${this.level} 路由 ${s}`), i.location.replace(this.loginPage), this.isResolving = !1;
3360
- return;
3361
- }
3362
- console.warn(`[Router] 404: 层级 ${this.level} 找不到路由 ${s}`), i.location.replace(this.errorPage);
3363
- }
3364
- this.isResolving = !1;
3365
- return;
3366
- }
3367
- if (this.current === s) {
3368
- this.isResolving = !1;
3369
- return;
3370
- }
3371
- const l = this.current;
3372
- this.runBeforeHooks({ name: s, meta: a.meta }, l, (d) => {
3373
- if (this.isResolving = !1, d === !1) {
3374
- l ? this.push(l) : i.__isGoLogin__ || i.location.replace(this.loginPage);
3375
- return;
3376
- }
3377
- if (typeof d == "string") {
3378
- this.push(d);
3379
- return;
3380
- }
3381
- this.current = s, this.vm && (this.vm.navPath = a.path, this.vm.activeMenu = s);
3382
- });
3383
- },
3384
- push(i) {
3385
- const r = this.getRootWindow();
3386
- let s = (r.location.hash || "").replace(/^#\/?/, "").split("/").filter(Boolean);
3387
- s[this.level - 1] = i, s = s.slice(0, this.level), r.location.hash = "/" + s.join("/");
3388
- },
3389
- beforeEach(i) {
3390
- this.beforeHooks.push(i);
3391
- },
3392
- runBeforeHooks(i, r, n) {
3393
- let s = 0;
3394
- const a = (l) => {
3395
- if (l === !1 || typeof l == "string") {
3396
- n(l);
3397
- return;
3398
- }
3399
- if (s >= this.beforeHooks.length) {
3400
- n();
3401
- return;
3402
- }
3403
- const d = this.beforeHooks[s++];
3404
- d(i, r, a);
3405
- };
3406
- a();
3407
- }
3408
- };
3409
- }
3410
- const oe = {
3411
- LvcButton: Pe,
3412
- LvcDialog: we,
3413
- LvcSelect: Ie,
3414
- LvcSwitch: ze,
3415
- LvcTable: qe,
3416
- LvcTimePicker: Je,
3417
- LvcLoadMore: nt,
3418
- LvcDatePicker: ct,
3419
- LvcOdometer: mt,
3420
- LvcTree: ft,
3421
- LvcMonthPicker: bt,
3422
- LvcYearPicker: St
3423
- }, It = {
3424
- LvcButton: "lvc-button",
3425
- LvcDialog: "lvc-dialog",
3426
- LvcSelect: "lvc-select",
3427
- LvcSwitch: "lvc-switch",
3428
- LvcTable: "lvc-table",
3429
- LvcTimePicker: "lvc-time-picker",
3430
- LvcLoadMore: "lvc-load-more",
3431
- LvcDatePicker: "lvc-date-picker",
3432
- LvcOdometer: "lvc-odometer",
3433
- LvcTree: "lvc-tree",
3434
- LvcMonthPicker: "lvc-month-picker",
3435
- LvcYearPicker: "lvc-year-picker"
3436
- }, ce = (t) => {
3437
- ce.installed || (ce.installed = !0, Object.keys(oe).forEach((e) => {
3438
- t.component(It[e] || e, oe[e]);
3439
- }), _t(t), Pt(t), Lt(t));
3440
- }, Ht = {
3441
- version: "0.1.0",
3442
- install: ce,
3443
- ...oe,
3444
- Dialog: le,
3445
- Message: Y,
3446
- Loading: F,
3447
- Bus: Rt,
3448
- SocketClient: Yt,
3449
- ScanCode: ke,
3450
- scanUtils: Ee,
3451
- CanvasTopologyUtils: Ot,
3452
- px2EchartsUrils: At,
3453
- createRouter: Dt
3454
- };
3455
- export {
3456
- Rt as Bus,
3457
- Ot as CanvasTopologyUtils,
3458
- le as Dialog,
3459
- F as Loading,
3460
- Pe as LvcButton,
3461
- ct as LvcDatePicker,
3462
- we as LvcDialog,
3463
- nt as LvcLoadMore,
3464
- mt as LvcOdometer,
3465
- Ie as LvcSelect,
3466
- ze as LvcSwitch,
3467
- qe as LvcTable,
3468
- Je as LvcTimePicker,
3469
- Y as Message,
3470
- ke as ScanCode,
3471
- Yt as SocketClient,
3472
- Dt as createRouter,
3473
- Ht as default,
3474
- ce as install,
3475
- At as px2EchartsUrils,
3476
- Ee as scanUtils
3477
- };