@vue-start/pro 0.4.13 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,158 +1,350 @@
1
- import { defineComponent as L, createVNode as b, mergeProps as R, isVNode as ie, computed as w, h as Z, inject as J, reactive as B, Fragment as oe, provide as Q, ref as $ } from "vue";
2
- import { map as M, isString as fe, forEach as z, reduce as ee, size as V, get as v, set as _, pick as K, omit as C, isArray as U, some as ve, keys as k, isFunction as H, head as tt, isObject as Fe, filter as G, split as nt, isEmpty as rt, mergeWith as xe, sortBy as ke, cloneDeep as at, isUndefined as ot, concat as ct, debounce as ut, clone as st, isBoolean as pe } from "lodash";
3
- import { merge as dt, filter as he, tap as be, Subject as it } from "rxjs";
4
- import { useEffect as ce, setReactiveValue as lt, useWatch as mt } from "@vue-start/hooks";
5
- import { useRequestProvide as ge, isDoneRequestActor as qe, isFailedRequestActor as Ke } from "@vue-start/request";
6
- import { useRouter as ft, useRoute as pt } from "vue-router";
7
- function yt(e) {
8
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !ie(e);
9
- }
10
- const Et = () => ({
11
- row: {
12
- type: Object,
13
- default: void 0
14
- },
15
- col: {
16
- type: Object
1
+ var It = Object.defineProperty;
2
+ var Dt = (e, t, n) => t in e ? It(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var Y = (e, t, n) => (Dt(e, typeof t != "symbol" ? t + "" : t, n), n);
4
+ import { defineComponent as N, provide as se, inject as Z, ref as B, computed as w, h as de, isVNode as Se, reactive as W, createVNode as y, Fragment as H, mergeProps as O, createTextVNode as qe, toRef as Mt } from "vue";
5
+ import { reduce as _, get as S, isFunction as k, map as K, isString as Ie, forEach as te, size as X, set as ce, pick as q, omit as C, isArray as oe, some as le, keys as F, head as Nt, isObject as ve, filter as U, split as Ot, isEmpty as Lt, mergeWith as At, startsWith as Rt, mapKeys as Kt, has as Je, debounce as wt, clone as kt, isBoolean as ne, every as Ft, sortBy as Qe, cloneDeep as $t } from "lodash";
6
+ import { Observable as xt, filter as Pe, tap as Ee, merge as jt, Subject as qt } from "rxjs";
7
+ import { useEffect as J, useState as we, setReactiveValue as Ye, useWatch as Ze, useUpdateKey as Ut, useResizeObserver as Bt } from "@vue-start/hooks";
8
+ import { useRequestProvide as he, isDoneRequestActor as et, isFailedRequestActor as tt } from "@vue-start/request";
9
+ import { map as Vt, distinctUntilChanged as _t } from "rxjs/operators";
10
+ import { useRouter as Gt, useRoute as zt } from "vue-router";
11
+ const Wt = () => ({
12
+ elementMap: { type: Object },
13
+ formElementMap: { type: Object },
14
+ columns: { type: Array },
15
+ columnState: { type: Object }
16
+ }), me = Wt(), Ht = () => ({
17
+ elementMap: { type: Object },
18
+ formElementMap: { type: Object },
19
+ registerStores: { type: Array },
20
+ registerActors: { type: Array },
21
+ registerMetas: { type: Array }
22
+ }), ke = Symbol("pro-config"), ee = () => Z(ke) || {}, Jn = N({
23
+ props: {
24
+ ...Ht()
17
25
  },
18
- items: {
19
- type: Array
26
+ setup: (e, { slots: t }) => {
27
+ const n = _(e.registerStores, (c, m) => ({ ...c, [m.key]: m }), {}), s = _(e.registerActors, (c, m) => ({ ...c, [m.actor.name]: m }), {}), o = _(e.registerMetas, (c, m) => ({ ...c, [m.actorName]: m }), {});
28
+ ln(o, s);
29
+ const { dispatchRequest: a } = he(), r = (c, m, f) => {
30
+ const b = S(s, c);
31
+ if (!!b)
32
+ return a(b.actor, m, f);
33
+ };
34
+ return se(ke, {
35
+ elementMap: e.elementMap,
36
+ formElementMap: e.formElementMap,
37
+ registerStoreMap: n,
38
+ registerActorMap: s,
39
+ registerMetaMap: o,
40
+ dispatchRequest: r
41
+ }), () => {
42
+ var c;
43
+ return (c = t.default) == null ? void 0 : c.call(t);
44
+ };
20
45
  }
21
- }), $t = (e, n) => L({
22
- props: {
23
- ...Et()
24
- },
25
- setup: (o) => () => {
26
- let t;
27
- return b(e, o.row, yt(t = M(o.items, (u) => b(n, R({
28
- key: u.rowKey
29
- }, o.col, u.col), {
30
- default: () => [u.vNode]
31
- }))) ? t : {
32
- default: () => [t]
46
+ }), Qn = (e = {}) => (t) => {
47
+ t.provide(ke, e);
48
+ }, Xt = Object.prototype.hasOwnProperty, Ue = (e, t) => e === t ? e !== 0 || t !== 0 || 1 / e === 1 / t : e !== e && t !== t, Jt = (e, t) => {
49
+ if (Ue(e, t))
50
+ return !0;
51
+ if (typeof e != "object" || e === null || typeof t != "object" || t === null)
52
+ return !1;
53
+ const n = Object.keys(e), s = Object.keys(t);
54
+ if (n.length !== s.length)
55
+ return !1;
56
+ for (let o = 0; o < n.length; o++)
57
+ if (!Xt.call(t, n[o]) || !Ue(e[n[o]], t[n[o]]))
58
+ return !1;
59
+ return !0;
60
+ }, Qt = "$store", De = () => Z(Qt), Yt = (e, t) => (n = {}, s) => {
61
+ const o = typeof e == "function" ? e(s) : e;
62
+ if (o === "")
63
+ return n;
64
+ const a = t(n[o], s), r = {};
65
+ for (const c in n)
66
+ c !== o && (r[c] = n[c]);
67
+ return typeof a < "u" && (r[o] = a), r;
68
+ };
69
+ class Zt {
70
+ constructor(t) {
71
+ Y(this, "group");
72
+ Y(this, "name");
73
+ Y(this, "stage");
74
+ Y(this, "effect");
75
+ Y(this, "arg");
76
+ Y(this, "opts");
77
+ this.group = t.group || "UN_GROUPED", this.name = t.name || "UN_NAMED", this.stage = t.stage, this.effect = t.effect, this.arg = t.arg || {}, this.opts = t.opts || {};
78
+ }
79
+ static of(t) {
80
+ return new this({ group: t });
81
+ }
82
+ named(t, n) {
83
+ return new this.constructor({
84
+ ...this,
85
+ name: t,
86
+ opts: {
87
+ ...this.opts,
88
+ ...n
89
+ }
90
+ });
91
+ }
92
+ staged(t) {
93
+ return new this.constructor({
94
+ ...this,
95
+ stage: t
96
+ });
97
+ }
98
+ effectWith(t) {
99
+ return new this.constructor({
100
+ ...this,
101
+ effect: t
102
+ });
103
+ }
104
+ effectOn(t, n) {
105
+ return this.effectWith(Yt(t, n));
106
+ }
107
+ with(t, n) {
108
+ return new this.constructor({
109
+ ...this,
110
+ arg: t,
111
+ opts: {
112
+ ...this.opts,
113
+ ...n
114
+ }
33
115
  });
34
116
  }
35
- }), Ue = (e) => (n, o) => {
36
- const { requestSubject$: t } = ge(), u = new Set(M(n, (r) => fe(r) ? r : r.name));
37
- ce(() => {
38
- const r = t.pipe(
39
- he(e),
40
- be((s) => {
41
- u.has(s.name) && o(s);
117
+ invoke(t) {
118
+ t.dispatch(this);
119
+ }
120
+ get type() {
121
+ let t = !1;
122
+ for (const n in this.opts)
123
+ n !== "parentActor" && (this.opts[n], t = !0);
124
+ return `@@${this.group}/${this.name}${this.stage ? `::${this.stage}` : ""}${t ? `${JSON.stringify(this.opts)}` : ""}`;
125
+ }
126
+ is(t) {
127
+ const n = this.isSameGroup(t) && t.name === this.name;
128
+ return this.stage ? n && t.stage === this.stage : n;
129
+ }
130
+ isSameGroup(t) {
131
+ return t.group === this.group;
132
+ }
133
+ }
134
+ class Me extends xt {
135
+ constructor(n, s, o = Jt) {
136
+ super((a) => this.state$.pipe(
137
+ Vt((r) => {
138
+ const c = this.mapper(r);
139
+ return o(c, this._value) || (this._value = c), this._value;
140
+ }),
141
+ _t()
142
+ ).subscribe(a));
143
+ Y(this, "_value");
144
+ this.state$ = n, this.mapper = s;
145
+ }
146
+ static from(n, s) {
147
+ return new Me(n, s, s.equalFn);
148
+ }
149
+ get value() {
150
+ return typeof this._value > "u" && (this._value = this.mapper(this.state$.value)), this._value;
151
+ }
152
+ }
153
+ const en = (e, t) => {
154
+ const [n, s] = we(t || e.value);
155
+ return J(() => {
156
+ const o = e.subscribe((a) => {
157
+ s(a);
158
+ });
159
+ return () => {
160
+ o && o.unsubscribe();
161
+ };
162
+ }, void 0), n;
163
+ }, tn = (e, t) => {
164
+ const n = B(t || e.value);
165
+ return J(() => {
166
+ const s = e.subscribe((o) => {
167
+ n.value = o;
168
+ });
169
+ return () => {
170
+ s && s.unsubscribe();
171
+ };
172
+ }, []), n;
173
+ }, nn = (e, t) => Me.from(e, t), rn = (e) => nn(De(), e || ((t) => t)), an = Zt.of("state"), nt = an.named("update").effectOn(
174
+ (e) => e.opts.key,
175
+ (e, t) => t.arg(e)
176
+ ), rt = () => {
177
+ const e = De();
178
+ return (t, n, s, o) => {
179
+ const a = `${s ? "$" : ""}${t}`, r = k(o) ? o() : o;
180
+ nt.with(
181
+ (c = r) => k(n) ? n(c) : n,
182
+ { key: a }
183
+ ).invoke(e);
184
+ };
185
+ }, on = (e, t, n) => {
186
+ const s = `${n ? "$" : ""}${e}`, o = k(t) ? t() : t, a = De(), r = (f) => nt.with(
187
+ (b = o) => k(f) ? f(b) : f,
188
+ { key: s }
189
+ ).invoke(a), c = Me.from(a, (f) => S(f, [s], o));
190
+ return [en(c), r];
191
+ }, sn = (e, t, n = !1) => () => {
192
+ const [s, o] = on(e, t, n);
193
+ return [s, o];
194
+ }, at = (e) => (t, n) => {
195
+ const { requestSubject$: s } = he(), o = new Set(K(t, (a) => Ie(a) ? a : a.name));
196
+ J(() => {
197
+ const a = s.pipe(
198
+ Pe(e),
199
+ Ee((r) => {
200
+ o.has(r.name) && n(r);
42
201
  })
43
202
  ).subscribe();
44
203
  return () => {
45
- r.unsubscribe();
204
+ a.unsubscribe();
46
205
  };
47
206
  }, []);
48
- }, Vt = Ue(qe), Xt = Ue(Ke), St = (e, n, o) => {
49
- const { requestSubject$: t, dispatchRequest: u } = ge(), r = new Set(M(e, (m) => fe(m) ? m : m.name)), s = {};
50
- ce(() => {
51
- const m = dt(
52
- t.pipe(
53
- he(qe),
54
- be((y) => {
55
- var E, l;
56
- r.has(y.name) && ((E = n.onSuccess) == null || E.call(n, y), (l = n.onFinish) == null || l.call(n, y), s[y.name] = void 0);
207
+ }, Yn = at(et), Zn = at(tt), cn = (e, t, n) => {
208
+ const { requestSubject$: s, dispatchRequest: o } = he(), a = new Set(K(e, (c) => Ie(c) ? c : c.name)), r = {};
209
+ J(() => {
210
+ const c = jt(
211
+ s.pipe(
212
+ Pe(et),
213
+ Ee((m) => {
214
+ var f, b;
215
+ a.has(m.name) && ((f = t.onSuccess) == null || f.call(t, m), (b = t.onFinish) == null || b.call(t, m), r[m.name] = void 0);
57
216
  })
58
217
  ),
59
- t.pipe(
60
- he(Ke),
61
- be((y) => {
62
- var E, l;
63
- r.has(y.name) && ((E = n.onFailed) == null || E.call(n, y), (l = n.onFinish) == null || l.call(n, y), s[y.name] = void 0);
218
+ s.pipe(
219
+ Pe(tt),
220
+ Ee((m) => {
221
+ var f, b;
222
+ a.has(m.name) && ((f = t.onFailed) == null || f.call(t, m), (b = t.onFinish) == null || b.call(t, m), r[m.name] = void 0);
64
223
  })
65
224
  )
66
225
  ).subscribe();
67
226
  return () => {
68
- m.unsubscribe(), o && z(s, (y) => {
69
- y && u({ ...y, stage: "CANCEL" });
227
+ c.unsubscribe(), n && te(r, (m) => {
228
+ m && o({ ...m, stage: "CANCEL" });
70
229
  });
71
230
  };
72
231
  }, []);
73
- }, Be = (e) => e.formValueType || e.valueType || "text", te = (e) => {
74
- var n;
75
- return ((n = e.formItemProps) == null ? void 0 : n.name) || e.dataIndex;
76
- }, Pe = (e, n, o = !0) => {
77
- var m;
78
- const t = Be(n), u = v(e, t);
79
- if (!u)
232
+ }, un = (e, t, n) => {
233
+ var o;
234
+ const s = (o = e.res) == null ? void 0 : o.data;
235
+ return t ? t(s, e) : n ? S(s, n) : s;
236
+ }, er = () => {
237
+ const e = De(), { registerMetaMap: t, dispatchRequest: n } = ee();
238
+ return (s) => {
239
+ const o = S(t, s);
240
+ if (!o)
241
+ return;
242
+ const a = o.storeName || s;
243
+ S(e.value, a) || n(s, o.initParams || {});
244
+ };
245
+ }, ln = (e, t) => {
246
+ const { requestSubject$: n } = he(), s = rt(), o = (a) => {
247
+ const r = S(e, a.name), c = S(t, a.name);
248
+ return !!(r && c && c.actor);
249
+ };
250
+ J(() => {
251
+ const a = n.pipe(
252
+ Pe(o),
253
+ Ee((r) => {
254
+ const c = S(e, r.name);
255
+ if (!c)
256
+ return;
257
+ const m = c.storeName || r.name, f = un(r, c.convertData, c.convertPath);
258
+ s(m, f, !1, void 0);
259
+ })
260
+ ).subscribe();
261
+ return () => {
262
+ a.unsubscribe();
263
+ };
264
+ }, []);
265
+ }, ot = (e) => e.formValueType || e.valueType || "text", ue = (e) => {
266
+ var t;
267
+ return ((t = e.formItemProps) == null ? void 0 : t.name) || e.dataIndex;
268
+ }, st = (e, t, n = !0) => {
269
+ var c;
270
+ const s = ot(t), o = S(e, s);
271
+ if (!o)
80
272
  return null;
81
- const r = te(n), s = o ? n.formItemProps : C(n.formItemProps, "rules");
82
- return Z(u, {
83
- key: r,
84
- name: r,
85
- label: n.title,
86
- ...s,
87
- fieldProps: C(n.formFieldProps, "slots"),
88
- showProps: n.showProps
89
- }, (m = n.formFieldProps) == null ? void 0 : m.slots);
90
- }, $e = (e, n, o) => {
91
- var r;
92
- const t = n.valueType || "text", u = v(e, t);
93
- return u ? Z(u, {
94
- ...C(n.formFieldProps, "slots"),
95
- showProps: n.showProps,
96
- value: o
97
- }, (r = n.formFieldProps) == null ? void 0 : r.slots) : null;
98
- }, Te = (e, n) => M(n, (o) => ne(e, o)), Ve = (e, n) => {
99
- var u;
100
- const o = n.elementProps, t = {
101
- ...n.elementProps
273
+ const a = ue(t), r = n ? t.formItemProps : C(t.formItemProps, "rules");
274
+ return de(o, {
275
+ key: a,
276
+ name: a,
277
+ label: t.title,
278
+ ...r,
279
+ fieldProps: C(t.formFieldProps, "slots"),
280
+ showProps: t.showProps
281
+ }, (c = t.formFieldProps) == null ? void 0 : c.slots);
282
+ }, Fe = (e, t, n) => {
283
+ var a;
284
+ const s = t.valueType || "text", o = S(e, s);
285
+ return o ? de(o, {
286
+ ...C(t.formFieldProps, "slots"),
287
+ showProps: t.showProps,
288
+ value: n
289
+ }, (a = t.formFieldProps) == null ? void 0 : a.slots) : null;
290
+ }, $e = (e, t) => K(t, (n) => fe(e, n)), ct = (e, t) => {
291
+ var o;
292
+ const n = t.elementProps, s = {
293
+ ...t.elementProps
102
294
  };
103
- return z((u = n.highConfig$) == null ? void 0 : u.registerPropsTrans, (r) => {
104
- const s = v(o, r.name);
105
- if (!(!s || ie(s))) {
106
- if (U(s)) {
107
- if (ve(s, (m) => ie(m)))
295
+ return te((o = t.highConfig$) == null ? void 0 : o.registerPropsTrans, (a) => {
296
+ const r = S(n, a.name);
297
+ if (!(!r || Se(r))) {
298
+ if (oe(r)) {
299
+ if (le(r, (c) => Se(c)))
108
300
  return;
109
- _(t, r.name, Te(e, s));
301
+ ce(s, a.name, $e(e, r));
110
302
  return;
111
303
  }
112
- !s.elementType || (r.isFun ? _(t, r.name, (...m) => {
113
- const y = r.needParams ? {
114
- ...s.elementProps,
115
- params$: m
116
- } : s.elementProps;
117
- return ne(e, {
118
- ...s,
119
- elementProps: y
304
+ !r.elementType || (a.isFun ? ce(s, a.name, (...c) => {
305
+ const m = a.needParams ? {
306
+ ...r.elementProps,
307
+ params$: c
308
+ } : r.elementProps;
309
+ return fe(e, {
310
+ ...r,
311
+ elementProps: m
120
312
  });
121
- }) : _(t, r.name, ne(e, s)));
313
+ }) : ce(s, a.name, fe(e, r)));
122
314
  }
123
- }), t;
124
- }, Xe = (e, n) => {
125
- const o = V(n.children) > 0 ? Te(e, n.children) : void 0, t = n.childrenSlotName || "default", u = C(n.slots, o ? t : "");
126
- return z(k(u), (r) => {
127
- const s = u[r];
128
- s && !H(s) && s.elementType && (u[r] = (...m) => {
129
- const y = s.needParams ? {
130
- ...s.elementProps,
131
- params$: m
132
- } : s.elementProps;
133
- return ne(e, {
134
- ...s,
135
- elementProps: y
315
+ }), s;
316
+ }, ut = (e, t) => {
317
+ const n = X(t.children) > 0 ? $e(e, t.children) : void 0, s = t.childrenSlotName || "default", o = C(t.slots, n ? s : "");
318
+ return te(F(o), (a) => {
319
+ const r = o[a];
320
+ r && !k(r) && r.elementType && (o[a] = (...c) => {
321
+ const m = r.needParams ? {
322
+ ...r.elementProps,
323
+ params$: c
324
+ } : r.elementProps;
325
+ return fe(e, {
326
+ ...r,
327
+ elementProps: m
136
328
  });
137
329
  });
138
330
  }), {
139
- [t]: o ? () => o : void 0,
140
- ...u
331
+ [s]: n ? () => n : void 0,
332
+ ...o
141
333
  };
142
- }, ne = (e, n) => {
143
- const o = v(e, n.elementType) || n.elementType;
144
- if (n.highConfig$)
145
- return Z(bt, {
146
- key: n.elementId,
334
+ }, fe = (e, t) => {
335
+ const n = S(e, t.elementType) || t.elementType;
336
+ if (t.highConfig$)
337
+ return de(mn, {
338
+ key: t.elementId,
147
339
  elementMap: e,
148
- elementConfig: n
340
+ elementConfig: t
149
341
  });
150
- const t = Xe(e, n), u = Ve(e, n);
151
- return Z(o, {
152
- key: n.elementId,
153
- ...u
154
- }, t);
155
- }, ht = (e) => U(e) ? tt(e) : fe(e) && e.indexOf(".") > 0 ? e.substring(0, e.indexOf(".")) : e, bt = L({
342
+ const s = ut(e, t), o = ct(e, t);
343
+ return de(n, {
344
+ key: t.elementId,
345
+ ...o
346
+ }, s);
347
+ }, dn = (e) => oe(e) ? Nt(e) : Ie(e) && e.indexOf(".") > 0 ? e.substring(0, e.indexOf(".")) : e, mn = N({
156
348
  props: {
157
349
  elementMap: {
158
350
  type: Object
@@ -163,43 +355,55 @@ const Et = () => ({
163
355
  },
164
356
  setup: (e) => {
165
357
  const {
166
- state: n,
167
- sendEvent: o
168
- } = ue(), {
169
- elementMap: t,
170
- elementConfig: u
171
- } = e, r = u.highConfig$, s = Ve(t, u), m = ee(r.registerEventList, (f, a) => ({
172
- ...f,
173
- [a.name]: (...c) => {
174
- o({
175
- type: a.sendEventName || u.elementId,
176
- payload: c
358
+ state: t,
359
+ sendEvent: n
360
+ } = ge(), {
361
+ elementMap: s,
362
+ elementConfig: o
363
+ } = e, a = o.highConfig$, r = ct(s, o), c = _(a.registerEventList, (d, u) => ({
364
+ ...d,
365
+ [u.name]: (...l) => {
366
+ n({
367
+ type: u.sendEventName || o.elementId,
368
+ payload: l
177
369
  });
178
370
  }
179
- }), {}), y = w(() => {
180
- if (!r.registerStateList || V(r.registerStateList) <= 0)
371
+ }), {}), m = w(() => {
372
+ if (!a.registerStateList || X(a.registerStateList) <= 0)
181
373
  return;
182
- const f = {
183
- ...s
184
- }, a = M(r.registerStateList, (c) => {
185
- const d = c.mapName || c.name, i = v(n, c.name);
186
- return _(f, d, i), ht(d);
374
+ const d = {
375
+ ...r
376
+ }, u = K(a.registerStateList, (l) => {
377
+ const p = l.mapName || l.name, i = S(t, l.name);
378
+ return ce(d, p, i), dn(p);
187
379
  });
188
- return K(f, a);
189
- }), E = v(t, u.elementType) || u.elementType, l = Xe(t, u);
190
- return () => v(y.value, "show$") === !1 ? null : Z(E, {
191
- key: u.elementId,
192
- ...s,
193
- ...C(y.value, "show$"),
194
- ...m
195
- }, l);
380
+ return q(d, u);
381
+ }), f = S(s, o.elementType) || o.elementType, b = ut(s, o);
382
+ return () => S(m.value, "show$") === !1 ? null : de(f, {
383
+ key: o.elementId,
384
+ ...r,
385
+ ...C(m.value, "show$"),
386
+ ...c
387
+ }, b);
196
388
  }
197
- }), ze = Symbol("pro-module"), ue = () => J(ze), Pt = (e) => {
198
- Q(ze, e);
199
- }, re = {
389
+ }), lt = Symbol("pro-module"), ge = () => Z(lt), fn = (e) => {
390
+ se(lt, e);
391
+ }, xe = (e) => {
392
+ const {
393
+ subject$: t
394
+ } = ge();
395
+ J(() => {
396
+ const n = t.subscribe({
397
+ next: (s) => {
398
+ e(s);
399
+ }
400
+ });
401
+ return () => n.unsubscribe();
402
+ }, []);
403
+ }, pe = {
200
404
  Success: "request-success$",
201
405
  Fail: "request-fail$"
202
- }, vt = () => ({
406
+ }, pn = () => ({
203
407
  state: {
204
408
  type: Object
205
409
  },
@@ -212,753 +416,971 @@ const Et = () => ({
212
416
  requests: {
213
417
  type: Array
214
418
  }
215
- }), ye = L({
419
+ }), Oe = N({
216
420
  props: {
217
- ...vt()
421
+ ...pn()
218
422
  },
219
423
  setup: (e, {
220
- slots: n,
221
- expose: o
424
+ slots: t,
425
+ expose: n
222
426
  }) => {
223
- const t = (a) => U(a) ? Te(e.elementMap, a) : ne(e.elementMap, a), u = new it(), r = (a) => {
224
- u.next(a);
225
- }, s = e.state || B({}), m = (a) => {
226
- const c = s[a.type], d = H(a.payload) ? a.payload(c) : a.payload;
227
- if (Fe(c)) {
228
- lt(s[a.type], d);
427
+ const s = (u) => oe(u) ? $e(e.elementMap, u) : fe(e.elementMap, u), o = new qt(), a = (u) => {
428
+ o.next(u);
429
+ }, r = e.state || W({}), c = (u) => {
430
+ const l = r[u.type], p = k(u.payload) ? u.payload(l) : u.payload;
431
+ if (ve(l)) {
432
+ Ye(r[u.type], p);
229
433
  return;
230
434
  }
231
- s[a.type] = d;
435
+ r[u.type] = p;
232
436
  }, {
233
- dispatchRequest: y
234
- } = ge(), E = ee(e.requests, (a, c) => {
235
- var d;
437
+ dispatchRequest: m
438
+ } = he(), f = _(e.requests, (u, l) => {
439
+ var p;
236
440
  return {
237
- ...a,
238
- [(d = c.actor) == null ? void 0 : d.name]: c
441
+ ...u,
442
+ [(p = l.actor) == null ? void 0 : p.name]: l
239
443
  };
240
- }, {}), l = ee(e.requests, (a, c) => ({
241
- ...a,
242
- [c.action]: c
243
- }), {}), f = (a, ...c) => {
244
- const d = v(E, a) || v(l, a);
245
- if (!d)
444
+ }, {}), b = _(e.requests, (u, l) => ({
445
+ ...u,
446
+ [l.action]: l
447
+ }), {}), d = (u, ...l) => {
448
+ const p = S(f, u) || S(b, u);
449
+ if (!p)
246
450
  return;
247
451
  let i;
248
- d.convertParams ? i = d.convertParams(...c) : i = v(c, 0), d.loadingName && m({
249
- type: d.loadingName,
452
+ p.convertParams ? i = p.convertParams(...l) : i = S(l, 0), p.loadingName && c({
453
+ type: p.loadingName,
250
454
  payload: !0
251
- }), y(d.actor, i);
455
+ }), m(p.actor, i);
252
456
  };
253
- return St(k(E), {
254
- onSuccess: (a) => {
255
- var d, i;
256
- const c = v(E, a.name);
257
- if (c != null && c.stateName) {
258
- const h = c.convertData ? c.convertData(a) : (d = a.res) == null ? void 0 : d.data;
259
- m({
260
- type: c.stateName,
261
- payload: h
457
+ return cn(F(f), {
458
+ onSuccess: (u) => {
459
+ var p, i;
460
+ const l = S(f, u.name);
461
+ if (l != null && l.stateName) {
462
+ const g = l.convertData ? l.convertData(u) : (p = u.res) == null ? void 0 : p.data;
463
+ c({
464
+ type: l.stateName,
465
+ payload: g
262
466
  });
263
467
  }
264
- r({
265
- type: re.Success,
468
+ a({
469
+ type: pe.Success,
266
470
  payload: {
267
- actor: a,
268
- requestOpts: c
471
+ actor: u,
472
+ requestOpts: l
269
473
  }
270
- }), (i = c.onSuccess) == null || i.call(c, a);
474
+ }), (i = l.onSuccess) == null || i.call(l, u);
271
475
  },
272
- onFailed: (a) => {
273
- var d;
274
- const c = v(E, a.name);
275
- r({
276
- type: re.Fail,
476
+ onFailed: (u) => {
477
+ var p;
478
+ const l = S(f, u.name);
479
+ a({
480
+ type: pe.Fail,
277
481
  payload: {
278
- actor: a,
279
- requestOpts: c
482
+ actor: u,
483
+ requestOpts: l
280
484
  }
281
- }), (d = c.onFailed) == null || d.call(c, a);
485
+ }), (p = l.onFailed) == null || p.call(l, u);
282
486
  },
283
- onFinish: (a) => {
284
- const c = v(E, [a.name, "loadingName"]);
285
- c && m({
286
- type: c,
487
+ onFinish: (u) => {
488
+ const l = S(f, [u.name, "loadingName"]);
489
+ l && c({
490
+ type: l,
287
491
  payload: !1
288
492
  });
289
493
  }
290
- }, !0), Pt({
494
+ }, !0), fn({
291
495
  elementMap: e.elementMap,
292
- subject$: u,
293
- sendEvent: r,
294
- state: s,
295
- dispatch: m,
496
+ subject$: o,
497
+ sendEvent: a,
498
+ state: r,
499
+ dispatch: c,
296
500
  requests: e.requests,
297
- sendRequest: f
298
- }), o({
299
- sendEvent: r,
300
- sendRequest: f
501
+ sendRequest: d
502
+ }), n({
503
+ sendEvent: a,
504
+ sendRequest: d
301
505
  }), () => {
302
- var a;
303
- return b(oe, null, [V(e.elementConfigs) > 0 && t(e.elementConfigs), (a = n.default) == null ? void 0 : a.call(n)]);
506
+ var u;
507
+ return y(H, null, [X(e.elementConfigs) > 0 && s(e.elementConfigs), (u = t.default) == null ? void 0 : u.call(t)]);
304
508
  };
305
509
  }
306
- }), De = (e) => {
307
- const { subject$: n } = ue();
308
- ce(() => {
309
- const o = n.subscribe({
310
- next: (t) => {
311
- e(t);
312
- }
313
- });
314
- return () => o.unsubscribe();
315
- }, []);
316
- }, gt = () => ({
317
- elementMap: { type: Object },
318
- formElementMap: { type: Object },
319
- columns: { type: Array },
320
- columnState: { type: Object }
321
- }), Ce = gt(), Tt = () => ({
322
- config: { type: Object, default: {} }
323
- }), Ie = Symbol("pro-config"), Le = () => J(Ie) || {}, zt = L({
510
+ }), tr = () => {
511
+ const e = rt(), { registerStoreMap: t } = ee();
512
+ return (n, s) => {
513
+ const o = S(t, n);
514
+ !o || e(n, s, !!o.persist, o.initialState);
515
+ };
516
+ }, nr = (e) => {
517
+ const { registerStoreMap: t } = ee(), n = S(t, e), s = `${n != null && n.persist ? "$" : ""}${n == null ? void 0 : n.key}`;
518
+ return tn(rn((a) => {
519
+ const r = S(a, s);
520
+ return r || (k(n == null ? void 0 : n.initialState) ? n == null ? void 0 : n.initialState() : n == null ? void 0 : n.initialState);
521
+ }));
522
+ }, it = sn("access", void 0, !0), yn = () => {
523
+ const [e] = it();
524
+ return e;
525
+ }, rr = () => {
526
+ const [e, t] = it();
527
+ return [e, t, () => {
528
+ t(void 0);
529
+ }];
530
+ }, ar = N((e, { slots: t, emit: n }) => {
531
+ const s = yn(), o = w(() => s && s.token);
532
+ return J(() => {
533
+ o.value || n("toLogin");
534
+ }, o), () => {
535
+ var a;
536
+ return o.value ? (a = t.default) == null ? void 0 : a.call(t) : null;
537
+ };
538
+ }), dt = Symbol("logon-user"), or = () => Z(dt), sr = N((e, { slots: t }) => {
539
+ const [n, s] = we(), [o, a] = we();
540
+ return se(dt, { user: n, setUser: s, per: o, setPer: a, opts: {} }), () => {
541
+ var c;
542
+ return (c = t.default) == null ? void 0 : c.call(t);
543
+ };
544
+ }), x = {
545
+ LoadingKey: "Loading$",
546
+ RowKey: "Row$",
547
+ ColKey: "Col$",
548
+ ButtonKey: "Button$",
549
+ DescriptionsKey: "ProDescriptions$",
550
+ DescriptionsItemKey: "ProDescriptionsItem$",
551
+ PaginationKey: "Pagination$",
552
+ PopoverKey: "Popover$",
553
+ CheckboxKey: "Checkbox$",
554
+ ModalKey: "Modal$",
555
+ FormKey: "Form$",
556
+ FormItemKey: "FormItem$",
557
+ TableKey: "Table$",
558
+ ProFormKey: "ProForm$",
559
+ ProSearchFormKey: "ProSearchForm$",
560
+ ProTableKey: "ProTable$"
561
+ }, Q = () => {
562
+ const { elementMap: e } = ee();
563
+ return (t) => S(e, t);
564
+ };
565
+ function hn(e) {
566
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Se(e);
567
+ }
568
+ const gn = () => ({
569
+ row: {
570
+ type: Object,
571
+ default: void 0
572
+ },
573
+ col: {
574
+ type: Object
575
+ },
576
+ items: {
577
+ type: Array
578
+ }
579
+ }), Le = N({
324
580
  props: {
325
- ...Tt()
581
+ ...gn()
326
582
  },
327
- setup: (e, { slots: n }) => (Q(Ie, e.config), () => {
328
- var o;
329
- return (o = n.default) == null ? void 0 : o.call(n);
330
- })
331
- }), Gt = (e = {}) => (n) => {
332
- n.provide(Ie, e);
333
- }, Ge = Symbol("pro-curd"), se = () => J(Ge), Dt = (e) => Q(Ge, e);
334
- var T = /* @__PURE__ */ ((e) => (e.LIST = "LIST", e.DETAIL = "DETAIL", e.ADD = "ADD", e.EDIT = "EDIT", e.DELETE = "DELETE", e))(T || {}), D = /* @__PURE__ */ ((e) => (e.EMIT = "EMIT", e.EXECUTE = "EXECUTE", e.PAGE = "PAGE", e.SUCCESS = "SUCCESS", e.FAIL = "FAIL", e))(D || {}), q = /* @__PURE__ */ ((e) => (e.ADD = "ADD", e.EDIT = "EDIT", e.DETAIL = "DETAIL", e))(q || {}), ae = /* @__PURE__ */ ((e) => (e.NORMAL = "NORMAL", e.CONTINUE = "CONTINUE", e))(ae || {});
335
- const Ct = (e, n, o) => {
336
- if (n) {
337
- const t = G(k(n), (u) => !n[u]);
338
- return C(e, t);
583
+ setup: (e) => {
584
+ const t = Q(), n = t(x.RowKey), s = t(x.ColKey);
585
+ return () => {
586
+ let o;
587
+ return !n || !s ? null : y(n, e.row, hn(o = K(e.items, (a) => y(s, O({
588
+ key: a.rowKey
589
+ }, e.col, a.col), {
590
+ default: () => [a.vNode]
591
+ }))) ? o : {
592
+ default: () => [o]
593
+ });
594
+ };
595
+ }
596
+ }), bn = (e, t, n) => {
597
+ if (t) {
598
+ const s = U(F(t), (o) => !t[o]);
599
+ return C(e, s);
339
600
  }
340
- if (o) {
341
- const t = G(k(o), (u) => !o[u](e));
342
- return C(e, t);
601
+ if (n) {
602
+ const s = U(F(n), (o) => !n[o](e));
603
+ return C(e, s);
343
604
  }
344
605
  return e;
345
- }, We = (e) => {
606
+ }, mt = (e) => {
346
607
  if (!!e)
347
- return U(e) ? e : e && fe(e) && e.indexOf(".") > 0 ? nt(e, ".") : [e];
348
- }, Ae = (e, n, o) => !n || !o ? e : M(e, (t) => {
349
- const u = H(o) ? o(t) : o, r = v(n, u);
350
- return !r || rt(r) || H(r) || !Fe(r) ? t : xe(t, r, (s, m) => {
351
- if (U(s) || U(m))
352
- return m;
608
+ return oe(e) ? e : e && Ie(e) && e.indexOf(".") > 0 ? Ot(e, ".") : [e];
609
+ }, Ne = (e, t, n) => !t || !n ? e : K(e, (s) => {
610
+ const o = k(n) ? n(s) : S(s, n), a = S(t, o);
611
+ return !a || Lt(a) || k(a) || !ve(a) ? s : At(s, a, (r, c) => {
612
+ if (oe(r) || oe(c))
613
+ return c;
353
614
  });
354
- }), Y = (e, n) => {
355
- const o = ee(
615
+ }), ie = (e, t) => {
616
+ const n = _(
356
617
  e,
357
- (t, u) => ({
358
- ...t,
359
- [u]: (...r) => {
360
- var s, m;
361
- return (m = (s = n.value) == null ? void 0 : s[u]) == null ? void 0 : m.call(s, ...r);
618
+ (s, o) => ({
619
+ ...s,
620
+ [o]: (...a) => {
621
+ var r, c;
622
+ return (c = (r = t.value) == null ? void 0 : r[o]) == null ? void 0 : c.call(r, ...a);
362
623
  }
363
624
  }),
364
625
  {}
365
626
  );
366
- return o.originRef = n, o;
367
- }, Wt = (e, n, o) => {
368
- const t = { originRef: e, ...o };
369
- return n && V(n) > 0 && z(n, (u) => {
370
- t[u] = (...r) => {
371
- var s, m;
372
- return (m = (s = e.value) == null ? void 0 : s[u]) == null ? void 0 : m.call(s, ...r);
627
+ return n.originRef = t, n;
628
+ }, cr = (e, t, n) => {
629
+ const s = { originRef: e, ...n };
630
+ return t && X(t) > 0 && te(t, (o) => {
631
+ s[o] = (...a) => {
632
+ var r, c;
633
+ return (c = (r = e.value) == null ? void 0 : r[o]) == null ? void 0 : c.call(r, ...a);
373
634
  };
374
- }), t;
375
- }, It = {
376
- page: 1,
377
- pageSize: 10
378
- }, Lt = () => ({
635
+ }), s;
636
+ }, ft = (e, t) => S(e, ["extra", t]) || S(e, t), re = (e, t) => {
637
+ const n = F(e), s = `${t}-`, o = U(n, (r) => Rt(r, s)), a = q(e, o);
638
+ return Kt(a, (r, c) => c.replace(s, ""));
639
+ }, pt = Symbol("pro-form-list"), yt = () => Z(pt), ht = (e) => {
640
+ se(pt, e);
641
+ }, Sn = N({
642
+ props: {
643
+ pathList: {
644
+ type: Array
645
+ }
646
+ },
647
+ setup: (e, {
648
+ slots: t
649
+ }) => (ht({
650
+ pathList: e.pathList
651
+ }), () => {
652
+ var n;
653
+ return (n = t.default) == null ? void 0 : n.call(t);
654
+ })
655
+ }), vn = () => ({
379
656
  rowKey: {
380
657
  type: String,
381
658
  default: "id"
382
659
  },
383
- operates: {
384
- type: Array
660
+ name: {
661
+ type: [String, Number, Array],
662
+ required: !0
663
+ }
664
+ }), ur = N({
665
+ props: {
666
+ ...vn()
385
667
  },
386
- listProps: {
668
+ setup: (e, {
669
+ slots: t
670
+ }) => {
671
+ const s = Q()(x.FormItemKey), {
672
+ formState: o,
673
+ readonly: a
674
+ } = bt(), r = yt(), c = mt(e.name), m = r != null && r.pathList ? [...r.pathList, ...c] : c, f = () => {
675
+ let d = S(o, m);
676
+ oe(d) || (d = []), d.push({
677
+ [e.rowKey]: new Date().valueOf()
678
+ }), ce(o, m, d);
679
+ }, b = (d) => {
680
+ const u = S(o, m);
681
+ X(u) <= 0 || u.splice(d, 1);
682
+ };
683
+ return () => s ? y(s, C(e, "rowKey"), {
684
+ default: () => {
685
+ var d;
686
+ return [K(S(o, m), (u, l) => y(Sn, {
687
+ key: u[e.rowKey] || l,
688
+ pathList: [...m, l]
689
+ }, {
690
+ default: () => {
691
+ var p, i, g;
692
+ return [y("div", {
693
+ class: "pro-form-list-item"
694
+ }, [(p = t.default) == null ? void 0 : p.call(t), !a.value && y(H, null, [y("div", {
695
+ class: "pro-form-list-item-add",
696
+ onClick: f
697
+ }, [(i = t.itemAdd) == null ? void 0 : i.call(t)]), y("div", {
698
+ class: "pro-form-list-item-minus",
699
+ onClick: () => b(l)
700
+ }, [(g = t.itemMinus) == null ? void 0 : g.call(t)])])])];
701
+ }
702
+ })), !a.value && y("div", {
703
+ class: "pro-form-list-add",
704
+ onClick: f
705
+ }, [(d = t.add) == null ? void 0 : d.call(t)])];
706
+ }
707
+ }) : null;
708
+ }
709
+ }), gt = Symbol("pro-form"), bt = () => Z(gt), Pn = (e) => {
710
+ se(gt, e);
711
+ };
712
+ let V;
713
+ (function(e) {
714
+ e.RESET = "RESET", e.SUBMIT = "SUBMIT", e.CONTINUE = "CONTINUE";
715
+ })(V || (V = {}));
716
+ const Be = () => ({
717
+ clsName: {
718
+ type: String,
719
+ default: "pro-form"
720
+ },
721
+ model: {
387
722
  type: Object
388
723
  },
389
- formProps: {
724
+ readonly: {
725
+ type: Boolean,
726
+ default: void 0
727
+ },
728
+ showState: {
390
729
  type: Object
391
730
  },
392
- descProps: {
731
+ showStateRules: {
393
732
  type: Object
394
733
  },
395
- modalProps: {
734
+ readonlyState: {
735
+ type: Object
736
+ },
737
+ readonlyStateRules: {
738
+ type: Object
739
+ },
740
+ disableState: {
741
+ type: Object
742
+ },
743
+ disableStateRules: {
744
+ type: Object
745
+ },
746
+ needRules: {
747
+ type: Boolean,
748
+ default: !0
749
+ },
750
+ provideExtra: {
751
+ type: Object
752
+ },
753
+ operate: {
396
754
  type: Object
755
+ },
756
+ submitLoading: {
757
+ type: Boolean
758
+ },
759
+ formMethods: {
760
+ type: Array
397
761
  }
398
- }), _e = ["sendCurdEvent", "refreshList", "sendEvent", "sendRequest"], Me = L({
762
+ }), En = N({
763
+ inheritAttrs: !1,
399
764
  props: {
400
- ...Ce,
401
- ...Lt()
765
+ ...me,
766
+ ...Be(),
767
+ ...C(Le.props, "items")
402
768
  },
403
769
  setup: (e, {
404
- slots: n,
405
- expose: o
770
+ slots: t,
771
+ emit: n,
772
+ expose: s,
773
+ attrs: o
406
774
  }) => {
407
775
  const {
408
- elementMap: t,
409
- state: u,
410
- sendEvent: r,
411
- sendRequest: s
412
- } = ue(), m = w(() => Ae(e.columns, e.columnState, (g) => te(g))), y = (g, O = !0) => Pe(e.formElementMap, g, O), E = (g, O) => $e(t, g, O), l = (g, O) => {
413
- const W = G(m.value, (j) => {
414
- const x = v(j, ["extra", g]) || v(j, g);
415
- return O ? x !== !1 : x;
776
+ elementMap: a,
777
+ formElementMap: r
778
+ } = ee(), c = e.elementMap || a, m = e.formElementMap || r, f = e.model || W({}), b = e.showState || W({}), d = e.readonlyState || W({}), u = e.disableState || W({});
779
+ J(() => {
780
+ e.showStateRules && te(e.showStateRules, (v, h) => {
781
+ b[h] = v(f);
782
+ }), e.readonlyStateRules && te(e.readonlyStateRules, (v, h) => {
783
+ d[h] = v(f);
784
+ }), e.disableStateRules && te(e.disableStateRules, (v, h) => {
785
+ u[h] = v(f);
416
786
  });
417
- return ke(W, (j) => v(j, ["extra", `${g}Sort`]) || v(j, `${g}Sort`));
418
- }, f = w(() => l("form", !0)), a = w(() => l("detail", !0)), c = w(() => l("table", !0)), d = w(() => l("search"));
419
- let i;
420
- const h = (g) => {
421
- s(T.LIST, {
422
- ...i,
423
- ...g
424
- });
425
- }, p = (g) => {
426
- r({
427
- type: g.action,
428
- payload: C(g, "action", "source"),
429
- source: g.source
430
- });
431
- };
432
- De(({
433
- type: g,
434
- payload: O,
435
- source: W
436
- }) => {
437
- if (W)
438
- return;
439
- let j = g, x = O == null ? void 0 : O.type;
440
- j === re.Success && (j = v(O, ["requestOpts", "action"]), x = D.SUCCESS);
441
- const {
442
- values: X,
443
- record: de
444
- } = O;
445
- switch (j) {
446
- case T.LIST:
447
- x === D.EMIT && (i = X, h());
448
- return;
449
- case T.ADD:
450
- x === D.EXECUTE && s(T.ADD, X, u.detailData);
451
- return;
452
- case T.EDIT:
453
- x === D.EXECUTE && s(T.EDIT, X, u.detailData);
787
+ }, f);
788
+ const l = w(() => e.readonly), p = w(() => Ne(e.columns, e.columnState, (v) => ue(v))), i = (v) => {
789
+ const h = bn(v, b, e.showStateRules);
790
+ n("finish", h, v);
791
+ }, g = B();
792
+ s(ie(e.formMethods || [], g)), Pn({
793
+ formState: f,
794
+ showState: b,
795
+ readonlyState: d,
796
+ disableState: u,
797
+ elementMap: c,
798
+ formElementMap: m,
799
+ readonly: l,
800
+ columns: p,
801
+ formRef: g,
802
+ ...e.provideExtra
803
+ });
804
+ const M = [{
805
+ value: V.RESET,
806
+ label: "\u91CD\u7F6E"
807
+ }, {
808
+ value: V.SUBMIT,
809
+ label: "\u63D0\u4EA4",
810
+ extraProps: {
811
+ type: "primary"
812
+ }
813
+ }], I = w(() => {
814
+ const v = e.operate, h = (v == null ? void 0 : v.items) || M;
815
+ return K(h, (T) => (!T.onClick && !S(v == null ? void 0 : v.itemState, [T.value, "onClick"]) && (T.value === V.RESET ? T.onClick = () => {
816
+ var $;
817
+ if (v != null && v.onReset) {
818
+ v.onReset();
454
819
  return;
455
- case T.DELETE:
456
- x === D.EMIT ? s(T.DELETE, de, e.rowKey) : x === D.SUCCESS && h();
820
+ }
821
+ ($ = g.value) == null || $.resetFields();
822
+ } : T.value === V.SUBMIT ? T.onClick = () => {
823
+ var $;
824
+ if (v != null && v.onSubmit) {
825
+ v.onSubmit();
457
826
  return;
458
- }
459
- j && g === D.EXECUTE && s(j, X);
460
- });
461
- const S = ee(e.operates, (g, O) => ({
462
- ...g,
463
- [O.action]: O
464
- }), {}), P = (g) => v(S, g), N = w(() => e.listProps), F = w(() => e.formProps), I = w(() => e.descProps), A = w(() => e.modalProps);
465
- return Dt({
466
- columns: m,
467
- getSignColumns: l,
468
- getFormItemVNode: y,
469
- getItemVNode: E,
470
- elementMap: t,
471
- formElementMap: e.formElementMap,
472
- rowKey: e.rowKey,
473
- curdState: u,
474
- formColumns: f,
475
- descColumns: a,
476
- tableColumns: c,
477
- searchColumns: d,
478
- sendCurdEvent: p,
479
- operates: e.operates,
480
- getOperate: P,
481
- refreshList: h,
482
- listProps: N,
483
- formProps: F,
484
- descProps: I,
485
- modalProps: A
486
- }), o({
487
- sendCurdEvent: p,
488
- refreshList: h
489
- }), () => {
490
- var g;
491
- return (g = n.default) == null ? void 0 : g.call(n);
827
+ }
828
+ ($ = g.value) == null || $.submit();
829
+ } : T.value === V.CONTINUE && (v == null ? void 0 : v.onContinue) && (T.onClick = () => {
830
+ v.onContinue();
831
+ })), T.value === V.SUBMIT && !Je(T, "loading") && (T.loading = e.submitLoading), T));
832
+ }), P = (v) => {
833
+ const h = ue(v);
834
+ return h && t[h] ? t[h](v, f) : st(m, v, e.needRules);
492
835
  };
836
+ ht({});
837
+ const D = F(Be()), L = F(C(Le.props, "items")), R = S(a, x.FormKey);
838
+ return () => R ? y(R, O({
839
+ ref: g,
840
+ class: e.clsName
841
+ }, C(o, "onFinish"), C(e, ...D, ...L, "onFinish", "operate"), {
842
+ model: f,
843
+ onFinish: i
844
+ }), {
845
+ default: () => {
846
+ var v, h, T;
847
+ return [(v = t.start) == null ? void 0 : v.call(t), m && X(p.value) > 0 && y(H, null, [e.row ? y(Le, {
848
+ row: e.row,
849
+ col: e.col,
850
+ items: K(p.value, ($) => ({
851
+ rowKey: ue($),
852
+ vNode: P($),
853
+ col: S($, ["extra", "col"])
854
+ }))
855
+ }, null) : K(p.value, ($) => P($))]), (h = t.default) == null ? void 0 : h.call(t), e.operate && y(St, O({
856
+ clsName: "pro-form-operate",
857
+ items: I.value
858
+ }, C(e.operate, "items", "onReset", "onSubmit", "onContinue")), null), (T = t.end) == null ? void 0 : T.call(t)];
859
+ }
860
+ }) : null;
861
+ }
862
+ });
863
+ let Ce;
864
+ (function(e) {
865
+ e.AUTO = "AUTO", e.MANUAL = "MANUAL";
866
+ })(Ce || (Ce = {}));
867
+ const Ve = () => ({
868
+ initEmit: {
869
+ type: Boolean,
870
+ default: !0
871
+ },
872
+ searchMode: {
873
+ type: String,
874
+ default: Ce.AUTO
875
+ },
876
+ debounceKeys: {
877
+ type: Array
878
+ },
879
+ debounceTypes: {
880
+ type: Array,
881
+ default: ["text"]
882
+ },
883
+ debounceTime: {
884
+ type: Number,
885
+ default: 800
493
886
  }
494
- }), le = L({
887
+ }), lr = N({
495
888
  props: {
496
- ...C(ye.props, "state", "requests"),
497
- ...Me.props,
498
- curdState: {
499
- type: Object
889
+ ...Ve(),
890
+ needRules: {
891
+ type: Boolean,
892
+ default: !1
500
893
  }
501
894
  },
502
895
  setup: (e, {
503
- slots: n,
504
- expose: o
896
+ slots: t,
897
+ expose: n
505
898
  }) => {
506
- const {
507
- elementMap: t,
508
- formElementMap: u
509
- } = Le(), r = $(), s = $(), m = e.curdState || B({
510
- detailData: {}
511
- }), y = {
512
- [T.LIST]: {
513
- convertParams: (a) => a,
514
- convertData: (a) => {
515
- var c;
516
- return (c = a.res) == null ? void 0 : c.data;
517
- },
518
- loadingName: "listLoading",
519
- stateName: "listData"
520
- },
521
- [T.DETAIL]: {
522
- convertParams: (a, c) => K(a, c),
523
- convertData: (a) => {
524
- var c;
525
- return (c = a.res) == null ? void 0 : c.data;
526
- },
527
- loadingName: "detailLoading",
528
- stateName: "detailData",
529
- label: "\u8BE6\u60C5"
530
- },
531
- [T.ADD]: {
532
- convertParams: (a, c) => ({
533
- body: {
534
- ...c,
535
- ...a
536
- }
537
- }),
538
- loadingName: "operateLoading",
539
- label: "\u6DFB\u52A0"
540
- },
541
- [T.EDIT]: {
542
- convertParams: (a, c) => ({
543
- body: {
544
- ...c,
545
- ...a
546
- }
547
- }),
548
- loadingName: "operateLoading",
549
- label: "\u7F16\u8F91"
550
- },
551
- [T.DELETE]: {
552
- convertParams: (a, c) => K(a, c),
553
- label: "\u5220\u9664"
554
- }
555
- }, E = M(e.operates, (a) => ({
556
- ...v(y, a.action),
557
- ...a
558
- })), l = G(E, (a) => a.actor), f = k(C(ye.props, "state", "requests"));
559
- return o({
560
- sendCurdEvent: (a) => {
561
- var c;
562
- (c = s.value) == null || c.sendCurdEvent(a);
563
- },
564
- refreshList: (a) => {
565
- var c;
566
- (c = s.value) == null || c.refreshList(a);
567
- },
568
- sendEvent: (a) => {
569
- var c;
570
- (c = r.value) == null || c.sendEvent(a);
571
- },
572
- sendRequest: (a, ...c) => {
573
- var d;
574
- (d = r.value) == null || d.sendRequest(a, ...c);
899
+ const o = Q()(x.ProFormKey), a = e.model || W({}), r = new Set(e.debounceTypes), c = K(U(e.columns, (p) => {
900
+ const i = ot(p);
901
+ return r.has(i);
902
+ }), (p) => ue(p)), m = B(), f = e.formMethods || [];
903
+ n(ie(f, m));
904
+ const b = () => {
905
+ var p;
906
+ (p = m.value) == null || p.submit();
907
+ }, d = wt(() => {
908
+ b();
909
+ }, e.debounceTime);
910
+ J(() => {
911
+ e.initEmit && b();
912
+ }, []);
913
+ const u = (p, i, g) => le(g, (M) => S(p, M) !== S(i, M));
914
+ Ze((p, i) => {
915
+ if (e.searchMode !== Ce.AUTO)
916
+ return;
917
+ const g = X(e.debounceKeys) > 0 ? e.debounceKeys : c;
918
+ if (X(g) > 0 && u(p, i, g)) {
919
+ d();
920
+ return;
575
921
  }
576
- }), () => b(ye, R({
577
- ref: r
578
- }, K(e, f), {
579
- elementMap: e.elementMap || t,
580
- state: m,
581
- requests: l
582
- }), {
583
- default: () => [b(Me, R({
584
- ref: s
585
- }, C(e, ...f, "curdState", "operates"), {
586
- formElementMap: e.formElementMap || u,
587
- operates: E
588
- }), n)]
589
- });
922
+ b();
923
+ }, () => kt(a));
924
+ const l = F(C(Ve(), "columns"));
925
+ return () => o ? y(o, O({
926
+ ref: m
927
+ }, C(e, l), {
928
+ model: a
929
+ }), t) : null;
590
930
  }
591
- }), At = () => ({
592
- defaultAddRecord: {
931
+ }), _e = () => ({
932
+ readonly: {
933
+ type: Boolean,
934
+ default: void 0
935
+ },
936
+ fieldProps: {
937
+ type: Object
938
+ },
939
+ showProps: {
940
+ type: Object
941
+ },
942
+ slots: {
593
943
  type: Object
594
944
  }
595
- }), Ee = L({
945
+ }), ir = (e, t) => ({
946
+ InputComp: n,
947
+ valueType: s,
948
+ name: o
949
+ }) => N({
950
+ name: o,
596
951
  props: {
597
- ...At()
952
+ ...e.props,
953
+ ..._e()
598
954
  },
599
- setup: (e) => {
600
- var c;
955
+ setup: (a, {
956
+ slots: r
957
+ }) => {
601
958
  const {
602
- dispatch: n,
603
- sendRequest: o
604
- } = ue(), {
605
- rowKey: t,
606
- curdState: u,
607
- listProps: r,
608
- getOperate: s,
609
- refreshList: m
610
- } = se(), y = (c = r == null ? void 0 : r.value) == null ? void 0 : c.pageState, E = (d) => {
611
- const i = s(T.DETAIL);
612
- i != null && i.actor ? o(T.DETAIL, d, t) : n({
613
- type: "detailData",
614
- payload: at(d)
959
+ formState: c,
960
+ showState: m,
961
+ readonlyState: f,
962
+ disableState: b,
963
+ readonly: d,
964
+ elementMap: u
965
+ } = bt(), l = yt(), p = w(() => ne(a.readonly) ? a.readonly : ne(f[a.name]) ? f[a.name] : d.value), i = mt(a.name), g = l != null && l.pathList ? [...l.pathList, ...i] : i, M = (P) => {
966
+ ce(c, g, P);
967
+ }, I = F(_e());
968
+ return () => {
969
+ const P = S(m, g);
970
+ if (ne(P) && !P)
971
+ return null;
972
+ const D = S(c, g), L = S(u, s);
973
+ return y(e, O(C(a, ...I, "name", "slots"), {
974
+ name: g
975
+ }), {
976
+ default: () => [p.value ? y(H, null, [L ? y(L, O({
977
+ value: D
978
+ }, a.fieldProps, {
979
+ showProps: a.showProps
980
+ }), r) : y("span", null, [D])]) : y(n, O(t(D, M, S(b, g)), a.fieldProps), r)],
981
+ ...a.slots
615
982
  });
616
- }, l = (d, {
617
- record: i
618
- }) => {
619
- d === D.EMIT && (n({
620
- type: "mode",
621
- payload: q.DETAIL
622
- }), E(i));
623
- }, f = (d) => {
624
- d === D.EMIT ? (n({
625
- type: "mode",
626
- payload: q.ADD
627
- }), n({
628
- type: "detailData",
629
- payload: e.defaultAddRecord || {}
630
- })) : d === D.SUCCESS && (y && (y.page = 1), m(), u.addAction === ae.CONTINUE ? n({
631
- type: "detailData",
632
- payload: e.defaultAddRecord || {}
633
- }) : n({
634
- type: "mode",
635
- payload: void 0
636
- }));
637
- }, a = (d, {
638
- record: i
639
- }) => {
640
- d === D.EMIT ? (n({
641
- type: "mode",
642
- payload: q.EDIT
643
- }), E(i)) : d === D.SUCCESS && (n({
644
- type: "mode",
645
- payload: void 0
646
- }), m());
647
983
  };
648
- return De(({
649
- type: d,
650
- payload: i,
651
- source: h
652
- }) => {
653
- if (h)
654
- return;
655
- let p = d, S = i == null ? void 0 : i.type;
656
- const P = i == null ? void 0 : i.record;
657
- switch (p === re.Success && (p = v(i, ["requestOpts", "action"]), S = D.SUCCESS), p) {
658
- case T.DETAIL:
659
- l(S, {
660
- record: P
661
- });
662
- break;
663
- case T.ADD:
664
- f(S);
665
- break;
666
- case T.EDIT:
667
- a(S, {
668
- record: P
669
- });
670
- break;
671
- }
672
- }), () => null;
673
984
  }
674
- }), _t = L({
675
- props: {
676
- ...le.props,
677
- ...Ee.props
985
+ });
986
+ function Cn(e) {
987
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Se(e);
988
+ }
989
+ const Tn = () => ({
990
+ clsName: {
991
+ type: String,
992
+ default: "pro-operate"
678
993
  },
679
- setup: (e, {
680
- slots: n,
681
- expose: o
682
- }) => {
683
- const t = $();
684
- o(Y(_e, t));
685
- const u = k(Ee.props);
686
- return () => b(le, R({
687
- ref: t
688
- }, C(e, u)), {
689
- default: () => {
690
- var r;
691
- return [b(Ee, K(e, u), null), (r = n.default) == null ? void 0 : r.call(n)];
692
- }
693
- });
694
- }
695
- }), Ot = () => ({
696
- defaultAddRecord: {
697
- type: Object
994
+ items: {
995
+ type: Array
698
996
  },
699
- routeBack: {
700
- type: Function
701
- }
702
- }), Se = L({
703
- props: {
704
- ...Ot()
997
+ itemState: {
998
+ type: Object
705
999
  },
706
- setup: (e) => {
707
- const n = ft(), o = pt(), {
708
- dispatch: t,
709
- sendRequest: u
710
- } = ue(), {
711
- rowKey: r,
712
- curdState: s
713
- } = se(), m = (f) => {
714
- f === D.PAGE && (t({
715
- type: "mode",
716
- payload: void 0
717
- }), t({
718
- type: "detailData",
719
- payload: {}
720
- }), t({
721
- type: "detailLoading",
722
- payload: !1
723
- }), t({
724
- type: "addAction",
725
- payload: void 0
726
- }));
727
- }, y = (f, {
728
- record: a
729
- }) => {
730
- f === D.EMIT ? n.push({
731
- path: `${o.path}/detail`,
732
- query: K(a, r)
733
- }) : f === D.PAGE && (t({
734
- type: "mode",
735
- payload: q.DETAIL
736
- }), u(T.DETAIL, o.query, r));
737
- }, E = (f) => {
738
- f === D.EMIT ? n.push({
739
- path: `${o.path}/add`
740
- }) : f === D.PAGE ? (t({
741
- type: "mode",
742
- payload: q.ADD
743
- }), t({
744
- type: "detailData",
745
- payload: e.defaultAddRecord || {}
746
- })) : f === D.SUCCESS && (s.addAction === ae.CONTINUE ? t({
747
- type: "detailData",
748
- payload: e.defaultAddRecord || {}
749
- }) : e.routeBack ? e.routeBack(T.ADD) : n.go(-1));
750
- }, l = (f, {
751
- record: a
752
- }) => {
753
- f === D.EMIT ? n.push({
754
- path: `${o.path}/edit`,
755
- query: K(a, r)
756
- }) : f === D.PAGE ? (t({
757
- type: "mode",
758
- payload: q.EDIT
759
- }), u(T.DETAIL, o.query, r)) : f === D.SUCCESS && (e.routeBack ? e.routeBack(T.EDIT) : n.go(-1));
760
- };
761
- return De(({
762
- type: f,
763
- payload: a,
764
- source: c
765
- }) => {
766
- if (c)
767
- return;
768
- let d = f, i = a == null ? void 0 : a.type;
769
- const h = a == null ? void 0 : a.record;
770
- switch (d === re.Success && (d = v(a, ["requestOpts", "action"]), i = D.SUCCESS), d) {
771
- case T.LIST:
772
- m(i);
773
- break;
774
- case T.DETAIL:
775
- y(i, {
776
- record: h
777
- });
778
- break;
779
- case T.ADD:
780
- E(i);
781
- break;
782
- case T.EDIT:
783
- l(i, {
784
- record: h
785
- });
786
- break;
787
- }
788
- }), () => null;
1000
+ elementKey: {
1001
+ type: String,
1002
+ default: x.ButtonKey
789
1003
  }
790
- }), Ht = L({
1004
+ }), St = N({
791
1005
  props: {
792
- ...le.props,
793
- ...Se.props
1006
+ ...Tn()
794
1007
  },
795
1008
  setup: (e, {
796
- slots: n,
797
- expose: o
1009
+ slots: t
798
1010
  }) => {
799
- const t = $();
800
- o(Y(_e, t));
801
- const u = k(Se.props);
802
- return () => b(le, R({
803
- ref: t
804
- }, C(e, u)), {
805
- default: () => {
806
- var r;
807
- return [b(Se, K(e, u), null), (r = n.default) == null ? void 0 : r.call(n)];
808
- }
809
- });
1011
+ const n = Q(), s = e.elementKey ? n(e.elementKey) : void 0, o = w(() => {
1012
+ const r = U(e.items, (c) => k(c.show) ? c.show() : ne(c.show) ? c.show : !0);
1013
+ return K(r, (c) => Je(e.itemState, c.value) ? {
1014
+ ...c,
1015
+ ...S(e.itemState, c.value)
1016
+ } : c);
1017
+ }), a = (r) => {
1018
+ var c;
1019
+ (c = r.onClick) == null || c.call(r, r.value);
1020
+ };
1021
+ return () => y("div", {
1022
+ class: e.clsName
1023
+ }, [K(o.value, (r) => {
1024
+ const c = k(r.disabled) ? r.disabled() : r.disabled, m = k(r.loading) ? r.loading() : r.loading, f = k(r.label) ? r.label() : r.label, b = k(r.extraProps) ? r.extraProps() : r.extraProps, d = {
1025
+ ...C(r, "show", "disabled", "element"),
1026
+ disabled: c
1027
+ };
1028
+ return r.element && k(r.element) ? r.element(d) : t[r.value] ? t[r.value](d) : s ? y(s, O({
1029
+ disabled: c,
1030
+ loading: m,
1031
+ onClick: () => a(r)
1032
+ }, b), Cn(f) ? f : {
1033
+ default: () => [f]
1034
+ }) : y("div", {
1035
+ class: `${e.clsName}-item`,
1036
+ onClick: () => a(r)
1037
+ }, [f]);
1038
+ })]);
810
1039
  }
811
- });
812
- function Mt(e) {
813
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !ie(e);
814
- }
815
- const Jt = (e, n) => L({
1040
+ }), In = () => ({
1041
+ clsName: {
1042
+ type: String,
1043
+ default: "pro-table-toolbar-column"
1044
+ },
1045
+ signName: {
1046
+ type: String,
1047
+ default: "columnSetting"
1048
+ },
1049
+ popoverProps: Object
1050
+ }), Dn = N({
816
1051
  props: {
817
- ...e.props,
818
- renderItem: {
819
- type: Function
820
- },
821
- signName: {
822
- type: String
823
- }
1052
+ ...In()
824
1053
  },
825
- setup: (o, {
1054
+ setup: (e, {
826
1055
  slots: t
827
1056
  }) => {
828
- const {
829
- getItemVNode: u,
830
- curdState: r,
831
- descColumns: s,
832
- getSignColumns: m
833
- } = se(), y = w(() => {
834
- const E = o.signName ? m(o.signName) : s.value;
835
- return M(E, (l) => {
836
- var d;
837
- let f;
838
- const a = (d = o.renderItem) == null ? void 0 : d.call(o, l);
839
- if (a)
840
- return a;
841
- const c = v(r.detailData, l.dataIndex);
842
- return b(n, R({
843
- key: l.dataIndex,
844
- label: l.title
845
- }, v(l.extra, "desc")), Mt(f = u(l, c)) ? f : {
846
- default: () => [f]
847
- });
1057
+ const n = Q(), s = n(x.PopoverKey), o = n(x.CheckboxKey), {
1058
+ originColumns: a,
1059
+ state: r
1060
+ } = Mn(), [c, m] = Ut();
1061
+ Ze(() => {
1062
+ m();
1063
+ }, () => r.selectIds);
1064
+ const f = w(() => _(r.selectIds, (i, g) => ({
1065
+ ...i,
1066
+ [g]: !0
1067
+ }), {})), b = (i) => ft(i, e.signName), d = w(() => {
1068
+ const i = Ft(a.value, (M) => {
1069
+ const I = b(M);
1070
+ return I != null && I.disabled ? !0 : S(f.value, M.dataIndex);
1071
+ }), g = le(a.value, (M) => {
1072
+ const I = b(M);
1073
+ return I != null && I.disabled ? !0 : S(f.value, M.dataIndex);
848
1074
  });
849
- });
850
- return () => b(e, o, {
1075
+ return {
1076
+ checked: i,
1077
+ indeterminate: i ? !1 : g
1078
+ };
1079
+ }), u = (i) => {
1080
+ var M;
1081
+ (ve(i) ? (M = i.target) == null ? void 0 : M.checked : i) ? r.selectIds = K(a.value, (I) => I.dataIndex) : r.selectIds = K(U(a.value, (I) => {
1082
+ var P;
1083
+ return !!((P = b(I)) != null && P.disabled);
1084
+ }), (I) => I.dataIndex);
1085
+ }, l = () => {
1086
+ r.selectIds = K(U(a.value, (i) => {
1087
+ var g;
1088
+ return ((g = b(i)) == null ? void 0 : g.initShow) !== !1;
1089
+ }), (i) => i.dataIndex);
1090
+ }, p = (i, g) => {
1091
+ var I;
1092
+ (ve(g) ? (I = g.target) == null ? void 0 : I.checked : g) ? r.selectIds = [...r.selectIds, i.dataIndex] : r.selectIds = U(r.selectIds, (P) => i.dataIndex !== P);
1093
+ };
1094
+ return () => s ? y(s, O({
1095
+ trigger: "click"
1096
+ }, e.popoverProps), {
851
1097
  default: () => {
852
- var E, l;
853
- return [(E = t.start) == null ? void 0 : E.call(t), y.value, (l = t.default) == null ? void 0 : l.call(t)];
1098
+ var i;
1099
+ return [((i = t.default) == null ? void 0 : i.call(t)) || "\u5217\u8BBE\u7F6E"];
854
1100
  },
855
- ...C(t, "default", "start")
856
- });
1101
+ content: () => y("div", {
1102
+ class: `${e.clsName}`
1103
+ }, [y("div", {
1104
+ class: `${e.clsName}-header`
1105
+ }, [y(o, {
1106
+ checked: d.value.checked,
1107
+ indeterminate: d.value.indeterminate,
1108
+ onChange: u
1109
+ }, {
1110
+ default: () => [qe("\u5217\u5C55\u793A")]
1111
+ }), y("a", {
1112
+ onClick: l
1113
+ }, [qe("\u91CD\u7F6E")])]), y("div", {
1114
+ key: c.value,
1115
+ class: `${e.clsName}-list`
1116
+ }, [K(a.value, (i) => {
1117
+ const g = b(i);
1118
+ return y(o, {
1119
+ checked: S(f.value, i.dataIndex, !1),
1120
+ disabled: g == null ? void 0 : g.disabled,
1121
+ onChange: (M) => {
1122
+ p(i, M);
1123
+ }
1124
+ }, {
1125
+ default: () => [i.title]
1126
+ });
1127
+ })])]),
1128
+ ...C(t, "default")
1129
+ }) : null;
857
1130
  }
858
- }), wt = () => ({
859
- signName: {
860
- type: String
861
- },
862
- modelName: {
1131
+ }), vt = Symbol("pro-table"), Mn = () => Z(vt), Nn = (e) => {
1132
+ se(vt, e);
1133
+ }, Ge = () => ({
1134
+ clsName: {
863
1135
  type: String,
864
- default: "detailData"
1136
+ default: "pro-table"
865
1137
  },
866
- operateBar: {
867
- type: Boolean,
868
- default: !0
1138
+ operate: {
1139
+ type: Object
869
1140
  },
870
- showContinueAdd: {
871
- type: Boolean,
872
- default: !1
1141
+ columnEmptyText: {
1142
+ type: String
873
1143
  },
874
- okText: {
875
- type: String,
876
- default: "\u786E\u5B9A"
1144
+ column: {
1145
+ type: Object
1146
+ },
1147
+ serialNumber: {
1148
+ type: [Boolean, Object]
877
1149
  },
878
- okButtonProps: {
1150
+ paginationState: {
879
1151
  type: Object
880
1152
  },
881
- continueText: {
882
- type: String,
883
- default: "\u786E\u5B9A\u5E76\u7EE7\u7EED"
1153
+ toolbar: {
1154
+ type: Object
884
1155
  },
885
- continueButtonProps: {
1156
+ provideExtra: {
886
1157
  type: Object
1158
+ },
1159
+ tableMethods: {
1160
+ type: Array
887
1161
  }
888
- }), Qt = (e, n, o, t) => L({
1162
+ }), dr = N({
889
1163
  inheritAttrs: !1,
890
1164
  props: {
891
- ...e.props,
892
- ...wt()
1165
+ ...me,
1166
+ ...Ge()
893
1167
  },
894
- setup: (u, {
895
- slots: r,
896
- attrs: s,
897
- expose: m
1168
+ setup: (e, {
1169
+ slots: t,
1170
+ expose: n,
1171
+ attrs: s
898
1172
  }) => {
899
1173
  const {
900
- elementMap: y,
901
- formElementMap: E,
902
- curdState: l,
903
- formColumns: f,
904
- getSignColumns: a,
905
- sendCurdEvent: c
906
- } = se(), d = $(), i = w(() => u.signName ? a(u.signName) : f.value), h = (P, N) => {
907
- if (s.onFinish) {
908
- s.onFinish(P, N);
909
- return;
1174
+ elementMap: o
1175
+ } = ee(), a = e.elementMap || o, r = S(o, x.TableKey), c = () => ({
1176
+ title: "\u5E8F\u53F7",
1177
+ dataIndex: "serialNumber",
1178
+ width: 80,
1179
+ ...e.column,
1180
+ ...ne(e.serialNumber) ? void 0 : e.serialNumber,
1181
+ customRender: ({
1182
+ index: P
1183
+ }) => {
1184
+ var D, L;
1185
+ return ((D = e.paginationState) == null ? void 0 : D.page) && ((L = e.paginationState) == null ? void 0 : L.pageSize) ? e.paginationState.pageSize * (e.paginationState.page - 1) + P + 1 : P + 1;
910
1186
  }
911
- l.mode === q.EDIT ? c({
912
- action: T.EDIT,
913
- type: D.EXECUTE,
914
- values: P
915
- }) : c({
916
- action: T.ADD,
917
- type: D.EXECUTE,
918
- values: P
919
- });
920
- }, p = () => {
921
- var P;
922
- l.addAction = ae.NORMAL, (P = d.value) == null || P.submit();
923
- }, S = () => {
924
- var P;
925
- l.addAction = ae.CONTINUE, (P = d.value) == null || P.submit();
1187
+ }), m = re(t, "operate"), f = () => {
1188
+ const P = e.operate, D = K(P.items, (R) => ({
1189
+ ...R,
1190
+ ...S(P.itemState, R.value)
1191
+ })), L = Qe(D, (R) => R.sort);
1192
+ return {
1193
+ ...e.column,
1194
+ title: "\u64CD\u4F5C",
1195
+ dataIndex: "operate",
1196
+ fixed: "right",
1197
+ ...P.column,
1198
+ customRender: ({
1199
+ record: R
1200
+ }) => {
1201
+ const v = K(L, (h) => ({
1202
+ value: h.value,
1203
+ label: h.label,
1204
+ show: k(h.show) ? h.show(R) : h.show,
1205
+ disabled: k(h.disabled) ? h.disabled(R) : h.disabled,
1206
+ loading: k(h.loading) ? h.loading(R) : h.loading,
1207
+ extraProps: k(h.extraProps) ? h.extraProps(R) : h.extraProps,
1208
+ onClick: () => {
1209
+ var T;
1210
+ (T = h.onClick) == null || T.call(h, R);
1211
+ },
1212
+ element: k(h.element) ? () => h.element(R, h) : h.element
1213
+ }));
1214
+ return y(St, {
1215
+ clsName: P.clsName || `${e.clsName}-operate`,
1216
+ items: v,
1217
+ elementKey: P.elementKey
1218
+ }, _(F(m), (h, T) => ({
1219
+ ...h,
1220
+ [T]: ($) => {
1221
+ var j;
1222
+ return (j = m[T]) == null ? void 0 : j.call(m, R, $);
1223
+ }
1224
+ }), {}));
1225
+ }
1226
+ };
1227
+ }, d = W({
1228
+ selectIds: (() => {
1229
+ var L, R;
1230
+ const P = ((R = (L = e.toolbar) == null ? void 0 : L.columnSetting) == null ? void 0 : R.signName) || "columnSetting", D = U(e.columns, (v) => {
1231
+ var h;
1232
+ return ((h = ft(v, P)) == null ? void 0 : h.initShow) !== !1;
1233
+ });
1234
+ return e.serialNumber && D.unshift(c()), K(D, (v) => v.dataIndex);
1235
+ })()
1236
+ }), u = Mt(e, "columns"), l = w(() => {
1237
+ const P = _(d.selectIds, (D, L) => ({
1238
+ ...D,
1239
+ [L]: !0
1240
+ }), {});
1241
+ return U(e.columns, (D) => S(P, D.dataIndex));
1242
+ }), p = (P) => K(P, (D) => {
1243
+ const L = {
1244
+ ...e.column,
1245
+ ...D
1246
+ };
1247
+ return D.children && X(D.children) > 0 ? (L.children = p(D.children), L) : (D.customRender || (L.customRender = ({
1248
+ text: R
1249
+ }) => {
1250
+ var h;
1251
+ return Fe(a, {
1252
+ ...D,
1253
+ showProps: {
1254
+ ...D.showProps,
1255
+ content: ((h = D.showProps) == null ? void 0 : h.content) || e.columnEmptyText
1256
+ }
1257
+ }, R) || R || e.columnEmptyText;
1258
+ }), L);
1259
+ }), i = w(() => {
1260
+ const P = Ne(l.value, e.columnState, (L) => L.dataIndex), D = p(P);
1261
+ return e.serialNumber && D.unshift(c()), e.operate && e.operate.items && le(e.operate.items, (L) => L.show) && D.push(f()), D;
1262
+ }), g = B();
1263
+ Nn({
1264
+ columns: i,
1265
+ originColumns: u,
1266
+ state: d,
1267
+ tableRef: g,
1268
+ toolbar: e.toolbar,
1269
+ ...e.provideExtra
1270
+ }), n(ie(e.tableMethods || [], g));
1271
+ const M = F(Ge()), I = re(t, "columnSetting");
1272
+ return () => {
1273
+ var D, L, R;
1274
+ if (!r)
1275
+ return null;
1276
+ const P = t.toolbar ? t.toolbar() : void 0;
1277
+ return y("div", O({
1278
+ class: e.clsName
1279
+ }, q(s, "class")), [(P || ((D = e.toolbar) == null ? void 0 : D.columnSetting)) && y("div", {
1280
+ class: `${e.clsName}-toolbar`
1281
+ }, [P, ((L = e.toolbar) == null ? void 0 : L.columnSetting) && y(Dn, (R = e.toolbar) == null ? void 0 : R.columnSetting, I)]), y(r, O({
1282
+ ref: g
1283
+ }, C(s, "class"), C(e, M), {
1284
+ columns: i.value
1285
+ }), t)]);
926
1286
  };
927
- return m(Y(t, d)), () => b(e, R({
928
- ref: d
929
- }, C(s, "onFinish"), u, {
930
- elementMap: u.elementMap || y,
931
- formElementMap: u.formElementMap || E,
932
- columns: u.columns || i.value,
933
- model: u.model || l[u.modelName],
934
- readonly: l.mode === q.DETAIL,
935
- onFinish: h
936
- }, o == null ? void 0 : o(l)), {
937
- default: () => {
938
- var P, N, F, I, A;
939
- return [(P = r.divide) == null ? void 0 : P.call(r), u.operateBar && b("div", {
940
- class: "pro-curd-form-operate"
941
- }, [(N = r.operateStart) == null ? void 0 : N.call(r), l.mode !== q.DETAIL && b(n, R({
942
- onClick: p
943
- }, u.okButtonProps, {
944
- loading: l.operateLoading
945
- }), {
946
- default: () => [u.okText]
947
- }), (F = r.operateCenter) == null ? void 0 : F.call(r), u.showContinueAdd && l.mode === q.ADD && b(n, R({
948
- onClick: S
949
- }, u.continueButtonProps, {
950
- loading: l.operateLoading
951
- }), {
952
- default: () => [u.continueText]
953
- }), (I = r.operateEnd) == null ? void 0 : I.call(r)]), (A = r.default) == null ? void 0 : A.call(r)];
954
- },
955
- ...C(r, "default", "divide", "operateStart", "operateCenter", "operateEnd")
956
- });
957
1287
  }
958
- }), Rt = () => ({
959
- extraInSearch: {
1288
+ }), On = () => ({
1289
+ title: {
1290
+ type: String
1291
+ },
1292
+ subTitle: {
1293
+ type: String
1294
+ },
1295
+ showBack: Boolean,
1296
+ hideWhileNoHistory: {
960
1297
  type: Boolean,
961
- default: void 0
1298
+ default: !0
1299
+ }
1300
+ }), Ae = N({
1301
+ props: {
1302
+ ...On()
1303
+ },
1304
+ setup: (e, {
1305
+ slots: t,
1306
+ emit: n
1307
+ }) => () => {
1308
+ var o, a, r, c;
1309
+ const s = e.hideWhileNoHistory && ((a = (o = window.history) == null ? void 0 : o.state) == null ? void 0 : a.back) || e.hideWhileNoHistory === !1;
1310
+ return y("div", {
1311
+ class: "pro-page-header"
1312
+ }, [e.showBack && s && y("div", {
1313
+ class: "pro-page-header-back",
1314
+ onClick: () => {
1315
+ n("back");
1316
+ }
1317
+ }, [t.backIcon ? t.backIcon() : "\u8FD4\u56DE"]), y("div", {
1318
+ class: "pro-page-header-title"
1319
+ }, [t.title ? t.title() : e.title]), y("div", {
1320
+ class: "pro-page-header-sub-title"
1321
+ }, [t.subTitle ? t.subTitle() : e.subTitle]), y("div", {
1322
+ class: "pro-page-header-space"
1323
+ }, [(r = t.space) == null ? void 0 : r.call(t)]), y("div", {
1324
+ class: "pro-page-header-extra"
1325
+ }, [(c = t.extra) == null ? void 0 : c.call(t)])]);
1326
+ }
1327
+ }), Ln = () => ({
1328
+ loading: {
1329
+ type: Boolean,
1330
+ default: !1
1331
+ },
1332
+ loadingOpts: Object,
1333
+ fillMode: {
1334
+ type: Boolean,
1335
+ default: !0
1336
+ }
1337
+ }), mr = N({
1338
+ props: {
1339
+ ...Ae.props,
1340
+ ...Ln()
1341
+ },
1342
+ setup: (e, {
1343
+ slots: t,
1344
+ emit: n
1345
+ }) => {
1346
+ const o = Q()(x.LoadingKey), a = B(), r = B(0);
1347
+ Bt(a, (m) => {
1348
+ var b;
1349
+ const f = (b = m[0]) == null ? void 0 : b.contentRect;
1350
+ r.value = f == null ? void 0 : f.height;
1351
+ });
1352
+ const c = F(Ae.props);
1353
+ return () => {
1354
+ var b, d, u;
1355
+ const m = e.title || t.title || e.subTitle || t.subTitle || t.extra, f = !!t.footer;
1356
+ return y("div", {
1357
+ class: "pro-page"
1358
+ }, [m && y(Ae, O(q(e, c), {
1359
+ onBack: () => {
1360
+ n("back");
1361
+ }
1362
+ }), q(t, "backIcon", "title", "subTitle", "space", "extra")), e.loading && o ? y(o, O({
1363
+ loading: !0
1364
+ }, e.loadingOpts), {
1365
+ default: () => [y("div", {
1366
+ class: "pro-loading-dom"
1367
+ }, null)]
1368
+ }) : y("div", {
1369
+ ref: a,
1370
+ style: r.value > 0 ? `height:${r.value > 0}` : "",
1371
+ class: "pro-page-content"
1372
+ }, [e.fillMode ? y(H, null, [r.value > 0 && ((b = t.default) == null ? void 0 : b.call(t))]) : (d = t.default) == null ? void 0 : d.call(t)]), !e.loading && f && y("div", {
1373
+ class: "pro-page-footer"
1374
+ }, [(u = t.footer) == null ? void 0 : u.call(t)])]);
1375
+ };
1376
+ }
1377
+ }), An = Object.freeze({
1378
+ page: 1,
1379
+ pageSize: 10
1380
+ }), Rn = () => ({
1381
+ clsName: {
1382
+ type: String,
1383
+ default: "pro-list"
962
1384
  },
963
1385
  searchProps: {
964
1386
  type: Object
@@ -967,545 +1389,897 @@ const Jt = (e, n) => L({
967
1389
  type: Object
968
1390
  },
969
1391
  paginationProps: {
970
- type: Object
971
- },
972
- showPagination: {
973
- type: Boolean,
974
- default: !0
1392
+ type: [Object, Boolean]
975
1393
  },
976
1394
  pageState: {
977
1395
  type: Object
978
1396
  }
979
- }), Yt = (e, n) => L({
1397
+ }), ze = N({
980
1398
  props: {
981
- ...Rt()
1399
+ ...Rn()
982
1400
  },
983
- setup: (o, {
984
- slots: t
1401
+ setup: (e, {
1402
+ slots: t,
1403
+ emit: n
985
1404
  }) => {
986
- const {
987
- elementMap: u,
988
- formElementMap: r,
989
- curdState: s,
990
- searchColumns: m,
991
- tableColumns: y,
992
- sendCurdEvent: E,
993
- operates: l
994
- } = se(), f = o.pageState || B({
995
- ...It
1405
+ const s = Q(), o = s(x.ProSearchFormKey), a = s(x.ProTableKey), r = s(x.PaginationKey), c = e.pageState || W({
1406
+ ...An
996
1407
  });
997
- let a;
998
- const c = () => {
999
- E({
1000
- action: T.LIST,
1001
- type: D.EMIT,
1002
- values: {
1003
- ...a,
1004
- ...f
1005
- }
1408
+ let m;
1409
+ const f = () => {
1410
+ n("search", {
1411
+ ...m,
1412
+ ...c
1006
1413
  });
1007
- }, d = (p) => {
1008
- a = p, f.page = 1, c();
1009
- }, i = M(G(l, (p) => {
1010
- const S = p.action;
1011
- return S === T.DETAIL || S === T.EDIT || S === T.DELETE || p.tableOperate;
1012
- }), (p) => {
1013
- const S = {
1014
- ...K(p, "label", "element", "disabled", "sort", "onClick"),
1015
- show: ot(p == null ? void 0 : p.show) ? !1 : p == null ? void 0 : p.show,
1016
- value: p.action
1017
- };
1018
- return S.onClick || (S.onClick = (P) => {
1019
- E({
1020
- action: p.action,
1021
- type: D.EMIT,
1022
- record: P
1023
- });
1024
- }), S;
1025
- }), h = (p) => M(p, (S) => S.onClick ? S : {
1026
- ...S,
1027
- onClick: (P) => {
1028
- E({
1029
- action: "operate",
1030
- type: S.value,
1031
- record: P
1032
- });
1033
- }
1034
- });
1414
+ }, b = (i, g) => {
1415
+ m = i, c.page = g || 1, f();
1416
+ }, d = (i, g) => {
1417
+ c.page = i, c.pageSize = g, f();
1418
+ }, u = re(t, "search"), l = re(t, "table"), p = re(t, "pagination");
1035
1419
  return () => {
1036
- var N, F, I, A, g, O, W, j, x, X;
1037
- const p = o.tableProps, S = {
1038
- elementMap: u,
1039
- columns: y.value,
1040
- ...C(p, "slots", "operate"),
1041
- operate: xe({
1042
- items: i
1043
- }, p == null ? void 0 : p.operate, (de, Oe) => {
1044
- if (U(de) && U(Oe))
1045
- return ct(de, h(Oe));
1046
- }),
1420
+ var i, g, M, I;
1421
+ return y(H, null, [(i = t.start) == null ? void 0 : i.call(t), t.search ? t.search({
1422
+ executeSearchWithResetPage: b,
1423
+ pageState: c
1424
+ }) : y(H, null, [o ? y(o, O({
1425
+ clsName: `${e.clsName}-search`
1426
+ }, C(e.searchProps, "onFinish"), {
1427
+ onFinish: (P) => b(P)
1428
+ }), u) : null]), (g = t.divide) == null ? void 0 : g.call(t), t.table ? t.table({
1429
+ pageState: c
1430
+ }) : y(H, null, [a ? y(a, O({
1431
+ clsName: `${e.clsName}-table`,
1047
1432
  paginationState: {
1048
- page: f.page,
1049
- pageSize: f.pageSize
1050
- },
1051
- loading: s.listLoading,
1052
- dataSource: (N = s.listData) == null ? void 0 : N.dataSource
1053
- }, P = t.extra ? b("div", {
1054
- class: "pro-curd-list-extra"
1055
- }, [t.extra()]) : null;
1056
- return b(oe, null, [(F = t.start) == null ? void 0 : F.call(t), t.search ? t.search({
1057
- executeSearchWithResetPage: d
1058
- }) : b(e, R({
1059
- formElementMap: r,
1060
- columns: m.value
1061
- }, C(o.searchProps, "slots"), {
1062
- onFinish: d
1063
- }), {
1064
- default: () => [o.extraInSearch && P],
1065
- ...(I = o.searchProps) == null ? void 0 : I.slots
1066
- }), (A = t.divide) == null ? void 0 : A.call(t), !o.extraInSearch && P, t.table ? t.table(S) : b(n, S, p == null ? void 0 : p.slots), (g = t.divide2) == null ? void 0 : g.call(t), o.showPagination && b("div", {
1067
- class: "pro-curd-list-footer"
1068
- }, [(O = t.footerStart) == null ? void 0 : O.call(t), (j = t.pagination) == null ? void 0 : j.call(t, f, (W = s.listData) == null ? void 0 : W.total, c), (x = t.footerEnd) == null ? void 0 : x.call(t)]), (X = t.end) == null ? void 0 : X.call(t)]);
1433
+ page: c.page,
1434
+ pageSize: c.pageSize
1435
+ }
1436
+ }, e.tableProps), l) : null]), (M = t.divide2) == null ? void 0 : M.call(t), t.pagination ? t.pagination({
1437
+ executePageChange: d,
1438
+ pageState: c
1439
+ }) : y(H, null, [e.paginationProps !== !1 && r ? y(r, O({
1440
+ clsName: `${e.clsName}-pagination`
1441
+ }, C(ne(e.paginationProps) ? {} : e.paginationProps, "onChange"), {
1442
+ page: c.page,
1443
+ pageSize: c.pageSize,
1444
+ onComposeChange: d
1445
+ }), p) : null]), (I = t.end) == null ? void 0 : I.call(t)]);
1069
1446
  };
1070
1447
  }
1071
- }), He = Symbol("pro-form-list"), Je = () => J(He), Qe = (e) => {
1072
- Q(He, e);
1073
- }, Nt = L({
1074
- props: {
1075
- pathList: {
1076
- type: Array
1077
- }
1448
+ }), We = () => ({
1449
+ clsName: {
1450
+ type: String,
1451
+ default: "pro-desc"
1078
1452
  },
1079
- setup: (e, {
1080
- slots: n
1081
- }) => (Qe({
1082
- pathList: e.pathList
1083
- }), () => {
1084
- var o;
1085
- return (o = n.default) == null ? void 0 : o.call(n);
1086
- })
1087
- }), Zt = (e) => L({
1453
+ model: {
1454
+ type: Object
1455
+ }
1456
+ }), Kn = N({
1088
1457
  props: {
1089
- ...e.props,
1090
- rowKey: {
1091
- type: String,
1092
- default: "id"
1093
- }
1458
+ ...me,
1459
+ ...We()
1094
1460
  },
1095
- setup: (n, {
1096
- slots: o
1461
+ setup: (e, {
1462
+ slots: t
1097
1463
  }) => {
1098
1464
  const {
1099
- formState: t,
1100
- readonly: u
1101
- } = Ze(), r = Je(), s = We(n.name), m = r != null && r.pathList ? [...r.pathList, ...s] : s, y = () => {
1102
- let l = v(t, m);
1103
- U(l) || (l = []), l.push({
1104
- [n.rowKey]: new Date().valueOf()
1105
- }), _(t, m, l);
1106
- }, E = (l) => {
1107
- const f = v(t, m);
1108
- V(f) <= 0 || f.splice(l, 1);
1109
- };
1110
- return () => b(e, C(n, "rowKey"), {
1465
+ elementMap: n
1466
+ } = ee(), s = e.elementMap || n, o = Q(), a = o(x.DescriptionsKey), r = o(x.DescriptionsItemKey), c = w(() => Ne(e.columns, e.columnState, "dataIndex")), m = F(me), f = F(We());
1467
+ return () => !a || !r ? null : y(a, O({
1468
+ class: e.clsName
1469
+ }, C(e, ...m, ...f, "model")), {
1111
1470
  default: () => {
1112
- var l;
1113
- return [M(v(t, m), (f, a) => b(Nt, {
1114
- key: f[n.rowKey] || a,
1115
- pathList: [...m, a]
1116
- }, {
1117
- default: () => {
1118
- var c, d, i;
1119
- return [b("div", {
1120
- class: "pro-form-list-item"
1121
- }, [(c = o.default) == null ? void 0 : c.call(o), !u.value && b(oe, null, [b("div", {
1122
- class: "pro-form-list-item-add",
1123
- onClick: y
1124
- }, [(d = o.itemAdd) == null ? void 0 : d.call(o)]), b("div", {
1125
- class: "pro-form-list-item-minus",
1126
- onClick: () => E(a)
1127
- }, [(i = o.itemMinus) == null ? void 0 : i.call(o)])])])];
1128
- }
1129
- })), !u.value && b("div", {
1130
- class: "pro-form-list-add",
1131
- onClick: y
1132
- }, [(l = o.add) == null ? void 0 : l.call(o)])];
1133
- }
1471
+ var b, d;
1472
+ return [(b = t.start) == null ? void 0 : b.call(t), K(c.value, (u) => {
1473
+ const l = u.dataIndex, p = S(e.model, l);
1474
+ return y(r, O({
1475
+ class: `${e.clsName}-item`
1476
+ }, S(u.extra, "desc")), {
1477
+ default: () => {
1478
+ var i;
1479
+ return [((i = t.value) == null ? void 0 : i.call(t, p, u)) || Fe(s, u, p)];
1480
+ },
1481
+ label: () => {
1482
+ var i;
1483
+ return ((i = t.label) == null ? void 0 : i.call(t, u)) || u.title;
1484
+ }
1485
+ });
1486
+ }), (d = t.default) == null ? void 0 : d.call(t)];
1487
+ },
1488
+ ...t
1134
1489
  });
1135
1490
  }
1136
- }), Ye = Symbol("pro-form"), Ze = () => J(Ye), jt = (e) => {
1137
- Q(Ye, e);
1138
- }, we = () => ({
1139
- model: {
1140
- type: Object
1141
- },
1142
- readonly: {
1143
- type: Boolean,
1144
- default: void 0
1145
- },
1146
- showState: {
1147
- type: Object
1148
- },
1149
- showStateRules: {
1150
- type: Object
1491
+ }), Pt = Symbol("pro-curd"), G = () => Z(Pt), wn = (e) => se(Pt, e);
1492
+ var E = /* @__PURE__ */ ((e) => (e.LIST = "LIST", e.DETAIL = "DETAIL", e.ADD = "ADD", e.EDIT = "EDIT", e.DELETE = "DELETE", e))(E || {}), A = /* @__PURE__ */ ((e) => (e.EMIT = "EMIT", e.EXECUTE = "EXECUTE", e.PAGE = "PAGE", e.SUCCESS = "SUCCESS", e.FAIL = "FAIL", e))(A || {}), ae = /* @__PURE__ */ ((e) => (e.ADD = "ADD", e.EDIT = "EDIT", e.DETAIL = "DETAIL", e))(ae || {}), ye = /* @__PURE__ */ ((e) => (e.NORMAL = "NORMAL", e.CONTINUE = "CONTINUE", e))(ye || {});
1493
+ const kn = () => ({
1494
+ rowKey: {
1495
+ type: String,
1496
+ default: "id"
1151
1497
  },
1152
- readonlyState: {
1153
- type: Object
1498
+ operates: {
1499
+ type: Array
1154
1500
  },
1155
- readonlyStateRules: {
1501
+ listProps: {
1156
1502
  type: Object
1157
1503
  },
1158
- disableState: {
1504
+ formProps: {
1159
1505
  type: Object
1160
1506
  },
1161
- disableStateRules: {
1507
+ descProps: {
1162
1508
  type: Object
1163
1509
  },
1164
- needRules: {
1165
- type: Boolean,
1166
- default: !0
1167
- },
1168
- provideExtra: {
1510
+ modalProps: {
1169
1511
  type: Object
1170
1512
  }
1171
- }), en = (e, n, o) => L({
1172
- inheritAttrs: !1,
1513
+ }), Et = ["sendCurdEvent", "refreshList", "sendEvent", "sendRequest"], He = N({
1173
1514
  props: {
1174
- ...e.props,
1175
- ...Ce,
1176
- ...we(),
1177
- ...C(n.props, "items")
1515
+ ...me,
1516
+ ...kn()
1178
1517
  },
1179
- setup: (t, {
1180
- slots: u,
1181
- emit: r,
1182
- expose: s,
1183
- attrs: m
1518
+ setup: (e, {
1519
+ slots: t,
1520
+ expose: n
1184
1521
  }) => {
1185
1522
  const {
1186
- elementMap: y,
1187
- formElementMap: E
1188
- } = Le(), l = t.elementMap || y, f = t.formElementMap || E, a = t.model || B({}), c = t.showState || B({}), d = t.readonlyState || B({}), i = t.disableState || B({});
1189
- ce(() => {
1190
- t.showStateRules && z(t.showStateRules, (I, A) => {
1191
- c[A] = I(a);
1192
- }), t.readonlyStateRules && z(t.readonlyStateRules, (I, A) => {
1193
- d[A] = I(a);
1194
- }), t.disableStateRules && z(t.disableStateRules, (I, A) => {
1195
- i[A] = I(a);
1523
+ elementMap: s,
1524
+ state: o,
1525
+ sendEvent: a,
1526
+ sendRequest: r
1527
+ } = ge(), c = w(() => Ne(e.columns, e.columnState, (h) => ue(h))), m = (h, T = !0) => st(e.formElementMap, h, T), f = (h, T) => Fe(s, h, T), b = (h, T) => {
1528
+ const $ = U(c.value, (j) => {
1529
+ const z = S(j, ["extra", h]) || S(j, h);
1530
+ return T ? z !== !1 : z;
1196
1531
  });
1197
- }, a);
1198
- const h = w(() => t.readonly), p = w(() => Ae(t.columns, t.columnState, (I) => te(I))), S = (I) => {
1199
- const A = Ct(I, c, t.showStateRules);
1200
- r("finish", A, I);
1201
- }, P = $();
1202
- s(Y(o, P)), jt({
1203
- formState: a,
1204
- showState: c,
1205
- readonlyState: d,
1206
- disableState: i,
1207
- elementMap: l,
1208
- formElementMap: f,
1209
- readonly: h,
1210
- columns: p,
1211
- formRef: P,
1212
- ...t.provideExtra
1213
- }), Qe({});
1214
- const N = k(we()), F = k(C(n.props, "items"));
1215
- return () => b(e, R({
1216
- ref: P
1217
- }, C(m, "onFinish"), C(t, ...N, ...F, "onFinish"), {
1218
- model: a,
1219
- onFinish: S
1220
- }), {
1221
- default: () => {
1222
- var I, A;
1223
- return [(I = u.start) == null ? void 0 : I.call(u), f && V(p.value) > 0 && b(oe, null, [t.row ? b(n, {
1224
- row: t.row,
1225
- col: t.col,
1226
- items: M(p.value, (g) => ({
1227
- rowKey: te(g),
1228
- vNode: Pe(f, g, t.needRules),
1229
- col: v(g, ["extra", "col"])
1230
- }))
1231
- }, null) : M(p.value, (g) => Pe(f, g, t.needRules))]), (A = u.default) == null ? void 0 : A.call(u)];
1232
- },
1233
- ...C(u, "default")
1532
+ return Qe($, (j) => S(j, ["extra", `${h}Sort`]) || S(j, `${h}Sort`));
1533
+ }, d = w(() => b("form", !0)), u = w(() => b("detail", !0)), l = w(() => b("table", !0)), p = w(() => b("search"));
1534
+ let i;
1535
+ const g = (h) => {
1536
+ r(E.LIST, {
1537
+ ...i,
1538
+ ...h
1539
+ });
1540
+ }, M = (h) => {
1541
+ a({
1542
+ type: h.action,
1543
+ payload: C(h, "action", "source"),
1544
+ source: h.source
1545
+ });
1546
+ };
1547
+ xe(({
1548
+ type: h,
1549
+ payload: T,
1550
+ source: $
1551
+ }) => {
1552
+ if ($)
1553
+ return;
1554
+ let j = h, z = T == null ? void 0 : T.type;
1555
+ j === pe.Success && (j = S(T, ["requestOpts", "action"]), z = A.SUCCESS);
1556
+ const {
1557
+ values: be,
1558
+ record: Tt
1559
+ } = T;
1560
+ switch (j) {
1561
+ case E.LIST:
1562
+ z === A.EMIT && (i = be, g());
1563
+ return;
1564
+ case E.ADD:
1565
+ z === A.EXECUTE && r(E.ADD, be, o.detailData);
1566
+ return;
1567
+ case E.EDIT:
1568
+ z === A.EXECUTE && r(E.EDIT, be, o.detailData);
1569
+ return;
1570
+ case E.DELETE:
1571
+ z === A.EMIT ? r(E.DELETE, Tt, e.rowKey) : z === A.SUCCESS && g();
1572
+ return;
1573
+ }
1574
+ j && h === A.EXECUTE && r(j, be);
1234
1575
  });
1576
+ const I = _(e.operates, (h, T) => ({
1577
+ ...h,
1578
+ [T.action]: T
1579
+ }), {}), P = (h) => S(I, h), D = w(() => e.listProps), L = w(() => e.formProps), R = w(() => e.descProps), v = w(() => e.modalProps);
1580
+ return wn({
1581
+ columns: c,
1582
+ getSignColumns: b,
1583
+ getFormItemVNode: m,
1584
+ getItemVNode: f,
1585
+ elementMap: s,
1586
+ formElementMap: e.formElementMap,
1587
+ rowKey: e.rowKey,
1588
+ curdState: o,
1589
+ formColumns: d,
1590
+ descColumns: u,
1591
+ tableColumns: l,
1592
+ searchColumns: p,
1593
+ sendCurdEvent: M,
1594
+ operates: e.operates,
1595
+ getOperate: P,
1596
+ refreshList: g,
1597
+ listProps: D,
1598
+ formProps: L,
1599
+ descProps: R,
1600
+ modalProps: v
1601
+ }), n({
1602
+ sendCurdEvent: M,
1603
+ refreshList: g
1604
+ }), () => {
1605
+ var h;
1606
+ return (h = t.default) == null ? void 0 : h.call(t);
1607
+ };
1235
1608
  }
1236
- });
1237
- let me;
1238
- (function(e) {
1239
- e.AUTO = "AUTO", e.MANUAL = "MANUAL";
1240
- })(me || (me = {}));
1241
- const Re = () => ({
1242
- initEmit: {
1243
- type: Boolean,
1244
- default: !0
1245
- },
1246
- searchMode: {
1247
- type: String,
1248
- default: me.AUTO
1249
- },
1250
- debounceKeys: {
1251
- type: Array
1252
- },
1253
- debounceTypes: {
1254
- type: Array,
1255
- default: ["text"]
1609
+ }), Te = N({
1610
+ props: {
1611
+ ...C(Oe.props, "state", "requests"),
1612
+ ...He.props,
1613
+ curdState: {
1614
+ type: Object
1615
+ }
1256
1616
  },
1257
- debounceTime: {
1258
- type: Number,
1259
- default: 800
1617
+ setup: (e, {
1618
+ slots: t,
1619
+ expose: n
1620
+ }) => {
1621
+ const {
1622
+ elementMap: s,
1623
+ formElementMap: o
1624
+ } = ee(), a = B(), r = B(), c = e.curdState || W({
1625
+ detailData: {}
1626
+ }), m = {
1627
+ [E.LIST]: {
1628
+ convertParams: (u) => u,
1629
+ convertData: (u) => {
1630
+ var l;
1631
+ return (l = u.res) == null ? void 0 : l.data;
1632
+ },
1633
+ loadingName: "listLoading",
1634
+ stateName: "listData"
1635
+ },
1636
+ [E.DETAIL]: {
1637
+ convertParams: (u, l) => q(u, l),
1638
+ convertData: (u) => {
1639
+ var l;
1640
+ return (l = u.res) == null ? void 0 : l.data;
1641
+ },
1642
+ loadingName: "detailLoading",
1643
+ stateName: "detailData",
1644
+ label: "\u8BE6\u60C5"
1645
+ },
1646
+ [E.ADD]: {
1647
+ convertParams: (u, l) => ({
1648
+ body: {
1649
+ ...l,
1650
+ ...u
1651
+ }
1652
+ }),
1653
+ loadingName: "operateLoading",
1654
+ label: "\u6DFB\u52A0"
1655
+ },
1656
+ [E.EDIT]: {
1657
+ convertParams: (u, l) => ({
1658
+ body: {
1659
+ ...l,
1660
+ ...u
1661
+ }
1662
+ }),
1663
+ loadingName: "operateLoading",
1664
+ label: "\u7F16\u8F91"
1665
+ },
1666
+ [E.DELETE]: {
1667
+ convertParams: (u, l) => q(u, l),
1668
+ label: "\u5220\u9664"
1669
+ }
1670
+ }, f = K(e.operates, (u) => ({
1671
+ ...S(m, u.action),
1672
+ ...u
1673
+ })), b = U(f, (u) => u.actor), d = F(C(Oe.props, "state", "requests"));
1674
+ return n({
1675
+ sendCurdEvent: (u) => {
1676
+ var l;
1677
+ (l = r.value) == null || l.sendCurdEvent(u);
1678
+ },
1679
+ refreshList: (u) => {
1680
+ var l;
1681
+ (l = r.value) == null || l.refreshList(u);
1682
+ },
1683
+ sendEvent: (u) => {
1684
+ var l;
1685
+ (l = a.value) == null || l.sendEvent(u);
1686
+ },
1687
+ sendRequest: (u, ...l) => {
1688
+ var p;
1689
+ (p = a.value) == null || p.sendRequest(u, ...l);
1690
+ }
1691
+ }), () => y(Oe, O({
1692
+ ref: a
1693
+ }, q(e, d), {
1694
+ elementMap: e.elementMap || s,
1695
+ state: c,
1696
+ requests: b
1697
+ }), {
1698
+ default: () => [y(He, O({
1699
+ ref: r
1700
+ }, C(e, ...d, "curdState", "operates"), {
1701
+ formElementMap: e.formElementMap || o,
1702
+ operates: f
1703
+ }), t)]
1704
+ });
1260
1705
  }
1261
- }), tn = (e, n, o) => L({
1706
+ }), Fn = () => ({
1707
+ defaultAddRecord: {
1708
+ type: Object
1709
+ }
1710
+ }), Re = N({
1262
1711
  props: {
1263
- ...e.props,
1264
- ...n,
1265
- ...Re()
1712
+ ...Fn()
1266
1713
  },
1267
- setup: (t, {
1268
- slots: u,
1269
- expose: r
1270
- }) => {
1271
- const s = t.model || B({}), m = new Set(t.debounceTypes), y = M(G(t.columns, (d) => {
1272
- const i = Be(d);
1273
- return m.has(i);
1274
- }), (d) => te(d)), E = $();
1275
- r(Y(o, E));
1276
- const l = () => {
1277
- var d;
1278
- (d = E.value) == null || d.submit();
1279
- }, f = ut(() => {
1280
- l();
1281
- }, t.debounceTime);
1282
- ce(() => {
1283
- t.initEmit && l();
1284
- }, []);
1285
- const a = (d, i, h) => ve(h, (p) => v(d, p) !== v(i, p));
1286
- mt((d, i) => {
1287
- if (t.searchMode !== me.AUTO)
1288
- return;
1289
- const h = V(t.debounceKeys) > 0 ? t.debounceKeys : y;
1290
- if (V(h) > 0 && a(d, i, h)) {
1291
- f();
1714
+ setup: (e) => {
1715
+ var l;
1716
+ const {
1717
+ dispatch: t,
1718
+ sendRequest: n
1719
+ } = ge(), {
1720
+ rowKey: s,
1721
+ curdState: o,
1722
+ listProps: a,
1723
+ getOperate: r,
1724
+ refreshList: c
1725
+ } = G(), m = (l = a == null ? void 0 : a.value) == null ? void 0 : l.pageState, f = (p) => {
1726
+ const i = r(E.DETAIL);
1727
+ i != null && i.actor ? n(E.DETAIL, p, s) : t({
1728
+ type: "detailData",
1729
+ payload: $t(p)
1730
+ });
1731
+ }, b = (p, {
1732
+ record: i
1733
+ }) => {
1734
+ p === A.EMIT && (t({
1735
+ type: "mode",
1736
+ payload: ae.DETAIL
1737
+ }), f(i));
1738
+ }, d = (p) => {
1739
+ p === A.EMIT ? (t({
1740
+ type: "mode",
1741
+ payload: ae.ADD
1742
+ }), t({
1743
+ type: "detailData",
1744
+ payload: e.defaultAddRecord || {}
1745
+ })) : p === A.SUCCESS && (m && (m.page = 1), c(), o.addAction === ye.CONTINUE ? t({
1746
+ type: "detailData",
1747
+ payload: e.defaultAddRecord || {}
1748
+ }) : t({
1749
+ type: "mode",
1750
+ payload: void 0
1751
+ }));
1752
+ }, u = (p, {
1753
+ record: i
1754
+ }) => {
1755
+ p === A.EMIT ? (t({
1756
+ type: "mode",
1757
+ payload: ae.EDIT
1758
+ }), f(i)) : p === A.SUCCESS && (t({
1759
+ type: "mode",
1760
+ payload: void 0
1761
+ }), c());
1762
+ };
1763
+ return xe(({
1764
+ type: p,
1765
+ payload: i,
1766
+ source: g
1767
+ }) => {
1768
+ if (g)
1292
1769
  return;
1770
+ let M = p, I = i == null ? void 0 : i.type;
1771
+ const P = i == null ? void 0 : i.record;
1772
+ switch (M === pe.Success && (M = S(i, ["requestOpts", "action"]), I = A.SUCCESS), M) {
1773
+ case E.DETAIL:
1774
+ b(I, {
1775
+ record: P
1776
+ });
1777
+ break;
1778
+ case E.ADD:
1779
+ d(I);
1780
+ break;
1781
+ case E.EDIT:
1782
+ u(I, {
1783
+ record: P
1784
+ });
1785
+ break;
1293
1786
  }
1294
- l();
1295
- }, () => st(s));
1296
- const c = k(C(Re(), "columns"));
1297
- return () => b(e, R({
1298
- ref: E
1299
- }, C(t, c), {
1300
- model: s
1301
- }), u);
1787
+ }), () => null;
1302
1788
  }
1303
- }), Ne = () => ({
1304
- readonly: {
1305
- type: Boolean,
1306
- default: void 0
1789
+ }), fr = N({
1790
+ props: {
1791
+ ...Te.props,
1792
+ ...Re.props
1307
1793
  },
1308
- fieldProps: {
1794
+ setup: (e, {
1795
+ slots: t,
1796
+ expose: n
1797
+ }) => {
1798
+ const s = B();
1799
+ n(ie(Et, s));
1800
+ const o = F(Re.props);
1801
+ return () => y(Te, O({
1802
+ ref: s
1803
+ }, C(e, o)), {
1804
+ default: () => {
1805
+ var a;
1806
+ return [y(Re, q(e, o), null), (a = t.default) == null ? void 0 : a.call(t)];
1807
+ }
1808
+ });
1809
+ }
1810
+ }), $n = () => ({
1811
+ defaultAddRecord: {
1309
1812
  type: Object
1310
1813
  },
1311
- showProps: {
1312
- type: Object
1814
+ routeBack: {
1815
+ type: Function
1816
+ }
1817
+ }), Ke = N({
1818
+ props: {
1819
+ ...$n()
1313
1820
  },
1314
- slots: {
1315
- type: Object
1821
+ setup: (e) => {
1822
+ const t = Gt(), n = zt(), {
1823
+ dispatch: s,
1824
+ sendRequest: o
1825
+ } = ge(), {
1826
+ rowKey: a,
1827
+ curdState: r
1828
+ } = G(), c = (d) => {
1829
+ d === A.PAGE && (s({
1830
+ type: "mode",
1831
+ payload: void 0
1832
+ }), s({
1833
+ type: "detailData",
1834
+ payload: {}
1835
+ }), s({
1836
+ type: "detailLoading",
1837
+ payload: !1
1838
+ }), s({
1839
+ type: "addAction",
1840
+ payload: void 0
1841
+ }));
1842
+ }, m = (d, {
1843
+ record: u
1844
+ }) => {
1845
+ d === A.EMIT ? t.push({
1846
+ path: `${n.path}/detail`,
1847
+ query: q(u, a)
1848
+ }) : d === A.PAGE && (s({
1849
+ type: "mode",
1850
+ payload: ae.DETAIL
1851
+ }), o(E.DETAIL, n.query, a));
1852
+ }, f = (d) => {
1853
+ d === A.EMIT ? t.push({
1854
+ path: `${n.path}/add`
1855
+ }) : d === A.PAGE ? (s({
1856
+ type: "mode",
1857
+ payload: ae.ADD
1858
+ }), s({
1859
+ type: "detailData",
1860
+ payload: e.defaultAddRecord || {}
1861
+ })) : d === A.SUCCESS && (r.addAction === ye.CONTINUE ? s({
1862
+ type: "detailData",
1863
+ payload: e.defaultAddRecord || {}
1864
+ }) : e.routeBack ? e.routeBack(E.ADD) : t.go(-1));
1865
+ }, b = (d, {
1866
+ record: u
1867
+ }) => {
1868
+ d === A.EMIT ? t.push({
1869
+ path: `${n.path}/edit`,
1870
+ query: q(u, a)
1871
+ }) : d === A.PAGE ? (s({
1872
+ type: "mode",
1873
+ payload: ae.EDIT
1874
+ }), o(E.DETAIL, n.query, a)) : d === A.SUCCESS && (e.routeBack ? e.routeBack(E.EDIT) : t.go(-1));
1875
+ };
1876
+ return xe(({
1877
+ type: d,
1878
+ payload: u,
1879
+ source: l
1880
+ }) => {
1881
+ if (l)
1882
+ return;
1883
+ let p = d, i = u == null ? void 0 : u.type;
1884
+ const g = u == null ? void 0 : u.record;
1885
+ switch (p === pe.Success && (p = S(u, ["requestOpts", "action"]), i = A.SUCCESS), p) {
1886
+ case E.LIST:
1887
+ c(i);
1888
+ break;
1889
+ case E.DETAIL:
1890
+ m(i, {
1891
+ record: g
1892
+ });
1893
+ break;
1894
+ case E.ADD:
1895
+ f(i);
1896
+ break;
1897
+ case E.EDIT:
1898
+ b(i, {
1899
+ record: g
1900
+ });
1901
+ break;
1902
+ }
1903
+ }), () => null;
1316
1904
  }
1317
- }), nn = (e, n) => ({
1318
- InputComp: o,
1319
- valueType: t,
1320
- name: u
1321
- }) => L({
1322
- name: u,
1905
+ }), pr = N({
1323
1906
  props: {
1324
- ...e.props,
1325
- ...Ne()
1907
+ ...Te.props,
1908
+ ...Ke.props
1326
1909
  },
1327
- setup: (r, {
1328
- slots: s
1910
+ setup: (e, {
1911
+ slots: t,
1912
+ expose: n
1913
+ }) => {
1914
+ const s = B();
1915
+ n(ie(Et, s));
1916
+ const o = F(Ke.props);
1917
+ return () => y(Te, O({
1918
+ ref: s
1919
+ }, C(e, o)), {
1920
+ default: () => {
1921
+ var a;
1922
+ return [y(Ke, q(e, o), null), (a = t.default) == null ? void 0 : a.call(t)];
1923
+ }
1924
+ });
1925
+ }
1926
+ }), xn = N({
1927
+ props: {
1928
+ ...ze.props,
1929
+ clsName: {
1930
+ type: String,
1931
+ default: "pro-curd-list"
1932
+ }
1933
+ },
1934
+ setup: (e, {
1935
+ slots: t
1329
1936
  }) => {
1330
1937
  const {
1331
- formState: m,
1332
- showState: y,
1333
- readonlyState: E,
1334
- disableState: l,
1335
- readonly: f,
1336
- elementMap: a
1337
- } = Ze(), c = Je(), d = w(() => pe(r.readonly) ? r.readonly : pe(E[r.name]) ? E[r.name] : f.value), i = We(r.name), h = c != null && c.pathList ? [...c.pathList, ...i] : i, p = (P) => {
1338
- _(m, h, P);
1339
- }, S = k(Ne());
1938
+ elementMap: n,
1939
+ formElementMap: s,
1940
+ curdState: o,
1941
+ searchColumns: a,
1942
+ tableColumns: r,
1943
+ sendCurdEvent: c,
1944
+ operates: m
1945
+ } = G(), f = K(
1946
+ U(m, (d) => {
1947
+ const u = d.action;
1948
+ return u === E.DETAIL || u === E.EDIT || u === E.DELETE || d.tableOperate;
1949
+ }),
1950
+ (d) => {
1951
+ const u = {
1952
+ ...q(d, "label", "show", "disabled", "loading", "extraProps", "onClick", "element"),
1953
+ value: d.action
1954
+ };
1955
+ return u.onClick || (u.onClick = (l) => {
1956
+ c({
1957
+ action: d.action,
1958
+ type: A.EMIT,
1959
+ record: l
1960
+ });
1961
+ }), u;
1962
+ }
1963
+ ), b = (d) => {
1964
+ c({
1965
+ action: E.LIST,
1966
+ type: A.EMIT,
1967
+ values: d
1968
+ });
1969
+ };
1340
1970
  return () => {
1341
- const P = v(y, h);
1342
- if (pe(P) && !P)
1343
- return null;
1344
- const N = v(m, h), F = v(a, t);
1345
- return b(e, R(C(r, ...S, "name", "slots"), {
1346
- name: h
1971
+ var M, I;
1972
+ const d = e.searchProps, u = {
1973
+ formElementMap: s,
1974
+ columns: a.value,
1975
+ ...d
1976
+ }, l = e.tableProps, p = {
1977
+ elementMap: n,
1978
+ columns: r.value,
1979
+ loading: o.listLoading,
1980
+ dataSource: (M = o.listData) == null ? void 0 : M.dataSource,
1981
+ ...C(l, "operate"),
1982
+ operate: {
1983
+ items: f,
1984
+ ...l == null ? void 0 : l.operate
1985
+ }
1986
+ }, i = e.paginationProps, g = {
1987
+ total: (I = o.listData) == null ? void 0 : I.total,
1988
+ ...ne(i) ? {} : i
1989
+ };
1990
+ return y(ze, O(C(e, "searchProps", "tableProps", "paginationProps"), {
1991
+ searchProps: u,
1992
+ tableProps: p,
1993
+ paginationProps: g,
1994
+ onSearch: b
1347
1995
  }), {
1348
- default: () => [d.value ? b(oe, null, [F ? b(F, R({
1349
- value: N
1350
- }, r.fieldProps, {
1351
- showProps: r.showProps
1352
- }), s) : b("span", null, [N])]) : b(o, R(n(N, p, v(l, h)), r.fieldProps), s)],
1353
- ...r.slots
1996
+ ...t,
1997
+ search: t.search ? (P) => t.search(P, u) : void 0,
1998
+ pagination: t.pagination ? (P) => t.pagination(P, g) : void 0
1354
1999
  });
1355
2000
  };
1356
2001
  }
1357
- }), et = Symbol("pro-table"), rn = () => J(et), Ft = (e) => {
1358
- Q(et, e);
1359
- }, je = () => ({
1360
- operate: {
1361
- type: Object
2002
+ }), yr = N(() => {
2003
+ const {
2004
+ listProps: e
2005
+ } = G();
2006
+ return () => y(xn, C(e == null ? void 0 : e.value, "slots"), S(e == null ? void 0 : e.value, "slots"));
2007
+ }), jn = () => ({
2008
+ clsName: {
2009
+ type: String,
2010
+ default: "pro-curd-form"
1362
2011
  },
1363
- columnEmptyText: {
2012
+ signName: {
1364
2013
  type: String
2014
+ }
2015
+ }), je = N({
2016
+ props: {
2017
+ ...jn()
1365
2018
  },
1366
- column: {
1367
- type: Object
2019
+ setup: (e, {
2020
+ slots: t,
2021
+ expose: n,
2022
+ attrs: s
2023
+ }) => {
2024
+ const {
2025
+ elementMap: o,
2026
+ formElementMap: a,
2027
+ curdState: r,
2028
+ formColumns: c,
2029
+ getSignColumns: m,
2030
+ sendCurdEvent: f
2031
+ } = G(), b = B();
2032
+ n(ie(e.formMethods || [], b));
2033
+ const d = w(() => e.signName ? m(e.signName) : c.value), u = () => {
2034
+ var g;
2035
+ r.addAction = ye.NORMAL, (g = b.value) == null || g.submit();
2036
+ }, l = () => {
2037
+ var g;
2038
+ r.addAction = ye.CONTINUE, (g = b.value) == null || g.submit();
2039
+ }, p = [
2040
+ {
2041
+ value: V.RESET,
2042
+ label: "\u91CD\u7F6E"
2043
+ },
2044
+ {
2045
+ value: V.SUBMIT,
2046
+ label: "\u63D0\u4EA4",
2047
+ extraProps: {
2048
+ type: "primary"
2049
+ }
2050
+ },
2051
+ {
2052
+ value: V.CONTINUE,
2053
+ label: "\u786E\u5B9A\u5E76\u7EE7\u7EED",
2054
+ extraProps: {
2055
+ type: "primary"
2056
+ },
2057
+ show: !1
2058
+ }
2059
+ ], i = (g) => {
2060
+ s.onFinish || (r.mode === E.EDIT ? f({
2061
+ action: E.EDIT,
2062
+ type: A.EXECUTE,
2063
+ values: g
2064
+ }) : f({
2065
+ action: E.ADD,
2066
+ type: A.EXECUTE,
2067
+ values: g
2068
+ }));
2069
+ };
2070
+ return () => y(En, O({
2071
+ ref: b
2072
+ }, C(e, "operate"), {
2073
+ elementMap: e.elementMap || o,
2074
+ formElementMap: e.formElementMap || a,
2075
+ columns: e.columns || d.value,
2076
+ readonly: r.mode === E.DETAIL,
2077
+ model: e.model || r.detailData,
2078
+ hideRequiredMark: r.mode === E.DETAIL,
2079
+ operate: e.operate ? {
2080
+ items: p,
2081
+ onSubmit: u,
2082
+ onContinue: l,
2083
+ ...e.operate
2084
+ } : void 0,
2085
+ onFinish: i
2086
+ }), t);
2087
+ }
2088
+ }), hr = N(() => {
2089
+ const {
2090
+ formProps: e
2091
+ } = G();
2092
+ return () => y(je, C(e == null ? void 0 : e.value, "slots"), S(e == null ? void 0 : e.value, "slots"));
2093
+ }), qn = () => ({
2094
+ clsName: {
2095
+ type: String,
2096
+ default: "pro-curd-desc"
1368
2097
  },
1369
- serialNumber: {
1370
- type: Boolean
2098
+ signName: {
2099
+ type: String
2100
+ }
2101
+ }), Un = N({
2102
+ props: {
2103
+ ...qn()
1371
2104
  },
1372
- paginationState: {
1373
- type: Object
2105
+ setup: (e, {
2106
+ slots: t
2107
+ }) => {
2108
+ const {
2109
+ curdState: n,
2110
+ descColumns: s,
2111
+ getSignColumns: o
2112
+ } = G(), a = w(() => e.signName ? o(e.signName) : s.value);
2113
+ return () => y(Kn, O(C(e, "signName", "model", "columns"), {
2114
+ model: e.model || n.detailData,
2115
+ columns: a.value
2116
+ }), t);
2117
+ }
2118
+ }), gr = N(() => {
2119
+ const {
2120
+ descProps: e
2121
+ } = G();
2122
+ return () => y(Un, C(e == null ? void 0 : e.value, "slots"), S(e == null ? void 0 : e.value, "slots"));
2123
+ }), Xe = () => ({
2124
+ clsName: {
2125
+ type: String,
2126
+ default: "pro-curd-modal"
1374
2127
  },
1375
- provideExtra: {
1376
- type: Object
2128
+ validMode: {
2129
+ type: Array,
2130
+ default: [E.ADD, E.DETAIL, E.EDIT]
1377
2131
  }
1378
- }), an = (e, n, o) => L({
2132
+ }), Ct = N({
1379
2133
  props: {
1380
- ...e.props,
1381
- ...Ce,
1382
- ...n,
1383
- ...je()
2134
+ ...Xe()
1384
2135
  },
1385
- setup: (t, {
1386
- slots: u,
1387
- expose: r
2136
+ setup: (e, {
2137
+ slots: t
1388
2138
  }) => {
1389
- const {
1390
- elementMap: s
1391
- } = Le(), m = t.elementMap || s, y = () => ({
1392
- title: "\u5E8F\u53F7",
1393
- dataIndex: "serialNumber",
1394
- width: 80,
1395
- ...t.column,
1396
- customRender: ({
1397
- index: c
1398
- }) => {
1399
- var d, i;
1400
- return ((d = t.paginationState) == null ? void 0 : d.page) && ((i = t.paginationState) == null ? void 0 : i.pageSize) ? t.paginationState.pageSize * (t.paginationState.page - 1) + c + 1 : c + 1;
1401
- }
1402
- }), E = () => {
1403
- const c = t.operate, d = M(c.items, (h) => ({
1404
- ...h,
1405
- ...v(c.itemState, h.value)
1406
- })), i = ke(d, (h) => h.sort);
1407
- return {
1408
- ...t.column,
1409
- title: "\u64CD\u4F5C",
1410
- dataIndex: "operate",
1411
- fixed: "right",
1412
- ...c.column,
1413
- customRender: ({
1414
- record: h
1415
- }) => {
1416
- const p = G(i, (S) => S.show && H(S.show) ? S.show(h) : S.show !== !1);
1417
- return b("div", {
1418
- class: "pro-table-operate"
1419
- }, [M(p, (S) => H(S.element) ? S.element(h, S) : b("div", {
1420
- class: "pro-table-operate-item",
1421
- key: S.value,
1422
- onClick: () => {
1423
- var P;
1424
- (P = S.onClick) == null || P.call(S, h);
1425
- }
1426
- }, [S.label]))]);
1427
- }
1428
- };
1429
- }, l = w(() => {
1430
- const c = Ae(t.columns, t.columnState, (i) => i.dataIndex), d = M(c, (i) => {
1431
- const h = {
1432
- ...t.column,
1433
- ...i
1434
- };
1435
- return i.customRender || (h.customRender = ({
1436
- text: p
1437
- }) => $e(m, {
1438
- ...i,
1439
- showProps: {
1440
- ...i.showProps,
1441
- content: t.columnEmptyText
1442
- }
1443
- }, p) || p || t.columnEmptyText), h;
2139
+ const n = Q(), s = n(x.ModalKey), o = n(x.LoadingKey), {
2140
+ curdState: a,
2141
+ getOperate: r
2142
+ } = G(), c = () => {
2143
+ a.mode = void 0, Ye(a.detailData, {}), a.detailLoading = !1, a.addAction = void 0;
2144
+ }, m = F(Xe());
2145
+ return () => {
2146
+ var b;
2147
+ const f = a.mode;
2148
+ return !le(e.validMode, (d) => d === f) || !s ? null : y(s, O(C(e, m), {
2149
+ visible: le(e.validMode, (d) => d === f),
2150
+ title: e.title || ((b = r(a.mode)) == null ? void 0 : b.label),
2151
+ confirmLoading: a.operateLoading,
2152
+ maskClosable: a.mode === E.DETAIL,
2153
+ onCancel: c
2154
+ }), {
2155
+ default: () => {
2156
+ var d;
2157
+ return [a.detailLoading && o ? y(o, {
2158
+ loading: !0
2159
+ }, {
2160
+ default: () => [y("div", {
2161
+ class: `${e.clsName}-loading-dom`
2162
+ }, null)]
2163
+ }) : (d = t.default) == null ? void 0 : d.call(t)];
2164
+ },
2165
+ ...C(t, "default")
1444
2166
  });
1445
- return t.serialNumber && d.unshift(y()), t.operate && t.operate.items && ve(t.operate.items, (i) => i.show) && d.push(E()), d;
1446
- }), f = $();
1447
- Ft({
1448
- columns: l,
1449
- tableRef: f,
1450
- ...t.provideExtra
1451
- }), r(Y(o || [], f));
1452
- const a = k(je());
1453
- return () => b(e, R({
1454
- ref: f
1455
- }, C(t, a), {
1456
- columns: l.value
1457
- }), u);
2167
+ };
2168
+ }
2169
+ }), br = N({
2170
+ props: {
2171
+ modalProps: Object,
2172
+ formProps: Object
2173
+ },
2174
+ setup: (e, {
2175
+ slots: t
2176
+ }) => {
2177
+ const n = B(), s = re(t, "modal"), o = re(t, "form");
2178
+ return () => y(Ct, O(e.modalProps, {
2179
+ onOk: () => {
2180
+ var a;
2181
+ (a = n.value) == null || a.submit();
2182
+ }
2183
+ }), {
2184
+ default: () => [y(je, O({
2185
+ ref: n
2186
+ }, e.formProps), o)],
2187
+ ...s
2188
+ });
1458
2189
  }
2190
+ }), Sr = N(() => {
2191
+ const {
2192
+ modalProps: e,
2193
+ formProps: t
2194
+ } = G(), n = B();
2195
+ return () => y(Ct, O(C(e, "slots"), {
2196
+ onOk: () => {
2197
+ var s;
2198
+ (s = n.value) == null || s.submit();
2199
+ }
2200
+ }), {
2201
+ default: () => [y(je, O({
2202
+ ref: n
2203
+ }, C(t, "slots")), S(t, "slots"))],
2204
+ ...S(e, "slots")
2205
+ });
1459
2206
  });
1460
2207
  export {
1461
- T as CurdAction,
1462
- ae as CurdAddAction,
1463
- q as CurdCurrentMode,
1464
- _e as CurdMethods,
1465
- D as CurdSubAction,
1466
- zt as ProConfig,
1467
- le as ProCurd,
1468
- _t as ProModalCurd,
1469
- ye as ProModule,
1470
- Ht as ProPageCurd,
1471
- re as RequestAction,
1472
- me as SearchMode,
1473
- bt as Wrapper,
1474
- We as convertPathToList,
1475
- Jt as createCurdDesc,
1476
- Qt as createCurdForm,
1477
- Yt as createCurdList,
1478
- Y as createExpose,
1479
- Wt as createExposeObj,
1480
- en as createForm,
1481
- nn as createFormItemCompFn,
1482
- Zt as createFormList,
1483
- $t as createGrid,
1484
- Gt as createProConfig,
1485
- tn as createSearchForm,
1486
- an as createTable,
1487
- It as defaultPage,
1488
- te as getColumnFormItemName,
1489
- Be as getColumnValueType,
1490
- ht as getFirstPropName,
1491
- Pe as getFormItemEl,
1492
- $e as getItemEl,
1493
- Ct as getValidValues,
1494
- Ae as mergeStateToList,
1495
- Ce as proBaseProps,
1496
- Dt as provideProCurd,
1497
- Qe as provideProFormList,
1498
- Pt as provideProModule,
1499
- ne as renderElement,
1500
- Te as renderElements,
1501
- St as useComposeRequestActor,
1502
- Vt as useDoneRequestActor,
1503
- Xt as useFailedRequestActor,
1504
- De as useModuleEvent,
1505
- Le as useProConfig,
1506
- se as useProCurd,
1507
- Ze as useProForm,
1508
- Je as useProFormList,
1509
- ue as useProModule,
1510
- rn as useProTable
2208
+ E as CurdAction,
2209
+ ye as CurdAddAction,
2210
+ ae as CurdCurrentMode,
2211
+ Et as CurdMethods,
2212
+ A as CurdSubAction,
2213
+ x as ElementKeys,
2214
+ V as FormAction,
2215
+ sr as LogonUser,
2216
+ dt as LogonUserKey,
2217
+ ar as MustLogon,
2218
+ Ae as PageHeader,
2219
+ Jn as ProConfig,
2220
+ Te as ProCurd,
2221
+ Un as ProCurdDesc,
2222
+ gr as ProCurdDescConnect,
2223
+ je as ProCurdForm,
2224
+ hr as ProCurdFormConnect,
2225
+ xn as ProCurdList,
2226
+ yr as ProCurdListConnect,
2227
+ Ct as ProCurdModal,
2228
+ br as ProCurdModalForm,
2229
+ Sr as ProCurdModalFormConnect,
2230
+ Kn as ProDesc,
2231
+ En as ProForm,
2232
+ ur as ProFormList,
2233
+ Le as ProGrid,
2234
+ ze as ProList,
2235
+ fr as ProModalCurd,
2236
+ Oe as ProModule,
2237
+ St as ProOperate,
2238
+ mr as ProPage,
2239
+ pr as ProPageCurd,
2240
+ lr as ProSearchForm,
2241
+ dr as ProTable,
2242
+ pe as RequestAction,
2243
+ Ce as SearchMode,
2244
+ mn as Wrapper,
2245
+ mt as convertPathToList,
2246
+ un as convertResData,
2247
+ ie as createExpose,
2248
+ cr as createExposeObj,
2249
+ ir as createFormItemCompFn,
2250
+ Qn as createProConfig,
2251
+ An as defaultPage,
2252
+ re as filterSlotsByPrefix,
2253
+ ue as getColumnFormItemName,
2254
+ ot as getColumnValueType,
2255
+ dn as getFirstPropName,
2256
+ st as getFormItemEl,
2257
+ Fe as getItemEl,
2258
+ ft as getSignValue,
2259
+ bn as getValidValues,
2260
+ Ne as mergeStateToList,
2261
+ me as proBaseProps,
2262
+ wn as provideProCurd,
2263
+ ht as provideProFormList,
2264
+ fn as provideProModule,
2265
+ fe as renderElement,
2266
+ $e as renderElements,
2267
+ yn as useAccess,
2268
+ rr as useAccessMgr,
2269
+ cn as useComposeRequestActor,
2270
+ er as useDispatchMeta,
2271
+ tr as useDispatchStore,
2272
+ Yn as useDoneRequestActor,
2273
+ Zn as useFailedRequestActor,
2274
+ Q as useGetCompByKey,
2275
+ or as useLogonUser,
2276
+ ln as useMetaRegister,
2277
+ xe as useModuleEvent,
2278
+ ee as useProConfig,
2279
+ G as useProCurd,
2280
+ bt as useProForm,
2281
+ yt as useProFormList,
2282
+ ge as useProModule,
2283
+ Mn as useProTable,
2284
+ nr as useReadStore
1511
2285
  };