lew-ui 2.6.6 → 2.6.8

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/dist/index.mjs CHANGED
@@ -7454,7 +7454,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
7454
7454
  delay: props2.delay,
7455
7455
  duration: [250, 250],
7456
7456
  content: text ? sanitizeHtml(text) : lewTextTrimPopRef.value,
7457
- animation: "scale",
7457
+ animation: "scale-subtle",
7458
7458
  hideOnClick: false,
7459
7459
  interactive: true,
7460
7460
  appendTo: () => document.body,
@@ -7578,7 +7578,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
7578
7578
  };
7579
7579
  }
7580
7580
  });
7581
- const LewTextTrim = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-fb6a0a04"]]);
7581
+ const LewTextTrim = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-94021c25"]]);
7582
7582
  const flexProps = {
7583
7583
  direction: {
7584
7584
  type: String,
@@ -8238,7 +8238,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
8238
8238
  };
8239
8239
  }
8240
8240
  });
8241
- const LewMenu = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-4af03d56"]]);
8241
+ const LewMenu = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-1d41bd92"]]);
8242
8242
  const menuTreeModel = {
8243
8243
  modelValue: {
8244
8244
  type: String,
@@ -8371,7 +8371,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
8371
8371
  "lew-menu-tree-item-label-collapsed": unref(collapsed)
8372
8372
  }]),
8373
8373
  style: normalizeStyle({
8374
- paddingLeft: unref(collapsed) ? "0px" : _ctx.renderIcon() ? "36px" : "15px"
8374
+ paddingLeft: unref(collapsed) ? "0px" : _ctx.renderIcon() ? "36px" : "11.5px"
8375
8375
  }),
8376
8376
  onClick: withModifiers(change2, ["stop"])
8377
8377
  }, {
@@ -8426,7 +8426,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
8426
8426
  };
8427
8427
  }
8428
8428
  });
8429
- const LewMenuTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-cba8e1f9"]]);
8429
+ const LewMenuTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-ad7b86db"]]);
8430
8430
  const _sfc_main$Q = /* @__PURE__ */ defineComponent({
8431
8431
  __name: "LewMenuTree",
8432
8432
  props: /* @__PURE__ */ mergeModels(menuTreeProps, {
@@ -15470,7 +15470,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
15470
15470
  };
15471
15471
  }
15472
15472
  });
15473
- const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-08008d58"]]);
15473
+ const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-7a30a8b8"]]);
15474
15474
  const selectMultipleModel = {
15475
15475
  modelValue: {
15476
15476
  type: Array,
@@ -16934,9 +16934,9 @@ const _hoisted_10$1 = { class: "lew-date" };
16934
16934
  const _hoisted_11$1 = { class: "lew-date-control-left" };
16935
16935
  const _hoisted_12$1 = { class: "cur-date" };
16936
16936
  const _hoisted_13$1 = { class: "lew-date-control-right" };
16937
- const _hoisted_14$1 = { class: "lew-date-box" };
16938
- const _hoisted_15$1 = { class: "lew-date-num" };
16939
- const _hoisted_16$1 = ["onClick", "onMouseenter"];
16937
+ const _hoisted_14 = { class: "lew-date-box" };
16938
+ const _hoisted_15 = { class: "lew-date-num" };
16939
+ const _hoisted_16 = ["onClick", "onMouseenter"];
16940
16940
  const _hoisted_17 = {
16941
16941
  key: 0,
16942
16942
  class: "lew-date-item-today"
@@ -17359,13 +17359,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
17359
17359
  ]),
17360
17360
  _: 1
17361
17361
  }),
17362
- createElementVNode("div", _hoisted_14$1, [
17362
+ createElementVNode("div", _hoisted_14, [
17363
17363
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(headDate), (item, index2) => {
17364
17364
  return openBlock(), createElementBlock("div", {
17365
17365
  key: `h${index2}`,
17366
17366
  class: "lew-date-item"
17367
17367
  }, [
17368
- createElementVNode("div", _hoisted_15$1, toDisplayString$1(item), 1)
17368
+ createElementVNode("div", _hoisted_15, toDisplayString$1(item), 1)
17369
17369
  ]);
17370
17370
  }), 128)),
17371
17371
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(state).rightPanel, (item, index2) => {
@@ -17383,7 +17383,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
17383
17383
  class: normalizeClass(["lew-date-value", unref(object2class2)("selected", item)])
17384
17384
  }, toDisplayString$1(item.showDate), 3)
17385
17385
  ], 2)
17386
- ], 42, _hoisted_16$1);
17386
+ ], 42, _hoisted_16);
17387
17387
  }), 128))
17388
17388
  ])
17389
17389
  ])
@@ -21385,6 +21385,11 @@ const tableProps = {
21385
21385
  return true;
21386
21386
  }
21387
21387
  },
