@ljweb/layout-antdv-v4 0.1.0-beta.1 → 0.1.0-beta.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.
Files changed (49) hide show
  1. package/README.md +6 -10
  2. package/dist/style.css +126 -126
  3. package/esm/assets/style.css +126 -126
  4. package/esm/components/ext-table/ExtTable.vue.js +1 -1
  5. package/esm/components/ext-table/ExtTable2.vue.js +55 -31
  6. package/esm/components/ext-table/ExtTable2.vue.js.map +1 -1
  7. package/esm/components/index.js +36 -38
  8. package/esm/components/index.js.map +1 -1
  9. package/esm/index.js +36 -38
  10. package/esm/index.js.map +1 -1
  11. package/lib/assets/style.css +126 -126
  12. package/lib/components/ext-table/ExtTable.vue.js +1 -1
  13. package/lib/components/ext-table/ExtTable2.vue.js +55 -31
  14. package/lib/components/ext-table/ExtTable2.vue.js.map +1 -1
  15. package/lib/components/index.js +0 -2
  16. package/lib/components/index.js.map +1 -1
  17. package/lib/index.js +0 -2
  18. package/lib/index.js.map +1 -1
  19. package/package.json +1 -6
  20. package/types/components/config-provider/ConfigProvider.d.ts +1 -1
  21. package/types/components/ext-table/ExtTable.vue.d.ts +6 -6
  22. package/types/components/ext-table/types.d.ts +5 -1
  23. package/types/components/index.d.ts +0 -1
  24. package/types/components/locale-dropdown/LocaleDropdown.d.ts +1 -1
  25. package/esm/components/async-table/AsyncTable.js +0 -290
  26. package/esm/components/async-table/AsyncTable.js.map +0 -1
  27. package/esm/components/async-table/helpers.js +0 -71
  28. package/esm/components/async-table/helpers.js.map +0 -1
  29. package/esm/components/async-table/index.js +0 -6
  30. package/esm/components/async-table/index.js.map +0 -1
  31. package/esm/components/async-table/style.js +0 -2
  32. package/esm/components/async-table/style.js.map +0 -1
  33. package/esm/components/async-table/types.js +0 -2
  34. package/esm/components/async-table/types.js.map +0 -1
  35. package/lib/components/async-table/AsyncTable.js +0 -290
  36. package/lib/components/async-table/AsyncTable.js.map +0 -1
  37. package/lib/components/async-table/helpers.js +0 -71
  38. package/lib/components/async-table/helpers.js.map +0 -1
  39. package/lib/components/async-table/index.js +0 -6
  40. package/lib/components/async-table/index.js.map +0 -1
  41. package/lib/components/async-table/style.js +0 -3
  42. package/lib/components/async-table/style.js.map +0 -1
  43. package/lib/components/async-table/types.js +0 -2
  44. package/lib/components/async-table/types.js.map +0 -1
  45. package/types/components/async-table/AsyncTable.d.ts +0 -413
  46. package/types/components/async-table/helpers.d.ts +0 -18
  47. package/types/components/async-table/index.d.ts +0 -2
  48. package/types/components/async-table/style.d.ts +0 -1
  49. package/types/components/async-table/types.d.ts +0 -50
