@aplus-frontend/ui 0.1.36 → 0.1.38

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 (45) hide show
  1. package/es/index.mjs +41 -40
  2. package/es/src/ap-table/utils.mjs +11 -11
  3. package/es/src/business/ap-button-group/ApButtonGroup.vue.d.ts +21 -0
  4. package/es/src/business/ap-button-group/ApButtonGroup.vue.mjs +4 -0
  5. package/es/src/business/ap-button-group/ApButtonGroup.vue2.mjs +71 -0
  6. package/es/src/business/ap-button-group/interface.d.ts +29 -0
  7. package/es/src/business/ap-button-group/interface.mjs +1 -0
  8. package/es/src/business/ap-select-layout/interface.d.ts +1 -0
  9. package/es/src/business/ap-select-layout/select-layout.vue2.mjs +66 -62
  10. package/es/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +23 -0
  11. package/es/src/business/ap-table-modal/hooks/use-create-table-modal.mjs +41 -24
  12. package/es/src/business/ap-table-modal/hooks/use-table-modal.d.ts +24 -0
  13. package/es/src/business/ap-table-modal/hooks/use-table-modal.mjs +12 -11
  14. package/es/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +24 -0
  15. package/es/src/business/ap-table-modal/hooks/use-table-select-modal.mjs +11 -10
  16. package/es/src/business/ap-table-modal/index.d.ts +21 -0
  17. package/es/src/business/ap-table-modal/table-modal.vue.d.ts +21 -0
  18. package/es/src/business/ap-table-modal/table-modal.vue2.mjs +31 -30
  19. package/es/src/business/index.d.ts +608 -4
  20. package/es/src/business/index.mjs +27 -23
  21. package/es/src/editable-table/utils.mjs +12 -12
  22. package/es/src/index.mjs +216 -215
  23. package/lib/index.js +1 -1
  24. package/lib/src/ap-table/utils.js +1 -1
  25. package/lib/src/business/ap-button-group/ApButtonGroup.vue.d.ts +21 -0
  26. package/lib/src/business/ap-button-group/ApButtonGroup.vue.js +1 -0
  27. package/lib/src/business/ap-button-group/ApButtonGroup.vue2.js +1 -0
  28. package/lib/src/business/ap-button-group/interface.d.ts +29 -0
  29. package/lib/src/business/ap-button-group/interface.js +1 -0
  30. package/lib/src/business/ap-select-layout/interface.d.ts +1 -0
  31. package/lib/src/business/ap-select-layout/select-layout.vue2.js +1 -1
  32. package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +23 -0
  33. package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.js +1 -1
  34. package/lib/src/business/ap-table-modal/hooks/use-table-modal.d.ts +24 -0
  35. package/lib/src/business/ap-table-modal/hooks/use-table-modal.js +1 -1
  36. package/lib/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +24 -0
  37. package/lib/src/business/ap-table-modal/hooks/use-table-select-modal.js +1 -1
  38. package/lib/src/business/ap-table-modal/index.d.ts +21 -0
  39. package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +21 -0
  40. package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
  41. package/lib/src/business/index.d.ts +608 -4
  42. package/lib/src/business/index.js +1 -1
  43. package/lib/src/editable-table/utils.js +1 -1
  44. package/lib/src/index.js +1 -1
  45. package/package.json +3 -3
@@ -1,40 +1,57 @@
1
- import { ref as v, defineComponent as C, h as r, render as a, onUnmounted as y } from "vue";
1
+ import { ref as T, defineComponent as g, h as r, render as u, onUnmounted as C } from "vue";
2
2
  import "../table-modal.vue.mjs";
3
3
  import "../../../index.mjs";