21388
+ bordered: {
21389
+ type: Boolean,
21390
+ default: false,
21391
+ description: "是否显示边框"
21392
+ },
21388
21393
  dataSource: {
21389
21394
  type: Array,
21390
21395
  default: () => [],
@@ -21511,25 +21516,22 @@ const SortIcon = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v
21511
21516
  const _hoisted_1$d = { class: "lew-table-wrapper" };
21512
21517
  const _hoisted_2$7 = { class: "lew-table-header" };
21513
21518
  const _hoisted_3$6 = { class: "lew-table-tr" };
21514
- const _hoisted_4$4 = { class: "lew-table-title-span" };
21515
- const _hoisted_5$2 = { class: "lew-table-main" };
21519
+ const _hoisted_4$4 = { class: "lew-table-main" };
21520
+ const _hoisted_5$2 = { class: "lew-table-tr" };
21516
21521
  const _hoisted_6$1 = { class: "lew-table-tr" };
21517
- const _hoisted_7 = { class: "lew-table-title-span" };
21518
- const _hoisted_8 = { class: "lew-table-tr" };
21519
- const _hoisted_9 = { class: "lew-table-title-span" };
21520
- const _hoisted_10 = {
21522
+ const _hoisted_7 = {
21521
21523
  key: 0,
21522
21524
  class: "lew-table-fixed-left"
21523
21525
  };
21524
- const _hoisted_11 = ["onClick", "onMouseenter"];
21525
- const _hoisted_12 = { class: "lew-table-main" };
21526
- const _hoisted_13 = ["onClick", "onMouseenter"];
21527
- const _hoisted_14 = {
21526
+ const _hoisted_8 = ["onClick", "onMouseenter"];
21527
+ const _hoisted_9 = { class: "lew-table-main" };
21528
+ const _hoisted_10 = ["onClick", "onMouseenter"];
21529
+ const _hoisted_11 = {
21528
21530
  key: 1,
21529
21531
  class: "lew-table-fixed-right"
21530
21532
  };
21531
- const _hoisted_15 = ["onMouseenter"];
21532
- const _hoisted_16 = { class: "lew-table-footer" };
21533
+ const _hoisted_12 = ["onMouseenter"];
21534
+ const _hoisted_13 = { class: "lew-table-footer" };
21533
21535
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
21534
21536
  __name: "LewTable",
21535
21537
  props: /* @__PURE__ */ mergeModels(tableProps, {
@@ -21562,148 +21564,146 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
21562
21564
  fixedRightWidth: 0,
21563
21565
  selectedRowsMap: {}
21564
21566
  });
21567
+ const getCheckableWidth = computed(() => {
21568
+ const sizeMap = {
21569
+ small: 50,
21570
+ medium: 60,
21571
+ large: 70
21572
+ };
21573
+ return sizeMap[props2.size];
21574
+ });
21575
+ const getHeadHeight = computed(() => {
21576
+ const sizeMap = {
21577
+ small: 34,
21578
+ medium: 42,
21579
+ large: 50
21580
+ };
21581
+ return sizeMap[props2.size];
21582
+ });
21583
+ const getFontSize = computed(() => {
21584
+ const sizeMap = {
21585
+ small: 13,
21586
+ medium: 14,
21587
+ large: 16
21588
+ };
21589
+ return sizeMap[props2.size];
21590
+ });
21591
+ const getPadding = computed(() => {
21592
+ const paddingMap = {
21593
+ small: "8px 10px",
21594
+ medium: "10px 14px",
21595
+ large: "12px 18px"
21596
+ };
21597
+ return paddingMap[props2.size];
21598
+ });
21599
+ const getEmptyPadding = computed(() => {
21600
+ const paddingMap = {
21601
+ small: 20,
21602
+ medium: 30,
21603
+ large: 40
21604
+ };
21605
+ return paddingMap[props2.size];
21606
+ });
21607
+ const getEmptyProps = computed(() => {
21608
+ const widthMap = {
21609
+ small: 150,
21610
+ medium: 200,
21611
+ large: 250
21612
+ };
21613
+ const fontSizeMap = {
21614
+ small: 13,
21615
+ medium: 14,
21616
+ large: 16
21617
+ };
21618
+ return {
21619
+ width: widthMap[props2.size],
21620
+ fontSize: fontSizeMap[props2.size]
21621
+ };
21622
+ });
21623
+ const calculateColumnWidth = (column) => {
21624
+ if (column.children && column.children.length > 0) {
21625
+ const totalChildWidth = column.children.reduce((sum, child) => {
21626
+ return sum + (calculateColumnWidth(child) || 100);
21627
+ }, 0);
21628
+ column.width = totalChildWidth;
21629
+ return totalChildWidth;
21630
+ }
21631
+ if (!column.width || column.width === 0) {
21632
+ column.width = 100;
21633
+ }
21634
+ return column.width;
21635
+ };
21636
+ const processColumnsWidth = (columns) => {
21637
+ return columns.map((col) => {
21638
+ const cloneCol = { ...col };
21639
+ cloneCol.width = calculateColumnWidth(cloneCol);
21640
+ return cloneCol;
21641
+ });
21642
+ };
21643
+ const formatColumns = computed(() => {
21644
+ return processColumnsWidth(props2.columns);
21645
+ });
21565
21646
  const totalColumnWidth = computed(() => {
21566
- let width = sumBy(props2.columns, "width");
21647
+ let width = sumBy(formatColumns.value, "width");
21567
21648
  if (props2.checkable) width += getCheckableWidth.value;
21568
21649
  return width;
21569
21650
  });
21651
+ const nonFixedHeaderColumns = computed(() => {
21652
+ return formatColumns.value.filter((col) => !col.fixed);
21653
+ });
21654
+ const getFixedHeaderColumns = computed(() => (direction) => {
21655
+ return formatColumns.value.filter((col) => col.fixed === direction);
21656
+ });
21657
+ const getLeafColumns = (columns) => {
21658
+ const result = [];
21659
+ const traverse = (cols) => {
21660
+ cols.forEach((col) => {
21661
+ if (col.children && col.children.length > 0) {
21662
+ traverse(col.children);
21663
+ } else {
21664
+ result.push(col);
21665
+ }
21666
+ });
21667
+ };
21668
+ traverse(columns);
21669
+ return result;
21670
+ };
21570
21671
  const nonFixedColumns = computed(() => {
21571
- return props2.columns.filter((col) => !col.fixed);
21672
+ return getLeafColumns(formatColumns.value).filter((col) => !col.fixed);
21572
21673
  });
21573
21674
  const getFixedColumns = computed(() => (direction) => {
21574
- return props2.columns.filter((col) => col.fixed === direction);
21675
+ return getLeafColumns(formatColumns.value).filter((col) => col.fixed === direction);
21676
+ });
21677
+ const columnLevel = computed(() => {
21678
+ const findMaxDepth = (columns, currentDepth = 1) => {
21679
+ if (!columns || columns.length === 0) return currentDepth;
21680
+ let maxDepth = currentDepth;
21681
+ for (const col of columns) {
21682
+ if (col.children && col.children.length > 0) {
21683
+ const childDepth = findMaxDepth(col.children, currentDepth + 1);
21684
+ maxDepth = Math.max(maxDepth, childDepth);
21685
+ }
21686
+ }
21687
+ return maxDepth;
21688
+ };
21689
+ return findMaxDepth(props2.columns);
21575
21690
  });
21576
21691
  const hasPartialSelection = computed(() => {
21577
21692
  const selectedRowsMap = state.selectedRowsMap;
21578
21693
  return props2.dataSource.some((row) => selectedRowsMap[row[props2.rowKey]]);
21579
21694
  });
21580
- const getColumnStyle = computed(() => (column, row) => {
21581
- var _a;
21582
- const width = column.width;
21583
- const customStyle = row && ((_a = row.tdStyle) == null ? void 0 : _a[column.field]);
21584
- const sizeStyle = `padding:${getPadding.value};fontSize:${getFontSize.value}px;`;
21585
- if (state.isScrollbarVisible || column.fixed) {
21586
- return `${sizeStyle};width: ${width}px;${customStyle}`;
21587
- }
21588
- const fixedWidth = sumBy(
21589
- props2.columns.filter((col) => col.fixed),
21590
- "width"
21591
- ) + (props2.checkable ? getCheckableWidth.value : 0);
21592
- const tdWidth = width / (totalColumnWidth.value - fixedWidth) * (state.scrollClientWidth - fixedWidth);
21593
- return `${sizeStyle};width: ${tdWidth}px;${customStyle}`;
21594
- });
21595
- watch(
21596
- () => props2.dataSource,
21597
- () => {
21598
- state.selectedRowsMap = mapValues(
21599
- keyBy(props2.dataSource, props2.rowKey),
21600
- () => false
21601
- );
21602
- updateAllCheckedState();
21603
- },
21604
- { deep: true }
21605
- );
21606
- watch(selectedKeys, (newVal) => {
21607
- if (props2.checkable) {
21608
- updateSelectedKeys(newVal);
21609
- }
21610
- });
21611
- const initTableObserver = () => {
21612
- resizeObserver = new ResizeObserver(() => {
21613
- state.isInitialized = false;
21614
- handleTableResize();
21615
- });
21616
- resizeObserver.observe(tableRef.value);
21617
- };
21618
- const updateScrollState = () => {
21619
- const element = tableRef.value;
21620
- const { clientWidth, scrollWidth, scrollLeft } = element;
21621
- const scrollThreshold = 10;
21622
- if (scrollWidth === clientWidth) {
21623
- state.hiddenScrollLine = "all";
21624
- return;
21625
- }
21626
- if (scrollLeft < scrollThreshold) {
21627
- state.hiddenScrollLine = "left";
21628
- return;
21629
- }
21630
- if (scrollLeft + clientWidth > scrollWidth - scrollThreshold) {
21631
- state.hiddenScrollLine = "right";
21632
- return;
21633
- }
21634
- state.hiddenScrollLine = "";
21635
- };
21636
- const compTrHeight = () => {
21637
- nextTick(() => {
21638
- (trRefArr.value || []).forEach(
21639
- (element, index2) => {
21640
- if (element) {
21641
- trHeightArr.value[index2] = element.getBoundingClientRect().height;
21642
- }
21643
- }
21644
- );
21645
- });
21695
+ const updateAllCheckedState = () => {
21696
+ const checkedKeys = keys(pickBy(state.selectedRowsMap, Boolean));
21697
+ const allDataKeys = props2.dataSource.map((row) => String(row[props2.rowKey]));
21698
+ const uncheckedKeys = difference(allDataKeys, checkedKeys);
21699
+ state.isAllChecked = isEmpty(uncheckedKeys) && props2.multiple && props2.checkable && checkedKeys.length > 0;
21646
21700
  };
21647
- watch(
21648
- () => trRefArr.value,
21649
- () => {
21650
- compTrHeight();
21651
- },
21652
- {
21653
- deep: true
21654
- }
21655
- );
21656
- watch(
21657
- () => props2.dataSource,
21658
- () => {
21659
- compTrHeight();
21660
- },
21661
- {
21662
- deep: true
21663
- }
21664
- );
21665
- const handleTableResize = throttle(() => {
21666
- const table = tableRef.value;
21667
- if (!table) return;
21668
- compTrHeight();
21669
- let totalWidth = props2.columns.reduce(
21670
- (sum, col) => sum + Number(col.width),
21671
- 0
21672
- );
21673
- if (props2.checkable) {
21674
- totalWidth += getCheckableWidth.value;
21675
- }
21676
- if (fixedLeftRef.value) {
21677
- state.fixedLeftWidth = fixedLeftRef.value.clientWidth || 0;
21678
- }
21679
- if (fixedRightRef.value) {
21680
- state.fixedRightWidth = fixedRightRef.value.clientWidth || 0;
21681
- if (table.clientHeight < table.scrollHeight) {
21682
- state.fixedRightWidth += 6;
21683
- }
21684
- }
21685
- state.scrollClientWidth = table.clientWidth;
21686
- state.isScrollbarVisible = totalWidth > state.scrollClientWidth;
21687
- state.isInitialized = true;
21688
- updateScrollState();
21689
- }, 250);
21690
21701
  const setAllRowsChecked = (checked) => {
21691
- state.selectedRowsMap = mapValues(
21692
- keyBy(props2.dataSource, props2.rowKey),
21693
- () => checked
21694
- );
21702
+ state.selectedRowsMap = mapValues(keyBy(props2.dataSource, props2.rowKey), () => checked);
21695
21703
  if (props2.multiple) {
21696
21704
  selectedKeys.value = checked ? keys(state.selectedRowsMap) : [];
21697
21705
  }
21698
21706
  };
21699
- const updateAllCheckedState = () => {
21700
- const checkedKeys = keys(pickBy(state.selectedRowsMap, Boolean));
21701
- const allDataKeys = props2.dataSource.map(
21702
- (row) => String(row[props2.rowKey])
21703
- );
21704
- const uncheckedKeys = difference(allDataKeys, checkedKeys);
21705
- state.isAllChecked = isEmpty(uncheckedKeys) && props2.multiple && props2.checkable && checkedKeys.length > 0;
21706
- };
21707
21707
  const toggleRowSelection = (row) => {
21708
21708
  if (!props2.checkable) return;
21709
21709
  const rowKey = row[props2.rowKey];
@@ -21720,10 +21720,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
21720
21720
  };
21721
21721
  const updateSelectedKeys = (keys2) => {
21722
21722
  if (props2.multiple) {
21723
- state.selectedRowsMap = mapValues(
21724
- keyBy(props2.dataSource, props2.rowKey),
21725
- () => false
21726
- );
21723
+ state.selectedRowsMap = mapValues(keyBy(props2.dataSource, props2.rowKey), () => false);
21727
21724
  keys2.forEach((key) => {
21728
21725
  state.selectedRowsMap[key] = true;
21729
21726
  });
@@ -21731,11 +21728,37 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
21731
21728
  state.selectedRowsMap = { [keys2]: true };
21732
21729
  }
21733
21730
  };
21734
- const renderCell = ({
21735
- column,
21736
- row,
21737
- index: index2
21738
- }) => {
21731
+ const getHeaderColumnStyle = computed(() => (column, row) => {
21732
+ var _a;
21733
+ const width = column.width;
21734
+ const customStyle = row && ((_a = row.tdStyle) == null ? void 0 : _a[column.field]);
21735
+ const sizeStyle = `fontSize:${getFontSize.value}px;`;
21736
+ if (state.isScrollbarVisible || column.fixed) {
21737
+ return `${sizeStyle};width: ${width}px;${customStyle}`;
21738
+ }
21739
+ const fixedWidth = sumBy(
21740
+ formatColumns.value.filter((col) => col.fixed),
21741
+ "width"
21742
+ ) + (props2.checkable ? getCheckableWidth.value : 0);
21743
+ const tdWidth = width / (totalColumnWidth.value - fixedWidth) * (state.scrollClientWidth - fixedWidth);
21744
+ return `${sizeStyle};width: ${tdWidth}px;${customStyle}`;
21745
+ });
21746
+ const getColumnStyle = computed(() => (column, row) => {
21747
+ var _a;
21748
+ const width = column.width;
21749
+ const customStyle = row && ((_a = row.tdStyle) == null ? void 0 : _a[column.field]);
21750
+ const sizeStyle = `padding: ${getPadding.value}; fontSize:${getFontSize.value}px;`;
21751
+ if (state.isScrollbarVisible || column.fixed) {
21752
+ return `${sizeStyle};width: ${width}px;${customStyle}`;
21753
+ }
21754
+ const fixedWidth = sumBy(
21755
+ formatColumns.value.filter((col) => col.fixed),
21756
+ "width"
21757
+ ) + (props2.checkable ? getCheckableWidth.value : 0);
21758
+ const tdWidth = width / (totalColumnWidth.value - fixedWidth) * (state.scrollClientWidth - fixedWidth);
21759
+ return `${sizeStyle};width: ${tdWidth}px;${customStyle}`;
21760
+ });
21761
+ const renderCell = ({ column, row, index: index2 }) => {
21739
21762
  if (column.customRender) {
21740
21763
  return column.customRender({ row, column, index: index2, text: row[column.field] });
21741
21764
  }
@@ -21752,62 +21775,57 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
21752
21775
  return isString$1(text) ? text : JSON.stringify(text);
21753
21776
  }
21754
21777
  };
21755
- const getCheckableWidth = computed(() => {
21756
- const sizeMap = {
21757
- small: 50,
21758
- medium: 60,
21759
- large: 70
21760
- };
21761
- return sizeMap[props2.size];
21762
- });
21763
- const getHeadHeight = computed(() => {
21764
- const sizeMap = {
21765
- small: 34,
21766
- medium: 42,
21767
- large: 50
21768
- };
21769
- return sizeMap[props2.size];
21770
- });
21771
- const getFontSize = computed(() => {
21772
- const sizeMap = {
21773
- small: 13,
21774
- medium: 14,
21775
- large: 16
21776
- };
21777
- return sizeMap[props2.size];
21778
- });
21779
- const getPadding = computed(() => {
21780
- const paddingMap = {
21781
- small: "8px 10px",
21782
- medium: "10px 14px",
21783
- large: "12px 18px"
21784
- };
21785
- return paddingMap[props2.size];
21786
- });
21787
- const getEmptyPadding = computed(() => {
21788
- const paddingMap = {
21789
- small: 20,
21790
- medium: 30,
21791
- large: 40
21792
- };
21793
- return paddingMap[props2.size];
21794
- });
21795
- const getEmptyProps = computed(() => {
21796
- const widthMap = {
21797
- small: 150,
21798
- medium: 200,
21799
- large: 250
21800
- };
21801
- const fontSizeMap = {
21802
- small: 13,
21803
- medium: 14,
21804
- large: 16
21805
- };
21806
- return {
21807
- width: widthMap[props2.size],
21808
- fontSize: fontSizeMap[props2.size]
21809
- };
21810
- });
21778
+ const readerHeaderTd = ({ column }) => {
21779
+ return h(
21780
+ "div",
21781
+ {
21782
+ class: ["lew-table-td", column.sortable ? "lew-table-td-sortable" : ""],
21783
+ onClick: () => {
21784
+ if (column.sortable) {
21785
+ sort(column);
21786
+ }
21787
+ },
21788
+ style: `display: flex; flex-direction: column; width: ${any2px(
21789
+ column.width
21790
+ )}; justify-content: center; align-items: ${column.x || "start"};`
21791
+ },
21792
+ [
21793
+ h(
21794
+ "span",
21795
+ {
21796
+ style: `padding: ${getPadding.value};
21797
+ display: flex; align-items:center; justify-content: ${column.x};width: ${any2px(
21798
+ column.width
21799
+ )}; height:100%; box-sizing: border-box; `
21800
+ },
21801
+ [
21802
+ h(
21803
+ "span",
21804
+ {
21805
+ class: "lew-table-title-span"
21806
+ },
21807
+ [
21808
+ column == null ? void 0 : column.title,
21809
+ column.sortable && h(SortIcon, {
21810
+ "sort-value": sortValue.value[column.field],
21811
+ size: props2.size,
21812
+ class: "lew-table-sorter"
21813
+ })
21814
+ ]
21815
+ )
21816
+ ]
21817
+ ),
21818
+ (column == null ? void 0 : column.children) && column.children.length > 0 ? h(
21819
+ "div",
21820
+ {
21821
+ class: "lew-table-td-group",
21822
+ style: `display: flex;`
21823
+ },
21824
+ column.children.map((child) => readerHeaderTd({ column: child }))
21825
+ ) : null
21826
+ ]
21827
+ );
21828
+ };
21811
21829
  const sort = (column) => {
21812
21830
  var _a;
21813
21831
  if (column.sortable) {
@@ -21830,19 +21848,62 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
21830
21848
  emit2("sortChange", cloneDeep(sortValue.value));
21831
21849
  }
21832
21850
  };
21833
- watch(
21834
- () => props2.size,
21835
- () => {
21836
- nextTick(() => {
21837
- initTableObserver();
21838
- updateScrollState();
21839
- handleTableResize();
21840
- if (props2.checkable) {
21841
- updateSelectedKeys(selectedKeys.value);
21851
+ const updateScrollState = () => {
21852
+ const element = tableRef.value;
21853
+ const { clientWidth, scrollWidth, scrollLeft } = element;
21854
+ const scrollThreshold = 10;
21855
+ if (scrollWidth === clientWidth) {
21856
+ state.hiddenScrollLine = "all";
21857
+ return;
21858
+ }
21859
+ if (scrollLeft < scrollThreshold) {
21860
+ state.hiddenScrollLine = "left";
21861
+ return;
21862
+ }
21863
+ if (scrollLeft + clientWidth > scrollWidth - scrollThreshold) {
21864
+ state.hiddenScrollLine = "right";
21865
+ return;
21866
+ }
21867
+ state.hiddenScrollLine = "";
21868
+ };
21869
+ const compTrHeight = () => {
21870
+ nextTick(() => {
21871
+ (trRefArr.value || []).forEach((element, index2) => {
21872
+ if (element) {
21873
+ trHeightArr.value[index2] = element.getBoundingClientRect().height;
21842
21874
  }
21843
21875
  });
21876
+ });
21877
+ };
21878
+ const handleTableResize = throttle(() => {
21879
+ const table = tableRef.value;
21880
+ if (!table) return;
21881
+ compTrHeight();
21882
+ let totalWidth = formatColumns.value.reduce((sum, col) => sum + Number(col.width), 0);
21883
+ if (props2.checkable) {
21884
+ totalWidth += getCheckableWidth.value;
21844
21885
  }
21845
- );
21886
+ if (fixedLeftRef.value) {
21887
+ state.fixedLeftWidth = fixedLeftRef.value.clientWidth || 0;
21888
+ }
21889
+ if (fixedRightRef.value) {
21890
+ state.fixedRightWidth = fixedRightRef.value.clientWidth || 0;
21891
+ if (table.clientHeight < table.scrollHeight) {
21892
+ state.fixedRightWidth += 6;
21893
+ }
21894
+ }
21895
+ state.scrollClientWidth = table.clientWidth;
21896
+ state.isScrollbarVisible = totalWidth > state.scrollClientWidth;
21897
+ state.isInitialized = true;
21898
+ updateScrollState();
21899
+ }, 250);
21900
+ const initTableObserver = () => {
21901
+ resizeObserver = new ResizeObserver(() => {
21902
+ state.isInitialized = false;
21903
+ handleTableResize();
21904
+ });
21905
+ resizeObserver.observe(tableRef.value);
21906
+ };
21846
21907
  const init = () => {
21847
21908
  nextTick(() => {
21848
21909
  initTableObserver();
@@ -21859,11 +21920,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
21859
21920
  onActivated(() => {
21860
21921
  init();
21861
21922
  if (props2.checkable && !props2.rowKey) {
21862
- throw new Error(
21863
- "LewTable error: rowKey is required when checkable is enabled!"
21864
- );
21923
+ throw new Error("LewTable error: rowKey is required when checkable is enabled!");
21865
21924
  }
21866
- if (props2.columns.some((col) => !col.width)) {
21925
+ if (props2.columns.some(
21926
+ (col) => !col.width && (!col.children || col.children.length === 0)
21927
+ )) {
21867
21928
  throw new Error("LewTable error: width must be set for every column");
21868
21929
  }
21869
21930
  });
@@ -21873,6 +21934,50 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
21873
21934
  resizeObserver = null;
21874
21935
  }
21875
21936
  });
21937
+ watch(
21938
+ () => props2.dataSource,
21939
+ () => {
21940
+ state.selectedRowsMap = mapValues(keyBy(props2.dataSource, props2.rowKey), () => false);
21941
+ updateAllCheckedState();
21942
+ },
21943
+ { deep: true }
21944
+ );
21945
+ watch(selectedKeys, (newVal) => {
21946
+ if (props2.checkable) {
21947
+ updateSelectedKeys(newVal);
21948
+ }
21949
+ });
21950
+ watch(
21951
+ () => trRefArr.value,
21952
+ () => {
21953
+ compTrHeight();
21954
+ },
21955
+ {
21956
+ deep: true
21957
+ }
21958
+ );
21959
+ watch(
21960
+ () => props2.dataSource,
21961
+ () => {
21962
+ compTrHeight();
21963
+ },
21964
+ {
21965
+ deep: true
21966
+ }
21967
+ );
21968
+ watch(
21969
+ () => props2.size,
21970
+ () => {
21971
+ nextTick(() => {
21972
+ initTableObserver();
21973
+ updateScrollState();
21974
+ handleTableResize();
21975
+ if (props2.checkable) {
21976
+ updateSelectedKeys(selectedKeys.value);
21977
+ }
21978
+ });
21979
+ }
21980
+ );
21876
21981
  return (_ctx, _cache) => {
21877
21982
  return openBlock(), createElementBlock("div", _hoisted_1$d, [
21878
21983
  createElementVNode("i", {
@@ -21893,20 +21998,20 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
21893
21998
  createElementVNode("div", {
21894
21999
  ref_key: "tableRef",
21895
22000
  ref: tableRef,
21896
- class: "lew-table lew-scrollbar",
22001
+ class: normalizeClass(["lew-table lew-scrollbar", { "lew-table-bordered": _ctx.bordered }]),
21897
22002
  style: normalizeStyle(`max-height: ${unref(any2px)(_ctx.maxHeight)}`),
21898
22003
  onScroll: updateScrollState,
21899
22004
  onMouseleave: _cache[3] || (_cache[3] = ($event) => unref(state).hoverRowIndex = -1)
21900
22005
  }, [
21901
22006
  createElementVNode("div", {
21902
- class: "lew-table-head",
22007
+ class: normalizeClass(["lew-table-head", { "lew-table-head-bordered": unref(columnLevel) > 1 }]),
21903
22008
  style: normalizeStyle({
21904
22009
  width: unref(totalColumnWidth) + "px",
21905
- height: unref(getHeadHeight) + "px"
22010
+ height: unref(getHeadHeight) * unref(columnLevel) + unref(columnLevel) * 1 + "px"
21906
22011
  }),
21907
22012
  onMouseenter: _cache[2] || (_cache[2] = ($event) => unref(state).hoverRowIndex = -1)
21908
22013
  }, [
21909
- unref(getFixedColumns)("left").length > 0 || _ctx.checkable ? (openBlock(), createElementBlock("div", {
22014
+ unref(getFixedHeaderColumns)("left").length > 0 || _ctx.checkable ? (openBlock(), createElementBlock("div", {
21910
22015
  key: 0,
21911
22016
  ref_key: "fixedLeftRef",
21912
22017
  ref: fixedLeftRef,
@@ -21934,100 +22039,59 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
21934
22039
  ]),
21935
22040
  _: 1
21936
22041
  }, 8, ["style"])) : createCommentVNode("", true),
21937
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getFixedColumns)("left"), (column, index2) => {
21938
- return openBlock(), createBlock(unref(LewFlex), {
22042
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getFixedHeaderColumns)("left"), (column, index2) => {
22043
+ return openBlock(), createBlock(readerHeaderTd, {
22044
+ column,
21939
22045
  key: `columns${index2}`,
21940
- class: normalizeClass(["lew-table-td", { "lew-table-td-sortable": column.sortable }]),
21941
22046
  x: column.x || "start",
21942
22047
  y: column.y,
21943
- style: normalizeStyle(unref(getColumnStyle)(column)),
21944
- gap: "5",
21945
- onClick: ($event) => sort(column)
21946
- }, {
21947
- default: withCtx(() => [
21948
- createElementVNode("span", _hoisted_4$4, [
21949
- createTextVNode(toDisplayString$1(column.title) + " ", 1),
21950
- column.sortable ? (openBlock(), createBlock(SortIcon, {
21951
- key: 0,
21952
- "sort-value": sortValue.value[column.field],
21953
- size: _ctx.size,
21954
- class: "lew-table-sorter"
21955
- }, null, 8, ["sort-value", "size"])) : createCommentVNode("", true)
21956
- ])
21957
- ]),
21958
- _: 2
21959
- }, 1032, ["class", "x", "y", "style", "onClick"]);
22048
+ style: normalizeStyle(unref(getHeaderColumnStyle)(column)),
22049
+ gap: "5"
22050
+ }, null, 8, ["column", "x", "y", "style"]);
21960
22051
  }), 128))
21961
22052
  ])
21962
22053
  ], 512)) : createCommentVNode("", true),
21963
- createElementVNode("div", _hoisted_5$2, [
21964
- createElementVNode("div", _hoisted_6$1, [
21965
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(nonFixedColumns), (column, index2) => {
21966
- return openBlock(), createBlock(unref(LewFlex), {
22054
+ createElementVNode("div", _hoisted_4$4, [
22055
+ createElementVNode("div", _hoisted_5$2, [
22056
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(nonFixedHeaderColumns), (column, index2) => {
22057
+ return openBlock(), createBlock(readerHeaderTd, {
22058
+ column,
21967
22059
  key: `columns${index2}`,
21968
- class: normalizeClass(["lew-table-td", { "lew-table-td-sortable": column.sortable }]),
21969
22060
  x: column.x || "start",
21970
22061
  y: column.y,
21971
- style: normalizeStyle(unref(getColumnStyle)(column)),
21972
- gap: "5",
21973
- onClick: ($event) => sort(column)
21974
- }, {
21975
- default: withCtx(() => [
21976
- createElementVNode("span", _hoisted_7, [
21977
- createTextVNode(toDisplayString$1(column.title) + " ", 1),
21978
- column.sortable ? (openBlock(), createBlock(SortIcon, {
21979
- key: 0,
21980
- "sort-value": sortValue.value[column.field],
21981
- size: _ctx.size,
21982
- class: "lew-table-sorter"
21983
- }, null, 8, ["sort-value", "size"])) : createCommentVNode("", true)
21984
- ])
21985
- ]),
21986
- _: 2
21987
- }, 1032, ["class", "x", "y", "style", "onClick"]);
22062
+ style: normalizeStyle(unref(getHeaderColumnStyle)(column)),
22063
+ gap: "5"
22064
+ }, null, 8, ["column", "x", "y", "style"]);
21988
22065
  }), 128))
21989
22066
  ])
21990
22067
  ]),
21991
- unref(getFixedColumns)("right").length > 0 ? (openBlock(), createElementBlock("div", {
22068
+ unref(getFixedHeaderColumns)("right").length > 0 ? (openBlock(), createElementBlock("div", {
21992
22069
  key: 1,
21993
22070
  ref_key: "fixedRightRef",
21994
22071
  ref: fixedRightRef,
21995
22072
  class: "lew-table-fixed-right"
21996
22073
  }, [
21997
- createElementVNode("div", _hoisted_8, [
21998
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getFixedColumns)("right"), (column, index2) => {
21999
- return openBlock(), createBlock(unref(LewFlex), {
22074
+ createElementVNode("div", _hoisted_6$1, [
22075
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getFixedHeaderColumns)("right"), (column, index2) => {
22076
+ return openBlock(), createBlock(readerHeaderTd, {
22077
+ column,
22000
22078
  key: `columns${index2}`,
22001
22079
  class: normalizeClass(["lew-table-td", { "lew-table-td-sortable": column.sortable }]),
22002
22080
  x: column.x || "start",
22003
22081
  y: column.y,
22004
- style: normalizeStyle(unref(getColumnStyle)(column)),
22005
- gap: "5",
22006
- onClick: ($event) => sort(column)
22007
- }, {
22008
- default: withCtx(() => [
22009
- createElementVNode("span", _hoisted_9, [
22010
- createTextVNode(toDisplayString$1(column.title) + " ", 1),
22011
- column.sortable ? (openBlock(), createBlock(SortIcon, {
22012
- key: 0,
22013
- "sort-value": sortValue.value[column.field],
22014
- size: _ctx.size,
22015
- class: "lew-table-sorter"
22016
- }, null, 8, ["sort-value", "size"])) : createCommentVNode("", true)
22017
- ])
22018
- ]),
22019
- _: 2
22020
- }, 1032, ["class", "x", "y", "style", "onClick"]);
22082
+ style: normalizeStyle(unref(getHeaderColumnStyle)(column)),
22083
+ gap: "5"
22084
+ }, null, 8, ["column", "class", "x", "y", "style"]);
22021
22085
  }), 128))
22022
22086
  ])
22023
22087
  ], 512)) : createCommentVNode("", true)
22024
- ], 36),
22088
+ ], 38),
22025
22089
  _ctx.dataSource.length > 0 ? (openBlock(), createElementBlock("div", {
22026
22090
  key: 0,
22027
22091
  class: "lew-table-body",
22028
22092
  style: normalizeStyle(`width: ${unref(totalColumnWidth)}px`)
22029
22093
  }, [
22030
- unref(getFixedColumns)("left").length > 0 || _ctx.checkable ? (openBlock(), createElementBlock("div", _hoisted_10, [
22094
+ unref(getFixedColumns)("left").length > 0 || _ctx.checkable ? (openBlock(), createElementBlock("div", _hoisted_7, [
22031
22095
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataSource, (row, i) => {
22032
22096
  return openBlock(), createElementBlock("div", {
22033
22097
  key: `data${i}`,
@@ -22080,10 +22144,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
22080
22144
  _: 2
22081
22145
  }, 1032, ["x", "y", "style"]);
22082
22146
  }), 128))
22083
- ], 46, _hoisted_11);
22147
+ ], 46, _hoisted_8);
22084
22148
  }), 128))
22085
22149
  ])) : createCommentVNode("", true),
22086
- createElementVNode("div", _hoisted_12, [
22150
+ createElementVNode("div", _hoisted_9, [
22087
22151
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataSource, (row, i) => {
22088
22152
  return openBlock(), createElementBlock("div", {
22089
22153
  key: `data${i}`,
@@ -22120,10 +22184,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
22120
22184
  _: 2
22121
22185
  }, 1032, ["x", "y", "style"]);
22122
22186
  }), 128))
22123
- ], 42, _hoisted_13);
22187
+ ], 42, _hoisted_10);
22124
22188
  }), 128))
