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