@aplus-frontend/ui 7.12.1 → 7.12.2

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,30 +1,30 @@
1
- import { defineComponent as $e, useSlots as je, ref as c, computed as n, unref as o, toRef as He, createVNode as p, Fragment as ae, watch as B, createElementBlock as k, openBlock as f, normalizeStyle as E, normalizeClass as m, createCommentVNode as le, createElementVNode as K, mergeProps as z, createSlots as ne, withCtx as w, renderList as se, createBlock as ue, resolveDynamicComponent as _e, renderSlot as v, normalizeProps as Ue, guardReactiveProps as qe } from "vue";
2
- import { Divider as Me, Table as Ge } from "@aplus-frontend/antdv";
3
- import { useToken as Je } from "@aplus-frontend/antdv/es/theme/internal";
4
- import { isUndefined as g, omit as de, isBoolean as Qe } from "lodash-unified";
1
+ import { defineComponent as je, useSlots as He, ref as c, computed as n, unref as o, toRef as _e, createVNode as p, Fragment as ae, watch as B, createElementBlock as k, openBlock as f, normalizeStyle as E, normalizeClass as m, createCommentVNode as le, createElementVNode as L, mergeProps as z, createSlots as ne, withCtx as w, renderList as se, createBlock as ue, resolveDynamicComponent as Ue, renderSlot as v, normalizeProps as qe, guardReactiveProps as Me } from "vue";
2
+ import { Divider as Ge, Table as Je } from "@aplus-frontend/antdv";
3
+ import { useToken as Qe } from "@aplus-frontend/antdv/es/theme/internal";
4
+ import { isUndefined as g, omit as de, isBoolean as Xe } from "lodash-unified";
5
5
  import "../scroll-bar/index.mjs";
6
- import { getValidVNodeList as Xe } from "../utils/slot.mjs";
7
- import { useDevWarning as Ye } from "../utils/warning.mjs";
8
- import { ApForm as Ze } from "../ap-form/index.mjs";
6
+ import { getValidVNodeList as Ye } from "../utils/slot.mjs";
7
+ import { useDevWarning as Ze } from "../utils/warning.mjs";
8
+ import { ApForm as er } from "../ap-form/index.mjs";
9
9
  import "../config-provider/index.mjs";
10
- import { getScrollbarSize as er } from "../utils/index.mjs";
10
+ import { getScrollbarSize as rr } from "../utils/index.mjs";
11
11
  import "./components/paragraph-ellipsis/index.vue.mjs";
12
12
  import "./components/setting/modal/index.vue.mjs";
13
13
  import { noRenderAsFormItemValueList as ie } from "./constants.mjs";
14
- import { useProvideApTable as rr } from "./context.mjs";
15
- import { useStickyScroll as or } from "./hooks/use-sticky-scroll.mjs";
16
- import tr from "./hooks/use-table-content-height.mjs";
17
- import { useTablePaging as ar } from "./hooks/use-table-paging-ng.mjs";
18
- import lr from "./hooks/use-table-row-selection.mjs";
19
- import nr from "./style/index.mjs";
20
- import { getColumnOrder as ce, updateFormProps as sr, getFieldProps as ur, getSearchFormItemRenderNode as dr, recursionApColumns as pe, getTableTitle as ir, getTableRenderType as cr, getTableRenderProps as pr, getTableCellRenderNode as fr, apColumnToColumn as mr, falseToUndefined as gr, objectToString as br } from "./utils.mjs";
21
- import { useNamespace as yr } from "../config-provider/hooks/use-namespace.mjs";
22
- import { useGlobalConfig as Sr } from "../config-provider/hooks/use-global-config.mjs";
14
+ import { useProvideApTable as or } from "./context.mjs";
15
+ import { useStickyScroll as tr } from "./hooks/use-sticky-scroll.mjs";
16
+ import ar from "./hooks/use-table-content-height.mjs";
17
+ import { useTablePaging as lr } from "./hooks/use-table-paging-ng.mjs";
18
+ import nr from "./hooks/use-table-row-selection.mjs";
19
+ import sr from "./style/index.mjs";
20
+ import { getColumnOrder as ce, updateFormProps as ur, getFieldProps as dr, getSearchFormItemRenderNode as ir, recursionApColumns as pe, getTableTitle as cr, getTableRenderType as pr, getTableRenderProps as fr, getTableCellRenderNode as mr, apColumnToColumn as gr, falseToUndefined as br, objectToString as yr } from "./utils.mjs";
21
+ import { useNamespace as Sr } from "../config-provider/hooks/use-namespace.mjs";
22
+ import { useGlobalConfig as hr } from "../config-provider/hooks/use-global-config.mjs";
23
23
  import { isDef as fe } from "../utils/is.mjs";