22125
22189
  ]),
22126
- unref(getFixedColumns)("right").length > 0 ? (openBlock(), createElementBlock("div", _hoisted_14, [
22190
+ unref(getFixedColumns)("right").length > 0 ? (openBlock(), createElementBlock("div", _hoisted_11, [
22127
22191
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataSource, (row, i) => {
22128
22192
  return openBlock(), createElementBlock("div", {
22129
22193
  key: `data${i}`,
@@ -22160,12 +22224,12 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
22160
22224
  _: 2
22161
22225
  }, 1032, ["x", "y", "style"]);
22162
22226
  }), 128))
22163
- ], 46, _hoisted_15);
22227
+ ], 46, _hoisted_12);
22164
22228
  }), 128))
22165
22229
  ])) : createCommentVNode("", true)
22166
22230
  ], 4)) : createCommentVNode("", true)
22167
- ], 36),
22168
- createElementVNode("div", _hoisted_16, [
22231
+ ], 38),
22232
+ createElementVNode("div", _hoisted_13, [
22169
22233
  renderSlot(_ctx.$slots, "table-footer")
22170
22234
  ]),
22171
22235
  _ctx.dataSource.length === 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
@@ -22874,9 +22938,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
22874
22938
  const parentKey = props2.extend.parentKey;
