@94ai/nf-table 8.0.12 → 8.0.14

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/lib/index.d.ts CHANGED
@@ -92,6 +92,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
92
92
  type: import("vue-demi").PropType<boolean>;
93
93
  default: boolean;
94
94
  };
95
+ detectResize: {
96
+ type: import("vue-demi").PropType<boolean>;
97
+ default: boolean;
98
+ };
95
99
  dragCached: {
96
100
  type: import("vue-demi").PropType<boolean>;
97
101
  default: boolean;
@@ -383,6 +387,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
383
387
  type: import("vue-demi").PropType<boolean>;
384
388
  default: boolean;
385
389
  };
390
+ detectResize: {
391
+ type: import("vue-demi").PropType<boolean>;
392
+ default: boolean;
393
+ };
386
394
  dragCached: {
387
395
  type: import("vue-demi").PropType<boolean>;
388
396
  default: boolean;
@@ -612,6 +620,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
612
620
  pageChangeSearchApi: boolean;
613
621
  pageKeys: string[];
614
622
  setEasyConf: boolean;
623
+ detectResize: boolean;
615
624
  dragCached: boolean;
616
625
  emptyImageSize: number;
617
626
  emptyText: string;
@@ -753,6 +762,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
753
762
  type: import("vue-demi").PropType<boolean>;
754
763
  default: boolean;
755
764
  };
765
+ detectResize: {
766
+ type: import("vue-demi").PropType<boolean>;
767
+ default: boolean;
768
+ };
756
769
  dragCached: {
757
770
  type: import("vue-demi").PropType<boolean>;
758
771
  default: boolean;
@@ -1049,6 +1062,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1049
1062
  'page-size': number;
1050
1063
  pageKeys: string[];
1051
1064
  }>;
1065
+ resizeTable: () => void;
1052
1066
  }> & import("vue/types/v3-component-options").ExtractComputedReturns<{}> & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
1053
1067
  background: {
1054
1068
  type: import("vue-demi").PropType<string>;
@@ -1142,6 +1156,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1142
1156
  type: import("vue-demi").PropType<boolean>;
1143
1157
  default: boolean;
1144
1158
  };
1159
+ detectResize: {
1160
+ type: import("vue-demi").PropType<boolean>;
1161
+ default: boolean;
1162
+ };
1145
1163
  dragCached: {
1146
1164
  type: import("vue-demi").PropType<boolean>;
1147
1165
  default: boolean;
@@ -1433,6 +1451,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1433
1451
  type: import("vue-demi").PropType<boolean>;
1434
1452
  default: boolean;
1435
1453
  };
1454
+ detectResize: {
1455
+ type: import("vue-demi").PropType<boolean>;
1456
+ default: boolean;
1457
+ };
1436
1458
  dragCached: {
1437
1459
  type: import("vue-demi").PropType<boolean>;
1438
1460
  default: boolean;
@@ -1729,6 +1751,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1729
1751
  'page-size': number;
1730
1752
  pageKeys: string[];
1731
1753
  }>;
1754
+ resizeTable: () => void;
1732
1755
  }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
1733
1756
  fieldsChange: (event: string[]) => void;
1734
1757
  "update:showColumn": (event: string[] | undefined) => void;
@@ -1760,6 +1783,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1760
1783
  pageChangeSearchApi: boolean;
1761
1784
  pageKeys: string[];
1762
1785
  setEasyConf: boolean;
1786
+ detectResize: boolean;
1763
1787
  dragCached: boolean;
1764
1788
  emptyImageSize: number;
1765
1789
  emptyText: string;
@@ -1902,6 +1926,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1902
1926
  type: import("vue-demi").PropType<boolean>;
1903
1927
  default: boolean;
1904
1928
  };
1929
+ detectResize: {
1930
+ type: import("vue-demi").PropType<boolean>;
1931
+ default: boolean;
1932
+ };
1905
1933
  dragCached: {
1906
1934
  type: import("vue-demi").PropType<boolean>;
1907
1935
  default: boolean;
@@ -5986,6 +5986,12 @@ __sfc_main.props = {
5986
5986
  type: Boolean,
5987
5987
  default: false
5988
5988
  },
5989
+ detectResize: {
5990
+ key: "detectResize",
5991
+ required: false,
5992
+ type: Boolean,
5993
+ default: false
5994
+ },
5989
5995
  dragCached: {
5990
5996
  key: "dragCached",
5991
5997
  required: false,
@@ -6840,6 +6846,7 @@ __sfc_main.setup = (__props, __ctx) => {
6840
6846
  columnCachedData[column.property] = column.width;
6841
6847
  await commonUtils.CachedManager.asyncCachedSet(`${cStorageKey.value}$drag-column-width`, columnCachedData);
6842
6848
  }
6849
+ resizeTable();
6843
6850
  await ((_b = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b.call(_a2, newWidth, oldWidth, column, event));
6844
6851
  };
6845
6852
  async function clearDragCached() {
@@ -6916,6 +6923,39 @@ __sfc_main.setup = (__props, __ctx) => {
6916
6923
  }
6917
6924
  });
6918
6925
  };
