view-ui-plus-derive 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,25 +1,25 @@
1
- import { defineComponent as _, shallowRef as ye, computed as N, onMounted as de, watch as z, resolveComponent as O, createElementBlock as P, openBlock as V, withDirectives as ie, createVNode as x, withCtx as C, createTextVNode as j, toDisplayString as F, unref as M, vShow as ce, Fragment as X, renderList as ee, createBlock as E, renderSlot as R, ref as H, mergeProps as U, useSlots as Me, createCommentVNode as W, createElementVNode as te, normalizeClass as oe, nextTick as J, shallowReactive as De, useTemplateRef as be, normalizeProps as ke, guardReactiveProps as Ce, createSlots as Ve, getCurrentInstance as ge, onBeforeUnmount as $e, mergeModels as Se, useModel as ze, reactive as Fe } from "vue";
2
- import { getPathValue as fe, setPathValue as je, deepMerge as Pe, makeObjectByPath as Ne, omitOwnKeys as He } from "utils-where";
3
- import Le from "./locale/zh-CN.js";
1
+ import { defineComponent as U, shallowRef as Ce, computed as P, onMounted as se, watch as I, createElementBlock as j, openBlock as D, withDirectives as _, createVNode as O, unref as n, withCtx as C, createTextVNode as H, toDisplayString as z, vShow as ie, Fragment as W, renderList as Z, createBlock as E, renderSlot as w, ref as L, mergeProps as K, useSlots as Ge, normalizeClass as F, createCommentVNode as J, createElementVNode as Q, nextTick as G, shallowReactive as Ie, useTemplateRef as re, normalizeProps as Be, guardReactiveProps as Ve, getCurrentInstance as me, createSlots as ze, onBeforeUnmount as Fe, mergeModels as Ae, useModel as Je, reactive as qe } from "vue";
2
+ import { Checkbox as ne, CheckboxGroup as We, Switch as Xe, InputNumber as Re, Select as Ze, Option as Qe, DatePicker as ke, Table as He, Button as X, Row as fe, Col as oe, Spin as _e, Dropdown as et, Icon as ce, DropdownMenu as tt, DropdownItem as at, Tooltip as Me, Page as lt } from "view-ui-plus";
3
+ import { getPathValue as ge, setPathValue as nt, deepMerge as ot, makeObjectByPath as it, omitOwnKeys as ut } from "utils-where";
4
+ import st from "./locale/zh-CN.js";
4
5
  /* empty css */
5
6
  /* empty css */
6
- import { i as xe } from "./directives/v-iview-select.js";
7
+ import { i as je } from "./directives/v-iview-select.js";
7
8
  /* empty css */
8
9
  /* empty css */
9
- import { Checkbox as Be } from "view-ui-plus";
10
10
  /* empty css */
11
11
  /* empty css */