22875
22939
  const parentNode = findNodeByKey(parentKey, _dataSource.value);
22876
22940
  const siblingKeys = ((parentNode == null ? void 0 : parentNode.children) || []).map((e) => e.key);
22877
- if (siblingKeys.length > 0 && siblingKeys.every(
22878
- (key) => newModelValue.includes(key)
22879
- )) {
22941
+ if (siblingKeys.length > 0 && siblingKeys.every((key) => newModelValue.includes(key))) {
22880
22942
  if (!newModelValue.includes(parentKey)) {
22881
22943
  newModelValue.push(parentKey);
22882
22944
  }
@@ -22916,11 +22978,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
22916
22978
  });
22917
22979
  if (status === "success") {
22918
22980
  loaded.value = true;
22919
- insertChildByKey(
22920
- _dataSource.value,
22921
- props2.__key,
22922
- result
22923
- );
22981
+ insertChildByKey(_dataSource.value, props2.__key, result);
22924
22982
  _dataSource.value = formatTree({
22925
22983
  dataSource: _dataSource.value,
22926
22984
  keyField,
@@ -22929,10 +22987,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
22929
22987
  });
22930
22988
  cacheDataSource.value = cloneDeep(_dataSource.value);
22931
22989
  console.log(_dataSource.value, "lew-tree-item");
22932
- expandKeys.value = [
22933
- ...expandKeys.value,
22934
- props2.__key
22935
- ];
22990
+ expandKeys.value = [...expandKeys.value, props2.__key];
22936
22991
  } else {
22937
22992
  loaded.value = false;
22938
22993
  LewMessage$1.error(error2.message);
@@ -23028,7 +23083,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
23028
23083
  };
