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