zhihao-ui 1.3.62 → 1.3.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { defineComponent as K, useModel as j, ref as E, computed as G, openBlock as s, createBlock as m, unref as u, withCtx as f, createVNode as R, mergeProps as J, createCommentVNode as x, createElementBlock as v, Fragment as A, renderList as Q, normalizeClass as S, toDisplayString as C, renderSlot as T, createTextVNode as D, createElementVNode as k, mergeModels as Y } from "vue";
1
+ import { defineComponent as K, useModel as j, ref as k, computed as G, openBlock as s, createBlock as m, unref as u, withCtx as f, createVNode as A, mergeProps as J, createCommentVNode as x, createElementBlock as v, Fragment as T, renderList as Q, normalizeClass as S, toDisplayString as C, renderSlot as D, createTextVNode as V, createElementVNode as b, mergeModels as Y } from "vue";
2
2
  import { D as F } from "./BaseItem-B_4mwWHs.js";
3
- import { m as V, e as N, n as ee, o as te, p as _, q as L, r as ae, s as I, b as U } from "./vendor-CbeG2C4c.js";
3
+ import { m as _, e as N, n as ee, o as te, p as $, q as L, r as ae, s as I, b as U } from "./vendor-CbeG2C4c.js";
4
4
  import { _ as oe } from "./Button-BFA52ivn.js";
5
5
  import { w as le } from "./utils-COxKH46Q.js";
6
6
  var w = /* @__PURE__ */ ((h) => (h.AUTOCOMPLETE = "autocomplete", h.FORMAT = "format", h.TEXT = "text", h.INDEX = "index", h))(w || {});
@@ -28,44 +28,44 @@ const re = { key: 0 }, de = {
28
28
  }),
29
29
  emits: ["update:rawData"],
