@aplus-frontend/ui 0.5.27 → 0.5.29

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 (33) hide show
  1. package/es/index.mjs +84 -82
  2. package/es/src/ap-grid/editable/form-item.vue.mjs +20 -18
  3. package/es/src/ap-grid/editable/index.vue.mjs +22 -20
  4. package/es/src/ap-grid/index.vue.mjs +78 -69
  5. package/es/src/ap-grid/interface.d.ts +5 -1
  6. package/es/src/ap-grid/utils/col.mjs +48 -48
  7. package/es/src/ap-grid/utils/table.mjs +2 -2
  8. package/es/src/ap-table/hooks/use-table-paging-ng.mjs +52 -52
  9. package/es/src/business/hooks/index.d.ts +1 -0
  10. package/es/src/business/hooks/index.mjs +6 -4
  11. package/es/src/business/hooks/useGridRefresh.d.ts +17 -0
  12. package/es/src/business/hooks/useGridRefresh.mjs +17 -0
  13. package/es/src/business/hooks/usePageListApGrid.mjs +11 -11
  14. package/es/src/full-screen/index.vue.mjs +17 -16
  15. package/es/src/full-screen/interface.d.ts +2 -1
  16. package/es/src/index.mjs +73 -71
  17. package/lib/index.js +1 -1
  18. package/lib/src/ap-grid/editable/form-item.vue.js +1 -1
  19. package/lib/src/ap-grid/editable/index.vue.js +1 -1
  20. package/lib/src/ap-grid/index.vue.js +1 -1
  21. package/lib/src/ap-grid/interface.d.ts +5 -1
  22. package/lib/src/ap-grid/utils/col.js +1 -1
  23. package/lib/src/ap-grid/utils/table.js +1 -1
  24. package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
  25. package/lib/src/business/hooks/index.d.ts +1 -0
  26. package/lib/src/business/hooks/index.js +1 -1
  27. package/lib/src/business/hooks/useGridRefresh.d.ts +17 -0
  28. package/lib/src/business/hooks/useGridRefresh.js +1 -0
  29. package/lib/src/business/hooks/usePageListApGrid.js +1 -1
  30. package/lib/src/full-screen/index.vue.js +1 -1
  31. package/lib/src/full-screen/interface.d.ts +2 -1
  32. package/lib/src/index.js +1 -1
  33. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { ref as ae, reactive as j, unref as h, nextTick as se, onMounted as ie, watch as ce, computed as A, createVNode as x } from "vue";
1
+ import { ref as ae, reactive as j, unref as m, nextTick as se, onMounted as ie, watch as ce, computed as A, createVNode as x } from "vue";
2
2
  import { useTableSortedAndFiltered as ue } from "./use-sorted-filtered.mjs";
3
3
  import "../../config-provider/index.mjs";
4
4
  import { parseFieldValue as le, dataIndexToStr as fe, isEqualCustom as ge } from "../utils.mjs";
@@ -6,8 +6,8 @@ import { isArray as q, isEqualWith as de, isUndefined as pe } from "lodash-unifi
6
6
  import { isDef as N } from "../../utils/index.mjs";
7
7
  import { useLocale as me } from "../../config-provider/hooks/use-locale.mjs";
8
8
  import { useNamespace as he } from "../../config-provider/hooks/use-namespace.mjs";