24
- import hr from "./components/paragraph-ellipsis/index.vue2.mjs";
25
- import wr from "./components/setting/modal/index.vue2.mjs";
26
- import vr from "../scroll-bar/index.vue.mjs";
27
- const Jr = /* @__PURE__ */ $e({
24
+ import wr from "./components/paragraph-ellipsis/index.vue2.mjs";
25
+ import vr from "./components/setting/modal/index.vue2.mjs";
26
+ import Rr from "../scroll-bar/index.vue.mjs";
27
+ const Qr = /* @__PURE__ */ je({
28
28
  name: "ApTable",
29
29
  __name: "ap-table",
30
30
  props: {
@@ -156,26 +156,26 @@ const Jr = /* @__PURE__ */ $e({
156
156
  expose: ge
157
157
  }) {
158
158
  const r = me;
159
- let L = 0;
160
- const b = je(), [, be] = Je();
161
- Ye("ApTable")(!1, "breaking", "ApTable has been EOL, Please use AgGrid(https://aplus.aplnk.com/aplus-ui/components/ag-grid/) instead.");
159
+ let K = 0;
160
+ const b = He(), [, be] = Qe();
161
+ Ze("ApTable")(!1, "breaking", "ApTable has been EOL, Please use AgGrid(https://aplus.aplnk.com/aplus-ui/components/ag-grid/) instead.");
162
162
  const {
163
163
  e: I,
164
164
  b: d,
165
165
  be: O,
166
166
  m: ye,
167
167
  cssVar: Se
168
- } = yr("ap-table"), he = nr("ap-table"), W = Sr("valueTypeMap"), {
168
+ } = Sr("ap-table"), he = sr("ap-table"), W = hr("valueTypeMap"), {
169
169
  height: we,
170
170
  contentRef: ve
171
- } = tr(), D = c(), $ = c(), {
171
+ } = ar(), D = c(), $ = c(), {
172
172
  isStickyMode: j,
173
173
  scrollBarRef: R
174
- } = or(D), C = c(r.size), s = c([]), H = c([]), _ = er(), P = c(!0), U = n(() => (L++, r.columns?.filter((e) => !e.hideInSearch && e.dataIndex && (e.valueType || e.customRenderFormItem) && !ie.includes(e.valueType))?.sort((e, a) => {
174
+ } = tr(D), C = c(r.size), s = c([]), H = c([]), _ = rr(), P = c(!0), U = n(() => (K++, r.columns?.filter((e) => !e.hideInSearch && e.dataIndex && (e.valueType || e.customRenderFormItem) && !ie.includes(e.valueType))?.sort((e, a) => {
175
175
  let t = ce(e.order);
176
176
  return ce(a.order) - t;
177
177
  })?.map((e) => {
178
- const a = sr(e, ur(e.fieldProps, {})), t = {
178
+ const a = ur(e, dr(e.fieldProps, {})), t = {
179
179
  ...e,
180
180
  fieldProps: {
181
181
  label: e.title,
@@ -183,22 +183,22 @@ const Jr = /* @__PURE__ */ $e({
183
183
  // tips: 在表格中的查询表单项默认是带边框的
184
184
  bordered: !0,
185
185
  ...a || {},
186
- _signal: L
186
+ _signal: K
187
187
  },
188
188
  renderNode: void 0
189
189
  };
190
- return t.renderNode = dr(t, o(W)), t;
190
+ return t.renderNode = ir(t, o(W)), t;
191
191
  }) || [])), Re = n(() => pe(o(s), (e) => {
192
192
  if (e.sorter === !0)
193
193
  return e.key || e?.dataIndex;
194
194
  }).filter(Boolean)), Ce = n(() => pe(o(s), (e) => {
195
195
  if (e.filters && !e.onFilter)
196
196
  return e.key || e?.dataIndex;
197
- }).filter(Boolean)), Te = n(() => g(r.dataSource) ? y.records : r.dataSource), Fe = n(() => fe(r.manual) ? r.manual : Xe(b.searchFormExtra?.() || []).some((a) => a.type?.name === "ApView")), {
197
+ }).filter(Boolean)), Te = n(() => g(r.dataSource) ? y.records : r.dataSource), Fe = n(() => fe(r.manual) ? r.manual : Ye(b.searchFormExtra?.() || []).some((a) => a.type?.name === "ApView")), {
198
198
  rowSelection: T,
199
199
  selectedRows: F,
200
200
  ...x
201
- } = lr({
201
+ } = nr({
202
202
  fixed: !0,
203
203
  ...r.rowSelection === !0 ? {} : r.rowSelection,
204
204
  rowKey: r.rowKey,
@@ -216,8 +216,9 @@ const Jr = /* @__PURE__ */ $e({
216
216
  filteredInfo: ke,
217
217
  setPaging: ze,
218
218
  getPaging: Ie,
219
- submitWith: J
220
- } = ar({
219
+ submitWith: J,
220
+ getLastParams: Pe
221
+ } = lr({
221
222
  async request(e) {
222
223
  if (!T.value.preserveSelectedRowKeys && g(r.dataSource) && !P.value && x.clearAll(), P.value && (P.value = !1), !g(r.dataSource))
223
224
  return {
@@ -232,13 +233,13 @@ const Jr = /* @__PURE__ */ $e({
232
233
  },
233
234
  filterFields: Ce,
234
235
  sortFields: Re,
235
- params: He(r, "params"),
236
+ params: _e(r, "params"),
236
237
  defaultData: r.defaultData,
237
238
  manual: o(Fe),
238
239
  formatParams: r.beforeSearchSubmit,
239
240
  pagination: r.pagination
240
241
  });
241
- rr({
242
+ or({
242
243
  columns: n(() => s.value),
243
244
  columnsBackup: n(() => H.value),
244
245
  size: n(() => C.value),
@@ -257,36 +258,37 @@ const Jr = /* @__PURE__ */ $e({
257
258
  refresh: M,
258
259
  getSearchFormSorterItems: Z,
259
260
  setSearchFormSorterItems: ee,
260
- resetSearchFormSorterItems: re
261
+ resetSearchFormSorterItems: re,
262
+ getLastParams: Pe
261
263
  });
262
- const Pe = () => {
264
+ const Ne = () => {
263
265
  let e = r.columns?.filter((t) => !t.hideInTable) || [];
264
266
  function a(t, u) {
265
267
  return t.map((l) => ({
266
268
  resizable: fe(l.resizable) ? l.resizable : r.columnResizable,
267
- ...de(mr(l), ["ellipsis"]),
269
+ ...de(gr(l), ["ellipsis"]),
268
270
  // tips: 此函数内部依赖查询&筛选的相应式值
269
271
  ...G(l),
270
272
  fixed: u ? u.fixed : l.fixed,
271
- title: ir(l, O("table-header", "title"), b.headerCell, o(be).colorTextTertiary),
273
+ title: cr(l, O("table-header", "title"), b.headerCell, o(be).colorTextTertiary),
272
274
  customRender({
273
275
  value: S,
274
276
  ...h
275
277
  }) {
276
- const oe = cr(l), Oe = pr({
278
+ const oe = pr(l), We = fr({
277
279
  ...l,
278
280
  valueType: oe
279
281
  }, {
280
282
  value: S,
281
283
  ...h
282
- }), We = fr(oe, Oe, h.record, o(W)), te = l.renderText?.({
284
+ }), De = mr(oe, We, h.record, o(W)), te = l.renderText?.({
283
285
  value: S,
284
286
  ...h
285
- }) || S, De = l.renderText ? p(ae, null, [l.renderText?.({
287
+ }) || S, $e = l.renderText ? p(ae, null, [l.renderText?.({
286
288
  value: S,
287
289
  ...h
288
- })]) : We;
289
- let A = Ke(l, te, De);
290
+ })]) : De;
291
+ let A = Ke(l, te, $e);
290
292
  return l.customRender && (A = l.customRender({
291
293
  value: S,
292
294
  ...h,
@@ -299,7 +301,7 @@ const Jr = /* @__PURE__ */ $e({
299
301
  }));
300
302
  }
301
303
  return a(e);
302
- }, Ne = () => {
304
+ }, Ve = () => {
303
305
  function e(a) {
304
306
  for (const t of a)
305
307
  t.children?.length ? e(t.children) : G(t, !0);
@@ -307,17 +309,17 @@ const Jr = /* @__PURE__ */ $e({
307
309
  e(s.value);
308
310
  };
309
311
  B(() => [r.columns, r.columnResizable], () => {
310
- const e = Pe();
312
+ const e = Ne();
311
313
  s.value = e, H.value = e;
312
314
  }, {
313
315
  deep: !0,
314
316
  immediate: !0
315
317
  }), B(() => [Be.value, ke.value], () => {
316
- Ne();
318
+ Ve();
317
319
  }, {
318
320
  deep: !0
319
321
  });
320
- const Ve = n(() => {
322
+ const Ae = n(() => {
321
323
  if (r.adaptive && (y.total > 0 || r.dataSource?.length))
322
324
  return {
323
325
  y: o(we),
@@ -325,7 +327,7 @@ const Jr = /* @__PURE__ */ $e({
325
327
  };
326
328
  if (r.scroll)
327
329
  return r.scroll;
328
- }), Ae = n(() => {
330
+ }), Ee = n(() => {
329
331
  if (r.tableLayout)
330
332
  return r.tableLayout;
331
333
  if (r.columns?.some((e) => e.ellipsis))
@@ -339,20 +341,20 @@ const Jr = /* @__PURE__ */ $e({
339
341
  ...a,
340
342
  // tips 如果是前端分页,则默认会走缓存
341
343
  preserveSelectedRowKeys: g(r.dataSource) ? a.preserveSelectedRowKeys : !0
342
- } : gr(r.rowSelection),
344
+ } : br(r.rowSelection),
343
345
  loading: g(r.loading) ? e.loading : r.loading,
344
346
  pagination: r.pagination === !1 ? !1 : e.pagination,
345
- scroll: o(Ve)
347
+ scroll: o(Ae)
346
348
  };
347
- }), Ee = n(() => [d(), r.card ? null : d("wrapper"), r.adaptive ? d("adaptive") : null, j.value && R.value?.visible ? ye(`sticky-${_ === 0 ? "absolute" : "relative"}`) : null, he.value].filter(Boolean));
349
+ }), Le = n(() => [d(), r.card ? null : d("wrapper"), r.adaptive ? d("adaptive") : null, j.value && R.value?.visible ? ye(`sticky-${_ === 0 ? "absolute" : "relative"}`) : null, he.value].filter(Boolean));
348
350
  function Ke(e, a, t) {
349
351
  if (ie.includes(e.valueType))
350
352
  return t;
351
- const u = br(a);
352
- return e.copyable || e.ellipsis ? p(hr, {
353
+ const u = yr(a);
354
+ return e.copyable || e.ellipsis ? p(wr, {
353
355
  copyable: e.copyable,
354
356
  rawValue: u,
355
- ellipsis: e.ellipsis ? Qe(e.ellipsis) ? {
357
+ ellipsis: e.ellipsis ? Xe(e.ellipsis) ? {
356
358
  tooltip: t,
357
359
  rows: 1
358
360
  } : {
@@ -385,7 +387,7 @@ const Jr = /* @__PURE__ */ $e({
385
387
  function re() {
386
388
  i.value?.resetSorterItems();
387
389
  }
388
- function Le() {
390
+ function Oe() {
389
391
  return o(s);
390
392
  }
391
393
  return ge({
@@ -397,7 +399,7 @@ const Jr = /* @__PURE__ */ $e({
397
399
  getSearchFormValues: Y,
398
400
  setPaging: ze,
399
401
  getPaging: Ie,
400
- getShownColumns: Le,
402
+ getShownColumns: Oe,
401
403
  dataSource: n(() => o(y).records),
402
404
  rowSelection: {
403
405
  selectedRows: n(() => o(F)),
@@ -416,7 +418,7 @@ const Jr = /* @__PURE__ */ $e({
416
418
  }), (e, a) => (f(), k("div", {
417
419
  ref_key: "tableWrapperRef",
418
420
  ref: D,
419
- class: m(Ee.value),
421
+ class: m(Le.value),
420
422
  style: E(o(Se)({
421
423
  "scroll-bar-width": `${o(_)}px`
422
424
  }))
@@ -424,7 +426,7 @@ const Jr = /* @__PURE__ */ $e({
424
426
  key: 0,
425
427
  class: m(e.card ? o(I)("search-wrapper") : null),
426
428
  style: E(e.searchFormWrapperStyle)
427
- }, [p(o(Ze).SearchForm, z(e.searchForm || {}, {
429
+ }, [p(o(er).SearchForm, z(e.searchForm || {}, {
428
430
  ref_key: "formRef",
429
431
  ref: i,
430
432
  "custom-reset": "",
@@ -432,7 +434,7 @@ const Jr = /* @__PURE__ */ $e({
432
434
  onSubmit: o(N),
433
435
  onReset: o(V)
434
436
  }), ne({
435
- default: w(() => [(f(!0), k(ae, null, se(U.value, (t) => (f(), ue(_e(t.renderNode), {
437
+ default: w(() => [(f(!0), k(ae, null, se(U.value, (t) => (f(), ue(Ue(t.renderNode), {
436
438
  key: t.dataIndex
437
439
  }))), 128))]),
438
440
  _: 2
@@ -440,39 +442,39 @@ const Jr = /* @__PURE__ */ $e({
440
442
  name: "extra",
441
443
  fn: w(() => [v(e.$slots, "searchFormExtra")]),
442
444
  key: "0"
443
- } : void 0]), 1040, ["submit-loading", "onSubmit", "onReset"])], 6)) : le("", !0), K("div", {
445
+ } : void 0]), 1040, ["submit-loading", "onSubmit", "onReset"])], 6)) : le("", !0), L("div", {
444
446
  ref_key: "contentRef",
445
447
  ref: ve,
446
448
  class: m([o(I)("table-wrapper"), e.card ? o(I)("table-wrapper-card") : null]),
447
449
  style: E(e.tableWrapperStyle)
448
- }, [K("div", {
450
+ }, [L("div", {
449
451
  class: m(o(d)("header-wrapper"))
450
452
  }, [e.settings ? (f(), k("div", {
451
453
  key: 0,
452
454
  class: m(o(d)("header"))
453
- }, [K("div", {
455
+ }, [L("div", {
454
456
  class: m(o(O)("header", "title"))
455
457
  }, [v(e.$slots, "title", z({
456
458
  selectedRows: o(F),
457
459
  selectedRowKeys: o(T).selectedRowKeys,
458
460
  shownColumns: s.value
459
- }, x))], 2), b.title ? (f(), ue(o(Me), {
461
+ }, x))], 2), b.title ? (f(), ue(o(Ge), {
460
462
  key: 0,
461
463
  type: "vertical"
462
- })) : le("", !0), p(wr, {
464
+ })) : le("", !0), p(vr, {
463
465
  config: e.settings === !0 ? {} : e.settings
464
466
  }, null, 8, ["config"])], 2)) : v(e.$slots, "title", z({
465
467
  key: 1,
466
468
  selectedRows: o(F),
467
469
  selectedRowKeys: o(T).selectedRowKeys,
468
470
  shownColumns: s.value
469
- }, x))], 2), p(o(Ge), z({
471
+ }, x))], 2), p(o(Je), z({
470
472
  ref_key: "antdTableRef",
471
473
  ref: $,
472
474
  class: o(d)("table")
473
475
  }, Q.value, {
474
476
  size: C.value,
475
- "table-layout": Ae.value,
477
+ "table-layout": Ee.value,
476
478
  columns: s.value,
477
479
  onResizeColumn: a[0] || (a[0] = (t, u) => u.width = t)
478
480
  }), ne({
@@ -484,7 +486,7 @@ const Jr = /* @__PURE__ */ $e({
484
486
  _: 2
485
487
  }, [o(j) ? {
486
488
  name: "bottomPaginationTop",
487
- fn: w(() => [p(o(vr), {
489
+ fn: w(() => [p(o(Rr), {
488
490
  ref_key: "scrollBarRef",
489
491
  ref: R,
490
492
  "scroll-container": $.value?.table?.scrollBodyRef,
@@ -496,10 +498,10 @@ const Jr = /* @__PURE__ */ $e({
496
498
  key: "0"
497
499
  } : void 0, se(o(de)(b, ["title", "searchFormExtra", "headerCell", "summary"]), (t, u) => ({
498
500
  name: u,
499
- fn: w((l) => [v(e.$slots, u, Ue(qe(l || {})))])
501
+ fn: w((l) => [v(e.$slots, u, qe(Me(l || {})))])
500
502
  }))]), 1040, ["class", "size", "table-layout", "columns"])], 6)], 6));
501
503
  }
502
504
  });
503
505
  export {
504
- Jr as default
506
+ Qr as default
505
507
  };
@@ -37,6 +37,7 @@ type ApTableContextProps<RecordType> = {
37
37
  getSearchFormSorterItems?: () => ApFormSearchFormPopoverSorterItem[];
38
38
  setSearchFormSorterItems?: (sortedItems: ApFormSearchFormPopoverSorterItem[]) => void;
39
39
  resetSearchFormSorterItems: () => void;
40
+ getLastParams?: () => Recordable;
40
41
  };
41
42
  export declare const ApTableContextKey: InjectionKey<ApTableContextProps<any>>;
42
43
  export declare function useProvideApTable<ModelType>(state: ApTableContextProps<ModelType>): void;
@@ -1,15 +1,15 @@
1
- import { provide as s, inject as a, computed as o } from "vue";
1
+ import { provide as s, inject as a, computed as t } from "vue";
2
2
  const r = Symbol("apTableContextKey");
3
- function n(t) {
4
- s(r, t);
3
+ function n(o) {
4
+ s(r, o);
5
5
  }
6
6
  const e = () => {
7
7
  };
8
8
  function c() {
9
9
  return a(r, {
10
- columns: o(() => []),
10
+ columns: t(() => []),
11
11
  updateColumns: e,
12
- size: o(() => "middle"),
12
+ size: t(() => "middle"),
13
13
  updateSize: e,
14
14
  dataSource: void 0,
15
15
  renderConfig: void 0,
@@ -21,7 +21,8 @@ function c() {
21
21
  refresh: e,
22
22
  getSearchFormSorterItems: () => [],
23
23
  setSearchFormSorterItems: e,
24
- resetSearchFormSorterItems: e
24
+ resetSearchFormSorterItems: e,
25
+ getLastParams: () => ({})
25
26
  });
26
27
  }
27
28
  export {
@@ -123,5 +123,6 @@ export declare const useTablePaging: <DataType = any, ParamsType = Record<string
123
123
  setPaging: (nextPaging: InternalPagingType, refreshImmediately?: boolean) => void;
124
124
  submitWith: (resetCurrent?: boolean) => void;
125
125
  fetchNextPageAndCache: () => void;
126
+ getLastParams: () => Recordable;
126
127
  };
127
128
  export {};