23029
23084
  }
23030
23085
  });
23031
- const LewTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-85641b32"]]);
23086
+ const LewTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-cd045d8b"]]);
23032
23087
  const _hoisted_1$a = {
23033
23088
  key: 0,
23034
23089
  class: "lew-result-count"
@@ -23973,7 +24028,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
23973
24028
  };
23974
24029
  }
23975
24030
  });
23976
- const LewDescItem = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-39933d3d"]]);
24031
+ const LewDescItem = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-65b841af"]]);
23977
24032
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
23978
24033
  __name: "LewDesc",
23979
24034
  props: descProps,
@@ -25423,7 +25478,7 @@ const LewTooltip = {
25423
25478
  theme: "light",
25424
25479
  trigger: _trigger,
25425
25480
  content,
25426
- animation: "scale",
25481
+ animation: "scale-subtle",
25427
25482
  interactive: true,
25428
25483
  appendTo: () => document.body,
25429
25484
  placement,
@@ -25734,7 +25789,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25734
25789
  zIndex: 2001,
25735
25790
  content: menuDom
25736
25791
  });
25737
- window.LewContextMenu.menuInstance[uniqueId2].popper.children[0].setAttribute("data-lew", "popover");
25792
+ window.LewContextMenu.menuInstance[uniqueId2].popper.children[0].setAttribute(
25793
+ "data-lew",
25794
+ "popover"
25795
+ );
25738
25796
  });
25739
25797
  };
25740
25798
  const renderIcon = ({ renderIcon: renderIcon2 }) => {
@@ -25773,7 +25831,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25773
25831
  class: normalizeClass(["lew-context-menu-item", {
25774
25832
  "lew-context-menu-item-active": item.active
25775
25833
  }]),
25776
- style: normalizeStyle({ "animation-delay": index2 * 15 + "ms" })
25834
+ style: normalizeStyle({ "animation-delay": index2 * 10 + "ms" })
25777
25835
  }, [
25778
25836
  _ctx.options.filter((e) => e.checkbox).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
25779
25837
  item.checked ? (openBlock(), createBlock(Icon, {
@@ -25815,7 +25873,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25815
25873
  };
25816
25874
  }
25817
25875
  });
25818
- const _LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-31b81ff7"]]);
25876
+ const _LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-3d59a17d"]]);
25819
25877
  const initLewHoverMenu = () => {
25820
25878
  window.LewHoverMenu = {
25821
25879
  menu: {},