@chewel611/naive-ui-plus 0.0.5 → 0.0.7
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/index.js +4454 -775
- package/dist/index.umd.cjs +27 -1
- package/es/_virtual/_commonjsHelpers.js +4 -0
- package/es/_virtual/lodash.js +2 -0
- package/es/_virtual/lodash2.js +4 -0
- package/es/modal/PModal.d.ts +5 -2
- package/es/modal/PModal.vue.js +74 -70
- package/es/modal/index.d.ts +7 -4
- package/es/modal/typing.d.ts +1 -1
- package/es/node_modules/lodash/lodash.js +3677 -0
- package/es/table/PTable.d.ts +1 -0
- package/es/table/PTable.vue.js +150 -150
- package/es/table/index.d.ts +3 -0
- package/es/table/typing.d.ts +2 -2
- package/es/utils/helper.d.ts +1 -1
- package/es/utils/helper.js +5 -4
- package/lib/_virtual/_commonjsHelpers.cjs +1 -0
- package/lib/_virtual/lodash.cjs +1 -0
- package/lib/_virtual/lodash2.cjs +1 -0
- package/lib/modal/PModal.d.ts +5 -2
- package/lib/modal/PModal.vue.cjs +1 -1
- package/lib/modal/index.d.ts +7 -4
- package/lib/modal/typing.d.ts +1 -1
- package/lib/node_modules/lodash/lodash.cjs +27 -0
- package/lib/table/PTable.d.ts +1 -0
- package/lib/table/PTable.vue.cjs +1 -1
- package/lib/table/index.d.ts +3 -0
- package/lib/table/typing.d.ts +2 -2
- package/lib/utils/helper.cjs +1 -1
- package/lib/utils/helper.d.ts +1 -1
- package/package.json +1 -3
package/es/table/PTable.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ declare const __VLS_component: import('vue').DefineComponent<DataTableProps, {
|
|
|
21
21
|
getSelectedRow: <T>() => T;
|
|
22
22
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<DataTableProps> & Readonly<{}>, {
|
|
23
23
|
idField: string;
|
|
24
|
+
item: any;
|
|
24
25
|
modalWidth: number;
|
|
25
26
|
hiddenAdd: boolean;
|
|
26
27
|
hiddenEdit: boolean;
|
package/es/table/PTable.vue.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { useDialog as
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { PlusSquareOutlined as
|
|
4
|
-
import { resetObject as
|
|
5
|
-
|
|
1
|
+
import { useDialog as ye, useMessage as we, NCard as ke, NDataTable as be, NModal as _e, NSpace as Ce, NButton as k, NTooltip as Se, NIcon as E, NDropdown as Me } from "naive-ui";
|
|
2
|
+
import { defineComponent as De, ref as c, computed as G, unref as r, onMounted as Oe, createBlock as x, openBlock as m, withCtx as n, createElementVNode as B, createElementBlock as I, createCommentVNode as b, createVNode as s, renderSlot as P, normalizeStyle as K, createTextVNode as T, h as $, toRaw as h } from "vue";
|
|
3
|
+
import { PlusSquareOutlined as Ee, DeleteOutlined as Be, ReloadOutlined as Te, MoreOutlined as $e } from "@vicons/antd";
|
|
4
|
+
import { resetObject as Ne } from "../utils/helper.js";
|
|
5
|
+
import "../_virtual/lodash.js";
|
|
6
|
+
const Re = { id: "data-content" }, ze = {
|
|
6
7
|
key: 0,
|
|
7
8
|
class: "rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-5 mb-5"
|
|
8
|
-
},
|
|
9
|
+
}, Le = { key: 1 }, He = { key: 2 }, Ve = /* @__PURE__ */ De({
|
|
9
10
|
__name: "PTable",
|
|
10
11
|
props: {
|
|
11
12
|
idField: { default: "id" },
|
|
12
|
-
item: {},
|
|
13
|
+
item: { default: {} },
|
|
13
14
|
columns: {},
|
|
14
15
|
modalWidth: { default: 800 },
|
|
15
16
|
hiddenAdd: { type: Boolean, default: !1 },
|
|
@@ -22,27 +23,27 @@ const Te = { id: "data-content" }, $e = {
|
|
|
22
23
|
onSave: {},
|
|
23
24
|
onDelete: {}
|
|
24
25
|
},
|
|
25
|
-
setup(
|
|
26
|
-
const W = c(null),
|
|
26
|
+
setup(X, { expose: Y }) {
|
|
27
|
+
const W = c(null), J = ye(), v = we(), _ = c(!1), C = c([]), S = c([]), M = c(null), g = c(!1), y = c(!1), D = c(!1), N = c({}), f = c({
|
|
27
28
|
page: 1,
|
|
28
29
|
itemCount: 0,
|
|
29
30
|
pageSize: 10,
|
|
30
31
|
pageSizes: [10, 20, 30, 50],
|
|
31
32
|
showSizePicker: !0,
|
|
32
33
|
onChange: async (e) => {
|
|
33
|
-
f.value.page = e, await
|
|
34
|
+
f.value.page = e, await p();
|
|
34
35
|
},
|
|
35
36
|
onUpdatePageSize: async (e) => {
|
|
36
|
-
f.value.pageSize = e, await
|
|
37
|
+
f.value.pageSize = e, await p();
|
|
37
38
|
}
|
|
38
|
-
}),
|
|
39
|
-
const t = (
|
|
39
|
+
}), o = X, Q = (e) => {
|
|
40
|
+
const t = (l) => {
|
|
40
41
|
const a = [];
|
|
41
42
|
return e && e.forEach((i) => {
|
|
42
43
|
i.key !== "edit" && i.key !== "delete" && a.push({
|
|
43
44
|
label: i.name,
|
|
44
45
|
key: i.key,
|
|
45
|
-
props: { onClick: () => i.action(
|
|
46
|
+
props: { onClick: () => i.action(l) }
|
|
46
47
|
});
|
|
47
48
|
}), a;
|
|
48
49
|
};
|
|
@@ -51,273 +52,272 @@ const Te = { id: "data-content" }, $e = {
|
|
|
51
52
|
key: "actions",
|
|
52
53
|
width: 100,
|
|
53
54
|
fixed: "right",
|
|
54
|
-
render: (
|
|
55
|
+
render: (l) => {
|
|
55
56
|
let a = [];
|
|
56
|
-
if (
|
|
57
|
+
if (o.hiddenEdit || a.push({
|
|
57
58
|
label: "编辑",
|
|
58
59
|
key: "edit",
|
|
59
|
-
props: { onClick: () =>
|
|
60
|
-
}),
|
|
60
|
+
props: { onClick: () => ne(l) }
|
|
61
|
+
}), o.hiddenDelete || a.push({
|
|
61
62
|
label: "删除",
|
|
62
63
|
key: "delete",
|
|
63
|
-
props: { onClick: () =>
|
|
64
|
-
}), a = [...a, ...t(
|
|
65
|
-
return
|
|
66
|
-
|
|
64
|
+
props: { onClick: () => te(l) }
|
|
65
|
+
}), a = [...a, ...t(l)], !(a.length <= 0))
|
|
66
|
+
return $(
|
|
67
|
+
Me,
|
|
67
68
|
{
|
|
68
69
|
options: a,
|
|
69
70
|
placement: "bottom-start"
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
|
-
default: () =>
|
|
73
|
-
|
|
73
|
+
default: () => $(
|
|
74
|
+
k,
|
|
74
75
|
{ size: "small", type: "primary" },
|
|
75
|
-
{ default: () => ["操作",
|
|
76
|
+
{ default: () => ["操作", $(E, () => $($e))] }
|
|
76
77
|
)
|
|
77
78
|
}
|
|
78
79
|
);
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
|
-
},
|
|
82
|
-
const e =
|
|
83
|
-
title:
|
|
84
|
-
key:
|
|
85
|
-
width:
|
|
86
|
-
fixed:
|
|
87
|
-
render:
|
|
88
|
-
ellipsis:
|
|
89
|
-
})), t =
|
|
90
|
-
(
|
|
82
|
+
}, Z = G(() => {
|
|
83
|
+
const e = o.columns.filter((l) => l.key != "action").map((l) => ({
|
|
84
|
+
title: l.title,
|
|
85
|
+
key: l.key,
|
|
86
|
+
width: l.width,
|
|
87
|
+
fixed: l.fixed ?? !1,
|
|
88
|
+
render: l.render,
|
|
89
|
+
ellipsis: l.ellipsis ? { tooltip: !0 } : !1
|
|
90
|
+
})), t = o.columns.reduce(
|
|
91
|
+
(l, a) => a.key === "action" ? a : l,
|
|
91
92
|
void 0
|
|
92
93
|
)?.action;
|
|
93
|
-
return t && t?.length > 0 || !
|
|
94
|
+
return t && t?.length > 0 || !o.hiddenDelete || !o.hiddenEdit ? [
|
|
94
95
|
{ type: "selection", fixed: "left" },
|
|
95
96
|
...e,
|
|
96
|
-
|
|
97
|
+
Q(t)
|
|
97
98
|
] : [{ type: "selection", fixed: "left" }, ...e];
|
|
98
|
-
}),
|
|
99
|
-
await
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
const e =
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
e && e.length > 0 &&
|
|
99
|
+
}), ee = async () => {
|
|
100
|
+
await p();
|
|
101
|
+
}, te = (e) => {
|
|
102
|
+
A([e]);
|
|
103
|
+
}, oe = () => {
|
|
104
|
+
const e = R();
|
|
105
|
+
A(e);
|
|
106
|
+
}, A = (e) => {
|
|
107
|
+
e && e.length > 0 && J.warning({
|
|
107
108
|
title: "警告",
|
|
108
109
|
content: "删除数据不可恢复, 确认删除吗?",
|
|
109
110
|
positiveText: "确定",
|
|
110
111
|
negativeText: "取消",
|
|
111
112
|
onPositiveClick: async () => {
|
|
112
|
-
if (
|
|
113
|
+
if (o.onDelete)
|
|
113
114
|
try {
|
|
114
|
-
await
|
|
115
|
+
await o.onDelete(e) ? (p(), v.success("删除成功")) : v.error("删除失败");
|
|
115
116
|
} catch (t) {
|
|
116
|
-
|
|
117
|
+
v.error(t.message);
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}, oe = async (e) => {
|
|
127
|
-
if (l.onOpenModal) {
|
|
128
|
-
l.onOpenModal(e);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
l.onGet && (e = await l.onGet(e[l.idField])), $.value = e, Object.assign(l.item, e), p.value = !1, v.value = !0;
|
|
121
|
+
}, le = () => {
|
|
122
|
+
M.value = null, j();
|
|
123
|
+
}, ne = async (e) => {
|
|
124
|
+
M.value = e, j(e, async () => {
|
|
125
|
+
o.onGet && (e = await o.onGet(e[o.idField])), Object.assign(o.item, e);
|
|
126
|
+
});
|
|
132
127
|
}, V = async () => {
|
|
133
|
-
if (
|
|
128
|
+
if (o.onSave)
|
|
134
129
|
try {
|
|
135
|
-
|
|
130
|
+
D.value = !0, (g.value ? await o.onSave(void 0, h(o.item)) : await o.onSave(M.value[o.idField], h(o.item))) && (O(), await p());
|
|
136
131
|
} catch (e) {
|
|
137
|
-
|
|
132
|
+
v.error(e.message);
|
|
138
133
|
} finally {
|
|
139
|
-
|
|
134
|
+
D.value = !1, console.log("---", N.value);
|
|
140
135
|
}
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
}, j = async (e, t) => {
|
|
137
|
+
o.onOpenModal?.(e), await t?.(), e ? (g.value = !1, y.value = !0) : (y.value = !1, g.value = !0);
|
|
138
|
+
}, O = () => {
|
|
139
|
+
M.value = null, Ne(o.item), Object.assign(o.item, { ...h(N.value) }), o.onCloseModal?.(o.item), g.value = !1, y.value = !1;
|
|
140
|
+
}, R = () => C.value ? S.value.filter((t) => C.value.includes(t.id)).map((t) => h(t)) : [], ae = () => R()[0], se = () => h(S.value), p = async () => {
|
|
141
|
+
if (!_.value) {
|
|
142
|
+
_.value = !0;
|
|
146
143
|
try {
|
|
147
|
-
if (
|
|
148
|
-
var { data: e, total: t } = await
|
|
144
|
+
if (o.onLoad) {
|
|
145
|
+
var { data: e, total: t } = await o.onLoad(
|
|
149
146
|
f.value.page,
|
|
150
147
|
f.value.pageSize
|
|
151
148
|
);
|
|
152
|
-
|
|
149
|
+
S.value = e, f.value.itemCount = t;
|
|
153
150
|
}
|
|
154
|
-
} catch (
|
|
155
|
-
|
|
151
|
+
} catch (l) {
|
|
152
|
+
v.error(l.message);
|
|
156
153
|
} finally {
|
|
157
|
-
|
|
154
|
+
_.value = !1;
|
|
158
155
|
}
|
|
159
156
|
}
|
|
160
|
-
},
|
|
157
|
+
}, ie = G(() => {
|
|
161
158
|
const e = r(W);
|
|
162
159
|
if (!e) return;
|
|
163
|
-
const t = e?.$el,
|
|
160
|
+
const t = e?.$el, l = t.querySelector(".n-data-table-thead "), { bottomIncludeBody: a } = re(l), i = 64;
|
|
164
161
|
let u = 2, d = 24;
|
|
165
|
-
const
|
|
162
|
+
const w = t.querySelector(
|
|
166
163
|
".n-data-table__pagination"
|
|
167
164
|
);
|
|
168
|
-
if (
|
|
169
|
-
const
|
|
170
|
-
u +=
|
|
165
|
+
if (w) {
|
|
166
|
+
const z = w.offsetHeight;
|
|
167
|
+
u += z || 0;
|
|
171
168
|
} else
|
|
172
169
|
u += 28;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const t = document.documentElement, o = t.scrollLeft, a = t.scrollTop, i = t.clientLeft, u = t.clientTop, d = window.pageXOffset, y = window.pageYOffset, O = se(e), {
|
|
177
|
-
left: R,
|
|
178
|
-
top: de,
|
|
179
|
-
width: re,
|
|
180
|
-
height: ce
|
|
181
|
-
} = O, ue = (d || o) - (i || 0), fe = (y || a) - (u || 0), pe = R + d, ge = de + y, z = pe - ue, L = ge - fe, F = window.document.documentElement.clientWidth, U = window.document.documentElement.clientHeight;
|
|
182
|
-
return {
|
|
170
|
+
return a - (i + u + d);
|
|
171
|
+
}), de = (e) => !e || !e.getBoundingClientRect ? 0 : e.getBoundingClientRect(), re = (e) => {
|
|
172
|
+
const t = document.documentElement, l = t.scrollLeft, a = t.scrollTop, i = t.clientLeft, u = t.clientTop, d = window.pageXOffset, w = window.pageYOffset, F = de(e), {
|
|
183
173
|
left: z,
|
|
184
|
-
top:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
174
|
+
top: ue,
|
|
175
|
+
width: fe,
|
|
176
|
+
height: pe
|
|
177
|
+
} = F, ge = (d || l) - (i || 0), me = (w || a) - (u || 0), he = z + d, ve = ue + w, L = he - ge, H = ve - me, U = window.document.documentElement.clientWidth, q = window.document.documentElement.clientHeight;
|
|
178
|
+
return {
|
|
179
|
+
left: L,
|
|
180
|
+
top: H,
|
|
181
|
+
right: U - fe - L,
|
|
182
|
+
bottom: q - pe - H,
|
|
183
|
+
rightIncludeBody: U - L,
|
|
184
|
+
bottomIncludeBody: q - H
|
|
189
185
|
};
|
|
186
|
+
}, ce = () => {
|
|
187
|
+
N.value = { ...h(o.item) };
|
|
190
188
|
};
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
189
|
+
return Oe(async () => {
|
|
190
|
+
ce(), await p();
|
|
191
|
+
}), Y({
|
|
192
|
+
getData: se,
|
|
193
|
+
getSelectedRow: ae,
|
|
194
|
+
getSelectedRows: R,
|
|
195
|
+
closeModal: O,
|
|
196
|
+
refreshData: p,
|
|
197
197
|
resetPage: () => {
|
|
198
198
|
f.value.page = 1;
|
|
199
199
|
}
|
|
200
200
|
}), (e, t) => {
|
|
201
|
-
const
|
|
202
|
-
return m(),
|
|
201
|
+
const l = Se, a = be, i = Ce, u = _e;
|
|
202
|
+
return m(), x(r(ke), {
|
|
203
203
|
title: " ",
|
|
204
204
|
"header-class": "p-4",
|
|
205
205
|
"content-class": "pl-4 pr-4",
|
|
206
206
|
bordered: !1
|
|
207
207
|
}, {
|
|
208
208
|
"header-extra": n(() => [
|
|
209
|
-
e.hiddenAdd ?
|
|
209
|
+
e.hiddenAdd ? b("", !0) : (m(), x(l, {
|
|
210
210
|
key: 0,
|
|
211
211
|
trigger: "hover"
|
|
212
212
|
}, {
|
|
213
213
|
trigger: n(() => [
|
|
214
|
-
s(r(
|
|
214
|
+
s(r(E), {
|
|
215
215
|
size: "18",
|
|
216
216
|
class: "mr-1 cursor-pointer hover:text-blue-600",
|
|
217
|
-
onClick:
|
|
217
|
+
onClick: le
|
|
218
218
|
}, {
|
|
219
219
|
default: n(() => [
|
|
220
|
-
s(r(
|
|
220
|
+
s(r(Ee))
|
|
221
221
|
]),
|
|
222
222
|
_: 1
|
|
223
223
|
})
|
|
224
224
|
]),
|
|
225
225
|
default: n(() => [
|
|
226
|
-
t[3] || (t[3] =
|
|
226
|
+
t[3] || (t[3] = B("span", null, "新增", -1))
|
|
227
227
|
]),
|
|
228
228
|
_: 1,
|
|
229
229
|
__: [3]
|
|
230
230
|
})),
|
|
231
|
-
e.hiddenDelete ?
|
|
231
|
+
e.hiddenDelete ? b("", !0) : (m(), x(l, {
|
|
232
232
|
key: 1,
|
|
233
233
|
trigger: "hover"
|
|
234
234
|
}, {
|
|
235
235
|
trigger: n(() => [
|
|
236
|
-
s(r(
|
|
236
|
+
s(r(E), {
|
|
237
237
|
size: "18",
|
|
238
238
|
class: "mr-1 cursor-pointer hover:text-blue-600",
|
|
239
|
-
onClick:
|
|
239
|
+
onClick: oe
|
|
240
240
|
}, {
|
|
241
241
|
default: n(() => [
|
|
242
|
-
s(r(
|
|
242
|
+
s(r(Be))
|
|
243
243
|
]),
|
|
244
244
|
_: 1
|
|
245
245
|
})
|
|
246
246
|
]),
|
|
247
247
|
default: n(() => [
|
|
248
|
-
t[4] || (t[4] =
|
|
248
|
+
t[4] || (t[4] = B("span", null, "删除", -1))
|
|
249
249
|
]),
|
|
250
250
|
_: 1,
|
|
251
251
|
__: [4]
|
|
252
252
|
})),
|
|
253
|
-
s(
|
|
253
|
+
s(l, { trigger: "hover" }, {
|
|
254
254
|
trigger: n(() => [
|
|
255
|
-
s(r(
|
|
255
|
+
s(r(E), {
|
|
256
256
|
size: "18",
|
|
257
257
|
class: "cursor-pointer hover:text-blue-600",
|
|
258
|
-
onClick:
|
|
258
|
+
onClick: ee
|
|
259
259
|
}, {
|
|
260
260
|
default: n(() => [
|
|
261
|
-
s(r(
|
|
261
|
+
s(r(Te))
|
|
262
262
|
]),
|
|
263
263
|
_: 1
|
|
264
264
|
})
|
|
265
265
|
]),
|
|
266
266
|
default: n(() => [
|
|
267
|
-
t[5] || (t[5] =
|
|
267
|
+
t[5] || (t[5] = B("span", null, "刷新", -1))
|
|
268
268
|
]),
|
|
269
269
|
_: 1,
|
|
270
270
|
__: [5]
|
|
271
271
|
})
|
|
272
272
|
]),
|
|
273
273
|
default: n(() => [
|
|
274
|
-
|
|
275
|
-
e.$slots.toolbar ? (m(),
|
|
274
|
+
B("div", Re, [
|
|
275
|
+
e.$slots.toolbar ? (m(), I("div", ze, [
|
|
276
276
|
P(e.$slots, "toolbar")
|
|
277
|
-
])) :
|
|
277
|
+
])) : b("", !0),
|
|
278
278
|
s(a, {
|
|
279
279
|
remote: "",
|
|
280
280
|
ref_key: "$table",
|
|
281
281
|
ref: W,
|
|
282
|
-
"checked-row-keys":
|
|
283
|
-
"onUpdate:checkedRowKeys": t[0] || (t[0] = (d) =>
|
|
284
|
-
"max-height":
|
|
285
|
-
loading:
|
|
282
|
+
"checked-row-keys": C.value,
|
|
283
|
+
"onUpdate:checkedRowKeys": t[0] || (t[0] = (d) => C.value = d),
|
|
284
|
+
"max-height": ie.value,
|
|
285
|
+
loading: _.value,
|
|
286
286
|
bordered: !1,
|
|
287
287
|
"single-line": !1,
|
|
288
|
-
columns:
|
|
289
|
-
data:
|
|
288
|
+
columns: Z.value,
|
|
289
|
+
data: S.value,
|
|
290
290
|
pagination: f.value,
|
|
291
291
|
"row-key": (d) => d[e.idField]
|
|
292
292
|
}, null, 8, ["checked-row-keys", "max-height", "loading", "columns", "data", "pagination", "row-key"]),
|
|
293
|
-
e.$slots.addModal ? (m(),
|
|
293
|
+
e.$slots.addModal ? (m(), I("div", Le, [
|
|
294
294
|
s(u, {
|
|
295
295
|
title: "新增",
|
|
296
296
|
preset: "dialog",
|
|
297
|
-
show:
|
|
298
|
-
"onUpdate:show": t[1] || (t[1] = (d) =>
|
|
297
|
+
show: g.value,
|
|
298
|
+
"onUpdate:show": t[1] || (t[1] = (d) => g.value = d),
|
|
299
299
|
closable: !1,
|
|
300
300
|
"close-on-esc": !1,
|
|
301
301
|
"mask-closable": !1,
|
|
302
|
-
style:
|
|
302
|
+
style: K({ width: `${e.modalWidth}px` })
|
|
303
303
|
}, {
|
|
304
304
|
action: n(() => [
|
|
305
305
|
s(i, null, {
|
|
306
306
|
default: n(() => [
|
|
307
|
-
s(r(
|
|
307
|
+
s(r(k), {
|
|
308
308
|
type: "primary",
|
|
309
|
-
loading:
|
|
309
|
+
loading: D.value,
|
|
310
310
|
onClick: V
|
|
311
311
|
}, {
|
|
312
312
|
default: n(() => t[6] || (t[6] = [
|
|
313
|
-
|
|
313
|
+
T("保存", -1)
|
|
314
314
|
])),
|
|
315
315
|
_: 1,
|
|
316
316
|
__: [6]
|
|
317
317
|
}, 8, ["loading"]),
|
|
318
|
-
s(r(
|
|
318
|
+
s(r(k), { onClick: O }, {
|
|
319
319
|
default: n(() => t[7] || (t[7] = [
|
|
320
|
-
|
|
320
|
+
T("取消", -1)
|
|
321
321
|
])),
|
|
322
322
|
_: 1,
|
|
323
323
|
__: [7]
|
|
@@ -331,35 +331,35 @@ const Te = { id: "data-content" }, $e = {
|
|
|
331
331
|
]),
|
|
332
332
|
_: 3
|
|
333
333
|
}, 8, ["show", "style"])
|
|
334
|
-
])) :
|
|
335
|
-
e.$slots.editModal ? (m(),
|
|
334
|
+
])) : b("", !0),
|
|
335
|
+
e.$slots.editModal ? (m(), I("div", He, [
|
|
336
336
|
s(u, {
|
|
337
337
|
title: "编辑",
|
|
338
|
-
show:
|
|
339
|
-
"onUpdate:show": t[2] || (t[2] = (d) =>
|
|
338
|
+
show: y.value,
|
|
339
|
+
"onUpdate:show": t[2] || (t[2] = (d) => y.value = d),
|
|
340
340
|
preset: "dialog",
|
|
341
341
|
closable: !1,
|
|
342
342
|
"close-on-esc": !1,
|
|
343
343
|
"mask-closable": !1,
|
|
344
|
-
style:
|
|
344
|
+
style: K({ width: `${e.modalWidth}px` })
|
|
345
345
|
}, {
|
|
346
346
|
action: n(() => [
|
|
347
347
|
s(i, null, {
|
|
348
348
|
default: n(() => [
|
|
349
|
-
s(r(
|
|
349
|
+
s(r(k), {
|
|
350
350
|
type: "primary",
|
|
351
|
-
loading:
|
|
351
|
+
loading: D.value,
|
|
352
352
|
onClick: V
|
|
353
353
|
}, {
|
|
354
354
|
default: n(() => t[8] || (t[8] = [
|
|
355
|
-
|
|
355
|
+
T("保存", -1)
|
|
356
356
|
])),
|
|
357
357
|
_: 1,
|
|
358
358
|
__: [8]
|
|
359
359
|
}, 8, ["loading"]),
|
|
360
|
-
s(r(
|
|
360
|
+
s(r(k), { onClick: O }, {
|
|
361
361
|
default: n(() => t[9] || (t[9] = [
|
|
362
|
-
|
|
362
|
+
T("取消", -1)
|
|
363
363
|
])),
|
|
364
364
|
_: 1,
|
|
365
365
|
__: [9]
|
|
@@ -373,7 +373,7 @@ const Te = { id: "data-content" }, $e = {
|
|
|
373
373
|
]),
|
|
374
374
|
_: 3
|
|
375
375
|
}, 8, ["show", "style"])
|
|
376
|
-
])) :
|
|
376
|
+
])) : b("", !0)
|
|
377
377
|
])
|
|
378
378
|
]),
|
|
379
379
|
_: 3
|
|
@@ -382,5 +382,5 @@ const Te = { id: "data-content" }, $e = {
|
|
|
382
382
|
}
|
|
383
383
|
});
|
|
384
384
|
export {
|
|
385
|
-
|
|
385
|
+
Ve as default
|
|
386
386
|
};
|
package/es/table/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare const _default: {
|
|
|
8
8
|
getSelectedRow: <T>() => T;
|
|
9
9
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
10
10
|
idField: string;
|
|
11
|
+
item: any;
|
|
11
12
|
modalWidth: number;
|
|
12
13
|
hiddenAdd: boolean;
|
|
13
14
|
hiddenEdit: boolean;
|
|
@@ -30,6 +31,7 @@ declare const _default: {
|
|
|
30
31
|
getSelectedRow: <T>() => T;
|
|
31
32
|
}, {}, {}, {}, {
|
|
32
33
|
idField: string;
|
|
34
|
+
item: any;
|
|
33
35
|
modalWidth: number;
|
|
34
36
|
hiddenAdd: boolean;
|
|
35
37
|
hiddenEdit: boolean;
|
|
@@ -47,6 +49,7 @@ declare const _default: {
|
|
|
47
49
|
getSelectedRow: <T>() => T;
|
|
48
50
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
49
51
|
idField: string;
|
|
52
|
+
item: any;
|
|
50
53
|
modalWidth: number;
|
|
51
54
|
hiddenAdd: boolean;
|
|
52
55
|
hiddenEdit: boolean;
|
package/es/table/typing.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface DataTableColumnDefine {
|
|
|
16
16
|
}
|
|
17
17
|
export interface DataTableProps {
|
|
18
18
|
idField?: string;
|
|
19
|
-
item
|
|
19
|
+
item?: any;
|
|
20
20
|
columns: DataTableColumnDefine[];
|
|
21
21
|
modalWidth?: number;
|
|
22
22
|
hiddenAdd?: boolean;
|
|
@@ -29,7 +29,7 @@ export interface DataTableProps {
|
|
|
29
29
|
onGet?: (id: string | number) => Promise<any>;
|
|
30
30
|
onOpenModal?: (item?: any) => void;
|
|
31
31
|
onCloseModal?: (item?: any) => void;
|
|
32
|
-
onSave?: (id?: string | number) => Promise<boolean> | boolean;
|
|
32
|
+
onSave?: (id?: string | number, row?: any) => Promise<boolean> | boolean;
|
|
33
33
|
onDelete?: (rows: any[]) => Promise<boolean> | boolean;
|
|
34
34
|
}
|
|
35
35
|
export interface DataTableMethods {
|
package/es/utils/helper.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const resetObject: (obj:
|
|
1
|
+
export declare const resetObject: (obj: Record<string, any>) => void;
|
package/es/utils/helper.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
Object.keys(
|
|
3
|
-
|
|
1
|
+
const s = (e) => {
|
|
2
|
+
Object.keys(e).forEach((r) => {
|
|
3
|
+
const t = e[r];
|
|
4
|
+
Array.isArray(t) ? e[r] = [] : t !== null && typeof t == "object" ? s(t) : e[r] = void 0;
|
|
4
5
|
});
|
|
5
6
|
};
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
+
s as resetObject
|
|
8
9
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};exports.commonjsGlobal=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("../node_modules/lodash/lodash.cjs");e.__require();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
|
package/lib/modal/PModal.d.ts
CHANGED
|
@@ -2,8 +2,11 @@ import { PModalProps } from './typing';
|
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
3
|
attrs: Partial<{}>;
|
|
4
4
|
slots: {
|
|
5
|
+
header?(_: {}): any;
|
|
6
|
+
'header-extra'?(_: {}): any;
|
|
5
7
|
default?(_: {}): any;
|
|
6
|
-
|
|
8
|
+
footer?(_: {}): any;
|
|
9
|
+
'action-extra'?(_: {}): any;
|
|
7
10
|
};
|
|
8
11
|
refs: {
|
|
9
12
|
$modal: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
|
@@ -2087,9 +2090,9 @@ declare const __VLS_component: import('vue').DefineComponent<PModalProps, {
|
|
|
2087
2090
|
close: () => void;
|
|
2088
2091
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PModalProps> & Readonly<{}>, {
|
|
2089
2092
|
width: number;
|
|
2093
|
+
height: number;
|
|
2090
2094
|
title: string;
|
|
2091
2095
|
closable: boolean;
|
|
2092
|
-
preset: "dialog" | "card";
|
|
2093
2096
|
saveBtnText: string;
|
|
2094
2097
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
2095
2098
|
$modal: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
package/lib/modal/PModal.vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("naive-ui"),e=require("vue"),w=e.defineComponent({__name:"PModal",props:{saveBtnText:{default:"保 存"},closable:{type:Boolean,default:!1},title:{default:"操作"},width:{default:800},height:{default:500},onSave:{},onClose:{}},setup(c,{expose:u}){const d=l.useMessage(),o=c,a=e.ref(!1),s=e.ref(!1),f=async()=>{a.value=!0;try{o.onSave&&await o.onSave()&&r()}catch(t){d.error(t.message)}finally{a.value=!1}},r=()=>{s.value=!1,a.value=!1},p=async()=>{try{o.onClose?await o.onClose()&&r():r()}catch(t){d.error(t.message)}};return u({open:()=>{a.value=!1,s.value=!0},close:()=>{s.value=!1,a.value=!1}}),(t,n)=>{const h=l.NText,i=l.NButton,v=l.NSpace;return e.openBlock(),e.createBlock(e.unref(l.NModal),e.mergeProps({ref:"$modal",preset:"card",show:s.value,"onUpdate:show":n[0]||(n[0]=m=>s.value=m)},t.$attrs,{draggable:!0,closable:!1,"close-on-esc":!1,"mask-closable":!1,bordered:!1,style:{width:`${o.width}px`},onClose:r}),{header:e.withCtx(()=>[t.$slots.header?(e.openBlock(),e.createBlock(h,{key:0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"header")]),"header-extra":e.withCtx(()=>[e.renderSlot(t.$slots,"header-extra")]),default:e.withCtx(()=>[e.createElementVNode("div",{class:"overflow-y-auto overflow-hidden",style:e.normalizeStyle({maxHeight:`${o.height}px`})},[e.renderSlot(t.$slots,"default")],4)]),footer:e.withCtx(()=>[e.renderSlot(t.$slots,"footer")]),action:e.withCtx(()=>[e.createVNode(v,{justify:"end"},{default:e.withCtx(()=>[e.createVNode(i,{type:"primary",loading:a.value,onClick:f},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.saveBtnText),1)]),_:1},8,["loading"]),e.renderSlot(t.$slots,"action-extra"),e.createVNode(i,{onClick:p},{default:e.withCtx(()=>n[1]||(n[1]=[e.createTextVNode("取 消",-1)])),_:1,__:[1]})]),_:3})]),_:3},16,["show","style"])}}});exports.default=w;
|