view-ui-plus-derive 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2338 @@
1
+ import L from "dayjs";
2
+ import Fe from "dayjs/plugin/isSameOrBefore";
3
+ import je from "dayjs/plugin/isSameOrAfter";
4
+ import Ne from "dayjs/plugin/isBetween";
5
+ import { defineComponent as U, shallowRef as ye, computed as N, onMounted as ce, watch as z, resolveComponent as O, createElementBlock as j, openBlock as V, withDirectives as se, createVNode as $, withCtx as B, createTextVNode as F, toDisplayString as I, vShow as fe, Fragment as q, renderList as ee, createBlock as H, renderSlot as M, ref as P, mergeProps as K, useSlots as Pe, createCommentVNode as W, createElementVNode as te, normalizeClass as ie, nextTick as J, unref as G, shallowReactive as De, useTemplateRef as be, normalizeProps as ke, guardReactiveProps as Se, createSlots as $e, getCurrentInstance as He, onBeforeUnmount as Oe, mergeModels as Be, useAttrs as Le, useModel as Ee, reactive as Ke } from "vue";
6
+ import { getPathValue as pe, setPathValue as Ue, deepMerge as Ye, makeObjectByPath as _e } from "utils-where";
7
+ import Ge from "./locale/zh-CN.js";
8
+ /* empty css */
9
+ /* empty css */
10
+ import { i as xe } from "./directives/v-iview-select.js";
11
+ /* empty css */
12
+ /* empty css */
13
+ import { Checkbox as Ce } from "view-ui-plus";
14
+ /* empty css */
15
+ /* empty css */
16
+ const R = {
17
+ i18n: null,
18
+ prefix: "d",
19
+ msg: Ge,
20
+ t(t, ...S) {
21
+ return R.i18n?.global.t(R.prefix + "." + t, ...S) ?? pe(R.msg, R.prefix + "." + t) ?? t;
22
+ }
23
+ }, Je = {
24
+ name: "AllCheckbox"
25
+ }, We = /* @__PURE__ */ U({
26
+ ...Je,
27
+ props: {
28
+ modelValue: Array,
29
+ /**
30
+ * 全选框显示文本,默认“全选”
31
+ */
32
+ title: {
33
+ type: String,
34
+ default() {
35
+ return R.t("allCheckbox.title");
36
+ }
37
+ },
38
+ /**
39
+ * 选项数组,数组成员可以是数组或对象
40
+ */
41
+ list: {
42
+ type: Array,
43
+ default: () => []
44
+ },
45
+ /**
46
+ * 各选项值对应list中的value键。如list是[{v:1,k:2}],valueKey为 v 且 labelKey为 k, 则选项绑定值为 1,显示文本是 2
47
+ */
48
+ valueKey: {
49
+ type: [String, Number],
50
+ default: 0
51
+ },
52
+ /**
53
+ * 各选项值对应list中的label键。如list是[{v:1,k:2}],valueKey为 v 且 labelKey为 k, 则选项绑定值为 1,显示文本是 2
54
+ */
55
+ labelKey: {
56
+ type: [String, Number],
57
+ default: 1
58
+ },
59
+ /**
60
+ * 同时设置valueKey & labelKey,优先级相对更高
61
+ */
62
+ keyMap: {
63
+ type: Object,
64
+ default(t) {
65
+ return {
66
+ value: t.valueKey,
67
+ label: t.labelKey
68
+ };
69
+ }
70
+ },
71
+ /**
72
+ * 是否隐藏全选框
73
+ */
74
+ hideAll: Boolean,
75
+ /**
76
+ * 双向绑定全选框的值,若全选中应为 true,否则 false
77
+ */
78
+ all: Boolean
79
+ },
80
+ emits: ["update:modelValue", "update:all", "change"],
81
+ setup(t, { emit: S }) {
82
+ const e = t, l = S, a = ye(e.modelValue || []), n = N({
83
+ get() {
84
+ return a.value.length === e.list.length;
85
+ },
86
+ set(c) {
87
+ a.value = c ? e.list.map((v) => v[e.keyMap.value]) : [];
88
+ }
89
+ }), i = N(
90
+ () => a.value.length > 0 && a.value.length < e.list.length
91
+ );
92
+ function h() {
93
+ l("update:modelValue", a.value), l("update:all", n.value), l("change", a.value, n.value);
94
+ }
95
+ return ce(() => {
96
+ l("update:all", n.value);
97
+ }), z(
98
+ () => e.modelValue,
99
+ (c) => {
100
+ a.value !== c && (a.value = c || [], l("update:all", n.value));
101
+ }
102
+ ), (c, v) => {
103
+ const f = O("Checkbox"), g = O("CheckboxGroup");
104
+ return V(), j("div", null, [
105
+ se($(f, {
106
+ modelValue: n.value,
107
+ "onUpdate:modelValue": v[0] || (v[0] = (y) => n.value = y),
108
+ indeterminate: i.value,
109
+ onOnChange: h
110
+ }, {
111
+ default: B(() => [
112
+ F(I(t.title), 1)
113
+ ]),
114
+ _: 1
115
+ }, 8, ["modelValue", "indeterminate"]), [
116
+ [fe, !t.hideAll]
117
+ ]),
118
+ $(g, {
119
+ modelValue: a.value,
120
+ "onUpdate:modelValue": v[1] || (v[1] = (y) => a.value = y),
121
+ class: "ivu-inline-block",
122
+ onOnChange: h
123
+ }, {
124
+ default: B(() => [
125
+ (V(!0), j(q, null, ee(t.list, (y) => (V(), H(f, {
126
+ key: y[t.keyMap.value],
127
+ label: y[t.keyMap.value]
128
+ }, {
129
+ default: B(() => [
130
+ M(c.$slots, "default", { item: y }, () => [
131
+ F(I(y[t.keyMap.label]), 1)
132
+ ])
133
+ ]),
134
+ _: 2
135
+ }, 1032, ["label"]))), 128))
136
+ ]),
137
+ _: 3
138
+ }, 8, ["modelValue"])
139
+ ]);
140
+ };
141
+ }
142
+ }), qe = {
143
+ name: "BaseSwitch"
144
+ }, Qe = /* @__PURE__ */ U({
145
+ ...qe,
146
+ props: {
147
+ modelValue: [String, Number, Boolean],
148
+ /**
149
+ * 打开状态对应值,默认 'T'
150
+ */
151
+ trueValue: {
152
+ type: [String, Number, Boolean],
153
+ default: "T"
154
+ },
155
+ /**
156
+ * 关闭状态对应值,默认 'F'
157
+ */
158
+ falseValue: {
159
+ type: [String, Number, Boolean],
160
+ default: "F"
161
+ },
162
+ /**
163
+ * 打开状态对应文本
164
+ */
165
+ trueLabel: String,
166
+ /**
167
+ * 关闭状态对应文本
168
+ */
169
+ falseLabel: String
170
+ },
171
+ emits: ["update:modelValue", "change"],
172
+ setup(t, { emit: S }) {
173
+ const e = t, l = S, a = P(e.modelValue), n = (i) => {
174
+ l("update:modelValue", i), l("change", i);
175
+ };
176
+ return z(
177
+ () => e.modelValue,
178
+ (i) => {
179
+ a.value !== i && (a.value = i);
180
+ }
181
+ ), (i, h) => {
182
+ const c = O("Switch");
183
+ return V(), H(c, K({
184
+ modelValue: a.value,
185
+ "onUpdate:modelValue": h[0] || (h[0] = (v) => a.value = v),
186
+ onOnChange: n
187
+ }, i.$attrs, {
188
+ trueValue: t.trueValue,
189
+ falseValue: t.falseValue
190
+ }), {
191
+ open: B(() => [
192
+ M(i.$slots, "open", {}, () => [
193
+ F(I(t.trueLabel), 1)
194
+ ])
195
+ ]),
196
+ close: B(() => [
197
+ M(i.$slots, "close", {}, () => [
198
+ F(I(t.falseLabel), 1)
199
+ ])
200
+ ]),
201
+ _: 3
202
+ }, 16, ["modelValue", "trueValue", "falseValue"]);
203
+ };
204
+ }
205
+ }), Xe = { class: "combi ivu-input-group" }, Ze = {
206
+ key: 0,
207
+ class: "ivu-input-group-prepend"
208
+ }, et = {
209
+ key: 1,
210
+ class: "ivu-input-group-append"
211
+ }, tt = {
212
+ name: "Combi"
213
+ }, at = /* @__PURE__ */ U({
214
+ ...tt,
215
+ props: {
216
+ /**
217
+ * 前置文本
218
+ */
219
+ prepend: String,
220
+ /**
221
+ * 后置文本
222
+ */
223
+ append: String
224
+ },
225
+ setup(t) {
226
+ const S = Pe(), e = t, l = N(() => !!e.prepend || !!S.prepend?.().length), a = N(() => !!e.append || !!S.append?.().length);
227
+ return (n, i) => (V(), j("div", Xe, [
228
+ l.value ? (V(), j("div", Ze, [
229
+ M(n.$slots, "prepend", {}, () => [
230
+ F(I(t.prepend), 1)
231
+ ])
232
+ ])) : W("", !0),
233
+ te("div", {
234
+ class: ie(["combi-cell", { "with-append": a.value, "with-prepend": l.value }])
235
+ }, [
236
+ M(n.$slots, "default")
237
+ ], 2),
238
+ a.value ? (V(), j("div", et, [
239
+ M(n.$slots, "append", {}, () => [
240
+ F(I(t.append), 1)
241
+ ])
242
+ ])) : W("", !0)
243
+ ]));
244
+ }
245
+ }), lt = { class: "count-range" }, nt = {
246
+ name: "CountRange"
247
+ }, ot = /* @__PURE__ */ U({
248
+ ...nt,
249
+ props: {
250
+ /**
251
+ * 双向绑定最小值
252
+ */
253
+ begin: {
254
+ type: Number,
255
+ default: null
256
+ },
257
+ /**
258
+ * 双向绑定最大值
259
+ */
260
+ end: {
261
+ type: Number,
262
+ default: null
263
+ },
264
+ /**
265
+ * 允许的最小值,默认0
266
+ */
267
+ min: {
268
+ type: Number,
269
+ default: 0
270
+ },
271
+ /**
272
+ * 允许的最大值,默认9999999999
273
+ */
274
+ max: {
275
+ type: Number,
276
+ default: 9999999999
277
+ },
278
+ /**
279
+ * 禁用整个组件
280
+ */
281
+ disabled: Boolean,
282
+ /**
283
+ * 禁用最小值
284
+ */
285
+ minDisabled: Boolean,
286
+ /**
287
+ * 禁用最大值
288
+ */
289
+ maxDisabled: Boolean,
290
+ /**
291
+ * 最小值组件class
292
+ */
293
+ minClass: [String, Array, Object],
294
+ /**
295
+ * 最大值组件class
296
+ */
297
+ maxClass: [String, Array, Object],
298
+ /**
299
+ * 最小值占位文本
300
+ */
301
+ minHolder: {
302
+ type: String,
303
+ default() {
304
+ return R.t("countRange.minHolder");
305
+ }
306
+ },
307
+ /**
308
+ * 最大值占位文本
309
+ */
310
+ maxHolder: {
311
+ type: String,
312
+ default() {
313
+ return R.t("countRange.maxHolder");
314
+ }
315
+ },
316
+ controlsOutside: Boolean,
317
+ step: Number,
318
+ readonly: Boolean,
319
+ editable: {
320
+ type: Boolean,
321
+ default: !0
322
+ },
323
+ precision: Number,
324
+ formatter: Function,
325
+ parser: Function,
326
+ activeChange: {
327
+ type: Boolean,
328
+ default: !0
329
+ },
330
+ /**
331
+ * 传递给最小值组件的props
332
+ */
333
+ minAttr: Object,
334
+ /**
335
+ * 传递给最大值组件的props
336
+ */
337
+ maxAttr: Object,
338
+ /**
339
+ * 中间连接部分class
340
+ */
341
+ joinerClass: [String, Object],
342
+ /**
343
+ * 是否隐藏连接部分
344
+ */
345
+ hideJoiner: Boolean
346
+ },
347
+ emits: ["update:begin", "update:end", "change-min", "change-max", "change"],
348
+ setup(t, { emit: S }) {
349
+ const e = t, l = S, a = P(e.begin), n = P(e.end), i = N(() => ({
350
+ min: e.min,
351
+ max: e.max,
352
+ placeholder: e.minHolder,
353
+ disabled: e.disabled || e.minDisabled,
354
+ class: e.minClass,
355
+ controlsOutside: e.controlsOutside,
356
+ step: e.step,
357
+ readonly: e.readonly,
358
+ editable: e.editable,
359
+ precision: e.precision,
360
+ formatter: e.formatter,
361
+ parser: e.parser,
362
+ activeChange: e.activeChange,
363
+ ...e.minAttr
364
+ })), h = N(() => ({
365
+ min: a.value,
366
+ max: e.max,
367
+ placeholder: e.maxHolder,
368
+ disabled: e.disabled || e.maxDisabled,
369
+ class: e.maxClass,
370
+ controlsOutside: e.controlsOutside,
371
+ step: e.step,
372
+ readonly: e.readonly,
373
+ editable: e.editable,
374
+ precision: e.precision,
375
+ formatter: e.formatter,
376
+ parser: e.parser,
377
+ activeChange: a.value ? !1 : e.activeChange,
378
+ ...e.maxAttr
379
+ })), c = () => {
380
+ l("update:begin", a.value), l("update:end", n.value);
381
+ }, v = (s) => {
382
+ n.value != null && s > n.value && (n.value = s + 1 > h.value.max ? h.value.max : s + 1), c(), l("change-min", s), l("change", s, n.value, !1);
383
+ }, f = (s) => {
384
+ c(), l("change-max", s), l("change", a.value, s, !0);
385
+ }, g = (s) => {
386
+ a.value !== s && (a.value = s !== void 0 ? s : null);
387
+ }, y = (s) => {
388
+ n.value !== s && (n.value = s !== void 0 ? s : null);
389
+ };
390
+ return z(() => e.begin, g), z(() => e.end, y), (s, k) => {
391
+ const x = O("InputNumber");
392
+ return V(), j("div", lt, [
393
+ $(x, K({
394
+ modelValue: a.value,
395
+ "onUpdate:modelValue": k[0] || (k[0] = (o) => a.value = o)
396
+ }, i.value, { onOnChange: v }), null, 16, ["modelValue"]),
397
+ se(te("span", {
398
+ class: ie(["count-range-joiner", t.joinerClass])
399
+ }, null, 2), [
400
+ [fe, !t.hideJoiner]
401
+ ]),
402
+ $(x, K({
403
+ modelValue: n.value,
404
+ "onUpdate:modelValue": k[1] || (k[1] = (o) => n.value = o)
405
+ }, h.value, { onOnChange: f }), null, 16, ["modelValue"])
406
+ ]);
407
+ };
408
+ }
409
+ }), ut = { key: 1 }, it = {
410
+ name: "RemoteSelect",
411
+ inheritAttrs: !1
412
+ }, we = /* @__PURE__ */ U({
413
+ ...it,
414
+ props: {
415
+ modelValue: [String, Array, Number],
416
+ list: Array,
417
+ multiple: Boolean,
418
+ /**
419
+ * 是否将选项的value作为Option的key,默认以v-for的index作为key
420
+ */
421
+ valueAsKey: Boolean,
422
+ /**
423
+ * 选项对应value的key
424
+ */
425
+ valueKey: {
426
+ type: String,
427
+ default: "value"
428
+ },
429
+ /**
430
+ * 选项对应文本的key
431
+ */
432
+ labelKey: {
433
+ type: String,
434
+ default: "label"
435
+ },
436
+ keyMap: {
437
+ type: Object,
438
+ default(t) {
439
+ return {
440
+ value: t.valueKey,
441
+ label: t.labelKey
442
+ };
443
+ }
444
+ },
445
+ method: Function,
446
+ refresh: Function,
447
+ process: Function,
448
+ param: [Object, Function, String],
449
+ chosen: [Object, Array],
450
+ autoGet: Boolean,
451
+ // 默认只在点开时请求,若该值为true,则挂载后立即请求
452
+ formatLabel: {
453
+ type: Function
454
+ /* default(item, index) {
455
+ let ref = this.$refs["options" + index];
456
+ return ref && ref[0] && ref[0].optionLabel;
457
+ } */
458
+ },
459
+ /**
460
+ * 点开再请求时,该函数返回true表示可发送请求
461
+ */
462
+ check: {
463
+ type: Function,
464
+ default: () => !0
465
+ },
466
+ textMode: Boolean,
467
+ textFormat: Function,
468
+ /**
469
+ * 关联值,该值变化后会清空绑定值与选项
470
+ *
471
+ * @example 当 some 变化后,<RemoteSelect>的值与选项都会清空
472
+ * <Select v-model="some" ><Option value="1">1</Option></Select>
473
+ * <RemoteSelect :parentCode="some" />
474
+ */
475
+ parentCode: [String, Array, Number],
476
+ optionDisabled: Function,
477
+ optionTag: Function,
478
+ getSelected: {
479
+ type: Function,
480
+ default({
481
+ multiple: t,
482
+ keyMap: S,
483
+ list: e,
484
+ value: l
485
+ }) {
486
+ return t ? e.filter((a) => l.includes(a[S.value])) : e.find((a) => a[S.value] === l) || {};
487
+ }
488
+ },
489
+ /**
490
+ * 启用则根据绑定的list判断是否需要在展开时发送请求
491
+ */
492
+ cache: Boolean,
493
+ loader: Function,
494
+ /**
495
+ * 开启后则展开时仅当parentCode有效才会发送请求
496
+ */
497
+ strict: Boolean,
498
+ all: {
499
+ type: Boolean,
500
+ default: !1
501
+ }
502
+ },
503
+ emits: ["update:modelValue", "update:chosen", "update:list", "update:refresh", "load"],
504
+ setup(t, { expose: S, emit: e }) {
505
+ const l = t, a = e, n = P(l.modelValue || ""), i = P([]), h = P(!1), c = P({}), v = N(
506
+ () => c.value && Object.keys(c.value).length > 0 ? typeof l.textFormat != "function" ? l.multiple ? c.value.map(
507
+ (d) => `${d[l.keyMap.label]}${d[l.keyMap.value] ? "(" + d[l.keyMap.value] + ")" : ""}`
508
+ ).join(",") : `${c.value[l.keyMap.label]}${c.value[l.keyMap.value] ? "(" + c.value[l.keyMap.value] + ")" : ""}` : l.textFormat(c.value) : ""
509
+ ), f = P(!1);
510
+ let g, y, s, k;
511
+ async function x() {
512
+ let d;
513
+ if (typeof l.loader != "function") {
514
+ if (typeof l.method != "function") {
515
+ console.warn("typeof method isn't function");
516
+ return;
517
+ }
518
+ if (h.value = !0, d = await l.method(typeof l.param != "function" ? l.param : l.param()), h.value = !1, d && typeof l.process == "function") {
519
+ const C = l.process(d);
520
+ C != null && (d = C);
521
+ }
522
+ } else
523
+ h.value = !0, d = await l.loader(), h.value = !1;
524
+ d && (f.value = !0, i.value = d, a("update:list", d), D() && o(n.value), g = !0, J(() => {
525
+ g = null;
526
+ }), a("load", d));
527
+ }
528
+ function o(d) {
529
+ y = !0, J(() => {
530
+ y = null;
531
+ }), s && (l.multiple ? !d.toString().length : d === void 0) && (n.value = d = s), c.value = l.getSelected({
532
+ multiple: l.multiple,
533
+ keyMap: l.keyMap,
534
+ list: i.value,
535
+ value: n.value
536
+ }), a("update:modelValue", d || ""), a("update:chosen", c.value);
537
+ }
538
+ function b(d) {
539
+ d && !l.autoGet && !h.value && !f.value && l.check() && (!l.strict || l.parentCode) && x();
540
+ }
541
+ function D() {
542
+ return n.value != null && n.value.toString().length > 0;
543
+ }
544
+ return a("update:refresh", x), ce(() => {
545
+ l.autoGet ? x() : D() && !i.value.length && b(!0);
546
+ }), S({
547
+ code: n,
548
+ changeCode: o,
549
+ loaded: f,
550
+ codes: i,
551
+ search: x
552
+ }), z(
553
+ () => l.list,
554
+ (d) => {
555
+ g || (d && d.length ? (i.value = d, f.value = !!l.cache) : (i.value = [], f.value = !1));
556
+ },
557
+ { immediate: !0 }
558
+ ), z(
559
+ () => l.modelValue,
560
+ (d) => {
561
+ if (!y && (k = !0, J(() => {
562
+ k = null;
563
+ }), n.value = d || "", D())) {
564
+ if (o(n.value), l.refresh === x) return;
565
+ for (const C in c.value)
566
+ return;
567
+ b(!0);
568
+ }
569
+ }
570
+ ), z(
571
+ () => l.parentCode,
572
+ (d) => {
573
+ k ? (s = l.modelValue, setTimeout(() => {
574
+ s = null;
575
+ })) : n.value = l.multiple ? [] : "", i.value = [], f.value = !1, a("update:list", i.value), D() && d && /* !this.opening && */
576
+ b(!0);
577
+ }
578
+ ), (d, C) => {
579
+ const u = O("Option"), r = O("Select");
580
+ return t.textMode ? (V(), j("span", ut, [
581
+ M(d.$slots, "text", { text: v.value }, () => [
582
+ F(I(v.value), 1)
583
+ ])
584
+ ])) : se((V(), H(r, K({
585
+ key: 0,
586
+ modelValue: n.value,
587
+ "onUpdate:modelValue": C[0] || (C[0] = (A) => n.value = A),
588
+ onOnOpenChange: b,
589
+ onOnChange: o
590
+ }, d.$attrs, {
591
+ multiple: t.multiple,
592
+ loading: h.value,
593
+ "not-found-text": h.value ? null : void 0
594
+ }), {
595
+ default: B(() => [
596
+ M(d.$slots, "dropdown", { list: i.value }, () => [
597
+ (V(!0), j(q, null, ee(i.value, (A, Y) => (V(), H(u, {
598
+ key: l.valueAsKey ? A[t.keyMap.value] : Y,
599
+ value: A[t.keyMap.value],
600
+ label: t.formatLabel && t.formatLabel(A, Y),
601
+ disabled: t.optionDisabled && t.optionDisabled(A, Y),
602
+ tag: t.optionTag && t.optionTag(A, Y)
603
+ }, {
604
+ default: B(() => [
605
+ M(d.$slots, "default", {
606
+ item: A,
607
+ index: Y
608
+ }, () => [
609
+ F(I(A[t.keyMap.label]), 1),
610
+ A[t.keyMap.value] ? (V(), j(q, { key: 0 }, [
611
+ F("(" + I(A[t.keyMap.value]) + ")", 1)
612
+ ], 64)) : W("", !0)
613
+ ])
614
+ ]),
615
+ _: 2
616
+ }, 1032, ["value", "label", "disabled", "tag"]))), 128))
617
+ ])
618
+ ]),
619
+ _: 3
620
+ }, 16, ["modelValue", "multiple", "loading", "not-found-text"])), [
621
+ [G(xe), t.all, "all"]
622
+ ]);
623
+ };
624
+ }
625
+ }), he = {
626
+ list: null
627
+ }, ne = De({}), oe = {
628
+ list: []
629
+ }, ue = {
630
+ list: []
631
+ }, ve = {}, st = {
632
+ name: "CacheSelect",
633
+ inheritAttrs: !1
634
+ }, dt = /* @__PURE__ */ U({
635
+ ...st,
636
+ props: {
637
+ modelValue: [String, Array, Number],
638
+ /**
639
+ * 缓存的唯一键,当页面上同时用到多个不同数据源的CacheSelect时需传入不同值
640
+ */
641
+ cacheId: {
642
+ type: String,
643
+ default: "list"
644
+ }
645
+ },
646
+ emits: ["update:modelValue", "update:chosen", "update:list", "load", "change"],
647
+ setup(t, { emit: S }) {
648
+ const e = t, l = S, a = P(""), n = be("sel"), i = (v) => {
649
+ l("update:modelValue", v), l("change", v);
650
+ }, h = (v) => {
651
+ J(() => {
652
+ oe[e.cacheId] && (oe[e.cacheId].forEach((f) => {
653
+ f.changeCode(f.code);
654
+ }), oe[e.cacheId] = []), ue[e.cacheId] && (ue[e.cacheId].forEach((f) => {
655
+ f !== n.value && f.$emit("update:list", f.codes);
656
+ }), ue[e.cacheId] = []);
657
+ }), l("load", v);
658
+ }, c = () => a.value != null && a.value.toString().length > 0;
659
+ return z(
660
+ () => e.modelValue,
661
+ (v) => {
662
+ a.value !== v && (a.value = v || "");
663
+ }
664
+ ), ne[e.cacheId] || (ne[e.cacheId] = [], he[e.cacheId] = null), ce(() => {
665
+ ne[e.cacheId].length && (n.value.loaded = !0), e.modelValue && (a.value = e.modelValue), he[e.cacheId] ? (c() && (oe[e.cacheId] || (oe[e.cacheId] = []), oe[e.cacheId].push(n.value)), n.value.loaded = ve[e.cacheId]) : he[e.cacheId] = !0, ue[e.cacheId] || (ue[e.cacheId] = []), ue[e.cacheId].push(n.value), ve[e.cacheId] || (ve[e.cacheId] = c()), z(
666
+ () => ne[e.cacheId],
667
+ (v) => {
668
+ v.length && (n.value.loaded = !0);
669
+ },
670
+ {
671
+ immediate: !0
672
+ }
673
+ );
674
+ }), (v, f) => (V(), H(we, K({
675
+ ref: "sel",
676
+ modelValue: a.value,
677
+ "onUpdate:modelValue": f[0] || (f[0] = (g) => a.value = g),
678
+ list: G(ne)[t.cacheId],
679
+ "onUpdate:list": [
680
+ f[1] || (f[1] = (g) => G(ne)[t.cacheId] = g),
681
+ f[3] || (f[3] = (g) => v.$emit("update:list", g))
682
+ ],
683
+ onLoad: h,
684
+ onOnChange: i,
685
+ "onUpdate:chosen": f[2] || (f[2] = (g) => v.$emit("update:chosen", g))
686
+ }, v.$attrs, { cache: "" }), {
687
+ default: B(({ item: g, index: y }) => [
688
+ M(v.$slots, "default", {
689
+ item: g,
690
+ index: y
691
+ })
692
+ ]),
693
+ dropdown: B(({ list: g }) => [
694
+ M(v.$slots, "dropdown", { list: g })
695
+ ]),
696
+ text: B((g) => [
697
+ M(v.$slots, "text", ke(Se(g)))
698
+ ]),
699
+ _: 3
700
+ }, 16, ["modelValue", "list"]));
701
+ }
702
+ }), rt = {
703
+ name: "CurdTable"
704
+ }, ct = /* @__PURE__ */ U({
705
+ ...rt,
706
+ props: {
707
+ modelValue: {
708
+ type: Array,
709
+ default: () => []
710
+ },
711
+ /**
712
+ * iview Table columns
713
+ */
714
+ columns: {
715
+ type: Array,
716
+ default: () => []
717
+ },
718
+ /**
719
+ * 是否隐藏控制列
720
+ */
721
+ disabled: Boolean,
722
+ /**
723
+ * 可否增加数据,默认true
724
+ */
725
+ addable: {
726
+ type: Boolean,
727
+ default: !0
728
+ },
729
+ /**
730
+ * 控制列宽度,默认90px
731
+ */
732
+ actionWidth: {
733
+ type: Number,
734
+ default: 90
735
+ },
736
+ /**
737
+ * 控制列水平对齐,默认居中
738
+ */
739
+ actionAlign: {
740
+ type: String,
741
+ default: "center"
742
+ },
743
+ /**
744
+ * 控制列是否固定
745
+ */
746
+ actionFixed: String,
747
+ /**
748
+ * 控制列表头文本
749
+ */
750
+ actionText: {
751
+ type: String,
752
+ default() {
753
+ return R.t("curdTable.actionText");
754
+ }
755
+ },
756
+ /**
757
+ * 右侧控制列
758
+ */
759
+ actionCol: {
760
+ type: Object,
761
+ default(t) {
762
+ return {
763
+ title: t.actionText,
764
+ slot: "action",
765
+ width: t.actionWidth,
766
+ align: t.actionAlign,
767
+ fixed: t.actionFixed
768
+ };
769
+ }
770
+ },
771
+ /**
772
+ * 新增行时需要添加的数据
773
+ */
774
+ addRow: {
775
+ type: Function,
776
+ default: () => []
777
+ },
778
+ border: Boolean,
779
+ size: String,
780
+ /**
781
+ * 返回Promise以决定何时新增数据
782
+ */
783
+ beforeAdd: Function,
784
+ /**
785
+ * 返回Promise以决定何时删除数据
786
+ */
787
+ beforeRemove: Function,
788
+ addBtnType: {
789
+ type: String,
790
+ default: "dashed"
791
+ },
792
+ addBtnSize: String,
793
+ addBtnGhost: {
794
+ type: Boolean,
795
+ default: !1
796
+ },
797
+ addBtnDisabled: {
798
+ type: Boolean,
799
+ default(t) {
800
+ return !t.addable;
801
+ }
802
+ },
803
+ addBtn: {
804
+ type: Object,
805
+ default: () => ({})
806
+ },
807
+ delBtnType: {
808
+ type: String,
809
+ default: "warning"
810
+ },
811
+ delBtnSize: {
812
+ type: String,
813
+ default: "small"
814
+ },
815
+ delBtnGhost: {
816
+ type: Boolean,
817
+ default: !0
818
+ },
819
+ delBtn: {
820
+ type: Object,
821
+ default: () => ({})
822
+ },
823
+ addText: {
824
+ type: String,
825
+ default() {
826
+ return R.t("curdTable.addText");
827
+ }
828
+ },
829
+ /**
830
+ * 是否隐藏每行的删除按钮,通过函数返回值决定
831
+ */
832
+ hideDelBtn: Function,
833
+ /**
834
+ * 是否禁用每行删除按钮,通过函数返回值决定
835
+ */
836
+ delBtnDisabled: {
837
+ type: Function,
838
+ default() {
839
+ return !1;
840
+ }
841
+ }
842
+ },
843
+ emits: ["update:modelValue", "add", "remove", "change"],
844
+ setup(t, { emit: S }) {
845
+ const e = t, l = S, a = P(e.modelValue), n = N(
846
+ () => e.disabled ? e.columns : e.columns.concat(e.actionCol)
847
+ ), i = N(() => {
848
+ const g = [], y = (s) => {
849
+ s.slot && g.push(s), s.children && s.children.forEach((k) => {
850
+ y(k);
851
+ });
852
+ };
853
+ return e.columns.forEach((s) => {
854
+ y(s);
855
+ }), g;
856
+ });
857
+ function h() {
858
+ typeof e.beforeAdd != "function" ? c() : e.beforeAdd().then(c).catch();
859
+ }
860
+ function c(g) {
861
+ a.value.push(...e.addRow(g)), l("update:modelValue", a.value), l("add", a.value[a.value.length - 1]), l("change", !0);
862
+ }
863
+ function v(g) {
864
+ typeof e.beforeRemove != "function" ? f(g) : e.beforeRemove(a.value[g], g).then(() => {
865
+ f(g);
866
+ });
867
+ }
868
+ function f(g) {
869
+ const [y] = a.value.splice(g, 1);
870
+ l("update:modelValue", a.value), l("remove", y), l("change", !1);
871
+ }
872
+ return z(
873
+ () => e.modelValue,
874
+ (g) => {
875
+ a.value = g;
876
+ }
877
+ ), (g, y) => {
878
+ const s = O("Button"), k = O("Table");
879
+ return V(), j("div", null, [
880
+ $(k, {
881
+ border: t.border,
882
+ columns: n.value,
883
+ data: a.value,
884
+ size: t.size,
885
+ style: { "z-index": "0" }
886
+ }, $e({
887
+ action: B(({ row: x, index: o }) => [
888
+ M(g.$slots, "moreAction", {
889
+ row: x,
890
+ index: o
891
+ }),
892
+ !t.hideDelBtn || !t.hideDelBtn(x, o) ? (V(), H(s, K({
893
+ key: 0,
894
+ type: t.delBtnType,
895
+ size: t.delBtnSize,
896
+ ghost: t.delBtnGhost
897
+ }, t.delBtn, {
898
+ disabled: t.delBtnDisabled(x, o),
899
+ onClick: (b) => v(o)
900
+ }), {
901
+ default: B(() => [
902
+ F(I(G(R).t("curdTable.del")), 1)
903
+ ]),
904
+ _: 2
905
+ }, 1040, ["type", "size", "ghost", "disabled", "onClick"])) : W("", !0)
906
+ ]),
907
+ _: 2
908
+ }, [
909
+ ee(i.value, (x) => ({
910
+ name: x.slot,
911
+ fn: B((o) => [
912
+ M(g.$slots, x.slot, ke(Se(o)))
913
+ ])
914
+ }))
915
+ ]), 1032, ["border", "columns", "data", "size"]),
916
+ t.disabled ? W("", !0) : se((V(), H(s, K({
917
+ key: 0,
918
+ type: t.addBtnType,
919
+ size: t.addBtnSize,
920
+ ghost: t.addBtnGhost,
921
+ disabled: t.addBtnDisabled
922
+ }, t.addBtn, {
923
+ long: "",
924
+ icon: "md-add",
925
+ style: { display: "block", position: "relative", "margin-top": "-1px" },
926
+ onClick: h
927
+ }), {
928
+ default: B(() => [
929
+ F(I(t.addText), 1)
930
+ ]),
931
+ _: 1
932
+ }, 16, ["type", "size", "ghost", "disabled"])), [
933
+ [fe, t.addable]
934
+ ])
935
+ ]);
936
+ };
937
+ }
938
+ }), ft = { class: "date-range" }, mt = {
939
+ name: "DateRange"
940
+ }, gt = /* @__PURE__ */ U({
941
+ ...mt,
942
+ props: {
943
+ /**
944
+ * 双向绑定开始时间
945
+ */
946
+ begin: {
947
+ type: [Date, String],
948
+ default: ""
949
+ },
950
+ /**
951
+ * 双向绑定结束时间
952
+ */
953
+ end: {
954
+ type: [Date, String],
955
+ default: ""
956
+ },
957
+ /**
958
+ * 可选的日期类型:date | month | year | datetime
959
+ */
960
+ type: {
961
+ type: String,
962
+ default: "date"
963
+ },
964
+ clearable: Boolean,
965
+ disabled: Boolean,
966
+ transfer: Boolean,
967
+ /**
968
+ * 禁用开始时间
969
+ */
970
+ beginDisabled: Boolean,
971
+ /**
972
+ * 禁用结束时间
973
+ */
974
+ endDisabled: Boolean,
975
+ /**
976
+ * 是否当所选开始日期大于结束日期时自动将结束日期置为开始日期后一天
977
+ */
978
+ autoNext: {
979
+ type: Boolean,
980
+ default: !0
981
+ },
982
+ /**
983
+ * 是否默认限制开始时间
984
+ */
985
+ limitBegin: {
986
+ type: Boolean,
987
+ default: !0
988
+ },
989
+ beginClass: [String, Array, Object],
990
+ endClass: [String, Array, Object],
991
+ /**
992
+ * 开始时间placeholder
993
+ */
994
+ beginHolder: {
995
+ type: String,
996
+ default() {
997
+ return R.t("dateRange.beginHolder");
998
+ }
999
+ },
1000
+ /**
1001
+ * 结束时间placeholder
1002
+ */
1003
+ endHolder: {
1004
+ type: String,
1005
+ default() {
1006
+ return R.t("dateRange.endHolder");
1007
+ }
1008
+ },
1009
+ /**
1010
+ * 一次性传给开始组件的prop
1011
+ */
1012
+ beginAttr: Object,
1013
+ /**
1014
+ * 一次性传给结束组件的prop
1015
+ */
1016
+ endAttr: Object,
1017
+ /**
1018
+ * 中间连接符的class
1019
+ */
1020
+ joinerClass: [String, Object],
1021
+ /**
1022
+ * 是否禁止选择今天
1023
+ */
1024
+ disableToday: Boolean,
1025
+ /**
1026
+ * 是否隐藏连接符
1027
+ */
1028
+ hideJoiner: Boolean,
1029
+ /**
1030
+ * iview DatePicer的日期格式
1031
+ */
1032
+ format: String
1033
+ },
1034
+ emits: ["update:begin", "update:end", "change-begin", "change-end", "change"],
1035
+ setup(t, { emit: S }) {
1036
+ const e = {
1037
+ date: "day",
1038
+ month: "month",
1039
+ year: "year",
1040
+ datetime: "day"
1041
+ }, l = t, a = S, n = P(l.begin), i = P(l.end), h = N(() => ({
1042
+ options: l.limitBegin ? {
1043
+ disabledDate: (k) => k && L(k).isBefore(Date.now(), e[l.type])
1044
+ // date.valueOf() < Date.now() - (props.disableToday ? 0 : 86400000)
1045
+ } : void 0,
1046
+ disabled: l.disabled || l.beginDisabled,
1047
+ placeholder: l.beginHolder,
1048
+ class: l.beginClass,
1049
+ clearable: l.clearable,
1050
+ transfer: l.transfer,
1051
+ format: l.format,
1052
+ ...l.beginAttr
1053
+ })), c = N(() => ({
1054
+ options: {
1055
+ disabledDate: (k) => n.value && k && L(k).isBefore(n.value, e[l.type])
1056
+ },
1057
+ disabled: l.disabled || l.endDisabled,
1058
+ placeholder: l.endHolder,
1059
+ class: l.endClass,
1060
+ clearable: l.clearable,
1061
+ transfer: l.transfer,
1062
+ format: l.format,
1063
+ ...l.endAttr
1064
+ })), v = () => {
1065
+ a("update:begin", n.value), a("update:end", i.value);
1066
+ }, f = (k) => {
1067
+ n.value > i.value && (i.value = l.autoNext ? L(n.value).add(1, e[l.type]).toDate() : ""), v(), a("change-begin", k), a("change", n.value, i.value, !1);
1068
+ }, g = (k) => {
1069
+ l.type === "datetime" && k && L(k).isBefore(n.value) && (i.value = L(n.value).add(1, "hour").toDate(), k = L(i.value).format("YYYY-MM-DD HH:mm:ss")), v(), a("change-end", k), a("change", n.value, i.value, !0);
1070
+ }, y = (k) => {
1071
+ n.value !== k && (n.value = k || "");
1072
+ }, s = (k) => {
1073
+ i.value !== k && (i.value = k || "");
1074
+ };
1075
+ return z(() => l.begin, y), z(() => l.end, s), (k, x) => {
1076
+ const o = O("DatePicker");
1077
+ return V(), j("div", ft, [
1078
+ $(o, K({
1079
+ modelValue: n.value,
1080
+ "onUpdate:modelValue": x[0] || (x[0] = (b) => n.value = b),
1081
+ onOnChange: f
1082
+ }, h.value, { type: t.type }), null, 16, ["modelValue", "type"]),
1083
+ se(te("span", {
1084
+ class: ie(["date-range-joiner", t.joinerClass])
1085
+ }, null, 2), [
1086
+ [fe, !t.hideJoiner]
1087
+ ]),
1088
+ $(o, K({
1089
+ modelValue: i.value,
1090
+ "onUpdate:modelValue": x[1] || (x[1] = (b) => i.value = b),
1091
+ onOnChange: g
1092
+ }, c.value, { type: t.type }), null, 16, ["modelValue", "type"])
1093
+ ]);
1094
+ };
1095
+ }
1096
+ }), pt = {
1097
+ name: "DateRangePicker"
1098
+ }, ht = /* @__PURE__ */ U({
1099
+ ...pt,
1100
+ props: {
1101
+ /**
1102
+ * 双向绑定开始时间
1103
+ */
1104
+ begin: {
1105
+ type: [Date, String],
1106
+ default: ""
1107
+ },
1108
+ /**
1109
+ * 双向绑定结束时间
1110
+ */
1111
+ end: {
1112
+ type: [Date, String],
1113
+ default: ""
1114
+ },
1115
+ /**
1116
+ * 可选的日期类型:daterange | datetimerange
1117
+ */
1118
+ type: {
1119
+ type: String,
1120
+ default: "daterange",
1121
+ validator(t) {
1122
+ return ["daterange", "datetimerange"].includes(t);
1123
+ }
1124
+ },
1125
+ options: Object,
1126
+ clearable: {
1127
+ type: Boolean,
1128
+ default: !0
1129
+ },
1130
+ splitPanels: Boolean,
1131
+ /**
1132
+ * 是否默认限制开始时间
1133
+ */
1134
+ limitBegin: {
1135
+ type: Boolean,
1136
+ default: !0
1137
+ },
1138
+ /**
1139
+ * 是否禁止选择今天
1140
+ */
1141
+ disableToday: Boolean,
1142
+ transfer: Boolean,
1143
+ placeholder: String,
1144
+ disabled: Boolean,
1145
+ placement: String,
1146
+ /**
1147
+ * 用于格式化绑定时间,默认 YYYY-MM-DD
1148
+ */
1149
+ valueFormat: {
1150
+ type: String,
1151
+ default: "YYYY-MM-DD"
1152
+ }
1153
+ },
1154
+ emits: ["update:begin", "update:end", "change"],
1155
+ setup(t, { emit: S }) {
1156
+ const e = t, l = S, a = N(
1157
+ () => e.options || (e.limitBegin ? {
1158
+ disabledDate: (h) => h && h.valueOf() < Date.now() - (e.disableToday ? 0 : 864e5)
1159
+ } : null)
1160
+ ), n = N({
1161
+ get() {
1162
+ const h = e.begin, c = e.end;
1163
+ return h && c ? [L(h).toDate(), L(c).toDate()] : [];
1164
+ },
1165
+ set(h) {
1166
+ let c, v;
1167
+ h[0] && h[1] ? (c = L(h[0]).format(e.valueFormat), v = L(h[1]).format(e.valueFormat)) : c = v = "", l("update:begin", c), l("update:end", v);
1168
+ }
1169
+ }), i = (h, c) => {
1170
+ l("change", h, c);
1171
+ };
1172
+ return (h, c) => {
1173
+ const v = O("DatePicker");
1174
+ return V(), H(v, {
1175
+ modelValue: n.value,
1176
+ "onUpdate:modelValue": c[0] || (c[0] = (f) => n.value = f),
1177
+ type: t.type,
1178
+ clearable: t.clearable,
1179
+ "split-panels": t.splitPanels,
1180
+ options: a.value,
1181
+ transfer: t.transfer,
1182
+ placeholder: t.placeholder,
1183
+ disabled: t.disabled,
1184
+ placement: t.placement,
1185
+ onOnChange: i
1186
+ }, null, 8, ["modelValue", "type", "clearable", "split-panels", "options", "transfer", "placeholder", "disabled", "placement"]);
1187
+ };
1188
+ }
1189
+ }), vt = { class: "mcalendar" }, bt = {
1190
+ name: "MCalendar"
1191
+ }, yt = /* @__PURE__ */ U({
1192
+ ...bt,
1193
+ props: {
1194
+ /**
1195
+ * 指定日期,默认显示该日期所在月份
1196
+ */
1197
+ date: Date,
1198
+ /**
1199
+ * 传入的额外日期数据
1200
+ * 组件始终展示一段日期,但业务上有时需要根据返回的一组日期进行渲染,如 [{date:'2000-01-01',xxx:false},{date:'2000-01-02',xxx:true}]
1201
+ */
1202
+ dates: Array,
1203
+ /**
1204
+ * 周起始日,默认星期一
1205
+ */
1206
+ startDay: {
1207
+ type: Number,
1208
+ default: 1,
1209
+ validator: (t) => t > -1 && t < 7
1210
+ },
1211
+ /**
1212
+ * 休息日,默认周六周日
1213
+ *
1214
+ * @example [5,6] 休息日变为周五周六
1215
+ */
1216
+ offDay: {
1217
+ type: Array,
1218
+ default: () => [6, 0]
1219
+ },
1220
+ /**
1221
+ * 传入dates里日期值对应的key,默认“date”
1222
+ */
1223
+ dateKey: {
1224
+ type: String,
1225
+ default: "date"
1226
+ },
1227
+ /**
1228
+ * 单元格标题class
1229
+ */
1230
+ titleClass: Function,
1231
+ /**
1232
+ * 每一天单元格class
1233
+ */
1234
+ dateClass: Function,
1235
+ /**
1236
+ * 加载状态
1237
+ */
1238
+ loading: Boolean,
1239
+ /**
1240
+ * 单元格日期[格式](https://day.js.org/docs/en/display/format),默认 YYYY-MM-DD
1241
+ */
1242
+ textFormat: {
1243
+ type: String,
1244
+ default: "YYYY-MM-DD"
1245
+ },
1246
+ /**
1247
+ * 是否将指定date放在第一行,而不是按传统模式将每月1号放在第一行,此时会限定整个42格为起止范围,故可能不会显示完整的某月上下范围
1248
+ */
1249
+ isOnFirstLine: Boolean,
1250
+ /**
1251
+ * 是否开启范围选择
1252
+ */
1253
+ hasRange: Boolean,
1254
+ /**
1255
+ * 非当前有效时间范围内的日期是否可被选入范围
1256
+ */
1257
+ outerInRange: Boolean,
1258
+ /**
1259
+ * 选择一个范围后,再选择时是否先将已选范围清除,即是否可清除已选范围
1260
+ */
1261
+ clearable: {
1262
+ type: Boolean,
1263
+ default: !0
1264
+ },
1265
+ /**
1266
+ * 已选范围
1267
+ *
1268
+ * @example [{_date: '2020-01-01'}, {_date: new Date('2020-01-10')}]
1269
+ */
1270
+ range: Array,
1271
+ /**
1272
+ * 周标题内容类型,可选mini、short、long
1273
+ *
1274
+ * @example
1275
+ * weekType=mini 对应显示成 一、二、三。。。
1276
+ * weekType=short对应显示成 周一、周二、周三。。。
1277
+ * weekType=long 对应显示成 星期一、星期二、星期三。。。
1278
+ */
1279
+ weekType: {
1280
+ type: String,
1281
+ default: "mini"
1282
+ },
1283
+ /**
1284
+ * 周一到周日对应的映射,若传入有效对象则以该对象的key显示星期标题
1285
+ *
1286
+ * @example
1287
+ * 周六周日标题会分别显示成 “星期6” 和 “星期天”,忽略对应的翻译文本
1288
+ * :weekMap={0: '星期天', 6: '星期6'} *
1289
+ */
1290
+ weekMap: {
1291
+ type: Object
1292
+ // default(props: Obj) {
1293
+ // return [1, 2, 3, 4, 5, 6, 0].reduce((a, b) => Object.assign(a, { [b]: $i18n.t(`MCalendar.${props.weekType}.${b}`) }), {})
1294
+ // }
1295
+ }
1296
+ },
1297
+ emits: ["update:range", "select-range", "click-day", "dblclick-day"],
1298
+ setup(t, { emit: S }) {
1299
+ const e = t, l = S, a = P(), n = P(null), i = P(null), h = N(() => {
1300
+ let o = Math.floor(e.startDay);
1301
+ return (isNaN(o) || o < 0 || o > 6) && (o = 0), o;
1302
+ }), c = N(() => {
1303
+ let o;
1304
+ const b = [], D = h.value + 7;
1305
+ for (let d = h.value; d < D; d++)
1306
+ o = d % 7, b.push({
1307
+ title: e.weekMap?.[o] || R.t(`dCalendar.${e.weekType}.${o}`),
1308
+ order: o
1309
+ });
1310
+ return b;
1311
+ }), v = (o) => {
1312
+ let b = L(
1313
+ e.date || e.dates && e.dates[0] && e.dates[0][e.dateKey]
1314
+ ), D, d, C;
1315
+ return e.isOnFirstLine ? D = b : (D = b.startOf("month"), d = b.endOf("month")), C = D.day(), h.value !== 0 && C === 0 && (C = 7), b = D.subtract(C - h.value, "day"), e.isOnFirstLine && (d = b.add(41, "day")), {
1316
+ beginDate: b.format("YYYY-MM-DD"),
1317
+ endDate: d?.format("YYYY-MM-DD"),
1318
+ extra: [b, e.isOnFirstLine ? b : D, d]
1319
+ };
1320
+ }, f = () => {
1321
+ e.hasRange && (n.value = i.value = null);
1322
+ const {
1323
+ extra: [o, b, D]
1324
+ } = v(), d = e.dates?.[0] ? e.dates.slice() : [], C = /* @__PURE__ */ new Date();
1325
+ let u, r, A;
1326
+ for (a.value = [], u = 0; u < 42; u++)
1327
+ r = o.add(u, "day"), A = d.find((Y) => r.isSame(Y[e.dateKey], "day")), a.value.push({
1328
+ _date: r.toDate(),
1329
+ _text: r.format(e.textFormat),
1330
+ _isOuter: !r.isBetween(b, D, "day", "[]"),
1331
+ _isToday: r.isSame(C, "day"),
1332
+ // _rangeStart: undefined,
1333
+ // _rangeEnd: undefined,
1334
+ _inRange: void 0,
1335
+ ...A
1336
+ });
1337
+ };
1338
+ let g;
1339
+ const y = (o, b) => {
1340
+ const D = e.hasRange && (!o._isOuter || e.outerInRange);
1341
+ if (D)
1342
+ if (!n.value)
1343
+ n.value = o, o._inRange = !0;
1344
+ else if (i.value)
1345
+ n.value = i.value = null, a.value.forEach((d) => {
1346
+ d._inRange = !1;
1347
+ }), e.clearable || (n.value = o);
1348
+ else {
1349
+ if (o._date < n.value._date) {
1350
+ const d = n.value;
1351
+ n.value = o, o = d;
1352
+ }
1353
+ i.value = o, o._inRange = !0;
1354
+ }
1355
+ l("click-day", o, b), D && (g = !0, J(() => {
1356
+ g = null;
1357
+ }), l("update:range", [n.value, i.value]), l(
1358
+ "select-range",
1359
+ [n.value, i.value],
1360
+ a.value.slice(
1361
+ a.value.indexOf(n.value),
1362
+ a.value.indexOf(i.value) + 1
1363
+ )
1364
+ ));
1365
+ }, s = (o, b) => {
1366
+ l("dblclick-day", o, b);
1367
+ }, k = (o, b) => {
1368
+ if (!e.hasRange || !n.value || i.value || o._isOuter && !e.outerInRange)
1369
+ return;
1370
+ let D = a.value.indexOf(n.value);
1371
+ if (b < D) {
1372
+ const d = D;
1373
+ D = b, b = d;
1374
+ }
1375
+ a.value.forEach((d, C) => {
1376
+ d._inRange = C >= D && C <= b;
1377
+ });
1378
+ }, x = (o) => {
1379
+ if (!(!e.hasRange || g)) {
1380
+ if (!o || !o.length) {
1381
+ n.value = i.value = null, a.value.forEach((b) => {
1382
+ b._inRange = !1;
1383
+ });
1384
+ return;
1385
+ }
1386
+ if (o[0] && o[1]) {
1387
+ if (L(o[0]._date).isAfter(o[1]._date)) {
1388
+ const C = o[1];
1389
+ o[1] = o[0], o[0] = C;
1390
+ }
1391
+ let b, D, d;
1392
+ for (let C = 0, u = a.value.length; C < u; C++)
1393
+ if (b = L(a.value[C]._date), b.isSame(o[0]._date, "day") && (n.value = a.value[C], D = C), b.isSame(o[1]._date, "day")) {
1394
+ i.value = a.value[C], d = C;
1395
+ break;
1396
+ }
1397
+ a.value.forEach((C, u) => {
1398
+ C._inRange = u >= D && u <= d;
1399
+ });
1400
+ }
1401
+ }
1402
+ };
1403
+ return f(), e.range && x(e.range), z(
1404
+ () => e.date,
1405
+ (o) => {
1406
+ !e.dates && o instanceof Date && f();
1407
+ }
1408
+ ), z(
1409
+ () => e.dates,
1410
+ (o) => {
1411
+ o && f();
1412
+ }
1413
+ ), z(
1414
+ () => e.startDay,
1415
+ () => {
1416
+ f();
1417
+ }
1418
+ ), z(() => e.range, x), (o, b) => {
1419
+ const D = O("Col"), d = O("Row"), C = O("Spin");
1420
+ return V(), j("div", vt, [
1421
+ $(d, null, {
1422
+ default: B(() => [
1423
+ (V(!0), j(q, null, ee(c.value, (u, r) => (V(), H(D, {
1424
+ key: r,
1425
+ span: "4",
1426
+ class: ie([
1427
+ "mcalendar-title",
1428
+ { weekend: t.offDay.includes(u.order) },
1429
+ t.titleClass && t.titleClass(u, r)
1430
+ ])
1431
+ }, {
1432
+ default: B(() => [
1433
+ F(I(u.title), 1)
1434
+ ]),
1435
+ _: 2
1436
+ }, 1032, ["class"]))), 128))
1437
+ ]),
1438
+ _: 1
1439
+ }),
1440
+ $(d, null, {
1441
+ default: B(() => [
1442
+ (V(!0), j(q, null, ee(a.value, (u, r) => (V(), H(D, {
1443
+ key: r,
1444
+ span: "4",
1445
+ class: ie([
1446
+ "mcalendar-cell",
1447
+ { "mcalendar-cell_today": u._isToday },
1448
+ { outer: u._isOuter },
1449
+ { "range-start": u === n.value },
1450
+ { "in-range": u._inRange },
1451
+ { "range-end": u === i.value },
1452
+ t.dateClass && t.dateClass(u, r),
1453
+ u.className
1454
+ ]),
1455
+ onClick: (A) => y(u, r),
1456
+ onDblclick: (A) => s(u, r),
1457
+ onMouseenter: (A) => k(u, r)
1458
+ }, {
1459
+ default: B(() => [
1460
+ M(o.$slots, "cell", {
1461
+ day: u,
1462
+ index: r
1463
+ }, () => [
1464
+ F(I(u._text), 1)
1465
+ ])
1466
+ ]),
1467
+ _: 2
1468
+ }, 1032, ["class", "onClick", "onDblclick", "onMouseenter"]))), 128))
1469
+ ]),
1470
+ _: 3
1471
+ }),
1472
+ se($(C, { fix: "" }, null, 512), [
1473
+ [fe, t.loading]
1474
+ ])
1475
+ ]);
1476
+ };
1477
+ }
1478
+ }), kt = {
1479
+ name: "ModalFooter",
1480
+ inheritAttrs: !1
1481
+ }, St = /* @__PURE__ */ U({
1482
+ ...kt,
1483
+ props: {
1484
+ modelValue: Boolean,
1485
+ /**
1486
+ * 确定按钮文本
1487
+ */
1488
+ okText: {
1489
+ type: String,
1490
+ default() {
1491
+ return R.t("modalFooter.ok");
1492
+ }
1493
+ },
1494
+ /**
1495
+ * 取消按钮文本
1496
+ */
1497
+ cancelText: {
1498
+ type: String,
1499
+ default() {
1500
+ return R.t("modalFooter.cancel");
1501
+ }
1502
+ },
1503
+ /**
1504
+ * 传递给确定按钮的props
1505
+ */
1506
+ ok: Object,
1507
+ /**
1508
+ * 确定按钮加载状态
1509
+ */
1510
+ okLoading: Boolean,
1511
+ /**
1512
+ * 确定按钮禁用状态
1513
+ */
1514
+ okDisabled: Boolean,
1515
+ /**
1516
+ * 传递给取消按钮的props
1517
+ */
1518
+ cancel: Object,
1519
+ /**
1520
+ * 取消按钮加载状态
1521
+ */
1522
+ cancelLoading: Boolean,
1523
+ /**
1524
+ * 取消按钮禁用状态
1525
+ */
1526
+ cancelDisabled: Boolean,
1527
+ /**
1528
+ * 取消按钮type,默认 text
1529
+ */
1530
+ cancelType: {
1531
+ type: String,
1532
+ default: "text"
1533
+ },
1534
+ /**
1535
+ * 是否把取消按钮放到确定按钮右边
1536
+ */
1537
+ rightCancel: Boolean,
1538
+ /**
1539
+ * 是否显示确定按钮
1540
+ */
1541
+ hasOk: {
1542
+ type: Boolean,
1543
+ default: !0
1544
+ }
1545
+ },
1546
+ emits: ["update:modelValue", "ok", "cancel"],
1547
+ setup(t, { emit: S }) {
1548
+ const e = S, l = He(), a = () => {
1549
+ l.vnode.props.onCancel ? e("cancel") : e("update:modelValue", !1);
1550
+ };
1551
+ return (n, i) => {
1552
+ const h = O("Col"), c = O("Button"), v = O("Row");
1553
+ return V(), H(v, {
1554
+ justify: "space-between",
1555
+ align: "middle"
1556
+ }, {
1557
+ default: B(() => [
1558
+ $(h, null, {
1559
+ default: B(() => [
1560
+ M(n.$slots, "other")
1561
+ ]),
1562
+ _: 3
1563
+ }),
1564
+ $(h, { class: "flex" }, {
1565
+ default: B(() => [
1566
+ t.rightCancel ? (V(), j(q, { key: 1 }, [
1567
+ t.hasOk ? (V(), H(c, K({
1568
+ key: 0,
1569
+ disabled: t.okDisabled,
1570
+ loading: t.okLoading
1571
+ }, t.ok, {
1572
+ type: "primary",
1573
+ onClick: i[1] || (i[1] = (f) => n.$emit("ok"))
1574
+ }), {
1575
+ default: B(() => [
1576
+ F(I(t.okText), 1)
1577
+ ]),
1578
+ _: 1
1579
+ }, 16, ["disabled", "loading"])) : W("", !0),
1580
+ $(c, K({
1581
+ disabled: t.cancelDisabled,
1582
+ loading: t.cancelLoading,
1583
+ type: t.cancelType
1584
+ }, t.cancel, { onClick: a }), {
1585
+ default: B(() => [
1586
+ F(I(t.cancelText), 1)
1587
+ ]),
1588
+ _: 1
1589
+ }, 16, ["disabled", "loading", "type"])
1590
+ ], 64)) : (V(), j(q, { key: 0 }, [
1591
+ $(c, K({
1592
+ disabled: t.cancelDisabled,
1593
+ loading: t.cancelLoading,
1594
+ type: t.cancelType
1595
+ }, t.cancel, { onClick: a }), {
1596
+ default: B(() => [
1597
+ F(I(t.cancelText), 1)
1598
+ ]),
1599
+ _: 1
1600
+ }, 16, ["disabled", "loading", "type"]),
1601
+ t.hasOk ? (V(), H(c, K({
1602
+ key: 0,
1603
+ disabled: t.okDisabled,
1604
+ loading: t.okLoading
1605
+ }, t.ok, {
1606
+ type: "primary",
1607
+ onClick: i[0] || (i[0] = (f) => n.$emit("ok"))
1608
+ }), {
1609
+ default: B(() => [
1610
+ F(I(t.okText), 1)
1611
+ ]),
1612
+ _: 1
1613
+ }, 16, ["disabled", "loading"])) : W("", !0)
1614
+ ], 64)),
1615
+ M(n.$slots, "action")
1616
+ ]),
1617
+ _: 3
1618
+ })
1619
+ ]),
1620
+ _: 3
1621
+ });
1622
+ };
1623
+ }
1624
+ }), Bt = {
1625
+ key: 0,
1626
+ class: "ivu-dropdown-item"
1627
+ }, _ = {}, Ct = {
1628
+ name: "ToggleColumn"
1629
+ }, Te = /* @__PURE__ */ U({
1630
+ ...Ct,
1631
+ props: {
1632
+ modelValue: {
1633
+ type: Array
1634
+ },
1635
+ title: {
1636
+ type: String,
1637
+ default() {
1638
+ return R.t("toggleColumn.title");
1639
+ }
1640
+ },
1641
+ /**
1642
+ * 仅显示图标
1643
+ */
1644
+ icon: String,
1645
+ /**
1646
+ * 绑定columns对应的唯一标识,一般在v-for中绑定了固定某列且列配置中带有 _visible:false 时用到
1647
+ */
1648
+ cacheId: [String, Number],
1649
+ /**
1650
+ * 是否显示全选框
1651
+ */
1652
+ all: {
1653
+ type: Boolean,
1654
+ default: !0
1655
+ },
1656
+ transfer: Boolean,
1657
+ /**
1658
+ * 将状态缓存至localStorage中的key,支持a.b形式
1659
+ *
1660
+ * @example
1661
+ * // 组件会尝试将显示状态读写至 localStorage.app.main.cols
1662
+ * storeAt='app.main.cols'
1663
+ */
1664
+ storeAt: String
1665
+ },
1666
+ emits: ["update:modelValue", "change"],
1667
+ setup(t, { emit: S }) {
1668
+ const e = t, l = S;
1669
+ let a, n, i;
1670
+ const h = (u) => {
1671
+ clearTimeout(a);
1672
+ let r = localStorage.getItem(n);
1673
+ r = r ? JSON.parse(r) : {}, u ? Ye(r, _e(i, c)) : Ue(r, i, c), a = setTimeout(() => {
1674
+ a = null, localStorage.setItem(n, JSON.stringify(r));
1675
+ });
1676
+ };
1677
+ let c;
1678
+ e.storeAt && (n = e.storeAt.split(".")[0], i = e.storeAt.slice(n.length + 1), c = localStorage.getItem(n) && pe(JSON.parse(localStorage[n]), i), c || (c = {}, h(!0)));
1679
+ const v = P(!1), f = ye([]), g = P([]), y = N(() => {
1680
+ const u = g.value.filter((r) => r._switchable);
1681
+ return u.some((r) => r._visible) && u.some((r) => !r._visible);
1682
+ }), s = N({
1683
+ get() {
1684
+ const u = g.value.filter((r) => r._switchable);
1685
+ return u.length > 0 && u.every((r) => r._visible);
1686
+ },
1687
+ set(u) {
1688
+ g.value.forEach((r, A) => {
1689
+ r._switchable && (f.value[A]._visible = r._visible = u);
1690
+ }), e.storeAt && (g.value.forEach((r, A) => {
1691
+ c[r.key] = r._visible;
1692
+ }), h()), C(), l("change", f.value);
1693
+ }
1694
+ });
1695
+ function k() {
1696
+ const u = g.value.filter((r) => r._visible);
1697
+ if (!e.all && u.length === 1) {
1698
+ u[0]._switchable = !1;
1699
+ return;
1700
+ }
1701
+ u.forEach((r) => {
1702
+ r.initSwitchable && !r._switchable && (r._switchable = !0);
1703
+ });
1704
+ }
1705
+ function x(u, r) {
1706
+ f.value[r]._visible = u._visible, e.storeAt && (c[u.key] = u._visible, h()), C(), k(), l("change", f.value[r]);
1707
+ }
1708
+ let o;
1709
+ function b(u) {
1710
+ clearTimeout(o), o = setTimeout(() => {
1711
+ v.value = u;
1712
+ }, 200);
1713
+ }
1714
+ function D() {
1715
+ (_[e.cacheId]?.cols || e.modelValue).forEach((u) => {
1716
+ u.hasOwnProperty("_visible") || (e.storeAt ? u._visible = c[u.key] === void 0 || c[u.key] : u._visible = !0), u.hasOwnProperty("_switchable") || (u._switchable = !0), f.value.push(u), g.value.push({
1717
+ title: u.title || "",
1718
+ key: u.key,
1719
+ initSwitchable: u._switchable,
1720
+ _switchable: u._switchable,
1721
+ _visible: u._visible
1722
+ });
1723
+ }), k(), C();
1724
+ }
1725
+ let d;
1726
+ function C() {
1727
+ e.cacheId != null && (_[e.cacheId].flag = !0, J(() => {
1728
+ _[e.cacheId].flag = null;
1729
+ })), d = !0, J(() => {
1730
+ d = null;
1731
+ }), l(
1732
+ "update:modelValue",
1733
+ f.value.filter((u) => u._visible)
1734
+ );
1735
+ }
1736
+ return ce(() => {
1737
+ e.cacheId != null && (_[e.cacheId] ? _[e.cacheId].all++ : _[e.cacheId] = { cols: e.modelValue, all: 1 }, Oe(() => {
1738
+ _[e.cacheId] && --_[e.cacheId].all < 1 && delete _[e.cacheId];
1739
+ })), D();
1740
+ }), z(
1741
+ () => e.modelValue,
1742
+ (u) => {
1743
+ d || (_[e.cacheId] && !_[e.cacheId].flag && (_[e.cacheId].cols = u), f.value = [], g.value = [], D());
1744
+ }
1745
+ ), (u, r) => {
1746
+ const A = O("Icon"), Y = O("Button"), ae = O("Checkbox"), le = O("DropdownItem"), me = O("DropdownMenu"), de = O("Dropdown");
1747
+ return V(), H(de, {
1748
+ trigger: "custom",
1749
+ visible: v.value,
1750
+ placement: "bottom-end",
1751
+ transfer: t.transfer,
1752
+ "transfer-class-name": "toggle-column-pop",
1753
+ class: "toggle-column"
1754
+ }, {
1755
+ list: B(() => [
1756
+ te("div", {
1757
+ onMouseenter: r[3] || (r[3] = (E) => b(!0)),
1758
+ onMouseleave: r[4] || (r[4] = (E) => b(!1))
1759
+ }, [
1760
+ t.all ? (V(), j("div", Bt, [
1761
+ $(ae, {
1762
+ modelValue: s.value,
1763
+ "onUpdate:modelValue": r[2] || (r[2] = (E) => s.value = E),
1764
+ indeterminate: y.value
1765
+ }, {
1766
+ default: B(() => [
1767
+ F(I(G(R).t("toggleColumn.checkAll")), 1)
1768
+ ]),
1769
+ _: 1
1770
+ }, 8, ["modelValue", "indeterminate"])
1771
+ ])) : W("", !0),
1772
+ $(me, { class: "toggle-column-list" }, {
1773
+ default: B(() => [
1774
+ (V(!0), j(q, null, ee(g.value, (E, ge) => (V(), H(le, {
1775
+ key: ge,
1776
+ disabled: !E._switchable
1777
+ }, {
1778
+ default: B(() => [
1779
+ $(ae, {
1780
+ modelValue: E._visible,
1781
+ "onUpdate:modelValue": (Z) => E._visible = Z,
1782
+ disabled: !E._switchable,
1783
+ onOnChange: (Z) => x(E, ge)
1784
+ }, {
1785
+ default: B(() => [
1786
+ F(I(E.title), 1)
1787
+ ]),
1788
+ _: 2
1789
+ }, 1032, ["modelValue", "onUpdate:modelValue", "disabled", "onOnChange"])
1790
+ ]),
1791
+ _: 2
1792
+ }, 1032, ["disabled"]))), 128))
1793
+ ]),
1794
+ _: 1
1795
+ })
1796
+ ], 32)
1797
+ ]),
1798
+ default: B(() => [
1799
+ te("span", {
1800
+ onMouseover: r[0] || (r[0] = (E) => b(!0)),
1801
+ onMouseout: r[1] || (r[1] = (E) => b(!1)),
1802
+ class: "toggle-column-btn"
1803
+ }, [
1804
+ M(u.$slots, "default", {}, () => [
1805
+ $(Y, {
1806
+ type: "default",
1807
+ icon: t.icon
1808
+ }, {
1809
+ default: B(() => [
1810
+ t.icon ? W("", !0) : (V(), j(q, { key: 0 }, [
1811
+ F(I(t.title) + " ", 1),
1812
+ $(A, { type: "ios-arrow-down" })
1813
+ ], 64))
1814
+ ]),
1815
+ _: 1
1816
+ }, 8, ["icon"])
1817
+ ])
1818
+ ], 32)
1819
+ ]),
1820
+ _: 3
1821
+ }, 8, ["visible", "transfer"]);
1822
+ };
1823
+ }
1824
+ });
1825
+ function Vt(t, S = ["id", "class", "style"]) {
1826
+ const e = {};
1827
+ return Object.entries(t).forEach((l) => {
1828
+ S.includes(l[0]) || (e[l[0]] = l[1]);
1829
+ }), e;
1830
+ }
1831
+ const Dt = {
1832
+ class: "page-table-header-title"
1833
+ }, $t = {
1834
+ class: "page-table-list"
1835
+ }, Ot = {
1836
+ name: "PageTable"
1837
+ // inheritAttrs: false
1838
+ }, xt = /* @__PURE__ */ U({
1839
+ ...Ot,
1840
+ props: /* @__PURE__ */ Be({
1841
+ columns: {
1842
+ type: Array,
1843
+ default: () => []
1844
+ },
1845
+ modelValue: {
1846
+ type: Array,
1847
+ default: () => []
1848
+ },
1849
+ /**
1850
+ * 远程请求方法
1851
+ *
1852
+ * @example
1853
+ * const getResult = () => axios.get('').then(res => res.data)
1854
+ * <PageTable :method="getResult" />
1855
+ */
1856
+ method: Function,
1857
+ /**
1858
+ * 调用 method 时传入的参数或者返回参数的函数
1859
+ */
1860
+ param: [Object, Function],
1861
+ /**
1862
+ * 返回值中对应的列表数据key
1863
+ *
1864
+ * @example 如返回结构是 { result: [1,2,3], total: 100 },则dataKey='result'
1865
+ */
1866
+ dataKey: String,
1867
+ /**
1868
+ * 返回值中对应的分页总条数key
1869
+ *
1870
+ * @example 如返回结构是 { result: [1,2,3], total: 100 },则totalKey='total'
1871
+ */
1872
+ totalKey: String,
1873
+ /**
1874
+ * 请求时传递的分页参数中 first 对应 key
1875
+ * 后端分页一般要求指定起始数据索引或者“页码”,以及获取多少条数据
1876
+ *
1877
+ * @example
1878
+ * 如后端接口给定的分页参数是 firstIndex 对应起始索引
1879
+ * pageKey='firstIndex'
1880
+ */
1881
+ pageKey: String,
1882
+ /**
1883
+ * 请求时传递的分页参数中 size 对应 key
1884
+ * 后端分页一般要求指定起始数据索引或者“页码”,以及获取多少条数据
1885
+ *
1886
+ * @example
1887
+ * 如后端接口给定的分页参数是 amount 对应需要获取的条数
1888
+ * sizeKey='amount'
1889
+ */
1890
+ sizeKey: String,
1891
+ /**
1892
+ * 对象形式传递分页参数映射
1893
+ */
1894
+ pageMap: {
1895
+ type: Object,
1896
+ default(t) {
1897
+ return {
1898
+ first: t.pageKey,
1899
+ pageSize: t.sizeKey
1900
+ };
1901
+ }
1902
+ },
1903
+ border: Boolean,
1904
+ /**
1905
+ * 处理接口返回列表数据的函数
1906
+ */
1907
+ process: Function,
1908
+ // loading: Boolean,
1909
+ /**
1910
+ * 自动设置Table的maxHeight
1911
+ */
1912
+ autoMaxHeight: {
1913
+ type: Boolean,
1914
+ default: !0
1915
+ },
1916
+ /**
1917
+ * 是否本地分页
1918
+ */
1919
+ isLocal: Boolean,
1920
+ /**
1921
+ * 分页条数选项
1922
+ */
1923
+ pageSizeOpts: {
1924
+ type: Array,
1925
+ default: () => [30, 50, 100, 200]
1926
+ },
1927
+ /**
1928
+ * 查询失败时不清除之前获取到的结果
1929
+ */
1930
+ autoRemain: Boolean,
1931
+ /**
1932
+ * 计算Table的maxHeight时,Table距离视口底部的距离
1933
+ * @default 80
1934
+ */
1935
+ bottomDis: {
1936
+ type: [Number, String],
1937
+ default: 80
1938
+ },
1939
+ /**
1940
+ * Table的maxHeight
1941
+ */
1942
+ maxHeight: [Number, String],
1943
+ /**
1944
+ * 勾选项
1945
+ */
1946
+ selection: Array,
1947
+ /**
1948
+ * 初始分页条数
1949
+ */
1950
+ initSize: Number,
1951
+ /**
1952
+ * 远程查询时额外检测的方法
1953
+ */
1954
+ check: Function,
1955
+ /**
1956
+ * 查询时是否用页码而不是用当页第一条的索引
1957
+ */
1958
+ usePageNum: Boolean,
1959
+ /**
1960
+ * 是否点击行即更改Checkbox状态
1961
+ */
1962
+ clickToCheck: Boolean,
1963
+ /**
1964
+ * 获取的勾选项是否去除_checked等内部属性
1965
+ */
1966
+ pure: Boolean,
1967
+ /**
1968
+ * head title
1969
+ */
1970
+ title: {
1971
+ type: String,
1972
+ default() {
1973
+ return R.t("pageTable.title");
1974
+ }
1975
+ },
1976
+ /**
1977
+ * 是否显示header
1978
+ */
1979
+ showHeader: Boolean,
1980
+ transfer: {
1981
+ type: Boolean,
1982
+ default: !0
1983
+ },
1984
+ /**
1985
+ * 最大化时是否全屏
1986
+ */
1987
+ fullscreen: Boolean,
1988
+ /**
1989
+ * 传至ToggleColumn组件的storeAt
1990
+ */
1991
+ storeAt: String
1992
+ }, {
1993
+ loading: {
1994
+ type: Boolean
1995
+ },
1996
+ loadingModifiers: {}
1997
+ }),
1998
+ emits: /* @__PURE__ */ Be(["update:modelValue", "update:selection", "load", "select-all", "select-rows", "select", "reload", "change-col"], ["update:loading"]),
1999
+ setup(t, {
2000
+ expose: S,
2001
+ emit: e
2002
+ }) {
2003
+ const l = Vt(Le()), a = t, n = e;
2004
+ let i;
2005
+ const h = Ee(t, "loading"), c = be("tableRef"), v = be("elRef"), f = P(!1), g = ye(), y = Ke({
2006
+ data: [],
2007
+ // rows: [] as Obj[],
2008
+ // selections: [],
2009
+ // loading: false,
2010
+ maxHeight: null,
2011
+ selectType: {
2012
+ align: "center",
2013
+ className: "page-table-mr0",
2014
+ renderHeader: (m) => {
2015
+ const p = y.data.filter((T) => T._checkable && !T._disabled), w = p.length;
2016
+ return (
2017
+ // table.rows.some((e) => e._checkable) && (
2018
+ y.data.some((T) => T._checkable) && $(Ce, {
2019
+ "model-value": !!w && p.every((T) => T._checked),
2020
+ disabled: !w,
2021
+ "onUpdate:model-value": (T) => {
2022
+ p.forEach((Q) => {
2023
+ Q._checked = T;
2024
+ });
2025
+ },
2026
+ onOnChange: (T) => {
2027
+ ae(), n("select-all", a.pure ? p.map((Q) => Z(Q)) : p, T);
2028
+ }
2029
+ }, null)
2030
+ );
2031
+ },
2032
+ render: (m, {
2033
+ row: p,
2034
+ index: w
2035
+ }) => p._checkable && $(Ce, {
2036
+ "model-value": p._checked,
2037
+ disabled: p._disabled,
2038
+ "onUpdate:model-value": (T) => {
2039
+ ge(y.data[w], T);
2040
+ }
2041
+ }, null)
2042
+ }
2043
+ }), s = De({
2044
+ curr: 1,
2045
+ size: 30,
2046
+ total: 0
2047
+ }), k = N(() => f.value ? !1 : a.transfer), x = N(() => {
2048
+ const m = [], p = (w) => {
2049
+ w.slot && m.push(w), w.children && w.children.forEach((T) => {
2050
+ p(T);
2051
+ });
2052
+ };
2053
+ return a.columns.forEach((w) => {
2054
+ p(w);
2055
+ }), m;
2056
+ });
2057
+ function o() {
2058
+ const m = a.columns.find((p) => p.type === "selection");
2059
+ if (m) {
2060
+ const p = {
2061
+ // fixed: selectType.fixed,
2062
+ // key: selectType.key,
2063
+ ...m,
2064
+ width: m.width || 54,
2065
+ type: void 0,
2066
+ ...y.selectType
2067
+ };
2068
+ g.value = [p].concat(a.columns.slice(1));
2069
+ } else
2070
+ g.value = a.columns;
2071
+ }
2072
+ let b;
2073
+ async function D() {
2074
+ if (typeof a.method != "function") return console.warn("typeof method isn't function");
2075
+ h.value = !0, n("update:selection", []);
2076
+ const m = await a.method(Object.assign(me(), typeof a.param != "function" ? a.param : a.param()));
2077
+ if (h.value = !1, !m) {
2078
+ a.autoRemain || (s.total = 0, n("update:modelValue", []));
2079
+ return;
2080
+ }
2081
+ let p = pe(m, a.dataKey) || [];
2082
+ if (d(p), typeof a.process == "function") {
2083
+ const w = a.process(p);
2084
+ Array.isArray(w) && (p = w);
2085
+ }
2086
+ y.data = p, s.total = pe(m, a.totalKey), b = !0, n("update:modelValue", y.data), n("load", m), setTimeout(() => {
2087
+ b = null;
2088
+ });
2089
+ }
2090
+ function d(m) {
2091
+ a.columns.some((p) => p.type === "selection") && m.forEach((p) => {
2092
+ p._checkable = !0, p._checked = p._disabled = !1;
2093
+ });
2094
+ }
2095
+ function C(m) {
2096
+ typeof a.check == "function" && !a.check() || (a.isLocal ? u(m) : D());
2097
+ }
2098
+ function u(m) {
2099
+ let p = m ? s.size * (s.curr - 1) : 0;
2100
+ const w = [], T = p + s.size, Q = T > s.total ? s.total : T, re = a.modelValue;
2101
+ for (; p < Q; p++)
2102
+ re[p]._checked = re[p]._disabled = !1, w.push(re[p]);
2103
+ y.data = w, n("update:selection", []);
2104
+ }
2105
+ function r() {
2106
+ C(!0);
2107
+ }
2108
+ function A(m) {
2109
+ s.size = m, s.curr === 1 && C();
2110
+ }
2111
+ function Y(m) {
2112
+ m !== !0 && (s.curr = 1), J(D);
2113
+ }
2114
+ function ae(m, p) {
2115
+ m && (m._checked = p);
2116
+ let w = y.data.filter((T) => T._checked);
2117
+ a.pure && (w = w.map((T) => Z(T))), n("update:selection", w), n("select-rows", w);
2118
+ }
2119
+ function le() {
2120
+ J(() => {
2121
+ const m = window.innerHeight - +a.bottomDis - c.value.$el.getBoundingClientRect().top;
2122
+ y.maxHeight = m > 0 ? m : 0;
2123
+ });
2124
+ }
2125
+ function me() {
2126
+ return {
2127
+ [a.pageMap.first]: a.usePageNum ? s.curr : s.size * (s.curr - 1),
2128
+ [a.pageMap.pageSize]: s.size
2129
+ };
2130
+ }
2131
+ let de;
2132
+ function E(m, p) {
2133
+ !a.clickToCheck || !m._checkable || m._disabled || (de = !0, m = y.data[p], m._checked = !m._checked, ae(m, m._checked), n("select", a.pure ? Z(m) : m, m._checked), setTimeout(() => {
2134
+ de = null;
2135
+ }));
2136
+ }
2137
+ function ge(m, p) {
2138
+ de || (ae(m, p), n("select", a.pure ? Z(m) : m, p));
2139
+ }
2140
+ function Z(m) {
2141
+ const p = {
2142
+ ...m
2143
+ };
2144
+ return delete p._checkable, delete p._checked, delete p._disabled, p;
2145
+ }
2146
+ function Ae() {
2147
+ if (a.fullscreen) {
2148
+ f.value ? document.exitFullscreen() : v.value.requestFullscreen();
2149
+ return;
2150
+ }
2151
+ f.value = !f.value, f.value ? (setTimeout(le), document.body.classList.add("clip")) : (y.maxHeight = a.maxHeight ?? i, document.body.classList.remove("clip"));
2152
+ }
2153
+ function Me() {
2154
+ h.value || (a.isLocal ? n("reload") : Y());
2155
+ }
2156
+ return S({
2157
+ search: Y,
2158
+ setMaxHeight: le,
2159
+ table: y,
2160
+ getPage: () => ({
2161
+ ...me(),
2162
+ curr: s.curr,
2163
+ total: s.total
2164
+ })
2165
+ }), o(), s.size = a.initSize || a.pageSizeOpts[0], ce(() => {
2166
+ !a.maxHeight && a.autoMaxHeight && (le(), J(() => {
2167
+ i = y.maxHeight;
2168
+ })), a.fullscreen && (v.value.onfullscreenchange = () => {
2169
+ f.value = !!document.fullscreenElement, f.value ? setTimeout(le) : y.maxHeight = a.maxHeight ?? i;
2170
+ });
2171
+ }), Oe(() => {
2172
+ v.value.onfullscreenchange = null;
2173
+ }), z(() => a.modelValue, (m) => {
2174
+ const p = Array.isArray(m) ? m : [];
2175
+ if (a.isLocal) {
2176
+ s.curr = 1, s.total = p.length, d(p), u();
2177
+ return;
2178
+ }
2179
+ b || (s.curr = 1, s.total = p.length, y.data = p);
2180
+ }, {
2181
+ immediate: !0
2182
+ }), z(() => a.maxHeight, (m) => {
2183
+ y.maxHeight = m;
2184
+ }, {
2185
+ immediate: !0
2186
+ }), z(() => a.columns, () => {
2187
+ o();
2188
+ }), (m, p) => {
2189
+ const w = O("Col"), T = O("Icon"), Q = O("Tooltip"), re = O("Row"), Re = O("Table"), Ie = O("Page");
2190
+ return V(), j("div", {
2191
+ ref: "elRef",
2192
+ class: ie(["page-table-container", {
2193
+ "page-table-bordered": t.border && t.showHeader,
2194
+ "page-table-maximized": f.value,
2195
+ "page-table-fullscreen": f.value && t.fullscreen
2196
+ }])
2197
+ }, [t.showHeader ? (V(), H(re, {
2198
+ key: 0,
2199
+ justify: "space-between",
2200
+ align: "middle",
2201
+ class: "page-table-header"
2202
+ }, {
2203
+ default: B(() => [$(w, null, {
2204
+ default: B(() => [M(m.$slots, "title", {}, () => [te("h1", Dt, I(t.title), 1)])]),
2205
+ _: 3
2206
+ }), $(w, null, {
2207
+ default: B(() => [M(m.$slots, "headerAction"), $(Q, {
2208
+ placement: "top",
2209
+ content: G(R).t("pageTable.reload"),
2210
+ transfer: k.value,
2211
+ class: "page-table-action"
2212
+ }, {
2213
+ default: B(() => [$(T, {
2214
+ type: "md-refresh",
2215
+ size: "20",
2216
+ onClick: Me
2217
+ })]),
2218
+ _: 1
2219
+ }, 8, ["content", "transfer"]), $(Q, {
2220
+ placement: "top",
2221
+ content: G(R).t(`pageTable.${f.value ? "restore" : "maxmize"}`),
2222
+ transfer: k.value,
2223
+ class: "page-table-action"
2224
+ }, {
2225
+ default: B(() => [$(T, {
2226
+ type: f.value ? "md-contract" : "md-expand",
2227
+ size: "20",
2228
+ onClick: Ae
2229
+ }, null, 8, ["type"])]),
2230
+ _: 1
2231
+ }, 8, ["content", "transfer"]), $(Te, {
2232
+ modelValue: g.value,
2233
+ "onUpdate:modelValue": p[0] || (p[0] = (X) => g.value = X),
2234
+ size: "20",
2235
+ transfer: k.value,
2236
+ "store-at": t.storeAt,
2237
+ onChange: p[1] || (p[1] = (X) => m.$emit("change-col", X))
2238
+ }, {
2239
+ default: B(() => [$(T, {
2240
+ type: "md-settings",
2241
+ size: "20"
2242
+ })]),
2243
+ _: 1
2244
+ }, 8, ["modelValue", "transfer", "store-at"])]),
2245
+ _: 3
2246
+ })]),
2247
+ _: 3
2248
+ })) : W("", !0), te("div", $t, [$(Re, K({
2249
+ ref: "tableRef"
2250
+ }, G(l), {
2251
+ border: t.border,
2252
+ columns: g.value,
2253
+ data: y.data,
2254
+ loading: h.value,
2255
+ "max-height": y.maxHeight,
2256
+ onOnRowClick: E
2257
+ }), $e({
2258
+ _: 2
2259
+ }, [m.$slots.header ? {
2260
+ name: "header",
2261
+ fn: B(() => [M(m.$slots, "header")]),
2262
+ key: "0"
2263
+ } : void 0, ee(x.value, (X) => ({
2264
+ name: X.slot,
2265
+ fn: B((ze) => [M(m.$slots, X.slot, ke(Se(ze)))])
2266
+ })), m.$slots.footer ? {
2267
+ name: "footer",
2268
+ fn: B(() => [M(m.$slots, "footer")]),
2269
+ key: "1"
2270
+ } : void 0]), 1040, ["border", "columns", "data", "loading", "max-height"]), $(Ie, {
2271
+ modelValue: G(s).curr,
2272
+ "onUpdate:modelValue": p[2] || (p[2] = (X) => G(s).curr = X),
2273
+ total: G(s).total,
2274
+ "page-size": G(s).size,
2275
+ "show-total": "",
2276
+ "show-sizer": "",
2277
+ "show-elevator": "",
2278
+ transfer: k.value,
2279
+ "page-size-opts": t.pageSizeOpts,
2280
+ class: "page-table-page-right",
2281
+ onOnChange: r,
2282
+ onOnPageSizeChange: A
2283
+ }, null, 8, ["modelValue", "total", "page-size", "transfer", "page-size-opts"])])], 2);
2284
+ };
2285
+ }
2286
+ }), wt = [
2287
+ We,
2288
+ Qe,
2289
+ at,
2290
+ ot,
2291
+ dt,
2292
+ we,
2293
+ ct,
2294
+ gt,
2295
+ ht,
2296
+ yt,
2297
+ St,
2298
+ xt,
2299
+ Te
2300
+ ], Tt = { iviewSelect: xe }, Ve = {
2301
+ isSameOrBefore: Fe,
2302
+ isSameOrAfter: je,
2303
+ isBetween: Ne
2304
+ };
2305
+ for (const t in Ve)
2306
+ !L.prototype[t] && L.extend(Ve[t]);
2307
+ function At(t, S = {}) {
2308
+ if (wt.forEach((e) => {
2309
+ t.component(e.name, e);
2310
+ }), Object.entries(Tt).forEach((e) => {
2311
+ t.directive(e[0], e[1]);
2312
+ }), S.msg) {
2313
+ R.msg = S.msg;
2314
+ return;
2315
+ }
2316
+ S.i18n && (R.i18n = S.i18n, S.msgPrefix && S.msgPrefix !== "d" && (R.prefix = S.msgPrefix));
2317
+ }
2318
+ const Gt = {
2319
+ install: At
2320
+ };
2321
+ export {
2322
+ We as AllCheckbox,
2323
+ Qe as BaseSwitch,
2324
+ dt as CacheSelect,
2325
+ at as Combi,
2326
+ ot as CountRange,
2327
+ ct as CurdTable,
2328
+ gt as DateRange,
2329
+ ht as DateRangePicker,
2330
+ yt as MCalendar,
2331
+ St as ModalFooter,
2332
+ xt as PageTable,
2333
+ we as RemoteSelect,
2334
+ Te as ToggleColumn,
2335
+ Gt as default,
2336
+ At as install,
2337
+ xe as iviewSelect
2338
+ };