30
30
  setup(h, { expose: q }) {
31
- const r = h, n = j(h, "rawData"), d = E([]), g = E({
31
+ const i = h, n = j(h, "rawData"), d = k([]), g = k({
32
32
  isShow: !0,
33
33
  width: 150,
34
34
  customAddRow: !0,
35
35
  addRowText: "增行",
36
36
  customAddColumn: !0,
37
37
  addColumnText: "增列"
38
- }), c = G(() => r.operationOption ? {
38
+ }), c = G(() => i.operationOption ? {
39
39
  ...g.value,
40
- ...r.operationOption || {}
40
+ ...i.operationOption || {}
41
41
  } : {
42
42
  ...g.value,
43
43
  // 兼容之前单个配置项
44
- customAddRow: r.customAddRow !== void 0 ? r.customAddRow : g.value.customAddRow,
45
- addRowText: r.addRowText !== void 0 ? r.addRowText : g.value.addRowText,
46
- customAddColumn: r.customAddColumn !== void 0 ? r.customAddColumn : g.value.customAddColumn,
47
- addColumnText: r.addColumnText !== void 0 ? r.addColumnText : g.value.addColumnText
48
- }), $ = () => {
49
- if (n.value.length === r.maxRowLength) {
50
- V({
51
- message: `最多添加${r.maxRowLength}行`,
44
+ customAddRow: i.customAddRow !== void 0 ? i.customAddRow : g.value.customAddRow,
45
+ addRowText: i.addRowText !== void 0 ? i.addRowText : g.value.addRowText,
46
+ customAddColumn: i.customAddColumn !== void 0 ? i.customAddColumn : g.value.customAddColumn,
47
+ addColumnText: i.addColumnText !== void 0 ? i.addColumnText : g.value.addColumnText
48
+ }), O = () => {
49
+ if (n.value.length === i.maxRowLength) {
50
+ _({
51
+ message: `最多添加${i.maxRowLength}行`,
52
52
  type: "warning"
53
53
  });
54
54
  return;
55
55
  }
56
56
  let t = {};
57
- r.beforeAddRow && (t = r.beforeAddRow(n.value)), n.value.push(t);
58
- }, O = () => {
59
- if (d.value.filter((e) => e.isAdd).length >= r.maxColLength) {
60
- V({
61
- message: `最多添加${r.maxColLength}列`,
57
+ i.beforeAddRow && (t = i.beforeAddRow(n.value)), n.value.push(t);
58
+ }, M = () => {
59
+ if (d.value.filter((e) => e.isAdd).length >= i.maxColLength) {
60
+ _({
61
+ message: `最多添加${i.maxColLength}列`,
62
62
  type: "warning"
63
63
  });
64
64
  return;
65
65
  }
66
- const o = String(Date.now());
66
+ const a = String(Date.now());
67
67
  d.value.push({
68
- prop: o,
68
+ prop: a,
69
69
  label: "",
70
70
  isEditHeader: !0,
71
71
  isAdd: !0,
@@ -74,21 +74,21 @@ const re = { key: 0 }, de = {
74
74
  headerMaxlength: 15,
75
75
  isNewlyColumn: !0
76
76
  });
77
- }, B = (t, o) => {
77
+ }, B = (t, a) => {
78
78
  d.value.splice(t, 1), n.value.forEach((e) => {
79
- delete e[o.prop];
79
+ delete e[a.prop];
80
80
  });
81
81
  }, W = (t) => {
82
- t === 0 && d.value.forEach((o) => {
83
- o.isSameData && (n.value[1][o.prop] = n.value[0][o.prop]);
82
+ t === 0 && d.value.forEach((a) => {
83
+ a.isSameData && (n.value[1][a.prop] = n.value[0][a.prop]);
84
84
  }), n.value.splice(t, 1);
85
- }, X = (t, o, e) => {
86
- o(
85
+ }, X = (t, a, e) => {
86
+ a(
87
87
  e.completeList.filter((l) => l.includes(t)).map((l) => ({ value: l }))
88
88
  );
89
89
  }, Z = (t) => [
90
90
  {
91
- validator: (o, e, l) => {
91
+ validator: (a, e, l) => {
92
92
  if (!d.value[t].label) {
93
93
  l(new Error("请输入表头"));
94
94
  return;
@@ -98,23 +98,23 @@ const re = { key: 0 }, de = {
98
98
  message: "请输入表头",
99
99
  trigger: ["blur", "change"]
100
100
  }
101
- ], z = (t, o, e) => {
101
+ ], z = (t, a, e) => {
102
102
  const l = [];
103
103
  return t.required && l.push({
104
104
  required: !0,
105
105
  message: t.requiredMessage || t.label + "不能为空",
106
106
  trigger: t.slot ? void 0 : "blur"
107
107
  }), t.varidate && l.push({
108
- validator: (a, i, p) => {
109
- const M = t.varidate(i, o, e);
110
- M !== !0 ? p(new Error(M)) : p();
108
+ validator: (o, r, p) => {
109
+ const E = t.varidate(r, a, e);
110
+ E !== !0 ? p(new Error(E)) : p();
111
111
  }
112
112
  // trigger: column.slot ? undefined : "blur",
113
113
  }), l;
114
- }, P = (t, o) => {
114
+ }, P = (t, a) => {
115
115
  let e = t;
116
- return o.isSameData && (e = n.value[0] || F), o.formatter ? o.showFormatter ? o.type === w.FORMAT ? o.showFormatter(o.formatter(e)) : o.showFormatter(e[o.prop]) : o.formatter(e[o.prop]) : e[o.prop] || F;
117
- }, b = E(), y = E({
116
+ return a.isSameData && (e = n.value[0] || F), a.formatter ? a.showFormatter ? a.type === w.FORMAT ? a.showFormatter(a.formatter(e)) : a.showFormatter(e[a.prop]) : a.formatter(e[a.prop]) : e[a.prop] || F;
117
+ }, R = k(), y = k({
118
118
  width: 132,
119
119
  type: w.INDEX,
120
120
  prop: "index",
@@ -125,24 +125,24 @@ const re = { key: 0 }, de = {
125
125
  });
126
126
  return q({
127
127
  /** 初始化数据 */
128
- initData: (t, o) => {
129
- const e = (o || []).find((l) => l.type === w.INDEX) || null;
130
- e && (y.value = { ...e, isShow: e.isShow !== !1 }), t = N(t) || [], t.length === 0 && t.push({}), o = [...o.filter((l) => l.type !== w.INDEX)], console.log("initData", t, o);
128
+ initData: (t, a) => {
129
+ const e = (a || []).find((l) => l.type === w.INDEX) || null;
130
+ e && (y.value = { ...e, isShow: e.isShow !== !1 }), t = N(t) || [], t.length === 0 && t.push({}), a = [...a.filter((l) => l.type !== w.INDEX)], console.log("initData", t, a);
131
131
  for (const l in t[0])
132
- if (!o.some(
133
- (a) => a.prop === l
132
+ if (!a.some(
133
+ (o) => o.prop === l
134
134
  )) {
135
- const a = Date.now() + l, i = l.split(H);
136
- if (i.length !== 2) {
135
+ const o = Date.now() + l, r = l.split(H);
136
+ if (r.length !== 2) {
137
137
  console.log("keySplit 失败", l);
138
138
  continue;
139
139
  }
140
- const p = Number(i[1]);
141
- o[p] = {
140
+ const p = Number(r[1]);
141
+ a[p] = {
142
142
  prop: l,
143
143
  isEditHeader: !0,
144
- label: i[0],
145
- key: a,
144
+ label: r[0],
145
+ key: o,
146
146
  isAdd: !0,
147
147
  maxlength: 15,
148
148
  headerMaxlength: 15,
@@ -150,16 +150,16 @@ const re = { key: 0 }, de = {
150
150
  isNewlyColumn: !1
151
151
  };
152
152
  }
153
- n.value = t, d.value = o.filter((l) => l);
153
+ n.value = t, d.value = a.filter((l) => l);
154
154
  },
155
155
  /** 获取数据 */
156
156
  getData: async () => {
157
- await b.value.validate();
158
- for (const o in d.value) {
159
- const e = d.value[o];
157
+ await R.value.validate();
158
+ for (const a in d.value) {
159
+ const e = d.value[a];
160
160
  for (const l of d.value)
161
161
  if (e.prop !== l.prop && e.label === l.label) {
162
- V({
162
+ _({
163
163
  message: "所有列的表头不可重复",
164
164
  type: "warning"
165
165
  });
@@ -167,19 +167,19 @@ const re = { key: 0 }, de = {
167
167
  }
168
168
  }
169
169
  const t = N(n.value);
170
- for (const o in t) {
171
- const e = t[o];
170
+ for (const a in t) {
171
+ const e = t[a];
172
172
  for (const l in d.value) {
173
- const a = d.value[l];
174
- if (a.isSameData && o !== "0" && (e[a.prop] = t[0][a.prop]), a.varidate && !a.varidate(e[a.prop], e, o))
173
+ const o = d.value[l];
174
+ if (o.isSameData && a !== "0" && (e[o.prop] = t[0][o.prop]), o.varidate && !o.varidate(e[o.prop], e, a))
175
175
  return;
176
- if (a.isAdd) {
177
- const i = e[a.prop];
178
- delete e[a.prop];
179
- const p = a.label + H + l;
180
- e[p] = i;
176
+ if (o.isAdd) {
177
+ const r = e[o.prop];
178
+ delete e[o.prop];
179
+ const p = o.label + H + l;
180
+ e[p] = r;
181
181
  }
182
- a.formatter && a.type === w.FORMAT && (e[a.prop] = a.formatter(e));
182
+ o.formatter && o.type === w.FORMAT && (e[o.prop] = o.formatter(e));
183
183
  }
184
184
  }
185
185
  return {
@@ -188,39 +188,39 @@ const re = { key: 0 }, de = {
188
188
  };
189
189
  },
190
190
  /** 更新列配置数据 */
191
- updateColumn: (t, o) => {
191
+ updateColumn: (t, a) => {
192
192
  const e = d.value[t].prop;
193
- if (d.value[t] = o, e !== o.prop)
193
+ if (d.value[t] = a, e !== a.prop)
194
194
  for (const l of n.value)
195
- l[o.prop] = l[e], delete l[e];
195
+ l[a.prop] = l[e], delete l[e];
196
196
  },
197
197
  /** 重置默认列配置数据 */
198
- resetColumns: (t) => {
199
- const e = d.value.filter((a) => !a.isAdd).reduce((a, i) => (t.some((p) => p.prop === i.prop) || a.push(i.prop), a), []);
200
- n.value.forEach((a) => {
201
- e.forEach((i) => {
202
- delete a[i];
198
+ resetColumns: (t, a = !1) => {
199
+ const l = d.value.filter((r) => !r.isAdd).reduce((r, p) => (t.some((E) => E.prop === p.prop) || r.push(p.prop), r), []);
200
+ n.value.forEach((r) => {
201
+ l.forEach((p) => {
202
+ delete r[p];
203
203
  });
204
204
  });
205
- const l = t.filter((a) => a.isAdd);
206
- d.value = [...t, ...l];
205
+ const o = d.value.filter((r) => r.isAdd);
206
+ a ? d.value = [...t] : d.value = [...t, ...o];
207
207
  },
208
- onAddRow: $,
209
- onAddColumn: O,
208
+ onAddRow: O,
209
+ onAddColumn: M,
210
210
  // 导出formRef
211
- formRef: b,
211
+ formRef: R,
212
212
  // 导出columns
213
213
  getColumns: () => d.value
214
- }), (t, o) => (s(), m(u(ee), {
214
+ }), (t, a) => (s(), m(u(ee), {
215
215
  class: "diy-data-table",
216
216
  model: h.rawData,
217
217
  ref_key: "formRef",
218
- ref: b
218
+ ref: R
219
219
  }, {
220
220
  default: f(() => [
221
- R(u(te), J({ data: n.value }, t.$attrs), {
221
+ A(u(te), J({ data: n.value }, t.$attrs), {
222
222
  default: f(() => [
223
- y.value.isShow ? (s(), m(u(_), {
223
+ y.value.isShow ? (s(), m(u($), {
224
224
  key: 0,
225
225
  type: y.value.type,
226
226
  label: y.value.label,
@@ -228,7 +228,7 @@ const re = { key: 0 }, de = {
228
228
  minWidth: y.value.minWidth,
229
229
  fixed: y.value.fixed
230
230
  }, null, 8, ["type", "label", "width", "minWidth", "fixed"])) : x("", !0),
231
- (s(!0), v(A, null, Q(d.value, (e, l) => (s(), m(u(_), {
231
+ (s(!0), v(T, null, Q(d.value, (e, l) => (s(), m(u($), {
232
232
  key: e.key || l,
233
233
  prop: e.prop,
234
234
  label: e.label,
@@ -238,14 +238,14 @@ const re = { key: 0 }, de = {
238
238
  }, {
239
239
  header: f(() => [
240
240
  t.isEdit ? e.isEditHeader && t.canOnlyEditNewlyColumnHeader && e.isNewlyColumn || e.isEditHeader && !t.canOnlyEditNewlyColumnHeader ? (s(), v("div", de, [
241
- R(u(L), {
241
+ A(u(L), {
242
242
  prop: `columns.${l}`,
243
243
  rules: Z(l)
244
244
  }, {
245
245
  default: f(() => [
246
- R(u(I), {
246
+ A(u(I), {
247
247
  modelValue: e.label,
248
- "onUpdate:modelValue": (a) => e.label = a,
248
+ "onUpdate:modelValue": (o) => e.label = o,
249
249
  maxlength: e.headerMaxlength || 20,
250
250
  placeholder: "请输入表头"
251
251
  }, null, 8, ["modelValue", "onUpdate:modelValue", "maxlength"])
@@ -255,38 +255,38 @@ const re = { key: 0 }, de = {
255
255
  e.isAdd ? (s(), v("i", {
256
256
  key: 0,
257
257
  class: "iconfont icon-close",
258
- onClick: (a) => B(l, e)
258
+ onClick: (o) => B(l, e)
259
259
  }, null, 8, ie)) : x("", !0)
260
260
  ])) : (s(), v("div", {
261
261
  key: 2,
262
262
  class: S({ "is-required-label": e.required })
263
263
  }, C(e.label), 3)) : (s(), v("div", re, C(e.label), 1))
264
264
  ]),
265
- default: f((a) => [
266
- r.isEdit && (!e.isSameData || a.$index === 0) && e.type !== u(w).TEXT && !a.row.disabled ? (s(), m(u(L), {
265
+ default: f((o) => [
266
+ i.isEdit && (!e.isSameData || o.$index === 0) && e.type !== u(w).TEXT && !o.row.disabled ? (s(), m(u(L), {
267
267
  key: 0,
268
- prop: `${a.$index}.${e.prop}`,
269
- rules: z(e, a.row, a.$index),
268
+ prop: `${o.$index}.${e.prop}`,
269
+ rules: z(e, o.row, o.$index),
270
270
  class: S(["col-edit-container", { "close-padding": e.isAdd }])
271
271
  }, {
272
272
  default: f(() => [
273
273
  e.type === u(w).FORMAT && e.formatter ? (s(), v("div", se, C(e.showFormatter ? e.showFormatter(
274
- e.formatter(a.row)
275
- ) : e.formatter(a.row)), 1)) : e.type === u(w).AUTOCOMPLETE ? (s(), m(u(ae), {
274
+ e.formatter(o.row)
275
+ ) : e.formatter(o.row)), 1)) : e.type === u(w).AUTOCOMPLETE ? (s(), m(u(ae), {
276
276
  key: 1,
277
- modelValue: a.row[e.prop],
278
- "onUpdate:modelValue": (i) => a.row[e.prop] = i,
277
+ modelValue: o.row[e.prop],
278
+ "onUpdate:modelValue": (r) => o.row[e.prop] = r,
279
279
  placeholder: e.placeholder || "请输入",
280
- "fetch-suggestions": (i, p) => X(i, p, e),
280
+ "fetch-suggestions": (r, p) => X(r, p, e),
281
281
  maxlength: e.maxlength || 20
282
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "fetch-suggestions", "maxlength"])) : e.slot ? T(t.$slots, e.slot, {
282
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "fetch-suggestions", "maxlength"])) : e.slot ? D(t.$slots, e.slot, {
283
283
  key: 2,
284
- row: a.row,
285
- $index: a.$index
284
+ row: o.row,
285
+ $index: o.$index
286
286
  }, void 0, !0) : (s(), m(u(I), {
287
287
  key: 3,
288
- modelValue: a.row[e.prop],
289
- "onUpdate:modelValue": (i) => a.row[e.prop] = i,
288
+ modelValue: o.row[e.prop],
289
+ "onUpdate:modelValue": (r) => o.row[e.prop] = r,
290
290
  placeholder: e.placeholder || "请输入",
291
291
  formatter: e.formatter,
292
292
  parser: e.parser,
@@ -295,32 +295,32 @@ const re = { key: 0 }, de = {
295
295
  }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "formatter", "parser", "maxlength", "show-word-limit"]))
296
296
  ]),
297
297
  _: 2
298
- }, 1032, ["prop", "rules", "class"])) : e.slot ? T(t.$slots, e.slot, {
298
+ }, 1032, ["prop", "rules", "class"])) : e.slot ? D(t.$slots, e.slot, {
299
299
  key: 1,
300
- row: a.row,
301
- $index: a.$index
302
- }, void 0, !0) : (s(), v(A, { key: 2 }, [
303
- D(C(P(a.row, e)), 1)
300
+ row: o.row,
301
+ $index: o.$index
302
+ }, void 0, !0) : (s(), v(T, { key: 2 }, [
303
+ V(C(P(o.row, e)), 1)
304
304
  ], 64))
305
305
  ]),
306
306
  _: 2
307
307
  }, 1032, ["prop", "label", "width", "min-width", "fixed"]))), 128)),
308
- r.isEdit && c.value.isShow ? (s(), m(u(_), {
308
+ i.isEdit && c.value.isShow ? (s(), m(u($), {
309
309
  key: 1,
310
310
  width: c.value.width,
311
311
  fixed: "right"
312
312
  }, {
313
313
  header: f(() => [
314
- k("div", ne, [
314
+ b("div", ne, [
315
315
  c.value.customAddRow ? (s(), m(u(U), {
316
316
  key: 0,
317
317
  type: "primary",
318
318
  link: "",
319
- onClick: $
319
+ onClick: O
320
320
  }, {
321
321
  default: f(() => [
322
- o[0] || (o[0] = k("i", { class: "iconfont icon-Frame1" }, null, -1)),
323
- D(C(c.value.addRowText), 1)
322
+ a[0] || (a[0] = b("i", { class: "iconfont icon-Frame1" }, null, -1)),
323
+ V(C(c.value.addRowText), 1)
324
324
  ]),
325
325
  _: 1
326
326
  })) : x("", !0),
@@ -328,27 +328,27 @@ const re = { key: 0 }, de = {
328
328
  key: 1,
329
329
  type: "primary",
330
330
  link: "",
331
- onClick: O
331
+ onClick: M
332
332
  }, {
333
333
  default: f(() => [
334
- o[1] || (o[1] = k("i", { class: "iconfont icon-Frame-11" }, null, -1)),
335
- D(C(c.value.addColumnText), 1)
334
+ a[1] || (a[1] = b("i", { class: "iconfont icon-Frame-11" }, null, -1)),
335
+ V(C(c.value.addColumnText), 1)
336
336
  ]),
337
337
  _: 1
338
338
  })) : x("", !0)
339
339
  ])
340
340
  ]),
341
341
  default: f(({ $index: e, row: l }) => [
342
- k("div", ue, [
343
- t.$slots.operation ? T(t.$slots, "operation", {
342
+ b("div", ue, [
343
+ t.$slots.operation ? D(t.$slots, "operation", {
344
344
  key: 0,
345
345
  row: n.value[e],
346
346
  $index: e
347
- }, void 0, !0) : (s(), v(A, { key: 1 }, [
347
+ }, void 0, !0) : (s(), v(T, { key: 1 }, [
348
348
  n.value.length > 1 && !l.disabled ? (s(), v("i", {
349
349
  key: 0,
350
350
  class: "iconfont icon-close",
351
- onClick: (a) => W(e)
351
+ onClick: (o) => W(e)
352
352
  }, null, 8, pe)) : x("", !0)
353
353
  ], 64))
354
354
  ])
@@ -362,7 +362,7 @@ const re = { key: 0 }, de = {
362
362
  _: 3
363
363
  }, 8, ["model"]));
364
364
  }
365
- }), he = /* @__PURE__ */ oe(fe, [["__scopeId", "data-v-de69ead8"]]), ce = le(he);
365
+ }), he = /* @__PURE__ */ oe(fe, [["__scopeId", "data-v-7618ed5a"]]), ce = le(he);
366
366
  export {
367
367
  w as D,
368
368
  ce as Z
package/dist/es/index.js CHANGED
@@ -15,8 +15,8 @@ import { Z as V } from "./PageHeadPanel-BV5qQLDj.js";
15
15
  import { Z as D } from "./ToolTips-B9Z_U4WM.js";
16
16
  import { Z as x } from "./BaseInfo-aiVRbjTP.js";
17
17
  import { Z as b } from "./DetailHeader-pQXMyG5I.js";
18
- import { Z as P } from "./DiyDataTable-Bt-ZrRFy.js";
19
- import { D as $ } from "./DiyDataTable-Bt-ZrRFy.js";
18
+ import { Z as P } from "./DiyDataTable-BzNrVInw.js";
19
+ import { D as $ } from "./DiyDataTable-BzNrVInw.js";
20
20
  import { Z as T } from "./Map-JC-tR-ga.js";
21
21
  import { Z as c } from "./Table-D49FFXP7.js";
22
22
  import { Z as ro } from "./BaseItem-B_4mwWHs.js";