@aplus-frontend/ui 0.5.35 → 0.5.37

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,4 +1,4 @@
1
- import { defineComponent as ke, useSlots as Fe, getCurrentInstance as Be, ref as k, computed as n, unref as o, watch as F, createElementBlock as B, openBlock as s, normalizeStyle as z, normalizeClass as g, createCommentVNode as S, createElementVNode as I, createVNode as U, mergeProps as h, createSlots as G, withCtx as v, Fragment as X, renderList as _, createBlock as p, resolveDynamicComponent as A, renderSlot as V, normalizeProps as Ie, guardReactiveProps as Ee } from "vue";
1
+ import { defineComponent as ke, useSlots as Be, getCurrentInstance as Fe, ref as k, computed as n, unref as o, watch as B, createElementBlock as F, openBlock as s, normalizeStyle as z, normalizeClass as g, createCommentVNode as S, createElementVNode as I, createVNode as U, mergeProps as h, createSlots as G, withCtx as v, Fragment as X, renderList as _, createBlock as p, resolveDynamicComponent as A, renderSlot as V, normalizeProps as Ie, guardReactiveProps as Ee } from "vue";
2
2
  import { VxeTable as Pe, VxeColumn as J } from "vxe-table";
3
3
  import "vxe-table/es/style.css";
4
4
  import "vxe-pc-ui/es/style.css";
@@ -9,11 +9,11 @@ import "../config-provider/index.mjs";
9
9
  import { noRenderAsFormItemValueList as ze } from "../ap-table/constants.mjs";
10
10
  import { getColumnOrder as Y, updateFormProps as _e, getFieldProps as Ae, getSearchFormItemRenderNode as Ve, recursionApColumns as Z } from "../ap-table/utils.mjs";
11
11
  import { useTablePaging as Le } from "../ap-table/hooks/use-table-paging-ng.mjs";
12
- import { Empty as ee, Pagination as Oe } from "@aplus-frontend/antdv";
13
- import { useInnerParams as De } from "./hooks/use-inner-params.mjs";
14
- import { toVxeProps as Ke, getRowExpandProps as $e, getRowSelectionProps as He } from "./utils/table.mjs";
15
- import We from "../ap-table/hooks/use-table-row-selection.mjs";
16
- import { useProvideApTable as je } from "../ap-table/context.mjs";
12
+ import { Empty as ee, Pagination as De } from "@aplus-frontend/antdv";
13
+ import { useInnerParams as Oe } from "./hooks/use-inner-params.mjs";
14
+ import { toVxeProps as $e, getRowExpandProps as Ke, getRowSelectionProps as We } from "./utils/table.mjs";
15
+ import je from "../ap-table/hooks/use-table-row-selection.mjs";
16
+ import { useProvideApTable as He } from "../ap-table/context.mjs";
17
17
  import { sizeReverseMap as Me, sizeMap as qe, ROW_SELECTION_FIELD as Ue } from "./constants.mjs";
18
18
  import { useRenderColumns as Ge } from "./hooks/use-render-columns.mjs";
19
19
  import { useToken as Xe } from "@aplus-frontend/antdv/es/theme/internal";
@@ -22,7 +22,7 @@ import { useNamespace as Je } from "../config-provider/hooks/use-namespace.mjs";
22
22
  import { useGlobalConfig as Qe } from "../config-provider/hooks/use-global-config.mjs";
23
23
  import { useLocale as Ye } from "../config-provider/hooks/use-locale.mjs";
24
24
  import Ze from "../scroll-bar/index.vue.mjs";
