@ljweb/layout-antdv-v4 0.1.0-beta.0 → 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 (60) hide show
  1. package/README.md +7 -11
  2. package/dist/style.css +169 -83
  3. package/esm/assets/style.css +169 -83
  4. package/esm/components/color-input/ColorInput.js +110 -41
  5. package/esm/components/color-input/ColorInput.js.map +1 -1
  6. package/esm/components/color-input/helpers.js +2 -3
  7. package/esm/components/color-input/helpers.js.map +1 -1
  8. package/esm/components/ext-table/ExtTable.vue.js +1 -1
  9. package/esm/components/ext-table/ExtTable2.vue.js +55 -31
  10. package/esm/components/ext-table/ExtTable2.vue.js.map +1 -1
  11. package/esm/components/index.js +36 -38
  12. package/esm/components/index.js.map +1 -1
  13. package/esm/index.js +36 -38
  14. package/esm/index.js.map +1 -1
  15. package/lib/assets/style.css +169 -83
  16. package/lib/components/color-input/ColorInput.js +110 -39
  17. package/lib/components/color-input/ColorInput.js.map +1 -1
  18. package/lib/components/color-input/helpers.js +2 -3
  19. package/lib/components/color-input/helpers.js.map +1 -1
  20. package/lib/components/ext-table/ExtTable.vue.js +1 -1
  21. package/lib/components/ext-table/ExtTable2.vue.js +55 -31
  22. package/lib/components/ext-table/ExtTable2.vue.js.map +1 -1
  23. package/lib/components/index.js +0 -2
  24. package/lib/components/index.js.map +1 -1
  25. package/lib/index.js +0 -2
  26. package/lib/index.js.map +1 -1
  27. package/package.json +1 -6
  28. package/src/components/color-input/style.less +48 -0
  29. package/types/components/color-input/ColorInput.d.ts +10 -0
  30. package/types/components/color-input/helpers.d.ts +8 -2
  31. package/types/components/config-provider/ConfigProvider.d.ts +1 -1
  32. package/types/components/ext-table/ExtTable.vue.d.ts +6 -6
  33. package/types/components/ext-table/types.d.ts +5 -1
  34. package/types/components/index.d.ts +0 -1
  35. package/types/components/locale-dropdown/LocaleDropdown.d.ts +1 -1
  36. package/esm/components/async-table/AsyncTable.js +0 -290
  37. package/esm/components/async-table/AsyncTable.js.map +0 -1
  38. package/esm/components/async-table/helpers.js +0 -71
  39. package/esm/components/async-table/helpers.js.map +0 -1
  40. package/esm/components/async-table/index.js +0 -6
  41. package/esm/components/async-table/index.js.map +0 -1
  42. package/esm/components/async-table/style.js +0 -2
  43. package/esm/components/async-table/style.js.map +0 -1
  44. package/esm/components/async-table/types.js +0 -2
  45. package/esm/components/async-table/types.js.map +0 -1
  46. package/lib/components/async-table/AsyncTable.js +0 -290
  47. package/lib/components/async-table/AsyncTable.js.map +0 -1
  48. package/lib/components/async-table/helpers.js +0 -71
  49. package/lib/components/async-table/helpers.js.map +0 -1
  50. package/lib/components/async-table/index.js +0 -6
  51. package/lib/components/async-table/index.js.map +0 -1
  52. package/lib/components/async-table/style.js +0 -3
  53. package/lib/components/async-table/style.js.map +0 -1
  54. package/lib/components/async-table/types.js +0 -2
  55. package/lib/components/async-table/types.js.map +0 -1
  56. package/types/components/async-table/AsyncTable.d.ts +0 -413
  57. package/types/components/async-table/helpers.d.ts +0 -18
  58. package/types/components/async-table/index.d.ts +0 -2
  59. package/types/components/async-table/style.d.ts +0 -1
  60. package/types/components/async-table/types.d.ts +0 -50
@@ -7,9 +7,8 @@ function colorPickerValue(value) {
7
7
  return tinycolor__default.default(value || "#000000").toHexString();
8
8
  }
9
9
  function colorWithAlpha(value, alpha, disableAlpha = false) {
10
- const color = tinycolor__default.default(value);
11
- if (disableAlpha) return color.toHexString();
12
- return color.setAlpha(Math.max(0, Math.min(1, alpha))).toRgbString();
10
+ if (disableAlpha) return colorPickerValue(value);
11
+ return tinycolor__default.default(value).setAlpha(Math.max(0, Math.min(1, alpha))).toRgbString();
13
12
  }
