@aplus-frontend/ui 0.3.9 → 0.3.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.
@@ -1,13 +1,12 @@
1
- import { defineComponent as H, ref as J, unref as t, computed as c, watch as Q, openBlock as i, createBlock as S, normalizeClass as u, withCtx as f, createElementVNode as X, normalizeStyle as v, renderSlot as l, createVNode as h, createElementBlock as p, Fragment as I, renderList as Y, mergeProps as Z, createCommentVNode as _ } from "vue";
1
+ import { defineComponent as H, ref as J, unref as t, computed as d, watch as Q, openBlock as i, createBlock as S, normalizeClass as u, withCtx as f, createElementVNode as X, normalizeStyle as h, renderSlot as l, createVNode as v, createElementBlock as p, Fragment as I, renderList as Y, mergeProps as Z, createCommentVNode as _ } from "vue";
2
2
  import { Empty as E, Spin as x, Pagination as ee } from "@aplus-frontend/antdv";
3
- import "../ap-table/index.mjs";
3
+ import { useTablePaging as te } from "../ap-table/hooks/use-table-paging-ng.mjs";
4
4
  import "../config-provider/index.mjs";
5
- import { isUndefined as O, isNumber as te, omit as ae } from "lodash-unified";
6
- import { useOfflineList as ne } from "./hooks/use-offline-list.mjs";
5
+ import { isUndefined as O, isNumber as ae, omit as ne } from "lodash-unified";
6
+ import { useOfflineList as re } from "./hooks/use-offline-list.mjs";
7
7
  import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
