zhihao-ui 1.2.67 → 1.2.69

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.
Files changed (57) hide show
  1. package/dist/es/{BaseInfo-ChbjTGfs.js → BaseInfo-BhnEjLKF.js} +1 -1
  2. package/dist/es/{BaseItem-Bm9MGEJ9.js → BaseItem-C4NJy1i4.js} +3 -3
  3. package/dist/es/{Button-MxEBey6B.js → Button-CGndQwez.js} +2 -2
  4. package/dist/es/DatePicker-Dy1K1cJQ.js +57 -0
  5. package/dist/es/{DetailHeader-CET8dXQK.js → DetailHeader-DaabNj_4.js} +3 -3
  6. package/dist/es/{DetailSubTitle-BjRMPd-x.js → DetailSubTitle-CzFZPXeE.js} +2 -2
  7. package/dist/es/{Dialog-DbLFMPUc.js → Dialog-BUW6ag1B.js} +6 -6
  8. package/dist/es/DiyDataTable-D-UZVciZ.js +331 -0
  9. package/dist/es/{EditInfoPair-BFhom7kE.js → EditInfoPair-B2f6zoGY.js} +3 -3
  10. package/dist/es/{FileWrapper-dvsZpeCo.js → FileWrapper-D4IxJemr.js} +4 -4
  11. package/dist/es/{Grid-BE291DBa.js → Grid-DIs695lY.js} +2 -2
  12. package/dist/es/{InfoPair-vBH3EpPX.js → InfoPair-Ce7nDfxD.js} +3 -3
  13. package/dist/es/{Input-CAfBuNDL.js → Input-C5X2X_YD.js} +3 -3
  14. package/dist/es/{Loading-DqAl0_Bv.js → Loading-BgoEv5qE.js} +2 -2
  15. package/dist/es/Map-DbbD377l.js +2235 -0
  16. package/dist/es/{MessageBox-D40uRNZW.js → MessageBox-DiGH5x51.js} +2 -2
  17. package/dist/es/{MoneyInput-D1qzFVtu.js → MoneyInput-D0kYiOfP.js} +8 -8
  18. package/dist/es/{PageHeadPanel-BKSrXbjM.js → PageHeadPanel-C6IdOq6I.js} +2 -2
  19. package/dist/es/Table-B_3YA1mb.js +1155 -0
  20. package/dist/es/{ToolTips-CUiNF0wz.js → ToolTips-CiQHxGrw.js} +6 -6
  21. package/dist/es/index.js +60 -77
  22. package/dist/es/{utils-B4dXhR36.js → utils-D2wHR1YB.js} +1 -1
  23. package/dist/es/{vendor-BxbXJpfv.js → vendor-D2mv9LHk.js} +26097 -30615
  24. package/dist/index.css +1 -1
  25. package/dist/types/components/BaseItem/index.d.ts +9 -9
  26. package/dist/types/components/Dialog/Dialog.vue.d.ts +16 -16
  27. package/dist/types/components/Dialog/index.d.ts +24 -24
  28. package/dist/types/components/DiyDataTable/DiyDataTable.vue.d.ts +1 -18
  29. package/dist/types/components/DiyDataTable/index.d.ts +0 -30
  30. package/dist/types/components/DiyDataTable/type.d.ts +1 -17
  31. package/dist/types/components/Map/Map.vue.d.ts +101 -138
  32. package/dist/types/components/Map/components/scaleLine.vue.d.ts +2 -1
  33. package/dist/types/components/Map/components/zoomControl.vue.d.ts +7 -3
  34. package/dist/types/components/Map/function/drawPolygon.d.ts +1 -0
  35. package/dist/types/components/Map/function/event.d.ts +2 -1
  36. package/dist/types/components/Map/function/port.d.ts +1 -1
  37. package/dist/types/components/Map/function/ship/index.d.ts +5 -7
  38. package/dist/types/components/Map/function/ship/style.d.ts +3 -3
  39. package/dist/types/components/Map/function/shipTrack.d.ts +4 -4
  40. package/dist/types/components/Map/index.d.ts +324 -390
  41. package/dist/types/components/Map/interface/index.d.ts +6 -13
  42. package/dist/types/components/Map/interface/mapProps.d.ts +3 -3
  43. package/dist/types/components/Map/interface/shipInfoVo.d.ts +2 -0
  44. package/dist/types/components/Map/meta/index.d.ts +5 -0
  45. package/dist/types/components/Map/types.d.ts +1 -13
  46. package/dist/types/components/Map/utils/shipOverlay.d.ts +3 -3
  47. package/dist/types/components/Table/types.d.ts +0 -1
  48. package/dist/types/components/ToolTips/index.d.ts +12 -12
  49. package/dist/types/components/index.d.ts +0 -1
  50. package/dist/umd/index.css +1 -1
  51. package/dist/umd/index.umd.cjs +130 -604
  52. package/package.json +1 -1
  53. package/dist/es/CascaderLoadMore-DlILOdn-.js +0 -241
  54. package/dist/es/DatePicker-CmHAGAfV.js +0 -73
  55. package/dist/es/DiyDataTable-Dl9cbZPM.js +0 -364
  56. package/dist/es/Map-Ds8BCcrZ.js +0 -2528
  57. package/dist/es/Table-oEih0-VJ.js +0 -1167
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhihao-ui",
3
- "version": "1.2.67",
3
+ "version": "1.2.69",
4
4
  "description": "components",