14
13
  function colorAlpha(value) {
15
14
  return tinycolor__default.default(value || "#000000").getAlpha();
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../src/components/color-input/helpers.ts"],"sourcesContent":["import tinycolor from 'tinycolor2';\n\nexport function colorPickerValue(value?: string) {\n return tinycolor(value || '#000000').toHexString();\n}\n\nexport function colorWithAlpha(value: string, alpha: number, disableAlpha = false) {\n const color = tinycolor(value);\n if (disableAlpha) return color.toHexString();\n return color.setAlpha(Math.max(0, Math.min(1, alpha))).toRgbString();\n}\n\nexport function colorAlpha(value?: string) {\n return tinycolor(value || '#000000').getAlpha();\n}\n"],"names":["tinycolor"],"mappings":";;;;;AAEO,SAAS,iBAAiB,OAAgB;AAC/C,SAAOA,2BAAU,SAAS,SAAS,EAAE,YAAA;AACvC;AAEO,SAAS,eAAe,OAAe,OAAe,eAAe,OAAO;AACjF,QAAM,QAAQA,mBAAAA,QAAU,KAAK;AAC7B,MAAI,aAAc,QAAO,MAAM,YAAA;AAC/B,SAAO,MAAM,SAAS,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,YAAA;AACzD;AAEO,SAAS,WAAW,OAAgB;AACzC,SAAOA,2BAAU,SAAS,SAAS,EAAE,SAAA;AACvC;;;;"}
1
+ {"version":3,"file":"helpers.js","sources":["../../../src/components/color-input/helpers.ts"],"sourcesContent":["import tinycolor from 'tinycolor2';\n\ntype ColorValue = string | { h: number; s: number; v: number };\n\nexport function colorPickerValue(value?: ColorValue) {\n return tinycolor(value || '#000000').toHexString();\n}\n\nexport function colorWithAlpha(value: ColorValue, alpha: number, disableAlpha = false) {\n if (disableAlpha) return colorPickerValue(value);\n return tinycolor(value)\n .setAlpha(Math.max(0, Math.min(1, alpha)))\n .toRgbString();\n}\n\nexport function colorAlpha(value?: string) {\n return tinycolor(value || '#000000').getAlpha();\n}\n"],"names":["tinycolor"],"mappings":";;;;;AAIO,SAAS,iBAAiB,OAAoB;AACnD,SAAOA,2BAAU,SAAS,SAAS,EAAE,YAAA;AACvC;AAEO,SAAS,eAAe,OAAmB,OAAe,eAAe,OAAO;AACrF,MAAI,aAAc,QAAO,iBAAiB,KAAK;AAC/C,SAAOA,mBAAAA,QAAU,KAAK,EACnB,SAAS,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC,CAAC,EACxC,YAAA;AACL;AAEO,SAAS,WAAW,OAAgB;AACzC,SAAOA,2BAAU,SAAS,SAAS,EAAE,SAAA;AACvC;;;;"}
@@ -3,6 +3,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3
3
  const ExtTable_vue_vue_type_script_setup_true_lang = require("./ExtTable2.vue.js");
4
4
  ;/* empty css */
5
5
  const _pluginVue_exportHelper = require("../../_virtual/_plugin-vue_export-helper.js");
6
- const ExtTable = /* @__PURE__ */ _pluginVue_exportHelper.default(ExtTable_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-60f82f19"]]);
6
+ const ExtTable = /* @__PURE__ */ _pluginVue_exportHelper.default(ExtTable_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-8476b82b"]]);
7
7
  exports.default = ExtTable;
8
8
  //# sourceMappingURL=ExtTable.vue.js.map
@@ -25,7 +25,7 @@ const ColumnSetting = require("./ColumnSetting.vue.js");
25
25
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
26
26
  const dayjs__default = /* @__PURE__ */ _interopDefault(dayjs);
27
27
  const sortablejs__default = /* @__PURE__ */ _interopDefault(sortablejs);
28
- const _withScopeId = (n) => (vue.pushScopeId("data-v-60f82f19"), n = n(), vue.popScopeId(), n);
28
+ const _withScopeId = (n) => (vue.pushScopeId("data-v-8476b82b"), n = n(), vue.popScopeId(), n);
29
29
  const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode(
30
30
  "svg",
31
31
  {
@@ -62,12 +62,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
62
62
  formatMappings: {},
63
63
  prefixCls: { default: void 0 },
64
64
  size: {},
65
+ scroll: {},
65
66
  dataSource: { default: void 0 },
66
67
  toolbar: { default: void 0 },
67
68
  fixedColumns: {},
68
69
  requiredColumns: {},
69
70
  tableId: { default: void 0 },
70
71
  showPagination: { type: Boolean, default: true },
72
+ paginationProps: {},
71
73
  paginationPosition: { default: "right" },
72
74
  defaultPageSize: { default: 20 },
73
75
  pageSizeOptions: { default: () => components_extTable_helpers.TABLE_PAGE_SIZE_OPTIONS },
@@ -438,10 +440,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
438
440
  },
439
441
  { immediate: true }
440
442
  );
441
- const loadData = (isResetPage = false) => {
442
- if (isResetPage) {
443
- currentPage.value = 1;
444
- }
443
+ let queryVersion = 0;
444
+ const loadPage = (canRetryLastPage = true) => {
445
+ const version = ++queryVersion;
445
446
  return new Promise((resolve) => {
446
447
  isLoading.value = true;
447
448
  const queryParams = {
@@ -451,9 +452,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
451
452
  },
452
453
  ...props.sortRemote ? { sorter: tableSorter.value } : {},
453
454
  success: (data = { list: [], count: 0 }) => {
455
+ if (version !== queryVersion) return resolve();
454
456
  if (data.list.length === 0 && props.showPagination && currentPage.value > 1) {
455
- currentPage.value--;
456
- loadData().then(resolve);
457
+ const lastPage = Math.max(1, Math.ceil(data.count / pageSize.value));
458
+ currentPage.value = canRetryLastPage && lastPage < currentPage.value ? lastPage : 1;
459
+ loadPage(false).then(resolve);
457
460
  return;
458
461
  }
459
462
  isLoading.value = false;
@@ -465,6 +468,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
465
468
  resolve();
466
469
  },
467
470
  fail: (err) => {
471
+ if (version !== queryVersion) return resolve();
468
472
  isLoading.value = false;
469
473
  if (err && lodashEs.isPlainObject(err) && err.message) {
470
474
  antDesignVue.message.error({
@@ -484,6 +488,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
484
488
  emits("query", queryParams);
485
489
  });
486
490
  };
491
+ const loadData = (isResetPage = false) => {
492
+ if (isResetPage) currentPage.value = 1;
493
+ return loadPage();
494
+ };
487
495
  const onTableChange = (_pagination, _filters, sorter, extra) => {
488
496
  emits("change", _pagination, _filters, sorter, extra);
489
497
  if (!props.sortRemote) {
@@ -519,6 +527,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
519
527
  refreshColumns(true);
520
528
  };
521
529
  const reset = () => {
530
+ queryVersion++;
522
531
  total.value = 0;
523
532
  pageSize.value = props.defaultPageSize;
524
533
  currentPage.value = 1;
@@ -758,6 +767,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
758
767
  scheduleUndefinedColumnWidthMeasurement();
759
768
  });
760
769
  vue.onUnmounted(() => {
770
+ queryVersion++;
761
771
  isTableMounted = false;
762
772
  columnWidthMeasureVersion++;
763
773
  destroySortable();
@@ -768,6 +778,21 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
768
778
  pageSize.value = size;
769
779
  loadData();
770
780
  };
781
+ const paginationBindings = vue.computed(
782
+ () => props.paginationProps ?? {
783
+ current: currentPage.value,
784
+ pageSize: pageSize.value,
785
+ total: total.value,
786
+ showTotal: props.showTotal,
787
+ pageSizeOptions: props.pageSizeOptions,
788
+ showSizeChanger: props.showSizeChanger,
789
+ onChange: onPageChange
790
+ }
791
+ );
792
+ const showPaginationControls = vue.computed(() => {
793
+ const { hideOnSinglePage, total: total2 = 0, pageSize: pageSize2, defaultPageSize = 10 } = paginationBindings.value;
794
+ return props.showPagination && (!hideOnSinglePage || total2 > (pageSize2 ?? defaultPageSize));
795
+ });
771
796
  const isSlot = (column, type) => {
772
797
  return lodashEs.get(column, "format.type") === type;
773
798
  };
@@ -801,7 +826,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
801
826
  return lodashEs.get(row, column.dataIndex, defaultValue || props.emptyValue);
802
827
  };
803
828
  const formatIndex = (index) => {
804
- return (currentPage.value - 1) * pageSize.value + index + 1;
829
+ const current = props.paginationProps?.current ?? currentPage.value;
830
+ const size = props.paginationProps?.pageSize ?? pageSize.value;
831
+ return (current - 1) * size + index + 1;
805
832
  };
806
833
  const formatFileType = (row, column) => {
807
834
  const value = lodashEs.get(row, column.dataIndex);
@@ -1187,6 +1214,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
1187
1214
  disabled: vue.unref(isNestedExtTable) || !_ctx.scrollTable,
1188
1215
  "row-selection": computedRowSelection.value,
1189
1216
  size: _ctx.size,
1217
+ scroll: _ctx.scroll,
1190
1218
  bordered: _ctx.bordered,
1191
1219
  columns: columnList.value,
1192
1220
  loading: isLoading.value,
@@ -1453,7 +1481,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
1453
1481
  ]),
1454
1482
  key: "2"
1455
1483
  } : void 0,
1456
- _ctx.showPagination || computedBatchOperations.value && computedBatchOperations.value.length > 0 || _ctx.$slots["batch-operators"] ? {
1484
+ showPaginationControls.value || computedBatchOperations.value && computedBatchOperations.value.length > 0 || _ctx.$slots["batch-operators"] ? {
1457
1485
  name: "default",
1458
1486
  fn: vue.withCtx(() => [
1459
1487
  vue.createVNode(vue.unref(antDesignVue.Flex), {
@@ -1500,21 +1528,19 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
1500
1528
  clear: handleClearSelection
1501
1529
  }, void 0, true) : vue.createCommentVNode("v-if", true)
1502
1530
  ]),
1503
- _ctx.showPagination ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Flex), {
1531
+ showPaginationControls.value ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Flex), {
1504
1532
  key: 0,
1505
1533
  justify: paginationJustify.value,
1506
1534
  class: "ext-table-pagination"
1507
1535
  }, {
1508
1536
  default: vue.withCtx(() => [
1509
- vue.createVNode(vue.unref(antDesignVue.Pagination), {
1510
- current: currentPage.value,
1511
- "page-size": pageSize.value,
1512
- total: total.value,
1513
- "show-total": _ctx.showTotal,
1514
- "page-size-options": _ctx.pageSizeOptions,
1515
- "show-size-changer": _ctx.showSizeChanger,
1516
- onChange: onPageChange
1517
- }, null, 8, ["current", "page-size", "total", "show-total", "page-size-options", "show-size-changer"])
1537
+ vue.createVNode(
1538
+ vue.unref(antDesignVue.Pagination),
1539
+ vue.normalizeProps(vue.guardReactiveProps(paginationBindings.value)),
1540
+ null,
1541
+ 16
1542
+ /* FULL_PROPS */
1543
+ )
1518
1544
  ]),
1519
1545
  _: 1
1520
1546
  /* STABLE */
@@ -1526,9 +1552,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
1526
1552
  ]),
1527
1553
  key: "3"
1528
1554
  } : void 0
1529
- ]), 1040, ["disabled", "row-selection", "size", "bordered", "columns", "loading", "data-source", "row-key"]),
1555
+ ]), 1040, ["disabled", "row-selection", "size", "scroll", "bordered", "columns", "loading", "data-source", "row-key"]),
1530
1556
  vue.createCommentVNode(" pagination "),