8
- import { RecycleScroller as re, DynamicScroller as oe, DynamicScrollerItem as ie } from "vue-virtual-scroller";
9
- import { useNamespace as le } from "../config-provider/hooks/use-namespace.mjs";
10
- import { useTablePaging as se } from "../ap-table/hooks/use-table-paging.mjs";
8
+ import { RecycleScroller as oe, DynamicScroller as ie, DynamicScrollerItem as le } from "vue-virtual-scroller";
9
+ import { useNamespace as se } from "../config-provider/hooks/use-namespace.mjs";
11
10
  const he = /* @__PURE__ */ H({
12
11
  __name: "index",
13
12
  props: {
@@ -28,16 +27,16 @@ const he = /* @__PURE__ */ H({
28
27
  rowKey: {}
29
28
  },
30
29
  setup(V, { expose: F }) {
31
- const L = E.PRESENTED_IMAGE_SIMPLE, n = V, { b: d, e: N } = le("ap-list"), b = J(), {
30
+ const L = E.PRESENTED_IMAGE_SIMPLE, n = V, { b: m, e: N } = se("ap-list"), b = J(), {
32
31
  formRef: k,
33
- submit: z,
34
- reset: C,
32
+ submit: D,
33
+ reset: w,
35
34
  handleTableChange: R,
36
35
  data: g,
37
36
  refresh: T,
38
37
  refreshByDelete: $,
39
- tableProps: P
40
- } = se({
38
+ tableProps: z
39
+ } = te({
41
40
  async request(e) {
42
41
  var r;
43
42
  const a = await ((r = n.request) == null ? void 0 : r.call(n, e));
@@ -49,16 +48,15 @@ const he = /* @__PURE__ */ H({
49
48
  defaultParams: n.params,
50
49
  defaultData: n.defaultData,
51
50
  manual: n.manual,
52
- defaultCurrent: n.pagination ? n.pagination.defaultCurrent : void 0,
53
- defaultPageSize: n.pagination ? n.pagination.defaultPageSize : void 0,
51
+ pagination: n.pagination,
54
52
  formatParams: n.beforeSearchSubmit
55
53
  }), j = { form: k }, {
56
- pagination: D,
54
+ pagination: B,
57
55
  dataSource: q,
58
56
  onChange: A
59
- } = ne(n);
57
+ } = re(n);
60
58
  function K(e, a) {
61
- if (t(m)) {
59
+ if (t(c)) {
62
60
  A(e, a);
63
61
  return;
64
62
  }
@@ -69,10 +67,10 @@ const he = /* @__PURE__ */ H({
69
67
  { currentDataSource: [], action: "paginate" }
70
68
  );
71
69
  }
72
- const s = c(() => t(m) ? t(q) : t(g).records), y = c(() => O(n.loading) ? t(g).loading : n.loading), M = c(() => {
70
+ const s = d(() => t(c) ? t(q) : t(g).records), y = d(() => O(n.loading) ? t(g).loading : n.loading), M = d(() => {
73
71
  var e, a;
74
- return n.pagination === !1 || n.virtual ? !1 : ((e = n.pagination) == null ? void 0 : e.hideOnSinglePage) !== !0 ? !0 : t(m) ? (((a = n.dataSource) == null ? void 0 : a.length) || 0) > t(D).pageSize : t(g).total > t(P).pagination.pageSize;
75
- }), m = c(() => !O(n.dataSource));
72
+ return n.pagination === !1 || n.virtual ? !1 : ((e = n.pagination) == null ? void 0 : e.hideOnSinglePage) !== !0 ? !0 : t(c) ? (((a = n.dataSource) == null ? void 0 : a.length) || 0) > t(B).pageSize : t(g).total > t(z).pagination.pageSize;
73
+ }), c = d(() => !O(n.dataSource));
76
74
  Q(
77
75
  () => t(y),
78
76
  (e) => {
@@ -90,41 +88,41 @@ const he = /* @__PURE__ */ H({
90
88
  return (r == null ? void 0 : r()) || {};
91
89
  }
92
90
  return F({
93
- submit: () => z(),
94
- reset: () => C(),
91
+ submit: () => D(),
92
+ reset: () => w(),
95
93
  refresh: () => T(),
96
94
  refreshByDelete: (e) => $(e),
97
95
  scrollToFirstRow: W,
98
96
  getSearchFormValuesIfSetted: G
99
97
  }), (e, a) => (i(), S(t(x), {
100
98
  spinning: y.value,
101
- class: u(t(d)("spin"))
99
+ class: u(t(m)("spin"))
102
100
  }, {
103
101
  default: f(() => [
104
102
  X("div", {
105
- class: u(t(d)()),
106
- style: v(e.containerStyle)
103
+ class: u(t(m)()),
104
+ style: h(e.containerStyle)
107
105
  }, [
108
106
  l(e.$slots, "header", {
109
107
  formIns: j,
110
- submit: t(z),
111
- reset: t(C)
108
+ submit: t(D),
109
+ reset: t(w)
112
110
  }),
113
111
  s.value.length === 0 ? l(e.$slots, "empty", {
114
112
  key: 0,
115
113
  loading: y.value
116
114
  }, () => [
117
- h(t(E), { image: t(L) }, null, 8, ["image"])
115
+ v(t(E), { image: t(L) }, null, 8, ["image"])
118
116
  ]) : (i(), p("div", {
119
117
  key: 1,
120
118
  ref_key: "contentRef",
121
119
  ref: b,
122
- style: v(e.contentStyle)
120
+ style: h(e.contentStyle)
123
121
  }, [
124
122
  e.virtual ? (i(), p(I, { key: 0 }, [
125
- t(te)(e.virtual) ? (i(), S(t(re), {
123
+ t(ae)(e.virtual) ? (i(), S(t(oe), {
126
124
  key: 0,
127
- class: u(t(d)("scroll-wrapper")),
125
+ class: u(t(m)("scroll-wrapper")),
128
126
  items: s.value,
129
127
  "item-size": e.virtual,
130
128
  "key-field": n.rowKey || "id"
@@ -136,20 +134,20 @@ const he = /* @__PURE__ */ H({
136
134
  })
137
135
  ]),
138
136
  _: 3
139
- }, 8, ["class", "items", "item-size", "key-field"])) : (i(), S(t(oe), {
137
+ }, 8, ["class", "items", "item-size", "key-field"])) : (i(), S(t(ie), {
140
138
  key: 1,
141
139
  items: s.value,
142
140
  "min-item-size": e.virtual.minItemSize,
143
- class: u(t(d)("scroll-wrapper"))
141
+ class: u(t(m)("scroll-wrapper"))
144
142
  }, {
145
143
  default: f(({ item: r, index: o, active: U }) => {
146
- var w, B;
144
+ var C, P;
147
145
  return [
148
- h(t(ie), {
146
+ v(t(le), {
149
147
  item: r,
150
148
  active: U,
151
149
  "data-index": o,
152
- "size-dependencies": (B = (w = e.virtual).sizeDependencies) == null ? void 0 : B.call(w, r)
150
+ "size-dependencies": (P = (C = e.virtual).sizeDependencies) == null ? void 0 : P.call(C, r)
153
151
  }, {
154
152
  default: f(() => [
155
153
  l(e.$slots, "renderItem", {
@@ -176,10 +174,10 @@ const he = /* @__PURE__ */ H({
176
174
  M.value ? (i(), p("div", {
177
175
  key: 2,
178
176
  class: u(t(N)("footer")),
179
- style: v(e.footerWarpperStyle)
177
+ style: h(e.footerWarpperStyle)
180
178
  }, [
181
- h(t(ee), Z(
182
- m.value ? t(D) : t(ae)(t(P).pagination, ["showTotal"]),
179
+ v(t(ee), Z(
180
+ c.value ? t(B) : t(ne)(t(z).pagination, ["showTotal"]),
183
181
  { onChange: K }
184
182
  ), null, 16)
185
183
  ], 6)) : _("", !0)
@@ -1,4 +1,4 @@
1
- import { StyleValue } from 'vue';
1
+ import { Ref, StyleValue } from 'vue';
2
2
  import { RequestData } from '../ap-table';
3
3
  import { Recordable } from '../type';
4
4
  export type ApListProps<RecordType = any, ParamsType = Recordable> = {
@@ -16,9 +16,9 @@ export type ApListProps<RecordType = any, ParamsType = Recordable> = {
16
16
  */
17
17
  onItem?: (record: RecordType, index: number) => void;
18
18
  /**
19
- * 依赖的额外的参数(该参数变更不会触发网络请求)
19
+ * 依赖的额外的参数,传入响应式参数会在变更后重新执行
20
20
  */
21
- params?: ParamsType;
21
+ params?: ParamsType | Ref<ParamsType>;
22
22
  /**
23
23
  * 请求数据
24
24
  * @param params
@@ -1,12 +1,12 @@
1
- import { defineComponent as Te, useSlots as Fe, ref as P, computed as s, unref as l, createVNode as y, Fragment as q, watchEffect as xe, watch as G, openBlock as p, createElementBlock as T, normalizeClass as f, normalizeStyle as M, mergeProps as w, createSlots as _, withCtx as F, renderList as J, createBlock as Q, resolveDynamicComponent as Be, renderSlot as h, createCommentVNode as X, createElementVNode as I, normalizeProps as ke, guardReactiveProps as ze } from "vue";
1
+ import { defineComponent as Te, useSlots as Fe, ref as P, computed as s, unref as l, createVNode as g, Fragment as q, watchEffect as xe, watch as G, openBlock as p, createElementBlock as T, normalizeClass as f, normalizeStyle as M, mergeProps as w, createSlots as _, withCtx as F, renderList as J, createBlock as Q, resolveDynamicComponent as Be, renderSlot as b, createCommentVNode as X, createElementVNode as I, normalizeProps as ke, guardReactiveProps as ze } from "vue";
2
2
  import { Divider as Pe, Table as Ie } from "@aplus-frontend/antdv";
3
3
  import { useToken as Ne } from "@aplus-frontend/antdv/es/theme/internal";
4
4
  import { ApForm as Ee } from "../ap-form/index.mjs";
5
5
  import { noRenderAsFormItemValueList as Y } from "./constants.mjs";
6
6
  import "../config-provider/index.mjs";
7
- import { useTablePaging as Ke } from "./hooks/use-table-paging.mjs";
8
- import { isUndefined as m, omit as Z, isBoolean as Le } from "lodash-unified";
9
- import { getColumnOrder as ee, updateFormProps as Oe, getFieldProps as Ve, getSearchFormItemRenderNode as Ae, recursionApColumns as ae, apColumnToColumn as De, getTableTitle as je, getTableRenderType as $e, getTableRenderProps as We, getTableCellRenderNode as He, falseToUndefined as Ue } from "./utils.mjs";
7
+ import { useTablePaging as Ke } from "./hooks/use-table-paging-ng.mjs";
8
+ import { isUndefined as m, omit as Z, isBoolean as Oe } from "lodash-unified";
9
+ import { getColumnOrder as ee, updateFormProps as Le, getFieldProps as Ve, getSearchFormItemRenderNode as Ae, recursionApColumns as ae, apColumnToColumn as De, getTableTitle as je, getTableRenderType as $e, getTableRenderProps as We, getTableCellRenderNode as He, falseToUndefined as Ue } from "./utils.mjs";
10
10
  import qe from "./hooks/use-table-content-height.mjs";
11
11
  import Ge from "./hooks/use-table-row-selection.mjs";
12
12
  import { isDef as Me } from "../utils/index.mjs";
@@ -17,7 +17,7 @@ import { useNamespace as Je } from "../config-provider/hooks/use-namespace.mjs";
17
17
  import { useGlobalConfig as Qe } from "../config-provider/hooks/use-global-config.mjs";
18
18
  import Xe from "./components/paragraph-ellipsis/index.vue2.mjs";
19
19
  import Ye from "./components/setting/modal/index.vue2.mjs";
20
- const ha = /* @__PURE__ */ Te({
20
+ const ba = /* @__PURE__ */ Te({
21
21
  name: "ApTable",
22
22
  __name: "ap-table",
23
23
  props: {
@@ -146,17 +146,17 @@ const ha = /* @__PURE__ */ Te({
146
146
  }) {
147
147
  const a = oe;
148
148
  let N = 0;
149
- const S = Fe(), [, re] = Ne(), {
149
+ const h = Fe(), [, re] = Ne(), {
150
150
  e: x,
151
151
  b: i,
152
152
  be: E
153
153
  } = Je("ap-table"), K = Qe("valueTypeMap"), {
154
154
  height: le,
155
155
  contentRef: ne
156
- } = qe(), B = P(a.size), u = P([]), L = P([]);
156
+ } = qe(), B = P(a.size), u = P([]), O = P([]);
157
157
  _e({
158
158
  columns: s(() => u.value),
159
- columnsBackup: s(() => L.value),
159
+ columnsBackup: s(() => O.value),
160
160
  size: s(() => B.value),
161
161
  updateColumns(e) {
162
162
  u.value = e;
@@ -165,13 +165,13 @@ const ha = /* @__PURE__ */ Te({
165
165
  B.value = e;
166
166
  }
167
167
  });
168
- const O = s(() => {
168
+ const L = s(() => {
169
169
  var e, t, o;
170
170
  return N++, ((o = (t = (e = a.columns) == null ? void 0 : e.filter((r) => !r.hideInSearch && r.dataIndex && (r.valueType || r.customRenderFormItem) && !Y.includes(r.valueType))) == null ? void 0 : t.sort((r, d) => {
171
171
  let n = ee(r.order);
172
172
  return ee(d.order) - n;
173
173
  })) == null ? void 0 : o.map((r) => {
174
- const d = Oe(r, Ve(r.fieldProps, {})), n = {
174
+ const d = Le(r, Ve(r.fieldProps, {})), n = {
175
175
  ...r,
176
176
  fieldProps: {
177
177
  label: r.title,
@@ -189,10 +189,10 @@ const ha = /* @__PURE__ */ Te({
189
189
  }).filter(Boolean)), de = s(() => ae(l(u), (e) => {
190
190
  if (e.filters && !e.onFilter)
191
191
  return e.key || e.dataIndex;
192
- }).filter(Boolean)), ue = s(() => m(a.dataSource) ? v.value.records : a.dataSource), {
193
- rowSelection: b,
194
- selectedRows: C,
195
- ...R
192
+ }).filter(Boolean)), ue = s(() => m(a.dataSource) ? v.records : a.dataSource), {
193
+ rowSelection: S,
194
+ selectedRows: R,
195
+ ...C
196
196
  } = Ge({
197
197
  fixed: !0,
198
198
  ...a.rowSelection === !0 ? {} : a.rowSelection,
@@ -210,7 +210,7 @@ const ha = /* @__PURE__ */ Te({
210
210
  } = Ke({
211
211
  async request(e) {
212
212
  var o, r;
213
- if (!b.value.preserveSelectedRowKeys && m(a.dataSource) && R.clearAll(), !m(a.dataSource))
213
+ if (!S.value.preserveSelectedRowKeys && m(a.dataSource) && C.clearAll(), !m(a.dataSource))
214
214
  return {
215
215
  data: a.dataSource || [],
216
216
  total: a.dataSource.length || 0
@@ -226,12 +226,8 @@ const ha = /* @__PURE__ */ Te({
226
226
  defaultParams: a.params,
227
227
  defaultData: a.defaultData,
228
228
  manual: a.manual,
229
- defaultCurrent: a.pagination ? a.pagination.defaultCurrent : void 0,
230
- defaultPageSize: a.pagination ? a.pagination.defaultPageSize : void 0,
231
229
  formatParams: a.beforeSearchSubmit,
232
- showLessItems: a.pagination ? a.pagination.showLessItems : void 0,
233
- showTotal: a.pagination ? a.pagination.showTotal : void 0,
234
- pagination: a.pagination !== !1
230
+ pagination: a.pagination
235
231
  }), fe = () => {
236
232
  var o;
237
233
  let e = ((o = a.columns) == null ? void 0 : o.filter((r) => !r.hideInTable)) || [];
@@ -241,29 +237,29 @@ const ha = /* @__PURE__ */ Te({
241
237
  ...Z(De(n), ["ellipsis"]),
242
238
  ...pe(n),
243
239
  fixed: d ? d.fixed : n.fixed,
244
- title: je(n, E("table-header", "title"), S.headerCell, l(re).colorPrimary),
240
+ title: je(n, E("table-header", "title"), h.headerCell, l(re).colorPrimary),
245
241
  customRender({
246
242
  value: c,
247
- ...g
243
+ ...y
248
244
  }) {
249
245
  var H, U;
250
- const $ = $e(n), Ce = We({
246
+ const $ = $e(n), Re = We({
251
247
  ...n,
252
248
  valueType: $
253
249
  }, {
254
250
  value: c,
255
- ...g
256
- }), Re = He($, Ce, g.record, l(K)), W = ((H = n.renderText) == null ? void 0 : H.call(n, {
251
+ ...y
252
+ }), Ce = He($, Re, y.record, l(K)), W = ((H = n.renderText) == null ? void 0 : H.call(n, {
257
253
  value: c,
258
- ...g
259
- })) || c, ve = n.renderText ? y(q, null, [(U = n.renderText) == null ? void 0 : U.call(n, {
254
+ ...y
255
+ })) || c, ve = n.renderText ? g(q, null, [(U = n.renderText) == null ? void 0 : U.call(n, {
260
256
  value: c,
261
- ...g
262
- })]) : Re;
257
+ ...y
258
+ })]) : Ce;
263
259
  let z = we(n, W, ve);
264
260
  return n.customRender && (z = n.customRender({
265
261
  value: c,
266
- ...g,
262
+ ...y,
267
263
  column: n,
268
264
  originalNode: z,
269
265
  originalText: W
@@ -276,18 +272,18 @@ const ha = /* @__PURE__ */ Te({
276
272
  };
277
273
  xe(() => {
278
274
  const e = fe();
279
- u.value = e, L.value = e;
275
+ u.value = e, O.value = e;
280
276
  });
281
277
  const me = s(() => {
282
278
  var t, o;
283
- if (a.adaptive && (v.value.total > 0 || ((t = a.dataSource) == null ? void 0 : t.length)))
279
+ if (a.adaptive && (v.total > 0 || ((t = a.dataSource) == null ? void 0 : t.length)))
284
280
  return {
285
281
  y: l(le),
286
282
  x: ((o = a.scroll) == null ? void 0 : o.x) || "100%"
287
283
  };
288
284
  if (a.scroll)
289
285
  return a.scroll;
290
- }), ge = s(() => {
286
+ }), ye = s(() => {
291
287
  var e;
292
288
  if (a.tableLayout)
293
289
  return a.tableLayout;
@@ -295,7 +291,7 @@ const ha = /* @__PURE__ */ Te({
295
291
  return "fixed";
296
292
  }), j = s(() => {
297
293
  var o;
298
- const e = l(D), t = l(b);
294
+ const e = l(D), t = l(S);
299
295
  return {
300
296
  ...a,
301
297
  ...e,
@@ -308,11 +304,11 @@ const ha = /* @__PURE__ */ Te({
308
304
  pagination: a.pagination === !1 ? !1 : e.pagination,
309
305
  scroll: l(me)
310
306
  };
311
- }), ye = s(() => [i(), a.card ? null : i("wrapper"), a.adaptive ? i("adaptive") : null].filter(Boolean));
307
+ }), ge = s(() => [i(), a.card ? null : i("wrapper"), a.adaptive ? i("adaptive") : null].filter(Boolean));
312
308
  function we(e, t, o) {
313
- return Y.includes(e.valueType) ? o : e.copyable || e.ellipsis ? y(Xe, {
309
+ return Y.includes(e.valueType) ? o : e.copyable || e.ellipsis ? g(Xe, {
314
310
  copyable: e.copyable,
315
- ellipsis: e.ellipsis ? Le(e.ellipsis) ? {
311
+ ellipsis: e.ellipsis ? Oe(e.ellipsis) ? {
316
312
  tooltip: o,
317
313
  rows: 1
318
314
  } : {
@@ -330,37 +326,37 @@ const ha = /* @__PURE__ */ Te({
330
326
  }, {
331
327
  immediate: !0
332
328
  });
333
- function he(e) {
329
+ function be(e) {
334
330
  var t, o, r;
335
331
  (r = (o = (t = k.value) == null ? void 0 : t.apForm) == null ? void 0 : o.setFieldsValue) == null || r.call(o, e);
336
332
  }
337
- function Se(e = !1) {
333
+ function he(e = !1) {
338
334
  var o, r, d;
339
335
  const t = e ? "getFieldsValueTransformed" : "getFieldsValue";
340
336
  return (d = (r = (o = k.value) == null ? void 0 : o.apForm) == null ? void 0 : r[t]) == null ? void 0 : d.call(r, !0);
341
337
  }
342
- function be() {
338
+ function Se() {
343
339
  return l(u);
344
340
  }
345
341
  return te({
346
342
  submit: () => V(),
347
343
  reset: () => A(),
348
344
  refresh: () => ie(),
349
- setSearchFormValues: he,
350
- getSearchFormValues: Se,
351
- getShownColumns: be,
345
+ setSearchFormValues: be,
346
+ getSearchFormValues: he,
347
+ getShownColumns: Se,
352
348
  dataSource: s(() => l(v).records),
353
349
  rowSelection: {
354
- selectedRows: s(() => l(C)),
355
- ...R
350
+ selectedRows: s(() => l(R)),
351
+ ...C
356
352
  }
357
353
  }), (e, t) => (p(), T("div", {
358
- class: f(ye.value)
359
- }, [l(m)(e.dataSource) && e.searchForm !== !1 && O.value.length > 0 ? (p(), T("div", {
354
+ class: f(ge.value)
355
+ }, [l(m)(e.dataSource) && e.searchForm !== !1 && L.value.length > 0 ? (p(), T("div", {
360
356
  key: 0,
361
357
  class: f(e.card ? l(x)("search-wrapper") : null),
362
358
  style: M(e.searchFormWrapperStyle)
363
- }, [y(l(Ee).SearchForm, w(e.searchForm || {}, {
359
+ }, [g(l(Ee).SearchForm, w(e.searchForm || {}, {
364
360
  ref_key: "formRef",
365
361
  ref: k,
366
362
  "custom-reset": "",
@@ -368,16 +364,16 @@ const ha = /* @__PURE__ */ Te({
368
364
  onSubmit: l(V),
369
365
  onReset: l(A)
370
366
  }), _({
371
- default: F(() => [(p(!0), T(q, null, J(O.value, (o) => (p(), Q(Be(o.renderNode), w({
367
+ default: F(() => [(p(!0), T(q, null, J(L.value, (o) => (p(), Q(Be(o.renderNode), w({
372
368
  key: o.dataIndex,
373
369
  ref_for: !0
374
370
  }, o.fieldProps || {}, {
375
371
  span: o.span
376
372
  }), null, 16, ["span"]))), 128))]),
377
373
  _: 2
378
- }, [S.searchFormExtra ? {
374
+ }, [h.searchFormExtra ? {
379
375
  name: "extra",
380
- fn: F(() => [h(e.$slots, "searchFormExtra")]),
376
+ fn: F(() => [b(e.$slots, "searchFormExtra")]),
381
377
  key: "0"
382
378
  } : void 0]), 1040, ["submit-loading", "onSubmit", "onReset"])], 6)) : X("", !0), I("div", {
383
379
  ref_key: "contentRef",
@@ -391,40 +387,40 @@ const ha = /* @__PURE__ */ Te({
391
387
  class: f(l(i)("header"))
392
388
  }, [I("div", {
393
389
  class: f(l(E)("header", "title"))
394
- }, [h(e.$slots, "title", w({
395
- selectedRows: l(C),
396
- selectedRowKeys: l(b).selectedRowKeys,
390
+ }, [b(e.$slots, "title", w({
391
+ selectedRows: l(R),
392
+ selectedRowKeys: l(S).selectedRowKeys,
397
393
  shownColumns: u.value
398
- }, R))], 2), S.title ? (p(), Q(l(Pe), {
394
+ }, C))], 2), h.title ? (p(), Q(l(Pe), {
399
395
  key: 0,
400
396
  type: "vertical"
401
- })) : X("", !0), y(Ye, {
397
+ })) : X("", !0), g(Ye, {
402
398
  config: e.settings === !0 ? {} : e.settings
403
- }, null, 8, ["config"])], 2)) : h(e.$slots, "title", w({
399
+ }, null, 8, ["config"])], 2)) : b(e.$slots, "title", w({
404
400
  key: 1,
405
- selectedRows: l(C),
406
- selectedRowKeys: l(b).selectedRowKeys,
401
+ selectedRows: l(R),
402
+ selectedRowKeys: l(S).selectedRowKeys,
407
403
  shownColumns: u.value
408
- }, R))], 2), y(l(Ie), w({
404
+ }, C))], 2), g(l(Ie), w({
409
405
  class: l(i)("table")
410
406
  }, j.value, {
411
407
  size: B.value,
412
- "table-layout": ge.value,
408
+ "table-layout": ye.value,
413
409
  columns: u.value,
414
410
  onResizeColumn: t[0] || (t[0] = (o, r) => r.width = o)
415
411
  }), _({
416
- summary: F(() => [h(e.$slots, "summary", {
412
+ summary: F(() => [b(e.$slots, "summary", {
417
413
  columns: u.value,
418
414
  records: j.value.dataSource,
419
- selectedRows: l(C)
415
+ selectedRows: l(R)
420
416
  })]),
421
417
  _: 2
422
- }, [J(l(Z)(S, ["title", "searchFormExtra", "headerCell", "summary"]), (o, r) => ({
418
+ }, [J(l(Z)(h, ["title", "searchFormExtra", "headerCell", "summary"]), (o, r) => ({
423
419
  name: r,
424
- fn: F((d) => [h(e.$slots, r, ke(ze(d || {})))])
420
+ fn: F((d) => [b(e.$slots, r, ke(ze(d || {})))])
425
421
  }))]), 1040, ["class", "size", "table-layout", "columns"])], 6)], 2));
426
422
  }
427
423
  });
428
424
  export {
429
- ha as default
425
+ ba as default
430
426
  };
@@ -0,0 +1,87 @@
1
+ import { DataIndex } from '@aplus-frontend/antdv/es/vc-table/interface';
2
+ import { Ref, ComputedRef } from 'vue';
3
+ import { ApTablePaginationConfig, RequestData } from '../interface';
4
+ import { Recordable } from '../../type';
5
+ import { ApFormSearchFormExpose } from '../../ap-form';
6
+ import { TablePaginationConfig } from '@aplus-frontend/antdv';
7
+ import { FilterValue, SorterResult, TableCurrentDataSource } from '@aplus-frontend/antdv/es/table/interface';
8
+ import { ApColumnType } from '..';
9
+ export type UseTablePagingParams<DataType, ParamsType> = {
10
+ request: (params: any) => Promise<RequestData<DataType>>;
11
+ /**
12
+ * 是否手动执行,页面初始化后不执行网络请求,需要手动触发
13
+ * @param params
14
+ * @returns
15
+ */
16
+ manual?: boolean;
17
+ /**
18
+ * 额外的默认请求参数
19
+ * @description 如果传入响应式数据,将会在数据改变后重新请求
20
+ */
21
+ defaultParams?: ParamsType | Ref<ParamsType>;
22
+ /**
23
+ * 默认的数据源(只生效一次)
24
+ */
25
+ defaultData?: DataType[];
26
+ /**
27
+ * 数据请求前格式化请求参数
28
+ * @param values
29
+ * @returns
30
+ */
31
+ formatParams?: (values: any) => any;
32
+ /**
33
+ * 特殊类型参数类型对照表(会根据该对照表运行默认的参数格式化)
34
+ */
35
+ paramsValueTypeMap?: Record<string, any>;
36
+ /**
37
+ * 重设表单需要忽略的字段
38
+ */
39
+ resetFieldsIgnores?: string[];
40
+ /**
41
+ * 需要后端筛选的字段列表
42
+ */
43
+ filterFields?: Ref<DataIndex[]>;
44
+ /**
45
+ * 需要后端筛选的排序字段列表
46
+ */
47
+ sortFields?: Ref<DataIndex[]>;
48
+ /**
49
+ * 分页相关
50
+ */
51
+ pagination?: boolean | ApTablePaginationConfig;
52
+ };
53
+ type InternalDataType<DataType = Recordable> = {
54
+ total: number;
55
+ records: DataType[];
56
+ loading: boolean;
57
+ };
58
+ export declare const useTablePaging: <DataType = any, ParamsType = Record<string, any>>({ manual, request, defaultParams, defaultData, formatParams, paramsValueTypeMap, resetFieldsIgnores, filterFields, sortFields, pagination }: UseTablePagingParams<DataType, ParamsType>) => {
59
+ formRef: Ref<ApFormSearchFormExpose | undefined, ApFormSearchFormExpose | undefined>;
60
+ submit: () => void;
61
+ reset: () => void;
62
+ refresh: () => void;
63
+ refreshByDelete: (n: number) => void;
64
+ data: InternalDataType<DataType>;
65
+ current: number | undefined;
66
+ pageSize: number | undefined;
67
+ handleTableChange: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<any> | SorterResult<any>[], extra: TableCurrentDataSource<any>) => void;
68
+ tableProps: ComputedRef<{
69
+ loading: boolean;
70
+ pagination: {
71
+ current: number;
72
+ pageSize: number;
73
+ total: number;
74
+ showSizeChanger: boolean;
75
+ showQuickJumper: boolean;
76
+ showLessItems: boolean | undefined;
77
+ size: string;
78
+ showTotal: ((total: number) => import("vue/jsx-runtime").JSX.Element) | undefined;
79
+ };
80
+ onChange: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<any> | SorterResult<any>[], extra: TableCurrentDataSource<any>) => void;
81
+ dataSource: DataType[];
82
+ }>;
83
+ dataSource: ComputedRef<DataType[]>;
84
+ setDataSource: (dataSource?: DataType[]) => void;
85
+ getColumnSFConfig: (column: ApColumnType) => Recordable;
86
+ };
87
+ export {};