@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.
Files changed (153) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.js +804 -676
  3. package/dist/index.umd.cjs +1 -1
  4. package/dist/style.css +1 -1
  5. package/es/application/PApplication.vue.js +16 -16
  6. package/es/application/index.d.ts +1 -2
  7. package/es/application/index.js +4 -4
  8. package/es/components.d.ts +9 -5
  9. package/es/components.js +20 -9
  10. package/es/error/P403.css +1 -0
  11. package/es/error/P403.d.ts +2 -0
  12. package/es/error/P403.vue.js +19 -0
  13. package/es/error/P404.css +1 -0
  14. package/es/error/P404.d.ts +2 -0
  15. package/es/error/P404.vue.js +19 -0
  16. package/es/error/P500.css +1 -0
  17. package/es/error/P500.d.ts +2 -0
  18. package/es/error/P500.vue.js +19 -0
  19. package/es/error/index.d.ts +39 -0
  20. package/es/error/index.js +10 -0
  21. package/es/iframe/PIframe.css +1 -0
  22. package/es/iframe/PIframe.d.ts +4 -0
  23. package/es/iframe/PIframe.vue.js +7 -0
  24. package/es/iframe/PIframe.vue2.js +46 -0
  25. package/es/iframe/index.d.ts +15 -0
  26. package/es/iframe/index.js +6 -0
  27. package/es/index.d.ts +5 -1
  28. package/es/index.js +34 -21
  29. package/es/languages/PLanguage.vue.js +28 -28
  30. package/es/languages/index.d.ts +3 -4
  31. package/es/languages/index.js +4 -5
  32. package/es/languages/store.d.ts +1 -1
  33. package/es/languages/store.js +1 -1
  34. package/es/layout/PEmptyLayout.d.ts +2 -0
  35. package/es/layout/PEmptyLayout.vue.js +11 -0
  36. package/es/layout/PLayout.css +1 -1
  37. package/es/layout/PLayout.vue.js +1 -1
  38. package/es/layout/PLayout.vue2.js +6 -6
  39. package/es/layout/content/PContent.vue.js +10 -10
  40. package/es/layout/content/PTabs.css +1 -1
  41. package/es/layout/content/PTabs.vue.js +2 -2
  42. package/es/layout/content/PTabs.vue2.js +60 -57
  43. package/es/layout/header/PHeader.css +1 -1
  44. package/es/layout/header/PHeader.vue.js +2 -2
  45. package/es/layout/header/PHeader.vue2.js +10 -17
  46. package/es/layout/index.d.ts +16 -3
  47. package/es/layout/index.js +6 -4
  48. package/es/layout/sider/PLogo.css +1 -1
  49. package/es/layout/sider/PLogo.vue.js +2 -2
  50. package/es/layout/sider/PLogo.vue2.js +5 -5
  51. package/es/layout/sider/PMenus.vue.js +5 -5
  52. package/es/layout/{layout.d.ts → store.d.ts} +236 -251
  53. package/es/layout/{layout.js → store.js} +1 -1
  54. package/es/layout/typing.d.ts +25 -0
  55. package/es/modal/PModal.d.ts +87 -59
  56. package/es/modal/PModal.vue.js +37 -38
  57. package/es/modal/index.d.ts +47 -33
  58. package/es/modal/index.js +4 -4
  59. package/es/modal/typing.d.ts +2 -2
  60. package/es/oidc/POidc.css +1 -0
  61. package/es/oidc/POidc.d.ts +2 -0
  62. package/es/oidc/POidc.vue.js +7 -0
  63. package/es/oidc/POidc.vue2.js +25 -0
  64. package/es/oidc/index.d.ts +15 -0
  65. package/es/oidc/index.js +6 -0
  66. package/es/oidc/store.d.ts +17 -0
  67. package/es/oidc/store.js +24 -0
  68. package/es/oidc/typing.d.ts +5 -0
  69. package/es/redirect/PRedirect.d.ts +2 -0
  70. package/es/redirect/PRedirect.vue.js +19 -0
  71. package/es/redirect/PRedirect.vue2.js +4 -0
  72. package/es/redirect/index.d.ts +13 -0
  73. package/es/redirect/index.js +6 -0
  74. package/es/table/PTable.vue.js +114 -121
  75. package/es/table/index.d.ts +2 -2
  76. package/es/table/index.js +4 -4
  77. package/es/table/typing.d.ts +8 -8
  78. package/lib/application/PApplication.vue.cjs +1 -1
  79. package/lib/application/index.cjs +1 -1
  80. package/lib/application/index.d.ts +1 -2
  81. package/lib/components.cjs +1 -1
  82. package/lib/components.d.ts +9 -5
  83. package/lib/error/P403.css +1 -0
  84. package/lib/error/P403.d.ts +2 -0
  85. package/lib/error/P403.vue.cjs +1 -0
  86. package/lib/error/P404.css +1 -0
  87. package/lib/error/P404.d.ts +2 -0
  88. package/lib/error/P404.vue.cjs +1 -0
  89. package/lib/error/P500.css +1 -0
  90. package/lib/error/P500.d.ts +2 -0
  91. package/lib/error/P500.vue.cjs +1 -0
  92. package/lib/error/index.cjs +1 -0
  93. package/lib/error/index.d.ts +39 -0
  94. package/lib/iframe/PIframe.css +1 -0
  95. package/lib/iframe/PIframe.d.ts +4 -0
  96. package/lib/iframe/PIframe.vue.cjs +1 -0
  97. package/lib/iframe/PIframe.vue2.cjs +1 -0
  98. package/lib/iframe/index.cjs +1 -0
  99. package/lib/iframe/index.d.ts +15 -0
  100. package/lib/index.cjs +1 -1
  101. package/lib/index.d.ts +5 -1
  102. package/lib/languages/PLanguage.vue.cjs +1 -1
  103. package/lib/languages/index.cjs +1 -1
  104. package/lib/languages/index.d.ts +3 -4
  105. package/lib/languages/store.cjs +1 -1
  106. package/lib/languages/store.d.ts +1 -1
  107. package/lib/layout/PEmptyLayout.d.ts +2 -0
  108. package/lib/layout/PEmptyLayout.vue.cjs +1 -0
  109. package/lib/layout/PLayout.css +1 -1
  110. package/lib/layout/PLayout.vue.cjs +1 -1
  111. package/lib/layout/PLayout.vue2.cjs +1 -1
  112. package/lib/layout/content/PContent.vue.cjs +1 -1
  113. package/lib/layout/content/PTabs.css +1 -1
  114. package/lib/layout/content/PTabs.vue.cjs +1 -1
  115. package/lib/layout/content/PTabs.vue2.cjs +1 -1
  116. package/lib/layout/header/PHeader.css +1 -1
  117. package/lib/layout/header/PHeader.vue.cjs +1 -1
  118. package/lib/layout/header/PHeader.vue2.cjs +1 -1
  119. package/lib/layout/index.cjs +1 -1
  120. package/lib/layout/index.d.ts +16 -3
  121. package/lib/layout/sider/PLogo.css +1 -1
  122. package/lib/layout/sider/PLogo.vue.cjs +1 -1
  123. package/lib/layout/sider/PLogo.vue2.cjs +1 -1
  124. package/lib/layout/sider/PMenus.vue.cjs +1 -1
  125. package/lib/layout/{layout.cjs → store.cjs} +1 -1
  126. package/lib/layout/{layout.d.ts → store.d.ts} +236 -251
  127. package/lib/layout/typing.d.ts +25 -0
  128. package/lib/modal/PModal.d.ts +87 -59
  129. package/lib/modal/PModal.vue.cjs +1 -1
  130. package/lib/modal/index.cjs +1 -1
  131. package/lib/modal/index.d.ts +47 -33
  132. package/lib/modal/typing.d.ts +2 -2
  133. package/lib/oidc/POidc.css +1 -0
  134. package/lib/oidc/POidc.d.ts +2 -0
  135. package/lib/oidc/POidc.vue.cjs +1 -0
  136. package/lib/oidc/POidc.vue2.cjs +1 -0
  137. package/lib/oidc/index.cjs +1 -0
  138. package/lib/oidc/index.d.ts +15 -0
  139. package/lib/oidc/store.cjs +1 -0
  140. package/lib/oidc/store.d.ts +17 -0
  141. package/lib/oidc/typing.d.ts +5 -0
  142. package/lib/redirect/PRedirect.d.ts +2 -0
  143. package/lib/redirect/PRedirect.vue.cjs +1 -0
  144. package/lib/redirect/PRedirect.vue2.cjs +1 -0
  145. package/lib/redirect/index.cjs +1 -0
  146. package/lib/redirect/index.d.ts +13 -0
  147. package/lib/table/PTable.vue.cjs +1 -1
  148. package/lib/table/index.cjs +1 -1
  149. package/lib/table/index.d.ts +2 -2
  150. package/lib/table/typing.d.ts +8 -8
  151. package/package.json +21 -24
  152. package/es/typing.d.ts +0 -5
  153. package/lib/typing.d.ts +0 -5