12
- const A = {
12
+ const M = {
13
13
  i18n: null,
14
14
  prefix: "d",
15
- msg: Le,
15
+ msg: st,
16
16
  t(t, ...S) {
17
- return A.i18n?.global.t(A.prefix + "." + t, ...S) ?? fe(A.msg, A.prefix + "." + t) ?? t;
17
+ return M.i18n?.global.t(M.prefix + "." + t, ...S) ?? ge(M.msg, M.prefix + "." + t) ?? t;
18
18
  }
19
- }, Ee = {
19
+ }, dt = {
20
20
  name: "AllCheckbox"
21
- }, Ke = /* @__PURE__ */ _({
22
- ...Ee,
21
+ }, rt = /* @__PURE__ */ U({
22
+ ...dt,
23
23
  props: {
24
24
  modelValue: Array,
25
25
  /**
@@ -70,70 +70,67 @@ const A = {
70
70
  },
71
71
  emits: ["update:modelValue", "update:all", "change"],
72
72
  setup(t, { emit: S }) {
73
- const a = t, e = S, l = ye(a.modelValue || []), n = N({
73
+ const a = t, e = S, l = Ce(a.modelValue || []), o = P({
74
74
  get() {
75
75
  return l.value.length === a.list.length;
76
76
  },
77
- set(d) {
78
- l.value = d ? a.list.map((s) => s[a.keyMap.value]) : [];
77
+ set(p) {
78
+ l.value = p ? a.list.map((b) => b[a.keyMap.value]) : [];
79
79
  }
80
- }), i = N(
80
+ }), i = P(
81
81
  () => l.value.length > 0 && l.value.length < a.list.length
82
82
  );
83
- function p() {
84
- e("update:modelValue", l.value), e("update:all", n.value), e("change", l.value, n.value);
83
+ function h() {
84
+ e("update:modelValue", l.value), e("update:all", o.value), e("change", l.value, o.value);
85
85
  }
86
- return de(() => {
87
- e("update:all", n.value);
88
- }), z(
86
+ return se(() => {
87
+ e("update:all", o.value);
88
+ }), I(
89
89
  () => a.modelValue,
90
- (d) => {
91
- l.value !== d && (l.value = d || [], e("update:all", n.value));
90
+ (p) => {
91
+ l.value !== p && (l.value = p || [], e("update:all", o.value));
92
92
  }
93
- ), (d, s) => {
94
- const h = O("Checkbox"), u = O("CheckboxGroup");
95
- return V(), P("div", null, [
96
- ie(x(h, {
97
- modelValue: n.value,
98
- "onUpdate:modelValue": s[0] || (s[0] = (v) => n.value = v),
99
- indeterminate: i.value,
100
- onOnChange: p
101
- }, {
102
- default: C(() => [
103
- j(F(t.title ?? M(A).t("allCheckbox.title")), 1)
104
- ]),
105
- _: 1
106
- }, 8, ["modelValue", "indeterminate"]), [
107
- [ce, !t.hideAll]
93
+ ), (p, b) => (D(), j("div", null, [
94
+ _(O(n(ne), {
95
+ modelValue: o.value,
96
+ "onUpdate:modelValue": b[0] || (b[0] = (v) => o.value = v),
97
+ indeterminate: i.value,
98
+ onOnChange: h
99
+ }, {
100
+ default: C(() => [
101
+ H(z(t.title ?? n(M).t("allCheckbox.title")), 1)
108
102
  ]),
109
- x(u, {
110
- modelValue: l.value,
111
- "onUpdate:modelValue": s[1] || (s[1] = (v) => l.value = v),
112
- class: "ivu-inline-block",
113
- onOnChange: p
114
- }, {
115
- default: C(() => [
116
- (V(!0), P(X, null, ee(t.list, (v) => (V(), E(h, {
117
- key: v[t.keyMap.value],
118
- label: v[t.keyMap.value]
119
- }, {
120
- default: C(() => [
121
- R(d.$slots, "default", { item: v }, () => [
122
- j(F(v[t.keyMap.label]), 1)
123
- ])
124
- ]),
125
- _: 2
126
- }, 1032, ["label"]))), 128))
127
- ]),
128
- _: 3
129
- }, 8, ["modelValue"])
130
- ]);
131
- };
103
+ _: 1
104
+ }, 8, ["modelValue", "indeterminate"]), [
105
+ [ie, !t.hideAll]
106
+ ]),
107
+ O(n(We), {
108
+ modelValue: l.value,
109
+ "onUpdate:modelValue": b[1] || (b[1] = (v) => l.value = v),
110
+ class: "ivu-inline-block",
111
+ onOnChange: h
112
+ }, {
113
+ default: C(() => [
114
+ (D(!0), j(W, null, Z(t.list, (v) => (D(), E(n(ne), {
115
+ key: v[t.keyMap.value],
116
+ label: v[t.keyMap.value]
117
+ }, {
118
+ default: C(() => [
119
+ w(p.$slots, "default", { item: v }, () => [
120
+ H(z(v[t.keyMap.label]), 1)
121
+ ])
122
+ ]),
123
+ _: 2
124
+ }, 1032, ["label"]))), 128))
125
+ ]),
126
+ _: 3
127
+ }, 8, ["modelValue"])
128
+ ]));
132
129
  }
133
- }), Ue = {
130
+ }), ct = {
134
131
  name: "BaseSwitch"
135
- }, _e = /* @__PURE__ */ _({
136
- ...Ue,
132
+ }, ft = /* @__PURE__ */ U({
133
+ ...ct,
137
134
  props: {
138
135
  modelValue: [String, Number, Boolean],
139
136
  /**
@@ -161,48 +158,48 @@ const A = {
161
158
  },
162
159
  emits: ["update:modelValue", "change"],
163
160
  setup(t, { emit: S }) {
164
- const a = t, e = S, l = H(a.modelValue), n = (i) => {
161
+ const a = t, e = S, l = L(a.modelValue), o = (i) => {
165
162
  e("update:modelValue", i), e("change", i);
166
163
  };
167
- return z(
164
+ return I(
168
165
  () => a.modelValue,
169
166
  (i) => {
170
167
  l.value !== i && (l.value = i);
171
168
  }
172
- ), (i, p) => {
173
- const d = O("Switch");
174
- return V(), E(d, U({
175
- modelValue: l.value,
176
- "onUpdate:modelValue": p[0] || (p[0] = (s) => l.value = s),
177
- onOnChange: n
178
- }, i.$attrs, {
179
- trueValue: t.trueValue,
180
- falseValue: t.falseValue
181
- }), {
182
- open: C(() => [
183
- R(i.$slots, "open", {}, () => [
184
- j(F(t.trueLabel), 1)
185
- ])
186
- ]),
187
- close: C(() => [
188
- R(i.$slots, "close", {}, () => [
189
- j(F(t.falseLabel), 1)
190
- ])
191
- ]),
192
- _: 3
193
- }, 16, ["modelValue", "trueValue", "falseValue"]);
194
- };
169
+ ), (i, h) => (D(), E(n(Xe), K({
170
+ modelValue: l.value,
171
+ "onUpdate:modelValue": h[0] || (h[0] = (p) => l.value = p),
172
+ onOnChange: o
173
+ }, i.$attrs, {
174
+ trueValue: t.trueValue,
175
+ falseValue: t.falseValue
176
+ }), {
177
+ open: C(() => [
178
+ w(i.$slots, "open", {}, () => [
179
+ H(z(t.trueLabel), 1)
180
+ ])
181
+ ]),
182
+ close: C(() => [
183
+ w(i.$slots, "close", {}, () => [
184
+ H(z(t.falseLabel), 1)
185
+ ])
186
+ ]),
187
+ _: 3
188
+ }, 16, ["modelValue", "trueValue", "falseValue"]));
195
189
  }
196
- }), Ye = { class: "combi ivu-input-group" }, Ge = {
190
+ }), Se = [], R = (t) => (
191
+ // const prefix = inject(classSymbol, '') as string
192
+ Se[0] ? Se[0].replace(/\B([A-Z])/g, "-$1").toLowerCase() + "-" + t : t
193
+ ), gt = {
197
194
  key: 0,
198
195
  class: "ivu-input-group-prepend"
199
- }, Je = {
196
+ }, mt = {
200
197
  key: 1,
201
198
  class: "ivu-input-group-append"
202
- }, We = {
199
+ }, ht = {
203
200
  name: "Combi"
204
- }, qe = /* @__PURE__ */ _({
205
- ...We,
201
+ }, pt = /* @__PURE__ */ U({
202
+ ...ht,
206
203
  props: {
207
204
  /**
208
205
  * 前置文本
@@ -214,29 +211,31 @@ const A = {
214
211
  append: String
215
212
  },
216
213
  setup(t) {
217
- const S = Me(), a = t, e = N(() => !!a.prepend || !!S.prepend?.().length), l = N(() => !!a.append || !!S.append?.().length);
218
- return (n, i) => (V(), P("div", Ye, [
219
- e.value ? (V(), P("div", Ge, [
220
- R(n.$slots, "prepend", {}, () => [
221
- j(F(t.prepend), 1)
214
+ const S = Ge(), a = t, e = P(() => !!a.prepend || !!S.prepend?.().length), l = P(() => !!a.append || !!S.append?.().length);
215
+ return (o, i) => (D(), j("div", {
216
+ class: F([n(R)("combi"), "ivu-input-group"])
217
+ }, [
218
+ e.value ? (D(), j("div", gt, [
219
+ w(o.$slots, "prepend", {}, () => [
220
+ H(z(t.prepend), 1)
222
221
  ])
223
- ])) : W("", !0),
224
- te("div", {
225
- class: oe(["combi-cell", { "with-append": l.value, "with-prepend": e.value }])
222
+ ])) : J("", !0),
223
+ Q("div", {
224
+ class: F([n(R)("combi-cell"), { "with-append": l.value, "with-prepend": e.value }])
226
225
  }, [
227
- R(n.$slots, "default")
226
+ w(o.$slots, "default")
228
227
  ], 2),
229
- l.value ? (V(), P("div", Je, [
230
- R(n.$slots, "append", {}, () => [
231
- j(F(t.append), 1)
228
+ l.value ? (D(), j("div", mt, [
229
+ w(o.$slots, "append", {}, () => [
230
+ H(z(t.append), 1)
232
231
  ])
233
- ])) : W("", !0)
234
- ]));
232
+ ])) : J("", !0)
233
+ ], 2));
235
234
  }
236
- }), Qe = { class: "count-range" }, Xe = {
235
+ }), vt = {
237
236
  name: "CountRange"
238
- }, Ze = /* @__PURE__ */ _({
239
- ...Xe,
237
+ }, bt = /* @__PURE__ */ U({
238
+ ...vt,
240
239
  props: {
241
240
  /**
242
241
  * 双向绑定最小值
@@ -327,10 +326,10 @@ const A = {
327
326
  },
328
327
  emits: ["update:begin", "update:end", "change-min", "change-max", "change"],
329
328
  setup(t, { emit: S }) {
330
- const a = t, e = S, l = H(a.begin), n = H(a.end), i = N(() => ({
329
+ const a = t, e = S, l = L(a.begin), o = L(a.end), i = P(() => ({
331
330
  min: a.min,
332
331
  max: a.max,
333
- placeholder: a.minHolder ?? A.t("countRange.minHolder"),
332
+ placeholder: a.minHolder ?? M.t("countRange.minHolder"),
334
333
  disabled: a.disabled || a.minDisabled,
335
334
  class: a.minClass,
336
335
  controlsOutside: a.controlsOutside,
@@ -342,10 +341,10 @@ const A = {
342
341
  parser: a.parser,
343
342
  activeChange: a.activeChange,
344
343
  ...a.minAttr
345
- })), p = N(() => ({
344
+ })), h = P(() => ({
346
345
  min: l.value,
347
346
  max: a.max,
348
- placeholder: a.maxHolder ?? A.t("countRange.maxHolder"),
347
+ placeholder: a.maxHolder ?? M.t("countRange.maxHolder"),
349
348
  disabled: a.disabled || a.maxDisabled,
350
349
  class: a.maxClass,
351
350
  controlsOutside: a.controlsOutside,
@@ -357,41 +356,40 @@ const A = {
357
356
  parser: a.parser,
358
357
  activeChange: l.value ? !1 : a.activeChange,
359
358
  ...a.maxAttr
360
- })), d = () => {
361
- e("update:begin", l.value), e("update:end", n.value);
362
- }, s = (b) => {
363
- n.value != null && b > n.value && (n.value = b + 1 > p.value.max ? p.value.max : b + 1), d(), e("change-min", b), e("change", b, n.value, !1);
364
- }, h = (b) => {
365
- d(), e("change-max", b), e("change", l.value, b, !0);
366
- }, u = (b) => {
367
- l.value !== b && (l.value = b !== void 0 ? b : null);
368
- }, v = (b) => {
369
- n.value !== b && (n.value = b !== void 0 ? b : null);
370
- };
371
- return z(() => a.begin, u), z(() => a.end, v), (b, I) => {
372
- const y = O("InputNumber");
373
- return V(), P("div", Qe, [
374
- x(y, U({
375
- modelValue: l.value,
376
- "onUpdate:modelValue": I[0] || (I[0] = ($) => l.value = $)
377
- }, i.value, { onOnChange: s }), null, 16, ["modelValue"]),
378
- ie(te("span", {
379
- class: oe(["count-range-joiner", t.joinerClass])
380
- }, null, 2), [
381
- [ce, !t.hideJoiner]
382
- ]),
383
- x(y, U({
384
- modelValue: n.value,
385
- "onUpdate:modelValue": I[1] || (I[1] = ($) => n.value = $)
386
- }, p.value, { onOnChange: h }), null, 16, ["modelValue"])
387
- ]);
359
+ })), p = () => {
360
+ e("update:begin", l.value), e("update:end", o.value);
361
+ }, b = (d) => {
362
+ o.value != null && d > o.value && (o.value = d + 1 > h.value.max ? h.value.max : d + 1), p(), e("change-min", d), e("change", d, o.value, !1);
363
+ }, v = (d) => {
364
+ p(), e("change-max", d), e("change", l.value, d, !0);
365
+ }, c = (d) => {
366
+ l.value !== d && (l.value = d !== void 0 ? d : null);
367
+ }, T = (d) => {
368
+ o.value !== d && (o.value = d !== void 0 ? d : null);
388
369
  };
370
+ return I(() => a.begin, c), I(() => a.end, T), (d, y) => (D(), j("div", {
371
+ class: F(n(R)("count-range"))
372
+ }, [
373
+ O(n(Re), K({
374
+ modelValue: l.value,
375
+ "onUpdate:modelValue": y[0] || (y[0] = (B) => l.value = B)
376
+ }, i.value, { onOnChange: b }), null, 16, ["modelValue"]),
377
+ _(Q("span", {
378
+ class: F([n(R)("count-range-joiner"), t.joinerClass])
379
+ }, null, 2), [
380
+ [ie, !t.hideJoiner]
381
+ ]),
382
+ O(n(Re), K({
383
+ modelValue: o.value,
384
+ "onUpdate:modelValue": y[1] || (y[1] = (B) => o.value = B)
385
+ }, h.value, { onOnChange: v }), null, 16, ["modelValue"])
386
+ ], 2));
389
387
  }
390
- }), et = { key: 1 }, tt = {
388
+ }), yt = { key: 1 }, kt = {
391
389
  name: "RemoteSelect",
392
390
  inheritAttrs: !1
393
- }, Oe = /* @__PURE__ */ _({
394
- ...tt,
391
+ }, Pe = /* @__PURE__ */ U({
392
+ ...kt,
395
393
  props: {
396
394
  modelValue: [String, Array, Number],
397
395
  list: Array,
@@ -482,131 +480,128 @@ const A = {
482
480
  },
483
481
  emits: ["update:modelValue", "update:chosen", "update:list", "update:refresh", "load"],
484
482
  setup(t, { expose: S, emit: a }) {
485
- const e = t, l = a, n = H(e.modelValue ?? ""), i = H([]), p = H(!1), d = H({}), s = N(
486
- () => d.value && Object.keys(d.value).length > 0 ? typeof e.textFormat != "function" ? e.multiple ? d.value.map((r) => r[e.keyMap.label]).join(",") : d.value[e.keyMap.label] : e.textFormat(d.value) : ""
487
- ), h = H(!1);
488
- let u, v, b, I;
489
- async function y() {
490
- let r;
483
+ const e = t, l = a, o = L(e.modelValue ?? ""), i = L([]), h = L(!1), p = L({}), b = P(
484
+ () => p.value && Object.keys(p.value).length > 0 ? typeof e.textFormat != "function" ? e.multiple ? p.value.map((u) => u[e.keyMap.label]).join(",") : p.value[e.keyMap.label] : e.textFormat(p.value) : ""
485
+ ), v = L(!1);
486
+ let c, T, d, y;
487
+ async function B() {
488
+ let u;
491
489
  if (typeof e.loader != "function") {
492
490
  if (typeof e.method != "function") {
493
491
  console.warn("typeof method isn't function");
494
492
  return;
495
493
  }
496
- if (p.value = !0, r = await e.method(typeof e.param != "function" ? e.param : e.param()), p.value = !1, r && typeof e.process == "function") {
497
- const B = e.process(r);
498
- B != null && (r = B);
494
+ if (h.value = !0, u = await e.method(typeof e.param != "function" ? e.param : e.param()), h.value = !1, u && typeof e.process == "function") {
495
+ const k = e.process(u);
496
+ k != null && (u = k);
499
497
  }
500
498
  } else
501
- p.value = !0, r = await e.loader(), p.value = !1;
502
- r && (h.value = !0, i.value = r, l("update:list", r), k() && $(n.value), u = !0, J(() => {
503
- u = null;
504
- }), l("load", r));
499
+ h.value = !0, u = await e.loader(), h.value = !1;
500
+ u && (v.value = !0, i.value = u, l("update:list", u), V() && N(o.value), c = !0, G(() => {
501
+ c = null;
502
+ }), l("load", u));
505
503
  }
506
- function $(r) {
507
- v = !0, J(() => {
508
- v = null;
509
- }), b && (e.multiple ? !r.toString().length : r === void 0) && (n.value = r = b), d.value = e.getSelected({
504
+ function N(u) {
505
+ T = !0, G(() => {
506
+ T = null;
507
+ }), d && (e.multiple ? !u.toString().length : u === void 0) && (o.value = u = d), p.value = e.getSelected({
510
508
  multiple: e.multiple,
511
509
  keyMap: e.keyMap,
512
510
  list: i.value,
513
- value: n.value
514
- }), l("update:modelValue", r ?? ""), l("update:chosen", d.value);
511
+ value: o.value
512
+ }), l("update:modelValue", u ?? ""), l("update:chosen", p.value);
515
513
  }
516
- function c(r) {
517
- r && !e.autoGet && !p.value && !h.value && (!e.check || e.check()) && (!e.strict || e.parentCode) && y();
514
+ function f(u) {
515
+ u && !e.autoGet && !h.value && !v.value && (!e.check || e.check()) && (!e.strict || e.parentCode) && B();
518
516
  }
519
- function k() {
520
- return n.value != null && n.value.toString().length > 0;
517
+ function V() {
518
+ return o.value != null && o.value.toString().length > 0;
521
519
  }
522
- return l("update:refresh", y), de(() => {
523
- e.autoGet ? y() : k() && !i.value.length && c(!0);
520
+ return l("update:refresh", B), se(() => {
521
+ e.autoGet ? B() : V() && !i.value.length && f(!0);
524
522
  }), S({
525
- code: n,
526
- changeCode: $,
527
- loaded: h,
523
+ code: o,
524
+ changeCode: N,
525
+ loaded: v,
528
526
  codes: i,
529
- search: y
530
- }), z(
527
+ search: B
528
+ }), I(
531
529
  () => e.list,
532
- (r) => {
533
- u || (r && r.length ? (i.value = r, h.value = !!e.cache) : (i.value = [], h.value = !1));
530
+ (u) => {
531
+ c || (u && u.length ? (i.value = u, v.value = !!e.cache) : (i.value = [], v.value = !1));
534
532
  },
535
533
  { immediate: !0 }
536
- ), z(
534
+ ), I(
537
535
  () => e.modelValue,
538
- (r) => {
539
- if (!v && (I = !0, J(() => {
540
- I = null;
541
- }), n.value = r ?? "", $(n.value), e.refresh !== y)) {
542
- for (const B in d.value)
536
+ (u) => {
537
+ if (!T && (y = !0, G(() => {
538
+ y = null;
539
+ }), o.value = u ?? "", N(o.value), e.refresh !== B)) {
540
+ for (const k in p.value)
543
541
  return;
544
- c(k());
542
+ f(V());
545
543
  }
546
544
  }
547
- ), z(
545
+ ), I(
548
546
  () => e.parentCode,
549
- (r) => {
550
- I ? (b = e.modelValue, setTimeout(() => {
551
- b = null;
552
- })) : n.value = e.multiple ? [] : "", i.value = [], h.value = !1, l("update:list", i.value), k() && r && /* !this.opening && */
553
- c(!0);
547
+ (u) => {
548
+ y ? (d = e.modelValue, setTimeout(() => {
549
+ d = null;
550
+ })) : o.value = e.multiple ? [] : "", i.value = [], v.value = !1, l("update:list", i.value), V() && u && /* !this.opening && */
551
+ f(!0);
554
552
  }
555
- ), (r, B) => {
556
- const f = O("Option"), o = O("Select");
557
- return t.textMode ? (V(), P("span", et, [
558
- R(r.$slots, "text", { text: s.value }, () => [
559
- j(F(s.value), 1)
553
+ ), (u, k) => t.textMode ? (D(), j("span", yt, [
554
+ w(u.$slots, "text", { text: b.value }, () => [
555
+ H(z(b.value), 1)
556
+ ])
557
+ ])) : _((D(), E(n(Ze), K({
558
+ key: 0,
559
+ modelValue: o.value,
560
+ "onUpdate:modelValue": k[0] || (k[0] = (r) => o.value = r),
561
+ onOnOpenChange: f,
562
+ onOnChange: N
563
+ }, u.$attrs, {
564
+ multiple: t.multiple,
565
+ loading: h.value,
566
+ "not-found-text": h.value ? null : void 0
567
+ }), {
568
+ default: C(() => [
569
+ w(u.$slots, "dropdown", { list: i.value }, () => [
570
+ (D(!0), j(W, null, Z(i.value, (r, s) => (D(), E(n(Qe), {
571
+ key: e.valueAsKey ? r[t.keyMap.value] : s,
572
+ value: r[t.keyMap.value],
573
+ label: t.formatLabel && t.formatLabel(r, s),
574
+ disabled: t.optionDisabled && t.optionDisabled(r, s),
575
+ tag: t.optionTag && t.optionTag(r, s)
576
+ }, {
577
+ default: C(() => [
578
+ w(u.$slots, "default", {
579
+ item: r,
580
+ index: s
581
+ }, () => [
582
+ H(z(r[t.keyMap.label]), 1)
583
+ ])
584
+ ]),
585
+ _: 2
586
+ }, 1032, ["value", "label", "disabled", "tag"]))), 128))
560
587
  ])
561
- ])) : ie((V(), E(o, U({
562
- key: 0,
563
- modelValue: n.value,
564
- "onUpdate:modelValue": B[0] || (B[0] = (D) => n.value = D),
565
- onOnOpenChange: c,
566
- onOnChange: $
567
- }, r.$attrs, {
568
- multiple: t.multiple,
569
- loading: p.value,
570
- "not-found-text": p.value ? null : void 0
571
- }), {
572
- default: C(() => [
573
- R(r.$slots, "dropdown", { list: i.value }, () => [
574
- (V(!0), P(X, null, ee(i.value, (D, L) => (V(), E(f, {
575
- key: e.valueAsKey ? D[t.keyMap.value] : L,
576
- value: D[t.keyMap.value],
577
- label: t.formatLabel && t.formatLabel(D, L),
578
- disabled: t.optionDisabled && t.optionDisabled(D, L),
579
- tag: t.optionTag && t.optionTag(D, L)
580
- }, {
581
- default: C(() => [
582
- R(r.$slots, "default", {
583
- item: D,
584
- index: L
585
- }, () => [
586
- j(F(D[t.keyMap.label]), 1)
587
- ])
588
- ]),
589
- _: 2
590
- }, 1032, ["value", "label", "disabled", "tag"]))), 128))
591
- ])
592
- ]),
593
- _: 3
594
- }, 16, ["modelValue", "multiple", "loading", "not-found-text"])), [
595
- [M(xe), t.all, "all"]
596
- ]);
597
- };
588
+ ]),
589
+ _: 3
590
+ }, 16, ["modelValue", "multiple", "loading", "not-found-text"])), [
591
+ [n(je), t.all, "all"]
592
+ ]);
598
593
  }
599
- }), he = {
594
+ }), be = {
600
595
  list: null
601
- }, ae = De({}), le = {
596
+ }, te = Ie({}), ae = {
602
597
  list: []
603
- }, ne = {
598
+ }, le = {
604
599
  list: []
605
- }, ve = {}, at = {
600
+ }, ye = {}, St = {
606
601
  name: "CacheSelect",
607
602
  inheritAttrs: !1
608
- }, lt = /* @__PURE__ */ _({
609
- ...at,
603
+ }, Ct = /* @__PURE__ */ U({
604
+ ...St,
610
605
  props: {
611
606
  modelValue: [String, Array, Number],
612
607
  /**
@@ -619,297 +614,64 @@ const A = {
619
614
  },
620
615
  emits: ["update:modelValue", "update:chosen", "update:list", "load", "change"],
621
616
  setup(t, { emit: S }) {
622
- const a = t, e = S, l = H(""), n = be("sel"), i = (s) => {
623
- e("update:modelValue", s), e("change", s);
624
- }, p = (s) => {
625
- J(() => {
626
- le[a.cacheId] && (le[a.cacheId].forEach((h) => {
627
- h.changeCode(h.code);
628
- }), le[a.cacheId] = []), ne[a.cacheId] && (ne[a.cacheId].forEach((h) => {
629
- h !== n.value && h.$emit("update:list", h.codes);
630
- }), ne[a.cacheId] = []);
631
- }), e("load", s);
632
- }, d = () => l.value != null && l.value.toString().length > 0;
633
- return z(
617
+ const a = t, e = S, l = L(""), o = re("sel"), i = (b) => {
618
+ e("update:modelValue", b), e("change", b);
619
+ }, h = (b) => {
620
+ G(() => {
621
+ ae[a.cacheId] && (ae[a.cacheId].forEach((v) => {
622
+ v.changeCode(v.code);
623
+ }), ae[a.cacheId] = []), le[a.cacheId] && (le[a.cacheId].forEach((v) => {
624
+ v !== o.value && v.$emit("update:list", v.codes);
625
+ }), le[a.cacheId] = []);
626
+ }), e("load", b);
627
+ }, p = () => l.value != null && l.value.toString().length > 0;
628
+ return I(
634
629
  () => a.modelValue,
635
- (s) => {
636
- l.value !== s && (l.value = s ?? "");
630
+ (b) => {
631
+ l.value !== b && (l.value = b ?? "");
637
632
  }
638
- ), ae[a.cacheId] || (ae[a.cacheId] = [], he[a.cacheId] = null), de(() => {
639
- ae[a.cacheId].length && (n.value.loaded = !0), a.modelValue && (l.value = a.modelValue), he[a.cacheId] ? (d() && (le[a.cacheId] || (le[a.cacheId] = []), le[a.cacheId].push(n.value)), n.value.loaded = ve[a.cacheId]) : he[a.cacheId] = !0, ne[a.cacheId] || (ne[a.cacheId] = []), ne[a.cacheId].push(n.value), ve[a.cacheId] || (ve[a.cacheId] = d()), z(
640
- () => ae[a.cacheId],
641
- (s) => {
642
- s.length && (n.value.loaded = !0);
633
+ ), te[a.cacheId] || (te[a.cacheId] = [], be[a.cacheId] = null), se(() => {
634
+ te[a.cacheId].length && (o.value.loaded = !0), a.modelValue && (l.value = a.modelValue), be[a.cacheId] ? (p() && (ae[a.cacheId] || (ae[a.cacheId] = []), ae[a.cacheId].push(o.value)), o.value.loaded = ye[a.cacheId]) : be[a.cacheId] = !0, le[a.cacheId] || (le[a.cacheId] = []), le[a.cacheId].push(o.value), ye[a.cacheId] || (ye[a.cacheId] = p()), I(
635
+ () => te[a.cacheId],
636
+ (b) => {
637
+ b.length && (o.value.loaded = !0);
643
638
  },
644
639
  {
645
640
  immediate: !0
646
641
  }
647
642
  );
648
- }), (s, h) => (V(), E(Oe, U({
643
+ }), (b, v) => (D(), E(Pe, K({
649
644
  ref: "sel",
650
645
  modelValue: l.value,
651
- "onUpdate:modelValue": h[0] || (h[0] = (u) => l.value = u),
652
- list: M(ae)[t.cacheId],
646
+ "onUpdate:modelValue": v[0] || (v[0] = (c) => l.value = c),
647
+ list: n(te)[t.cacheId],
653
648
  "onUpdate:list": [
654
- h[1] || (h[1] = (u) => M(ae)[t.cacheId] = u),
655
- h[3] || (h[3] = (u) => s.$emit("update:list", u))
649
+ v[1] || (v[1] = (c) => n(te)[t.cacheId] = c),
650
+ v[3] || (v[3] = (c) => b.$emit("update:list", c))
656
651
  ],
657
- onLoad: p,
652
+ onLoad: h,
658
653
  onOnChange: i,
659
- "onUpdate:chosen": h[2] || (h[2] = (u) => s.$emit("update:chosen", u))
660
- }, s.$attrs, { cache: "" }), {
661
- default: C(({ item: u, index: v }) => [
662
- R(s.$slots, "default", {
663
- item: u,
664
- index: v
654
+ "onUpdate:chosen": v[2] || (v[2] = (c) => b.$emit("update:chosen", c))
655
+ }, b.$attrs, { cache: "" }), {
656
+ default: C(({ item: c, index: T }) => [
657
+ w(b.$slots, "default", {
658
+ item: c,
659
+ index: T
665
660
  })
666
661
  ]),
667
- dropdown: C(({ list: u }) => [
668
- R(s.$slots, "dropdown", { list: u })
662
+ dropdown: C(({ list: c }) => [
663
+ w(b.$slots, "dropdown", { list: c })
669
664
  ]),
670
- text: C((u) => [
671
- R(s.$slots, "text", ke(Ce(u)))
665
+ text: C((c) => [
666
+ w(b.$slots, "text", Be(Ve(c)))
672
667
  ]),
673
668
  _: 3
674
669
  }, 16, ["modelValue", "list"]));
675
670
  }
676
- }), nt = {
677
- name: "CurdTable"
678
- }, ot = /* @__PURE__ */ _({
679
- ...nt,
680
- props: {
681
- modelValue: {
682
- type: Array,
683
- default: () => []
684
- },
685
- /**
686
- * iview Table columns
687
- */
688
- columns: {
689
- type: Array,
690
- default: () => []
691
- },
692
- /**
693
- * 是否隐藏控制列
694
- */
695
- disabled: Boolean,
696
- /**
697
- * 可否增加数据,默认true
698
- */
699
- addable: {
700
- type: Boolean,
701
- default: !0
702
- },
703
- /**
704
- * 控制列宽度,默认90px
705
- */
706
- actionWidth: {
707
- type: Number,
708
- default: 90
709
- },
710
- /**
711
- * 控制列水平对齐,默认居中
712
- */
713
- actionAlign: {
714
- type: String,
715
- default: "center"
716
- },
717
- /**
718
- * 控制列是否固定
719
- */
720
- actionFixed: String,
721
- /**
722
- * 控制列表头文本
723
- */
724
- actionText: String,
725
- /**
726
- * 右侧控制列
727
- */
728
- actionCol: {
729
- type: Object,
730
- default(t) {
731
- return {
732
- // title: props.actionText,
733
- slot: "action",
734
- width: t.actionWidth,
735
- align: t.actionAlign,
736
- fixed: t.actionFixed
737
- };
738
- }
739
- },
740
- /**
741
- * 新增行时需要添加的数据
742
- */
743
- addRow: {
744
- type: Function,
745
- default: () => []
746
- },
747
- border: Boolean,
748
- size: String,
749
- /**
750
- * 返回Promise以决定何时新增数据
751
- */
752
- beforeAdd: Function,
753
- /**
754
- * 返回Promise以决定何时删除数据
755
- */
756
- beforeRemove: Function,
757
- addBtnType: {
758
- type: String,
759
- default: "dashed"
760
- },
761
- addBtnSize: String,
762
- addBtnGhost: {
763
- type: Boolean,
764
- default: !1
765
- },
766
- addBtnDisabled: {
767
- type: Boolean,
768
- default(t) {
769
- return !t.addable;
770
- }
771
- },
772
- addBtn: {
773
- type: Object,
774
- default: () => ({})
775
- },
776
- delBtnType: {
777
- type: String,
778
- default: "warning"
779
- },
780
- delBtnSize: {
781
- type: String,
782
- default: "small"
783
- },
784
- delBtnGhost: {
785
- type: Boolean,
786
- default: !0
787
- },
788
- delBtn: {
789
- type: Object,
790
- default: () => ({})
791
- },
792
- addText: String,
793
- /**
794
- * 是否隐藏每行的删除按钮,通过函数返回值决定
795
- */
796
- hideDelBtn: Function,
797
- /**
798
- * 是否禁用每行删除按钮,通过函数返回值决定
799
- */
800
- delBtnDisabled: {
801
- type: Function,
802
- default() {
803
- return !1;
804
- }
805
- }
806
- },
807
- emits: ["update:modelValue", "add", "remove", "change"],
808
- setup(t, { emit: S }) {
809
- const a = t, e = S, l = H(a.modelValue), n = N(
810
- () => a.disabled ? a.columns : a.columns.concat(
811
- Object.assign(
812
- {
813
- title: a.actionText ?? A.t("curdTable.actionText")
814
- },
815
- a.actionCol
816
- )
817
- )
818
- ), i = N(() => {
819
- const u = [], v = (b) => {
820
- b.slot && u.push(b), b.children && b.children.forEach((I) => {
821
- v(I);
822
- });
823
- };
824
- return a.columns.forEach((b) => {
825
- v(b);
826
- }), u;
827
- });
828
- function p() {
829
- typeof a.beforeAdd != "function" ? d() : a.beforeAdd().then(d).catch();
830
- }
831
- function d(u) {
832
- l.value.push(...a.addRow(u)), e("update:modelValue", l.value), e("add", l.value[l.value.length - 1]), e("change", !0);
833
- }
834
- function s(u) {
835
- typeof a.beforeRemove != "function" ? h(u) : a.beforeRemove(l.value[u], u).then(() => {
836
- h(u);
837
- });
838
- }
839
- function h(u) {
840
- const [v] = l.value.splice(u, 1);
841
- e("update:modelValue", l.value), e("remove", v), e("change", !1);
842
- }
843
- return z(
844
- () => a.modelValue,
845
- (u) => {
846
- l.value = u;
847
- }
848
- ), (u, v) => {
849
- const b = O("Button"), I = O("Table");
850
- return V(), P("div", null, [
851
- x(I, {
852
- border: t.border,
853
- columns: n.value,
854
- data: l.value,
855
- size: t.size,
856
- style: { "z-index": "0" }
857
- }, Ve({
858
- action: C(({ row: y, index: $ }) => [
859
- R(u.$slots, "moreAction", {
860
- row: y,
861
- index: $
862
- }),
863
- !t.hideDelBtn || !t.hideDelBtn(y, $) ? (V(), E(b, U({
864
- key: 0,
865
- type: t.delBtnType,
866
- size: t.delBtnSize,
867
- ghost: t.delBtnGhost
868
- }, t.delBtn, {
869
- disabled: t.delBtnDisabled(y, $),
870
- onClick: (c) => s($)
871
- }), {
872
- default: C(() => [
873
- j(F(M(A).t("curdTable.del")), 1)
874
- ]),
875
- _: 1
876
- }, 16, ["type", "size", "ghost", "disabled", "onClick"])) : W("", !0)
877
- ]),
878
- _: 2
879
- }, [
880
- ee(i.value, (y) => ({
881
- name: y.slot,
882
- fn: C(($) => [
883
- R(u.$slots, y.slot, ke(Ce($)))
884
- ])
885
- }))
886
- ]), 1032, ["border", "columns", "data", "size"]),
887
- t.disabled ? W("", !0) : ie((V(), E(b, U({
888
- key: 0,
889
- type: t.addBtnType,
890
- size: t.addBtnSize,
891
- ghost: t.addBtnGhost,
892
- disabled: t.addBtnDisabled
893
- }, t.addBtn, {
894
- long: "",
895
- icon: "md-add",
896
- style: { display: "block", position: "relative", "margin-top": "-1px" },
897
- onClick: p
898
- }), {
899
- default: C(() => [
900
- j(F(t.addText ?? M(A).t("curdTable.addText")), 1)
901
- ]),
902
- _: 1
903
- }, 16, ["type", "size", "ghost", "disabled"])), [
904
- [ce, t.addable]
905
- ])
906
- ]);
907
- };
908
- }
909
- }), it = { class: "date-range" }, ut = {
671
+ }), Bt = {
910
672
  name: "DateRange"
911
- }, st = /* @__PURE__ */ _({
912
- ...ut,
673
+ }, Vt = /* @__PURE__ */ U({
674
+ ...Bt,
913
675
  props: {
914
676
  /**
915
677
  * 双向绑定开始时间
@@ -994,70 +756,69 @@ const A = {
994
756
  },
995
757
  emits: ["update:begin", "update:end", "change-begin", "change-end", "change"],
996
758
  setup(t, { emit: S }) {
997
- const a = ge().appContext.config.globalProperties.$Date, e = {
759
+ const a = me().appContext.config.globalProperties.$Date, e = {
998
760
  date: "day",
999
761
  month: "month",
1000
762
  year: "year",
1001
763
  datetime: "day"
1002
- }, l = t, n = S, i = H(l.begin), p = H(l.end), d = N(() => ({
764
+ }, l = t, o = S, i = L(l.begin), h = L(l.end), p = P(() => ({
1003
765
  options: l.limitBegin ? {
1004
- disabledDate: (y) => y && a(y).isBefore(Date.now(), e[l.type])
766
+ disabledDate: (B) => B && a(B).isBefore(Date.now(), e[l.type])
1005
767
  // date.valueOf() < Date.now() - (props.disableToday ? 0 : 86400000)
1006
768
  } : void 0,
1007
769
  disabled: l.disabled || l.beginDisabled,
1008
- placeholder: l.beginHolder ?? A.t("dateRange.beginHolder"),
770
+ placeholder: l.beginHolder ?? M.t("dateRange.beginHolder"),
1009
771
  class: l.beginClass,
1010
772
  clearable: l.clearable,
1011
773
  transfer: l.transfer,
1012
774
  format: l.format,
1013
775
  ...l.beginAttr
1014
- })), s = N(() => ({
776
+ })), b = P(() => ({
1015
777
  options: {
1016
- disabledDate: (y) => i.value && y && a(y).isBefore(i.value, e[l.type])
778
+ disabledDate: (B) => i.value && B && a(B).isBefore(i.value, e[l.type])
1017
779
  },
1018
780
  disabled: l.disabled || l.endDisabled,
1019
- placeholder: l.endHolder ?? A.t("dateRange.endHolder"),
781
+ placeholder: l.endHolder ?? M.t("dateRange.endHolder"),
1020
782
  class: l.endClass,
1021
783
  clearable: l.clearable,
1022
784
  transfer: l.transfer,
1023
785
  format: l.format,
1024
786
  ...l.endAttr
1025
- })), h = () => {
1026
- n("update:begin", i.value), n("update:end", p.value);
1027
- }, u = (y) => {
1028
- i.value > p.value && (p.value = l.autoNext ? a(i.value).add(1, e[l.type]).toDate() : ""), h(), n("change-begin", y), n("change", i.value, p.value, !1);
1029
- }, v = (y) => {
1030
- l.type === "datetime" && y && a(y).isBefore(i.value) && (p.value = a(i.value).add(1, "hour").toDate(), y = a(p.value).format("YYYY-MM-DD HH:mm:ss")), h(), n("change-end", y), n("change", i.value, p.value, !0);
1031
- }, b = (y) => {
1032
- i.value !== y && (i.value = y || "");
1033
- }, I = (y) => {
1034
- p.value !== y && (p.value = y || "");
1035
- };
1036
- return z(() => l.begin, b), z(() => l.end, I), (y, $) => {
1037
- const c = O("DatePicker");
1038
- return V(), P("div", it, [
1039
- x(c, U({
1040
- modelValue: i.value,
1041
- "onUpdate:modelValue": $[0] || ($[0] = (k) => i.value = k),
1042
- onOnChange: u
1043
- }, d.value, { type: t.type }), null, 16, ["modelValue", "type"]),
1044
- ie(te("span", {
1045
- class: oe(["date-range-joiner", t.joinerClass])
1046
- }, null, 2), [
1047
- [ce, !t.hideJoiner]
1048
- ]),
1049
- x(c, U({
1050
- modelValue: p.value,
1051
- "onUpdate:modelValue": $[1] || ($[1] = (k) => p.value = k),
1052
- onOnChange: v
1053
- }, s.value, { type: t.type }), null, 16, ["modelValue", "type"])
1054
- ]);
787
+ })), v = () => {
788
+ o("update:begin", i.value), o("update:end", h.value);
789
+ }, c = (B) => {
790
+ i.value > h.value && (h.value = l.autoNext ? a(i.value).add(1, e[l.type]).toDate() : ""), v(), o("change-begin", B), o("change", i.value, h.value, !1);
791
+ }, T = (B) => {
792
+ l.type === "datetime" && B && a(B).isBefore(i.value) && (h.value = a(i.value).add(1, "hour").toDate(), B = a(h.value).format("YYYY-MM-DD HH:mm:ss")), v(), o("change-end", B), o("change", i.value, h.value, !0);
793
+ }, d = (B) => {
794
+ i.value !== B && (i.value = B || "");
795
+ }, y = (B) => {
796
+ h.value !== B && (h.value = B || "");
1055
797
  };
798
+ return I(() => l.begin, d), I(() => l.end, y), (B, N) => (D(), j("div", {
799
+ class: F(n(R)("date-range"))
800
+ }, [
801
+ O(n(ke), K({
802
+ modelValue: i.value,
803
+ "onUpdate:modelValue": N[0] || (N[0] = (f) => i.value = f),
804
+ onOnChange: c
805
+ }, p.value, { type: t.type }), null, 16, ["modelValue", "type"]),
806
+ _(Q("span", {
807
+ class: F([n(R)("date-range-joiner"), t.joinerClass])
808
+ }, null, 2), [
809
+ [ie, !t.hideJoiner]
810
+ ]),
811
+ O(n(ke), K({
812
+ modelValue: h.value,
813
+ "onUpdate:modelValue": N[1] || (N[1] = (f) => h.value = f),
814
+ onOnChange: T
815
+ }, b.value, { type: t.type }), null, 16, ["modelValue", "type"])
816
+ ], 2));
1056
817
  }
1057
- }), dt = {
818
+ }), Dt = {
1058
819
  name: "DateRangePicker"
1059
- }, ct = /* @__PURE__ */ _({
1060
- ...dt,
820
+ }, xt = /* @__PURE__ */ U({
821
+ ...Dt,
1061
822
  props: {
1062
823
  /**
1063
824
  * 双向绑定开始时间
@@ -1114,51 +875,278 @@ const A = {
1114
875
  },
1115
876
  emits: ["update:begin", "update:end", "change"],
1116
877
  setup(t, { emit: S }) {
1117
- const a = ge().appContext.config.globalProperties.$Date, e = t, l = S, n = N(
878
+ const a = me().appContext.config.globalProperties.$Date, e = t, l = S, o = P(
1118
879
  () => e.options || (e.limitBegin ? {
1119
- disabledDate: (d) => d && d.valueOf() < Date.now() - (e.disableToday ? 0 : 864e5)
1120
- } : null)
1121
- ), i = N({
880
+ disabledDate: (p) => p && p.valueOf() < Date.now() - (e.disableToday ? 0 : 864e5)
881
+ } : void 0)
882
+ ), i = P({
1122
883
  get() {
1123
- const d = e.begin, s = e.end;
1124
- return d && s ? [a(d).toDate(), a(s).toDate()] : [];
884
+ const p = e.begin, b = e.end;
885
+ return p && b ? [a(p).toDate(), a(b).toDate()] : [];
1125
886
  },
1126
- set(d) {
1127
- let s, h;
1128
- d[0] && d[1] ? (s = a(d[0]).format(e.valueFormat), h = a(d[1]).format(e.valueFormat)) : s = h = "", l("update:begin", s), l("update:end", h);
887
+ set(p) {
888
+ let b, v;
889
+ p[0] && p[1] ? (b = a(p[0]).format(e.valueFormat), v = a(p[1]).format(e.valueFormat)) : b = v = "", l("update:begin", b), l("update:end", v);
1129
890
  }
1130
- }), p = (d, s) => {
1131
- l("change", d, s);
1132
- };
1133
- return (d, s) => {
1134
- const h = O("DatePicker");
1135
- return V(), E(h, {
1136
- modelValue: i.value,
1137
- "onUpdate:modelValue": s[0] || (s[0] = (u) => i.value = u),
1138
- type: t.type,
1139
- clearable: t.clearable,
1140
- "split-panels": t.splitPanels,
1141
- options: n.value,
1142
- transfer: t.transfer,
1143
- placeholder: t.placeholder,
1144
- disabled: t.disabled,
1145
- placement: t.placement,
1146
- onOnChange: p
1147
- }, null, 8, ["modelValue", "type", "clearable", "split-panels", "options", "transfer", "placeholder", "disabled", "placement"]);
891
+ }), h = (p, b) => {
892
+ l("change", p, b);
1148
893
  };
894
+ return (p, b) => (D(), E(n(ke), {
895
+ modelValue: i.value,
896
+ "onUpdate:modelValue": b[0] || (b[0] = (v) => i.value = v),
897
+ type: t.type,
898
+ clearable: t.clearable,
899
+ "split-panels": t.splitPanels,
900
+ options: o.value,
901
+ transfer: t.transfer,
902
+ placeholder: t.placeholder,
903
+ disabled: t.disabled,
904
+ placement: t.placement,
905
+ onOnChange: h
906
+ }, null, 8, ["modelValue", "type", "clearable", "split-panels", "options", "transfer", "placeholder", "disabled", "placement", "onOnChange"]));
1149
907
  }
1150
- }), rt = { class: "mcalendar" }, mt = {
1151
- name: "MCalendar"
1152
- }, ft = /* @__PURE__ */ _({
1153
- ...mt,
908
+ }), Ot = {
909
+ name: "CurdTable"
910
+ }, $t = /* @__PURE__ */ U({
911
+ ...Ot,
1154
912
  props: {
913
+ modelValue: {
914
+ type: Array,
915
+ default: () => []
916
+ },
1155
917
  /**
1156
- * 指定日期,默认显示该日期所在月份
918
+ * iview Table columns
1157
919
  */
1158
- date: Date,
920
+ columns: {
921
+ type: Array,
922
+ default: () => []
923
+ },
1159
924
  /**
1160
- * 传入的额外日期数据
1161
- * 组件始终展示一段日期,但业务上有时需要根据返回的一组日期进行渲染,如 [{date:'2000-01-01',xxx:false},{date:'2000-01-02',xxx:true}]
925
+ * 是否隐藏控制列
926
+ */
927
+ disabled: Boolean,
928
+ /**
929
+ * 可否增加数据,默认true
930
+ */
931
+ addable: {
932
+ type: Boolean,
933
+ default: !0
934
+ },
935
+ /**
936
+ * 控制列宽度,默认90px
937
+ */
938
+ actionWidth: {
939
+ type: Number,
940
+ default: 90
941
+ },
942
+ /**
943
+ * 控制列水平对齐,默认居中
944
+ */
945
+ actionAlign: {
946
+ type: String,
947
+ default: "center"
948
+ },
949
+ /**
950
+ * 控制列是否固定
951
+ */
952
+ actionFixed: String,
953
+ /**
954
+ * 控制列表头文本
955
+ */
956
+ actionText: String,
957
+ /**
958
+ * 右侧控制列
959
+ */
960
+ actionCol: {
961
+ type: Object,
962
+ default(t) {
963
+ return {
964
+ // title: props.actionText,
965
+ slot: "action",
966
+ width: t.actionWidth,
967
+ align: t.actionAlign,
968
+ fixed: t.actionFixed
969
+ };
970
+ }
971
+ },
972
+ /**
973
+ * 新增行时需要添加的数据
974
+ */
975
+ addRow: {
976
+ type: Function,
977
+ default: () => []
978
+ },
979
+ border: Boolean,
980
+ size: String,
981
+ /**
982
+ * 返回Promise以决定何时新增数据
983
+ */
984
+ beforeAdd: Function,
985
+ /**
986
+ * 返回Promise以决定何时删除数据
987
+ */
988
+ beforeRemove: Function,
989
+ addBtnType: {
990
+ type: String,
991
+ default: "dashed"
992
+ },
993
+ addBtnSize: String,
994
+ addBtnGhost: {
995
+ type: Boolean,
996
+ default: !1
997
+ },
998
+ addBtnDisabled: {
999
+ type: Boolean,
1000
+ default(t) {
1001
+ return !t.addable;
1002
+ }
1003
+ },
1004
+ addBtn: {
1005
+ type: Object,
1006
+ default: () => ({})
1007
+ },
1008
+ delBtnType: {
1009
+ type: String,
1010
+ default: "warning"
1011
+ },
1012
+ delBtnSize: {
1013
+ type: String,
1014
+ default: "small"
1015
+ },
1016
+ delBtnGhost: {
1017
+ type: Boolean,
1018
+ default: !0
1019
+ },
1020
+ delBtn: {
1021
+ type: Object,
1022
+ default: () => ({})
1023
+ },
1024
+ addText: String,
1025
+ /**
1026
+ * 是否隐藏每行的删除按钮,通过函数返回值决定
1027
+ */
1028
+ hideDelBtn: Function,
1029
+ /**
1030
+ * 是否禁用每行删除按钮,通过函数返回值决定
1031
+ */
1032
+ delBtnDisabled: {
1033
+ type: Function,
1034
+ default() {
1035
+ return !1;
1036
+ }
1037
+ }
1038
+ },
1039
+ emits: ["update:modelValue", "add", "remove", "change"],
1040
+ setup(t, { emit: S }) {
1041
+ const a = t, e = S, l = L(a.modelValue), o = P(
1042
+ () => a.disabled ? a.columns : a.columns.concat(
1043
+ Object.assign(
1044
+ {
1045
+ title: a.actionText ?? M.t("curdTable.actionText")
1046
+ },
1047
+ a.actionCol
1048
+ )
1049
+ )
1050
+ ), i = P(() => {
1051
+ const c = [], T = (d) => {
1052
+ d.slot && c.push(d), d.children && d.children.forEach((y) => {
1053
+ T(y);
1054
+ });
1055
+ };
1056
+ return a.columns.forEach((d) => {
1057
+ T(d);
1058
+ }), c;
1059
+ });
1060
+ function h() {
1061
+ typeof a.beforeAdd != "function" ? p() : a.beforeAdd().then(p).catch();
1062
+ }
1063
+ function p(c) {
1064
+ l.value.push(...a.addRow(c)), e("update:modelValue", l.value), e("add", l.value[l.value.length - 1]), e("change", !0);
1065
+ }
1066
+ function b(c) {
1067
+ typeof a.beforeRemove != "function" ? v(c) : a.beforeRemove(l.value[c], c).then(() => {
1068
+ v(c);
1069
+ });
1070
+ }
1071
+ function v(c) {
1072
+ const [T] = l.value.splice(c, 1);
1073
+ e("update:modelValue", l.value), e("remove", T), e("change", !1);
1074
+ }
1075
+ return I(
1076
+ () => a.modelValue,
1077
+ (c) => {
1078
+ l.value = c;
1079
+ }
1080
+ ), (c, T) => (D(), j("div", null, [
1081
+ O(n(He), {
1082
+ border: t.border,
1083
+ columns: o.value,
1084
+ data: l.value,
1085
+ size: t.size,
1086
+ style: { "z-index": "0" }
1087
+ }, ze({
1088
+ action: C(({ row: d, index: y }) => [
1089
+ w(c.$slots, "moreAction", {
1090
+ row: d,
1091
+ index: y
1092
+ }),
1093
+ !t.hideDelBtn || !t.hideDelBtn(d, y) ? (D(), E(n(X), K({
1094
+ key: 0,
1095
+ type: t.delBtnType,
1096
+ size: t.delBtnSize,
1097
+ ghost: t.delBtnGhost
1098
+ }, t.delBtn, {
1099
+ disabled: t.delBtnDisabled(d, y),
1100
+ onClick: (B) => b(y)
1101
+ }), {
1102
+ default: C(() => [
1103
+ H(z(n(M).t("curdTable.del")), 1)
1104
+ ]),
1105
+ _: 1
1106
+ }, 16, ["type", "size", "ghost", "disabled", "onClick"])) : J("", !0)
1107
+ ]),
1108
+ _: 2
1109
+ }, [
1110
+ Z(i.value, (d) => ({
1111
+ name: d.slot,
1112
+ fn: C((y) => [
1113
+ w(c.$slots, d.slot, Be(Ve(y)))
1114
+ ])
1115
+ }))
1116
+ ]), 1032, ["border", "columns", "data", "size"]),
1117
+ t.disabled ? J("", !0) : _((D(), E(n(X), K({
1118
+ key: 0,
1119
+ type: t.addBtnType,
1120
+ size: t.addBtnSize,
1121
+ ghost: t.addBtnGhost,
1122
+ disabled: t.addBtnDisabled
1123
+ }, t.addBtn, {
1124
+ long: "",
1125
+ icon: "md-add",
1126
+ style: { display: "block", position: "relative", "margin-top": "-1px" },
1127
+ onClick: h
1128
+ }), {
1129
+ default: C(() => [
1130
+ H(z(t.addText ?? n(M).t("curdTable.addText")), 1)
1131
+ ]),
1132
+ _: 1
1133
+ }, 16, ["type", "size", "ghost", "disabled"])), [
1134
+ [ie, t.addable]
1135
+ ])
1136
+ ]));
1137
+ }
1138
+ }), Tt = {
1139
+ name: "MCalendar"
1140
+ }, At = /* @__PURE__ */ U({
1141
+ ...Tt,
1142
+ props: {
1143
+ /**
1144
+ * 指定日期,默认显示该日期所在月份
1145
+ */
1146
+ date: Date,
1147
+ /**
1148
+ * 传入的额外日期数据
1149
+ * 组件始终展示一段日期,但业务上有时需要根据返回的一组日期进行渲染,如 [{date:'2000-01-01',xxx:false},{date:'2000-01-02',xxx:true}]
1162
1150
  */
1163
1151
  dates: Array,
1164
1152
  /**
@@ -1257,190 +1245,189 @@ const A = {
1257
1245
  },
1258
1246
  emits: ["update:range", "select-range", "click-day", "dblclick-day"],
1259
1247
  setup(t, { emit: S }) {
1260
- const a = ge().appContext.config.globalProperties.$Date, e = t, l = S, n = H(), i = H(null), p = H(null), d = N(() => {
1261
- let c = Math.floor(e.startDay);
1262
- return (isNaN(c) || c < 0 || c > 6) && (c = 0), c;
1263
- }), s = N(() => {
1264
- let c;
1265
- const k = [], r = d.value + 7;
1266
- for (let B = d.value; B < r; B++)
1267
- c = B % 7, k.push({
1268
- title: e.weekMap?.[c] || A.t(`mCalendar.${e.weekType}.${c}`),
1269
- order: c
1248
+ const a = me().appContext.config.globalProperties.$Date, e = t, l = S, o = L(), i = L(null), h = L(null), p = P(() => {
1249
+ let f = Math.floor(e.startDay);
1250
+ return (isNaN(f) || f < 0 || f > 6) && (f = 0), f;
1251
+ }), b = P(() => {
1252
+ let f;
1253
+ const V = [], u = p.value + 7;
1254
+ for (let k = p.value; k < u; k++)
1255
+ f = k % 7, V.push({
1256
+ title: e.weekMap?.[f] || M.t(`mCalendar.${e.weekType}.${f}`),
1257
+ order: f
1270
1258
  });
1271
- return k;
1272
- }), h = (c) => {
1273
- let k = a(
1259
+ return V;
1260
+ }), v = (f) => {
1261
+ let V = a(
1274
1262
  e.date || e.dates && e.dates[0] && e.dates[0][e.dateKey]
1275
- ), r, B, f;
1276
- return e.isOnFirstLine ? r = k : (r = k.startOf("month"), B = k.endOf("month")), f = r.day(), d.value !== 0 && f === 0 && (f = 7), k = r.subtract(f - d.value, "day"), e.isOnFirstLine && (B = k.add(41, "day")), {
1277
- beginDate: k.format("YYYY-MM-DD"),
1278
- endDate: B?.format("YYYY-MM-DD"),
1279
- extra: [k, e.isOnFirstLine ? k : r, B]
1263
+ ), u, k, r;
1264
+ return e.isOnFirstLine ? u = V : (u = V.startOf("month"), k = V.endOf("month")), r = u.day(), p.value !== 0 && r === 0 && (r = 7), V = u.subtract(r - p.value, "day"), e.isOnFirstLine && (k = V.add(41, "day")), {
1265
+ beginDate: V.format("YYYY-MM-DD"),
1266
+ endDate: k?.format("YYYY-MM-DD"),
1267
+ extra: [V, e.isOnFirstLine ? V : u, k]
1280
1268
  };
1281
- }, u = () => {
1282
- e.hasRange && (i.value = p.value = null);
1269
+ }, c = () => {
1270
+ e.hasRange && (i.value = h.value = null);
1283
1271
  const {
1284
- extra: [c, k, r]
1285
- } = h(), B = e.dates?.[0] ? e.dates.slice() : [], f = /* @__PURE__ */ new Date();
1286
- let o, D, L;
1287
- for (n.value = [], o = 0; o < 42; o++)
1288
- D = c.add(o, "day"), L = B.find((G) => D.isSame(G[e.dateKey], "day")), n.value.push({
1289
- _date: D.toDate(),
1290
- _text: D.format(e.textFormat),
1291
- _isOuter: D.isBefore(k, "day") || D.isAfter(r, "day"),
1272
+ extra: [f, V, u]
1273
+ } = v(), k = e.dates?.[0] ? e.dates.slice() : [], r = /* @__PURE__ */ new Date();
1274
+ let s, $, q;
1275
+ for (o.value = [], s = 0; s < 42; s++)
1276
+ $ = f.add(s, "day"), q = k.find((ee) => $.isSame(ee[e.dateKey], "day")), o.value.push({
1277
+ _date: $.toDate(),
1278
+ _text: $.format(e.textFormat),
1279
+ _isOuter: $.isBefore(V, "day") || $.isAfter(u, "day"),
1292
1280
  //!eachDay.isBetween(start, end, 'day', '[]'),
1293
- _isToday: D.isSame(f, "day"),
1281
+ _isToday: $.isSame(r, "day"),
1294
1282
  // _rangeStart: undefined,
1295
1283
  // _rangeEnd: undefined,
1296
1284
  _inRange: void 0,
1297
- ...L
1285
+ ...q
1298
1286
  });
1299
1287
  };
1300
- let v;
1301
- const b = (c, k) => {
1302
- const r = e.hasRange && (!c._isOuter || e.outerInRange);
1303
- if (r)
1288
+ let T;
1289
+ const d = (f, V) => {
1290
+ const u = e.hasRange && (!f._isOuter || e.outerInRange);
1291
+ if (u)
1304
1292
  if (!i.value)
1305
- i.value = c, c._inRange = !0;
1306
- else if (p.value)
1307
- i.value = p.value = null, n.value.forEach((B) => {
1308
- B._inRange = !1;
1309
- }), e.clearable || (i.value = c);
1293
+ i.value = f, f._inRange = !0;
1294
+ else if (h.value)
1295
+ i.value = h.value = null, o.value.forEach((k) => {
1296
+ k._inRange = !1;
1297
+ }), e.clearable || (i.value = f);
1310
1298
  else {
1311
- if (c._date < i.value._date) {
1312
- const B = i.value;
1313
- i.value = c, c = B;
1299
+ if (f._date < i.value._date) {
1300
+ const k = i.value;
1301
+ i.value = f, f = k;
1314
1302
  }
1315
- p.value = c, c._inRange = !0;
1303
+ h.value = f, f._inRange = !0;
1316
1304
  }
1317
- l("click-day", c, k), r && (v = !0, J(() => {
1318
- v = null;
1319
- }), l("update:range", [i.value, p.value]), l(
1305
+ l("click-day", f, V), u && (T = !0, G(() => {
1306
+ T = null;
1307
+ }), l("update:range", [i.value, h.value]), l(
1320
1308
  "select-range",
1321
- [i.value, p.value],
1322
- n.value.slice(
1323
- n.value.indexOf(i.value),
1324
- n.value.indexOf(p.value) + 1
1309
+ [i.value, h.value],
1310
+ o.value.slice(
1311
+ o.value.indexOf(i.value),
1312
+ o.value.indexOf(h.value) + 1
1325
1313
  )
1326
1314
  ));
1327
- }, I = (c, k) => {
1328
- l("dblclick-day", c, k);
1329
- }, y = (c, k) => {
1330
- if (!e.hasRange || !i.value || p.value || c._isOuter && !e.outerInRange)
1315
+ }, y = (f, V) => {
1316
+ l("dblclick-day", f, V);
1317
+ }, B = (f, V) => {
1318
+ if (!e.hasRange || !i.value || h.value || f._isOuter && !e.outerInRange)
1331
1319
  return;
1332
- let r = n.value.indexOf(i.value);
1333
- if (k < r) {
1334
- const B = r;
1335
- r = k, k = B;
1320
+ let u = o.value.indexOf(i.value);
1321
+ if (V < u) {
1322
+ const k = u;
1323
+ u = V, V = k;
1336
1324
  }
1337
- n.value.forEach((B, f) => {
1338
- B._inRange = f >= r && f <= k;
1325
+ o.value.forEach((k, r) => {
1326
+ k._inRange = r >= u && r <= V;
1339
1327
  });
1340
- }, $ = (c) => {
1341
- if (!e.hasRange || v) return;
1342
- if (!c || !c.length) {
1343
- i.value = p.value = null, n.value.forEach((o) => {
1344
- o._inRange = !1;
1328
+ }, N = (f) => {
1329
+ if (!e.hasRange || T) return;
1330
+ if (!f || !f.length) {
1331
+ i.value = h.value = null, o.value.forEach((s) => {
1332
+ s._inRange = !1;
1345
1333
  });
1346
1334
  return;
1347
1335
  }
1348
- if (!c[0] || !c[1]) return;
1349
- if (a(c[0]._date).isAfter(c[1]._date)) {
1350
- const o = c[1];
1351
- c[1] = c[0], c[0] = o;
1336
+ if (!f[0] || !f[1]) return;
1337
+ if (a(f[0]._date).isAfter(f[1]._date)) {
1338
+ const s = f[1];
1339
+ f[1] = f[0], f[0] = s;
1352
1340
  }
1353
- const k = n.value.length;
1354
- let r, B = -1, f = k;
1355
- for (let o = 0; o < k; o++)
1356
- if (r = a(n.value[o]._date), B < 0 && r.isSame(c[0]._date, "day") && (i.value = n.value[o], B = o), r.isSame(c[1]._date, "day")) {
1357
- p.value = n.value[o], f = o;
1341
+ const V = o.value.length;
1342
+ let u, k = -1, r = V;
1343
+ for (let s = 0; s < V; s++)
1344
+ if (u = a(o.value[s]._date), k < 0 && u.isSame(f[0]._date, "day") && (i.value = o.value[s], k = s), u.isSame(f[1]._date, "day")) {
1345
+ h.value = o.value[s], r = s;
1358
1346
  break;
1359
1347
  }
1360
- n.value.forEach((o, D) => {
1361
- o._inRange = D >= B && D <= f;
1348
+ o.value.forEach((s, $) => {
1349
+ s._inRange = $ >= k && $ <= r;
1362
1350
  });
1363
1351
  };
1364
- return u(), e.range && (i.value = e.range[0], p.value = e.range[1], $(e.range)), z(
1352
+ return c(), e.range && (i.value = e.range[0], h.value = e.range[1], N(e.range)), I(
1365
1353
  () => e.date,
1366
- (c) => {
1367
- !e.dates && c instanceof Date && u();
1354
+ (f) => {
1355
+ !e.dates && f instanceof Date && c();
1368
1356
  }
1369
- ), z(
1357
+ ), I(
1370
1358
  () => e.dates,
1371
- (c) => {
1372
- c && u();
1359
+ (f) => {
1360
+ f && c();
1373
1361
  }
1374
- ), z(
1362
+ ), I(
1375
1363
  () => e.startDay,
1376
1364
  () => {
1377
- u();
1365
+ c();
1378
1366
  }
1379
- ), z(() => e.range, $), (c, k) => {
1380
- const r = O("Col"), B = O("Row"), f = O("Spin");
1381
- return V(), P("div", rt, [
1382
- x(B, null, {
1383
- default: C(() => [
1384
- (V(!0), P(X, null, ee(s.value, (o, D) => (V(), E(r, {
1385
- key: D,
1386
- span: "4",
1387
- class: oe([
1388
- "mcalendar-title",
1389
- { weekend: t.offDay.includes(o.order) },
1390
- t.titleClass && t.titleClass(o, D)
1367
+ ), I(() => e.range, N), (f, V) => (D(), j("div", {
1368
+ class: F(n(R)("mcalendar"))
1369
+ }, [
1370
+ O(n(fe), null, {
1371
+ default: C(() => [
1372
+ (D(!0), j(W, null, Z(b.value, (u, k) => (D(), E(n(oe), {
1373
+ key: k,
1374
+ span: "4",
1375
+ class: F([
1376
+ n(R)("mcalendar-title"),
1377
+ { weekend: t.offDay.includes(u.order) },
1378
+ t.titleClass && t.titleClass(u, k)
1379
+ ])
1380
+ }, {
1381
+ default: C(() => [
1382
+ H(z(u.title), 1)
1383
+ ]),
1384
+ _: 2
1385
+ }, 1032, ["class"]))), 128))
1386
+ ]),
1387
+ _: 1
1388
+ }),
1389
+ O(n(fe), null, {
1390
+ default: C(() => [
1391
+ (D(!0), j(W, null, Z(o.value, (u, k) => (D(), E(n(oe), {
1392
+ key: k,
1393
+ span: "4",
1394
+ class: F([
1395
+ n(R)("mcalendar-cell"),
1396
+ u._isToday && n(R)("mcalendar-cell_today"),
1397
+ { outer: u._isOuter },
1398
+ { "range-start": u === i.value },
1399
+ { "in-range": u._inRange },
1400
+ { "range-end": u === h.value },
1401
+ t.dateClass && t.dateClass(u, k),
1402
+ u.className
1403
+ ]),
1404
+ onClick: (r) => d(u, k),
1405
+ onDblclick: (r) => y(u, k),
1406
+ onMouseenter: (r) => B(u, k)
1407
+ }, {
1408
+ default: C(() => [
1409
+ w(f.$slots, "cell", {
1410
+ day: u,
1411
+ index: k
1412
+ }, () => [
1413
+ H(z(u._text), 1)
1391
1414
  ])
1392
- }, {
1393
- default: C(() => [
1394
- j(F(o.title), 1)
1395
- ]),
1396
- _: 2
1397
- }, 1032, ["class"]))), 128))
1398
- ]),
1399
- _: 1
1400
- }),
1401
- x(B, null, {
1402
- default: C(() => [
1403
- (V(!0), P(X, null, ee(n.value, (o, D) => (V(), E(r, {
1404
- key: D,
1405
- span: "4",
1406
- class: oe([
1407
- "mcalendar-cell",
1408
- { "mcalendar-cell_today": o._isToday },
1409
- { outer: o._isOuter },
1410
- { "range-start": o === i.value },
1411
- { "in-range": o._inRange },
1412
- { "range-end": o === p.value },
1413
- t.dateClass && t.dateClass(o, D),
1414
- o.className
1415
- ]),
1416
- onClick: (L) => b(o, D),
1417
- onDblclick: (L) => I(o, D),
1418
- onMouseenter: (L) => y(o, D)
1419
- }, {
1420
- default: C(() => [
1421
- R(c.$slots, "cell", {
1422
- day: o,
1423
- index: D
1424
- }, () => [
1425
- j(F(o._text), 1)
1426
- ])
1427
- ]),
1428
- _: 2
1429
- }, 1032, ["class", "onClick", "onDblclick", "onMouseenter"]))), 128))
1430
- ]),
1431
- _: 3
1432
- }),
1433
- ie(x(f, { fix: "" }, null, 512), [
1434
- [ce, t.loading]
1435
- ])
1436
- ]);
1437
- };
1415
+ ]),
1416
+ _: 2
1417
+ }, 1032, ["class", "onClick", "onDblclick", "onMouseenter"]))), 128))
1418
+ ]),
1419
+ _: 3
1420
+ }),
1421
+ _(O(n(_e), { fix: "" }, null, 512), [
1422
+ [ie, t.loading]
1423
+ ])
1424
+ ], 2));
1438
1425
  }
1439
- }), gt = {
1426
+ }), Rt = {
1440
1427
  name: "ModalFooter",
1441
1428
  inheritAttrs: !1
1442
- }, pt = /* @__PURE__ */ _({
1443
- ...gt,
1429
+ }, Mt = /* @__PURE__ */ U({
1430
+ ...Rt,
1444
1431
  props: {
1445
1432
  modelValue: Boolean,
1446
1433
  /**
@@ -1496,89 +1483,86 @@ const A = {
1496
1483
  },
1497
1484
  emits: ["update:modelValue", "ok", "cancel"],
1498
1485
  setup(t, { emit: S }) {
1499
- const a = S, e = ge(), l = () => {
1486
+ const a = S, e = me(), l = () => {
1500
1487
  e.vnode.props.onCancel ? a("cancel") : a("update:modelValue", !1);
1501
1488
  };
1502
- return (n, i) => {
1503
- const p = O("Col"), d = O("Button"), s = O("Row");
1504
- return V(), E(s, {
1505
- justify: "space-between",
1506
- align: "middle"
1507
- }, {
1508
- default: C(() => [
1509
- x(p, null, {
1510
- default: C(() => [
1511
- R(n.$slots, "other")
1512
- ]),
1513
- _: 3
1514
- }),
1515
- x(p, { class: "flex" }, {
1516
- default: C(() => [
1517
- t.rightCancel ? (V(), P(X, { key: 1 }, [
1518
- t.hasOk ? (V(), E(d, U({
1519
- key: 0,
1520
- disabled: t.okDisabled,
1521
- loading: t.okLoading
1522
- }, t.ok, {
1523
- type: "primary",
1524
- onClick: i[1] || (i[1] = (h) => n.$emit("ok"))
1525
- }), {
1526
- default: C(() => [
1527
- j(F(t.okText ?? M(A).t("modalFooter.ok")), 1)
1528
- ]),
1529
- _: 1
1530
- }, 16, ["disabled", "loading"])) : W("", !0),
1531
- x(d, U({
1532
- disabled: t.cancelDisabled,
1533
- loading: t.cancelLoading,
1534
- type: t.cancelType
1535
- }, t.cancel, { onClick: l }), {
1536
- default: C(() => [
1537
- j(F(t.cancelText ?? M(A).t("modalFooter.cancel")), 1)
1538
- ]),
1539
- _: 1
1540
- }, 16, ["disabled", "loading", "type"])
1541
- ], 64)) : (V(), P(X, { key: 0 }, [
1542
- x(d, U({
1543
- disabled: t.cancelDisabled,
1544
- loading: t.cancelLoading,
1545
- type: t.cancelType
1546
- }, t.cancel, { onClick: l }), {
1547
- default: C(() => [
1548
- j(F(t.cancelText ?? M(A).t("modalFooter.cancel")), 1)
1549
- ]),
1550
- _: 1
1551
- }, 16, ["disabled", "loading", "type"]),
1552
- t.hasOk ? (V(), E(d, U({
1553
- key: 0,
1554
- disabled: t.okDisabled,
1555
- loading: t.okLoading
1556
- }, t.ok, {
1557
- type: "primary",
1558
- onClick: i[0] || (i[0] = (h) => n.$emit("ok"))
1559
- }), {
1560
- default: C(() => [
1561
- j(F(t.okText ?? M(A).t("modalFooter.ok")), 1)
1562
- ]),
1563
- _: 1
1564
- }, 16, ["disabled", "loading"])) : W("", !0)
1565
- ], 64)),
1566
- R(n.$slots, "action")
1567
- ]),
1568
- _: 3
1569
- })
1570
- ]),
1571
- _: 3
1572
- });
1573
- };
1489
+ return (o, i) => (D(), E(n(fe), {
1490
+ justify: "space-between",
1491
+ align: "middle"
1492
+ }, {
1493
+ default: C(() => [
1494
+ O(n(oe), null, {
1495
+ default: C(() => [
1496
+ w(o.$slots, "other")
1497
+ ]),
1498
+ _: 3
1499
+ }),
1500
+ O(n(oe), null, {
1501
+ default: C(() => [
1502
+ t.rightCancel ? (D(), j(W, { key: 1 }, [
1503
+ t.hasOk ? (D(), E(n(X), K({
1504
+ key: 0,
1505
+ disabled: t.okDisabled,
1506
+ loading: t.okLoading
1507
+ }, t.ok, {
1508
+ type: "primary",
1509
+ onClick: i[1] || (i[1] = (h) => o.$emit("ok"))
1510
+ }), {
1511
+ default: C(() => [
1512
+ H(z(t.okText ?? n(M).t("modalFooter.ok")), 1)
1513
+ ]),
1514
+ _: 1
1515
+ }, 16, ["disabled", "loading"])) : J("", !0),
1516
+ O(n(X), K({
1517
+ disabled: t.cancelDisabled,
1518
+ loading: t.cancelLoading,
1519
+ type: t.cancelType
1520
+ }, t.cancel, { onClick: l }), {
1521
+ default: C(() => [
1522
+ H(z(t.cancelText ?? n(M).t("modalFooter.cancel")), 1)
1523
+ ]),
1524
+ _: 1
1525
+ }, 16, ["disabled", "loading", "type"])
1526
+ ], 64)) : (D(), j(W, { key: 0 }, [
1527
+ O(n(X), K({
1528
+ disabled: t.cancelDisabled,
1529
+ loading: t.cancelLoading,
1530
+ type: t.cancelType
1531
+ }, t.cancel, { onClick: l }), {
1532
+ default: C(() => [
1533
+ H(z(t.cancelText ?? n(M).t("modalFooter.cancel")), 1)
1534
+ ]),
1535
+ _: 1
1536
+ }, 16, ["disabled", "loading", "type"]),
1537
+ t.hasOk ? (D(), E(n(X), K({
1538
+ key: 0,
1539
+ disabled: t.okDisabled,
1540
+ loading: t.okLoading
1541
+ }, t.ok, {
1542
+ type: "primary",
1543
+ onClick: i[0] || (i[0] = (h) => o.$emit("ok"))
1544
+ }), {
1545
+ default: C(() => [
1546
+ H(z(t.okText ?? n(M).t("modalFooter.ok")), 1)
1547
+ ]),
1548
+ _: 1
1549
+ }, 16, ["disabled", "loading"])) : J("", !0)
1550
+ ], 64)),
1551
+ w(o.$slots, "action")
1552
+ ]),
1553
+ _: 3
1554
+ })
1555
+ ]),
1556
+ _: 3
1557
+ }));
1574
1558
  }
1575
- }), ht = {
1559
+ }), wt = {
1576
1560
  key: 0,
1577
1561
  class: "ivu-dropdown-item"
1578
- }, Y = {}, vt = {
1562
+ }, Y = {}, It = {
1579
1563
  name: "ToggleColumn"
1580
- }, Te = /* @__PURE__ */ _({
1581
- ...vt,
1564
+ }, Ne = /* @__PURE__ */ U({
1565
+ ...It,
1582
1566
  props: {
1583
1567
  modelValue: {
1584
1568
  type: Array
@@ -1612,171 +1596,166 @@ const A = {
1612
1596
  emits: ["update:modelValue", "change"],
1613
1597
  setup(t, { emit: S }) {
1614
1598
  const a = t, e = S;
1615
- let l, n, i;
1616
- const p = (f) => {
1599
+ let l, o, i;
1600
+ const h = (r) => {
1617
1601
  clearTimeout(l);
1618
- let o = localStorage.getItem(n);
1619
- o = o ? JSON.parse(o) : {}, f ? Pe(o, Ne(i, d)) : je(o, i, d), l = setTimeout(() => {
1620
- l = null, localStorage.setItem(n, JSON.stringify(o));
1602
+ let s = localStorage.getItem(o);
1603
+ s = s ? JSON.parse(s) : {}, r ? ot(s, it(i, p)) : nt(s, i, p), l = setTimeout(() => {
1604
+ l = null, localStorage.setItem(o, JSON.stringify(s));
1621
1605
  });
1622
1606
  };
1623
- let d;
1624
- a.storeAt && (n = a.storeAt.split(".")[0], i = a.storeAt.slice(n.length + 1), d = localStorage.getItem(n) && fe(JSON.parse(localStorage[n]), i), d || (d = {}, p(!0)));
1625
- const s = H(!1), h = ye([]), u = H([]), v = N(() => {
1626
- const f = u.value.filter((o) => o._switchable);
1627
- return f.some((o) => o._visible) && f.some((o) => !o._visible);
1628
- }), b = N({
1607
+ let p;
1608
+ a.storeAt && (o = a.storeAt.split(".")[0], i = a.storeAt.slice(o.length + 1), p = localStorage.getItem(o) && ge(JSON.parse(localStorage[o]), i), p || (p = {}, h(!0)));
1609
+ const b = L(!1), v = Ce([]), c = L([]), T = P(() => {
1610
+ const r = c.value.filter((s) => s._switchable);
1611
+ return r.some((s) => s._visible) && r.some((s) => !s._visible);
1612
+ }), d = P({
1629
1613
  get() {
1630
- const f = u.value.filter((o) => o._switchable);
1631
- return f.length > 0 && f.every((o) => o._visible);
1614
+ const r = c.value.filter((s) => s._switchable);
1615
+ return r.length > 0 && r.every((s) => s._visible);
1632
1616
  },
1633
- set(f) {
1634
- u.value.forEach((o, D) => {
1635
- o._switchable && (h.value[D]._visible = o._visible = f);
1636
- }), a.storeAt && (u.value.forEach((o, D) => {
1637
- d[o.key] = o._visible;
1638
- }), p()), B(), e("change", h.value);
1617
+ set(r) {
1618
+ c.value.forEach((s, $) => {
1619
+ s._switchable && (v.value[$]._visible = s._visible = r);
1620
+ }), a.storeAt && (c.value.forEach((s, $) => {
1621
+ p[s.key] = s._visible;
1622
+ }), h()), k(), e("change", v.value);
1639
1623
  }
1640
1624
  });
1641
- function I() {
1642
- const f = u.value.filter((o) => o._visible);
1643
- if (!a.all && f.length === 1) {
1644
- f[0]._switchable = !1;
1625
+ function y() {
1626
+ const r = c.value.filter((s) => s._visible);
1627
+ if (!a.all && r.length === 1) {
1628
+ r[0]._switchable = !1;
1645
1629
  return;
1646
1630
  }
1647
- f.forEach((o) => {
1648
- o.initSwitchable && !o._switchable && (o._switchable = !0);
1631
+ r.forEach((s) => {
1632
+ s.initSwitchable && !s._switchable && (s._switchable = !0);
1649
1633
  });
1650
1634
  }
1651
- function y(f, o) {
1652
- h.value[o]._visible = f._visible, a.storeAt && (d[f.key] = f._visible, p()), B(), I(), e("change", h.value[o]);
1635
+ function B(r, s) {
1636
+ v.value[s]._visible = r._visible, a.storeAt && (p[r.key] = r._visible, h()), k(), y(), e("change", v.value[s]);
1653
1637
  }
1654
- let $;
1655
- function c(f) {
1656
- clearTimeout($), $ = setTimeout(() => {
1657
- s.value = f, $ = null;
1638
+ let N;
1639
+ function f(r) {
1640
+ clearTimeout(N), N = setTimeout(() => {
1641
+ b.value = r, N = null;
1658
1642
  }, 200);
1659
1643
  }
1660
- function k() {
1661
- (Y[a.cacheId]?.cols || a.modelValue).forEach((f) => {
1662
- f.hasOwnProperty("_visible") || (a.storeAt ? f._visible = d[f.key] === void 0 || d[f.key] : f._visible = !0), f.hasOwnProperty("_switchable") || (f._switchable = !0), h.value.push(f), u.value.push({
1663
- title: f.title || "",
1664
- key: f.key,
1665
- initSwitchable: f._switchable,
1666
- _switchable: f._switchable,
1667
- _visible: f._visible
1644
+ function V() {
1645
+ (Y[a.cacheId]?.cols || a.modelValue).forEach((r) => {
1646
+ r.hasOwnProperty("_visible") || (a.storeAt ? r._visible = p[r.key] === void 0 || p[r.key] : r._visible = !0), r.hasOwnProperty("_switchable") || (r._switchable = !0), v.value.push(r), c.value.push({
1647
+ title: r.title || "",
1648
+ key: r.key,
1649
+ initSwitchable: r._switchable,
1650
+ _switchable: r._switchable,
1651
+ _visible: r._visible
1668
1652
  });
1669
- }), I(), B();
1653
+ }), y(), k();
1670
1654
  }
1671
- let r;
1672
- function B() {
1655
+ let u;
1656
+ function k() {
1673
1657
  a.cacheId != null && (Y[a.cacheId].flag = !0, setTimeout(() => {
1674
1658
  Y[a.cacheId].flag = null;
1675
- })), r = !0, setTimeout(() => {
1676
- r = null;
1659
+ })), u = !0, setTimeout(() => {
1660
+ u = null;
1677
1661
  }), e(
1678
1662
  "update:modelValue",
1679
- h.value.filter((f) => f._visible)
1663
+ v.value.filter((r) => r._visible)
1680
1664
  );
1681
1665
  }
1682
- return de(() => {
1683
- a.cacheId != null && (Y[a.cacheId] ? Y[a.cacheId].all++ : Y[a.cacheId] = { cols: a.modelValue, all: 1 }, $e(() => {
1666
+ return se(() => {
1667
+ a.cacheId != null && (Y[a.cacheId] ? Y[a.cacheId].all++ : Y[a.cacheId] = { cols: a.modelValue, all: 1 }, Fe(() => {
1684
1668
  Y[a.cacheId] && --Y[a.cacheId].all < 1 && delete Y[a.cacheId];
1685
- })), k();
1686
- }), z(
1669
+ })), V();
1670
+ }), I(
1687
1671
  () => a.modelValue,
1688
- (f) => {
1689
- r || (Y[a.cacheId] && !Y[a.cacheId].flag && (Y[a.cacheId].cols = f), h.value = [], u.value = [], k());
1672
+ (r) => {
1673
+ u || (Y[a.cacheId] && !Y[a.cacheId].flag && (Y[a.cacheId].cols = r), v.value = [], c.value = [], V());
1690
1674
  }
1691
- ), (f, o) => {
1692
- const D = O("Icon"), L = O("Button"), G = O("Checkbox"), re = O("DropdownItem"), ue = O("DropdownMenu"), pe = O("Dropdown");
1693
- return V(), E(pe, {
1694
- trigger: "custom",
1695
- visible: s.value,
1696
- placement: "bottom-end",
1697
- transfer: t.transfer,
1698
- "transfer-class-name": "toggle-column-pop",
1699
- class: "toggle-column"
1700
- }, {
1701
- list: C(() => [
1702
- te("div", {
1703
- onMouseenter: o[3] || (o[3] = (K) => c(!0)),
1704
- onMouseleave: o[4] || (o[4] = (K) => c(!1))
1705
- }, [
1706
- t.all ? (V(), P("div", ht, [
1707
- x(G, {
1708
- modelValue: b.value,
1709
- "onUpdate:modelValue": o[2] || (o[2] = (K) => b.value = K),
1710
- indeterminate: v.value
1711
- }, {
1712
- default: C(() => [
1713
- j(F(M(A).t("toggleColumn.checkAll")), 1)
1714
- ]),
1715
- _: 1
1716
- }, 8, ["modelValue", "indeterminate"])
1717
- ])) : W("", !0),
1718
- x(ue, { class: "toggle-column-list" }, {
1675
+ ), (r, s) => (D(), E(n(et), {
1676
+ trigger: "custom",
1677
+ visible: b.value,
1678
+ placement: "bottom-end",
1679
+ transfer: t.transfer,
1680
+ "transfer-class-name": n(R)("toggle-column-pop"),
1681
+ class: F(n(R)("toggle-column"))
1682
+ }, {
1683
+ list: C(() => [
1684
+ Q("div", {
1685
+ onMouseenter: s[3] || (s[3] = ($) => f(!0)),
1686
+ onMouseleave: s[4] || (s[4] = ($) => f(!1))
1687
+ }, [
1688
+ t.all ? (D(), j("div", wt, [
1689
+ O(n(ne), {
1690
+ modelValue: d.value,
1691
+ "onUpdate:modelValue": s[2] || (s[2] = ($) => d.value = $),
1692
+ indeterminate: T.value
1693
+ }, {
1719
1694
  default: C(() => [
1720
- (V(!0), P(X, null, ee(u.value, (K, Z) => (V(), E(re, {
1721
- key: Z,
1722
- disabled: !K._switchable
1723
- }, {
1724
- default: C(() => [
1725
- x(G, {
1726
- modelValue: K._visible,
1727
- "onUpdate:modelValue": (me) => K._visible = me,
1728
- disabled: !K._switchable,
1729
- onOnChange: (me) => y(K, Z)
1730
- }, {
1731
- default: C(() => [
1732
- j(F(K.title), 1)
1733
- ]),
1734
- _: 2
1735
- }, 1032, ["modelValue", "onUpdate:modelValue", "disabled", "onOnChange"])
1736
- ]),
1737
- _: 2
1738
- }, 1032, ["disabled"]))), 128))
1695
+ H(z(n(M).t("toggleColumn.checkAll")), 1)
1739
1696
  ]),
1740
1697
  _: 1
1741
- })
1742
- ], 32)
1743
- ]),
1744
- default: C(() => [
1745
- te("span", {
1746
- onMouseover: o[0] || (o[0] = (K) => c(!0)),
1747
- onMouseout: o[1] || (o[1] = (K) => c(!1)),
1748
- class: "toggle-column-btn"
1749
- }, [
1750
- R(f.$slots, "default", {}, () => [
1751
- x(L, {
1752
- type: "default",
1753
- icon: t.icon
1698
+ }, 8, ["modelValue", "indeterminate"])
1699
+ ])) : J("", !0),
1700
+ O(n(tt), {
1701
+ class: F(n(R)("toggle-column-list"))
1702
+ }, {
1703
+ default: C(() => [
1704
+ (D(!0), j(W, null, Z(c.value, ($, q) => (D(), E(n(at), {
1705
+ key: q,
1706
+ disabled: !$._switchable
1754
1707
  }, {
1755
1708
  default: C(() => [
1756
- t.icon ? W("", !0) : (V(), P(X, { key: 0 }, [
1757
- j(F(t.title ?? M(A).t("toggleColumn.title")) + " ", 1),
1758
- x(D, { type: "ios-arrow-down" })
1759
- ], 64))
1709
+ O(n(ne), {
1710
+ modelValue: $._visible,
1711
+ "onUpdate:modelValue": (ee) => $._visible = ee,
1712
+ disabled: !$._switchable,
1713
+ onOnChange: (ee) => B($, q)
1714
+ }, {
1715
+ default: C(() => [
1716
+ H(z($.title), 1)
1717
+ ]),
1718
+ _: 2
1719
+ }, 1032, ["modelValue", "onUpdate:modelValue", "disabled", "onOnChange"])
1760
1720
  ]),
1761
- _: 1
1762
- }, 8, ["icon"])
1763
- ])
1764
- ], 32)
1765
- ]),
1766
- _: 3
1767
- }, 8, ["visible", "transfer"]);
1768
- };
1721
+ _: 2
1722
+ }, 1032, ["disabled"]))), 128))
1723
+ ]),
1724
+ _: 1
1725
+ }, 8, ["class"])
1726
+ ], 32)
1727
+ ]),
1728
+ default: C(() => [
1729
+ Q("span", {
1730
+ onMouseover: s[0] || (s[0] = ($) => f(!0)),
1731
+ onMouseout: s[1] || (s[1] = ($) => f(!1)),
1732
+ class: F(n(R)("toggle-column-btn"))
1733
+ }, [
1734
+ w(r.$slots, "default", {}, () => [
1735
+ O(n(X), {
1736
+ type: "default",
1737
+ icon: t.icon
1738
+ }, {
1739
+ default: C(() => [
1740
+ t.icon ? J("", !0) : (D(), j(W, { key: 0 }, [
1741
+ H(z(t.title ?? n(M).t("toggleColumn.title")) + " ", 1),
1742
+ O(n(ce), { type: "ios-arrow-down" })
1743
+ ], 64))
1744
+ ]),
1745
+ _: 1
1746
+ }, 8, ["icon"])
1747
+ ])
1748
+ ], 34)
1749
+ ]),
1750
+ _: 3
1751
+ }, 8, ["visible", "transfer", "transfer-class-name", "class"]));
1769
1752
  }
1770
- }), bt = {
1771
- class: "page-table-header-title"
1772
- }, yt = {
1773
- class: "page-table-list"
1774
- }, kt = {
1753
+ }), zt = {
1775
1754
  name: "PageTable"
1776
1755
  // inheritAttrs: false
1777
- }, Ct = /* @__PURE__ */ _({
1778
- ...kt,
1779
- props: /* @__PURE__ */ Se({
1756
+ }, Ft = /* @__PURE__ */ U({
1757
+ ...zt,
1758
+ props: /* @__PURE__ */ Ae({
1780
1759
  columns: {
1781
1760
  type: Array,
1782
1761
  default: () => []
@@ -1845,13 +1824,6 @@ const A = {
1845
1824
  */
1846
1825
  process: Function,
1847
1826
  // loading: Boolean,
1848
- /**
1849
- * 自动设置Table的maxHeight
1850
- */
1851
- autoMaxHeight: {
1852
- type: Boolean,
1853
- default: !0
1854
- },
1855
1827
  /**
1856
1828
  * 是否本地分页
1857
1829
  */
@@ -1869,16 +1841,12 @@ const A = {
1869
1841
  autoRemain: Boolean,
1870
1842
  /**
1871
1843
  * 计算Table的maxHeight时,Table距离视口底部的距离
1872
- * @default 80
1844
+ * @default 45
1873
1845
  */
1874
1846
  bottomDis: {
1875
1847
  type: [Number, String],
1876
- default: 80
1848
+ default: 45
1877
1849
  },
1878
- /**
1879
- * Table的maxHeight
1880
- */
1881
- maxHeight: [Number, String],
1882
1850
  /**
1883
1851
  * 勾选项
1884
1852
  */
@@ -1922,347 +1890,403 @@ const A = {
1922
1890
  /**
1923
1891
  * 传至ToggleColumn组件的storeAt
1924
1892
  */
1925
- storeAt: String
1893
+ storeAt: String,
1894
+ /**
1895
+ * 隐藏分页
1896
+ */
1897
+ hidePage: Boolean,
1898
+ /**
1899
+ * 自动设置Table的maxHeight
1900
+ */
1901
+ autoMaxHeight: {
1902
+ type: Boolean,
1903
+ default: !0
1904
+ },
1905
+ /**
1906
+ * Table的maxHeight
1907
+ */
1908
+ maxHeight: [Number, String],
1909
+ /**
1910
+ * Table的height
1911
+ */
1912
+ height: [Number, String],
1913
+ /**
1914
+ * 自动设置Table的height
1915
+ */
1916
+ autoHeight: Boolean,
1917
+ /**
1918
+ * 最大化时自动计算哪种高度
1919
+ */
1920
+ maximizeHeightType: {
1921
+ type: String,
1922
+ default: "maxHeight"
1923
+ }
1926
1924
  }, {
1927
1925
  loading: {
1928
1926
  type: Boolean
1929
1927
  },
1930
1928
  loadingModifiers: {}
1931
1929
  }),
1932
- emits: /* @__PURE__ */ Se(["update:modelValue", "update:selection", "load", "select-all", "selection-change", "select", "reload", "change-col", "maximize-change"], ["update:loading"]),
1930
+ emits: /* @__PURE__ */ Ae(["update:modelValue", "update:selection", "load", "select-all", "selection-change", "select", "reload", "change-col", "maximize-change"], ["update:loading"]),
1933
1931
  setup(t, {
1934
1932
  expose: S,
1935
1933
  emit: a
1936
1934
  }) {
1937
1935
  const e = t, l = a;
1938
- let n;
1939
- const i = ze(t, "loading"), p = be("tableRef"), d = be("elRef"), s = H(!1), h = ye(), u = Fe({
1936
+ let o, i;
1937
+ const h = Je(t, "loading"), p = re("tableRef"), b = re("elRef"), v = re("pageRef"), c = L(!1), T = Ce(), d = qe({
1940
1938
  data: [],
1941
1939
  // rows: [] as Obj[],
1942
1940
  // selections: [],
1943
1941
  // loading: false,
1942
+ height: e.height,
1944
1943
  maxHeight: e.maxHeight,
1945
1944
  selectType: {
1946
1945
  align: "center",
1947
- className: "page-table-mr0",
1948
- renderHeader: (m) => {
1949
- const g = u.data.filter((w) => w._checkable && !w._disabled), T = g.length;
1946
+ className: R("page-table-mr0"),
1947
+ renderHeader: (g) => {
1948
+ const m = d.data.filter((A) => A._checkable && !A._disabled), x = m.length;
1950
1949
  return (
1951
1950
  // table.rows.some((e) => e._checkable) && (
1952
- u.data.some((w) => w._checkable) && x(Be, {
1953
- "model-value": !!T && g.every((w) => w._checked),
1954
- disabled: !T,
1955
- "onUpdate:model-value": (w) => {
1956
- g.forEach((q) => {
1957
- q._checked = w;
1951
+ d.data.some((A) => A._checkable) && O(ne, {
1952
+ "model-value": !!x && m.every((A) => A._checked),
1953
+ disabled: !x,
1954
+ "onUpdate:model-value": (A) => {
1955
+ m.forEach((ue) => {
1956
+ ue._checked = A;
1958
1957
  });
1959
1958
  },
1960
- onOnChange: (w) => {
1961
- L(), l("select-all", e.pure ? g.map((q) => Z(q)) : g, w);
1959
+ onOnChange: (A) => {
1960
+ he(), l("select-all", e.pure ? m.map((ue) => de(ue)) : m, A);
1962
1961
  }
1963
1962
  }, null)
1964
1963
  );
1965
1964
  },
1966
- render: (m, {
1967
- row: g,
1968
- index: T
1969
- }) => g._checkable && x(Be, {
1970
- "model-value": g._checked,
1971
- disabled: g._disabled,
1972
- "onUpdate:model-value": (w) => {
1973
- K(u.data[T], w);
1965
+ render: (g, {
1966
+ row: m,
1967
+ index: x
1968
+ }) => m._checkable && O(ne, {
1969
+ "model-value": m._checked,
1970
+ disabled: m._disabled,
1971
+ "onUpdate:model-value": (A) => {
1972
+ Ke(d.data[x], A);
1974
1973
  }
1975
1974
  }, null)
1976
1975
  }
1977
- }), v = De({
1976
+ }), y = Ie({
1978
1977
  curr: 1,
1979
- size: 30,
1978
+ size: e.initSize || e.pageSizeOpts[0],
1980
1979
  total: 0
1981
- }), b = N(() => s.value ? !1 : e.transfer), I = N(() => {
1982
- const m = [], g = (T) => {
1983
- T.slot && m.push(T), T.children && T.children.forEach((w) => {
1984
- g(w);
1980
+ }), B = P(() => c.value ? !1 : e.transfer), N = P(() => {
1981
+ const g = [], m = (x) => {
1982
+ x.slot && g.push(x), x.children && x.children.forEach((A) => {
1983
+ m(A);
1985
1984
  });
1986
1985
  };
1987
- return e.columns.forEach((T) => {
1988
- g(T);
1989
- }), m;
1986
+ return e.columns.forEach((x) => {
1987
+ m(x);
1988
+ }), g;
1990
1989
  });
1991
- function y() {
1992
- const m = e.columns.find((g) => g.type === "selection");
1993
- if (m) {
1994
- const g = {
1990
+ function f() {
1991
+ const g = e.columns.find((m) => m.type === "selection");
1992
+ if (g) {
1993
+ const m = {
1995
1994
  // fixed: selectType.fixed,
1996
1995
  // key: selectType.key,
1997
- ...m,
1998
- width: m.width || 54,
1996
+ ...g,
1997
+ width: g.width || 54,
1999
1998
  type: void 0,
2000
- ...u.selectType
1999
+ ...d.selectType
2001
2000
  };
2002
- h.value = [g].concat(e.columns.slice(1));
2001
+ T.value = [m].concat(e.columns.slice(1));
2003
2002
  } else
2004
- h.value = e.columns;
2003
+ T.value = e.columns;
2005
2004
  }
2006
- let $;
2007
- async function c() {
2005
+ let V, u, k = 0;
2006
+ async function r() {
2008
2007
  if (typeof e.method != "function") return console.warn("typeof method isn't function");
2009
- i.value = !0, l("update:selection", []);
2010
- const m = await e.method(Object.assign(re(), typeof e.param != "function" ? e.param : e.param()));
2011
- if (i.value = !1, !m) {
2012
- e.autoRemain || (v.total = 0, l("update:modelValue", []));
2008
+ u && (k = (k + 1) % Number.MAX_SAFE_INTEGER);
2009
+ const g = k;
2010
+ u = !0, h.value = !0, l("update:selection", []);
2011
+ const m = await e.method(Object.assign(Te(), typeof e.param != "function" ? e.param : e.param()));
2012
+ if (k !== g) return;
2013
+ if (h.value = !1, u = null, !m) {
2014
+ e.autoRemain || (y.total = 0, l("update:modelValue", []));
2013
2015
  return;
2014
2016
  }
2015
- let g = fe(m, e.dataKey) || [];
2016
- if (k(g), typeof e.process == "function") {
2017
- const T = e.process(g);
2018
- Array.isArray(T) && (g = T);
2017
+ let x = ge(m, e.dataKey) || [];
2018
+ if (s(x), typeof e.process == "function") {
2019
+ const A = e.process(x);
2020
+ Array.isArray(A) && (x = A);
2019
2021
  }
2020
- u.data = g, v.total = fe(m, e.totalKey), $ = !0, l("update:modelValue", u.data), l("load", m), setTimeout(() => {
2021
- $ = null;
2022
+ d.data = x, y.total = ge(m, e.totalKey) || 0, V = !0, l("update:modelValue", d.data), l("load", m), setTimeout(() => {
2023
+ V = null;
2022
2024
  });
2023
2025
  }
2024
- function k(m) {
2025
- e.columns.some((g) => g.type === "selection") && m.forEach((g) => {
2026
- g._checkable = !0, g._checked = g._disabled = !1;
2026
+ function s(g) {
2027
+ e.columns.some((m) => m.type === "selection") && g.forEach((m) => {
2028
+ m._checkable = !0, m._checked = m._disabled = !1;
2027
2029
  });
2028
2030
  }
2029
- function r(m) {
2030
- typeof e.check == "function" && !e.check() || (e.isLocal ? B(m) : c());
2031
+ function $(g) {
2032
+ typeof e.check == "function" && !e.check() || (e.isLocal ? q(g) : r());
2031
2033
  }
2032
- function B(m) {
2033
- let g = m ? v.size * (v.curr - 1) : 0;
2034
- const T = [], w = g + v.size, q = w > v.total ? v.total : w, se = e.modelValue;
2035
- for (; g < q; g++)
2036
- se[g]._checked = se[g]._disabled = !1, T.push(se[g]);
2037
- u.data = T, l("update:selection", []);
2034
+ function q(g) {
2035
+ let m = g ? y.size * (y.curr - 1) : 0;
2036
+ const x = [], A = m + y.size, ue = A > y.total ? y.total : A, ve = e.modelValue;
2037
+ for (; m < ue; m++)
2038
+ ve[m]._checked = ve[m]._disabled = !1, x.push(ve[m]);
2039
+ d.data = x, l("update:selection", []);
2038
2040
  }
2039
- function f() {
2040
- r(!0);
2041
+ function ee() {
2042
+ $(!0);
2043
+ }
2044
+ function Le(g) {
2045
+ y.size = g, y.curr === 1 && $();
2041
2046
  }
2042
- function o(m) {
2043
- v.size = m, v.curr === 1 && r();
2047
+ function De(g) {
2048
+ g !== !0 && (y.curr = 1), G(r);
2044
2049
  }
2045
- function D(m) {
2046
- m !== !0 && (v.curr = 1), J(c);
2050
+ function he(g, m) {
2051
+ g && (g._checked = m);
2052
+ let x = d.data.filter((A) => A._checked);
2053
+ e.pure && (x = x.map((A) => de(A))), l("update:selection", x), l("selection-change", x);
2047
2054
  }
2048
- function L(m, g) {
2049
- m && (m._checked = g);
2050
- let T = u.data.filter((w) => w._checked);
2051
- e.pure && (T = T.map((w) => Z(w))), l("update:selection", T), l("selection-change", T);
2055
+ function xe() {
2056
+ return window.innerHeight - +e.bottomDis - p.value.$el.getBoundingClientRect().top - v.value.$el.offsetHeight;
2052
2057
  }
2053
- function G() {
2054
- J(() => {
2055
- const m = window.innerHeight - +e.bottomDis - p.value.$el.getBoundingClientRect().top;
2056
- u.maxHeight = m > 0 ? m : 0;
2058
+ function Oe(g) {
2059
+ G(() => {
2060
+ const m = xe();
2061
+ d[g ? "height" : "maxHeight"] = m > 0 ? m : 0;
2057
2062
  });
2058
2063
  }
2059
- function re() {
2064
+ function $e() {
2065
+ (e.maximizeHeightType === "height" || e.maximizeHeightType === "maxHeight") && G(() => {
2066
+ const g = xe();
2067
+ d[e.maximizeHeightType] = g > 0 ? g : 0;
2068
+ });
2069
+ }
2070
+ function Te() {
2060
2071
  return {
2061
- [e.pageMap.first]: e.usePageNum ? v.curr : v.size * (v.curr - 1),
2062
- [e.pageMap.pageSize]: v.size
2072
+ [e.pageMap.first]: e.usePageNum ? y.curr : y.size * (y.curr - 1),
2073
+ [e.pageMap.pageSize]: y.size
2063
2074
  };
2064
2075
  }
2065
- let ue;
2066
- function pe(m, g) {
2067
- !e.clickToCheck || !m._checkable || m._disabled || (ue = !0, m = u.data[g], m._checked = !m._checked, L(m, m._checked), l("select", e.pure ? Z(m) : m, m._checked), setTimeout(() => {
2068
- ue = null;
2076
+ let pe;
2077
+ function Ee(g, m) {
2078
+ !e.clickToCheck || !g._checkable || g._disabled || (pe = !0, g = d.data[m], g._checked = !g._checked, he(g, g._checked), l("select", e.pure ? de(g) : g, g._checked), setTimeout(() => {
2079
+ pe = null;
2069
2080
  }));
2070
2081
  }
2071
- function K(m, g) {
2072
- ue || (L(m, g), l("select", e.pure ? Z(m) : m, g));
2082
+ function Ke(g, m) {
2083
+ pe || (he(g, m), l("select", e.pure ? de(g) : g, m));
2073
2084
  }
2074
- function Z(m) {
2075
- const g = {
2076
- ...m
2085
+ function de(g) {
2086
+ const m = {
2087
+ ...g
2077
2088
  };
2078
- return delete g._checkable, delete g._checked, delete g._disabled, g;
2089
+ return delete m._checkable, delete m._checked, delete m._disabled, m;
2079
2090
  }
2080
- function me() {
2091
+ function Ue() {
2081
2092
  if (e.fullscreen) {
2082
- s.value ? document.exitFullscreen() : d.value.requestFullscreen();
2093
+ c.value ? document.exitFullscreen() : b.value.requestFullscreen();
2083
2094
  return;
2084
2095
  }
2085
- s.value = !s.value, s.value ? (G(), document.body.classList.add("clip")) : (u.maxHeight = e.maxHeight ?? n, document.body.classList.remove("clip")), J(() => {
2086
- l("maximize-change", s.value);
2096
+ c.value = !c.value, c.value ? ($e(), document.body.classList.add("clip")) : (d.height = e.height ?? o, d.maxHeight = e.maxHeight ?? i, document.body.classList.remove("clip")), G(() => {
2097
+ l("maximize-change", c.value);
2087
2098
  });
2088
2099
  }
2089
- function we() {
2090
- i.value || (e.isLocal ? l("reload") : D());
2100
+ function Ye() {
2101
+ h.value || (e.isLocal ? l("reload") : De());
2091
2102
  }
2092
2103
  return S({
2093
- search: D,
2094
- setMaxHeight: G,
2095
- table: u,
2104
+ search: De,
2105
+ setMaxHeight: Oe,
2106
+ table: d,
2107
+ sizer: y,
2096
2108
  getPage: () => ({
2097
- ...re(),
2098
- curr: v.curr,
2099
- total: v.total
2109
+ ...Te(),
2110
+ curr: y.curr,
2111
+ total: y.total
2100
2112
  })
2101
- }), y(), v.size = e.initSize || e.pageSizeOpts[0], de(() => {
2102
- !e.maxHeight && e.autoMaxHeight && (G(), J(() => {
2103
- n = u.maxHeight;
2104
- })), e.fullscreen && (d.value.onfullscreenchange = () => {
2105
- s.value = !!document.fullscreenElement, s.value ? setTimeout(G) : u.maxHeight = e.maxHeight ?? n, setTimeout(() => {
2106
- l("maximize-change", s.value);
2113
+ }), f(), se(() => {
2114
+ !e.maxHeight && !e.height && (e.autoMaxHeight || e.autoHeight) && (Oe(e.autoHeight), G(() => {
2115
+ i = d.maxHeight, o = d.height;
2116
+ })), e.fullscreen && (b.value.onfullscreenchange = () => {
2117
+ c.value = !!document.fullscreenElement, c.value ? setTimeout($e) : (d.height = e.height ?? o, d.maxHeight = e.maxHeight ?? i), setTimeout(() => {
2118
+ l("maximize-change", c.value);
2107
2119
  });
2108
2120
  });
2109
- }), $e(() => {
2110
- d.value.onfullscreenchange = null;
2111
- }), z(() => e.modelValue, (m) => {
2112
- const g = Array.isArray(m) ? m : [];
2121
+ }), Fe(() => {
2122
+ b.value.onfullscreenchange = null;
2123
+ }), I(() => e.modelValue, (g) => {
2124
+ const m = Array.isArray(g) ? g : [];
2113
2125
  if (e.isLocal) {
2114
- v.curr = 1, v.total = g.length, k(g), B();
2126
+ y.curr = 1, y.total = m.length, s(m), q();
2115
2127
  return;
2116
2128
  }
2117
- $ || (v.curr = 1, v.total = g.length, u.data = g);
2129
+ V || (y.curr = 1, y.total = m.length, d.data = m);
2118
2130
  }, {
2119
2131
  immediate: !0
2120
- }), z(() => e.maxHeight, (m) => {
2121
- u.maxHeight = m;
2122
- }), z(() => e.columns, () => {
2123
- y();
2124
- }), (m, g) => {
2125
- const T = O("Col"), w = O("Icon"), q = O("Tooltip"), se = O("Row"), Ae = O("Table"), Re = O("Page");
2126
- return V(), P("div", {
2127
- ref: "elRef",
2128
- class: oe(["page-table-container", {
2129
- "page-table-bordered": t.border && t.showHeader,
2130
- "page-table-maximized": s.value,
2131
- "page-table-fullscreen": s.value && t.fullscreen
2132
- }])
2133
- }, [t.showHeader ? (V(), E(se, {
2134
- key: 0,
2135
- justify: "space-between",
2136
- align: "middle",
2137
- class: "page-table-header"
2138
- }, {
2139
- default: C(() => [x(T, null, {
2140
- default: C(() => [R(m.$slots, "title", {}, () => [te("h1", bt, F(t.title ?? M(A).t("pageTable.title")), 1)])]),
2141
- _: 3
2142
- }), x(T, null, {
2143
- default: C(() => [R(m.$slots, "headerAction"), x(q, {
2144
- placement: "top",
2145
- content: M(A).t("pageTable.reload"),
2146
- transfer: b.value,
2147
- class: "page-table-action"
2148
- }, {
2149
- default: C(() => [x(w, {
2150
- type: "md-refresh",
2151
- size: "20",
2152
- onClick: we
2153
- })]),
2154
- _: 1
2155
- }, 8, ["content", "transfer"]), x(q, {
2156
- placement: "top",
2157
- content: M(A).t(`pageTable.${s.value ? "restore" : "maxmize"}`),
2158
- transfer: b.value,
2159
- class: "page-table-action"
2160
- }, {
2161
- default: C(() => [x(w, {
2162
- type: s.value ? "md-contract" : "md-expand",
2163
- size: "20",
2164
- onClick: me
2165
- }, null, 8, ["type"])]),
2166
- _: 1
2167
- }, 8, ["content", "transfer"]), x(Te, {
2168
- modelValue: h.value,
2169
- "onUpdate:modelValue": g[0] || (g[0] = (Q) => h.value = Q),
2132
+ }), I(() => e.maxHeight, (g) => {
2133
+ d.maxHeight = g;
2134
+ }), I(() => e.height, (g) => {
2135
+ d.height = g;
2136
+ }), I(() => e.columns, () => {
2137
+ f();
2138
+ }), (g, m) => (D(), j("div", {
2139
+ ref: "elRef",
2140
+ class: F([
2141
+ n(R)("page-table-container"),
2142
+ // {
2143
+ // 'page-table-bordered': border && showHeader,
2144
+ // 'page-table-maximized': maximized,
2145
+ // 'page-table-fullscreen': maximized && fullscreen
2146
+ // }
2147
+ t.border && t.showHeader && n(R)("page-table-bordered"),
2148
+ c.value && n(R)("page-table-maximized"),
2149
+ c.value && t.fullscreen && n(R)("page-table-fullscreen")
2150
+ ])
2151
+ }, [t.showHeader ? (D(), E(n(fe), {
2152
+ key: 0,
2153
+ justify: "space-between",
2154
+ align: "middle",
2155
+ class: F(n(R)("page-table-header"))
2156
+ }, {
2157
+ default: C(() => [O(n(oe), null, {
2158
+ default: C(() => [w(g.$slots, "title", {}, () => [Q("h1", {
2159
+ class: F(n(R)("page-table-header-title"))
2160
+ }, z(t.title ?? n(M).t("pageTable.title")), 3)])]),
2161
+ _: 3
2162
+ }), O(n(oe), null, {
2163
+ default: C(() => [w(g.$slots, "headerAction"), O(n(Me), {
2164
+ placement: "top",
2165
+ content: n(M).t("pageTable.reload"),
2166
+ transfer: B.value,
2167
+ class: F(n(R)("page-table-action"))
2168
+ }, {
2169
+ default: C(() => [O(n(ce), {
2170
+ type: "md-refresh",
2170
2171
  size: "20",
2171
- transfer: b.value,
2172
- "store-at": t.storeAt,
2173
- onChange: g[1] || (g[1] = (Q) => m.$emit("change-col", Q))
2174
- }, {
2175
- default: C(() => [x(w, {
2176
- type: "md-settings",
2177
- size: "20"
2178
- })]),
2179
- _: 1
2180
- }, 8, ["modelValue", "transfer", "store-at"])]),
2181
- _: 3
2182
- })]),
2172
+ onClick: Ye
2173
+ })]),
2174
+ _: 1
2175
+ }, 8, ["content", "transfer", "class"]), O(n(Me), {
2176
+ placement: "top",
2177
+ content: n(M).t(`pageTable.${c.value ? "restore" : "maxmize"}`),
2178
+ transfer: B.value,
2179
+ class: F(n(R)("page-table-action"))
2180
+ }, {
2181
+ default: C(() => [O(n(ce), {
2182
+ type: c.value ? "md-contract" : "md-expand",
2183
+ size: "20",
2184
+ onClick: Ue
2185
+ }, null, 8, ["type"])]),
2186
+ _: 1
2187
+ }, 8, ["content", "transfer", "class"]), O(Ne, {
2188
+ modelValue: T.value,
2189
+ "onUpdate:modelValue": m[0] || (m[0] = (x) => T.value = x),
2190
+ size: "20",
2191
+ transfer: B.value,
2192
+ "store-at": t.storeAt,
2193
+ onChange: m[1] || (m[1] = (x) => g.$emit("change-col", x))
2194
+ }, {
2195
+ default: C(() => [O(n(ce), {
2196
+ type: "md-settings",
2197
+ size: "20"
2198
+ })]),
2199
+ _: 1
2200
+ }, 8, ["modelValue", "transfer", "store-at"])]),
2183
2201
  _: 3
2184
- })) : W("", !0), te("div", yt, [x(Ae, U({
2185
- ref: "tableRef"
2186
- }, M(He)(m.$attrs, ["id", "class", "style"]), {
2187
- border: t.border,
2188
- columns: h.value,
2189
- data: u.data,
2190
- loading: i.value,
2191
- "max-height": u.maxHeight,
2192
- onOnRowClick: pe
2193
- }), Ve({
2194
- _: 2
2195
- }, [m.$slots.header ? {
2196
- name: "header",
2197
- fn: C(() => [R(m.$slots, "header")]),
2198
- key: "0"
2199
- } : void 0, ee(I.value, (Q) => ({
2200
- name: Q.slot,
2201
- fn: C((Ie) => [R(m.$slots, Q.slot, ke(Ce(Ie)))])
2202
- })), m.$slots.footer ? {
2203
- name: "footer",
2204
- fn: C(() => [R(m.$slots, "footer")]),
2205
- key: "1"
2206
- } : void 0]), 1040, ["border", "columns", "data", "loading", "max-height"]), x(Re, {
2207
- modelValue: M(v).curr,
2208
- "onUpdate:modelValue": g[2] || (g[2] = (Q) => M(v).curr = Q),
2209
- total: M(v).total,
2210
- "page-size": M(v).size,
2211
- "show-total": "",
2212
- "show-sizer": "",
2213
- "show-elevator": "",
2214
- transfer: b.value,
2215
- "page-size-opts": t.pageSizeOpts,
2216
- class: "page-table-page-right",
2217
- onOnChange: f,
2218
- onOnPageSizeChange: o
2219
- }, null, 8, ["modelValue", "total", "page-size", "transfer", "page-size-opts"])])], 2);
2220
- };
2202
+ })]),
2203
+ _: 3
2204
+ }, 8, ["class"])) : J("", !0), Q("div", {
2205
+ class: F([n(R)("page-table-list"), !n(y).total && !d.data.length && n(R)("page-table-list-empty")])
2206
+ }, [O(n(He), K({
2207
+ ref: "tableRef"
2208
+ }, n(ut)(g.$attrs, ["id", "class", "style"]), {
2209
+ border: t.border,
2210
+ columns: T.value,
2211
+ data: d.data,
2212
+ loading: h.value,
2213
+ height: d.height,
2214
+ "max-height": d.maxHeight,
2215
+ onOnRowClick: Ee
2216
+ }), ze({
2217
+ _: 2
2218
+ }, [g.$slots.header ? {
2219
+ name: "header",
2220
+ fn: C(() => [w(g.$slots, "header")]),
2221
+ key: "0"
2222
+ } : void 0, Z(N.value, (x) => ({
2223
+ name: x.slot,
2224
+ fn: C((A) => [w(g.$slots, x.slot, Be(Ve(A)))])
2225
+ })), g.$slots.footer ? {
2226
+ name: "footer",
2227
+ fn: C(() => [w(g.$slots, "footer")]),
2228
+ key: "1"
2229
+ } : void 0]), 1040, ["border", "columns", "data", "loading", "height", "max-height", "onOnRowClick"]), _(O(n(lt), {
2230
+ ref: "pageRef",
2231
+ modelValue: n(y).curr,
2232
+ "onUpdate:modelValue": m[2] || (m[2] = (x) => n(y).curr = x),
2233
+ total: n(y).total,
2234
+ "page-size": n(y).size,
2235
+ "show-total": "",
2236
+ "show-sizer": "",
2237
+ "show-elevator": "",
2238
+ transfer: B.value,
2239
+ "page-size-opts": t.pageSizeOpts,
2240
+ class: F(n(R)("page-table-paginator")),
2241
+ onOnChange: ee,
2242
+ onOnPageSizeChange: Le
2243
+ }, null, 8, ["modelValue", "total", "page-size", "transfer", "page-size-opts", "class"]), [[ie, !t.hidePage]])], 2)], 2));
2221
2244
  }
2222
- }), St = [
2223
- Ke,
2224
- _e,
2225
- qe,
2226
- Ze,
2227
- lt,
2228
- Oe,
2229
- ot,
2230
- st,
2231
- ct,
2232
- ft,
2233
- pt,
2234
- Ct,
2235
- Te
2236
- ], Bt = { iviewSelect: xe };
2237
- function Dt(t, S = {}) {
2238
- if (St.forEach((a) => {
2245
+ }), Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2246
+ __proto__: null,
2247
+ AllCheckbox: rt,
2248
+ BaseSwitch: ft,
2249
+ CacheSelect: Ct,
2250
+ Combi: pt,
2251
+ CountRange: bt,
2252
+ CurdTable: $t,
2253
+ DateRange: Vt,
2254
+ DateRangePicker: xt,
2255
+ MCalendar: At,
2256
+ ModalFooter: Mt,
2257
+ PageTable: Ft,
2258
+ RemoteSelect: Pe,
2259
+ ToggleColumn: Ne
2260
+ }, Symbol.toStringTag, { value: "Module" })), we = Object.values(Ht), jt = Object.entries({ iviewSelect: je });
2261
+ function Pt(t, S = {}) {
2262
+ if (S.prefix && (Se[0] = S.prefix, we.forEach((a) => a.name = S.prefix + a.name)), we.forEach((a) => {
2239
2263
  t.component(a.name, a);
2240
- }), Object.entries(Bt).forEach((a) => {
2264
+ }), jt.forEach((a) => {
2241
2265
  t.directive(a[0], a[1]);
2242
2266
  }), S.i18n) {
2243
- A.i18n = S.i18n, S.msgPrefix && S.msgPrefix !== "d" && (A.prefix = S.msgPrefix);
2267
+ M.i18n = S.i18n, S.msgPrefix && S.msgPrefix !== "d" && (M.prefix = S.msgPrefix);
2244
2268
  return;
2245
2269
  }
2246
- S.msg && (A.msg = S.msg);
2270
+ S.msg && (M.msg = S.msg);
2247
2271
  }
2248
- const Ft = {
2249
- install: Dt
2272
+ const Zt = {
2273
+ install: Pt
2250
2274
  };
2251
2275
  export {
2252
- Ke as AllCheckbox,
2253
- _e as BaseSwitch,
2254
- lt as CacheSelect,
2255
- qe as Combi,
2256
- Ze as CountRange,
2257
- ot as CurdTable,
2258
- st as DateRange,
2259
- ct as DateRangePicker,
2260
- ft as MCalendar,
2261
- pt as ModalFooter,
2262
- Ct as PageTable,
2263
- Oe as RemoteSelect,
2264
- Te as ToggleColumn,
2265
- Ft as default,
2266
- Dt as install,
2267
- xe as iviewSelect
2276
+ rt as AllCheckbox,
2277
+ ft as BaseSwitch,
2278
+ Ct as CacheSelect,
2279
+ pt as Combi,
2280
+ bt as CountRange,
2281
+ $t as CurdTable,
2282
+ Vt as DateRange,
2283
+ xt as DateRangePicker,
2284
+ At as MCalendar,
2285
+ Mt as ModalFooter,
2286
+ Ft as PageTable,
2287
+ Pe as RemoteSelect,
2288
+ Ne as ToggleColumn,
2289
+ Zt as default,
2290
+ Pt as install,
2291
+ je as iviewSelect
2268
2292
  };