zhihao-ui 1.3.53 → 1.3.55
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/{BaseInfo-BZ34efZZ.js → BaseInfo-Bz9HbxrR.js} +1 -1
- package/dist/es/{BaseItem-DxfKmzHN.js → BaseItem-YGnpIugn.js} +3 -3
- package/dist/es/{Button-ByWikGvS.js → Button-DSjKm2wO.js} +4 -4
- package/dist/es/CascaderLoadMore-BwYi7PBx.js +287 -0
- package/dist/es/{DatePicker-BS2zGuNF.js → DatePicker-BkKUo2v1.js} +3 -3
- package/dist/es/{DetailHeader-Bdjj2rT_.js → DetailHeader-lzEy7t5Y.js} +3 -3
- package/dist/es/{DetailSubTitle-oDZVGEDj.js → DetailSubTitle-DfqGXyKI.js} +2 -2
- package/dist/es/{Dialog-6oittA9s.js → Dialog-MVXB7s2S.js} +3 -3
- package/dist/es/DiyDataTable-Yp1HvbS1.js +367 -0
- package/dist/es/{EditInfoPair-CZXKGl2-.js → EditInfoPair-BXF1tV3S.js} +3 -3
- package/dist/es/{FileWrapper-B4nZf2F1.js → FileWrapper-CqbiXynu.js} +4 -4
- package/dist/es/{Grid-anvIeL2d.js → Grid-CDS9IrCA.js} +2 -2
- package/dist/es/{InfoPair-C6PjunKe.js → InfoPair-jRjF91Ro.js} +3 -3
- package/dist/es/{Input-v0wMSltt.js → Input-CJadFglX.js} +3 -3
- package/dist/es/{Loading-C86LqgY4.js → Loading-C9Te67Gr.js} +2 -2
- package/dist/es/Map-BoN5eeEB.js +2326 -0
- package/dist/es/{MessageBox-Mt0l51rJ.js → MessageBox-BzwToZ0E.js} +2 -2
- package/dist/es/{MoneyInput-DU9wly48.js → MoneyInput-oY4Jr4Du.js} +5 -5
- package/dist/es/{PageHeadPanel-CJNtdEZb.js → PageHeadPanel-oLoxYR29.js} +2 -2
- package/dist/es/Table-BU_pHf2Y.js +1180 -0
- package/dist/es/{ToolTips-DtkJa3Ld.js → ToolTips-H93PrmYL.js} +3 -3
- package/dist/es/index.js +23 -23
- package/dist/es/{utils-BXhGHET2.js → utils-DRDkj6ga.js} +1 -1
- package/dist/es/{vendor-DIFwbdTH.js → vendor-CxcudVpO.js} +10946 -10410
- package/dist/index.css +1 -1
- package/dist/types/components/CascaderLoadMore/CascaderLoadMore.vue.d.ts +18 -0
- package/dist/types/components/CascaderLoadMore/index.d.ts +30 -0
- package/dist/types/components/DiyDataTable/DiyDataTable.vue.d.ts +2 -1
- package/dist/types/components/DiyDataTable/index.d.ts +6 -3
- package/dist/types/components/DiyDataTable/type.d.ts +3 -1
- package/dist/types/components/Map/Map.vue.d.ts +1 -0
- package/dist/types/components/Map/function/position.d.ts +2 -1
- package/dist/types/components/Map/function/ship/index.d.ts +1 -0
- package/dist/types/components/Map/index.d.ts +3 -0
- package/dist/types/components/Map/interface/position.d.ts +2 -0
- package/dist/types/components/ToolTips/index.d.ts +6 -6
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +44 -44
- package/package.json +3 -5
- package/dist/es/CascaderLoadMore-CF_J-i8H.js +0 -261
- package/dist/es/DiyDataTable-BzfRDF0J.js +0 -366
- package/dist/es/Map-CGiEKZ7_.js +0 -2280
- package/dist/es/Table-BgW-kh7S.js +0 -1177
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zhihao-ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.55",
|
|
4
4
|
"description": "components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/umd/index.umd.cjs",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"sideEffects": [
|
|
24
24
|
"./dist/index.css"
|
|
25
25
|
],
|
|
26
|
-
|
|
27
26
|
"scripts": {
|
|
28
27
|
"build": "run-s build-only move-style",
|
|
29
28
|
"build-only": "run-p build-es build-umd",
|
|
@@ -38,12 +37,11 @@
|
|
|
38
37
|
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
|
39
38
|
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
|
40
39
|
"@fortawesome/vue-fontawesome": "^3.0.6",
|
|
41
|
-
"@popperjs/core": "^2.11.8",
|
|
42
40
|
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
|
43
41
|
"async-validator": "^4.2.5"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
44
|
+
"@zhihao-ui/components": "workspace:*",
|
|
45
|
+
"vite-plugin-dts": "^3.9.1"
|
|
48
46
|
}
|
|
49
47
|
}
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { defineComponent as ee, useModel as le, ref as r, watch as L, nextTick as q, resolveDirective as ae, openBlock as d, createElementBlock as M, withDirectives as te, createBlock as E, unref as h, mergeProps as oe, withCtx as w, Fragment as re, renderList as se, createVNode as ne, createCommentVNode as D, mergeModels as x } from "vue";
|
|
2
|
-
import { e as z, f as ce, g as ue, h as ie, i as pe } from "./vendor-DIFwbdTH.js";
|
|
3
|
-
import { w as ve } from "./utils-BXhGHET2.js";
|
|
4
|
-
const de = { class: "w-100" }, fe = {
|
|
5
|
-
key: 1,
|
|
6
|
-
class: "loading"
|
|
7
|
-
}, ge = /* @__PURE__ */ ee({
|
|
8
|
-
name: "CascaderLoadMore",
|
|
9
|
-
__name: "CascaderLoadMore",
|
|
10
|
-
props: /* @__PURE__ */ x({
|
|
11
|
-
onChange: {
|
|
12
|
-
type: Function,
|
|
13
|
-
required: !1
|
|
14
|
-
},
|
|
15
|
-
// 默认选中项
|
|
16
|
-
initialValue: {
|
|
17
|
-
type: [String, Number, Array],
|
|
18
|
-
required: !1
|
|
19
|
-
},
|
|
20
|
-
pageSize: {
|
|
21
|
-
type: Number,
|
|
22
|
-
default: 10
|
|
23
|
-
},
|
|
24
|
-
// 数据请求函数
|
|
25
|
-
requestFunction: {
|
|
26
|
-
type: Function,
|
|
27
|
-
required: !0
|
|
28
|
-
},
|
|
29
|
-
// 选项处理函数
|
|
30
|
-
handleOptionsFunction: {
|
|
31
|
-
type: Function,
|
|
32
|
-
required: !0
|
|
33
|
-
},
|
|
34
|
-
placeholder: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: "输入关键字搜索名称"
|
|
37
|
-
},
|
|
38
|
-
// 强制搜索:不输入内容也进行搜索,即点击下拉默认展示数据
|
|
39
|
-
forceSearch: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: !0
|
|
42
|
-
},
|
|
43
|
-
// 初始下拉项用于回显数据
|
|
44
|
-
initialOptions: {
|
|
45
|
-
type: Array,
|
|
46
|
-
required: !1,
|
|
47
|
-
default: () => []
|
|
48
|
-
},
|
|
49
|
-
// 多选,默认false
|
|
50
|
-
multiple: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: !1
|
|
53
|
-
},
|
|
54
|
-
collapseTags: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: !1
|
|
57
|
-
},
|
|
58
|
-
collapseTagsTooltip: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: !1
|
|
61
|
-
},
|
|
62
|
-
clearable: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: !0
|
|
65
|
-
},
|
|
66
|
-
cascaderProps: {
|
|
67
|
-
type: Object,
|
|
68
|
-
default: () => ({})
|
|
69
|
-
},
|
|
70
|
-
placement: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: "bottom-start"
|
|
73
|
-
},
|
|
74
|
-
trigger: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: "click"
|
|
77
|
-
},
|
|
78
|
-
popperClass: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: "warp-cascade-panel"
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
modelValue: {},
|
|
84
|
-
modelModifiers: {}
|
|
85
|
-
}),
|
|
86
|
-
emits: /* @__PURE__ */ x(["change", "removeTag"], ["update:modelValue"]),
|
|
87
|
-
setup(i, { expose: A, emit: H }) {
|
|
88
|
-
const t = i, s = le(i, "modelValue"), v = r(s.value || []), y = r(!1), n = r({
|
|
89
|
-
page: 1,
|
|
90
|
-
size: t.pageSize
|
|
91
|
-
}), C = r(void 0), S = r(!1), c = r(t.initialOptions || []), u = r(t.initialOptions || []), f = r(void 0), b = r(!1), I = {
|
|
92
|
-
expandTrigger: "hover",
|
|
93
|
-
checkStrictly: !1,
|
|
94
|
-
multiple: t.multiple,
|
|
95
|
-
emitPath: !0,
|
|
96
|
-
...t.cascaderProps
|
|
97
|
-
}, R = r(), O = r(), N = () => {
|
|
98
|
-
y.value = !0;
|
|
99
|
-
}, $ = () => {
|
|
100
|
-
y.value = !1;
|
|
101
|
-
}, U = () => {
|
|
102
|
-
var e, l;
|
|
103
|
-
(l = (e = h(O).popperRef) == null ? void 0 : e.delayHide) == null || l.call(e);
|
|
104
|
-
}, j = (e) => {
|
|
105
|
-
const l = /* @__PURE__ */ new Map();
|
|
106
|
-
return (e || []).forEach((o) => {
|
|
107
|
-
const a = `${o.value}`;
|
|
108
|
-
l.has(a) || l.set(a, o);
|
|
109
|
-
}), Array.from(l.values());
|
|
110
|
-
};
|
|
111
|
-
function V(e) {
|
|
112
|
-
const l = [];
|
|
113
|
-
function o(a, p = "") {
|
|
114
|
-
const m = p && (t.cascaderProps.emitPath ?? !0) ? `${p}/${a.label}` : a.label;
|
|
115
|
-
l.push({
|
|
116
|
-
...a,
|
|
117
|
-
value: a.value,
|
|
118
|
-
label: m
|
|
119
|
-
// 如果需要保留原始路径结构,可加上 fullPath 字段
|
|
120
|
-
// fullPath: currentPath
|
|
121
|
-
}), a.children && a.children.length > 0 && a.children.forEach((Y) => o(Y, m));
|
|
122
|
-
}
|
|
123
|
-
return e.forEach((a) => o(a)), l;
|
|
124
|
-
}
|
|
125
|
-
const k = async (e) => {
|
|
126
|
-
var p;
|
|
127
|
-
if (!t.forceSearch && !e) return;
|
|
128
|
-
const l = f.value === e || !f.value && !e;
|
|
129
|
-
if (l || (n.value.page = 1), l && C.value !== void 0 && n.value.page > C.value && !b.value) return;
|
|
130
|
-
b.value = !1, S.value = !0;
|
|
131
|
-
const a = await t.requestFunction(n.value.page, n.value.size, e);
|
|
132
|
-
if (a && Object.keys(a).length) {
|
|
133
|
-
C.value = a.totalPage;
|
|
134
|
-
const m = (p = a == null ? void 0 : a.list) == null ? void 0 : p.map(t.handleOptionsFunction);
|
|
135
|
-
l && n.value.page !== 1 ? u.value = j([...u.value, ...m]) : u.value = m || [], v.value = z(s.value), c.value = V(u.value);
|
|
136
|
-
}
|
|
137
|
-
f.value = e, S.value = !1;
|
|
138
|
-
}, Z = () => {
|
|
139
|
-
n.value.page = n.value.page + 1, k(f.value);
|
|
140
|
-
}, _ = (e) => {
|
|
141
|
-
s.value = e, v.value = e;
|
|
142
|
-
const l = T(e), o = t.onChange;
|
|
143
|
-
o && o(e, l);
|
|
144
|
-
}, T = (e) => {
|
|
145
|
-
const l = e || s.value;
|
|
146
|
-
return t.multiple ? c.value.filter(
|
|
147
|
-
(o) => (l || []).includes(o.value)
|
|
148
|
-
) : c.value.find((o) => o.value === l);
|
|
149
|
-
}, Q = () => {
|
|
150
|
-
s.value = t.initialValue, v.value = t.initialValue, n.value.page = 1, n.value.size = t.pageSize, c.value = [], C.value = void 0, f.value = void 0;
|
|
151
|
-
}, B = H;
|
|
152
|
-
L(
|
|
153
|
-
() => t.initialOptions,
|
|
154
|
-
() => {
|
|
155
|
-
c.value = V(t.initialOptions), console.log("options.value", c.value), u.value = t.initialOptions;
|
|
156
|
-
},
|
|
157
|
-
{ immediate: !0 }
|
|
158
|
-
);
|
|
159
|
-
const W = (e) => {
|
|
160
|
-
B("removeTag", e);
|
|
161
|
-
}, G = (e) => {
|
|
162
|
-
b.value = e;
|
|
163
|
-
}, P = r(null), g = r(null), F = () => {
|
|
164
|
-
if (!y.value) return;
|
|
165
|
-
const e = O.value.popperRef.contentRef, l = e == null ? void 0 : e.querySelector(".el-cascader-panel .el-scrollbar__wrap");
|
|
166
|
-
l && (P.value = l, g.value = () => K(l), l.addEventListener("scroll", g.value));
|
|
167
|
-
}, J = () => {
|
|
168
|
-
P.value && g.value && (P.value.removeEventListener("scroll", g.value), P.value = null, g.value = null);
|
|
169
|
-
}, K = (e) => {
|
|
170
|
-
const { scrollTop: l, scrollHeight: o, clientHeight: a } = e;
|
|
171
|
-
let p = o - l;
|
|
172
|
-
a + 10 > p && Z();
|
|
173
|
-
};
|
|
174
|
-
q(() => F()), L(y, (e) => {
|
|
175
|
-
e ? q(() => F()) : J();
|
|
176
|
-
});
|
|
177
|
-
const X = async (e) => {
|
|
178
|
-
(t.cascaderProps.emitPath ?? !0) && Array.isArray(e) ? t.multiple ? s.value = e.map((a) => a.at(-1)) : s.value = e.at(-1) : s.value = z(v.value), await q();
|
|
179
|
-
const l = T(s.value);
|
|
180
|
-
B("change", e, l);
|
|
181
|
-
const o = t.onChange;
|
|
182
|
-
o && o(e, l);
|
|
183
|
-
};
|
|
184
|
-
return A({
|
|
185
|
-
reset: Q,
|
|
186
|
-
getSelectedOption: T,
|
|
187
|
-
remoteMethod: k,
|
|
188
|
-
handleRequestParamsChanged: G,
|
|
189
|
-
options: c,
|
|
190
|
-
cascderOptions: u
|
|
191
|
-
}), (e, l) => {
|
|
192
|
-
const o = ae("click-outside");
|
|
193
|
-
return d(), M("div", de, [
|
|
194
|
-
te((d(), E(h(ce), oe({
|
|
195
|
-
ref_key: "remoteSelectRef",
|
|
196
|
-
ref: R,
|
|
197
|
-
modelValue: s.value,
|
|
198
|
-
"onUpdate:modelValue": l[0] || (l[0] = (a) => s.value = a),
|
|
199
|
-
multiple: i.multiple,
|
|
200
|
-
placeholder: i.placeholder,
|
|
201
|
-
"remote-method": k,
|
|
202
|
-
teleported: !0,
|
|
203
|
-
clearable: i.clearable,
|
|
204
|
-
"collapse-tags": i.collapseTags,
|
|
205
|
-
"collapse-tags-tooltip": i.collapseTagsTooltip,
|
|
206
|
-
filterable: "",
|
|
207
|
-
height: "300",
|
|
208
|
-
remote: "",
|
|
209
|
-
"remote-show-suffix": "",
|
|
210
|
-
"reserve-keyword": "",
|
|
211
|
-
"popper-class": "hidden-dropdown",
|
|
212
|
-
class: "cascader-select"
|
|
213
|
-
}, e.$attrs, {
|
|
214
|
-
onChange: _,
|
|
215
|
-
onRemoveTag: W
|
|
216
|
-
}), {
|
|
217
|
-
default: w(() => [
|
|
218
|
-
(d(!0), M(re, null, se(c.value, (a) => (d(), E(h(ue), {
|
|
219
|
-
key: a.value,
|
|
220
|
-
label: a.label,
|
|
221
|
-
value: a.value
|
|
222
|
-
}, null, 8, ["label", "value"]))), 128))
|
|
223
|
-
]),
|
|
224
|
-
_: 1
|
|
225
|
-
}, 16, ["modelValue", "multiple", "placeholder", "clearable", "collapse-tags", "collapse-tags-tooltip"])), [
|
|
226
|
-
[o, U]
|
|
227
|
-
]),
|
|
228
|
-
ne(h(ie), {
|
|
229
|
-
ref_key: "popoverRef",
|
|
230
|
-
ref: O,
|
|
231
|
-
teleported: !0,
|
|
232
|
-
placement: t.placement,
|
|
233
|
-
trigger: t.trigger,
|
|
234
|
-
"popper-class": t.popperClass,
|
|
235
|
-
"virtual-ref": R.value,
|
|
236
|
-
onShow: N,
|
|
237
|
-
onHide: $,
|
|
238
|
-
"virtual-triggering": ""
|
|
239
|
-
}, {
|
|
240
|
-
default: w(() => [
|
|
241
|
-
!S.value || u.value.length > 0 ? (d(), E(h(pe), {
|
|
242
|
-
key: 0,
|
|
243
|
-
modelValue: v.value,
|
|
244
|
-
"onUpdate:modelValue": l[1] || (l[1] = (a) => v.value = a),
|
|
245
|
-
border: !1,
|
|
246
|
-
props: I,
|
|
247
|
-
options: u.value,
|
|
248
|
-
class: "select-cascader-panel",
|
|
249
|
-
onChange: X
|
|
250
|
-
}, null, 8, ["modelValue", "options"])) : D("", !0),
|
|
251
|
-
S.value ? (d(), M("div", fe, "加载中...")) : D("", !0)
|
|
252
|
-
]),
|
|
253
|
-
_: 1
|
|
254
|
-
}, 8, ["placement", "trigger", "popper-class", "virtual-ref"])
|
|
255
|
-
]);
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
}), Ce = ve(ge);
|
|
259
|
-
export {
|
|
260
|
-
Ce as Z
|
|
261
|
-
};
|
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
import { defineComponent as P, useModel as K, ref as E, computed as j, openBlock as s, createBlock as h, unref as u, withCtx as p, createVNode as R, mergeProps as G, createCommentVNode as x, createElementBlock as m, Fragment as A, renderList as J, normalizeClass as S, toDisplayString as C, renderSlot as T, createTextVNode as D, createElementVNode as b, mergeModels as Q } from "vue";
|
|
2
|
-
import { D as F } from "./BaseItem-DxfKmzHN.js";
|
|
3
|
-
import { m as V, e as M, n as Y, o as ee, p as _, q as N, r as te, s as L, b as I } from "./vendor-DIFwbdTH.js";
|
|
4
|
-
import { _ as ae } from "./Button-ByWikGvS.js";
|
|
5
|
-
import { w as oe } from "./utils-BXhGHET2.js";
|
|
6
|
-
var v = /* @__PURE__ */ ((f) => (f.AUTOCOMPLETE = "autocomplete", f.FORMAT = "format", f.TEXT = "text", f.INDEX = "index", f))(v || {});
|
|
7
|
-
const le = { key: 0 }, re = {
|
|
8
|
-
key: 1,
|
|
9
|
-
class: "col-edit-header"
|
|
10
|
-
}, de = ["onClick"], ie = { key: 0 }, se = { class: "header-operation-container" }, ne = { class: "operation-container" }, ue = ["onClick"], U = "$ZH_DIV$", pe = /* @__PURE__ */ P({
|
|
11
|
-
name: "zh-diy-data-table",
|
|
12
|
-
__name: "DiyDataTable",
|
|
13
|
-
props: /* @__PURE__ */ Q({
|
|
14
|
-
isEdit: { type: Boolean, default: !1 },
|
|
15
|
-
maxRowLength: { default: 50 },
|
|
16
|
-
maxColLength: { default: 10 },
|
|
17
|
-
defaultMinWidth: { default: 120 },
|
|
18
|
-
beforeAddRow: {},
|
|
19
|
-
addRowText: { default: "增行" },
|
|
20
|
-
addColumnText: { default: "增列" },
|
|
21
|
-
customAddRow: { type: Boolean, default: !0 },
|
|
22
|
-
customAddColumn: { type: Boolean, default: !0 },
|
|
23
|
-
operationOption: {},
|
|
24
|
-
canOnlyEditNewlyColumnHeader: { type: Boolean, default: !1 }
|
|
25
|
-
}, {
|
|
26
|
-
rawData: { required: !0 },
|
|
27
|
-
rawDataModifiers: {}
|
|
28
|
-
}),
|
|
29
|
-
emits: ["update:rawData"],
|
|
30
|
-
setup(f, { expose: H }) {
|
|
31
|
-
const d = f, n = K(f, "rawData"), i = E([]), c = E({
|
|
32
|
-
isShow: !0,
|
|
33
|
-
width: 150,
|
|
34
|
-
customAddRow: !0,
|
|
35
|
-
addRowText: "增行",
|
|
36
|
-
customAddColumn: !0,
|
|
37
|
-
addColumnText: "增列"
|
|
38
|
-
}), g = j(() => d.operationOption ? {
|
|
39
|
-
...c.value,
|
|
40
|
-
...d.operationOption || {}
|
|
41
|
-
} : {
|
|
42
|
-
...c.value,
|
|
43
|
-
// 兼容之前单个配置项
|
|
44
|
-
customAddRow: d.customAddRow !== void 0 ? d.customAddRow : c.value.customAddRow,
|
|
45
|
-
addRowText: d.addRowText !== void 0 ? d.addRowText : c.value.addRowText,
|
|
46
|
-
customAddColumn: d.customAddColumn !== void 0 ? d.customAddColumn : c.value.customAddColumn,
|
|
47
|
-
addColumnText: d.addColumnText !== void 0 ? d.addColumnText : c.value.addColumnText
|
|
48
|
-
}), O = () => {
|
|
49
|
-
if (n.value.length === d.maxRowLength) {
|
|
50
|
-
V({
|
|
51
|
-
message: `最多添加${d.maxRowLength}行`,
|
|
52
|
-
type: "warning"
|
|
53
|
-
});
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
let t = {};
|
|
57
|
-
d.beforeAddRow && (t = d.beforeAddRow(n.value)), n.value.push(t);
|
|
58
|
-
}, $ = () => {
|
|
59
|
-
if (i.value.filter((e) => e.isAdd).length >= d.maxColLength) {
|
|
60
|
-
V({
|
|
61
|
-
message: `最多添加${d.maxColLength}列`,
|
|
62
|
-
type: "warning"
|
|
63
|
-
});
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const a = String(Date.now());
|
|
67
|
-
i.value.push({
|
|
68
|
-
prop: a,
|
|
69
|
-
label: "",
|
|
70
|
-
isEditHeader: !0,
|
|
71
|
-
isAdd: !0,
|
|
72
|
-
maxlength: 15,
|
|
73
|
-
minWidth: 150,
|
|
74
|
-
headerMaxlength: 15,
|
|
75
|
-
isNewlyColumn: !0
|
|
76
|
-
});
|
|
77
|
-
}, B = (t, a) => {
|
|
78
|
-
i.value.splice(t, 1), n.value.forEach((e) => {
|
|
79
|
-
delete e[a.prop];
|
|
80
|
-
});
|
|
81
|
-
}, q = (t) => {
|
|
82
|
-
t === 0 && i.value.forEach((a) => {
|
|
83
|
-
a.isSameData && (n.value[1][a.prop] = n.value[0][a.prop]);
|
|
84
|
-
}), n.value.splice(t, 1);
|
|
85
|
-
}, W = (t, a, e) => {
|
|
86
|
-
a(
|
|
87
|
-
e.completeList.filter((l) => l.includes(t)).map((l) => ({ value: l }))
|
|
88
|
-
);
|
|
89
|
-
}, X = (t) => [
|
|
90
|
-
{
|
|
91
|
-
validator: (a, e, l) => {
|
|
92
|
-
if (!i.value[t].label) {
|
|
93
|
-
l(new Error("请输入表头"));
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
l();
|
|
97
|
-
},
|
|
98
|
-
message: "请输入表头",
|
|
99
|
-
trigger: ["blur", "change"]
|
|
100
|
-
}
|
|
101
|
-
], Z = (t) => {
|
|
102
|
-
const a = [];
|
|
103
|
-
return t.required && a.push({
|
|
104
|
-
required: !0,
|
|
105
|
-
message: "请输入" + t.label,
|
|
106
|
-
trigger: t.slot ? void 0 : "blur"
|
|
107
|
-
}), t.varidate && a.push({
|
|
108
|
-
validator: (e, l, o) => {
|
|
109
|
-
const r = t.varidate(l);
|
|
110
|
-
r !== !0 ? o(new Error(r)) : o();
|
|
111
|
-
}
|
|
112
|
-
// trigger: column.slot ? undefined : "blur",
|
|
113
|
-
}), a;
|
|
114
|
-
}, z = (t, a) => {
|
|
115
|
-
let e = t;
|
|
116
|
-
return a.isSameData && (e = n.value[0] || F), a.formatter ? a.showFormatter ? a.type === v.FORMAT ? a.showFormatter(a.formatter(e)) : a.showFormatter(e[a.prop]) : a.formatter(e[a.prop]) : e[a.prop] || F;
|
|
117
|
-
}, k = E(), w = E({
|
|
118
|
-
width: 132,
|
|
119
|
-
type: v.INDEX,
|
|
120
|
-
prop: "index",
|
|
121
|
-
label: "序号",
|
|
122
|
-
fixed: "left",
|
|
123
|
-
isShow: !0
|
|
124
|
-
// 默认显示序号列
|
|
125
|
-
});
|
|
126
|
-
return H({
|
|
127
|
-
/** 初始化数据 */
|
|
128
|
-
initData: (t, a) => {
|
|
129
|
-
const e = (a || []).find((l) => l.type === v.INDEX) || null;
|
|
130
|
-
e && (w.value = { ...e, isShow: e.isShow !== !1 }), t = M(t) || [], t.length === 0 && t.push({}), a = [...a.filter((l) => l.type !== v.INDEX)], console.log("initData", t, a);
|
|
131
|
-
for (const l in t[0])
|
|
132
|
-
if (!a.some(
|
|
133
|
-
(o) => o.prop === l
|
|
134
|
-
)) {
|
|
135
|
-
const o = Date.now() + l, r = l.split(U);
|
|
136
|
-
if (r.length !== 2) {
|
|
137
|
-
console.log("keySplit 失败", l);
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
const y = Number(r[1]);
|
|
141
|
-
a[y] = {
|
|
142
|
-
prop: l,
|
|
143
|
-
isEditHeader: !0,
|
|
144
|
-
label: r[0],
|
|
145
|
-
key: o,
|
|
146
|
-
isAdd: !0,
|
|
147
|
-
maxlength: 15,
|
|
148
|
-
headerMaxlength: 15,
|
|
149
|
-
// 是否是本地新增的数据
|
|
150
|
-
isNewlyColumn: !1
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
n.value = t, i.value = a.filter((l) => l);
|
|
154
|
-
},
|
|
155
|
-
/** 获取数据 */
|
|
156
|
-
getData: async () => {
|
|
157
|
-
await k.value.validate();
|
|
158
|
-
for (const a in i.value) {
|
|
159
|
-
const e = i.value[a];
|
|
160
|
-
for (const l of i.value)
|
|
161
|
-
if (e.prop !== l.prop && e.label === l.label) {
|
|
162
|
-
V({
|
|
163
|
-
message: "所有列的表头不可重复",
|
|
164
|
-
type: "warning"
|
|
165
|
-
});
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
const t = M(n.value);
|
|
170
|
-
for (const a in t) {
|
|
171
|
-
const e = t[a];
|
|
172
|
-
for (const l in i.value) {
|
|
173
|
-
const o = i.value[l];
|
|
174
|
-
if (o.isSameData && a !== "0" && (e[o.prop] = t[0][o.prop]), o.varidate && !o.varidate(e[o.prop]))
|
|
175
|
-
return;
|
|
176
|
-
if (o.isAdd) {
|
|
177
|
-
const r = e[o.prop];
|
|
178
|
-
delete e[o.prop];
|
|
179
|
-
const y = o.label + U + l;
|
|
180
|
-
e[y] = r;
|
|
181
|
-
}
|
|
182
|
-
o.formatter && o.type === v.FORMAT && (e[o.prop] = o.formatter(e));
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return console.log("DiyDataTable 获取数据", t, i.value), {
|
|
186
|
-
data: t,
|
|
187
|
-
columns: i.value
|
|
188
|
-
};
|
|
189
|
-
},
|
|
190
|
-
/** 更新列配置数据 */
|
|
191
|
-
updateColumn: (t, a) => {
|
|
192
|
-
const e = i.value[t].prop;
|
|
193
|
-
if (i.value[t] = a, e !== a.prop)
|
|
194
|
-
for (const l of n.value)
|
|
195
|
-
l[a.prop] = l[e], delete l[e];
|
|
196
|
-
},
|
|
197
|
-
/** 重置默认列配置数据 */
|
|
198
|
-
resetColumns: (t) => {
|
|
199
|
-
const e = i.value.filter((o) => !o.isAdd).reduce((o, r) => (t.some((y) => y.prop === r.prop) || o.push(r.prop), o), []);
|
|
200
|
-
n.value.forEach((o) => {
|
|
201
|
-
e.forEach((r) => {
|
|
202
|
-
delete o[r];
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
const l = t.filter((o) => o.isAdd);
|
|
206
|
-
i.value = [...t, ...l];
|
|
207
|
-
},
|
|
208
|
-
onAddRow: O,
|
|
209
|
-
onAddColumn: $,
|
|
210
|
-
// 导出formRef
|
|
211
|
-
formRef: k
|
|
212
|
-
}), (t, a) => (s(), h(u(Y), {
|
|
213
|
-
class: "diy-data-table",
|
|
214
|
-
model: f.rawData,
|
|
215
|
-
ref_key: "formRef",
|
|
216
|
-
ref: k
|
|
217
|
-
}, {
|
|
218
|
-
default: p(() => [
|
|
219
|
-
R(u(ee), G({ data: n.value }, t.$attrs), {
|
|
220
|
-
default: p(() => [
|
|
221
|
-
w.value.isShow ? (s(), h(u(_), {
|
|
222
|
-
key: 0,
|
|
223
|
-
type: w.value.type,
|
|
224
|
-
label: w.value.label,
|
|
225
|
-
width: w.value.width,
|
|
226
|
-
minWidth: w.value.minWidth,
|
|
227
|
-
fixed: w.value.fixed
|
|
228
|
-
}, null, 8, ["type", "label", "width", "minWidth", "fixed"])) : x("", !0),
|
|
229
|
-
(s(!0), m(A, null, J(i.value, (e, l) => (s(), h(u(_), {
|
|
230
|
-
key: e.key || l,
|
|
231
|
-
prop: e.prop,
|
|
232
|
-
label: e.label,
|
|
233
|
-
width: e.width,
|
|
234
|
-
"min-width": e.minWidth || t.defaultMinWidth,
|
|
235
|
-
fixed: e.fixed
|
|
236
|
-
}, {
|
|
237
|
-
header: p(() => [
|
|
238
|
-
t.isEdit ? e.isEditHeader && t.canOnlyEditNewlyColumnHeader && e.isNewlyColumn || e.isEditHeader && !t.canOnlyEditNewlyColumnHeader ? (s(), m("div", re, [
|
|
239
|
-
R(u(N), {
|
|
240
|
-
prop: `columns.${l}`,
|
|
241
|
-
rules: X(l)
|
|
242
|
-
}, {
|
|
243
|
-
default: p(() => [
|
|
244
|
-
R(u(L), {
|
|
245
|
-
modelValue: e.label,
|
|
246
|
-
"onUpdate:modelValue": (o) => e.label = o,
|
|
247
|
-
maxlength: e.headerMaxlength || 20,
|
|
248
|
-
placeholder: "请输入表头"
|
|
249
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "maxlength"])
|
|
250
|
-
]),
|
|
251
|
-
_: 2
|
|
252
|
-
}, 1032, ["prop", "rules"]),
|
|
253
|
-
e.isAdd ? (s(), m("i", {
|
|
254
|
-
key: 0,
|
|
255
|
-
class: "iconfont icon-close",
|
|
256
|
-
onClick: (o) => B(l, e)
|
|
257
|
-
}, null, 8, de)) : x("", !0)
|
|
258
|
-
])) : (s(), m("div", {
|
|
259
|
-
key: 2,
|
|
260
|
-
class: S({ "is-required-label": e.required })
|
|
261
|
-
}, C(e.label), 3)) : (s(), m("div", le, C(e.label), 1))
|
|
262
|
-
]),
|
|
263
|
-
default: p((o) => [
|
|
264
|
-
d.isEdit && (!e.isSameData || o.$index === 0) && e.type !== u(v).TEXT && !o.row.disabled ? (s(), h(u(N), {
|
|
265
|
-
key: 0,
|
|
266
|
-
prop: `${o.$index}.${e.prop}`,
|
|
267
|
-
rules: Z(e),
|
|
268
|
-
class: S(["col-edit-container", { "close-padding": e.isAdd }])
|
|
269
|
-
}, {
|
|
270
|
-
default: p(() => [
|
|
271
|
-
e.type === u(v).FORMAT && e.formatter ? (s(), m("div", ie, C(e.showFormatter ? e.showFormatter(
|
|
272
|
-
e.formatter(o.row)
|
|
273
|
-
) : e.formatter(o.row)), 1)) : e.type === u(v).AUTOCOMPLETE ? (s(), h(u(te), {
|
|
274
|
-
key: 1,
|
|
275
|
-
modelValue: o.row[e.prop],
|
|
276
|
-
"onUpdate:modelValue": (r) => o.row[e.prop] = r,
|
|
277
|
-
placeholder: e.placeholder || "请输入",
|
|
278
|
-
"fetch-suggestions": (r, y) => W(r, y, e),
|
|
279
|
-
maxlength: e.maxlength || 20
|
|
280
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "fetch-suggestions", "maxlength"])) : e.slot ? T(t.$slots, e.slot, {
|
|
281
|
-
key: 2,
|
|
282
|
-
row: o.row,
|
|
283
|
-
$index: o.$index
|
|
284
|
-
}, void 0, !0) : (s(), h(u(L), {
|
|
285
|
-
key: 3,
|
|
286
|
-
modelValue: o.row[e.prop],
|
|
287
|
-
"onUpdate:modelValue": (r) => o.row[e.prop] = r,
|
|
288
|
-
placeholder: e.placeholder || "请输入",
|
|
289
|
-
formatter: e.formatter,
|
|
290
|
-
parser: e.parser,
|
|
291
|
-
maxlength: e.maxlength || 20
|
|
292
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "formatter", "parser", "maxlength"]))
|
|
293
|
-
]),
|
|
294
|
-
_: 2
|
|
295
|
-
}, 1032, ["prop", "rules", "class"])) : e.slot ? T(t.$slots, e.slot, {
|
|
296
|
-
key: 1,
|
|
297
|
-
row: o.row,
|
|
298
|
-
$index: o.$index
|
|
299
|
-
}, void 0, !0) : (s(), m(A, { key: 2 }, [
|
|
300
|
-
D(C(z(o.row, e)), 1)
|
|
301
|
-
], 64))
|
|
302
|
-
]),
|
|
303
|
-
_: 2
|
|
304
|
-
}, 1032, ["prop", "label", "width", "min-width", "fixed"]))), 128)),
|
|
305
|
-
d.isEdit && g.value.isShow ? (s(), h(u(_), {
|
|
306
|
-
key: 1,
|
|
307
|
-
width: g.value.width,
|
|
308
|
-
fixed: "right"
|
|
309
|
-
}, {
|
|
310
|
-
header: p(() => [
|
|
311
|
-
b("div", se, [
|
|
312
|
-
g.value.customAddRow ? (s(), h(u(I), {
|
|
313
|
-
key: 0,
|
|
314
|
-
type: "primary",
|
|
315
|
-
link: "",
|
|
316
|
-
onClick: O
|
|
317
|
-
}, {
|
|
318
|
-
default: p(() => [
|
|
319
|
-
a[0] || (a[0] = b("i", { class: "iconfont icon-Frame1" }, null, -1)),
|
|
320
|
-
D(C(g.value.addRowText), 1)
|
|
321
|
-
]),
|
|
322
|
-
_: 1
|
|
323
|
-
})) : x("", !0),
|
|
324
|
-
g.value.customAddColumn ? (s(), h(u(I), {
|
|
325
|
-
key: 1,
|
|
326
|
-
type: "primary",
|
|
327
|
-
link: "",
|
|
328
|
-
onClick: $
|
|
329
|
-
}, {
|
|
330
|
-
default: p(() => [
|
|
331
|
-
a[1] || (a[1] = b("i", { class: "iconfont icon-Frame-11" }, null, -1)),
|
|
332
|
-
D(C(g.value.addColumnText), 1)
|
|
333
|
-
]),
|
|
334
|
-
_: 1
|
|
335
|
-
})) : x("", !0)
|
|
336
|
-
])
|
|
337
|
-
]),
|
|
338
|
-
default: p(({ $index: e, row: l }) => [
|
|
339
|
-
b("div", ne, [
|
|
340
|
-
t.$slots.operation ? T(t.$slots, "operation", {
|
|
341
|
-
key: 0,
|
|
342
|
-
row: n.value[e],
|
|
343
|
-
$index: e
|
|
344
|
-
}, void 0, !0) : (s(), m(A, { key: 1 }, [
|
|
345
|
-
n.value.length > 1 && !l.disabled ? (s(), m("i", {
|
|
346
|
-
key: 0,
|
|
347
|
-
class: "iconfont icon-close",
|
|
348
|
-
onClick: (o) => q(e)
|
|
349
|
-
}, null, 8, ue)) : x("", !0)
|
|
350
|
-
], 64))
|
|
351
|
-
])
|
|
352
|
-
]),
|
|
353
|
-
_: 3
|
|
354
|
-
}, 8, ["width"])) : x("", !0)
|
|
355
|
-
]),
|
|
356
|
-
_: 3
|
|
357
|
-
}, 16, ["data"])
|
|
358
|
-
]),
|
|
359
|
-
_: 3
|
|
360
|
-
}, 8, ["model"]));
|
|
361
|
-
}
|
|
362
|
-
}), fe = /* @__PURE__ */ ae(pe, [["__scopeId", "data-v-5a4b704c"]]), ce = oe(fe);
|
|
363
|
-
export {
|
|
364
|
-
v as D,
|
|
365
|
-
ce as Z
|
|
366
|
-
};
|