@aplus-frontend/ui 0.5.8 → 0.5.10

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 (40) hide show
  1. package/es/index.mjs +109 -107
  2. package/es/src/ap-descriptions/ap-descriptions.vue.mjs +70 -54
  3. package/es/src/ap-descriptions/formatter/index.d.ts +2 -1
  4. package/es/src/ap-descriptions/formatter/index.mjs +92 -76
  5. package/es/src/ap-descriptions/helper.d.ts +3 -4
  6. package/es/src/ap-descriptions/helper.mjs +15 -13
  7. package/es/src/ap-descriptions/interface.d.ts +6 -0
  8. package/es/src/ap-grid/editable/form-item.vue.mjs +7 -7
  9. package/es/src/ap-grid/editable/index.vue.mjs +16 -16
  10. package/es/src/ap-grid/utils/col.mjs +35 -34
  11. package/es/src/ap-table/ap-table.vue2.mjs +49 -45
  12. package/es/src/ap-table/components/paragraph-ellipsis/index.vue.d.ts +1 -0
  13. package/es/src/ap-table/components/paragraph-ellipsis/index.vue2.mjs +33 -33
  14. package/es/src/business/hooks/index.d.ts +1 -0
  15. package/es/src/business/hooks/index.mjs +4 -2
  16. package/es/src/business/hooks/usePageListApGrid.d.ts +34 -0
  17. package/es/src/business/hooks/usePageListApGrid.mjs +90 -0
  18. package/es/src/index.mjs +61 -59
  19. package/lib/index.js +1 -1
  20. package/lib/src/ap-descriptions/ap-descriptions.vue.js +1 -1
  21. package/lib/src/ap-descriptions/formatter/index.d.ts +2 -1
  22. package/lib/src/ap-descriptions/formatter/index.js +1 -1
  23. package/lib/src/ap-descriptions/helper.d.ts +3 -4
  24. package/lib/src/ap-descriptions/helper.js +1 -1
  25. package/lib/src/ap-descriptions/interface.d.ts +6 -0
  26. package/lib/src/ap-grid/editable/form-item.vue.js +1 -1
  27. package/lib/src/ap-grid/editable/index.vue.js +1 -1
  28. package/lib/src/ap-grid/utils/col.js +1 -1
  29. package/lib/src/ap-table/ap-table.vue2.js +1 -1
  30. package/lib/src/ap-table/components/paragraph-ellipsis/index.vue.d.ts +1 -0
  31. package/lib/src/ap-table/components/paragraph-ellipsis/index.vue2.js +1 -1
  32. package/lib/src/business/hooks/index.d.ts +1 -0
  33. package/lib/src/business/hooks/index.js +1 -1
  34. package/lib/src/business/hooks/usePageListApGrid.d.ts +34 -0
  35. package/lib/src/business/hooks/usePageListApGrid.js +1 -0
  36. package/lib/src/index.js +1 -1
  37. package/package.json +5 -5
  38. package/theme/ap-descriptions/ap-descriptions.css +10 -0
  39. package/theme/ap-descriptions/ap-descriptions.less +13 -0
  40. package/theme/index.css +10 -0
@@ -1,26 +1,26 @@
1
- import { defineComponent as Ee, useSlots as Oe, ref as h, computed as s, unref as l, watch as k, createElementBlock as B, openBlock as p, normalizeStyle as K, normalizeClass as m, createCommentVNode as Z, createElementVNode as E, createVNode as y, mergeProps as w, createSlots as ee, withCtx as v, Fragment as oe, renderList as re, createBlock as ae, resolveDynamicComponent as Ve, renderSlot as R, normalizeProps as Le, guardReactiveProps as $e } from "vue";
1
+ import { defineComponent as Ke, useSlots as Ee, ref as h, computed as s, unref as l, watch as k, createElementBlock as B, openBlock as p, normalizeStyle as V, normalizeClass as m, createCommentVNode as Z, createElementVNode as K, createVNode as y, mergeProps as w, createSlots as ee, withCtx as v, Fragment as oe, renderList as re, createBlock as ae, resolveDynamicComponent as Oe, renderSlot as R, normalizeProps as Le, guardReactiveProps as $e } from "vue";
2
2
  import { Divider as Ae, Table as De } from "@aplus-frontend/antdv";
