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