zhihao-ui 1.2.16 → 1.2.17

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,9 +1,9 @@
1
- import { defineComponent as H, useModel as N, ref as w, openBlock as s, createBlock as g, unref as o, withCtx as p, createVNode as c, createElementBlock as f, Fragment as W, renderList as Z, normalizeClass as E, toDisplayString as m, renderSlot as D, createCommentVNode as x, createElementVNode as y, createTextVNode as V, mergeModels as z } from "vue";
2
- import { D as X } from "./DatePicker-vGQGWrmB.js";
3
- import { d as k, e as $, f as j, g as K, i as _, j as C, k as P, l as T, E as M } from "./vendor-AIl6iHcE.js";
1
+ import { defineComponent as H, useModel as N, ref as b, openBlock as d, createBlock as g, unref as s, withCtx as p, createVNode as v, createElementBlock as f, Fragment as W, renderList as Z, normalizeClass as D, toDisplayString as m, renderSlot as C, createCommentVNode as k, createElementVNode as y, createTextVNode as V, mergeModels as z } from "vue";
2
+ import { D as P } from "./DatePicker-vGQGWrmB.js";
3
+ import { d as E, e as $, f as X, g as j, i as _, j as T, k as K, l as M, E as A } from "./vendor-AIl6iHcE.js";
4
4
  import { _ as G } from "./Button-OpzeoolK.js";
5
5
  import { w as J } from "./utils-CbI5IWJJ.js";
6
- var v = /* @__PURE__ */ ((u) => (u.AUTOCOMPLETE = "autocomplete", u.FORMAT = "format", u.TEXT = "text", u))(v || {});
6
+ var c = /* @__PURE__ */ ((u) => (u.AUTOCOMPLETE = "autocomplete", u.FORMAT = "format", u.TEXT = "text", u))(c || {});
7
7
  const Q = { key: 0 }, Y = {
8
8
  key: 1,
9
9
  class: "col-edit-header"
@@ -21,25 +21,25 @@ const Q = { key: 0 }, Y = {
21
21
  }),
22
22
  emits: ["update:rawData"],
