@chewel611/naive-ui-plus 0.0.6 → 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 +4441 -755
- 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 +4 -1
- package/es/modal/PModal.vue.js +59 -44
- package/es/modal/index.d.ts +6 -3
- package/es/modal/typing.d.ts +1 -1
- package/es/node_modules/lodash/lodash.js +3677 -0
- package/es/table/PTable.vue.js +145 -148
- 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 +4 -1
- package/lib/modal/PModal.vue.cjs +1 -1
- package/lib/modal/index.d.ts +6 -3
- package/lib/modal/typing.d.ts +1 -1
- package/lib/node_modules/lodash/lodash.cjs +27 -0
- package/lib/table/PTable.vue.cjs +1 -1
- package/package.json +1 -3
package/es/table/PTable.vue.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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" },
|
|
@@ -23,26 +24,26 @@ const $e = { id: "data-content" }, Ne = {
|
|
|
23
24
|
onDelete: {}
|
|
24
25
|
},
|
|
25
26
|
setup(X, { expose: Y }) {
|
|
26
|
-
const W =
|
|
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,254 +52,250 @@ const $e = { id: "data-content" }, Ne = {
|
|
|
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
|
}, Z = G(() => {
|
|
82
|
-
const e =
|
|
83
|
-
title:
|
|
84
|
-
key:
|
|
85
|
-
width:
|
|
86
|
-
fixed:
|
|
87
|
-
render:
|
|
88
|
-
ellipsis:
|
|
89
|
-
})), t =
|
|
90
|
-
(
|
|
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
|
-
},
|
|
99
|
+
}), ee = async () => {
|
|
100
|
+
await p();
|
|
101
|
+
}, te = (e) => {
|
|
102
|
+
A([e]);
|
|
103
|
+
}, oe = () => {
|
|
104
|
+
const e = R();
|
|
105
|
+
A(e);
|
|
106
|
+
}, A = (e) => {
|
|
106
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
|
-
|
|
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);
|
|
125
126
|
});
|
|
126
127
|
}, V = async () => {
|
|
127
|
-
if (
|
|
128
|
+
if (o.onSave)
|
|
128
129
|
try {
|
|
129
|
-
|
|
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());
|
|
130
131
|
} catch (e) {
|
|
131
|
-
|
|
132
|
+
v.error(e.message);
|
|
132
133
|
} finally {
|
|
133
|
-
|
|
134
|
+
D.value = !1, console.log("---", N.value);
|
|
134
135
|
}
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (S.value = null, l.onCloseModal) {
|
|
143
|
-
l.onCloseModal();
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
p.value = !1, v.value = !1;
|
|
147
|
-
}, N = () => _.value ? C.value.filter((t) => _.value.includes(t.id)).map((t) => $(t)) : [], ne = () => N()[0], ae = () => $(C.value), g = async () => {
|
|
148
|
-
if (!b.value) {
|
|
149
|
-
b.value = !0;
|
|
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;
|
|
150
143
|
try {
|
|
151
|
-
if (
|
|
152
|
-
var { data: e, total: t } = await
|
|
144
|
+
if (o.onLoad) {
|
|
145
|
+
var { data: e, total: t } = await o.onLoad(
|
|
153
146
|
f.value.page,
|
|
154
147
|
f.value.pageSize
|
|
155
148
|
);
|
|
156
|
-
|
|
149
|
+
S.value = e, f.value.itemCount = t;
|
|
157
150
|
}
|
|
158
|
-
} catch (
|
|
159
|
-
|
|
151
|
+
} catch (l) {
|
|
152
|
+
v.error(l.message);
|
|
160
153
|
} finally {
|
|
161
|
-
|
|
154
|
+
_.value = !1;
|
|
162
155
|
}
|
|
163
156
|
}
|
|
164
|
-
},
|
|
157
|
+
}, ie = G(() => {
|
|
165
158
|
const e = r(W);
|
|
166
159
|
if (!e) return;
|
|
167
|
-
const t = e?.$el,
|
|
168
|
-
let
|
|
169
|
-
const
|
|
160
|
+
const t = e?.$el, l = t.querySelector(".n-data-table-thead "), { bottomIncludeBody: a } = re(l), i = 64;
|
|
161
|
+
let u = 2, d = 24;
|
|
162
|
+
const w = t.querySelector(
|
|
170
163
|
".n-data-table__pagination"
|
|
171
164
|
);
|
|
172
|
-
if (
|
|
173
|
-
const
|
|
174
|
-
|
|
165
|
+
if (w) {
|
|
166
|
+
const z = w.offsetHeight;
|
|
167
|
+
u += z || 0;
|
|
175
168
|
} else
|
|
176
|
-
|
|
177
|
-
return a - (i +
|
|
178
|
-
}),
|
|
179
|
-
const t = document.documentElement,
|
|
180
|
-
left: R,
|
|
181
|
-
top: re,
|
|
182
|
-
width: ue,
|
|
183
|
-
height: ce
|
|
184
|
-
} = U, fe = (d || o) - (i || 0), pe = (y || a) - (c || 0), ge = R + d, me = re + y, z = ge - fe, L = me - pe, j = window.document.documentElement.clientWidth, q = window.document.documentElement.clientHeight;
|
|
185
|
-
return {
|
|
169
|
+
u += 28;
|
|
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), {
|
|
186
173
|
left: z,
|
|
187
|
-
top:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
|
192
185
|
};
|
|
186
|
+
}, ce = () => {
|
|
187
|
+
N.value = { ...h(o.item) };
|
|
193
188
|
};
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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,
|
|
200
197
|
resetPage: () => {
|
|
201
198
|
f.value.page = 1;
|
|
202
199
|
}
|
|
203
200
|
}), (e, t) => {
|
|
204
|
-
const
|
|
205
|
-
return m(),
|
|
201
|
+
const l = Se, a = be, i = Ce, u = _e;
|
|
202
|
+
return m(), x(r(ke), {
|
|
206
203
|
title: " ",
|
|
207
204
|
"header-class": "p-4",
|
|
208
205
|
"content-class": "pl-4 pr-4",
|
|
209
206
|
bordered: !1
|
|
210
207
|
}, {
|
|
211
208
|
"header-extra": n(() => [
|
|
212
|
-
e.hiddenAdd ?
|
|
209
|
+
e.hiddenAdd ? b("", !0) : (m(), x(l, {
|
|
213
210
|
key: 0,
|
|
214
211
|
trigger: "hover"
|
|
215
212
|
}, {
|
|
216
213
|
trigger: n(() => [
|
|
217
|
-
s(r(
|
|
214
|
+
s(r(E), {
|
|
218
215
|
size: "18",
|
|
219
216
|
class: "mr-1 cursor-pointer hover:text-blue-600",
|
|
220
|
-
onClick:
|
|
217
|
+
onClick: le
|
|
221
218
|
}, {
|
|
222
219
|
default: n(() => [
|
|
223
|
-
s(r(
|
|
220
|
+
s(r(Ee))
|
|
224
221
|
]),
|
|
225
222
|
_: 1
|
|
226
223
|
})
|
|
227
224
|
]),
|
|
228
225
|
default: n(() => [
|
|
229
|
-
t[3] || (t[3] =
|
|
226
|
+
t[3] || (t[3] = B("span", null, "新增", -1))
|
|
230
227
|
]),
|
|
231
228
|
_: 1,
|
|
232
229
|
__: [3]
|
|
233
230
|
})),
|
|
234
|
-
e.hiddenDelete ?
|
|
231
|
+
e.hiddenDelete ? b("", !0) : (m(), x(l, {
|
|
235
232
|
key: 1,
|
|
236
233
|
trigger: "hover"
|
|
237
234
|
}, {
|
|
238
235
|
trigger: n(() => [
|
|
239
|
-
s(r(
|
|
236
|
+
s(r(E), {
|
|
240
237
|
size: "18",
|
|
241
238
|
class: "mr-1 cursor-pointer hover:text-blue-600",
|
|
242
|
-
onClick:
|
|
239
|
+
onClick: oe
|
|
243
240
|
}, {
|
|
244
241
|
default: n(() => [
|
|
245
|
-
s(r(
|
|
242
|
+
s(r(Be))
|
|
246
243
|
]),
|
|
247
244
|
_: 1
|
|
248
245
|
})
|
|
249
246
|
]),
|
|
250
247
|
default: n(() => [
|
|
251
|
-
t[4] || (t[4] =
|
|
248
|
+
t[4] || (t[4] = B("span", null, "删除", -1))
|
|
252
249
|
]),
|
|
253
250
|
_: 1,
|
|
254
251
|
__: [4]
|
|
255
252
|
})),
|
|
256
|
-
s(
|
|
253
|
+
s(l, { trigger: "hover" }, {
|
|
257
254
|
trigger: n(() => [
|
|
258
|
-
s(r(
|
|
255
|
+
s(r(E), {
|
|
259
256
|
size: "18",
|
|
260
257
|
class: "cursor-pointer hover:text-blue-600",
|
|
261
|
-
onClick:
|
|
258
|
+
onClick: ee
|
|
262
259
|
}, {
|
|
263
260
|
default: n(() => [
|
|
264
|
-
s(r(
|
|
261
|
+
s(r(Te))
|
|
265
262
|
]),
|
|
266
263
|
_: 1
|
|
267
264
|
})
|
|
268
265
|
]),
|
|
269
266
|
default: n(() => [
|
|
270
|
-
t[5] || (t[5] =
|
|
267
|
+
t[5] || (t[5] = B("span", null, "刷新", -1))
|
|
271
268
|
]),
|
|
272
269
|
_: 1,
|
|
273
270
|
__: [5]
|
|
274
271
|
})
|
|
275
272
|
]),
|
|
276
273
|
default: n(() => [
|
|
277
|
-
|
|
278
|
-
e.$slots.toolbar ? (m(),
|
|
274
|
+
B("div", Re, [
|
|
275
|
+
e.$slots.toolbar ? (m(), I("div", ze, [
|
|
279
276
|
P(e.$slots, "toolbar")
|
|
280
|
-
])) :
|
|
277
|
+
])) : b("", !0),
|
|
281
278
|
s(a, {
|
|
282
279
|
remote: "",
|
|
283
280
|
ref_key: "$table",
|
|
284
281
|
ref: W,
|
|
285
|
-
"checked-row-keys":
|
|
286
|
-
"onUpdate:checkedRowKeys": t[0] || (t[0] = (d) =>
|
|
287
|
-
"max-height":
|
|
288
|
-
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,
|
|
289
286
|
bordered: !1,
|
|
290
287
|
"single-line": !1,
|
|
291
288
|
columns: Z.value,
|
|
292
|
-
data:
|
|
289
|
+
data: S.value,
|
|
293
290
|
pagination: f.value,
|
|
294
291
|
"row-key": (d) => d[e.idField]
|
|
295
292
|
}, null, 8, ["checked-row-keys", "max-height", "loading", "columns", "data", "pagination", "row-key"]),
|
|
296
|
-
e.$slots.addModal ? (m(),
|
|
297
|
-
s(
|
|
293
|
+
e.$slots.addModal ? (m(), I("div", Le, [
|
|
294
|
+
s(u, {
|
|
298
295
|
title: "新增",
|
|
299
296
|
preset: "dialog",
|
|
300
|
-
show:
|
|
301
|
-
"onUpdate:show": t[1] || (t[1] = (d) =>
|
|
297
|
+
show: g.value,
|
|
298
|
+
"onUpdate:show": t[1] || (t[1] = (d) => g.value = d),
|
|
302
299
|
closable: !1,
|
|
303
300
|
"close-on-esc": !1,
|
|
304
301
|
"mask-closable": !1,
|
|
@@ -307,20 +304,20 @@ const $e = { id: "data-content" }, Ne = {
|
|
|
307
304
|
action: n(() => [
|
|
308
305
|
s(i, null, {
|
|
309
306
|
default: n(() => [
|
|
310
|
-
s(r(
|
|
307
|
+
s(r(k), {
|
|
311
308
|
type: "primary",
|
|
312
|
-
loading:
|
|
309
|
+
loading: D.value,
|
|
313
310
|
onClick: V
|
|
314
311
|
}, {
|
|
315
312
|
default: n(() => t[6] || (t[6] = [
|
|
316
|
-
|
|
313
|
+
T("保存", -1)
|
|
317
314
|
])),
|
|
318
315
|
_: 1,
|
|
319
316
|
__: [6]
|
|
320
317
|
}, 8, ["loading"]),
|
|
321
|
-
s(r(
|
|
318
|
+
s(r(k), { onClick: O }, {
|
|
322
319
|
default: n(() => t[7] || (t[7] = [
|
|
323
|
-
|
|
320
|
+
T("取消", -1)
|
|
324
321
|
])),
|
|
325
322
|
_: 1,
|
|
326
323
|
__: [7]
|
|
@@ -334,12 +331,12 @@ const $e = { id: "data-content" }, Ne = {
|
|
|
334
331
|
]),
|
|
335
332
|
_: 3
|
|
336
333
|
}, 8, ["show", "style"])
|
|
337
|
-
])) :
|
|
338
|
-
e.$slots.editModal ? (m(),
|
|
339
|
-
s(
|
|
334
|
+
])) : b("", !0),
|
|
335
|
+
e.$slots.editModal ? (m(), I("div", He, [
|
|
336
|
+
s(u, {
|
|
340
337
|
title: "编辑",
|
|
341
|
-
show:
|
|
342
|
-
"onUpdate:show": t[2] || (t[2] = (d) =>
|
|
338
|
+
show: y.value,
|
|
339
|
+
"onUpdate:show": t[2] || (t[2] = (d) => y.value = d),
|
|
343
340
|
preset: "dialog",
|
|
344
341
|
closable: !1,
|
|
345
342
|
"close-on-esc": !1,
|
|
@@ -349,20 +346,20 @@ const $e = { id: "data-content" }, Ne = {
|
|
|
349
346
|
action: n(() => [
|
|
350
347
|
s(i, null, {
|
|
351
348
|
default: n(() => [
|
|
352
|
-
s(r(
|
|
349
|
+
s(r(k), {
|
|
353
350
|
type: "primary",
|
|
354
|
-
loading:
|
|
351
|
+
loading: D.value,
|
|
355
352
|
onClick: V
|
|
356
353
|
}, {
|
|
357
354
|
default: n(() => t[8] || (t[8] = [
|
|
358
|
-
|
|
355
|
+
T("保存", -1)
|
|
359
356
|
])),
|
|
360
357
|
_: 1,
|
|
361
358
|
__: [8]
|
|
362
359
|
}, 8, ["loading"]),
|
|
363
|
-
s(r(
|
|
360
|
+
s(r(k), { onClick: O }, {
|
|
364
361
|
default: n(() => t[9] || (t[9] = [
|
|
365
|
-
|
|
362
|
+
T("取消", -1)
|
|
366
363
|
])),
|
|
367
364
|
_: 1,
|
|
368
365
|
__: [9]
|
|
@@ -376,7 +373,7 @@ const $e = { id: "data-content" }, Ne = {
|
|
|
376
373
|
]),
|
|
377
374
|
_: 3
|
|
378
375
|
}, 8, ["show", "style"])
|
|
379
|
-
])) :
|
|
376
|
+
])) : b("", !0)
|
|
380
377
|
])
|
|
381
378
|
]),
|
|
382
379
|
_: 3
|
|
@@ -385,5 +382,5 @@ const $e = { id: "data-content" }, Ne = {
|
|
|
385
382
|
}
|
|
386
383
|
});
|
|
387
384
|
export {
|
|
388
|
-
|
|
385
|
+
Ve as default
|
|
389
386
|
};
|
|
@@ -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,7 +2,10 @@ 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;
|
|
8
|
+
footer?(_: {}): any;
|
|
6
9
|
'action-extra'?(_: {}): any;
|
|
7
10
|
};
|
|
8
11
|
refs: {
|
|
@@ -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;
|
package/lib/modal/index.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ declare const _default: {
|
|
|
4
4
|
close: () => void;
|
|
5
5
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
6
6
|
width: number;
|
|
7
|
+
height: number;
|
|
7
8
|
title: string;
|
|
8
9
|
closable: boolean;
|
|
9
|
-
preset: "dialog" | "card";
|
|
10
10
|
saveBtnText: string;
|
|
11
11
|
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
12
12
|
$modal: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
|
@@ -2093,9 +2093,9 @@ declare const _default: {
|
|
|
2093
2093
|
close: () => void;
|
|
2094
2094
|
}, {}, {}, {}, {
|
|
2095
2095
|
width: number;
|
|
2096
|
+
height: number;
|
|
2096
2097
|
title: string;
|
|
2097
2098
|
closable: boolean;
|
|
2098
|
-
preset: "dialog" | "card";
|
|
2099
2099
|
saveBtnText: string;
|
|
2100
2100
|
}>;
|
|
2101
2101
|
__isFragment?: never;
|
|
@@ -2106,13 +2106,16 @@ declare const _default: {
|
|
|
2106
2106
|
close: () => void;
|
|
2107
2107
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
2108
2108
|
width: number;
|
|
2109
|
+
height: number;
|
|
2109
2110
|
title: string;
|
|
2110
2111
|
closable: boolean;
|
|
2111
|
-
preset: "dialog" | "card";
|
|
2112
2112
|
saveBtnText: string;
|
|
2113
2113
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
2114
2114
|
$slots: {
|
|
2115
|
+
header?(_: {}): any;
|
|
2116
|
+
'header-extra'?(_: {}): any;
|
|
2115
2117
|
default?(_: {}): any;
|
|
2118
|
+
footer?(_: {}): any;
|
|
2116
2119
|
'action-extra'?(_: {}): any;
|
|
2117
2120
|
};
|
|
2118
2121
|
}) & import('vue').Plugin;
|
package/lib/modal/typing.d.ts
CHANGED