3h1-ui 2.14.87 → 2.14.89

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.
package/es/index.js CHANGED
@@ -11621,7 +11621,9 @@ function useFormEvents({
11621
11621
  if (typeof componentProps === "function") {
11622
11622
  _props = _props({ formModel });
11623
11623
  }
11624
- formModel[key2] = value ? (_props == null ? void 0 : _props.valueFormat) ? value : dateUtil(value) : null;
11624
+ if (typeof value !== "string")
11625
+ value = dayjs(value);
11626
+ formModel[key2] = value ? (_props == null ? void 0 : _props.valueFormat) ? dayjs(value).format(_props == null ? void 0 : _props.valueFormat) : dateUtil(value) : null;
11625
11627
  }
11626
11628
  } else {
11627
11629
  formModel[key2] = value;
@@ -14693,16 +14695,30 @@ function handleItem(item, ellipsis) {
14693
14695
  handleChildren(children, !!ellipsis);
14694
14696
  }
14695
14697
  }
14696
- function handleColumnResize(propsRef, columns) {
14698
+ function handleColumnResize(propsRef, columns, wrapRef) {
14699
+ var _a2, _b, _c;
14700
+ const tableWidth = (_c = (_b = (_a2 = wrapRef.value) == null ? void 0 : _a2.querySelector) == null ? void 0 : _b.call(_a2, ".ant-table-body")) == null ? void 0 : _c.clientWidth;
14701
+ const selectWidth = 60;
14702
+ const [sumWidth, sumLength] = columns.reduce(
14703
+ ([sumWidth2, length2], cur) => {
14704
+ if (typeof cur.width === "number") {
14705
+ return [sumWidth2 + cur.width, ++length2];
14706
+ }
14707
+ return [sumWidth2, length2];
14708
+ },
14709
+ [0, 0]
14710
+ );
14711
+ const length = columns.length;
14712
+ const colWidth = tableWidth ? (tableWidth - sumWidth - selectWidth) / (length - sumLength) : 100;
14697
14713
  columns.forEach((item) => {
14698
- if (item.flag === "ACTION")
14714
+ if (item.flag)
14699
14715
  return;
14700
14716
  if (propsRef.value.resizable) {
14701
- item.width = item.width || 100;
14717
+ item.width = item.width || colWidth;
14702
14718
  item.resizable = item.resizable === void 0 ? true : item.resizable;
14703
14719
  } else {
14704
14720
  if (item.resizable) {
14705
- item.width = item.width || 100;
14721
+ item.width = item.width || colWidth;
14706
14722
  }
14707
14723
  }
14708
14724
  });
@@ -14771,14 +14787,14 @@ function handleActionColumn(propsRef, columns) {
14771
14787
  });
14772
14788
  }
14773
14789
  }