4
- import { omit as h } from "lodash-unified";
5
- import { ConfigProvider as M, globalConfigCached as b } from "../../../config-provider/config-provider.mjs";
6
- import g from "../table-modal.vue2.mjs";
7
- function E(d) {
8
- let o = !0;
9
- const i = document.body, t = v(), { destroyOnUnmounted: s = !0 } = d, n = document.createElement("div"), u = () => {
10
- const e = C({
4
+ import { omit as y } from "lodash-unified";
5
+ import { ConfigProvider as A, globalConfigCached as h } from "../../../config-provider/config-provider.mjs";
6
+ import I from "../table-modal.vue2.mjs";
7
+ function E(l) {
8
+ let n = !0;
9
+ const s = document.body, t = T(), { destroyOnUnmounted: i = !0 } = l, a = document.createElement("div"), m = () => {
10
+ const e = g({
11
11
  setup() {
12
12
  return () => r(
13
- M,
14
- { ...b.value },
15
- r(g, {
16
- ...h(d, "destroyOnUnmounted"),
13
+ A,
14
+ { ...h.value },
15
+ r(I, {
16
+ ...y(l, "destroyOnUnmounted"),
17
17
  ref: t
18
18
  })
19
19
  );
20
20
  }
21
21
  });
22
- i.appendChild(n), a(r(e), n), o = !1;
23
- }, l = () => {
22
+ s.appendChild(a), u(r(e), a), n = !1;
23
+ }, c = () => {
24
24
  var e;
25
- (e = t.value) == null || e.close(), o || setTimeout(() => {
26
- a(null, n), i.removeChild(n), o = !0;
25
+ (e = t.value) == null || e.close(), n || setTimeout(() => {
26
+ u(null, a), s.removeChild(a), n = !0;
27
27
  }, 400);
28
- }, c = async (e = [], p = {}) => {
29
- var m;
30
- return t.value || u(), (m = t.value) == null ? void 0 : m.open(e, p);
31
- }, f = () => {
28
+ }, f = async (e = [], o = {}) => {
29
+ var d;
30
+ return t.value || m(), (d = t.value) == null ? void 0 : d.open(e, o);
31
+ }, p = () => {
32
32
  var e;
33
- o || (e = t.value) == null || e.close();
33
+ n || (e = t.value) == null || e.close();
34
+ }, v = () => {
35
+ var e, o;
36
+ (o = (e = t.value) == null ? void 0 : e.getApTableInstance()) == null || o.submit();
37
+ }, b = () => {
38
+ var e, o;
39
+ (o = (e = t.value) == null ? void 0 : e.getApTableInstance()) == null || o.reset();
40
+ };
41
+ return C(() => {
42
+ i && c();
43
+ }), {
44
+ openModal: f,
45
+ closeModal: p,
46
+ destroy: c,
47
+ reloadApTableData: v,
48
+ resetApTableData: b,
49
+ getApTableInstance: () => {
50
+ var e;
51
+ return (e = t.value) == null ? void 0 : e.getApTableInstance();
52
+ },
53
+ isDestroyed: n
34
54
  };
35
- return y(() => {
36
- s && l();
37
- }), { openModal: c, closeModal: f, destroy: l, isDestroyed: o };
38
55
  }
39
56
  export {
40
57
  E as useCreateTableModal
@@ -1,6 +1,30 @@
1
1
  import { ApTableModalProps, OpenOptions } from '../interface';
2
+ import { Recordable } from '../../../type';
3
+ import { TableColumnsType } from 'ant-design-vue';
2
4
  /** 函数式调用弹框表格 */
3
5
  export declare function useTableModal<TableRowType = Record<string, any>>(props: ApTableModalProps<TableRowType>): {
6
+ reloadApTableData: () => void;
7
+ resetApTableData: () => void;
8
+ getApTableInstance: () => {
9
+ submit: () => void;
10
+ reset: () => void;
11
+ refresh: () => void;
12
+ setSearchFormValues: (fields: Partial< Recordable>) => void;
13
+ getSearchFormValues: () => Partial< Recordable>;
14
+ dataSource: any;
15
+ rowSelection?: {
16
+ select: (item: any) => void;
17
+ selectAll: () => void;
18
+ unSelectAll: () => void;
19
+ selectedRows: any[];
20
+ unSelect: (item: any) => void;
21
+ isSelected: (item: any) => boolean;
22
+ clearAll: () => void;
23
+ toggleSelect: (item: any) => void;
24
+ } | undefined;
25
+ getShownColumns: () => TableColumnsType<any>;
26
+ } | null | undefined;
27
+ isDestroyed: true;
4
28
  open: (options?: OpenOptions) => Promise<void>;
5
29
  destroy: () => void;
6
30
  close: () => void;
@@ -1,8 +1,8 @@
1
- import { onUnmounted as d } from "vue";
2
- import { merge as p } from "lodash-unified";
3
- import { useCreateTableModal as f } from "./use-create-table-modal.mjs";
4
- function P(l) {
5
- const t = p(l, {
1
+ import { onUnmounted as p } from "vue";
2
+ import { merge as f } from "lodash-unified";
3
+ import { useCreateTableModal as u } from "./use-create-table-modal.mjs";
4
+ function T(t) {
5
+ const l = f(t, {
6
6
  ...{
7
7
  footer: null
8
8
  },
@@ -11,19 +11,20 @@ function P(l) {
11
11
  },
12
12
  destroyOnUnmounted: !1,
13
13
  isRenderModalTitleSuffix: !1
14
- }), { destroy: o, openModal: r, closeModal: s } = f(t), a = async (n) => {
15
- r([], n);
14
+ }), { destroy: o, openModal: r, closeModal: s, ...a } = u(l), n = async (d) => {
15
+ r([], d);
16
16
  }, e = () => {
17
17
  s();
18
18
  };
19
- return d(() => {
19
+ return p(() => {
20
20
  e(), o();
21
21
  }), {
22
- open: a,
22
+ open: n,
23
23
  destroy: o,
24
- close: e
24
+ close: e,
25
+ ...a
25
26
  };
26
27
  }
27
28
  export {
28
- P as useTableModal
29
+ T as useTableModal
29
30
  };
@@ -1,5 +1,29 @@
1
1
  import { OpenOptions, UseTableSelectModalProps, OpenReturnType } from '../interface';
2
+ import { Recordable } from '../../../type';
3
+ import { TableColumnsType } from 'ant-design-vue';
2
4
  export declare function useTableSelectModal<TableRowType = Record<string, any>>(props: UseTableSelectModalProps<TableRowType>): {
5
+ reloadApTableData: () => void;
6
+ resetApTableData: () => void;
7
+ getApTableInstance: () => {
8
+ submit: () => void;
9
+ reset: () => void;
10
+ refresh: () => void;
11
+ setSearchFormValues: (fields: Partial< Recordable>) => void;
12
+ getSearchFormValues: () => Partial< Recordable>;
13
+ dataSource: any;
14
+ rowSelection?: {
15
+ select: (item: any) => void;
16
+ selectAll: () => void;
17
+ unSelectAll: () => void;
18
+ selectedRows: any[];
19
+ unSelect: (item: any) => void;
20
+ isSelected: (item: any) => boolean;
21
+ clearAll: () => void;
22
+ toggleSelect: (item: any) => void;
23
+ } | undefined;
24
+ getShownColumns: () => TableColumnsType<any>;
25
+ } | null | undefined;
26
+ isDestroyed: true;
3
27
  open: (selected?: any[], options?: OpenOptions) => Promise< OpenReturnType<TableRowType>>;
4
28
  destroy: () => void;
5
29
  close: () => void;
@@ -1,13 +1,13 @@
1
1
  import { onUnmounted as m } from "vue";
2
- import { useCreateTableModal as p } from "./use-create-table-modal.mjs";
3
- const w = (e) => e.id;
4
- function i(e) {
5
- const { finishCallback: o, getRowKey: r, ...a } = e, { destroy: t, openModal: c, closeModal: d } = p({
2
+ import { useCreateTableModal as w } from "./use-create-table-modal.mjs";
3
+ const f = (e) => e.id;
4
+ function K(e) {
5
+ const { finishCallback: o, getRowKey: r, ...a } = e, { destroy: t, openModal: c, closeModal: d, ...l } = w({
6
6
  ...a,
7
7
  destroyOnUnmounted: !1,
8
- getRowKey: r || w
9
- }), l = async (u = [], y = {}) => {
10
- const s = await c(u, y) || {
8
+ getRowKey: r || f
9
+ }), u = async (p = [], y = {}) => {
10
+ const s = await c(p, y) || {
11
11
  keys: [],
12
12
  rows: []
13
13
  };
@@ -18,11 +18,12 @@ function i(e) {
18
18
  return m(() => {
19
19
  n(), t();
20
20
  }), {
21
- open: l,
21
+ open: u,
22
22
  destroy: t,
23
- close: n
23
+ close: n,
24
+ ...l
24
25
  };
25
26
  }
26
27
  export {
27
- i as useTableSelectModal
28
+ K as useTableSelectModal
28
29
  };
@@ -8,6 +8,8 @@ import { VueTypeValidableDef } from '../../../node_modules/vue-types';
8
8
  import { MouseEventHandler } from 'ant-design-vue/es/_util/EventInterface';
9
9
  import { VueNode } from 'ant-design-vue/es/_util/type';
10
10
  import { OpenOptions, OpenReturnType } from './interface';
11
+ import { Recordable } from '../../type';
12
+ import { TableColumnsType } from 'ant-design-vue';
11
13
  /**
12
14
  *
13
15
  */
@@ -263,6 +265,25 @@ declare const ApTableModal: DefineComponent<{
263
265
  }, {
264
266
  open: <T>(selected?: any[], options?: OpenOptions) => Promise< OpenReturnType<T>>;
265
267
  close: () => void;
268
+ getApTableInstance: () => {
269
+ submit: () => void;
270
+ reset: () => void;
271
+ refresh: () => void;
272
+ setSearchFormValues: (fields: Partial< Recordable>) => void;
273
+ getSearchFormValues: () => Partial< Recordable>;
274
+ dataSource: any;
275
+ rowSelection?: {
276
+ select: (item: any) => void;
277
+ selectAll: () => void;
278
+ unSelectAll: () => void;
279
+ selectedRows: any[];
280
+ unSelect: (item: any) => void;
281
+ isSelected: (item: any) => boolean;
282
+ clearAll: () => void;
283
+ toggleSelect: (item: any) => void;
284
+ } | undefined;
285
+ getShownColumns: () => TableColumnsType<any>;
286
+ } | null;
266
287
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
267
288
  finish: (selectedRowKeys: (string | number)[], selectedRows: any[]) => void;
268
289
  }, string, PublicProps, Readonly< ExtractPropTypes<{
@@ -1,5 +1,7 @@
1
1
  import { OpenOptions, OpenReturnType, ApTableModalProps } from './interface';
2
2
  import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
3
+ import { Recordable } from '../../type';
4
+ import { TableColumnsType } from 'ant-design-vue';
3
5
  declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<ApTableModalProps<any>>, {
4
6
  confirmLoading: undefined;
5
7
  closable: undefined;
@@ -20,6 +22,25 @@ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOpti
20
22
  }>, {
21
23
  open: <T>(selected?: any[], options?: OpenOptions) => Promise<OpenReturnType<T>>;
22
24
  close: () => void;
25
+ getApTableInstance: () => {
26
+ submit: () => void;
27
+ reset: () => void;
28
+ refresh: () => void;
29
+ setSearchFormValues: (fields: Partial< Recordable>) => void;
30
+ getSearchFormValues: () => Partial< Recordable>;
31
+ dataSource: any;
32
+ rowSelection?: {
33
+ select: (item: any) => void;
34
+ selectAll: () => void;
35
+ unSelectAll: () => void;
36
+ selectedRows: any[];
37
+ unSelect: (item: any) => void;
38
+ isSelected: (item: any) => boolean;
39
+ clearAll: () => void;
40
+ toggleSelect: (item: any) => void;
41
+ } | undefined;
42
+ getShownColumns: () => TableColumnsType<any>;
43
+ } | null;
23
44
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
24
45
  finish: (selectedRowKeys: (string | number)[], selectedRows: any[]) => void;
25
46
  }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ApTableModalProps<any>>, {
@@ -1,7 +1,7 @@
1
- import { defineComponent as N, ref as i, unref as r, computed as O, h as D, openBlock as E, createBlock as I, mergeProps as x, withCtx as L, createVNode as U } from "vue";
2
- import { message as q, Modal as A } from "ant-design-vue";
1
+ import { defineComponent as I, ref as i, unref as r, computed as N, h as O, openBlock as A, createBlock as D, mergeProps as g, withCtx as E, createVNode as L } from "vue";
2
+ import { message as U, Modal as q } from "ant-design-vue";
3
3
  import "../../index.mjs";
4
- import { cloneDeep as F, omit as g } from "lodash-unified";
4
+ import { cloneDeep as F, omit as x } from "lodash-unified";
5
5
  import { transformTableParams as G } from "@aplus-frontend/utils";
6
6
  import "./modal-title.vue.mjs";
7
7
  import { AsyncOpenResultError as f } from "./interface.mjs";
@@ -9,7 +9,7 @@ import { useGlobalConfig as $ } from "../../config-provider/hooks/use-global-con
9
9
  import { useLocale as z } from "../../config-provider/hooks/use-locale.mjs";
10
10
  import V from "./modal-title.vue2.mjs";
11
11
  import W from "../../ap-table/ap-table.vue.mjs";
12
- const le = /* @__PURE__ */ N({
12
+ const le = /* @__PURE__ */ I({
13
13
  __name: "table-modal",
14
14
  props: {
15
15
  columns: {},
@@ -56,17 +56,17 @@ const le = /* @__PURE__ */ N({
56
56
  mousePosition: {}
57
57
  },
58
58
  emits: ["finish"],
59
- setup(C, { expose: b, emit: w }) {
60
- const e = C, T = w, s = i(!1), m = i({}), c = i(null), l = i([]), p = i();
59
+ setup(b, { expose: C, emit: w }) {
60
+ const e = b, T = w, s = i(!1), m = i({}), d = i(null), n = i([]), p = i();
61
61
  let u = null, a = null;
62
62
  const k = $("uiMode", "admin"), { t: B } = z(), S = async (t = [], o = {}) => {
63
- var n, d, v;
64
- switch (l.value = [...t], s.value = !0, m.value = o == null ? void 0 : o.extraParams, p.value = o.apTableDataSources || ((n = e.apTableProps) == null ? void 0 : n.dataSource), o.refreshMode || "reset") {
63
+ var l, c, v;
64
+ switch (n.value = [...t], s.value = !0, m.value = o == null ? void 0 : o.extraParams, p.value = o.apTableDataSources || ((l = e.apTableProps) == null ? void 0 : l.dataSource), o.refreshMode || "reset") {
65
65
  case "reset":
66
- (d = c.value) == null || d.reset();
66
+ (c = d.value) == null || c.reset();
67
67
  break;
68
68
  case "submit":
69
- (v = c.value) == null || v.submit();
69
+ (v = d.value) == null || v.submit();
70
70
  break;
71
71
  case "none":
72
72
  break;
@@ -81,63 +81,64 @@ const le = /* @__PURE__ */ N({
81
81
  ...t,
82
82
  ...m.value
83
83
  });
84
- const o = e.api, { records: n, total: d } = await o(t);
84
+ const o = e.api, { records: l, total: c } = await o(t);
85
85
  return {
86
- data: n,
87
- total: d
86
+ data: l,
87
+ total: c
88
88
  };
89
89
  }, M = () => {
90
- if (l.value.length > e.maxCount) {
90
+ if (n.value.length > e.maxCount) {
91
91
  a == null || a(f.ExceedMaxCount);
92
92
  return;
93
93
  }
94
94
  if (e.getRowKey) {
95
- const t = F(r(l)), o = t.map(e.getRowKey);
95
+ const t = F(r(n)), o = t.map(e.getRowKey);
96
96
  T("finish", o, t), u == null || u({ keys: o, rows: t });
97
97
  } else {
98
98
  a == null || a(f.NotFineGetRowKey);
99
99
  return;
100
100
  }
101
101
  s.value = !1;
102
- }, P = O(() => {
102
+ }, P = N(() => {
103
103
  if (e.getRowKey)
104
104
  return {
105
105
  fixed: !0,
106
- selectedRowKeys: l.value.map(e.getRowKey),
106
+ selectedRowKeys: n.value.map(e.getRowKey),
107
107
  columnWidth: 50,
108
108
  preserveSelectedRowKeys: !0,
109
109
  onChange: (t, o) => {
110
110
  if (o.length > e.maxCount) {
111
- q.warning(
111
+ U.warning(
112
112
  B("ap.apTableModal.messageMaxCount", { maxCount: e.maxCount })
113
113
  );
114
114
  return;
115
115
  }
116
- l.value = o;
116
+ n.value = o;
117
117
  }
118
118
  };
119
- }), R = () => e.isRenderModalTitleSuffix ? D(
119
+ }), R = () => e.isRenderModalTitleSuffix ? O(
120
120
  V,
121
121
  {
122
122
  title: e.title,
123
- count: l.value.length || 0,
123
+ count: n.value.length || 0,
124
124
  maxCount: e.maxCount
125
125
  },
126
126
  {
127
127
  default: e.renderModalTitleSuffix ?? void 0
128
128
  }
129
129
  ) : e.title;
130
- return b({
130
+ return C({
131
131
  open: S,
132
- close: y
133
- }), (t, o) => (E(), I(r(A), x(
132
+ close: y,
133
+ getApTableInstance: () => d.value
134
+ }), (t, o) => (A(), D(r(q), g(
134
135
  {
135
136
  onOk: M,
136
137
  onCancel: y,
137
138
  open: s.value,
138
- "onUpdate:open": o[0] || (o[0] = (n) => s.value = n)
139
+ "onUpdate:open": o[0] || (o[0] = (l) => s.value = l)
139
140
  },
140
- r(g)(e, [
141
+ r(x)(e, [
141
142
  "api",
142
143
  "getRowKey",
143
144
  "centered",
@@ -153,8 +154,8 @@ const le = /* @__PURE__ */ N({
153
154
  centered: e.centered ?? !0
154
155
  }
155
156
  ), {
156
- default: L(() => [
157
- U(r(W), x({
157
+ default: E(() => [
158
+ L(r(W), g({
158
159
  scroll: { y: "100%" },
159
160
  style: { padding: "0px" },
160
161
  columns: t.columns,
@@ -162,9 +163,9 @@ const le = /* @__PURE__ */ N({
162
163
  "row-key": t.getRowKey,
163
164
  "row-selection": P.value,
164
165
  bordered: r(k) === "admin"
165
- }, r(g)(e.apTableProps, "dataSource"), {
166
+ }, r(x)(e.apTableProps, "dataSource"), {
166
167
  ref_key: "apTableRef",
167
- ref: c,
168
+ ref: d,
168
169
  "data-source": p.value
169
170
  }), null, 16, ["columns", "row-key", "row-selection", "bordered", "data-source"])
170
171
  ]),