@uzum-tech/ui 2.0.0-beta.3 → 2.0.0-beta.5

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 (183) hide show
  1. package/dist/index.js +2467 -1507
  2. package/dist/index.mjs +2461 -1506
  3. package/dist/index.prod.js +2 -2
  4. package/dist/index.prod.mjs +2 -2
  5. package/es/_internal/component-renderer/index.d.ts +2 -0
  6. package/es/_internal/component-renderer/index.mjs +1 -0
  7. package/es/_internal/component-renderer/src/interface.d.ts +29 -0
  8. package/es/_internal/component-renderer/src/interface.mjs +1 -0
  9. package/es/_internal/component-renderer/src/renderer.d.ts +3 -0
  10. package/es/_internal/component-renderer/src/renderer.mjs +20 -0
  11. package/es/_internal/select-menu/src/SelectOption.mjs +9 -5
  12. package/es/_internal/select-menu/src/styles/index.cssr.mjs +4 -3
  13. package/es/_internal/selection/src/styles/index.cssr.mjs +3 -0
  14. package/es/card-list/src/CardList.d.ts +1 -1
  15. package/es/checkbox/src/Checkbox.d.ts +2 -2
  16. package/es/components.d.ts +1 -0
  17. package/es/components.mjs +1 -0
  18. package/es/config-provider/src/internal-interface.d.ts +3 -1
  19. package/es/data-table/src/DataTable.d.ts +25 -5
  20. package/es/data-table/src/DataTable.mjs +125 -4
  21. package/es/data-table/src/HeaderButton/FilterMenu.mjs +1 -1
  22. package/es/data-table/src/TableParts/Body.d.ts +9 -6
  23. package/es/data-table/src/TableParts/Body.mjs +30 -6
  24. package/es/data-table/src/TableParts/Cell.mjs +17 -17
  25. package/es/data-table/src/TableParts/Header.d.ts +4 -2
  26. package/es/data-table/src/TableParts/Header.mjs +65 -22
  27. package/es/data-table/src/interface.d.ts +16 -0
  28. package/es/data-table/src/interface.mjs +9 -0
  29. package/es/data-table/src/use-group-header.mjs +2 -2
  30. package/es/data-table/src/use-mask.mjs +1 -1
  31. package/es/data-table/src/use-resizable.d.ts +1 -0
  32. package/es/data-table/src/use-resizable.mjs +5 -2
  33. package/es/data-table/src/use-scroll.d.ts +5 -4
  34. package/es/data-table/src/use-scroll.mjs +29 -25
  35. package/es/data-table/src/use-sorter.mjs +1 -1
  36. package/es/data-table/src/use-table-data.mjs +1 -1
  37. package/es/data-table/src/utils/column-utils.d.ts +13 -0
  38. package/es/data-table/src/utils/column-utils.mjs +84 -0
  39. package/es/data-table/src/utils/csv-utils.d.ts +3 -0
  40. package/es/data-table/src/utils/csv-utils.mjs +21 -0
  41. package/es/data-table/src/utils/index.d.ts +7 -0
  42. package/es/data-table/src/utils/index.mjs +7 -0
  43. package/es/data-table/src/utils/mask-defaults.d.ts +6 -0
  44. package/es/data-table/src/utils/mask-defaults.mjs +16 -0
  45. package/es/data-table/src/utils/resize-orchestrator-utils.d.ts +6 -0
  46. package/es/data-table/src/utils/resize-orchestrator-utils.mjs +21 -0
  47. package/es/data-table/src/utils/sort-filter-utils.d.ts +6 -0
  48. package/es/data-table/src/utils/sort-filter-utils.mjs +38 -0
  49. package/es/data-table/src/utils/width-utils.d.ts +20 -0
  50. package/es/data-table/src/utils/width-utils.mjs +174 -0
  51. package/es/data-table/src/utils.d.ts +1 -25
  52. package/es/data-table/src/utils.mjs +1 -165
  53. package/es/grid/src/Grid.d.ts +1 -1
  54. package/es/header/src/HeaderSearchResults.d.ts +1 -1
  55. package/es/icon-bar/src/IconBar.d.ts +1 -1
  56. package/es/input/src/Input.d.ts +1 -1
  57. package/es/list/src/ListItem.d.ts +2 -2
  58. package/es/list/src/ListItem.mjs +19 -12
  59. package/es/list/src/props.d.ts +3 -1
  60. package/es/list/src/styles/index.cssr.mjs +4 -2
  61. package/es/locales/common/enUS.d.ts +6 -0
  62. package/es/locales/common/enUS.mjs +6 -0
  63. package/es/locales/common/ruRU.mjs +6 -0
  64. package/es/mapping-card/index.d.ts +7 -0
  65. package/es/mapping-card/index.mjs +4 -0
  66. package/es/mapping-card/src/MappingCard.d.ts +2091 -0
  67. package/es/mapping-card/src/MappingCard.mjs +77 -0
  68. package/es/mapping-card/src/MappingCardList.d.ts +36 -0
  69. package/es/mapping-card/src/MappingCardList.mjs +50 -0
  70. package/es/mapping-card/src/MappingCardParts/Body.d.ts +4 -0
  71. package/es/mapping-card/src/MappingCardParts/Body.mjs +66 -0
  72. package/es/mapping-card/src/MappingCardParts/Header.d.ts +7 -0
  73. package/es/mapping-card/src/MappingCardParts/Header.mjs +147 -0
  74. package/es/mapping-card/src/injection.d.ts +17 -0
  75. package/es/mapping-card/src/injection.mjs +2 -0
  76. package/es/mapping-card/src/interface.d.ts +105 -0
  77. package/es/mapping-card/src/interface.mjs +45 -0
  78. package/es/mapping-card/src/styles/index.cssr.d.ts +2 -0
  79. package/es/mapping-card/src/styles/index.cssr.mjs +92 -0
  80. package/es/mapping-card/styles/dark.d.ts +337 -0
  81. package/es/mapping-card/styles/dark.mjs +22 -0
  82. package/es/mapping-card/styles/index.d.ts +3 -0
  83. package/es/mapping-card/styles/index.mjs +2 -0
  84. package/es/mapping-card/styles/light.d.ts +352 -0
  85. package/es/mapping-card/styles/light.mjs +45 -0
  86. package/es/progress/src/MultipleCircle.d.ts +1 -1
  87. package/es/radio/src/Radio.d.ts +1 -1
  88. package/es/radio/src/RadioButton.d.ts +3 -3
  89. package/es/tabs/src/Tabs.d.ts +2 -6
  90. package/es/themes/dark.mjs +2 -0
  91. package/es/themes/light.mjs +2 -0
  92. package/es/toggle-button/src/ToggleButton.d.ts +2 -2
  93. package/es/version.d.ts +1 -1
  94. package/es/version.mjs +1 -1
  95. package/lib/_internal/component-renderer/index.d.ts +2 -0
  96. package/lib/_internal/component-renderer/index.js +5 -0
  97. package/lib/_internal/component-renderer/src/interface.d.ts +29 -0
  98. package/lib/_internal/component-renderer/src/interface.js +2 -0
  99. package/lib/_internal/component-renderer/src/renderer.d.ts +3 -0
  100. package/lib/_internal/component-renderer/src/renderer.js +28 -0
  101. package/lib/_internal/select-menu/src/SelectOption.js +11 -12
  102. package/lib/_internal/select-menu/src/styles/index.cssr.js +4 -3
  103. package/lib/_internal/selection/src/styles/index.cssr.js +3 -0
  104. package/lib/card-list/src/CardList.d.ts +1 -1
  105. package/lib/checkbox/src/Checkbox.d.ts +2 -2
  106. package/lib/components.d.ts +1 -0
  107. package/lib/components.js +1 -0
  108. package/lib/config-provider/src/internal-interface.d.ts +3 -1
  109. package/lib/data-table/src/DataTable.d.ts +25 -5
  110. package/lib/data-table/src/DataTable.js +131 -4
  111. package/lib/data-table/src/TableParts/Body.d.ts +9 -6
  112. package/lib/data-table/src/TableParts/Body.js +30 -8
  113. package/lib/data-table/src/TableParts/Cell.js +16 -16
  114. package/lib/data-table/src/TableParts/Header.d.ts +4 -2
  115. package/lib/data-table/src/TableParts/Header.js +55 -23
  116. package/lib/data-table/src/interface.d.ts +16 -0
  117. package/lib/data-table/src/interface.js +6 -0
  118. package/lib/data-table/src/use-group-header.js +1 -1
  119. package/lib/data-table/src/use-resizable.d.ts +1 -0
  120. package/lib/data-table/src/use-resizable.js +5 -2
  121. package/lib/data-table/src/use-scroll.d.ts +5 -4
  122. package/lib/data-table/src/use-scroll.js +31 -28
  123. package/lib/data-table/src/utils/column-utils.d.ts +13 -0
  124. package/lib/data-table/src/utils/column-utils.js +116 -0
  125. package/lib/data-table/src/utils/csv-utils.d.ts +3 -0
  126. package/lib/data-table/src/utils/csv-utils.js +34 -0
  127. package/lib/data-table/src/utils/index.d.ts +7 -0
  128. package/lib/data-table/src/utils/index.js +26 -0
  129. package/lib/data-table/src/utils/mask-defaults.d.ts +6 -0
  130. package/lib/data-table/src/utils/mask-defaults.js +22 -0
  131. package/lib/data-table/src/utils/resize-orchestrator-utils.d.ts +6 -0
  132. package/lib/data-table/src/utils/resize-orchestrator-utils.js +35 -0
  133. package/lib/data-table/src/utils/sort-filter-utils.d.ts +6 -0
  134. package/lib/data-table/src/utils/sort-filter-utils.js +54 -0
  135. package/lib/data-table/src/utils/width-utils.d.ts +20 -0
  136. package/lib/data-table/src/utils/width-utils.js +182 -0
  137. package/lib/data-table/src/utils.d.ts +1 -25
  138. package/lib/data-table/src/utils.js +15 -229
  139. package/lib/grid/src/Grid.d.ts +1 -1
  140. package/lib/header/src/HeaderSearchResults.d.ts +1 -1
  141. package/lib/icon-bar/src/IconBar.d.ts +1 -1
  142. package/lib/input/src/Input.d.ts +1 -1
  143. package/lib/list/src/ListItem.d.ts +2 -2
  144. package/lib/list/src/ListItem.js +31 -10
  145. package/lib/list/src/props.d.ts +3 -1
  146. package/lib/list/src/styles/index.cssr.js +4 -2
  147. package/lib/locales/common/enUS.d.ts +6 -0
  148. package/lib/locales/common/enUS.js +6 -0
  149. package/lib/locales/common/ruRU.js +6 -0
  150. package/lib/mapping-card/index.d.ts +7 -0
  151. package/lib/mapping-card/index.js +15 -0
  152. package/lib/mapping-card/src/MappingCard.d.ts +2091 -0
  153. package/lib/mapping-card/src/MappingCard.js +58 -0
  154. package/lib/mapping-card/src/MappingCardList.d.ts +36 -0
  155. package/lib/mapping-card/src/MappingCardList.js +38 -0
  156. package/lib/mapping-card/src/MappingCardParts/Body.d.ts +4 -0
  157. package/lib/mapping-card/src/MappingCardParts/Body.js +48 -0
  158. package/lib/mapping-card/src/MappingCardParts/Header.d.ts +7 -0
  159. package/lib/mapping-card/src/MappingCardParts/Header.js +77 -0
  160. package/lib/mapping-card/src/injection.d.ts +17 -0
  161. package/lib/mapping-card/src/injection.js +5 -0
  162. package/lib/mapping-card/src/interface.d.ts +105 -0
  163. package/lib/mapping-card/src/interface.js +48 -0
  164. package/lib/mapping-card/src/styles/index.cssr.d.ts +2 -0
  165. package/lib/mapping-card/src/styles/index.cssr.js +97 -0
  166. package/lib/mapping-card/styles/dark.d.ts +337 -0
  167. package/lib/mapping-card/styles/dark.js +24 -0
  168. package/lib/mapping-card/styles/index.d.ts +3 -0
  169. package/lib/mapping-card/styles/index.js +10 -0
  170. package/lib/mapping-card/styles/light.d.ts +352 -0
  171. package/lib/mapping-card/styles/light.js +40 -0
  172. package/lib/progress/src/MultipleCircle.d.ts +1 -1
  173. package/lib/radio/src/Radio.d.ts +1 -1
  174. package/lib/radio/src/RadioButton.d.ts +3 -3
  175. package/lib/tabs/src/Tabs.d.ts +2 -6
  176. package/lib/themes/dark.js +84 -82
  177. package/lib/themes/light.js +82 -80
  178. package/lib/toggle-button/src/ToggleButton.d.ts +2 -2
  179. package/lib/version.d.ts +1 -1
  180. package/lib/version.js +1 -1
  181. package/package.json +1 -1
  182. package/volar.d.ts +2 -0
  183. package/web-types.json +207 -2