14774
- function useColumns$1(propsRef, getPaginationRef, tableAction, tableElRef) {
14790
+ function useColumns$1(propsRef, getPaginationRef, tableAction, wrapRef) {
14775
14791
  const columnsRef = ref(unref(propsRef).columns);
14776
14792
  let cacheColumns = unref(propsRef).columns;
14777
14793
  const getColumnsRef = computed(() => {
14778
14794
  const columns = cloneDeep(unref(columnsRef));
14779
14795
  handleIndexColumn(propsRef, getPaginationRef, columns);
14780
14796
  handleActionColumn(propsRef, columns);
14781
- handleColumnResize(propsRef, columns);
14797
+ handleColumnResize(propsRef, columns, wrapRef);
14782
14798
  if (!columns) {
14783
14799
  return [];
14784
14800
  }
@@ -17798,7 +17814,7 @@ const _sfc_main$q = defineComponent({
17798
17814
  getColumnsRef,
17799
17815
  getCacheColumns,
17800
17816
  getColumnsSummary
17801
- } = useColumns$1(getProps, getPaginationInfo, tableActionRef);
17817
+ } = useColumns$1(getProps, getPaginationInfo, tableActionRef, wrapRef);
17802
17818
  const { getScrollRef, redoHeight } = useTableScroll(
17803
17819
  getProps,
17804
17820
  tableElRef,
package/lib/index.js CHANGED
@@ -11645,7 +11645,9 @@ function useFormEvents({
11645
11645
  if (typeof componentProps === "function") {
11646
11646
  _props = _props({ formModel });
11647
11647
  }
11648
- formModel[key2] = value ? (_props == null ? void 0 : _props.valueFormat) ? value : utils.dateUtil(value) : null;
11648
+ if (typeof value !== "string")
11649
+ value = dayjs(value);
11650
+ formModel[key2] = value ? (_props == null ? void 0 : _props.valueFormat) ? dayjs(value).format(_props == null ? void 0 : _props.valueFormat) : utils.dateUtil(value) : null;
11649
11651
  }
11650
11652
  } else {
11651
11653
  formModel[key2] = value;
@@ -14717,16 +14719,30 @@ function handleItem(item, ellipsis) {
14717
14719
  handleChildren(children, !!ellipsis);
14718
14720
  }
14719
14721
  }
14720
- function handleColumnResize(propsRef, columns) {
14722
+ function handleColumnResize(propsRef, columns, wrapRef) {
14723
+ var _a2, _b, _c;
14724
+ const tableWidth = (_c = (_b = (_a2 = wrapRef.value) == null ? void 0 : _a2.querySelector) == null ? void 0 : _b.call(_a2, ".ant-table-body")) == null ? void 0 : _c.clientWidth;
14725
+ const selectWidth = 60;
14726
+ const [sumWidth, sumLength] = columns.reduce(
14727
+ ([sumWidth2, length2], cur) => {
14728
+ if (typeof cur.width === "number") {
14729
+ return [sumWidth2 + cur.width, ++length2];
14730
+ }
14731
+ return [sumWidth2, length2];
14732
+ },
14733
+ [0, 0]
14734
+ );
14735
+ const length = columns.length;
14736
+ const colWidth = tableWidth ? (tableWidth - sumWidth - selectWidth) / (length - sumLength) : 100;
14721
14737
  columns.forEach((item) => {
14722
- if (item.flag === "ACTION")
14738
+ if (item.flag)
14723
14739
  return;
14724
14740
  if (propsRef.value.resizable) {
14725
- item.width = item.width || 100;
14741
+ item.width = item.width || colWidth;
14726
14742
  item.resizable = item.resizable === void 0 ? true : item.resizable;
14727
14743
  } else {
14728
14744
  if (item.resizable) {
14729
- item.width = item.width || 100;
14745
+ item.width = item.width || colWidth;
14730
14746
  }
14731
14747
  }
14732
14748
  });
@@ -14795,14 +14811,14 @@ function handleActionColumn(propsRef, columns) {
14795
14811
  });
14796
14812
  }
14797
14813
  }
14798
- function useColumns$1(propsRef, getPaginationRef, tableAction, tableElRef) {
14814
+ function useColumns$1(propsRef, getPaginationRef, tableAction, wrapRef) {
14799
14815
  const columnsRef = vue.ref(vue.unref(propsRef).columns);
14800
14816
  let cacheColumns = vue.unref(propsRef).columns;
14801
14817
  const getColumnsRef = vue.computed(() => {
14802
14818
  const columns = cloneDeep(vue.unref(columnsRef));
14803
14819
  handleIndexColumn(propsRef, getPaginationRef, columns);
14804
14820
  handleActionColumn(propsRef, columns);
14805
- handleColumnResize(propsRef, columns);
14821
+ handleColumnResize(propsRef, columns, wrapRef);
14806
14822
  if (!columns) {
14807
14823
  return [];
14808
14824
  }
@@ -17822,7 +17838,7 @@ const _sfc_main$q = vue.defineComponent({
17822
17838
  getColumnsRef,
17823
17839
  getCacheColumns,
17824
17840
  getColumnsSummary
17825
- } = useColumns$1(getProps, getPaginationInfo, tableActionRef);
17841
+ } = useColumns$1(getProps, getPaginationInfo, tableActionRef, wrapRef);
17826
17842
  const { getScrollRef, redoHeight } = useTableScroll(
17827
17843
  getProps,
17828
17844
  tableElRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "2.14.87",
3
+ "version": "2.14.89",
4
4
  "description": "",
5
5
  "module": "es/index.js",
6
6
  "main": "lib/index.js",