25
- const Fo = /* @__PURE__ */ ke({
25
+ const Bo = /* @__PURE__ */ ke({
26
26
  name: "ApGrid",
27
27
  __name: "index",
28
28
  props: {
@@ -112,22 +112,22 @@ const Fo = /* @__PURE__ */ ke({
112
112
  },
113
113
  setup(oe, { expose: ae }) {
114
114
  var q;
115
- const L = Fe(), a = oe, w = (q = Be()) == null ? void 0 : q.appContext.app;
115
+ const L = Be(), a = oe, w = (q = Fe()) == null ? void 0 : q.appContext.app;
116
116
  w && !w.__VXE_PC_UI_INSTALLED__ && (w.use(Q), w.__VXE_PC_UI_INSTALLED__ = !0);
117
- const { e: E, b: d, be: re } = Je("ap-grid"), te = Qe("valueTypeMap"), i = k([]), O = k([]), m = k(), C = k(a.size), [, c] = Xe(), { t: le } = Ye();
117
+ const { e: E, b: c, be: re } = Je("ap-grid"), te = Qe("valueTypeMap"), d = k([]), D = k([]), m = k(), C = k(a.size), [, i] = Xe(), { t: le } = Ye();
118
118
  Q.setConfig({
119
119
  i18n: (e, r) => le(`ap.${e}`, r)
120
120
  });
121
- const { renderConfig: ne, updateSignal: se } = Ge(i);
122
- let D = 0;
123
- const ie = n(() => {
121
+ const { renderConfig: ne, updateSignal: se } = Ge(d);
122
+ let O = 0;
123
+ const de = n(() => {
124
124
  if (m.value)
125
125
  return m.value.$el.querySelector(
126
126
  ".vxe-table--header-inner-wrapper"
127
127
  );
128
- }), K = n(() => {
128
+ }), $ = n(() => {
129
129
  var e, r, l;
130
- return D++, ((l = (r = (e = a.columns) == null ? void 0 : e.filter(
130
+ return O++, ((l = (r = (e = a.columns) == null ? void 0 : e.filter(
131
131
  (t) => !t.hideInSearch && t.dataIndex && (t.valueType || t.customRenderFormItem) && !ze.includes(t.valueType)
132
132
  )) == null ? void 0 : r.sort((t, u) => {
133
133
  let y = Y(t.order);
@@ -142,7 +142,7 @@ const Fo = /* @__PURE__ */ ke({
142
142
  label: t.title,
143
143
  name: t.dataIndex,
144
144
  ...u || {},
145
- _signal: D
145
+ _signal: O
146
146
  },
147
147
  renderNode: void 0
148
148
  };
@@ -151,21 +151,21 @@ const Fo = /* @__PURE__ */ ke({
151
151
  o(te)
152
152
  ), y;
153
153
  })) || [];
154
- }), de = n(() => [
155
- d(),
156
- a.card ? null : d("wrapper"),
157
- a.adaptive ? d("adaptive") : null,
158
- a.sticky ? d("sticky") : null
159
- ].filter(Boolean)), $ = n(() => Z(o(i), (e) => {
154
+ }), ie = n(() => [
155
+ c(),
156
+ a.card ? null : c("wrapper"),
157
+ a.adaptive ? c("adaptive") : null,
158
+ a.sticky ? c("sticky") : null
159
+ ].filter(Boolean)), K = n(() => Z(o(d), (e) => {
160
160
  if (e.sorter === !0)
161
161
  return e.key || e.dataIndex;
162
- }).filter(Boolean)), H = n(() => Z(o(i), (e) => {
162
+ }).filter(Boolean)), W = n(() => Z(o(d), (e) => {
163
163
  if (e.filters && !e.onFilter)
164
164
  return e.key || e.dataIndex;
165
165
  }).filter(Boolean)), {
166
166
  formRef: P,
167
- submit: W,
168
- reset: j,
167
+ submit: j,
168
+ reset: H,
169
169
  refresh: ce,
170
170
  data: f,
171
171
  tableProps: M,
@@ -188,40 +188,40 @@ const Fo = /* @__PURE__ */ ke({
188
188
  };
189
189
  },
190
190
  namespace: "ap-grid",
191
- filterFields: H,
192
- sortFields: $,
191
+ filterFields: W,
192
+ sortFields: K,
193
193
  defaultParams: a.params,
194
194
  defaultData: a.defaultData,
195
195
  manual: a.manual,
196
196
  formatParams: a.beforeSearchSubmit,
197
197
  pagination: a.pagination
198
- }), { sortChangeEvent: me, filterChangeEvent: fe, paginationChangeEvent: ge } = De(pe);
199
- je({
200
- columns: n(() => i.value),
201
- columnsBackup: n(() => O.value),
198
+ }), { sortChangeEvent: me, filterChangeEvent: fe, paginationChangeEvent: ge } = Oe(pe);
199
+ He({
200
+ columns: n(() => d.value),
201
+ columnsBackup: n(() => D.value),
202
202
  size: n(() => C.value ? qe[C.value] : "middle"),
203
203
  updateColumns(e) {
204
204
  var r;
205
- i.value = e, (r = a.onShownColumnsChange) == null || r.call(a, e);
205
+ d.value = e, (r = a.onShownColumnsChange) == null || r.call(a, e);
206
206
  },
207
207
  updateSize(e) {
208
208
  C.value = Me[e];
209
209
  },
210
210
  renderConfig: n(() => ({
211
211
  className: re("table-header", "title"),
212
- color: c.value.colorPrimary
212
+ color: i.value.colorPrimary
213
213
  })),
214
214
  dataSource: n(() => o(f).records)
215
215
  });
216
216
  const he = n(
217
- () => i.value.some(
217
+ () => d.value.some(
218
218
  (e) => e.fixed === "left" || e.fixed === !0
219
219
  ) ? "left" : void 0
220
220
  ), ve = n(
221
221
  () => b(a.loading) ? f.loading : a.loading
222
222
  ), Ce = n(
223
223
  () => b(a.dataSource) ? f.records : a.dataSource
224
- ), { selectedRows: x, rowSelection: R, ...ye } = We({
224
+ ), { selectedRows: x, rowSelection: R, ...ye } = je({
225
225
  ...a.rowSelection === !0 ? {} : a.rowSelection,
226
226
  dataSource: Ce,
227
227
  rowKey: a.rowKey
@@ -259,51 +259,52 @@ const Fo = /* @__PURE__ */ ke({
259
259
  if (l)
260
260
  return (t = m.value) == null ? void 0 : t.scrollToRow(l, r);
261
261
  }
262
- return F(
262
+ return B(
263
263
  () => [a.columnResizable, a.columns],
264
264
  () => {
265
265
  var r;
266
266
  const e = be();
267
- i.value = e, (r = a.onShownColumnsChange) == null || r.call(a, e), O.value = e;
267
+ d.value = e, (r = a.onShownColumnsChange) == null || r.call(a, e), D.value = e;
268
268
  },
269
269
  {
270
270
  deep: !0,
271
271
  immediate: !0
272
272
  }
273
- ), F(
273
+ ), B(
274
274
  () => a.dataSource,
275
275
  (e) => {
276
276
  ue(e);
277
277
  },
278
278
  { immediate: !0, deep: !0 }
279
- ), F(
279
+ ), B(
280
280
  () => o(f).loading,
281
281
  (e) => {
282
282
  var r;
283
283
  (r = a.onLoadingChange) == null || r.call(a, e);
284
284
  }
285
- ), F(
285
+ ), B(
286
286
  () => a.size,
287
287
  (e) => {
288
288
  C.value = e;
289
289
  }
290
290
  ), ae({
291
- submit: W,
292
- reset: j,
291
+ submit: j,
292
+ reset: H,
293
293
  refresh: ce,
294
294
  setSearchFormValues: we,
295
295
  getSearchFormValues: xe,
296
- getShowColumns: () => o(i),
296
+ getShowColumns: () => o(d),
297
297
  rowSelection: {
298
298
  selectedRows: n(() => x.value),
299
299
  clearAll: T
300
300
  },
301
- scrollToRow: Re
302
- }), (e, r) => (s(), B("div", {
303
- class: g(de.value),
301
+ scrollToRow: Re,
302
+ getDataSource: () => o(f.records)
303
+ }), (e, r) => (s(), F("div", {
304
+ class: g(ie.value),
304
305
  style: z(e.wrapperStyle)
305
306
  }, [
306
- o(b)(e.dataSource) && e.searchForm !== !1 && K.value.length > 0 ? (s(), B("div", {
307
+ o(b)(e.dataSource) && e.searchForm !== !1 && $.value.length > 0 ? (s(), F("div", {
307
308
  key: 0,
308
309
  class: g(e.card ? o(E)("search-wrapper") : null),
309
310
  style: z(e.searchFormWrapperStyle)
@@ -313,11 +314,11 @@ const Fo = /* @__PURE__ */ ke({
313
314
  ref: P,
314
315
  "custom-reset": "",
315
316
  "submit-loading": o(M).loading,
316
- onSubmit: o(W),
317
- onReset: o(j)
317
+ onSubmit: o(j),
318
+ onReset: o(H)
318
319
  }), G({
319
320
  default: v(() => [
320
- (s(!0), B(X, null, _(K.value, (l) => (s(), p(A(l.renderNode.Comp), h({
321
+ (s(!0), F(X, null, _($.value, (l) => (s(), p(A(l.renderNode.Comp), h({
321
322
  key: l.dataIndex,
322
323
  item: l,
323
324
  ref_for: !0
@@ -342,41 +343,38 @@ const Fo = /* @__PURE__ */ ke({
342
343
  style: z(e.tableWrapperStyle)
343
344
  }, [
344
345
  I("div", {
345
- class: g(o(d)("header-wrapper"))
346
+ class: g(o(c)("header-wrapper"))
346
347
  }, [
347
348
  V(e.$slots, "title", {
348
349
  selectedRows: o(x),
349
350
  selectedRowKeys: o(R).selectedRowKeys,
350
- shownColumns: i.value,
351
+ shownColumns: d.value,
351
352
  clearAll: T
352
353
  })
353
354
  ], 2),
354
355
  I("div", {
355
- class: g(o(d)("vxe-wrapper"))
356
+ class: g(o(c)("vxe-wrapper"))
356
357
  }, [
357
- (s(), p(o(Pe), h(o(Ke)(a), {
358
+ (s(), p(o(Pe), h(o($e)(a), {
358
359
  ref_key: "tableRef",
359
360
  ref: m,
360
361
  key: o(se),
361
362
  data: o(f).records,
362
- "sort-config": { remote: $.value.length > 0 },
363
- "filter-config": { remote: H.value.length > 0 },
363
+ "sort-config": { remote: K.value.length > 0 },
364
+ "filter-config": { remote: W.value.length > 0 },
364
365
  loading: ve.value,
365
- "row-config": {
366
- isHover: !0,
367
- keyField: a.rowKey
368
- },
369
366
  style: {
370
- "--vxe-ui-table-row-checkbox-checked-background-color": o(c).controlItemBgActive,
371
- "--vxe-ui-table-row-hover-checkbox-checked-background-color": o(c).controlItemBgActiveHover,
372
- "--vxe-ui-font-primary-color": o(c).colorPrimary,
367
+ "--vxe-ui-table-row-checkbox-checked-background-color": o(i).controlItemBgActive,
368
+ "--vxe-ui-table-row-hover-checkbox-checked-background-color": o(i).controlItemBgActiveHover,
369
+ "--vxe-ui-font-primary-color": o(i).colorPrimary,
373
370
  "--vxe-ui-table-header-background-color": "var(--ap-table-header-bg)",
374
371
  "--vxe-ui-table-cell-padding-default": "12px",
375
372
  "--vxe-ui-table-cell-padding-medium": "9px",
376
- "--vxe-ui-table-row-radio-checked-background-color": o(c).controlItemBgActive,
377
- "--vxe-ui-table-row-hover-radio-checked-background-color": o(c).controlItemBgActiveHover,
378
- "--vxe-ui-font-color": o(c).colorTextBase,
379
- "--vxe-ui-table-border-color": o(c).colorBorderSecondary
373
+ "--vxe-ui-table-row-radio-checked-background-color": o(i).controlItemBgActive,
374
+ "--vxe-ui-table-row-hover-radio-checked-background-color": o(i).controlItemBgActiveHover,
375
+ "--vxe-ui-font-color": o(i).colorTextBase,
376
+ "--vxe-ui-table-border-color": o(i).colorBorderSecondary,
377
+ "--vxe-ui-table-header-font-color": o(i).colorTextBase
380
378
  },
381
379
  size: C.value,
382
380
  onSortChange: o(me),
@@ -392,14 +390,14 @@ const Fo = /* @__PURE__ */ ke({
392
390
  }, null, 8, ["image"])
393
391
  ]),
394
392
  default: v(() => [
395
- a.expandable ? (s(), p(o(J), h({ key: 0 }, o($e)(e.expandable), { fixed: he.value }), {
393
+ a.expandable ? (s(), p(o(J), h({ key: 0 }, o(Ke)(e.expandable), { fixed: he.value }), {
396
394
  content: v((l) => [
397
395
  (s(), p(A(a.expandable.renderContent(l))))
398
396
  ]),
399
397
  _: 1
400
398
  }, 16, ["fixed"])) : S("", !0),
401
- a.rowSelection ? (s(), p(o(J), h({ key: 1 }, o(He)(o(R), i.value), { field: o(Ue) }), null, 16, ["field"])) : S("", !0),
402
- (s(!0), B(X, null, _(o(ne), (l) => (s(), p(A(l), {
399
+ a.rowSelection ? (s(), p(o(J), h({ key: 1 }, o(We)(o(R), d.value), { field: o(Ue) }), null, 16, ["field"])) : S("", !0),
400
+ (s(!0), F(X, null, _(o(ne), (l) => (s(), p(A(l), {
403
401
  key: l.props.colId
404
402
  }))), 128))
405
403
  ]),
@@ -411,20 +409,20 @@ const Fo = /* @__PURE__ */ ke({
411
409
  V(e.$slots, t, Ie(Ee(u || {})))
412
410
  ])
413
411
  }))
414
- ]), 1040, ["data", "sort-config", "filter-config", "loading", "row-config", "style", "size", "onSortChange", "onFilterChange"]))
412
+ ]), 1040, ["data", "sort-config", "filter-config", "loading", "style", "size", "onSortChange", "onFilterChange"]))
415
413
  ], 2),
416
414
  I("div", {
417
- class: g(o(d)("pagination-wrapper"))
415
+ class: g(o(c)("pagination-wrapper"))
418
416
  }, [
419
417
  e.sticky ? (s(), p(o(Ze), {
420
418
  key: 0,
421
419
  direction: "horizontal",
422
- "scroll-container": ie.value,
420
+ "scroll-container": de.value,
423
421
  "extra-size": -4.2
424
422
  }, null, 8, ["scroll-container"])) : S("", !0),
425
- e.pagination !== !1 ? (s(), p(o(Oe), h({
423
+ e.pagination !== !1 ? (s(), p(o(De), h({
426
424
  key: 1,
427
- class: o(d)("pagination")
425
+ class: o(c)("pagination")
428
426
  }, o(M).pagination, { onChange: o(ge) }), null, 16, ["class", "onChange"])) : S("", !0)
429
427
  ], 2)
430
428
  ], 6)
@@ -432,5 +430,5 @@ const Fo = /* @__PURE__ */ ke({
432
430
  }
433
431
  });
434
432
  export {
435
- Fo as default
433
+ Bo as default
436
434
  };
@@ -298,4 +298,9 @@ export type ApGridExpose<SearchParamsType = Recordable, RecordType = any> = {
298
298
  * @returns
299
299
  */
300
300
  scrollToRow: (index: number, fieldOrColumn?: any) => Promise<any>;
301
+ /**
302
+ * 获取当前表格数据
303
+ * @returns
304
+ */
305
+ getDataSource: () => RecordType[];
301
306
  };
@@ -1,6 +1,6 @@
1
- import { omit as l, isUndefined as u, isFunction as h, isNumber as b } from "lodash-unified";
2
- const w = 20, x = 50;
3
- function m(e) {
1
+ import { omit as l, isUndefined as u, isFunction as h, isNumber as w } from "lodash-unified";
2
+ const b = 20, y = 50;
3
+ function R(e) {
4
4
  var i;
5
5
  const t = {
6
6
  ...l(e, [
@@ -47,22 +47,25 @@ function m(e) {
47
47
  enabled: !1
48
48
  }, t.virtualYConfig = {
49
49
  enabled: !1
50
- }) : (a(t, "X", e.virtual), a(t, "Y", e.virtual)), t.round = !0, t;
50
+ }) : (a(t, "X", e.virtual), a(t, "Y", e.virtual)), t.rowConfig = {
51
+ isHover: !0,
52
+ keyField: e.rowKey
53
+ }, t.round = !0, t;
51
54
  }
52
55
  function a(e, t, i) {
53
- const o = t === "X", r = o ? "x" : "y", n = o ? "virtualXConfig" : "virtualYConfig", s = i == null ? void 0 : i[r], f = s !== !1, d = o ? w : x, c = b(s) && s >= 0 ? s : d;
56
+ const o = t === "X", r = o ? "x" : "y", n = o ? "virtualXConfig" : "virtualYConfig", d = i == null ? void 0 : i[r], f = d !== !1, s = o ? b : y, c = w(d) && d >= 0 ? d : s;
54
57
  e[n] = {
55
58
  enabled: f,
56
59
  gt: c,
57
60
  oSize: (i == null ? void 0 : i.oSize) || 0
58
61
  };
59
62
  }
60
- function y(e) {
63
+ function x(e) {
61
64
  return e === !0 ? "left" : e;
62
65
  }
63
- function C(e, t) {
66
+ function m(e, t) {
64
67
  const i = e === !0 || !e.type ? "checkbox" : e.type, o = e === !0 ? 60 : e.columnWidth || 60;
65
- let r = e === !0 ? void 0 : y(e.fixed);
68
+ let r = e === !0 ? void 0 : x(e.fixed);
66
69
  return r || (r === !1 ? r = void 0 : r = t.some(
67
70
  (n) => n.fixed === "left" || n.fixed === !0
68
71
  ) ? "left" : void 0), {
@@ -81,6 +84,6 @@ function g(e) {
81
84
  }
82
85
  export {
83
86
  g as getRowExpandProps,
84
- C as getRowSelectionProps,
85
- m as toVxeProps
87
+ m as getRowSelectionProps,
88
+ R as toVxeProps
86
89
  };