3
- import { useToken as We } from "@aplus-frontend/antdv/es/theme/internal";
4
- import { ApForm as je } from "../ap-form/index.mjs";
3
+ import { useToken as je } from "@aplus-frontend/antdv/es/theme/internal";
4
+ import { ApForm as We } from "../ap-form/index.mjs";
5
5
  import { noRenderAsFormItemValueList as te } from "./constants.mjs";
6
6
  import "../config-provider/index.mjs";
7
7
  import { useTablePaging as _e } from "./hooks/use-table-paging-ng.mjs";
8
8
  import { isUndefined as g, omit as le, isBoolean as He } from "lodash-unified";
9
- import { getColumnOrder as ne, updateFormProps as Ue, getFieldProps as qe, getSearchFormItemRenderNode as Me, recursionApColumns as se, falseToUndefined as Ge, getTableTitle as Je, getTableRenderType as Qe, getTableRenderProps as Xe, getTableCellRenderNode as Ye, apColumnToColumn as Ze } from "./utils.mjs";
10
- import eo from "./hooks/use-table-content-height.mjs";
11
- import oo from "./hooks/use-table-row-selection.mjs";
12
- import { getScrollbarSize as ro, isDef as ao } from "../utils/index.mjs";
9
+ import { getColumnOrder as ne, updateFormProps as Ue, getFieldProps as qe, getSearchFormItemRenderNode as Me, recursionApColumns as se, falseToUndefined as Ge, getTableTitle as Je, getTableRenderType as Qe, getTableRenderProps as Xe, getTableCellRenderNode as Ye, apColumnToColumn as Ze, objectToString as eo } from "./utils.mjs";
10
+ import oo from "./hooks/use-table-content-height.mjs";
11
+ import ro from "./hooks/use-table-row-selection.mjs";
12
+ import { getScrollbarSize as ao, isDef as to } from "../utils/index.mjs";
13
13
  import "./components/setting/modal/index.vue.mjs";
14
14
  import "./components/paragraph-ellipsis/index.vue.mjs";
15
- import { useProvideApTable as to } from "./context.mjs";
15
+ import { useProvideApTable as lo } from "./context.mjs";
16
16
  import "../scroll-bar/index.mjs";