5
5
  "type": "module",
6
6
  "main": "./dist/umd/index.umd.cjs",
@@ -1,241 +0,0 @@
1
- import { defineComponent as J, useModel as K, ref as n, watch as B, nextTick as F, resolveComponent as X, openBlock as y, createElementBlock as O, createVNode as T, unref as q, withCtx as M, createCommentVNode as Y, mergeProps as _, Fragment as ee, renderList as le, createBlock as ae, mergeModels as L } from "vue";
2
- import { e as w, f as te, g as oe, h as ne } from "./vendor-BxbXJpfv.js";
3
- import { w as se } from "./utils-B4dXhR36.js";
4
- const re = { class: "w-100" }, ce = {
5
- key: 0,
6
- class: "loading"
7
- }, ue = /* @__PURE__ */ J({
8
- name: "CascaderLoadMore",
9
- __name: "CascaderLoadMore",
10
- props: /* @__PURE__ */ L({
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__ */ L(["removeTag"], ["update:modelValue"]),
87
- setup(u, { expose: R, emit: x }) {
88
- const t = u, r = K(u, "modelValue"), p = n(r.value || []), m = n(!1), s = n({
89
- page: 1,
90
- size: t.pageSize
91
- }), g = n(void 0), C = n(!1), c = n(t.initialOptions || []), i = n(t.initialOptions || []), v = n(void 0), S = n(!1), z = {
92
- expandTrigger: "hover",
93
- checkStrictly: !0,
94
- emitPath: !1,
95
- multiple: t.multiple,
96
- ...t.cascaderProps
97
- }, D = (e) => {
98
- const a = /* @__PURE__ */ new Map();
99
- return (e || []).forEach((o) => {
100
- const l = `${o.value}`;
101
- a.has(l) || a.set(l, o);
102
- }), Array.from(a.values());
103
- };
104
- function V(e) {
105
- const a = [];
106
- function o(l) {
107
- a.push({ value: l.value, label: l.label }), l.children && l.children.length > 0 && l.children.forEach((d) => o(d));
108
- }
109
- return e.forEach((l) => o(l)), a;
110
- }
111
- const b = async (e) => {
112
- var k;
113
- if (!t.forceSearch && !e) return;
114
- const a = v.value === e || !v.value && !e;
115
- if (a || (s.value.page = 1), a && g.value !== void 0 && s.value.page > g.value && !S.value) return;
116
- S.value = !1, C.value = !0;
117
- const l = await t.requestFunction(s.value.page, s.value.size, e);
118
- g.value = l.totalPage;
119
- const d = (k = l == null ? void 0 : l.list) == null ? void 0 : k.map(t.handleOptionsFunction);
120
- a && s.value.page !== 1 ? i.value = D([...i.value, ...d]) : i.value = d, p.value = w(r.value), c.value = V(i.value), v.value = e, C.value = !1;
121
- }, I = () => {
122
- s.value.page = s.value.page + 1, b(v.value);
123
- }, N = (e) => {
124
- r.value = e, p.value = e;
125
- const a = P(e), o = t.onChange;
126
- o && o(e, a);
127
- }, P = (e) => {
128
- const a = e || r.value;
129
- return t.multiple ? c.value.filter(
130
- (o) => (a || []).includes(o.value)
131
- ) : c.value.find((o) => o.value === a);
132
- }, U = () => {
133
- r.value = t.initialValue, p.value = t.initialValue, s.value.page = 1, s.value.size = t.pageSize, c.value = [], g.value = void 0, v.value = void 0;
134
- }, A = x;
135
- B(
136
- () => t.initialOptions,
137
- () => {
138
- c.value = V(t.initialOptions), console.log("options.value", c.value), i.value = t.initialOptions;
139
- },
140
- { immediate: !0 }
141
- );
142
- const H = (e) => {
143
- A("removeTag", e);
144
- }, Z = n(), $ = n(), j = (e) => {
145
- S.value = e;
146
- }, h = n(null), f = n(null), E = () => {
147
- if (!m.value) return;
148
- const e = document == null ? void 0 : document.querySelector(".el-cascader-panel .el-scrollbar__wrap");
149
- console.log("selectDom", e), e && (h.value = e, f.value = () => W(e), e.addEventListener("scroll", f.value));
150
- }, Q = () => {
151
- h.value && f.value && (h.value.removeEventListener("scroll", f.value), h.value = null, f.value = null);
152
- }, W = (e) => {
153
- const { scrollTop: a, scrollHeight: o, clientHeight: l } = e;
154
- let d = o - a;
155
- l + 10 > d && (I(), console.log("handleScroll", "触底了"));
156
- };
157
- F(() => E()), B(m, (e) => {
158
- e ? F(() => E()) : Q();
159
- });
160
- const G = (e) => {
161
- r.value = w(p.value);
162
- const a = P(e), o = t.onChange;
163
- o && o(e, a);
164
- };
165
- return R({
166
- reset: U,
167
- getSelectedOption: P,
168
- remoteMethod: b,
169
- handleRequestParamsChanged: j,
170
- options: c,
171
- cascderOptions: i
172
- }), (e, a) => {
173
- const o = X("el-option");
174
- return y(), O("div", re, [
175
- T(q(te), {
176
- ref: "cascaderPopperRef",
177
- visible: m.value,
178
- "onUpdate:visible": a[2] || (a[2] = (l) => m.value = l),
179
- width: "100%",
180
- teleported: !0,
181
- placement: t.placement,
182
- trigger: t.trigger,
183
- "popper-class": t.popperClass
184
- }, {
185
- reference: M(() => [
186
- T(q(ne), _({
187
- ref_key: "remoteSelectRef",
188
- ref: Z,
189
- modelValue: r.value,
190
- "onUpdate:modelValue": a[0] || (a[0] = (l) => r.value = l),
191
- multiple: u.multiple,
192
- placeholder: u.placeholder,
193
- "remote-method": b,
194
- teleported: !0,
195
- clearable: u.clearable,
196
- "collapse-tags": u.collapseTags,
197
- "collapse-tags-tooltip": u.collapseTagsTooltip,
198
- filterable: "",
199
- height: "300",
200
- remote: "",
201
- "remote-show-suffix": "",
202
- "reserve-keyword": "",
203
- "popper-class": "hidden-dropdown",
204
- class: "cascader-select"
205
- }, e.$attrs, {
206
- onChange: N,
207
- onRemoveTag: H
208
- }), {
209
- default: M(() => [
210
- (y(!0), O(ee, null, le(c.value, (l) => (y(), ae(o, {
211
- key: l.value,
212
- label: l.label,
213
- value: l.value
214
- }, null, 8, ["label", "value"]))), 128))
215
- ]),
216
- _: 1
217
- }, 16, ["modelValue", "multiple", "placeholder", "clearable", "collapse-tags", "collapse-tags-tooltip"])
218
- ]),
219
- default: M(() => [
220
- T(q(oe), {
221
- ref_key: "cascaderPanelRef",
222
- ref: $,
223
- modelValue: p.value,
224
- "onUpdate:modelValue": a[1] || (a[1] = (l) => p.value = l),
225
- border: !1,
226
- props: z,
227
- options: i.value,
228
- class: "select-cascader-panel",
229
- onChange: G
230
- }, null, 8, ["modelValue", "options"]),
231
- C.value ? (y(), O("div", ce, "加载中...")) : Y("", !0)
232
- ]),
233
- _: 1
234
- }, 8, ["visible", "placement", "trigger", "popper-class"])
235
- ]);
236
- };
237
- }
238
- }), ve = se(ue);
239
- export {
240
- ve as Z
241
- };
@@ -1,73 +0,0 @@
1
- import { defineComponent as m, openBlock as u, createElementBlock as h, normalizeClass as d, createVNode as g, unref as _, mergeProps as A } from "vue";
2
- import { i as D, j as E } from "./vendor-BxbXJpfv.js";
3
- import { D as p, a as M, L as f, b as T } from "./BaseItem-Bm9MGEJ9.js";
4
- import { w as b } from "./utils-B4dXhR36.js";
5
- const i = (e, t = M) => e ? D(e).format(t).replace("Invalid date", p) : p, O = (e) => typeof e == "number" ? !0 : typeof e == "string" ? !isNaN(parseFloat(e)) : !1;
6
- function P(e) {
7
- const t = ["角", "分"], a = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], s = [
8
- ["元", "万", "亿"],
9
- ["", "拾", "佰", "仟"]
10
- ], n = e < 0 ? "负" : "";
11
- e = Math.abs(e);
12
- let l = "";
13
- for (let o = 0; o < t.length; o++)
14
- l += (a[Math.floor(e * 10 * Math.pow(10, o)) % 10] + t[o]).replace(/零./, "");
15
- l = l || "整", e = Math.floor(e);
16
- for (let o = 0; o < s[0].length && e > 0; o++) {
17
- let r = "";
18
- for (let c = 0; c < s[1].length && e > 0; c++)
19
- r = a[e % 10] + s[1][c] + r, e = Math.floor(e / 10);
20
- l = r.replace(/(零.)*零$/, "").replace(/^$/, "零") + s[0][o] + l;
21
- }
22
- return n + l.replace(/(零.)*零元/, "元").replace(/(零.)+/g, "零").replace(/^整$/, "零元整");
23
- }
24
- function y(e) {
25
- let t = e.replace(/^#/, "");
26
- t.length === 3 && (t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2]);
27
- const a = parseInt(t.slice(0, 2), 16), s = parseInt(t.slice(2, 4), 16), n = parseInt(t.slice(4, 6), 16);
28
- return [a, s, n];
29
- }
30
- function F(e) {
31
- const [t, a, s] = e;
32
- return 0.299 * t + 0.587 * a + 0.114 * s;
33
- }
34
- function R(e, t = 128) {
35
- e === "white" && (e = "#fff"), e === "black" && (e = "#000");
36
- const a = y(e);
37
- return F(a) > t ? "black" : "white";
38
- }
39
- const k = /* @__PURE__ */ m({
40
- name: "zh-date-picker",
41
- __name: "DatePicker",
42
- props: {
43
- style: {},
44
- class: {},
45
- modelValue: {}
46
- },
47
- emits: ["update:modelValue", "change"],
48
- setup(e, { emit: t }) {
49
- const a = e, s = t, n = (r) => Array.isArray(r) ? [i(r[0], f), i(r[1], T)] : r && i(r, f), l = (r) => {
50
- const c = n(r);
51
- s("update:modelValue", c);
52
- }, o = (r) => {
53
- const c = n(r);
54
- s("change", c);
55
- };
56
- return (r, c) => (u(), h("div", {
57
- class: d([a.class, "zh-date-picker"])
58
- }, [
59
- g(_(E), A(r.$attrs, {
60
- style: a.style,
61
- "model-value": a.modelValue,
62
- "onUpdate:modelValue": l,
63
- onChange: o
64
- }), null, 16, ["style", "model-value"])
65
- ], 2));
66
- }
67
- }), U = b(k);
68
- export {
69
- U as Z,
70
- P as d,
71
- R as g,
72
- O as v
73
- };
@@ -1,364 +0,0 @@
1
- import { defineComponent as P, useModel as K, ref as b, computed as j, openBlock as s, createBlock as h, unref as u, withCtx as p, createVNode as k, mergeProps as G, createCommentVNode as x, createElementBlock as m, Fragment as R, renderList as J, normalizeClass as S, toDisplayString as C, renderSlot as A, createTextVNode as T, createElementVNode as E, mergeModels as Q } from "vue";
2
- import { D as F } from "./BaseItem-Bm9MGEJ9.js";
3
- import { l as D, e as M, m as Y, n as ee, o as V, p as N, q as te, r as L, b as I } from "./vendor-BxbXJpfv.js";
4
- import { _ as ae } from "./Button-MxEBey6B.js";
5
- import { w as oe } from "./utils-B4dXhR36.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 = b([]), c = b({
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
- }), _ = () => {
49
- if (n.value.length === d.maxRowLength) {
50
- D({
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
- }, O = () => {
59
- if (i.value.filter((e) => e.isAdd).length >= d.maxColLength) {
60
- D({
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
- }, $ = b(), w = b({
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;
154
- },
155
- /** 获取数据 */
156
- getData: async () => {
157
- await $.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
- D({
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: _,
209
- onAddColumn: O
210
- }), (t, a) => (s(), h(u(Y), {
211
- class: "diy-data-table",
212
- model: f.rawData,
213
- ref_key: "formRef",
214
- ref: $
215
- }, {
216
- default: p(() => [
217
- k(u(ee), G({ data: n.value }, t.$attrs), {
218
- default: p(() => [
219
- w.value.isShow ? (s(), h(u(V), {
220
- key: 0,
221
- type: w.value.type,
222
- label: w.value.label,
223
- width: w.value.width,
224
- minWidth: w.value.minWidth,
225
- fixed: w.value.fixed
226
- }, null, 8, ["type", "label", "width", "minWidth", "fixed"])) : x("", !0),
227
- (s(!0), m(R, null, J(i.value, (e, l) => (s(), h(u(V), {
228
- key: e.key || l,
229
- prop: e.prop,
230
- label: e.label,
231
- width: e.width,
232
- "min-width": e.minWidth || t.defaultMinWidth,
233
- fixed: e.fixed
234
- }, {
235
- header: p(() => [
236
- t.isEdit ? e.isEditHeader && t.canOnlyEditNewlyColumnHeader && e.isNewlyColumn || e.isEditHeader && !t.canOnlyEditNewlyColumnHeader ? (s(), m("div", re, [
237
- k(u(N), {
238
- prop: `columns.${l}`,
239
- rules: X(l)
240
- }, {
241
- default: p(() => [
242
- k(u(L), {
243
- modelValue: e.label,
244
- "onUpdate:modelValue": (o) => e.label = o,
245
- maxlength: e.headerMaxlength || 20,
246
- placeholder: "请输入表头"
247
- }, null, 8, ["modelValue", "onUpdate:modelValue", "maxlength"])
248
- ]),
249
- _: 2
250
- }, 1032, ["prop", "rules"]),
251
- e.isAdd ? (s(), m("i", {
252
- key: 0,
253
- class: "iconfont icon-close",
254
- onClick: (o) => B(l, e)
255
- }, null, 8, de)) : x("", !0)
256
- ])) : (s(), m("div", {
257
- key: 2,
258
- class: S({ "is-required-label": e.required })
259
- }, C(e.label), 3)) : (s(), m("div", le, C(e.label), 1))
260
- ]),
261
- default: p((o) => [
262
- d.isEdit && (!e.isSameData || o.$index === 0) && e.type !== u(v).TEXT && !o.row.disabled ? (s(), h(u(N), {
263
- key: 0,
264
- prop: `${o.$index}.${e.prop}`,
265
- rules: Z(e),
266
- class: S(["col-edit-container", { "close-padding": e.isAdd }])
267
- }, {
268
- default: p(() => [
269
- e.type === u(v).FORMAT && e.formatter ? (s(), m("div", ie, C(e.showFormatter ? e.showFormatter(
270
- e.formatter(o.row)
271
- ) : e.formatter(o.row)), 1)) : e.type === u(v).AUTOCOMPLETE ? (s(), h(u(te), {
272
- key: 1,
273
- modelValue: o.row[e.prop],
274
- "onUpdate:modelValue": (r) => o.row[e.prop] = r,
275
- placeholder: e.placeholder || "请输入",
276
- "fetch-suggestions": (r, y) => W(r, y, e),
277
- maxlength: e.maxlength || 20
278
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "fetch-suggestions", "maxlength"])) : e.slot ? A(t.$slots, e.slot, {
279
- key: 2,
280
- row: o.row,
281
- $index: o.$index
282
- }, void 0, !0) : (s(), h(u(L), {
283
- key: 3,
284
- modelValue: o.row[e.prop],
285
- "onUpdate:modelValue": (r) => o.row[e.prop] = r,
286
- placeholder: e.placeholder || "请输入",
287
- formatter: e.formatter,
288
- parser: e.parser,
289
- maxlength: e.maxlength || 20
290
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "formatter", "parser", "maxlength"]))
291
- ]),
292
- _: 2
293
- }, 1032, ["prop", "rules", "class"])) : e.slot ? A(t.$slots, e.slot, {
294
- key: 1,
295
- row: o.row,
296
- $index: o.$index
297
- }, void 0, !0) : (s(), m(R, { key: 2 }, [
298
- T(C(z(o.row, e)), 1)
299
- ], 64))
300
- ]),
301
- _: 2
302
- }, 1032, ["prop", "label", "width", "min-width", "fixed"]))), 128)),
303
- d.isEdit && g.value.isShow ? (s(), h(u(V), {
304
- key: 1,
305
- width: g.value.width,
306
- fixed: "right"
307
- }, {
308
- header: p(() => [
309
- E("div", se, [
310
- g.value.customAddRow ? (s(), h(u(I), {
311
- key: 0,
312
- type: "primary",
313
- link: "",
314
- onClick: _
315
- }, {
316
- default: p(() => [
317
- a[0] || (a[0] = E("i", { class: "iconfont icon-Frame1" }, null, -1)),
318
- T(C(g.value.addRowText), 1)
319
- ]),
320
- _: 1
321
- })) : x("", !0),
322
- g.value.customAddColumn ? (s(), h(u(I), {
323
- key: 1,
324
- type: "primary",
325
- link: "",
326
- onClick: O
327
- }, {
328
- default: p(() => [
329
- a[1] || (a[1] = E("i", { class: "iconfont icon-Frame-11" }, null, -1)),
330
- T(C(g.value.addColumnText), 1)
331
- ]),
332
- _: 1
333
- })) : x("", !0)
334
- ])
335
- ]),
336
- default: p(({ $index: e, row: l }) => [
337
- E("div", ne, [
338
- t.$slots.operation ? A(t.$slots, "operation", {
339
- key: 0,
340
- row: n.value[e],
341
- $index: e
342
- }, void 0, !0) : (s(), m(R, { key: 1 }, [
343
- n.value.length > 1 && !l.disabled ? (s(), m("i", {
344
- key: 0,
345
- class: "iconfont icon-close",
346
- onClick: (o) => q(e)
347
- }, null, 8, ue)) : x("", !0)
348
- ], 64))
349
- ])
350
- ]),
351
- _: 3
352
- }, 8, ["width"])) : x("", !0)
353
- ]),
354
- _: 3
355
- }, 16, ["data"])
356
- ]),
357
- _: 3
358
- }, 8, ["model"]));
359
- }
360
- }), fe = /* @__PURE__ */ ae(pe, [["__scopeId", "data-v-5b48bcac"]]), ce = oe(fe);
361
- export {
362
- v as D,
363
- ce as Z
364
- };