@@ -2,7 +2,7 @@ import { get } from 'lodash-es';
2
2
  import { defineComponent, h } from 'vue';
3
3
  import { UEllipsis } from "../../../ellipsis/index.mjs";
4
4
  import { processMaskedValue } from "../use-mask.mjs";
5
- import { defaultNumericMask } from "../utils.mjs";
5
+ import { defaultNumericMask, isColumnEllipsisEnabled } from "../utils/index.mjs";
6
6
  export default defineComponent({
7
7
  name: 'DataTableCell',
8
8
  emits: ['edit'],
@@ -51,7 +51,7 @@ export default defineComponent({
51
51
  numeric
52
52
  } = column;
53
53
  if (numeric && !mask) mask = defaultNumericMask;
54
- const isEditable = typeof editable === 'function' ? editable(row) : editable;
54
+ const rowEditable = typeof editable === 'function' ? editable(row) : editable;
55
55
  if (render && !isSummary) {
56
56
  let cellValue = render(row, this.index);
57
57
  if (cellValue == null || cellValue === false) {
@@ -75,7 +75,7 @@ export default defineComponent({
75
75
  }
76
76
  cell = cellValue;
77
77
  }
78
- } else if (isEditable && !isSummary) {
78
+ } else if (rowEditable && !isSummary) {
79
79
  const {
80
80
  placeholder
81
81
  } = column;
@@ -88,19 +88,19 @@ export default defineComponent({
88
88
  class: `${this.clsPrefix}-data-table-editable-input`,
89
89
  value: displayValue,
90
90
  placeholder: placeholder || '',
91
- onFocus: e => {
92
- const input = e.target;
91
+ onFocus: event => {
92
+ const input = event.target;
93
93
  isEditingRef.current = true;
94
94
  input.value = rawValue;
95
95
  },
96
- onKeyDown: e => {
96
+ onKeyDown: event => {
97
97
  if (mask && typeof mask === 'function' && isEditingRef.current) {
98
- const input = e.target;
98
+ const input = event.target;
99
99
  input.value = rawValue;
100
100
  }
101
101
  },
102
- onInput: e => {
103
- const input = e.target;
102
+ onInput: event => {
103
+ const input = event.target;
104
104
  let value = input.value;
105
105
  if (numeric) {
106
106
  const cursorPosition = input.selectionStart || 0;
@@ -146,15 +146,15 @@ export default defineComponent({
146
146
  }
147
147
  this.$emit('edit', processedValue, row, key);
148
148
  },
149
- onKeyUp: e => {
149
+ onKeyUp: event => {
150
150
  if (mask && typeof mask === 'function' && isEditingRef.current) {
151
- const input = e.target;
151
+ const input = event.target;
152
152
  input.value = rawValue;
153
153
  }
154
154
  },
155
- onChange: e => {
155
+ onChange: event => {
156
156
  if (mask && typeof mask === 'function' && isEditingRef.current) {
157
- const input = e.target;
157
+ const input = event.target;
158
158
  setTimeout(() => {
159
159
  if (isEditingRef.current && input.value !== rawValue) {
160
160
  input.value = rawValue;
@@ -167,10 +167,10 @@ export default defineComponent({
167
167
  }, 10);
168
168
  }
169
169
  },
170
- onBlur: e => {
170
+ onBlur: event => {
171
171
  isEditingRef.current = false;
172
172
  if (mask) {
173
- const input = e.target;
173
+ const input = event.target;
174
174
  let currentValue = input.value;
175
175
  if (numeric && currentValue !== '') {
176
176
  currentValue = currentValue.replace(',', '.');
@@ -234,8 +234,8 @@ export default defineComponent({
234
234
  }
235
235
  }
236
236
  }
237
- if (ellipsis) {
238
- if (typeof ellipsis === 'object') {
237
+ if (isColumnEllipsisEnabled(column)) {
238
+ if (ellipsis && typeof ellipsis === 'object') {
239
239
  const {
240
240
  mergedTheme
241
241
  } = this;
@@ -5,7 +5,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
5
5
  default: boolean;
6
6
  };
7
7
  }>, {
8
- cellElsRef: import("vue").Ref<Record<ColumnKey, HTMLTableCellElement>, Record<ColumnKey, HTMLTableCellElement>>;
8
+ cellElementsRef: import("vue").Ref<Record<ColumnKey, HTMLTableCellElement>, Record<ColumnKey, HTMLTableCellElement>>;
9
9
  componentId: string;
10
10
  mergedSortState: import("vue").Ref<import("../interface").SortState[], import("../interface").SortState[]>;
11
11
  mergedClsPrefix: import("vue").Ref<string, string>;
@@ -2792,9 +2792,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
2792
2792
  }>;
2793
2793
  checkOptions: import("vue").Ref<import("../interface").DataTableSelectionOptions<import("../interface").InternalRowData> | undefined, import("../interface").DataTableSelectionOptions<import("../interface").InternalRowData> | undefined>;
2794
2794
  mergedTableLayout: import("vue").Ref<"auto" | "fixed", "auto" | "fixed">;
2795
+ resizableEnabled: import("vue").Ref<boolean, boolean>;
2796
+ fixedResizableTableWidth: import("vue").ComputedRef<string | undefined>;
2795
2797
  headerCheckboxDisabled: import("vue").Ref<boolean, boolean>;
2796
2798
  handleCheckboxUpdateChecked: () => void;
2797
- handleColHeaderClick: (e: MouseEvent, column: TableBaseColumn) => void;
2799
+ handleColHeaderClick: (event: MouseEvent, column: TableBaseColumn) => void;
2798
2800
  handleTableHeaderScroll: (e: Event) => void;
2799
2801
  handleColumnResizeStart: (column: TableBaseColumn) => void;
2800
2802
  handleColumnResize: (column: TableBaseColumn, displacementX: number) => void;
@@ -1,5 +1,5 @@
1
- import { happensIn, pxfy } from 'seemly';
2
- import { defineComponent, Fragment, h, inject, ref } from 'vue';
1
+ import { depx, happensIn, pxfy } from 'seemly';
2
+ import { computed, defineComponent, Fragment, h, inject, ref } from 'vue';
3
3
  import { formatLength } from "../../../_utils/index.mjs";
4
4
  import { UCheckbox } from "../../../checkbox/index.mjs";
5
5
  import { UEllipsis } from "../../../ellipsis/index.mjs";
@@ -7,7 +7,7 @@ import FilterButton from "../HeaderButton/FilterButton.mjs";
7
7
  import ResizeButton from "../HeaderButton/ResizeButton.mjs";
8
8
  import SortButton from "../HeaderButton/SortButton.mjs";
9
9
  import { dataTableInjectionKey } from "../interface.mjs";
10
- import { clampValueFollowCSSRules, createNextSorter, getColKey, getNumberColWidth, isColumnFilterable, isColumnResizable, isColumnSortable, isColumnSorting } from "../utils.mjs";
10
+ import { clampValueFollowCSSRules, createNextSorter, getColKey, getNumberColWidth, isColumnEllipsisEnabled, isColumnFilterable, isColumnResizable, isColumnSortable, isColumnSorting, resolveColumnWidthConstraint } from "../utils/index.mjs";
11
11
  import SelectionMenu from "./SelectionMenu.mjs";
12
12
  function renderTitle(column) {
13
13
  return typeof column.title === 'function' ? column.title(column) : column.title;
@@ -22,6 +22,7 @@ export default defineComponent({
22
22
  },
23
23
  setup() {
24
24
  const {
25
+ props: dataTableProps,
25
26
  mergedClsPrefixRef,
26
27
  scrollXRef,
27
28
  fixedColumnLeftMapRef,
@@ -36,6 +37,7 @@ export default defineComponent({
36
37
  mergedSortStateRef,
37
38
  componentId,
38
39
  mergedTableLayoutRef,
40
+ resizableEnabledRef,
39
41
  headerCheckboxDisabledRef,
40
42
  sizeRef,
41
43
  onUnstableColumnResize,
@@ -46,9 +48,22 @@ export default defineComponent({
46
48
  doUncheckAll,
47
49
  doCheckAll
48
50
  } = inject(dataTableInjectionKey);
49
- const cellElsRef = ref({});
51
+ const fixedResizableModeRef = computed(() => {
52
+ return mergedTableLayoutRef.value === 'fixed' && resizableEnabledRef.value;
53
+ });
54
+ const fixedResizableTableWidthRef = computed(() => {
55
+ if (!fixedResizableModeRef.value) return;
56
+ let total = 0;
57
+ for (const column of colsRef.value) {
58
+ const width = depx(column.style.width);
59
+ if (!Number.isFinite(width) || width <= 0) return;
60
+ total += width;
61
+ }
62
+ return `${total}px`;
63
+ });
64
+ const cellElementsRef = ref({});
50
65
  function getCellActualWidth(key) {
51
- const element = cellElsRef.value[key];
66
+ const element = cellElementsRef.value[key];
52
67
  return element === null || element === void 0 ? void 0 : element.getBoundingClientRect().width;
53
68
  }
54
69
  function handleCheckboxUpdateChecked() {
@@ -58,8 +73,8 @@ export default defineComponent({
58
73
  doCheckAll();
59
74
  }
60
75
  }
61
- function handleColHeaderClick(e, column) {
62
- if (happensIn(e, 'dataTableFilter') || happensIn(e, 'dataTableResizable')) {
76
+ function handleColHeaderClick(event, column) {
77
+ if (happensIn(event, 'dataTableFilter') || happensIn(event, 'dataTableResizable')) {
63
78
  return;
64
79
  }
65
80
  if (!isColumnSortable(column)) return;
@@ -69,16 +84,18 @@ export default defineComponent({
69
84
  }
70
85
  const resizeStartWidthMap = new Map();
71
86
  function getColumnStartWidth(column) {
72
- const actual = getCellActualWidth(column.key);
73
- if (actual !== undefined && actual > 0) return actual;
74
- const resized = getResizableWidth(column.key);
75
- if (resized !== undefined && resized > 0) return resized;
87
+ const actualWidth = getCellActualWidth(column.key);
88
+ if (actualWidth !== undefined && actualWidth > 0) return actualWidth;
89
+ const resizedWidth = getResizableWidth(column.key);
90
+ if (resizedWidth !== undefined && resizedWidth > 0) return resizedWidth;
76
91
  return getNumberColWidth(column);
77
92
  }
78
93
  function handleColumnResizeStart(column) {
79
94
  resizeStartWidthMap.set(column.key, getColumnStartWidth(column));
80
95
  }
81
96
  function handleColumnResize(column, displacementX) {
97
+ var _a, _b, _c, _d;
98
+ if (!resizableEnabledRef.value) return;
82
99
  let startWidth = resizeStartWidthMap.get(column.key);
83
100
  if (startWidth === undefined) {
84
101
  startWidth = getColumnStartWidth(column);
@@ -86,12 +103,34 @@ export default defineComponent({
86
103
  resizeStartWidthMap.set(column.key, startWidth);
87
104
  }
88
105
  const widthAfterResize = startWidth + displacementX;
89
- const limitWidth = clampValueFollowCSSRules(widthAfterResize, column.minWidth, column.maxWidth);
106
+ const {
107
+ min: minWidth,
108
+ max: maxWidth
109
+ } = resolveColumnWidthConstraint(column, dataTableProps.resizableMinWidth, dataTableProps.resizableMaxWidth);
110
+ const limitWidth = clampValueFollowCSSRules(widthAfterResize, minWidth, maxWidth);
111
+ const currentWidth = (_b = (_a = getResizableWidth(column.key)) !== null && _a !== void 0 ? _a : getCellActualWidth(column.key)) !== null && _b !== void 0 ? _b : startWidth;
112
+ const delta = limitWidth - currentWidth;
113
+ if (fixedResizableModeRef.value && delta > 0) {
114
+ const lastColumnItem = colsRef.value[colsRef.value.length - 1];
115
+ if (lastColumnItem !== undefined && lastColumnItem.key !== column.key) {
116
+ const lastCurrentWidth = (_d = (_c = getResizableWidth(lastColumnItem.key)) !== null && _c !== void 0 ? _c : getCellActualWidth(lastColumnItem.key)) !== null && _d !== void 0 ? _d : depx(lastColumnItem.style.width);
117
+ if (Number.isFinite(lastCurrentWidth) && lastCurrentWidth > 0) {
118
+ const {
119
+ min: lastMinWidth,
120
+ max: lastMaxWidth
121
+ } = resolveColumnWidthConstraint(lastColumnItem.column, dataTableProps.resizableMinWidth, dataTableProps.resizableMaxWidth);
122
+ const nextLastWidth = clampValueFollowCSSRules(lastCurrentWidth - delta, lastMinWidth, lastMaxWidth);
123
+ doUpdateResizableWidth({
124
+ key: lastColumnItem.key
125
+ }, nextLastWidth);
126
+ }
127
+ }
128
+ }
90
129
  onUnstableColumnResize(widthAfterResize, limitWidth, column, getCellActualWidth);
91
130
  doUpdateResizableWidth(column, limitWidth);
92
131
  }
93
132
  return {
94
- cellElsRef,
133
+ cellElementsRef,
95
134
  componentId,
96
135
  mergedSortState: mergedSortStateRef,
97
136
  mergedClsPrefix: mergedClsPrefixRef,
@@ -106,6 +145,8 @@ export default defineComponent({
106
145
  mergedTheme: mergedThemeRef,
107
146
  checkOptions: checkOptionsRef,
108
147
  mergedTableLayout: mergedTableLayoutRef,
148
+ resizableEnabled: resizableEnabledRef,
149
+ fixedResizableTableWidth: fixedResizableTableWidthRef,
109
150
  headerCheckboxDisabled: headerCheckboxDisabledRef,
110
151
  handleCheckboxUpdateChecked,
111
152
  handleColHeaderClick,
@@ -117,7 +158,7 @@ export default defineComponent({
117
158
  },
118
159
  render() {
119
160
  const {
120
- cellElsRef,
161
+ cellElementsRef,
121
162
  mergedClsPrefix,
122
163
  fixedColumnLeftMap,
123
164
  fixedColumnRightMap,
@@ -131,6 +172,8 @@ export default defineComponent({
131
172
  componentId,
132
173
  discrete,
133
174
  mergedTableLayout,
175
+ resizableEnabled,
176
+ fixedResizableTableWidth,
134
177
  headerCheckboxDisabled,
135
178
  mergedSortState,
136
179
  sizeRef,
@@ -139,7 +182,6 @@ export default defineComponent({
139
182
  handleColumnResizeStart,
140
183
  handleColumnResize
141
184
  } = this;
142
- let hasEllipsis = false;
143
185
  const theadVNode = h("thead", {
144
186
  class: `${mergedClsPrefix}-data-table-thead`,
145
187
  "data-u-id": componentId
@@ -157,7 +199,7 @@ export default defineComponent({
157
199
  const {
158
200
  ellipsis
159
201
  } = column;
160
- if (!hasEllipsis && ellipsis) hasEllipsis = true;
202
+ const ellipsisEnabled = isColumnEllipsisEnabled(column);
161
203
  const createColumnVNode = () => {
162
204
  if (column.type === 'selection') {
163
205
  return column.multiple !== false ? h(Fragment, null, h(UCheckbox, {
@@ -176,21 +218,21 @@ export default defineComponent({
176
218
  class: `${mergedClsPrefix}-data-table-th__title-wrapper`
177
219
  }, h("div", {
178
220
  class: `${mergedClsPrefix}-data-table-th__title`
179
- }, ellipsis === true || ellipsis && !ellipsis.tooltip ? h("div", {
180
- class: `${mergedClsPrefix}-data-table-th__ellipsis`
181
- }, renderTitle(column)) : ellipsis && typeof ellipsis === 'object' ? h(UEllipsis, Object.assign({}, ellipsis, {
221
+ }, ellipsisEnabled ? ellipsis && typeof ellipsis === 'object' ? h(UEllipsis, Object.assign({}, ellipsis, {
182
222
  theme: mergedTheme.peers.Ellipsis,
183
223
  themeOverrides: mergedTheme.peerOverrides.Ellipsis
184
224
  }), {
185
225
  default: () => renderTitle(column)
186
- }) : renderTitle(column), column.subtitle && h("div", {
226
+ }) : h("div", {
227
+ class: `${mergedClsPrefix}-data-table-th__ellipsis`
228
+ }, renderTitle(column)) : renderTitle(column), column.subtitle && h("div", {
187
229
  class: `${mergedClsPrefix}-data-table-th__subtitle`
188
230
  }, column.subtitle)), isColumnSortable(column) ? h(SortButton, {
189
231
  column: column
190
232
  }) : null), isColumnFilterable(column) ? h(FilterButton, {
191
233
  column: column,
192
234
  options: column.filterOptions
193
- }) : null, isColumnResizable(column) ? h(ResizeButton, {
235
+ }) : null, resizableEnabled && isColumnResizable(column) ? h(ResizeButton, {
194
236
  onResizeStart: () => {
195
237
  handleColumnResizeStart(column);
196
238
  },
@@ -202,7 +244,7 @@ export default defineComponent({
202
244
  const leftFixed = key in fixedColumnLeftMap;
203
245
  const rightFixed = key in fixedColumnRightMap;
204
246
  return h("th", {
205
- ref: el => cellElsRef[key] = el,
247
+ ref: el => cellElementsRef[key] = el,
206
248
  key: key,
207
249
  style: {
208
250
  textAlign: column.titleAlign || column.align,
@@ -242,6 +284,7 @@ export default defineComponent({
242
284
  class: `${mergedClsPrefix}-data-table-table`,
243
285
  style: {
244
286
  minWidth: formatLength(scrollX),
287
+ width: fixedResizableTableWidth,
245
288
  tableLayout: mergedTableLayout
246
289
  }
247
290
  }, h("colgroup", null, cols.map(col => h("col", {
@@ -74,6 +74,15 @@ export declare const dataTableProps: {
74
74
  readonly type: PropType<"auto" | "fixed">;
75
75
  readonly default: "auto";
76
76
  };
77
+ readonly resizableMinWidth: {
78
+ readonly type: PropType<number | string>;
79
+ readonly default: 50;
80
+ };
81
+ readonly resizableMaxWidth: PropType<number | string>;
82
+ readonly resizableStorage: {
83
+ readonly type: BooleanConstructor;
84
+ readonly default: true;
85
+ };
77
86
  readonly allowCheckingNotLoaded: BooleanConstructor;
78
87
  readonly cascade: {
79
88
  readonly type: BooleanConstructor;
@@ -2975,6 +2984,12 @@ export declare const dataTableProps: {
2975
2984
  export type FilterOptionValue = string | number;
2976
2985
  export type ColumnKey = string | number;
2977
2986
  export type RowKey = string | number;
2987
+ export interface ColumnWidthComputationItem {
2988
+ key: ColumnKey;
2989
+ width?: number | string;
2990
+ minWidth?: number | string;
2991
+ maxWidth?: number | string;
2992
+ }
2978
2993
  export type SortOrderFlag = 1 | -1 | 0;
2979
2994
  export interface DataTableSlots {
2980
2995
  default?: () => VNode[];
@@ -3153,6 +3168,7 @@ export interface DataTableInjection {
3153
3168
  virtualScrollRef: Ref<boolean>;
3154
3169
  bodyWidthRef: Ref<number | null>;
3155
3170
  mergedTableLayoutRef: Ref<'auto' | 'fixed'>;
3171
+ resizableEnabledRef: Ref<boolean>;
3156
3172
  maxHeightRef: Ref<string | number | undefined>;
3157
3173
  minHeightRef: Ref<string | number | undefined>;
3158
3174
  rowPropsRef: Ref<CreateRowProps | undefined>;
@@ -64,6 +64,15 @@ export const dataTableProps = Object.assign(Object.assign({}, useTheme.props), {
64
64
  type: String,
65
65
  default: 'auto'
66
66
  },
67
+ resizableMinWidth: {
68
+ type: [Number, String],
69
+ default: 50
70
+ },
71
+ resizableMaxWidth: [Number, String],
72
+ resizableStorage: {
73
+ type: Boolean,
74
+ default: true
75
+ },
67
76
  allowCheckingNotLoaded: Boolean,
68
77
  cascade: {
69
78
  type: Boolean,
@@ -1,6 +1,6 @@
1
1
  import { computed } from 'vue';
2
2
  import { formatLength } from "../../_utils/index.mjs";
3
- import { createCustomWidthStyle, getColKey } from "./utils.mjs";
3
+ import { createCustomWidthStyle, getColKey, isColumnEllipsisEnabled } from "./utils/index.mjs";
4
4
  function getRowsAndCols(columns, getResizableWidth) {
5
5
  const rows = [];
6
6
  const cols = [];
@@ -27,7 +27,7 @@ function getRowsAndCols(columns, getResizableWidth) {
27
27
  });
28
28
  totalRowSpan += 1;
29
29
  if (!hasEllipsis) {
30
- hasEllipsis = !!column.ellipsis;
30
+ hasEllipsis = isColumnEllipsisEnabled(column);
31
31
  }
32
32
  dataRelatedCols.push(column);
33
33
  }
@@ -1,4 +1,4 @@
1
- import { REGEX } from "./utils.mjs";
1
+ import { REGEX } from "./utils/index.mjs";
2
2
  export function applyMask(value, mask) {
3
3
  if (!mask) return value;
4
4
  if (!value || value.trim() === '') return '';
@@ -2,6 +2,7 @@ import type { ColumnKey, TableColumn } from './interface';
2
2
  export declare function useResizable(): {
3
3
  getResizableWidth: (key: ColumnKey) => number | undefined;
4
4
  doUpdateResizableWidth: (column: TableColumn, width: number) => void;
5
+ setResizableWidths: (widths: Record<ColumnKey, number>) => void;
5
6
  clearResizableWidth: () => void;
6
7
  resizableWidthsRef: import("vue").Ref<Record<ColumnKey, number>, Record<ColumnKey, number>>;
7
8
  };
@@ -1,21 +1,24 @@
1
1
  import { ref } from 'vue';
2
- import { isColumnResizable } from "./utils.mjs";
3
2
  export function useResizable() {
4
3
  const resizableWidthsRef = ref({});
5
4
  function getResizableWidth(key) {
6
5
  return resizableWidthsRef.value[key];
7
6
  }
8
7
  function doUpdateResizableWidth(column, width) {
9
- if (isColumnResizable(column) && 'key' in column) {
8
+ if ('key' in column) {
10
9
  resizableWidthsRef.value[column.key] = width;
11
10
  }
12
11
  }
12
+ function setResizableWidths(widths) {
13
+ resizableWidthsRef.value = widths;
14
+ }
13
15
  function clearResizableWidth() {
14
16
  resizableWidthsRef.value = {};
15
17
  }
16
18
  return {
17
19
  getResizableWidth,
18
20
  doUpdateResizableWidth,
21
+ setResizableWidths,
19
22
  clearResizableWidth,
20
23
  resizableWidthsRef
21
24
  };
@@ -1,9 +1,10 @@
1
1
  import type { ComputedRef, Ref } from 'vue';
2
2
  import type { ColumnKey, DataTableSetupProps, MainTableRef, TableColumn } from './interface';
3
- export declare function useScroll(props: DataTableSetupProps, { mainTableInstRef, mergedCurrentPageRef, bodyWidthRef }: {
3
+ export declare function useScroll(props: DataTableSetupProps, { mainTableInstRef, mergedCurrentPageRef, bodyWidthRef, getResizableWidth }: {
4
4
  bodyWidthRef: Ref<null | number>;
5
5
  mainTableInstRef: Ref<MainTableRef | null>;
6
6
  mergedCurrentPageRef: ComputedRef<number>;
7
+ getResizableWidth: (key: ColumnKey) => number | undefined;
7
8
  }): {
8
9
  styleScrollXRef: ComputedRef<string | undefined>;
9
10
  fixedColumnLeftMapRef: ComputedRef<Record<ColumnKey, {
@@ -14,14 +15,14 @@ export declare function useScroll(props: DataTableSetupProps, { mainTableInstRef
14
15
  start: number;
15
16
  end: number;
16
17
  } | undefined>>;
17
- leftFixedColumnsRef: ComputedRef<TableColumn<any>[]>;
18
- rightFixedColumnsRef: ComputedRef<TableColumn<any>[]>;
18
+ leftFixedColumnsRef: ComputedRef<TableColumn[]>;
19
+ rightFixedColumnsRef: ComputedRef<TableColumn[]>;
19
20
  leftActiveFixedColKeyRef: Ref<ColumnKey | null, ColumnKey | null>;
20
21
  leftActiveFixedChildrenColKeysRef: Ref<ColumnKey[], ColumnKey[]>;
21
22
  rightActiveFixedColKeyRef: Ref<ColumnKey | null, ColumnKey | null>;
22
23
  rightActiveFixedChildrenColKeysRef: Ref<ColumnKey[], ColumnKey[]>;
23
24
  syncScrollState: () => void;
24
- handleTableBodyScroll: (e: Event) => void;
25
+ handleTableBodyScroll: (event: Event) => void;
25
26
  handleTableHeaderScroll: () => void;
26
27
  setHeaderScrollLeft: (left: number) => void;
27
28
  };
@@ -1,11 +1,12 @@
1
1
  import { beforeNextFrameOnce } from 'seemly';
2
2
  import { computed, ref, watch } from 'vue';
3
3
  import { formatLength } from "../../_utils/index.mjs";
4
- import { getColKey, getNumberColWidth } from "./utils.mjs";
4
+ import { getColKey, getNumberColWidth } from "./utils/index.mjs";
5
5
  export function useScroll(props, {
6
6
  mainTableInstRef,
7
7
  mergedCurrentPageRef,
8
- bodyWidthRef
8
+ bodyWidthRef,
9
+ getResizableWidth
9
10
  }) {
10
11
  let lastScrollLeft = 0;
11
12
  const scrollPartRef = ref();
@@ -25,18 +26,19 @@ export function useScroll(props, {
25
26
  const fixedColumnLeftMapRef = computed(() => {
26
27
  const columns = {};
27
28
  let left = 0;
28
- function traverse(cols) {
29
- cols.forEach(col => {
29
+ function traverse(columnList) {
30
+ columnList.forEach(column => {
31
+ var _a;
30
32
  const positionInfo = {
31
33
  start: left,
32
34
  end: 0
33
35
  };
34
- columns[getColKey(col)] = positionInfo;
35
- if ('children' in col) {
36
- traverse(col.children);
36
+ columns[getColKey(column)] = positionInfo;
37
+ if ('children' in column) {
38
+ traverse(column.children);
37
39
  positionInfo.end = left;
38
40
  } else {
39
- left += getNumberColWidth(col) || 0;
41
+ left += ((_a = getResizableWidth(getColKey(column))) !== null && _a !== void 0 ? _a : getNumberColWidth(column)) || 0;
40
42
  positionInfo.end = left;
41
43
  }
42
44
  });
@@ -47,19 +49,20 @@ export function useScroll(props, {
47
49
  const fixedColumnRightMapRef = computed(() => {
48
50
  const columns = {};
49
51
  let right = 0;
50
- function traverse(cols) {
51
- for (let i = cols.length - 1; i >= 0; --i) {
52
- const col = cols[i];
52
+ function traverse(columnList) {
53
+ var _a;
54
+ for (let index = columnList.length - 1; index >= 0; --index) {
55
+ const column = columnList[index];
53
56
  const positionInfo = {
54
57
  start: right,
55
58
  end: 0
56
59
  };
57
- columns[getColKey(col)] = positionInfo;
58
- if ('children' in col) {
59
- traverse(col.children);
60
+ columns[getColKey(column)] = positionInfo;
61
+ if ('children' in column) {
62
+ traverse(column.children);
60
63
  positionInfo.end = right;
61
64
  } else {
62
- right += getNumberColWidth(col) || 0;
65
+ right += ((_a = getResizableWidth(getColKey(column))) !== null && _a !== void 0 ? _a : getNumberColWidth(column)) || 0;
63
66
  positionInfo.end = right;
64
67
  }
65
68
  }
@@ -78,8 +81,8 @@ export function useScroll(props, {
78
81
  value: fixedColumnLeftMap
79
82
  } = fixedColumnLeftMapRef;
80
83
  let leftActiveFixedColKey = null;
81
- for (let i = 0; i < leftFixedColumns.length; ++i) {
82
- const key = getColKey(leftFixedColumns[i]);
84
+ for (let index = 0; index < leftFixedColumns.length; ++index) {
85
+ const key = getColKey(leftFixedColumns[index]);
83
86
  if (lastScrollLeft > (((_a = fixedColumnLeftMap[key]) === null || _a === void 0 ? void 0 : _a.start) || 0) - leftWidth) {
84
87
  leftActiveFixedColKey = key;
85
88
  leftWidth = ((_b = fixedColumnLeftMap[key]) === null || _b === void 0 ? void 0 : _b.end) || 0;
@@ -91,7 +94,7 @@ export function useScroll(props, {
91
94
  }
92
95
  function deriveActiveLeftFixedChildrenColumns() {
93
96
  leftActiveFixedChildrenColKeysRef.value = [];
94
- let activeLeftFixedColumn = props.columns.find(col => getColKey(col) === leftActiveFixedColKeyRef.value);
97
+ let activeLeftFixedColumn = props.columns.find(column => getColKey(column) === leftActiveFixedColKeyRef.value);
95
98
  while (activeLeftFixedColumn && 'children' in activeLeftFixedColumn) {
96
99
  const length = activeLeftFixedColumn.children.length;
97
100
  if (length === 0) break;
@@ -116,8 +119,8 @@ export function useScroll(props, {
116
119
  const {
117
120
  value: fixedColumnRightMap
118
121
  } = fixedColumnRightMapRef;
119
- for (let i = rightFixedColumns.length - 1; i >= 0; --i) {
120
- const key = getColKey(rightFixedColumns[i]);
122
+ for (let index = rightFixedColumns.length - 1; index >= 0; --index) {
123
+ const key = getColKey(rightFixedColumns[index]);
121
124
  if (Math.round(lastScrollLeft + (((_a = fixedColumnRightMap[key]) === null || _a === void 0 ? void 0 : _a.start) || 0) + tableWidth - rightWidth) < scrollWidth) {
122
125
  rightActiveFixedColKey = key;
123
126
  rightWidth = ((_b = fixedColumnRightMap[key]) === null || _b === void 0 ? void 0 : _b.end) || 0;
@@ -129,7 +132,7 @@ export function useScroll(props, {
129
132
  }
130
133
  function deriveActiveRightFixedChildrenColumns() {
131
134
  rightActiveFixedChildrenColKeysRef.value = [];
132
- let activeRightFixedColumn = props.columns.find(col => getColKey(col) === rightActiveFixedColKeyRef.value);
135
+ let activeRightFixedColumn = props.columns.find(column => getColKey(column) === rightActiveFixedColKeyRef.value);
133
136
  while (activeRightFixedColumn && 'children' in activeRightFixedColumn && activeRightFixedColumn.children.length) {
134
137
  const nextActiveRightFixedColumn = activeRightFixedColumn.children[0];
135
138
  rightActiveFixedChildrenColKeysRef.value.push(getColKey(nextActiveRightFixedColumn));
@@ -137,8 +140,9 @@ export function useScroll(props, {
137
140
  }
138
141
  }
139
142
  function getScrollElements() {
140
- const header = mainTableInstRef.value ? mainTableInstRef.value.getHeaderElement() : null;
141
- const body = mainTableInstRef.value ? mainTableInstRef.value.getBodyElement() : null;
143
+ var _a, _b, _c, _d;
144
+ const header = (_b = (_a = mainTableInstRef.value) === null || _a === void 0 ? void 0 : _a.getHeaderElement()) !== null && _b !== void 0 ? _b : null;
145
+ const body = (_d = (_c = mainTableInstRef.value) === null || _c === void 0 ? void 0 : _c.getBodyElement()) !== null && _d !== void 0 ? _d : null;
142
146
  return {
143
147
  header,
144
148
  body
@@ -159,9 +163,9 @@ export function useScroll(props, {
159
163
  scrollPartRef.value = undefined;
160
164
  }
161
165
  }
162
- function handleTableBodyScroll(e) {
166
+ function handleTableBodyScroll(event) {
163
167
  var _a;
164
- (_a = props.onScroll) === null || _a === void 0 ? void 0 : _a.call(props, e);
168
+ (_a = props.onScroll) === null || _a === void 0 ? void 0 : _a.call(props, event);
165
169
  if (scrollPartRef.value !== 'head') {
166
170
  beforeNextFrameOnce(syncScrollState);
167
171
  } else {
@@ -1,6 +1,6 @@
1
1
  import { computed, ref } from 'vue';
2
2
  import { call } from "../../_utils/index.mjs";
3
- import { getFlagOfOrder } from "./utils.mjs";
3
+ import { getFlagOfOrder } from "./utils/index.mjs";
4
4
  function getMultiplePriority(sorter) {
5
5
  if (typeof sorter === 'object' && typeof sorter.multiple === 'number') {
6
6
  return sorter.multiple;
@@ -3,7 +3,7 @@ import { useMemo, useMergedState } from 'vooks';
3
3
  import { computed, ref } from 'vue';
4
4
  import { call, warn } from "../../_utils/index.mjs";
5
5
  import { useSorter } from "./use-sorter.mjs";
6
- import { createShallowClonedObject } from "./utils.mjs";
6
+ import { createShallowClonedObject } from "./utils/index.mjs";
7
7
  // useTableData combines filter, sorter and pagination
8
8
  export function useTableData(props, {
9
9
  dataRelatedColsRef
@@ -0,0 +1,13 @@
1
+ import type { CSSProperties } from 'vue';
2
+ import type { CreateRowClassName, InternalRowData, TableBaseColumn, TableColumn, TableExpandColumn, TableSelectionColumn } from '../interface';
3
+ export declare const SELECTION_COL_WIDTH = 40;
4
+ export declare const EXPAND_COL_WIDTH = 40;
5
+ export declare function getNumberColWidth(column: TableColumn): number | undefined;
6
+ export declare function getStringColWidth(column: TableColumn): string | undefined;
7
+ export declare function getColKey(column: TableColumn): string | number;
8
+ export declare function createCustomWidthStyle(column: TableBaseColumn | TableSelectionColumn | TableExpandColumn, resizedWidth?: string): CSSProperties;
9
+ export declare function createRowClassName(row: InternalRowData, index: number, rowClassName?: string | CreateRowClassName): string;
10
+ export declare function isColumnSortable(column: TableColumn): boolean;
11
+ export declare function isColumnEllipsisEnabled(column: Pick<TableColumn, 'ellipsis'>): boolean;
12
+ export declare function isColumnResizable(column: TableColumn): boolean;
13
+ export declare function isColumnFilterable(column: TableColumn): boolean;