@@ -1,4 +1,4 @@
1
- export type PModalProps = {
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 PModalMethods = {
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,7 @@
1
+ import o from "./POidc.vue2.js";
2
+ /* empty css */
3
+ import t from "../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-71eae482"]]);
5
+ export {
6
+ m as default
7
+ };
@@ -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;
@@ -0,0 +1,6 @@
1
+ import { withInstall as i } from "../utils/install.js";
2
+ import o from "./POidc.vue.js";
3
+ const m = i(o);
4
+ export {
5
+ m as POidcPlugin
6
+ };
@@ -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">>;
@@ -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,5 @@
1
+ import { Router } from 'vue-router';
2
+ export type OidcState = {
3
+ error?: (router: Router, error: Error) => void;
4
+ callback?: () => Promise<void>;
5
+ };
@@ -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,4 @@
1
+ import f from "./PRedirect.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -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;
@@ -0,0 +1,6 @@
1
+ import { withInstall as t } from "../utils/install.js";
2
+ import i from "./PRedirect.vue.js";
3
+ const m = t(i);
4
+ export {
5
+ m as PRedirectPlugin
6
+ };
@@ -1,12 +1,12 @@
1
- import { useDialog as ye, useMessage as we, NCard as ke, NDataTable as be, NModal as _e, NSpace as Ce, NButton as b, NTooltip as Se, NIcon as E, NDropdown as De } from "naive-ui";
2
- import { defineComponent as Me, ref as c, computed as G, unref as r, onMounted as Oe, createBlock as H, openBlock as h, withCtx as n, createElementVNode as B, createElementBlock as x, createCommentVNode as _, createVNode as s, renderSlot as j, normalizeStyle as K, createTextVNode as T, h as $, toRaw as v } from "vue";
3
- import { PlusSquareOutlined as Ee, DeleteOutlined as Be, ReloadOutlined as Te, MoreOutlined as $e } from "@vicons/antd";
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 }, xe = { key: 2 }, Ve = /* @__PURE__ */ Me({
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(X, { expose: Y }) {
27
- const I = c(null), J = ye(), y = we(), C = c(!1), S = c([]), D = c([]), f = c(null), m = c(!1), w = c(!1), M = c(!1), P = c({}), p = c({
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 = X, Q = (e) => {
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
- De,
66
+ return N(
67
+ Me,
68
68
  {
69
69
  options: a,
70
70
  placement: "bottom-start"
71
71
  },
72
72
  {
73
- default: () => $(
74
- b,
73
+ default: () => N(
74
+ C,
75
75
  { size: "small", type: "primary" },
76
- { default: () => ["操作", $(E, () => $($e))] }
76
+ { default: () => ["操作", N(B, () => N($e))] }
77
77
  )
78
78
  }
79
79
  );
80
80
  }
81
81
  };
82
- }, Z = G(() => {
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
- W([e]);
102
+ A([e]);
103
103
  }, oe = () => {
104
- const e = N();
105
- W(e);
106
- }, W = (e) => {
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(), y.success("删除成功")) : y.error("删除失败");
115
+ await o.onDelete(e) ? (g(), w.success("删除成功")) : w.error("删除失败");
116
116
  } catch (t) {
117
- y.error(t.message);
117
+ w.error(t.message);
118
118
  }
119
119
  }
120
120
  });
121
121
  }, le = () => {
122
- f.value = null, V();
122
+ f.value = null, F();
123
123
  }, ne = async (e) => {
124
- f.value = Re(e), V(f.value, async () => {
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
- }, A = async () => {
127
+ }, V = async () => {
128
128
  if (o.onSave)
129
129
  try {
130
- M.value = !0, (m.value ? await o.onSave(void 0, v(o.item)) : await o.onSave(f.value[o.idField], v(o.item))) && (O(), await g());
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
- y.error(e.message);
132
+ w.error(e.message);
133
133
  } finally {
134
- M.value = !1;
134
+ E.value = !1;
135
135
  }
136
- }, V = async (e, t) => {
137
- o.onOpenModal?.(e), await t?.(), e ? (m.value = !1, w.value = !0) : (w.value = !1, m.value = !0);
138
- }, O = () => {
139
- f.value = null, Ne(o.item), Object.assign(o.item, { ...v(P.value) }), o.onCloseModal?.(o.item), m.value = !1, w.value = !1;
140
- }, N = () => S.value ? D.value.filter((t) => S.value.includes(t.id)).map((t) => v(t)) : [], ae = () => N()[0], se = () => v(D.value), g = async () => {
141
- if (!C.value) {
142
- C.value = !0;
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
- D.value = e, p.value.itemCount = t;
149
+ O.value = e, p.value.itemCount = t;
150
150
  }
151
151
  } catch (l) {
152
- y.error(l.message);
152
+ w.error(l.message);
153
153
  } finally {
154
- C.value = !1;
154
+ D.value = !1;
155
155
  }
156
156
  }
157
- }, ie = G(() => {
158
- const e = r(I);
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 k = t.querySelector(
162
+ const b = t.querySelector(
163
163
  ".n-data-table__pagination"
164
164
  );
165
- if (k) {
166
- const R = k.offsetHeight;
167
- u += R || 0;
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, k = window.pageYOffset, F = de(e), {
173
- left: R,
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
- } = F, ge = (d || l) - (i || 0), me = (k || a) - (u || 0), he = R + d, ve = ue + k, z = he - ge, L = ve - me, U = window.document.documentElement.clientWidth, q = window.document.documentElement.clientHeight;
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: z,
180
- top: L,
181
- right: U - fe - z,
182
- bottom: q - pe - L,
183
- rightIncludeBody: U - z,
184
- bottomIncludeBody: q - L
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
- P.value = { ...v(o.item) };
187
+ W.value = { ...y(o.item) };
188
188
  };
189
- return Oe(async () => {
189
+ return Ee(async () => {
190
190
  ce(), await g();
191
191
  }), Y({
192
192
  getData: se,
193
193
  getSelectedRow: ae,
194
- getSelectedRows: N,
195
- closeModal: O,
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 = Se, a = be, i = Ce, u = _e;
202
- return h(), H(r(ke), {
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
- e.hiddenAdd ? _("", !0) : (h(), H(l, {
209
+ m.hiddenAdd ? S("", !0) : (v(), _(l, {
210
210
  key: 0,
211
211
  trigger: "hover"
212
212
  }, {
213
213
  trigger: n(() => [
214
- s(r(E), {
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(Ee))
220
+ s(r(xe))
221
221
  ]),
222
222
  _: 1
223
223
  })
224
224
  ]),
225
225
  default: n(() => [
226
- t[3] || (t[3] = B("span", null, "新增", -1))
226
+ t[3] || (t[3] = T("span", null, "新增", -1))
227
227
  ]),
228
- _: 1,
229
- __: [3]
228
+ _: 1
230
229
  })),
231
- e.hiddenDelete ? _("", !0) : (h(), H(l, {
230
+ m.hiddenDelete ? S("", !0) : (v(), _(l, {
232
231
  key: 1,
233
232
  trigger: "hover"
234
233
  }, {
235
234
  trigger: n(() => [
236
- s(r(E), {
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] = B("span", null, "删除", -1))
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(E), {
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] = B("span", null, "刷新", -1))
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
- B("div", ze, [
275
- e.$slots.toolbar ? (h(), x("div", Le, [
276
- j(e.$slots, "toolbar")
277
- ])) : _("", !0),
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: I,
282
- "checked-row-keys": S.value,
283
- "onUpdate:checkedRowKeys": t[0] || (t[0] = (d) => S.value = 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: C.value,
282
+ loading: D.value,
286
283
  bordered: !1,
287
284
  "single-line": !1,
288
285
  columns: Z.value,
289
- data: D.value,
286
+ data: O.value,
290
287
  pagination: p.value,
291
- "row-key": (d) => d[e.idField]
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 ? (h(), x("div", He, [
290
+ e.$slots.addModal ? (v(), j("div", He, [
294
291
  s(u, {
295
292
  title: "新增",
296
293
  preset: "card",
297
- show: m.value,
298
- "onUpdate:show": t[1] || (t[1] = (d) => m.value = 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: K({ width: `${e.modalWidth}px` })
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(b), {
306
+ s(r(C), {
310
307
  type: "primary",
311
- loading: M.value,
312
- onClick: A
308
+ loading: E.value,
309
+ onClick: V
313
310
  }, {
314
- default: n(() => t[6] || (t[6] = [
315
- T("保存", -1)
316
- ])),
317
- _: 1,
318
- __: [6]
311
+ default: n(() => [...t[6] || (t[6] = [
312
+ $("保存", -1)
313
+ ])]),
314
+ _: 1
319
315
  }, 8, ["loading"]),
320
- s(r(b), { onClick: O }, {
321
- default: n(() => t[7] || (t[7] = [
322
- T("取消", -1)
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
- j(e.$slots, "addModal")
327
+ I(e.$slots, "addModal")
333
328
  ]),
334
329
  _: 3
335
330
  }, 8, ["show", "style"])
336
- ])) : _("", !0),
337
- e.$slots.editModal ? (h(), x("div", xe, [
331
+ ])) : S("", !0),
332
+ e.$slots.editModal ? (v(), j("div", _e, [
338
333
  s(u, {
339
334
  title: "编辑",
340
- show: w.value,
341
- "onUpdate:show": t[2] || (t[2] = (d) => w.value = 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: K({ width: `${e.modalWidth}px` })
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(b), {
348
+ s(r(C), {
354
349
  type: "primary",
355
- loading: M.value,
356
- onClick: A
350
+ loading: E.value,
351
+ onClick: V
357
352
  }, {
358
- default: n(() => t[8] || (t[8] = [
359
- T("保存", -1)
360
- ])),
361
- _: 1,
362
- __: [8]
353
+ default: n(() => [...t[8] || (t[8] = [
354
+ $("保存", -1)
355
+ ])]),
356
+ _: 1
363
357
  }, 8, ["loading"]),
364
- s(r(b), { onClick: O }, {
365
- default: n(() => t[9] || (t[9] = [
366
- T("取消", -1)
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
- j(e.$slots, "editModal")
369
+ I(e.$slots, "editModal")
377
370
  ]),
378
371
  _: 3
379
372
  }, 8, ["show", "style"])
380
- ])) : _("", !0)
373
+ ])) : S("", !0)
381
374
  ])
382
375
  ]),
383
376
  _: 3
@@ -1,4 +1,5 @@
1
- declare const _default: {
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;