17
- import { useStickyScroll as lo } from "./hooks/use-sticky-scroll.mjs";
18
- import { useNamespace as no } from "../config-provider/hooks/use-namespace.mjs";
19
- import { useGlobalConfig as so } from "../config-provider/hooks/use-global-config.mjs";
20
- import uo from "./components/setting/modal/index.vue2.mjs";
21
- import io from "../scroll-bar/index.vue.mjs";
22
- import co from "./components/paragraph-ellipsis/index.vue2.mjs";
23
- const Eo = /* @__PURE__ */ Ee({
17
+ import { useStickyScroll as no } from "./hooks/use-sticky-scroll.mjs";
18
+ import { useNamespace as so } from "../config-provider/hooks/use-namespace.mjs";
19
+ import { useGlobalConfig as uo } from "../config-provider/hooks/use-global-config.mjs";
20
+ import io from "./components/setting/modal/index.vue2.mjs";
21
+ import co from "../scroll-bar/index.vue.mjs";
22
+ import fo from "./components/paragraph-ellipsis/index.vue2.mjs";
23
+ const Eo = /* @__PURE__ */ Ke({
24
24
  name: "ApTable",
25
25
  __name: "ap-table",
26
26
  props: {
@@ -148,23 +148,23 @@ const Eo = /* @__PURE__ */ Ee({
148
148
  expose: ue
149
149
  }) {
150
150
  const o = de;
151
- let O = 0;
152
- const C = Oe(), [, ie] = We(), {
151
+ let E = 0;
152
+ const C = Ee(), [, ie] = je(), {
153
153
  e: z,
154
154
  b: c,
155
- be: V,
155
+ be: O,
156
156
  m: ce,
157
157
  cssVar: fe
158
- } = no("ap-table"), L = so("valueTypeMap"), {
158
+ } = so("ap-table"), L = uo("valueTypeMap"), {
159
159
  height: pe,
160
160
  contentRef: me
161
- } = eo(), $ = h(), A = h(), {
161
+ } = oo(), $ = h(), A = h(), {
162
162
  isStickyMode: D,
163
163
  scrollBarRef: i
164
- } = lo($), P = h(o.size), u = h([]), W = h([]), j = ro();
165
- to({
164
+ } = no($), P = h(o.size), u = h([]), j = h([]), W = ao();
165
+ lo({
166
166
  columns: s(() => u.value),
167
- columnsBackup: s(() => W.value),
167
+ columnsBackup: s(() => j.value),
168
168
  size: s(() => P.value),
169
169
  updateColumns(e) {
170
170
  u.value = e;
@@ -176,7 +176,7 @@ const Eo = /* @__PURE__ */ Ee({
176
176
  });
177
177
  const _ = s(() => {
178
178
  var e, a, r;
179
- return O++, ((r = (a = (e = o.columns) == null ? void 0 : e.filter((t) => !t.hideInSearch && t.dataIndex && (t.valueType || t.customRenderFormItem) && !te.includes(t.valueType))) == null ? void 0 : a.sort((t, d) => {
179
+ return E++, ((r = (a = (e = o.columns) == null ? void 0 : e.filter((t) => !t.hideInSearch && t.dataIndex && (t.valueType || t.customRenderFormItem) && !te.includes(t.valueType))) == null ? void 0 : a.sort((t, d) => {
180
180
  let n = ne(t.order);
181
181
  return ne(d.order) - n;
182
182
  })) == null ? void 0 : r.map((t) => {
@@ -186,7 +186,7 @@ const Eo = /* @__PURE__ */ Ee({
186
186
  label: t.title,
187
187
  name: t.dataIndex,
188
188
  ...d || {},
189
- _signal: O
189
+ _signal: E
190
190
  },
191
191
  renderNode: void 0
192
192
  };
@@ -202,7 +202,7 @@ const Eo = /* @__PURE__ */ Ee({
202
202
  rowSelection: T,
203
203
  selectedRows: F,
204
204
  ...x
205
- } = oo({
205
+ } = ro({
206
206
  fixed: !0,
207
207
  ...o.rowSelection === !0 ? {} : o.rowSelection,
208
208
  rowKey: o.rowKey,
@@ -244,12 +244,12 @@ const Eo = /* @__PURE__ */ Ee({
244
244
  let e = ((r = o.columns) == null ? void 0 : r.filter((t) => !t.hideInTable)) || [];
245
245
  function a(t, d) {
246
246
  return t.map((n) => ({
247
- resizable: ao(n.resizable) ? n.resizable : o.columnResizable,
247
+ resizable: to(n.resizable) ? n.resizable : o.columnResizable,
248
248
  ...le(Ze(n), ["ellipsis"]),
249
249
  // tips: 此函数内部依赖查询&筛选的相应式值
250
250
  ...M(n),
251
251
  fixed: d ? d.fixed : n.fixed,
252
- title: Je(n, V("table-header", "title"), C.headerCell, l(ie).colorPrimary),
252
+ title: Je(n, O("table-header", "title"), C.headerCell, l(ie).colorPrimary),
253
253
  customRender({
254
254
  value: f,
255
255
  ...S
@@ -264,11 +264,11 @@ const Eo = /* @__PURE__ */ Ee({
264
264
  }), Ne = Ye(J, Ie, S.record, l(L)), Q = ((X = n.renderText) == null ? void 0 : X.call(n, {
265
265
  value: f,
266
266
  ...S
267
- })) || f, Ke = n.renderText ? y(oe, null, [(Y = n.renderText) == null ? void 0 : Y.call(n, {
267
+ })) || f, Ve = n.renderText ? y(oe, null, [(Y = n.renderText) == null ? void 0 : Y.call(n, {
268
268
  value: f,
269
269
  ...S
270
270
  })]) : Ne;
271
- let N = ke(n, Q, Ke);
271
+ let N = ke(n, Q, Ve);
272
272
  return n.customRender && (N = n.customRender({
273
273
  value: f,
274
274
  ...S,
@@ -291,7 +291,7 @@ const Eo = /* @__PURE__ */ Ee({
291
291
  };
292
292
  k(() => [o.columns, o.columnResizable], () => {
293
293
  const e = Re();
294
- u.value = e, W.value = e;
294
+ u.value = e, j.value = e;
295
295
  }, {
296
296
  deep: !0,
297
297
  immediate: !0
@@ -332,11 +332,15 @@ const Eo = /* @__PURE__ */ Ee({
332
332
  };
333
333
  }), xe = s(() => {
334
334
  var e;
335
- return [c(), o.card ? null : c("wrapper"), o.adaptive ? c("adaptive") : null, D.value && ((e = i.value) != null && e.visible) ? ce(`sticky-${j === 0 ? "absolute" : "relative"}`) : null].filter(Boolean);
335
+ return [c(), o.card ? null : c("wrapper"), o.adaptive ? c("adaptive") : null, D.value && ((e = i.value) != null && e.visible) ? ce(`sticky-${W === 0 ? "absolute" : "relative"}`) : null].filter(Boolean);
336
336
  });
337
337
  function ke(e, a, r) {
338
- return te.includes(e.valueType) ? r : e.copyable || e.ellipsis ? y(co, {
338
+ if (te.includes(e.valueType))
339
+ return r;
340
+ const t = eo(a);
341
+ return e.copyable || e.ellipsis ? y(fo, {
339
342
  copyable: e.copyable,
343
+ rawValue: t,
340
344
  ellipsis: e.ellipsis ? He(e.ellipsis) ? {
341
345
  tooltip: r,
342
346
  rows: 1
@@ -396,14 +400,14 @@ const Eo = /* @__PURE__ */ Ee({
396
400
  ref_key: "tableWrapperRef",
397
401
  ref: $,
398
402
  class: m(xe.value),
399
- style: K(l(fe)({
400
- "scroll-bar-width": `${l(j)}px`
403
+ style: V(l(fe)({
404
+ "scroll-bar-width": `${l(W)}px`
401
405
  }))
402
406
  }, [l(g)(e.dataSource) && e.searchForm !== !1 && _.value.length > 0 ? (p(), B("div", {
403
407
  key: 0,
404
408
  class: m(e.card ? l(z)("search-wrapper") : null),
405
- style: K(e.searchFormWrapperStyle)
406
- }, [y(l(je).SearchForm, w(e.searchForm || {}, {
409
+ style: V(e.searchFormWrapperStyle)
410
+ }, [y(l(We).SearchForm, w(e.searchForm || {}, {
407
411
  ref_key: "formRef",
408
412
  ref: I,
409
413
  "custom-reset": "",
@@ -411,7 +415,7 @@ const Eo = /* @__PURE__ */ Ee({
411
415
  onSubmit: l(H),
412
416
  onReset: l(U)
413
417
  }), ee({
414
- default: v(() => [(p(!0), B(oe, null, re(_.value, (r) => (p(), ae(Ve(r.renderNode.Comp), w({
418
+ default: v(() => [(p(!0), B(oe, null, re(_.value, (r) => (p(), ae(Oe(r.renderNode.Comp), w({
415
419
  key: r.dataIndex,
416
420
  item: r,
417
421
  ref_for: !0
@@ -424,18 +428,18 @@ const Eo = /* @__PURE__ */ Ee({
424
428
  name: "extra",
425
429
  fn: v(() => [R(e.$slots, "searchFormExtra")]),
426
430
  key: "0"
427
- } : void 0]), 1040, ["submit-loading", "onSubmit", "onReset"])], 6)) : Z("", !0), E("div", {
431
+ } : void 0]), 1040, ["submit-loading", "onSubmit", "onReset"])], 6)) : Z("", !0), K("div", {
428
432
  ref_key: "contentRef",
429
433
  ref: me,
430
434
  class: m([l(z)("table-wrapper"), e.card ? l(z)("table-wrapper-card") : null]),
431
- style: K(e.tableWrapperStyle)
432
- }, [E("div", {
435
+ style: V(e.tableWrapperStyle)
436
+ }, [K("div", {
433
437
  class: m(l(c)("header-wrapper"))
434
438
  }, [e.settings ? (p(), B("div", {
435
439
  key: 0,
436
440
  class: m(l(c)("header"))
437
- }, [E("div", {
438
- class: m(l(V)("header", "title"))
441
+ }, [K("div", {
442
+ class: m(l(O)("header", "title"))
439
443
  }, [R(e.$slots, "title", w({
440
444
  selectedRows: l(F),
441
445
  selectedRowKeys: l(T).selectedRowKeys,
@@ -443,7 +447,7 @@ const Eo = /* @__PURE__ */ Ee({
443
447
  }, x))], 2), C.title ? (p(), ae(l(Ae), {
444
448
  key: 0,
445
449
  type: "vertical"
446
- })) : Z("", !0), y(uo, {
450
+ })) : Z("", !0), y(io, {
447
451
  config: e.settings === !0 ? {} : e.settings
448
452
  }, null, 8, ["config"])], 2)) : R(e.$slots, "title", w({
449
453
  key: 1,
@@ -470,7 +474,7 @@ const Eo = /* @__PURE__ */ Ee({
470
474
  name: "bottomPaginationTop",
471
475
  fn: v(() => {
472
476
  var r, t;
473
- return [y(l(io), {
477
+ return [y(l(co), {
474
478
  ref_key: "scrollBarRef",
475
479
  ref: i,
476
480
  "scroll-container": (t = (r = A.value) == null ? void 0 : r.table) == null ? void 0 : t.scrollBodyRef,
@@ -2,6 +2,7 @@ import { VNodeChild, DefineComponent, ComponentOptionsMixin, PublicProps, Compon
2
2
  interface Props {
3
3
  copyable?: boolean;
4
4
  content?: VNodeChild;
5
+ rawValue?: string;
5
6
  ellipsis?: boolean | {
6
7
  rows?: number;
7
8
  tooltip?: VNodeChild;
@@ -1,7 +1,7 @@
1
- import { defineComponent as x, ref as _, computed as B, createElementBlock as f, openBlock as i, mergeProps as E, unref as l, createElementVNode as O, createCommentVNode as N, normalizeClass as y, createVNode as v, createSlots as j, withCtx as m, createBlock as c, resolveDynamicComponent as b, h } from "vue";
1
+ import { defineComponent as x, ref as _, computed as B, createElementBlock as f, openBlock as i, mergeProps as E, unref as o, createElementVNode as O, createCommentVNode as N, normalizeClass as y, createVNode as b, createSlots as V, withCtx as m, createBlock as c, resolveDynamicComponent as v, h as w } from "vue";
2
2
  import "../../../config-provider/index.mjs";
3
- import { Tooltip as w } from "@aplus-frontend/antdv";
4
- import { CopyOutlined as S, CheckOutlined as V } from "@ant-design/icons-vue";
3
+ import { Tooltip as h } from "@aplus-frontend/antdv";
4
+ import { CopyOutlined as j, CheckOutlined as S } from "@ant-design/icons-vue";
5
5
  import { useNamespace as A } from "../../../config-provider/hooks/use-namespace.mjs";
6
6
  import { useLocale as P } from "../../../config-provider/hooks/use-locale.mjs";
7
7
  const G = /* @__PURE__ */ x({
@@ -10,32 +10,33 @@ const G = /* @__PURE__ */ x({
10
10
  props: {
11
11
  copyable: { type: Boolean },
12
12
  content: { type: [Object, String, Number, Boolean, null, Array] },
13
+ rawValue: {},
13
14
  ellipsis: { type: [Boolean, Object] }
14
15
  },
15
16
  setup(C) {
16
- const { b: u } = A("ap-table-paragraph-ellipsis"), { t: d } = P(), o = C, p = _(!1), r = B(() => o.ellipsis === !0 ? {
17
+ const { b: u } = A("ap-table-paragraph-ellipsis"), { t: d } = P(), l = C, n = _(!1), p = B(() => l.ellipsis === !0 ? {
17
18
  rows: 1,
18
- tooltip: o.content,
19
+ tooltip: l.content,
19
20
  htmlTitle: ""
20
- } : typeof o.ellipsis == "object" ? Object.assign(
21
+ } : typeof l.ellipsis == "object" ? Object.assign(
21
22
  {
22
23
  rows: 1,
23
- tooltip: o.content,
24
+ tooltip: l.content,
24
25
  htmlTitle: ""
25
26
  },
26
- o.ellipsis
27
+ l.ellipsis
27
28
  ) : {});
28
29
  function T() {
29
30
  return (window.top !== window ? window.top : window) ?? window;
30
31
  }
31
- function g(n) {
32
- var a;
32
+ function g(a) {
33
+ var r;
33
34
  const e = T();
34
- if ((a = e == null ? void 0 : e.navigator) != null && a.clipboard)
35
- e.navigator.clipboard.writeText(n);
35
+ if ((r = e == null ? void 0 : e.navigator) != null && r.clipboard)
36
+ e.navigator.clipboard.writeText(a);
36
37
  else if (e.document) {
37
38
  const t = e.document.createElement("textarea");
38
- t.value = n, t.style.position = "fixed", t.style.top = "-1000px", e.document.body.appendChild(t), t.focus(), t.select();
39
+ t.value = a, t.style.position = "fixed", t.style.top = "-1000px", e.document.body.appendChild(t), t.focus(), t.select();
39
40
  try {
40
41
  e.document.execCommand("copy");
41
42
  } catch (s) {
@@ -45,56 +46,55 @@ const G = /* @__PURE__ */ x({
45
46
  }
46
47
  }
47
48
  function k() {
48
- var e, a, t;
49
- const n = ((e = r.value) == null ? void 0 : e.tooltip) ?? ((t = (a = o.content) == null ? void 0 : a.props) == null ? void 0 : t.value) ?? o.content;
50
- g(n), p.value || (p.value = !0, setTimeout(() => {
51
- p.value = !1;
49
+ const a = l.rawValue || "";
50
+ g(a), n.value || (n.value = !0, setTimeout(() => {
51
+ n.value = !1;
52
52
  }, 2200));
53
53
  }
54
- return (n, e) => {
55
- var a, t;
54
+ return (a, e) => {
55
+ var r, t;
56
56
  return i(), f("div", E({
57
- class: [l(u)()]
57
+ class: [o(u)()]
58
58
  }, {
59
- ...n.$attrs
59
+ ...a.$attrs
60
60
  }, {
61
61
  style: {
62
- "--ap-table-paragraph-ellipsis-rows": (a = r.value) == null ? void 0 : a.rows
62
+ "--ap-table-paragraph-ellipsis-rows": (r = p.value) == null ? void 0 : r.rows
63
63
  }
64
64
  }), [
65
65
  O("div", {
66
- class: y([l(u)("content")])
66
+ class: y([o(u)("content")])
67
67
  }, [
68
- v(l(w), null, j({
68
+ b(o(h), null, V({
69
69
  default: m(() => {
70
70
  var s;
71
71
  return [
72
- (i(), c(b(
73
- h("span", { title: (s = r.value) == null ? void 0 : s.htmlTitle }, [o.content])
72
+ (i(), c(v(
73
+ w("span", { title: (s = p.value) == null ? void 0 : s.htmlTitle }, [l.content])
74
74
  )))
75
75
  ];
76
76
  }),
77
77
  _: 2
78
78
  }, [
79
- (t = r.value) != null && t.tooltip ? {
79
+ (t = p.value) != null && t.tooltip ? {
80
80
  name: "title",
81
81
  fn: m(() => [
82
- (i(), c(b(h("div", [r.value.tooltip]))))
82
+ (i(), c(v(w("div", [p.value.tooltip]))))
83
83
  ]),
84
84
  key: "0"
85
85
  } : void 0
86
86
  ]), 1024)
87
87
  ], 2),
88
- o.copyable ? (i(), f("div", {
88
+ l.copyable ? (i(), f("div", {
89
89
  key: 0,
90
- class: y([l(u)("copyable")]),
90
+ class: y([o(u)("copyable")]),
91
91
  onClick: k
92
92
  }, [
93
- v(l(w), {
94
- title: p.value ? l(d)("ap.apTable.paragraphEllipsis.copySuccess") : l(d)("ap.apTable.paragraphEllipsis.copy")
93
+ b(o(h), {
94
+ title: n.value ? o(d)("ap.apTable.paragraphEllipsis.copySuccess") : o(d)("ap.apTable.paragraphEllipsis.copy")
95
95
  }, {
96
96
  default: m(() => [
97
- p.value ? (i(), c(l(V), { key: 1 })) : (i(), c(l(S), { key: 0 }))
97
+ n.value ? (i(), c(o(S), { key: 1 })) : (i(), c(o(j), { key: 0 }))
98
98
  ]),
99
99
  _: 1
100
100
  }, 8, ["title"])
@@ -1,2 +1,3 @@
1
1
  export * from './usePageListApTable';
2
2
  export * from './useTableRefresh';
3
+ export * from './usePageListApGrid';
@@ -1,6 +1,8 @@
1
1
  import { usePageListApTable as o } from "./usePageListApTable.mjs";
2
- import { useTableRefresh as a } from "./useTableRefresh.mjs";
2
+ import { useTableRefresh as p } from "./useTableRefresh.mjs";
3
+ import { usePageListApGrid as a } from "./usePageListApGrid.mjs";
3
4
  export {
5
+ a as usePageListApGrid,
4
6
  o as usePageListApTable,
5
- a as useTableRefresh
7
+ p as useTableRefresh
6
8
  };
@@ -0,0 +1,34 @@
1
+ import { UseTableRefreshOption } from '..';
2
+ import { ApGridExpose, ApGridProps } from '../../ap-grid';
3
+ export interface UsePageListApGrid extends ApGridProps {
4
+ /** 是否显示默认的行选择配置
5
+ * @default true
6
+ */
7
+ isShowRowSelection?: boolean;
8
+ /** 转化ApGrid查询参数 */
9
+ transformSearchFormValues?: (values: any) => any;
10
+ /** ApGrid数据接口 */
11
+ api?(record: any): Promise<any>;
12
+ /** 发起请求的时候情况行选中
13
+ * @default true
14
+ */
15
+ clearSelectionOnRequest?: boolean;
16
+ /** 用于覆盖默认的class */
17
+ class?: string;
18
+ /**
19
+ * 表格刷新相关
20
+ */
21
+ tableRefresh?: boolean | Omit<UseTableRefreshOption, 'apTableRef'>;
22
+ }
23
+ /**
24
+ * 集成了列表页面的ApGrid的默认配置
25
+ * 表格分页器吸底效果,表格可拖动,表格行选择等
26
+ */
27
+ export declare function usePageListApGrid(props?: UsePageListApGrid): [ApGridProps, {
28
+ reload: () => void;
29
+ reset: () => void;
30
+ getSearchFormValues: (transform?: boolean) => any;
31
+ getApGridInstance: () => ApGridExpose | undefined;
32
+ getSearchFormValuesAndSorted: (transform?: boolean) => any;
33
+ clearSelection: () => void;
34
+ }];
@@ -0,0 +1,90 @@
1
+ import "../../config-provider/index.mjs";
2
+ import "../index.mjs";
3
+ import { merge as h, cloneDeep as S } from "lodash-unified";
4
+ import { ref as g } from "vue";
5
+ import { useGlobalConfig as v } from "../../config-provider/hooks/use-global-config.mjs";
6
+ import { useTableRefresh as b } from "./useTableRefresh.mjs";
7
+ function k(s) {
8
+ const o = g(null), {
9
+ isShowRowSelection: c = !0,
10
+ clearSelectionOnRequest: i = !0,
11
+ transformSearchFormValues: a,
12
+ api: l,
13
+ tableRefresh: f = !1,
14
+ ...d
15
+ } = s || {};
16
+ let n = null;
17
+ const m = v("uiMode", "aplus"), u = () => {
18
+ var e, r;
19
+ (r = (e = o.value) == null ? void 0 : e.rowSelection) == null || r.clearAll();
20
+ };
21
+ return b({
22
+ ...R(f),
23
+ apTableRef: o
24
+ }), [h(
25
+ {
26
+ // scroll,tableLayout,columnResizable设置表格可拖动
27
+ scroll: { x: "100%", y: "100%" },
28
+ columnResizable: !0,
29
+ // 表格分页器吸底效果
30
+ sticky: !0,
31
+ request: l ? async (e) => {
32
+ n = e.sort;
33
+ const r = a ? a(e) : e;
34
+ try {
35
+ if (!l) throw new Error("api is not defined");
36
+ const { records: t, total: p } = await l(r);
37
+ return i && u(), {
38
+ data: t,
39
+ total: p
40
+ };
41
+ } catch (t) {
42
+ return console.error(t), {
43
+ data: [],
44
+ total: 0
45
+ };
46
+ }
47
+ } : void 0,
48
+ rowSelection: c ? {
49
+ fixed: "left",
50
+ columnWidth: 50
51
+ } : void 0,
52
+ ref(e) {
53
+ o.value = e;
54
+ },
55
+ // 新UI规范,需要都添加分割线
56
+ card: !0,
57
+ bordered: m.value === "admin"
58
+ },
59
+ d
60
+ ), {
61
+ reload: () => {
62
+ var e;
63
+ (e = o.value) == null || e.submit();
64
+ },
65
+ reset: () => {
66
+ var e;
67
+ (e = o.value) == null || e.reset();
68
+ },
69
+ getSearchFormValues: (e = !0) => {
70
+ var t;
71
+ const r = ((t = o.value) == null ? void 0 : t.getSearchFormValues(!!e)) || {};
72
+ return a ? a(r) : r;
73
+ },
74
+ getApGridInstance: () => o.value,
75
+ getSearchFormValuesAndSorted: (e = !0) => {
76
+ var t;
77
+ const r = ((t = o.value) == null ? void 0 : t.getSearchFormValues(!!e)) || {};
78
+ return r.sort = n && S(n), a ? a(r) : r;
79
+ },
80
+ clearSelection: u
81
+ }];
82
+ }
83
+ function R(s) {
84
+ return s === !0 ? {} : s === !1 ? {
85
+ refreshBefore: () => !1
86
+ } : s;
87
+ }
88
+ export {
89
+ k as usePageListApGrid
90
+ };