zhihao-ui 1.2.24 → 1.2.25

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