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