9
- const S = 1, D = 10, B = {
10
- defaultCurrent: S,
9
+ const h = 1, D = 10, B = {
10
+ defaultCurrent: h,
11
11
  defaultPageSize: D,
12
12
  showLessItems: !1,
13
13
  showTotal: !0
@@ -20,7 +20,7 @@ function Se(s) {
20
20
  }
21
21
  function ze(s) {
22
22
  const f = {};
23
- return s === !1 || (s === !0 || s == null ? (f.current = S, f.pageSize = D) : (f.current = s.defaultCurrent || S, f.pageSize = s.defaultPageSize || D)), f;
23
+ return s === !1 || (s === !0 || s == null ? (f.current = h, f.pageSize = D) : (f.current = s.defaultCurrent || h, f.pageSize = s.defaultPageSize || D)), f;
24
24
  }
25
25
  const Ae = ({
26
26
  manual: s = !1,
@@ -33,10 +33,10 @@ const Ae = ({
33
33
  filterFields: J,
34
34
  sortFields: K,
35
35
  namespace: M = "ap-table",
36
- pagination: d
36
+ pagination: S
37
37
  }) => {
38
38
  let b = 0, i = {};
39
- const Q = Se(d), $ = (e) => y ? y(e) : e, z = ae(), c = j(ze(d)), {
39
+ const Q = Se(S), $ = (e) => y ? y(e) : e, z = ae(), c = j(ze(S)), {
40
40
  getColumnSFConfig: G,
41
41
  setSF: W,
42
42
  clearAll: Z,
@@ -54,34 +54,34 @@ const Ae = ({
54
54
  var e, t;
55
55
  return ((t = (e = z.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
56
56
  }, I = async (e) => {
57
- var n;
58
- const t = $(e), r = Date.now();
59
- b = r, a.loading = !0;
57
+ var r;
58
+ const t = $(e), n = Date.now();
59
+ b = n, a.loading = !0;
60
60
  try {
61
61
  const o = await f({
62
- ...h(L),
62
+ ...m(L),
63
63
  ...t
64
64
  });
65
- b === r && (a.total = o.total || ((n = o.data) == null ? void 0 : n.length) || 0, a.records = [...o.data || []]);
65
+ b === n && (a.total = o.total || ((r = o.data) == null ? void 0 : r.length) || 0, a.records = [...o.data || []]);
66
66
  } catch {
67
- b === r && (a.records = [], a.total = 0);
67
+ b === n && (a.records = [], a.total = 0);
68
68
  } finally {
69
69
  a.loading = !1;
70
70
  }
71
71
  }, V = (e) => {
72
72
  const t = {};
73
- return Object.entries(e).forEach(([r, n]) => {
74
- if (t[r] = n, O && n) {
75
- const o = O[r];
76
- o && (t[r] = le(o, n));
73
+ return Object.entries(e).forEach(([n, r]) => {
74
+ if (t[n] = r, O && r) {
75
+ const o = O[n];
76
+ o && (t[n] = le(o, r));
77
77
  }
78
78
  }), t;
79
79
  }, Y = async (e) => {
80
- var n, o, l, g, p;
81
- const t = w(), r = {};
82
- Object.entries(t).forEach(([m, F]) => {
83
- R && R.indexOf(m) > -1 && (r[m] = F);
84
- }), await ((o = (n = z.value) == null ? void 0 : n.apForm) == null ? void 0 : o.resetFields()), (p = (g = (l = z.value) == null ? void 0 : l.apForm) == null ? void 0 : g.setFieldsValue) == null || p.call(g, r), se(() => {
80
+ var r, o, l, g, d;
81
+ const t = w(), n = {};
82
+ Object.entries(t).forEach(([p, F]) => {
83
+ R && R.indexOf(p) > -1 && (n[p] = F);
84
+ }), await ((o = (r = z.value) == null ? void 0 : r.apForm) == null ? void 0 : o.resetFields()), (d = (g = (l = z.value) == null ? void 0 : l.apForm) == null ? void 0 : g.setFieldsValue) == null || d.call(g, n), se(() => {
85
85
  e == null || e();
86
86
  });
87
87
  }, C = (e) => {
@@ -94,70 +94,70 @@ const Ae = ({
94
94
  ...e
95
95
  });
96
96
  }, E = () => {
97
- const e = w();
98
- d && (c.current = S), C({
97
+ const e = w(), t = S !== !1;
98
+ t && (c.current = h), C({
99
99
  ...e,
100
100
  filter: i.filter,
101
101
  sort: i.sort,
102
- current: d ? S : void 0,
103
- pageSize: d ? i.pageSize || c.pageSize : void 0
102
+ current: t ? h : void 0,
103
+ pageSize: t ? i.pageSize || c.pageSize : void 0
104
104
  });
105
105
  }, ee = () => {
106
106
  Z(), i.sort = {}, i.filter = {}, Y(E);
107
107
  }, U = () => {
108
108
  C(i);
109
109
  }, te = (e) => {
110
- if (!d)
110
+ if (S === !1)
111
111
  U();
112
112
  else {
113
113
  const {
114
114
  current: t,
115
- pageSize: r
116
- } = c, n = a.total - e, o = Math.ceil(n / r), l = t > o ? o : t;
115
+ pageSize: n
116
+ } = c, r = a.total - e, o = Math.ceil(r / n), l = t > o ? o : t;
117
117
  k({
118
118
  current: l > 0 ? l : 1
119
119
  });
120
120
  }
121
- }, _ = (e, t, r) => {
122
- var m, F;
123
- const n = w();
124
- c.current = e.current, c.pageSize = e.pageSize, W(t, r);
125
- const o = q(r) ? [...r] : [r], l = {};
121
+ }, _ = (e, t, n) => {
122
+ var p, F;
123
+ const r = w();
124
+ c.current = e.current, c.pageSize = e.pageSize, W(t, n);
125
+ const o = q(n) ? [...n] : [n], l = {};
126
126
  for (const u of o)
127
- (m = h(K)) != null && m.includes(u.columnKey || u.field) && u.order && (l[fe(u.columnKey || u.field)] = u.order);
127
+ (p = m(K)) != null && p.includes(u.columnKey || u.field) && u.order && (l[fe(u.columnKey || u.field)] = u.order);
128
128
  const g = {};
129
129
  for (const u of Object.keys(t))
130
- (F = h(J)) != null && F.includes(u) && t[u] && (g[u] = t[u]);
131
- const p = {
132
- ...n,
130
+ (F = m(J)) != null && F.includes(u) && t[u] && (g[u] = t[u]);
131
+ const d = {
132
+ ...r,
133
133
  filter: g,
134
134
  sort: l,
135
135
  current: e.current,
136
136
  pageSize: e.pageSize
137
137
  };
138
- de(i, p, ge) || C(p);
138
+ de(i, d, ge) || C(d);
139
139
  };
140
140
  ie(() => {
141
141
  const e = w(), {
142
142
  current: t,
143
- pageSize: r
143
+ pageSize: n
144
144
  } = c;
145
145
  if (i = {
146
146
  current: t,
147
- pageSize: r,
147
+ pageSize: n,
148
148
  filter: {},
149
149
  sort: {},
150
150
  ...e
151
151
  }, !s) {
152
- const n = V(i);
153
- I(n);
152
+ const r = V(i);
153
+ I(r);
154
154
  }
155
- }), ce(() => h(L), () => {
155
+ }), ce(() => m(L), () => {
156
156
  E();
157
157
  }, {
158
158
  deep: !0
159
159
  });
160
- const re = A(() => {
160
+ const ne = A(() => {
161
161
  if (a.total === 0)
162
162
  return "-";
163
163
  const {
@@ -166,15 +166,15 @@ const Ae = ({
166
166
  } = c;
167
167
  return `${e}/${Math.ceil(a.total / t)}`;
168
168
  });
169
- function ne(e) {
169
+ function re(e) {
170
170
  q(e) && (a.records = e, a.total = e.length);
171
171
  }
172
172
  const oe = A(() => {
173
173
  const {
174
174
  showLessItems: e,
175
175
  showTotal: t,
176
- showQuickJumper: r,
177
- showSizeChanger: n,
176
+ showQuickJumper: n,
177
+ showSizeChanger: r,
178
178
  pageSizeOptions: o
179
179
  } = Q;
180
180
  return {
@@ -183,8 +183,8 @@ const Ae = ({
183
183
  current: c.current,
184
184
  pageSize: c.pageSize,
185
185
  total: a.total,
186
- showSizeChanger: N(n) ? n : !e,
187
- showQuickJumper: N(r) ? r : !e,
186
+ showSizeChanger: N(r) ? r : !e,
187
+ showQuickJumper: N(n) ? n : !e,
188
188
  showLessItems: e,
189
189
  size: "default",
190
190
  pageSizeOptions: pe(o) ? ["10", "20", "50", "100"] : o,
@@ -196,7 +196,7 @@ const Ae = ({
196
196
  class: P("pagination--total-right")
197
197
  }, [T("ap.apTable.pagination.totalRightPrefix"), " ", x("span", {
198
198
  class: P("pagination-count-text")
199
- }, [h(re)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
199
+ }, [m(ne)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
200
200
  },
201
201
  onChange: _,
202
202
  dataSource: a.records
@@ -214,14 +214,14 @@ const Ae = ({
214
214
  handleTableChange: _,
215
215
  tableProps: oe,
216
216
  dataSource: A(() => a.records),
217
- setDataSource: ne,
217
+ setDataSource: re,
218
218
  getColumnSFConfig: G,
219
219
  sortedInfo: H,
220
220
  filteredInfo: X
221
221
  };
222
222
  };
223
223
  export {
224
- S as DEFAULT_CURRENT,
224
+ h as DEFAULT_CURRENT,
225
225
  D as DEFAULT_PAGE_SIZE,
226
226
  Ae as useTablePaging
227
227
  };
@@ -1,3 +1,4 @@
1
1
  export * from './usePageListApTable';
2
2
  export * from './useTableRefresh';
3
3
  export * from './usePageListApGrid';
4
+ export * from './useGridRefresh';
@@ -1,8 +1,10 @@
1
1
  import { usePageListApTable as o } from "./usePageListApTable.mjs";
2
- import { useTableRefresh as p } from "./useTableRefresh.mjs";
3
- import { usePageListApGrid as a } from "./usePageListApGrid.mjs";
2
+ import { useTableRefresh as f } from "./useTableRefresh.mjs";
3
+ import { usePageListApGrid as t } from "./usePageListApGrid.mjs";
4
+ import { useGridRefresh as i } from "./useGridRefresh.mjs";
4
5
  export {
5
- a as usePageListApGrid,
6
+ i as useGridRefresh,
7
+ t as usePageListApGrid,
6
8
  o as usePageListApTable,
7
- p as useTableRefresh
9
+ f as useTableRefresh
8
10
  };
@@ -0,0 +1,17 @@
1
+ import { Ref } from 'vue';
2
+ import { ApGridExpose } from '../../ap-grid';
3
+ export interface UseGridRefreshOption {
4
+ /**
5
+ * apTable实例
6
+ */
7
+ apTableRef?: Ref<ApGridExpose | undefined | null>;
8
+ /**
9
+ * 刷新类型,reset:重置,submit:提交
10
+ */
11
+ refreshType?: 'reset' | 'submit';
12
+ /**
13
+ * 刷新前执行,返回false则不执行
14
+ */
15
+ refreshBefore?: () => boolean;
16
+ }
17
+ export declare function useGridRefresh(option?: UseGridRefreshOption): void;
@@ -0,0 +1,17 @@
1
+ import { onMounted as m, onActivated as b } from "vue";
2
+ function l(e) {
3
+ const a = (["reset", "submit", void 0].includes(e == null ? void 0 : e.refreshType) ? e == null ? void 0 : e.refreshType : "submit") ?? "submit", r = (e == null ? void 0 : e.refreshBefore) ?? (() => !0);
4
+ let s = !0;
5
+ m(() => {
6
+ s = !1;
7
+ }), b(() => {
8
+ const c = r == null ? void 0 : r();
9
+ s || c && setTimeout(() => {
10
+ var u, f;
11
+ (f = (u = e == null ? void 0 : e.apTableRef) == null ? void 0 : u.value) == null || f[a]();
12
+ });
13
+ });
14
+ }
15
+ export {
16
+ l as useGridRefresh
17
+ };
@@ -9,17 +9,17 @@ function k(s) {
9
9
  isShowRowSelection: c = !0,
10
10
  clearSelectionOnRequest: i = !0,
11
11
  transformSearchFormValues: a,
12
- api: l,
13
- tableRefresh: f = !1,
14
- ...d
12
+ api: n,
13
+ tableRefresh: d = !0,
14
+ ...f
15
15
  } = s || {};
16
- let n = null;
16
+ let l = null;
17
17
  const m = v("uiMode", "aplus"), u = () => {
18
18
  var e, r;
19
19
  (r = (e = o.value) == null ? void 0 : e.rowSelection) == null || r.clearAll();
20
20
  };
21
21
  return b({
22
- ...R(f),
22
+ ...R(d),
23
23
  apTableRef: o
24
24
  }), [h(
25
25
  {
@@ -28,12 +28,12 @@ function k(s) {
28
28
  columnResizable: !0,
29
29
  // 表格分页器吸底效果
30
30
  sticky: !0,
31
- request: l ? async (e) => {
32
- n = e.sort;
31
+ request: n ? async (e) => {
32
+ l = e.sort;
33
33
  const r = a ? a(e) : e;
34
34
  try {
35
- if (!l) throw new Error("api is not defined");
36
- const { records: t, total: p } = await l(r);
35
+ if (!n) throw new Error("api is not defined");
36
+ const { records: t, total: p } = await n(r);
37
37
  return i && u(), {
38
38
  data: t,
39
39
  total: p
@@ -56,7 +56,7 @@ function k(s) {
56
56
  card: !0,
57
57
  bordered: m.value === "admin"
58
58
  },
59
- d
59
+ f
60
60
  ), {
61
61
  reload: () => {
62
62
  var e;
@@ -75,7 +75,7 @@ function k(s) {
75
75
  getSearchFormValuesAndSorted: (e = !0) => {
76
76
  var t;
77
77
  const r = ((t = o.value) == null ? void 0 : t.getSearchFormValues(!!e)) || {};
78
- return r.sort = n && S(n), a ? a(r) : r;
78
+ return r.sort = l && S(l), a ? a(r) : r;
79
79
  },
80
80
  clearSelection: u
81
81
  }];
@@ -1,4 +1,4 @@
1
- import { defineComponent as R, ref as i, watch as E, unref as a, computed as n, createBlock as m, openBlock as d, withCtx as v, resolveDynamicComponent as z, mergeProps as C, renderSlot as F, createElementVNode as N, normalizeClass as S } from "vue";
1
+ import { defineComponent as R, ref as i, watch as E, unref as a, computed as n, createBlock as d, openBlock as m, withCtx as v, resolveDynamicComponent as z, mergeProps as C, renderSlot as F, createElementVNode as N, normalizeClass as S } from "vue";
2
2
  import "../hooks/index.mjs";
3
3
  import "../portal/index.mjs";
4
4
  import "../config-provider/index.mjs";
@@ -11,7 +11,8 @@ const H = /* @__PURE__ */ R({
11
11
  __name: "index",
12
12
  props: {
13
13
  wrapperElementName: { default: "div" },
14
- zIndex: { default: 2147483647 }
14
+ zIndex: { default: 2147483647 },
15
+ to: { default: "body" }
15
16
  },
16
17
  setup(L, { expose: w }) {
17
18
  const {
@@ -19,49 +20,49 @@ const H = /* @__PURE__ */ R({
19
20
  full: b,
20
21
  enter: y,
21
22
  exit: _
22
- } = I(), { b: x, bm: g, be: k } = $("full-screen"), t = i(!1), l = i(), p = h(document.body), u = i();
23
+ } = I(), { b: g, bm: k, be: x } = $("full-screen"), t = i(!1), l = i(), p = h(document.body), u = i();
23
24
  E(
24
25
  () => a(b),
25
26
  (e) => {
26
27
  e || (t.value = !1, l.value = void 0);
27
28
  }
28
29
  );
29
- async function o(e, r = !1) {
30
- await s(), t.value = !0, l.value = e, e === "browser" ? y(r) : p.value = !0;
30
+ async function r(e, o = !1) {
31
+ await s(), t.value = !0, l.value = e, e === "browser" ? y(o) : p.value = !0;
31
32
  }
32
33
  async function s(e = !1) {
33
34
  t.value = !1, l.value === "browser" ? await _(e) : p.value = !1, l.value = void 0;
34
35
  }
35
- async function c(e, r = !1) {
36
- t.value ? l.value !== e ? await o(e, r) : await s(r) : await o(e, r);
36
+ async function c(e, o = !1) {
37
+ t.value ? l.value !== e ? await r(e, o) : await s(o) : await r(e, o);
37
38
  }
38
39
  return w({
39
40
  target: n(() => a(f)),
40
41
  portalRoot: n(() => a(u)),
41
42
  full: n(() => a(t)),
42
43
  mode: n(() => a(l)),
43
- enter: o,
44
+ enter: r,
44
45
  exit: s,
45
46
  toggle: c
46
- }), (e, r) => (d(), m(a(B), {
47
- to: "body",
47
+ }), (e, o) => (m(), d(a(B), {
48
+ to: e.to,
48
49
  disabled: l.value !== "window"
49
50
  }, {
50
51
  default: v(() => [
51
- (d(), m(z(e.wrapperElementName), C({
52
+ (m(), d(z(e.wrapperElementName), C({
52
53
  ref_key: "target",
53
54
  ref: f
54
55
  }, e.$attrs, {
55
56
  class: [
56
- a(x)("wrapper"),
57
- t.value && l.value === "window" ? a(g)("wrapper", "full") : null
57
+ a(g)("wrapper"),
58
+ t.value && l.value === "window" ? a(k)("wrapper", "full") : null
58
59
  ],
59
60
  style: { zIndex: t.value && l.value === "window" ? e.zIndex : "unset" }
60
61
  }), {
61
62
  default: v(() => [
62
63
  F(e.$slots, "default", {
63
64
  full: t.value,
64
- enter: o,
65
+ enter: r,
65
66
  exit: s,
66
67
  toggle: c,
67
68
  mode: l.value,
@@ -70,14 +71,14 @@ const H = /* @__PURE__ */ R({
70
71
  N("div", {
71
72
  ref_key: "portalRootRef",
72
73
  ref: u,
73
- class: S(a(k)("wrapper", "portal-root"))
74
+ class: S(a(x)("wrapper", "portal-root"))
74
75
  }, null, 2)
75
76
  ]),
76
77
  _: 3
77
78
  }, 16, ["class", "style"]))
78
79
  ]),
79
80
  _: 3
80
- }, 8, ["disabled"]));
81
+ }, 8, ["to", "disabled"]));
81
82
  }
82
83
  });
83
84
  export {
@@ -1,4 +1,5 @@
1
1
  import { ComputedRef } from 'vue';
2
+ import { PortalProps } from '../portal';
2
3
  export type FullScreenMode = 'browser' | 'window';
3
4
  export type FullScreenProps = {
4
5
  /**
@@ -9,7 +10,7 @@ export type FullScreenProps = {
9
10
  * 全屏状态下的css zIndex 默认为2^31 - 1
10
11
  */
11
12
  zIndex?: number;
12
- };
13
+ } & Pick<PortalProps, 'to'>;
13
14
  export type FullScreenExpose = {
14
15
  /**
15
16
  * 全屏的目标元素