@@ -20,7 +20,7 @@ import { TABLE_SHOW_TOTAL, TABLE_SHOW_SIZE_CHANGER, TABLE_PAGE_SIZE_OPTIONS, NES
20
20
  import _sfc_main$4 from "./Status.vue.js";
21
21
  import Operations from "./Operations.vue.js";
22
22
  import ColumnSetting from "./ColumnSetting.vue.js";
23
- const _withScopeId = (n) => (pushScopeId("data-v-60f82f19"), n = n(), popScopeId(), n);
23
+ const _withScopeId = (n) => (pushScopeId("data-v-8476b82b"), n = n(), popScopeId(), n);
24
24
  const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode(
25
25
  "svg",
26
26
  {
@@ -57,12 +57,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
57
  formatMappings: {},
58
58
  prefixCls: { default: void 0 },
59
59
  size: {},
60
+ scroll: {},
60
61
  dataSource: { default: void 0 },
61
62
  toolbar: { default: void 0 },
62
63
  fixedColumns: {},
63
64
  requiredColumns: {},
64
65
  tableId: { default: void 0 },
65
66
  showPagination: { type: Boolean, default: true },
67
+ paginationProps: {},
66
68
  paginationPosition: { default: "right" },
67
69
  defaultPageSize: { default: 20 },
68
70
  pageSizeOptions: { default: () => TABLE_PAGE_SIZE_OPTIONS },
@@ -433,10 +435,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
433
435
  },
434
436
  { immediate: true }
435
437
  );
436
- const loadData = (isResetPage = false) => {
437
- if (isResetPage) {
438
- currentPage.value = 1;
439
- }
438
+ let queryVersion = 0;
439
+ const loadPage = (canRetryLastPage = true) => {
440
+ const version = ++queryVersion;
440
441
  return new Promise((resolve) => {
441
442
  isLoading.value = true;
442
443
  const queryParams = {
@@ -446,9 +447,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
446
447
  },
447
448
  ...props.sortRemote ? { sorter: tableSorter.value } : {},
448
449
  success: (data = { list: [], count: 0 }) => {
450
+ if (version !== queryVersion) return resolve();
449
451
  if (data.list.length === 0 && props.showPagination && currentPage.value > 1) {
450
- currentPage.value--;
451
- loadData().then(resolve);
452
+ const lastPage = Math.max(1, Math.ceil(data.count / pageSize.value));
453
+ currentPage.value = canRetryLastPage && lastPage < currentPage.value ? lastPage : 1;
454
+ loadPage(false).then(resolve);
452
455
  return;
453
456
  }
454
457
  isLoading.value = false;
@@ -460,6 +463,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
460
463
  resolve();
461
464
  },
462
465
  fail: (err) => {
466
+ if (version !== queryVersion) return resolve();
463
467
  isLoading.value = false;
464
468
  if (err && isPlainObject(err) && err.message) {
465
469
  message.error({
@@ -479,6 +483,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
479
483
  emits("query", queryParams);
480
484
  });
481
485
  };
486
+ const loadData = (isResetPage = false) => {
487
+ if (isResetPage) currentPage.value = 1;
488
+ return loadPage();
489
+ };
482
490
  const onTableChange = (_pagination, _filters, sorter, extra) => {
483
491
  emits("change", _pagination, _filters, sorter, extra);
484
492
  if (!props.sortRemote) {
@@ -514,6 +522,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
514
522
  refreshColumns(true);
515
523
  };
516
524
  const reset = () => {
525
+ queryVersion++;
517
526
  total.value = 0;
518
527
  pageSize.value = props.defaultPageSize;
519
528
  currentPage.value = 1;
@@ -753,6 +762,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
753
762
  scheduleUndefinedColumnWidthMeasurement();
754
763
  });
755
764
  onUnmounted(() => {
765
+ queryVersion++;
756
766
  isTableMounted = false;
757
767
  columnWidthMeasureVersion++;
758
768
  destroySortable();
@@ -763,6 +773,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
763
773
  pageSize.value = size;
764
774
  loadData();
765
775
  };
776
+ const paginationBindings = computed(
777
+ () => props.paginationProps ?? {
778
+ current: currentPage.value,
779
+ pageSize: pageSize.value,
780
+ total: total.value,
781
+ showTotal: props.showTotal,
782
+ pageSizeOptions: props.pageSizeOptions,
783
+ showSizeChanger: props.showSizeChanger,
784
+ onChange: onPageChange
785
+ }
786
+ );
787
+ const showPaginationControls = computed(() => {
788
+ const { hideOnSinglePage, total: total2 = 0, pageSize: pageSize2, defaultPageSize = 10 } = paginationBindings.value;
789
+ return props.showPagination && (!hideOnSinglePage || total2 > (pageSize2 ?? defaultPageSize));
790
+ });
766
791
  const isSlot = (column, type) => {
767
792
  return get(column, "format.type") === type;
768
793
  };
@@ -796,7 +821,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
796
821
  return get(row, column.dataIndex, defaultValue || props.emptyValue);
797
822
  };
798
823
  const formatIndex = (index) => {
799
- return (currentPage.value - 1) * pageSize.value + index + 1;
824
+ const current = props.paginationProps?.current ?? currentPage.value;
825
+ const size = props.paginationProps?.pageSize ?? pageSize.value;
826
+ return (current - 1) * size + index + 1;
800
827
  };
801
828
  const formatFileType = (row, column) => {
802
829
  const value = get(row, column.dataIndex);
@@ -1182,6 +1209,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1182
1209
  disabled: unref(isNestedExtTable) || !_ctx.scrollTable,
1183
1210
  "row-selection": computedRowSelection.value,
1184
1211
  size: _ctx.size,
1212
+ scroll: _ctx.scroll,
1185
1213
  bordered: _ctx.bordered,
1186
1214
  columns: columnList.value,
1187
1215
  loading: isLoading.value,
@@ -1448,7 +1476,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1448
1476
  ]),
1449
1477
  key: "2"
1450
1478
  } : void 0,
1451
- _ctx.showPagination || computedBatchOperations.value && computedBatchOperations.value.length > 0 || _ctx.$slots["batch-operators"] ? {
1479
+ showPaginationControls.value || computedBatchOperations.value && computedBatchOperations.value.length > 0 || _ctx.$slots["batch-operators"] ? {
1452
1480
  name: "default",
1453
1481
  fn: withCtx(() => [
1454
1482
  createVNode(unref(Flex), {
@@ -1495,21 +1523,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1495
1523
  clear: handleClearSelection
1496
1524
  }, void 0, true) : createCommentVNode("v-if", true)
1497
1525
  ]),
1498
- _ctx.showPagination ? (openBlock(), createBlock(unref(Flex), {
1526
+ showPaginationControls.value ? (openBlock(), createBlock(unref(Flex), {
1499
1527
  key: 0,
1500
1528
  justify: paginationJustify.value,
1501
1529
  class: "ext-table-pagination"
1502
1530
  }, {
1503
1531
  default: withCtx(() => [
1504
- createVNode(unref(Pagination), {
1505
- current: currentPage.value,
1506
- "page-size": pageSize.value,
1507
- total: total.value,
1508
- "show-total": _ctx.showTotal,
1509
- "page-size-options": _ctx.pageSizeOptions,
1510
- "show-size-changer": _ctx.showSizeChanger,
1511
- onChange: onPageChange
1512
- }, null, 8, ["current", "page-size", "total", "show-total", "page-size-options", "show-size-changer"])
1532
+ createVNode(
1533
+ unref(Pagination),
1534
+ normalizeProps(guardReactiveProps(paginationBindings.value)),
1535
+ null,
1536
+ 16
1537
+ /* FULL_PROPS */
1538
+ )
1513
1539
  ]),
1514
1540
  _: 1
1515
1541
  /* STABLE */
@@ -1521,9 +1547,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1521
1547
  ]),
1522
1548
  key: "3"
1523
1549
  } : void 0
1524
- ]), 1040, ["disabled", "row-selection", "size", "bordered", "columns", "loading", "data-source", "row-key"]),
1550
+ ]), 1040, ["disabled", "row-selection", "size", "scroll", "bordered", "columns", "loading", "data-source", "row-key"]),
1525
1551
  createCommentVNode(" pagination "),
1526
- _ctx.showPagination || computedBatchOperations.value && computedBatchOperations.value.length > 0 || _ctx.$slots["batch-operators"] ? (openBlock(), createBlock(unref(Flex), {
1552
+ showPaginationControls.value || computedBatchOperations.value && computedBatchOperations.value.length > 0 || _ctx.$slots["batch-operators"] ? (openBlock(), createBlock(unref(Flex), {
1527
1553
  key: 1,
1528
1554
  justify: "space-between",
1529
1555
  align: "center",
@@ -1568,21 +1594,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1568
1594
  clear: handleClearSelection
1569
1595
  }, void 0, true) : createCommentVNode("v-if", true)
1570
1596
  ]),
1571
- _ctx.showPagination ? (openBlock(), createBlock(unref(Flex), {
1597
+ showPaginationControls.value ? (openBlock(), createBlock(unref(Flex), {
1572
1598
  key: 0,
1573
1599
  justify: paginationJustify.value,
1574
1600
  class: "ext-table-pagination"
1575
1601
  }, {
1576
1602
  default: withCtx(() => [
1577
- createVNode(unref(Pagination), {
1578
- current: currentPage.value,
1579
- "page-size": pageSize.value,
1580
- total: total.value,
1581
- "show-total": _ctx.showTotal,
1582
- "page-size-options": _ctx.pageSizeOptions,
1583
- "show-size-changer": _ctx.showSizeChanger,
1584
- onChange: onPageChange
1585
- }, null, 8, ["current", "page-size", "total", "show-total", "page-size-options", "show-size-changer"])
1603
+ createVNode(
1604
+ unref(Pagination),
1605
+ normalizeProps(guardReactiveProps(paginationBindings.value)),
1606
+ null,
1607
+ 16
1608
+ /* FULL_PROPS */
1609
+ )
1586
1610
  ]),
1587
1611
  _: 1
1588
1612
  /* STABLE */