@chewel611/naive-ui-plus 0.0.19 → 0.0.21
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/LICENSE +21 -0
- package/dist/index.js +804 -676
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/es/application/PApplication.vue.js +16 -16
- package/es/application/index.d.ts +1 -2
- package/es/application/index.js +4 -4
- package/es/components.d.ts +9 -5
- package/es/components.js +20 -9
- package/es/error/P403.css +1 -0
- package/es/error/P403.d.ts +2 -0
- package/es/error/P403.vue.js +19 -0
- package/es/error/P404.css +1 -0
- package/es/error/P404.d.ts +2 -0
- package/es/error/P404.vue.js +19 -0
- package/es/error/P500.css +1 -0
- package/es/error/P500.d.ts +2 -0
- package/es/error/P500.vue.js +19 -0
- package/es/error/index.d.ts +39 -0
- package/es/error/index.js +10 -0
- package/es/iframe/PIframe.css +1 -0
- package/es/iframe/PIframe.d.ts +4 -0
- package/es/iframe/PIframe.vue.js +7 -0
- package/es/iframe/PIframe.vue2.js +46 -0
- package/es/iframe/index.d.ts +15 -0
- package/es/iframe/index.js +6 -0
- package/es/index.d.ts +5 -1
- package/es/index.js +34 -21
- package/es/languages/PLanguage.vue.js +28 -28
- package/es/languages/index.d.ts +3 -4
- package/es/languages/index.js +4 -5
- package/es/languages/store.d.ts +1 -1
- package/es/languages/store.js +1 -1
- package/es/layout/PEmptyLayout.d.ts +2 -0
- package/es/layout/PEmptyLayout.vue.js +11 -0
- package/es/layout/PLayout.css +1 -1
- package/es/layout/PLayout.vue.js +1 -1
- package/es/layout/PLayout.vue2.js +6 -6
- package/es/layout/content/PContent.vue.js +10 -10
- package/es/layout/content/PTabs.css +1 -1
- package/es/layout/content/PTabs.vue.js +2 -2
- package/es/layout/content/PTabs.vue2.js +60 -57
- package/es/layout/header/PHeader.css +1 -1
- package/es/layout/header/PHeader.vue.js +2 -2
- package/es/layout/header/PHeader.vue2.js +10 -17
- package/es/layout/index.d.ts +16 -3
- package/es/layout/index.js +6 -4
- package/es/layout/sider/PLogo.css +1 -1
- package/es/layout/sider/PLogo.vue.js +2 -2
- package/es/layout/sider/PLogo.vue2.js +5 -5
- package/es/layout/sider/PMenus.vue.js +5 -5
- package/es/layout/{layout.d.ts → store.d.ts} +236 -251
- package/es/layout/{layout.js → store.js} +1 -1
- package/es/layout/typing.d.ts +25 -0
- package/es/modal/PModal.d.ts +87 -59
- package/es/modal/PModal.vue.js +37 -38
- package/es/modal/index.d.ts +47 -33
- package/es/modal/index.js +4 -4
- package/es/modal/typing.d.ts +2 -2
- package/es/oidc/POidc.css +1 -0
- package/es/oidc/POidc.d.ts +2 -0
- package/es/oidc/POidc.vue.js +7 -0
- package/es/oidc/POidc.vue2.js +25 -0
- package/es/oidc/index.d.ts +15 -0
- package/es/oidc/index.js +6 -0
- package/es/oidc/store.d.ts +17 -0
- package/es/oidc/store.js +24 -0
- package/es/oidc/typing.d.ts +5 -0
- package/es/redirect/PRedirect.d.ts +2 -0
- package/es/redirect/PRedirect.vue.js +19 -0
- package/es/redirect/PRedirect.vue2.js +4 -0
- package/es/redirect/index.d.ts +13 -0
- package/es/redirect/index.js +6 -0
- package/es/table/PTable.vue.js +114 -121
- package/es/table/index.d.ts +2 -2
- package/es/table/index.js +4 -4
- package/es/table/typing.d.ts +8 -8
- package/lib/application/PApplication.vue.cjs +1 -1
- package/lib/application/index.cjs +1 -1
- package/lib/application/index.d.ts +1 -2
- package/lib/components.cjs +1 -1
- package/lib/components.d.ts +9 -5
- package/lib/error/P403.css +1 -0
- package/lib/error/P403.d.ts +2 -0
- package/lib/error/P403.vue.cjs +1 -0
- package/lib/error/P404.css +1 -0
- package/lib/error/P404.d.ts +2 -0
- package/lib/error/P404.vue.cjs +1 -0
- package/lib/error/P500.css +1 -0
- package/lib/error/P500.d.ts +2 -0
- package/lib/error/P500.vue.cjs +1 -0
- package/lib/error/index.cjs +1 -0
- package/lib/error/index.d.ts +39 -0
- package/lib/iframe/PIframe.css +1 -0
- package/lib/iframe/PIframe.d.ts +4 -0
- package/lib/iframe/PIframe.vue.cjs +1 -0
- package/lib/iframe/PIframe.vue2.cjs +1 -0
- package/lib/iframe/index.cjs +1 -0
- package/lib/iframe/index.d.ts +15 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/languages/PLanguage.vue.cjs +1 -1
- package/lib/languages/index.cjs +1 -1
- package/lib/languages/index.d.ts +3 -4
- package/lib/languages/store.cjs +1 -1
- package/lib/languages/store.d.ts +1 -1
- package/lib/layout/PEmptyLayout.d.ts +2 -0
- package/lib/layout/PEmptyLayout.vue.cjs +1 -0
- package/lib/layout/PLayout.css +1 -1
- package/lib/layout/PLayout.vue.cjs +1 -1
- package/lib/layout/PLayout.vue2.cjs +1 -1
- package/lib/layout/content/PContent.vue.cjs +1 -1
- package/lib/layout/content/PTabs.css +1 -1
- package/lib/layout/content/PTabs.vue.cjs +1 -1
- package/lib/layout/content/PTabs.vue2.cjs +1 -1
- package/lib/layout/header/PHeader.css +1 -1
- package/lib/layout/header/PHeader.vue.cjs +1 -1
- package/lib/layout/header/PHeader.vue2.cjs +1 -1
- package/lib/layout/index.cjs +1 -1
- package/lib/layout/index.d.ts +16 -3
- package/lib/layout/sider/PLogo.css +1 -1
- package/lib/layout/sider/PLogo.vue.cjs +1 -1
- package/lib/layout/sider/PLogo.vue2.cjs +1 -1
- package/lib/layout/sider/PMenus.vue.cjs +1 -1
- package/lib/layout/{layout.cjs → store.cjs} +1 -1
- package/lib/layout/{layout.d.ts → store.d.ts} +236 -251
- package/lib/layout/typing.d.ts +25 -0
- package/lib/modal/PModal.d.ts +87 -59
- package/lib/modal/PModal.vue.cjs +1 -1
- package/lib/modal/index.cjs +1 -1
- package/lib/modal/index.d.ts +47 -33
- package/lib/modal/typing.d.ts +2 -2
- package/lib/oidc/POidc.css +1 -0
- package/lib/oidc/POidc.d.ts +2 -0
- package/lib/oidc/POidc.vue.cjs +1 -0
- package/lib/oidc/POidc.vue2.cjs +1 -0
- package/lib/oidc/index.cjs +1 -0
- package/lib/oidc/index.d.ts +15 -0
- package/lib/oidc/store.cjs +1 -0
- package/lib/oidc/store.d.ts +17 -0
- package/lib/oidc/typing.d.ts +5 -0
- package/lib/redirect/PRedirect.d.ts +2 -0
- package/lib/redirect/PRedirect.vue.cjs +1 -0
- package/lib/redirect/PRedirect.vue2.cjs +1 -0
- package/lib/redirect/index.cjs +1 -0
- package/lib/redirect/index.d.ts +13 -0
- package/lib/table/PTable.vue.cjs +1 -1
- package/lib/table/index.cjs +1 -1
- package/lib/table/index.d.ts +2 -2
- package/lib/table/typing.d.ts +8 -8
- package/package.json +21 -24
- package/es/typing.d.ts +0 -5
- package/lib/typing.d.ts +0 -5
package/es/modal/typing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ModalProps = {
|
|
2
2
|
saveBtnText?: string;
|
|
3
3
|
closable?: boolean;
|
|
4
4
|
title?: string;
|
|
@@ -9,7 +9,7 @@ export type PModalProps = {
|
|
|
9
9
|
onSave?: () => Promise<boolean> | boolean;
|
|
10
10
|
onClose?: () => Promise<boolean> | boolean;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
12
|
+
export type ModalMethods = {
|
|
13
13
|
open: () => void;
|
|
14
14
|
close: () => void;
|
|
15
15
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.view-auth-callback[data-v-71eae482]{display:flex;flex-direction:column;height:100vh;overflow:auto}.view-auth-callback-content[data-v-71eae482]{flex:1;padding:32px 12px;display:flex;justify-content:center;align-items:center}.view-auth-callback-spinner[data-v-71eae482]{display:flex;justify-content:center;align-items:center;height:100px}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineComponent as n, onMounted as l, openBlock as s, createElementBlock as i, createElementVNode as o } from "vue";
|
|
2
|
+
import { useRouter as u } from "vue-router";
|
|
3
|
+
import { useOidcStore as m } from "./store.js";
|
|
4
|
+
const p = { class: "view-auth-callback" }, v = /* @__PURE__ */ n({
|
|
5
|
+
__name: "POidc",
|
|
6
|
+
setup(d) {
|
|
7
|
+
const r = u(), { callCallback: c, callError: a } = m();
|
|
8
|
+
return l(async () => {
|
|
9
|
+
try {
|
|
10
|
+
c();
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.error("OIDC回调处理失败:", e), a(r, e);
|
|
13
|
+
}
|
|
14
|
+
}), (e, t) => (s(), i("div", p, [...t[0] || (t[0] = [
|
|
15
|
+
o("div", { class: "view-auth-callback-content" }, [
|
|
16
|
+
o("div", { class: "view-auth-callback-spinner" }, [
|
|
17
|
+
o("span", null, "正在处理登录回调...")
|
|
18
|
+
])
|
|
19
|
+
], -1)
|
|
20
|
+
])]));
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
v as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type * from './typing';
|
|
2
|
+
export { useOidcStore } from './store';
|
|
3
|
+
export declare const POidcPlugin: {
|
|
4
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
5
|
+
P: {};
|
|
6
|
+
B: {};
|
|
7
|
+
D: {};
|
|
8
|
+
C: {};
|
|
9
|
+
M: {};
|
|
10
|
+
Defaults: {};
|
|
11
|
+
}, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
12
|
+
__isFragment?: never;
|
|
13
|
+
__isTeleport?: never;
|
|
14
|
+
__isSuspense?: never;
|
|
15
|
+
} & import('vue').ComponentOptionsBase<Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & import('vue').Plugin;
|
package/es/oidc/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Router } from 'vue-router';
|
|
2
|
+
export declare const useOidcStore: import('pinia').StoreDefinition<"oidc", Pick<{
|
|
3
|
+
setCallback: (callback: () => Promise<void>) => void;
|
|
4
|
+
callCallback: () => Promise<void>;
|
|
5
|
+
setError: (error: (router: Router) => void) => void;
|
|
6
|
+
callError: (router: Router, error: Error) => void;
|
|
7
|
+
}, never>, Pick<{
|
|
8
|
+
setCallback: (callback: () => Promise<void>) => void;
|
|
9
|
+
callCallback: () => Promise<void>;
|
|
10
|
+
setError: (error: (router: Router) => void) => void;
|
|
11
|
+
callError: (router: Router, error: Error) => void;
|
|
12
|
+
}, never>, Pick<{
|
|
13
|
+
setCallback: (callback: () => Promise<void>) => void;
|
|
14
|
+
callCallback: () => Promise<void>;
|
|
15
|
+
setError: (error: (router: Router) => void) => void;
|
|
16
|
+
callError: (router: Router, error: Error) => void;
|
|
17
|
+
}, "setCallback" | "callCallback" | "setError" | "callError">>;
|
package/es/oidc/store.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineStore as l } from "pinia";
|
|
2
|
+
import { reactive as o } from "vue";
|
|
3
|
+
const k = l("oidc", () => {
|
|
4
|
+
const r = o({
|
|
5
|
+
callback: void 0
|
|
6
|
+
});
|
|
7
|
+
return {
|
|
8
|
+
setCallback: (c) => {
|
|
9
|
+
r.callback = c;
|
|
10
|
+
},
|
|
11
|
+
callCallback: async () => {
|
|
12
|
+
r.callback && await r.callback();
|
|
13
|
+
},
|
|
14
|
+
setError: (c) => {
|
|
15
|
+
r.error = c;
|
|
16
|
+
},
|
|
17
|
+
callError: (c, a) => {
|
|
18
|
+
r.error && r.error(c, a);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
export {
|
|
23
|
+
k as useOidcStore
|
|
24
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineComponent as a, onBeforeMount as m } from "vue";
|
|
2
|
+
import { useRoute as s, useRouter as u } from "vue-router";
|
|
3
|
+
import { NEmpty as p } from "naive-ui";
|
|
4
|
+
const l = a({
|
|
5
|
+
name: "Redirect",
|
|
6
|
+
setup() {
|
|
7
|
+
const t = s(), r = u();
|
|
8
|
+
return m(() => {
|
|
9
|
+
const { params: o, query: n } = t, { path: e } = o;
|
|
10
|
+
r.replace({
|
|
11
|
+
path: "/" + (Array.isArray(e) ? e.join("/") : e),
|
|
12
|
+
query: n
|
|
13
|
+
});
|
|
14
|
+
}), () => /* @__PURE__ */ React.createElement(p, null);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
l as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const PRedirectPlugin: {
|
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
3
|
+
P: {};
|
|
4
|
+
B: {};
|
|
5
|
+
D: {};
|
|
6
|
+
C: {};
|
|
7
|
+
M: {};
|
|
8
|
+
Defaults: {};
|
|
9
|
+
}, Readonly<{}> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {}>;
|
|
10
|
+
__isFragment?: never;
|
|
11
|
+
__isTeleport?: never;
|
|
12
|
+
__isSuspense?: never;
|
|
13
|
+
} & import('vue').ComponentOptionsBase<Readonly<{}> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & import('vue').Plugin;
|
package/es/table/PTable.vue.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useDialog as ye, useMessage as we, NCard as ke, NDataTable as be, NModal as
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { PlusSquareOutlined as
|
|
1
|
+
import { useDialog as ye, useMessage as we, NCard as ke, NDataTable as be, NModal as Ce, NSpace as Se, NButton as C, NTooltip as De, NIcon as B, NDropdown as Me } from "naive-ui";
|
|
2
|
+
import { defineComponent as Oe, ref as c, computed as K, unref as r, onMounted as Ee, openBlock as v, createBlock as _, withCtx as n, createElementVNode as T, createElementBlock as j, renderSlot as I, createCommentVNode as S, createVNode as s, normalizeStyle as X, createTextVNode as $, h as N, toRaw as y } from "vue";
|
|
3
|
+
import { PlusSquareOutlined as xe, DeleteOutlined as Be, ReloadOutlined as Te, MoreOutlined as $e } from "@vicons/antd";
|
|
4
4
|
import { resetObject as Ne } from "../utils/helper.js";
|
|
5
5
|
import { cloneDeep as Re } from "lodash";
|
|
6
6
|
const ze = { id: "data-content" }, Le = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-5 mb-5"
|
|
9
|
-
}, He = { key: 1 },
|
|
9
|
+
}, He = { key: 1 }, _e = { key: 2 }, Ve = /* @__PURE__ */ Oe({
|
|
10
10
|
__name: "PTable",
|
|
11
11
|
props: {
|
|
12
12
|
idField: { default: "id" },
|
|
@@ -23,8 +23,8 @@ const ze = { id: "data-content" }, Le = {
|
|
|
23
23
|
onSave: {},
|
|
24
24
|
onDelete: {}
|
|
25
25
|
},
|
|
26
|
-
setup(
|
|
27
|
-
const
|
|
26
|
+
setup(m, { expose: Y }) {
|
|
27
|
+
const P = c(null), J = ye(), w = we(), D = c(!1), M = c([]), O = c([]), f = c(null), h = c(!1), k = c(!1), E = c(!1), W = c({}), p = c({
|
|
28
28
|
page: 1,
|
|
29
29
|
itemCount: 0,
|
|
30
30
|
pageSize: 10,
|
|
@@ -36,7 +36,7 @@ const ze = { id: "data-content" }, Le = {
|
|
|
36
36
|
onUpdatePageSize: async (e) => {
|
|
37
37
|
p.value.pageSize = e, await g();
|
|
38
38
|
}
|
|
39
|
-
}), o =
|
|
39
|
+
}), o = m, Q = (e) => {
|
|
40
40
|
const t = (l) => {
|
|
41
41
|
const a = [];
|
|
42
42
|
return e && e.forEach((i) => {
|
|
@@ -63,23 +63,23 @@ const ze = { id: "data-content" }, Le = {
|
|
|
63
63
|
key: "delete",
|
|
64
64
|
props: { onClick: () => te(l) }
|
|
65
65
|
}), a = [...a, ...t(l)], !(a.length <= 0))
|
|
66
|
-
return
|
|
67
|
-
|
|
66
|
+
return N(
|
|
67
|
+
Me,
|
|
68
68
|
{
|
|
69
69
|
options: a,
|
|
70
70
|
placement: "bottom-start"
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
default: () =>
|
|
74
|
-
|
|
73
|
+
default: () => N(
|
|
74
|
+
C,
|
|
75
75
|
{ size: "small", type: "primary" },
|
|
76
|
-
{ default: () => ["操作",
|
|
76
|
+
{ default: () => ["操作", N(B, () => N($e))] }
|
|
77
77
|
)
|
|
78
78
|
}
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
}, Z =
|
|
82
|
+
}, Z = K(() => {
|
|
83
83
|
const e = o.columns.filter((l) => l.key != "action").map((l) => ({
|
|
84
84
|
title: l.title,
|
|
85
85
|
key: l.key,
|
|
@@ -99,11 +99,11 @@ const ze = { id: "data-content" }, Le = {
|
|
|
99
99
|
}), ee = async () => {
|
|
100
100
|
await g();
|
|
101
101
|
}, te = (e) => {
|
|
102
|
-
|
|
102
|
+
A([e]);
|
|
103
103
|
}, oe = () => {
|
|
104
|
-
const e =
|
|
105
|
-
|
|
106
|
-
},
|
|
104
|
+
const e = R();
|
|
105
|
+
A(e);
|
|
106
|
+
}, A = (e) => {
|
|
107
107
|
e && e.length > 0 && J.warning({
|
|
108
108
|
title: "警告",
|
|
109
109
|
content: "删除数据不可恢复, 确认删除吗?",
|
|
@@ -112,128 +112,127 @@ const ze = { id: "data-content" }, Le = {
|
|
|
112
112
|
onPositiveClick: async () => {
|
|
113
113
|
if (o.onDelete)
|
|
114
114
|
try {
|
|
115
|
-
await o.onDelete(e) ? (g(),
|
|
115
|
+
await o.onDelete(e) ? (g(), w.success("删除成功")) : w.error("删除失败");
|
|
116
116
|
} catch (t) {
|
|
117
|
-
|
|
117
|
+
w.error(t.message);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
}, le = () => {
|
|
122
|
-
f.value = null,
|
|
122
|
+
f.value = null, F();
|
|
123
123
|
}, ne = async (e) => {
|
|
124
|
-
f.value = Re(e),
|
|
124
|
+
f.value = Re(e), F(f.value, async () => {
|
|
125
125
|
o.onGet && (f.value = await o.onGet(e[o.idField])), Object.assign(o.item, f.value);
|
|
126
126
|
});
|
|
127
|
-
},
|
|
127
|
+
}, V = async () => {
|
|
128
128
|
if (o.onSave)
|
|
129
129
|
try {
|
|
130
|
-
|
|
130
|
+
E.value = !0, (h.value ? await o.onSave(void 0, y(o.item)) : await o.onSave(f.value[o.idField], y(o.item))) && (x(), await g());
|
|
131
131
|
} catch (e) {
|
|
132
|
-
|
|
132
|
+
w.error(e.message);
|
|
133
133
|
} finally {
|
|
134
|
-
|
|
134
|
+
E.value = !1;
|
|
135
135
|
}
|
|
136
|
-
},
|
|
137
|
-
o.onOpenModal?.(e), await t?.(), e ? (
|
|
138
|
-
},
|
|
139
|
-
f.value = null, Ne(o.item), Object.assign(o.item, { ...
|
|
140
|
-
},
|
|
141
|
-
if (!
|
|
142
|
-
|
|
136
|
+
}, F = async (e, t) => {
|
|
137
|
+
o.onOpenModal?.(e), await t?.(), e ? (h.value = !1, k.value = !0) : (k.value = !1, h.value = !0);
|
|
138
|
+
}, x = () => {
|
|
139
|
+
f.value = null, Ne(o.item), Object.assign(o.item, { ...y(W.value) }), o.onCloseModal?.(o.item), h.value = !1, k.value = !1;
|
|
140
|
+
}, R = () => M.value ? O.value.filter((t) => M.value.includes(t.id)).map((t) => y(t)) : [], ae = () => R()[0], se = () => y(O.value), g = async () => {
|
|
141
|
+
if (!D.value) {
|
|
142
|
+
D.value = !0;
|
|
143
143
|
try {
|
|
144
144
|
if (o.onLoad) {
|
|
145
145
|
var { data: e, total: t } = await o.onLoad(
|
|
146
146
|
p.value.page,
|
|
147
147
|
p.value.pageSize
|
|
148
148
|
);
|
|
149
|
-
|
|
149
|
+
O.value = e, p.value.itemCount = t;
|
|
150
150
|
}
|
|
151
151
|
} catch (l) {
|
|
152
|
-
|
|
152
|
+
w.error(l.message);
|
|
153
153
|
} finally {
|
|
154
|
-
|
|
154
|
+
D.value = !1;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
}, ie =
|
|
158
|
-
const e = r(
|
|
157
|
+
}, ie = K(() => {
|
|
158
|
+
const e = r(P);
|
|
159
159
|
if (!e) return;
|
|
160
160
|
const t = e?.$el, l = t.querySelector(".n-data-table-thead "), { bottomIncludeBody: a } = re(l), i = 64;
|
|
161
161
|
let u = 2, d = 24;
|
|
162
|
-
const
|
|
162
|
+
const b = t.querySelector(
|
|
163
163
|
".n-data-table__pagination"
|
|
164
164
|
);
|
|
165
|
-
if (
|
|
166
|
-
const
|
|
167
|
-
u +=
|
|
165
|
+
if (b) {
|
|
166
|
+
const z = b.offsetHeight;
|
|
167
|
+
u += z || 0;
|
|
168
168
|
} else
|
|
169
169
|
u += 28;
|
|
170
170
|
return a - (i + u + d);
|
|
171
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,
|
|
173
|
-
left:
|
|
172
|
+
const t = document.documentElement, l = t.scrollLeft, a = t.scrollTop, i = t.clientLeft, u = t.clientTop, d = window.pageXOffset, b = window.pageYOffset, U = de(e), {
|
|
173
|
+
left: z,
|
|
174
174
|
top: ue,
|
|
175
175
|
width: fe,
|
|
176
176
|
height: pe
|
|
177
|
-
} =
|
|
177
|
+
} = U, ge = (d || l) - (i || 0), me = (b || a) - (u || 0), he = z + d, ve = ue + b, L = he - ge, H = ve - me, q = window.document.documentElement.clientWidth, G = window.document.documentElement.clientHeight;
|
|
178
178
|
return {
|
|
179
|
-
left:
|
|
180
|
-
top:
|
|
181
|
-
right:
|
|
182
|
-
bottom:
|
|
183
|
-
rightIncludeBody:
|
|
184
|
-
bottomIncludeBody:
|
|
179
|
+
left: L,
|
|
180
|
+
top: H,
|
|
181
|
+
right: q - fe - L,
|
|
182
|
+
bottom: G - pe - H,
|
|
183
|
+
rightIncludeBody: q - L,
|
|
184
|
+
bottomIncludeBody: G - H
|
|
185
185
|
};
|
|
186
186
|
}, ce = () => {
|
|
187
|
-
|
|
187
|
+
W.value = { ...y(o.item) };
|
|
188
188
|
};
|
|
189
|
-
return
|
|
189
|
+
return Ee(async () => {
|
|
190
190
|
ce(), await g();
|
|
191
191
|
}), Y({
|
|
192
192
|
getData: se,
|
|
193
193
|
getSelectedRow: ae,
|
|
194
|
-
getSelectedRows:
|
|
195
|
-
closeModal:
|
|
194
|
+
getSelectedRows: R,
|
|
195
|
+
closeModal: x,
|
|
196
196
|
refreshData: g,
|
|
197
197
|
resetPage: () => {
|
|
198
198
|
p.value.page = 1;
|
|
199
199
|
}
|
|
200
200
|
}), (e, t) => {
|
|
201
|
-
const l =
|
|
202
|
-
return
|
|
201
|
+
const l = De, a = be, i = Se, u = Ce;
|
|
202
|
+
return v(), _(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
|
-
|
|
209
|
+
m.hiddenAdd ? S("", !0) : (v(), _(l, {
|
|
210
210
|
key: 0,
|
|
211
211
|
trigger: "hover"
|
|
212
212
|
}, {
|
|
213
213
|
trigger: n(() => [
|
|
214
|
-
s(r(
|
|
214
|
+
s(r(B), {
|
|
215
215
|
size: "18",
|
|
216
216
|
class: "mr-1 cursor-pointer hover:text-blue-600",
|
|
217
217
|
onClick: le
|
|
218
218
|
}, {
|
|
219
219
|
default: n(() => [
|
|
220
|
-
s(r(
|
|
220
|
+
s(r(xe))
|
|
221
221
|
]),
|
|
222
222
|
_: 1
|
|
223
223
|
})
|
|
224
224
|
]),
|
|
225
225
|
default: n(() => [
|
|
226
|
-
t[3] || (t[3] =
|
|
226
|
+
t[3] || (t[3] = T("span", null, "新增", -1))
|
|
227
227
|
]),
|
|
228
|
-
_: 1
|
|
229
|
-
__: [3]
|
|
228
|
+
_: 1
|
|
230
229
|
})),
|
|
231
|
-
|
|
230
|
+
m.hiddenDelete ? S("", !0) : (v(), _(l, {
|
|
232
231
|
key: 1,
|
|
233
232
|
trigger: "hover"
|
|
234
233
|
}, {
|
|
235
234
|
trigger: n(() => [
|
|
236
|
-
s(r(
|
|
235
|
+
s(r(B), {
|
|
237
236
|
size: "18",
|
|
238
237
|
class: "mr-1 cursor-pointer hover:text-blue-600",
|
|
239
238
|
onClick: oe
|
|
@@ -245,14 +244,13 @@ const ze = { id: "data-content" }, Le = {
|
|
|
245
244
|
})
|
|
246
245
|
]),
|
|
247
246
|
default: n(() => [
|
|
248
|
-
t[4] || (t[4] =
|
|
247
|
+
t[4] || (t[4] = T("span", null, "删除", -1))
|
|
249
248
|
]),
|
|
250
|
-
_: 1
|
|
251
|
-
__: [4]
|
|
249
|
+
_: 1
|
|
252
250
|
})),
|
|
253
251
|
s(l, { trigger: "hover" }, {
|
|
254
252
|
trigger: n(() => [
|
|
255
|
-
s(r(
|
|
253
|
+
s(r(B), {
|
|
256
254
|
size: "18",
|
|
257
255
|
class: "cursor-pointer hover:text-blue-600",
|
|
258
256
|
onClick: ee
|
|
@@ -264,120 +262,115 @@ const ze = { id: "data-content" }, Le = {
|
|
|
264
262
|
})
|
|
265
263
|
]),
|
|
266
264
|
default: n(() => [
|
|
267
|
-
t[5] || (t[5] =
|
|
265
|
+
t[5] || (t[5] = T("span", null, "刷新", -1))
|
|
268
266
|
]),
|
|
269
|
-
_: 1
|
|
270
|
-
__: [5]
|
|
267
|
+
_: 1
|
|
271
268
|
})
|
|
272
269
|
]),
|
|
273
270
|
default: n(() => [
|
|
274
|
-
|
|
275
|
-
e.$slots.toolbar ? (
|
|
276
|
-
|
|
277
|
-
])) :
|
|
271
|
+
T("div", ze, [
|
|
272
|
+
e.$slots.toolbar ? (v(), j("div", Le, [
|
|
273
|
+
I(e.$slots, "toolbar")
|
|
274
|
+
])) : S("", !0),
|
|
278
275
|
s(a, {
|
|
279
276
|
remote: "",
|
|
280
277
|
ref_key: "$table",
|
|
281
|
-
ref:
|
|
282
|
-
"checked-row-keys":
|
|
283
|
-
"onUpdate:checkedRowKeys": t[0] || (t[0] = (d) =>
|
|
278
|
+
ref: P,
|
|
279
|
+
"checked-row-keys": M.value,
|
|
280
|
+
"onUpdate:checkedRowKeys": t[0] || (t[0] = (d) => M.value = d),
|
|
284
281
|
"max-height": ie.value,
|
|
285
|
-
loading:
|
|
282
|
+
loading: D.value,
|
|
286
283
|
bordered: !1,
|
|
287
284
|
"single-line": !1,
|
|
288
285
|
columns: Z.value,
|
|
289
|
-
data:
|
|
286
|
+
data: O.value,
|
|
290
287
|
pagination: p.value,
|
|
291
|
-
"row-key": (d) => d[
|
|
288
|
+
"row-key": (d) => d[m.idField]
|
|
292
289
|
}, null, 8, ["checked-row-keys", "max-height", "loading", "columns", "data", "pagination", "row-key"]),
|
|
293
|
-
e.$slots.addModal ? (
|
|
290
|
+
e.$slots.addModal ? (v(), j("div", He, [
|
|
294
291
|
s(u, {
|
|
295
292
|
title: "新增",
|
|
296
293
|
preset: "card",
|
|
297
|
-
show:
|
|
298
|
-
"onUpdate:show": t[1] || (t[1] = (d) =>
|
|
294
|
+
show: h.value,
|
|
295
|
+
"onUpdate:show": t[1] || (t[1] = (d) => h.value = d),
|
|
299
296
|
"header-class": "bg-gray-50",
|
|
300
297
|
closable: !1,
|
|
301
298
|
"close-on-esc": !1,
|
|
302
299
|
"mask-closable": !1,
|
|
303
300
|
draggable: !0,
|
|
304
|
-
style:
|
|
301
|
+
style: X({ width: `${m.modalWidth}px` })
|
|
305
302
|
}, {
|
|
306
303
|
action: n(() => [
|
|
307
304
|
s(i, { justify: "end" }, {
|
|
308
305
|
default: n(() => [
|
|
309
|
-
s(r(
|
|
306
|
+
s(r(C), {
|
|
310
307
|
type: "primary",
|
|
311
|
-
loading:
|
|
312
|
-
onClick:
|
|
308
|
+
loading: E.value,
|
|
309
|
+
onClick: V
|
|
313
310
|
}, {
|
|
314
|
-
default: n(() => t[6] || (t[6] = [
|
|
315
|
-
|
|
316
|
-
])),
|
|
317
|
-
_: 1
|
|
318
|
-
__: [6]
|
|
311
|
+
default: n(() => [...t[6] || (t[6] = [
|
|
312
|
+
$("保存", -1)
|
|
313
|
+
])]),
|
|
314
|
+
_: 1
|
|
319
315
|
}, 8, ["loading"]),
|
|
320
|
-
s(r(
|
|
321
|
-
default: n(() => t[7] || (t[7] = [
|
|
322
|
-
|
|
323
|
-
])),
|
|
324
|
-
_: 1
|
|
325
|
-
__: [7]
|
|
316
|
+
s(r(C), { onClick: x }, {
|
|
317
|
+
default: n(() => [...t[7] || (t[7] = [
|
|
318
|
+
$("取消", -1)
|
|
319
|
+
])]),
|
|
320
|
+
_: 1
|
|
326
321
|
})
|
|
327
322
|
]),
|
|
328
323
|
_: 1
|
|
329
324
|
})
|
|
330
325
|
]),
|
|
331
326
|
default: n(() => [
|
|
332
|
-
|
|
327
|
+
I(e.$slots, "addModal")
|
|
333
328
|
]),
|
|
334
329
|
_: 3
|
|
335
330
|
}, 8, ["show", "style"])
|
|
336
|
-
])) :
|
|
337
|
-
e.$slots.editModal ? (
|
|
331
|
+
])) : S("", !0),
|
|
332
|
+
e.$slots.editModal ? (v(), j("div", _e, [
|
|
338
333
|
s(u, {
|
|
339
334
|
title: "编辑",
|
|
340
|
-
show:
|
|
341
|
-
"onUpdate:show": t[2] || (t[2] = (d) =>
|
|
335
|
+
show: k.value,
|
|
336
|
+
"onUpdate:show": t[2] || (t[2] = (d) => k.value = d),
|
|
342
337
|
preset: "card",
|
|
343
338
|
"header-class": "bg-gray-50",
|
|
344
339
|
closable: !1,
|
|
345
340
|
"close-on-esc": !1,
|
|
346
341
|
"mask-closable": !1,
|
|
347
342
|
draggable: !0,
|
|
348
|
-
style:
|
|
343
|
+
style: X({ width: `${m.modalWidth}px` })
|
|
349
344
|
}, {
|
|
350
345
|
action: n(() => [
|
|
351
346
|
s(i, { justify: "end" }, {
|
|
352
347
|
default: n(() => [
|
|
353
|
-
s(r(
|
|
348
|
+
s(r(C), {
|
|
354
349
|
type: "primary",
|
|
355
|
-
loading:
|
|
356
|
-
onClick:
|
|
350
|
+
loading: E.value,
|
|
351
|
+
onClick: V
|
|
357
352
|
}, {
|
|
358
|
-
default: n(() => t[8] || (t[8] = [
|
|
359
|
-
|
|
360
|
-
])),
|
|
361
|
-
_: 1
|
|
362
|
-
__: [8]
|
|
353
|
+
default: n(() => [...t[8] || (t[8] = [
|
|
354
|
+
$("保存", -1)
|
|
355
|
+
])]),
|
|
356
|
+
_: 1
|
|
363
357
|
}, 8, ["loading"]),
|
|
364
|
-
s(r(
|
|
365
|
-
default: n(() => t[9] || (t[9] = [
|
|
366
|
-
|
|
367
|
-
])),
|
|
368
|
-
_: 1
|
|
369
|
-
__: [9]
|
|
358
|
+
s(r(C), { onClick: x }, {
|
|
359
|
+
default: n(() => [...t[9] || (t[9] = [
|
|
360
|
+
$("取消", -1)
|
|
361
|
+
])]),
|
|
362
|
+
_: 1
|
|
370
363
|
})
|
|
371
364
|
]),
|
|
372
365
|
_: 1
|
|
373
366
|
})
|
|
374
367
|
]),
|
|
375
368
|
default: n(() => [
|
|
376
|
-
|
|
369
|
+
I(e.$slots, "editModal")
|
|
377
370
|
]),
|
|
378
371
|
_: 3
|
|
379
372
|
}, 8, ["show", "style"])
|
|
380
|
-
])) :
|
|
373
|
+
])) : S("", !0)
|
|
381
374
|
])
|
|
382
375
|
]),
|
|
383
376
|
_: 3
|
package/es/table/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export type * from './typing';
|
|
2
|
+
export declare const PTablePlugin: {
|
|
2
3
|
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./typing').DataTableProps> & Readonly<{}>, {
|
|
3
4
|
refreshData: () => Promise<void>;
|
|
4
5
|
getData: <T>() => T[];
|
|
@@ -61,4 +62,3 @@ declare const _default: {
|
|
|
61
62
|
editModal?(_: {}): any;
|
|
62
63
|
};
|
|
63
64
|
}) & import('vue').Plugin;
|
|
64
|
-
export default _default;
|