1531
- _ctx.showPagination || computedBatchOperations.value && computedBatchOperations.value.length > 0 || _ctx.$slots["batch-operators"] ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Flex), {
1557
+ showPaginationControls.value || computedBatchOperations.value && computedBatchOperations.value.length > 0 || _ctx.$slots["batch-operators"] ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Flex), {
1532
1558
  key: 1,
1533
1559
  justify: "space-between",
1534
1560
  align: "center",
@@ -1573,21 +1599,19 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
1573
1599
  clear: handleClearSelection
1574
1600
  }, void 0, true) : vue.createCommentVNode("v-if", true)
1575
1601
  ]),
1576
- _ctx.showPagination ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Flex), {
1602
+ showPaginationControls.value ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Flex), {
1577
1603
  key: 0,
1578
1604
  justify: paginationJustify.value,
1579
1605
  class: "ext-table-pagination"
1580
1606
  }, {
1581
1607
  default: vue.withCtx(() => [
1582
- vue.createVNode(vue.unref(antDesignVue.Pagination), {
1583
- current: currentPage.value,
1584
- "page-size": pageSize.value,
1585
- total: total.value,
1586
- "show-total": _ctx.showTotal,
1587
- "page-size-options": _ctx.pageSizeOptions,
1588
- "show-size-changer": _ctx.showSizeChanger,
1589
- onChange: onPageChange
1590
- }, null, 8, ["current", "page-size", "total", "show-total", "page-size-options", "show-size-changer"])
1608
+ vue.createVNode(
1609
+ vue.unref(antDesignVue.Pagination),
1610
+ vue.normalizeProps(vue.guardReactiveProps(paginationBindings.value)),
1611
+ null,
1612
+ 16
1613
+ /* FULL_PROPS */
1614
+ )
1591
1615
  ]),
1592
1616
  _: 1
1593
1617
  /* STABLE */