23
23
  setup(u, { expose: R }) {
24
- const h = u, n = N(u, "rawData"), i = w([]), A = () => {
24
+ const h = u, n = N(u, "rawData"), o = b([]), U = () => {
25
25
  if (n.value.length === h.maxRowLength) {
26
- k({
26
+ E({
27
27
  message: `最多添加${h.maxRowLength}行`,
28
28
  type: "warning"
29
29
  });
30
30
  return;
31
31
  }
32
32
  n.value.push({});
33
- }, U = () => {
34
- if (i.value.filter((e) => e.isAdd).length >= h.maxColLength) {
35
- k({
33
+ }, F = () => {
34
+ if (o.value.filter((e) => e.isAdd).length >= h.maxColLength) {
35
+ E({
36
36
  message: `最多添加${h.maxColLength}列`,
37
37
  type: "warning"
38
38
  });
39
39
  return;
40
40
  }
41
41
  const l = String(Date.now());
42
- i.value.push({
42
+ o.value.push({
43
43
  prop: l,
44
44
  label: "",
45
45
  isEditHeader: !0,
@@ -48,20 +48,20 @@ const Q = { key: 0 }, Y = {
48
48
  minWidth: 150,
49
49
  headerMaxlength: 15
50
50
  });
51
- }, F = (t, l) => {
52
- i.value.splice(t, 1), n.value.forEach((e) => {
51
+ }, S = (a, l) => {
52
+ o.value.splice(a, 1), n.value.forEach((e) => {
53
53
  delete e[l.prop];
54
54
  });
55
- }, S = (t) => {
56
- n.value.splice(t, 1);
57
- }, O = (t, l, e) => {
55
+ }, I = (a) => {
56
+ n.value.splice(a, 1);
57
+ }, O = (a, l, e) => {
58
58
  l(
59
- e.completeList.filter((r) => r.includes(t)).map((r) => ({ value: r }))
59
+ e.completeList.filter((r) => r.includes(a)).map((r) => ({ value: r }))
60
60
  );
61
- }, q = (t) => [
61
+ }, q = (a) => [
62
62
  {
63
63
  validator: (l, e, r) => {
64
- if (!i.value[t].label) {
64
+ if (!o.value[a].label) {
65
65
  r(new Error("请输入表头"));
66
66
  return;
67
67
  }
@@ -70,158 +70,169 @@ const Q = { key: 0 }, Y = {
70
70
  message: "请输入表头",
71
71
  trigger: ["blur", "change"]
72
72
  }
73
- ], I = (t) => {
73
+ ], B = (a) => {
74
74
  const l = [];
75
- return t.required && l.push({
75
+ return a.required && l.push({
76
76
  required: !0,
77
- message: "请输入" + t.label,
78
- trigger: t.slot ? void 0 : "blur"
79
- }), t.varidate && l.push({
80
- validator: (e, r, a) => {
81
- const d = t.varidate(r);
82
- d !== !0 ? a(new Error(d)) : a();
77
+ message: "请输入" + a.label,
78
+ trigger: a.slot ? void 0 : "blur"
79
+ }), a.varidate && l.push({
80
+ validator: (e, r, t) => {
81
+ const i = a.varidate(r);
82
+ i !== !0 ? t(new Error(i)) : t();
83
83
  },
84
- trigger: t.slot ? void 0 : "blur"
84
+ trigger: a.slot ? void 0 : "blur"
85
85
  }), l;
86
- }, b = w();
86
+ }, w = b();
87
87
  return R({
88
88
  /** 初始化数据 */
89
- initData: (t, l) => {
90
- console.log("initData", t, l), t = $(t) || [], t.length === 0 && t.push({}), l = [...l];
91
- for (const e in t[0])
89
+ initData: (a, l) => {
90
+ console.log("initData", a, l), a = $(a) || [], a.length === 0 && a.push({}), l = [...l];
91
+ for (const e in a[0])
92
92
  if (!l.some(
93
93
  (r) => r.prop === e
94
94
  )) {
95
- const r = Date.now() + e, a = e.split(L);
96
- if (a.length !== 2) {
95
+ const r = Date.now() + e, t = e.split(L);
96
+ if (t.length !== 2) {
97
97
  console.log("keySplit 失败", e);
98
98
  continue;
99
99
  }
100
- const d = Number(a[1]);
101
- l[d] = {
100
+ const i = Number(t[1]);
101
+ l[i] = {
102
102
  prop: e,
103
103
  isEditHeader: !0,
104
- label: a[0],
104
+ label: t[0],
105
105
  key: r,
106
106
  isAdd: !0,
107
107
  maxlength: 15,
108
108
  headerMaxlength: 15
109
109
  };
110
110
  }
111
- n.value = t, i.value = l;
111
+ n.value = a, o.value = l;
112
112
  },
113
113
  /** 获取数据 */
114
114
  getData: async () => {
115
- await b.value.validate();
116
- for (const l in i.value) {
117
- const e = i.value[l];
118
- for (const r of i.value)
115
+ await w.value.validate();
116
+ for (const l in o.value) {
117
+ const e = o.value[l];
118
+ for (const r of o.value)
119
119
  if (e.prop !== r.prop && e.label === r.label) {
120
- k({
120
+ E({
121
121
  message: "所有列的表头不可重复",
122
122
  type: "warning"
123
123
  });
124
124
  return;
125
125
  }
126
126
  }
127
- const t = $(n.value);
128
- for (const l in t) {
129
- const e = t[l];
130
- for (const r in i.value) {
131
- const a = i.value[r];
132
- if (a.isSameData && l !== "0" && (e[a.prop] = t[0][a.prop]), a.varidate && !a.varidate(e[a.prop]))
127
+ const a = $(n.value);
128
+ for (const l in a) {
129
+ const e = a[l];
130
+ for (const r in o.value) {
131
+ const t = o.value[r];
132
+ if (t.isSameData && l !== "0" && (e[t.prop] = a[0][t.prop]), t.varidate && !t.varidate(e[t.prop]))
133
133
  return;
134
- if (a.isAdd) {
135
- const d = a.label + L + r;
136
- e[d] = e[a.prop], delete e[a.prop];
134
+ if (t.isAdd) {
135
+ const i = t.label + L + r;
136
+ e[i] = e[t.prop], delete e[t.prop];
137
137
  }
138
- a.formatter && a.type === v.FORMAT && (e[a.prop] = a.formatter(e));
138
+ t.formatter && t.type === c.FORMAT && (e[t.prop] = t.formatter(e));
139
139
  }
140
140
  }
141
- return console.log("DiyDataTable 获取数据", t, i.value), {
142
- data: t,
143
- columns: i.value
141
+ return console.log("DiyDataTable 获取数据", a, o.value), {
142
+ data: a,
143
+ columns: o.value
144
144
  };
145
145
  },
146
146
  /** 更新列配置数据 */
147
- updateColumn: (t, l) => {
148
- const e = i.value[t].prop;
149
- if (i.value[t] = l, e !== l.prop)
147
+ updateColumn: (a, l) => {
148
+ const e = o.value[a].prop;
149
+ if (o.value[a] = l, e !== l.prop)
150
150
  for (const r of n.value)
151
151
  r[l.prop] = r[e], delete r[e];
152
+ },
153
+ /** 重置列配置数据 */
154
+ resetColumns: (a) => {
155
+ const e = o.value.filter((t) => !t.isAdd).reduce((t, i) => (a.some((x) => x.prop === i.prop) || t.push(i.prop), t), []);
156
+ n.value.forEach((t) => {
157
+ e.forEach((i) => {
158
+ delete t[i];
159
+ });
160
+ });
161
+ const r = a.filter((t) => t.isAdd);
162
+ o.value = [...a, ...r];
152
163
  }
153
- }), (t, l) => (s(), g(o(j), {
164
+ }), (a, l) => (d(), g(s(X), {
154
165
  class: "diy-data-table",
155
166
  model: u.rawData,
156
167
  ref_key: "formRef",
157
- ref: b
168
+ ref: w
158
169
  }, {
159
170
  default: p(() => [
160
- c(o(K), { data: n.value }, {
171
+ v(s(j), { data: n.value }, {
161
172
  default: p(() => [
162
- c(o(_), {
173
+ v(s(_), {
163
174
  type: "index",
164
175
  label: "序号",
165
176
  width: "132",
166
177
  fixed: "left"
167
178
  }),
168
- (s(!0), f(W, null, Z(i.value, (e, r) => (s(), g(o(_), {
179
+ (d(!0), f(W, null, Z(o.value, (e, r) => (d(), g(s(_), {
169
180
  key: e.key || r,
170
181
  prop: e.prop,
171
182
  label: e.label,
172
183
  width: e.width,
173
- "min-width": e.minWidth || t.defaultMinWidth,
184
+ "min-width": e.minWidth || a.defaultMinWidth,
174
185
  fixed: e.fixed
175
186
  }, {
176
187
  header: p(() => [
177
- t.isEdit ? e.isEditHeader ? (s(), f("div", Y, [
178
- c(o(C), {
188
+ a.isEdit ? e.isEditHeader ? (d(), f("div", Y, [
189
+ v(s(T), {
179
190
  prop: `columns.${r}`,
180
191
  rules: q(r)
181
192
  }, {
182
193
  default: p(() => [
183
- c(o(T), {
194
+ v(s(M), {
184
195
  modelValue: e.label,
185
- "onUpdate:modelValue": (a) => e.label = a,
196
+ "onUpdate:modelValue": (t) => e.label = t,
186
197
  maxlength: e.headerMaxlength || 20,
187
198
  placeholder: "请输入表头"
188
199
  }, null, 8, ["modelValue", "onUpdate:modelValue", "maxlength"])
189
200
  ]),
190
201
  _: 2
191
202
  }, 1032, ["prop", "rules"]),
192
- e.isAdd ? (s(), f("i", {
203
+ e.isAdd ? (d(), f("i", {
193
204
  key: 0,
194
205
  class: "iconfont icon-close",
195
- onClick: (a) => F(r, e)
196
- }, null, 8, ee)) : x("", !0)
197
- ])) : (s(), f("div", {
206
+ onClick: (t) => S(r, e)
207
+ }, null, 8, ee)) : k("", !0)
208
+ ])) : (d(), f("div", {
198
209
  key: 2,
199
- class: E({ "is-required-label": e.required })
200
- }, m(e.label), 3)) : (s(), f("div", Q, m(e.label), 1))
210
+ class: D({ "is-required-label": e.required })
211
+ }, m(e.label), 3)) : (d(), f("div", Q, m(e.label), 1))
201
212
  ]),
202
- default: p((a) => [
203
- h.isEdit && (!e.isSameData || a.$index === 0) && e.type !== o(v).TEXT ? (s(), g(o(C), {
213
+ default: p((t) => [
214
+ h.isEdit && (!e.isSameData || t.$index === 0) && e.type !== s(c).TEXT ? (d(), g(s(T), {
204
215
  key: 0,
205
- prop: `${a.$index}.${e.prop}`,
206
- rules: I(e),
207
- class: E(["col-edit-container", { "close-padding": e.isAdd }])
216
+ prop: `${t.$index}.${e.prop}`,
217
+ rules: B(e),
218
+ class: D(["col-edit-container", { "close-padding": e.isAdd }])
208
219
  }, {
209
220
  default: p(() => [
210
- e.type === o(v).FORMAT && e.formatter ? (s(), f("div", te, m(e.formatter(a.row)), 1)) : e.type === o(v).AUTOCOMPLETE ? (s(), g(o(P), {
221
+ e.type === s(c).FORMAT && e.formatter ? (d(), f("div", te, m(e.formatter(t.row)), 1)) : e.type === s(c).AUTOCOMPLETE ? (d(), g(s(K), {
211
222
  key: 1,
212
- modelValue: a.row[e.prop],
213
- "onUpdate:modelValue": (d) => a.row[e.prop] = d,
223
+ modelValue: t.row[e.prop],
224
+ "onUpdate:modelValue": (i) => t.row[e.prop] = i,
214
225
  placeholder: e.placeholder || "请输入",
215
- "fetch-suggestions": (d, B) => O(d, B, e),
226
+ "fetch-suggestions": (i, x) => O(i, x, e),
216
227
  maxlength: e.maxlength || 20
217
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "fetch-suggestions", "maxlength"])) : e.slot ? D(t.$slots, e.slot, {
228
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "fetch-suggestions", "maxlength"])) : e.slot ? C(a.$slots, e.slot, {
218
229
  key: 2,
219
- row: a.row,
220
- $index: a.$index
221
- }, void 0, !0) : (s(), g(o(T), {
230
+ row: t.row,
231
+ $index: t.$index
232
+ }, void 0, !0) : (d(), g(s(M), {
222
233
  key: 3,
223
- modelValue: a.row[e.prop],
224
- "onUpdate:modelValue": (d) => a.row[e.prop] = d,
234
+ modelValue: t.row[e.prop],
235
+ "onUpdate:modelValue": (i) => t.row[e.prop] = i,
225
236
  placeholder: e.placeholder || "请输入",
226
237
  formatter: e.formatter,
227
238
  parser: e.parser,
@@ -229,25 +240,25 @@ const Q = { key: 0 }, Y = {
229
240
  }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "formatter", "parser", "maxlength"]))
230
241
  ]),
231
242
  _: 2
232
- }, 1032, ["prop", "rules", "class"])) : e.slot ? D(t.$slots, e.slot, {
243
+ }, 1032, ["prop", "rules", "class"])) : e.slot ? C(a.$slots, e.slot, {
233
244
  key: 1,
234
- row: a.row,
235
- $index: a.$index
236
- }, void 0, !0) : (s(), f("div", ae, m((e.isSameData ? n.value[0][e.prop] : a.row[e.prop]) || o(X)), 1))
245
+ row: t.row,
246
+ $index: t.$index
247
+ }, void 0, !0) : (d(), f("div", ae, m((e.isSameData ? n.value[0][e.prop] : t.row[e.prop]) || s(P)), 1))
237
248
  ]),
238
249
  _: 2
239
250
  }, 1032, ["prop", "label", "width", "min-width", "fixed"]))), 128)),
240
- h.isEdit ? (s(), g(o(_), {
251
+ h.isEdit ? (d(), g(s(_), {
241
252
  key: 0,
242
253
  width: "150",
243
254
  fixed: "right"
244
255
  }, {
245
256
  header: p(() => [
246
257
  y("div", le, [
247
- c(o(M), {
258
+ v(s(A), {
248
259
  type: "primary",
249
260
  link: "",
250
- onClick: A
261
+ onClick: U
251
262
  }, {
252
263
  default: p(() => l[0] || (l[0] = [
253
264
  y("i", { class: "iconfont icon-Frame1" }, null, -1),
@@ -255,10 +266,10 @@ const Q = { key: 0 }, Y = {
255
266
  ])),
256
267
  _: 1
257
268
  }),
258
- c(o(M), {
269
+ v(s(A), {
259
270
  type: "primary",
260
271
  link: "",
261
- onClick: U
272
+ onClick: F
262
273
  }, {
263
274
  default: p(() => l[1] || (l[1] = [
264
275
  y("i", { class: "iconfont icon-Frame-11" }, null, -1),
@@ -270,15 +281,15 @@ const Q = { key: 0 }, Y = {
270
281
  ]),
271
282
  default: p(({ $index: e }) => [
272
283
  y("div", re, [
273
- n.value.length > 1 ? (s(), f("i", {
284
+ n.value.length > 1 ? (d(), f("i", {
274
285
  key: 0,
275
286
  class: "iconfont icon-close",
276
- onClick: (r) => S(e)
277
- }, null, 8, oe)) : x("", !0)
287
+ onClick: (r) => I(e)
288
+ }, null, 8, oe)) : k("", !0)
278
289
  ])
279
290
  ]),
280
291
  _: 1
281
- })) : x("", !0)
292
+ })) : k("", !0)
282
293
  ]),
283
294
  _: 3
284
295
  }, 8, ["data"])
@@ -286,8 +297,8 @@ const Q = { key: 0 }, Y = {
286
297
  _: 3
287
298
  }, 8, ["model"]));
288
299
  }
289
- }), se = /* @__PURE__ */ G(ie, [["__scopeId", "data-v-eecb97af"]]), he = J(se);
300
+ }), se = /* @__PURE__ */ G(ie, [["__scopeId", "data-v-a77561c1"]]), he = J(se);
290
301
  export {
291
- v as D,
302
+ c as D,
292
303
  he as Z
293
304
  };
package/dist/es/index.js CHANGED
@@ -15,8 +15,8 @@ import { Z as D } from "./PageHeadPanel-CAVlNQj7.js";
15
15
  import { Z as I } from "./ToolTips-B1YUKWTm.js";
16
16
  import { Z as T } from "./BaseInfo-Dr298ctb.js";
17
17
  import { Z as d } from "./DetailHeader-Dy_GLl1j.js";
18
- import { Z as P } from "./DiyDataTable-C0um1VNh.js";
19
- import { D as K } from "./DiyDataTable-C0um1VNh.js";
18
+ import { Z as P } from "./DiyDataTable-BzYgTozd.js";
19
+ import { D as K } from "./DiyDataTable-BzYgTozd.js";
20
20
  import { Z as b } from "./Map-f7AQFEm9.js";
21
21
  import { Z as c } from "./Table-B786GVKD.js";
22
22
  const g = [