6926
+ const resizeTable = () => {
6927
+ if (props.detectResize) {
6928
+ const hasLeftFixed = props.columns.find((item) => item.attr.fixed === "left" || item.attr.fixed === true);
6929
+ const hasRightFixed = props.columns.find((item) => item.attr.fixed === "right");
6930
+ if (!hasLeftFixed && !hasRightFixed) {
6931
+ return;
6932
+ }
6933
+ vueDemi.nextTick(() => {
6934
+ try {
6935
+ if (elTableRef.value) {
6936
+ const childrenEle = elTableRef.value.$el.children;
6937
+ const eleChildrenContent = childrenEle[2].children[0].children[1].children;
6938
+ for (let i = 0; i < (eleChildrenContent == null ? void 0 : eleChildrenContent["length"]); i++) {
6939
+ const offsetHeight = eleChildrenContent[i].offsetHeight + "px";
6940
+ if (hasLeftFixed) {
6941
+ const eleChildrenFixLeft = childrenEle[3].children[1].children[0].children[1].children;
6942
+ eleChildrenFixLeft[i].style.height = offsetHeight;
6943
+ }
6944
+ if (hasRightFixed) {
6945
+ const eleChildrenFixRight = childrenEle[4].children[1].children[0].children[1].children;
6946
+ eleChildrenFixRight[i].style.height = offsetHeight;
6947
+ }
6948
+ }
6949
+ vueDemi.nextTick(() => {
6950
+ doLayout();
6951
+ });
6952
+ }
6953
+ } catch (err) {
6954
+ console.error(err);
6955
+ }
6956
+ });
6957
+ }
6958
+ };
6919
6959
  vueDemi.onMounted(() => {
6920
6960
  calcTableHeight();
6921
6961
  props.columns.forEach((i) => {
@@ -7102,7 +7142,8 @@ __sfc_main.setup = (__props, __ctx) => {
7102
7142
  /** 切换页码 */
7103
7143
  handleCurrentChange,
7104
7144
  /** 当前页码 */
7105
- pageAttrs: vueDemi.computed(() => cPageAttrs)
7145
+ pageAttrs: vueDemi.computed(() => cPageAttrs),
7146
+ resizeTable
7106
7147
  });
7107
7148
  };
7108
7149
  __sfc_main.components = Object.assign({
@@ -5984,6 +5984,12 @@ __sfc_main.props = {
5984
5984
  type: Boolean,
5985
5985
  default: false
5986
5986
  },
5987
+ detectResize: {
5988
+ key: "detectResize",
5989
+ required: false,
5990
+ type: Boolean,
5991
+ default: false
5992
+ },
5987
5993
  dragCached: {
5988
5994
  key: "dragCached",
5989
5995
  required: false,
@@ -6838,6 +6844,7 @@ __sfc_main.setup = (__props, __ctx) => {
6838
6844
  columnCachedData[column.property] = column.width;
6839
6845
  await CachedManager.asyncCachedSet(`${cStorageKey.value}$drag-column-width`, columnCachedData);
6840
6846
  }
6847
+ resizeTable();
6841
6848
  await ((_b = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b.call(_a2, newWidth, oldWidth, column, event));
6842
6849
  };
6843
6850
  async function clearDragCached() {
@@ -6914,6 +6921,39 @@ __sfc_main.setup = (__props, __ctx) => {
6914
6921
  }
6915
6922
  });
6916
6923
  };
6924
+ const resizeTable = () => {
6925
+ if (props.detectResize) {
6926
+ const hasLeftFixed = props.columns.find((item) => item.attr.fixed === "left" || item.attr.fixed === true);
6927
+ const hasRightFixed = props.columns.find((item) => item.attr.fixed === "right");
6928
+ if (!hasLeftFixed && !hasRightFixed) {
6929
+ return;
6930
+ }
6931
+ nextTick(() => {
6932
+ try {
6933
+ if (elTableRef.value) {
6934
+ const childrenEle = elTableRef.value.$el.children;
6935
+ const eleChildrenContent = childrenEle[2].children[0].children[1].children;
6936
+ for (let i = 0; i < (eleChildrenContent == null ? void 0 : eleChildrenContent["length"]); i++) {
6937
+ const offsetHeight = eleChildrenContent[i].offsetHeight + "px";
6938
+ if (hasLeftFixed) {
6939
+ const eleChildrenFixLeft = childrenEle[3].children[1].children[0].children[1].children;
6940
+ eleChildrenFixLeft[i].style.height = offsetHeight;
6941
+ }
6942
+ if (hasRightFixed) {
6943
+ const eleChildrenFixRight = childrenEle[4].children[1].children[0].children[1].children;
6944
+ eleChildrenFixRight[i].style.height = offsetHeight;
6945
+ }
6946
+ }
6947
+ nextTick(() => {
6948
+ doLayout();
6949
+ });
6950
+ }
6951
+ } catch (err) {
6952
+ console.error(err);
6953
+ }
6954
+ });
6955
+ }
6956
+ };
6917
6957
  onMounted(() => {
6918
6958
  calcTableHeight();
6919
6959
  props.columns.forEach((i) => {
@@ -7100,7 +7140,8 @@ __sfc_main.setup = (__props, __ctx) => {
7100
7140
  /** 切换页码 */
7101
7141
  handleCurrentChange,
7102
7142
  /** 当前页码 */
7103
- pageAttrs: computed(() => cPageAttrs)
7143
+ pageAttrs: computed(() => cPageAttrs),
7144
+ resizeTable
7104
7145
  });
7105
7146
  };
7106
7147
  __sfc_main.components = Object.assign({
@@ -14,6 +14,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
14
14
  pageChangeSearchApi?: boolean | undefined;
15
15
  pageKeys?: string[] | undefined;
16
16
  setEasyConf?: boolean | undefined;
17
+ detectResize?: boolean | undefined;
17
18
  dragCached?: boolean | undefined;
18
19
  emptyImageSize?: number | undefined;
19
20
  emptyText?: string | undefined;
@@ -95,6 +96,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
95
96
  pageChangeSearchApi: undefined;
96
97
  pageKeys: () => string[];
97
98
  setEasyConf: boolean;
99
+ detectResize: boolean;
98
100
  calHeight: boolean;
99
101
  columnEdit: boolean;
100
102
  columnPosition: string;
@@ -244,6 +246,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
244
246
  'page-size': number;
245
247
  pageKeys: string[];
246
248
  }>;
249
+ resizeTable: () => void;
247
250
  }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
248
251
  fieldsChange: (event: string[]) => void;
249
252
  "update:showColumn": (event: string[] | undefined) => void;
@@ -265,6 +268,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
265
268
  pageChangeSearchApi?: boolean | undefined;
266
269
  pageKeys?: string[] | undefined;
267
270
  setEasyConf?: boolean | undefined;
271
+ detectResize?: boolean | undefined;
268
272
  dragCached?: boolean | undefined;
269
273
  emptyImageSize?: number | undefined;
270
274
  emptyText?: string | undefined;
@@ -346,6 +350,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
346
350
  pageChangeSearchApi: undefined;
347
351
  pageKeys: () => string[];
348
352
  setEasyConf: boolean;
353
+ detectResize: boolean;
349
354
  calHeight: boolean;
350
355
  columnEdit: boolean;
351
356
  columnPosition: string;
@@ -421,6 +426,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
421
426
  pageChangeSearchApi: boolean;
422
427
  pageKeys: string[];
423
428
  setEasyConf: boolean;
429
+ detectResize: boolean;
424
430
  dragCached: boolean;
425
431
  emptyImageSize: number;
426
432
  emptyText: string;
@@ -646,6 +646,7 @@ const props = withDefaults(defineProps<{
646
646
  pageChangeSearchApi?: boolean | undefined, // 分页切换的时候自动查询
647
647
  pageKeys?: string[], // 分页使用的字段
648
648
  setEasyConf?: boolean, // 简易配置
649
+ detectResize?: boolean, // 检测表格内容展开自动同步fix column和 unfix column
649
650
  /**
650
651
  * 开启表格列拖拽缓存记录
651
652
  */
@@ -768,6 +769,7 @@ const props = withDefaults(defineProps<{
768
769
  pageChangeSearchApi: undefined, // 分页切换的时候自动查询
769
770
  pageKeys: () => ['pageNo', 'pageSize'], // 分页使用的字段
770
771
  setEasyConf: false,
772
+ detectResize: false,
771
773
  calHeight: false,
772
774
  columnEdit: false,
773
775
  columnPosition: 'embed',
@@ -1323,6 +1325,7 @@ const headerDragend = async (newWidth, oldWidth, column, event) => {
1323
1325
  columnCachedData[column.property] = column.width
1324
1326
  await CachedManager.asyncCachedSet(`${cStorageKey.value}$drag-column-width`, columnCachedData)
1325
1327
  }
1328
+ resizeTable()
1326
1329
  await props.tableEvents['header-dragend']?.(newWidth, oldWidth, column, event)
1327
1330
  }
1328
1331
 
@@ -1423,6 +1426,44 @@ const searchApi = async (formData = {}, refresh = false) => {
1423
1426
  })
1424
1427
  }
1425
1428
 
1429
+ // 调整table固定列高度
1430
+ const resizeTable = () => {
1431
+ if (props.detectResize) {
1432
+ const hasLeftFixed = props.columns.find(item => item.attr.fixed === 'left' || item.attr.fixed === true)
1433
+ const hasRightFixed = props.columns.find(item => item.attr.fixed === 'right')
1434
+ if (!hasLeftFixed && !hasRightFixed) {
1435
+ return
1436
+ }
1437
+ nextTick(() => {
1438
+ try {
1439
+ if (elTableRef.value) {
1440
+ const childrenEle = elTableRef.value.$el.children
1441
+ /** 内容table */
1442
+ const eleChildrenContent = childrenEle[2].children[0].children[1].children
1443
+ for (let i = 0; i < eleChildrenContent?.['length']; i++) {
1444
+ const offsetHeight = eleChildrenContent[i].offsetHeight + 'px'
1445
+ if (hasLeftFixed) {
1446
+ /** 左侧固定table */
1447
+ const eleChildrenFixLeft = childrenEle[3].children[1].children[0].children[1].children
1448
+ eleChildrenFixLeft[i].style.height = offsetHeight
1449
+ }
1450
+ if (hasRightFixed) {
1451
+ /** 右侧固定table */
1452
+ const eleChildrenFixRight = childrenEle[4].children[1].children[0].children[1].children
1453
+ eleChildrenFixRight[i].style.height = offsetHeight
1454
+ }
1455
+ }
1456
+ nextTick(() => {
1457
+ doLayout()
1458
+ })
1459
+ }
1460
+ } catch (err) {
1461
+ console.error(err)
1462
+ }
1463
+ })
1464
+ }
1465
+ }
1466
+
1426
1467
  onMounted(() => {
1427
1468
  calcTableHeight()
1428
1469
  props.columns.forEach(i => {
@@ -1574,7 +1615,8 @@ defineExpose({
1574
1615
  /** 切换页码 */
1575
1616
  handleCurrentChange,
1576
1617
  /** 当前页码 */
1577
- pageAttrs: computed(() => cPageAttrs)
1618
+ pageAttrs: computed(() => cPageAttrs),
1619
+ resizeTable
1578
1620
  })
1579
1621
 
1580
1622
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-table",
3
- "version": "8.0.12",
3
+ "version": "8.0.14",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,13 +14,13 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/common-utils": "^8.0.12",
18
- "@94ai/nf-button": "^8.0.12",
19
- "@94ai/nf-drawer": "^8.0.12",
20
- "@94ai/nf-message": "^8.0.12",
21
- "@94ai/nf-search-form": "^8.0.12",
22
- "@94ai/nf-tag": "^8.0.12",
23
- "@94ai/nf-theme-chalk": "^8.0.12",
17
+ "@94ai/common-utils": "^8.0.14",
18
+ "@94ai/nf-button": "^8.0.14",
19
+ "@94ai/nf-drawer": "^8.0.14",
20
+ "@94ai/nf-message": "^8.0.14",
21
+ "@94ai/nf-search-form": "^8.0.14",
22
+ "@94ai/nf-tag": "^8.0.14",
23
+ "@94ai/nf-theme-chalk": "^8.0.14",
24
24
  "idb-keyval": "^6.2.1",
25
25
  "vue-demi": "^0.14.5",
26
26
  "vue-router": "3.6.4",
@@ -39,5 +39,5 @@
39
39
  "types": "lib/index.d.ts",
40
40
  "main": "lib/nf-table.cjs.js",
41
41
  "module": "lib/nf-table.esm-bundler.js",
42
- "gitHead": "dd2adc2b66c074a49c7a33477c806464d85ee254"
42
+ "gitHead": "d72020ef037faebeb18b1e628a46bacb30006437"
43
43
  }