@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
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultNumericMask = exports.REGEX = void 0;
4
+ exports.REGEX = {
5
+ ONLY_DIGITS: /\D/g,
6
+ ONLY_NUMERIC_AND_DOT: /[^\d.]/g
7
+ };
8
+ exports.defaultNumericMask = {
9
+ postProcess: (value) => {
10
+ if (!value)
11
+ return '';
12
+ const negative = value.trim().startsWith('-');
13
+ const cleaned = value.replace(/[^\d.,]/g, '').replace(',', '.');
14
+ const [integerPartRaw, decimalPartRaw = ''] = cleaned.split('.', 2);
15
+ const integerPart = integerPartRaw.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
16
+ const decimalPart = decimalPartRaw.slice(0, 2);
17
+ const result = cleaned.includes('.')
18
+ ? `${integerPart}.${decimalPart}`
19
+ : integerPart;
20
+ return negative ? `-${result}` : result;
21
+ }
22
+ };
@@ -0,0 +1,6 @@
1
+ import type { ColumnWidthComputationItem, TableBaseColumn, TableExpandColumn, TableSelectionColumn } from '../interface';
2
+ type ResizableLeafColumn = TableSelectionColumn | TableBaseColumn | TableExpandColumn;
3
+ export declare function deriveVisibleLeafColumnWidthItems(columns: ResizableLeafColumn[]): ColumnWidthComputationItem[];
4
+ export declare function deriveResizableColumnWidthItems(columns: ResizableLeafColumn[]): ColumnWidthComputationItem[];
5
+ export declare function deriveColumnWidthSignature(columns: ColumnWidthComputationItem[]): string;
6
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deriveVisibleLeafColumnWidthItems = deriveVisibleLeafColumnWidthItems;
4
+ exports.deriveResizableColumnWidthItems = deriveResizableColumnWidthItems;
5
+ exports.deriveColumnWidthSignature = deriveColumnWidthSignature;
6
+ const column_utils_1 = require("./column-utils");
7
+ function toColumnWidthItem(column) {
8
+ return {
9
+ key: (0, column_utils_1.getColKey)(column),
10
+ width: column.width,
11
+ minWidth: column.minWidth,
12
+ maxWidth: column.maxWidth
13
+ };
14
+ }
15
+ function deriveVisibleLeafColumnWidthItems(columns) {
16
+ return columns.map(column => toColumnWidthItem(column));
17
+ }
18
+ function deriveResizableColumnWidthItems(columns) {
19
+ return columns
20
+ .filter(column => (0, column_utils_1.isColumnResizable)(column))
21
+ .map(column => toColumnWidthItem(column));
22
+ }
23
+ function deriveColumnWidthSignature(columns) {
24
+ return columns
25
+ .map((column) => {
26
+ var _a, _b, _c;
27
+ return [
28
+ String(column.key),
29
+ String((_a = column.width) !== null && _a !== void 0 ? _a : ''),
30
+ String((_b = column.minWidth) !== null && _b !== void 0 ? _b : ''),
31
+ String((_c = column.maxWidth) !== null && _c !== void 0 ? _c : '')
32
+ ].join(':');
33
+ })
34
+ .join('|');
35
+ }
@@ -0,0 +1,6 @@
1
+ import type { SortOrder, SortOrderFlag, SortState, TableBaseColumn, TableColumn } from '../interface';
2
+ export declare function createShallowClonedObject<T>(object: T): T;
3
+ export declare function getFlagOfOrder(order: SortOrder): SortOrderFlag;
4
+ export declare function shouldUseArrayInSingleMode(column: TableBaseColumn): boolean;
5
+ export declare function createNextSorter(column: TableBaseColumn, currentSortState: SortState | null): SortState | null;
6
+ export declare function isColumnSorting(column: TableColumn, mergedSortState: SortState[]): boolean;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createShallowClonedObject = createShallowClonedObject;
4
+ exports.getFlagOfOrder = getFlagOfOrder;
5
+ exports.shouldUseArrayInSingleMode = shouldUseArrayInSingleMode;
6
+ exports.createNextSorter = createNextSorter;
7
+ exports.isColumnSorting = isColumnSorting;
8
+ function createShallowClonedObject(object) {
9
+ if (!object)
10
+ return object;
11
+ if (typeof object === 'object') {
12
+ return Object.assign({}, object);
13
+ }
14
+ return object;
15
+ }
16
+ function getFlagOfOrder(order) {
17
+ if (order === 'ascend')
18
+ return 1;
19
+ else if (order === 'descend')
20
+ return -1;
21
+ return 0;
22
+ }
23
+ // for compatibility
24
+ // If column.filterOptionValues or column.defaultFilterOptionValues is set, use
25
+ // array value
26
+ function shouldUseArrayInSingleMode(column) {
27
+ return (column.filterOptionValues !== undefined
28
+ || (column.filterOptionValue === undefined
29
+ && column.defaultFilterOptionValues !== undefined));
30
+ }
31
+ function getNextOrderOf(order) {
32
+ if (!order)
33
+ return 'descend';
34
+ else if (order === 'descend')
35
+ return 'ascend';
36
+ return false;
37
+ }
38
+ function createNextSorter(column, currentSortState) {
39
+ if (column.sorter === undefined)
40
+ return null;
41
+ if (currentSortState === null || currentSortState.columnKey !== column.key) {
42
+ return {
43
+ columnKey: column.key,
44
+ sorter: column.sorter,
45
+ order: getNextOrderOf(false)
46
+ };
47
+ }
48
+ else {
49
+ return Object.assign(Object.assign({}, currentSortState), { order: getNextOrderOf(currentSortState.order) });
50
+ }
51
+ }
52
+ function isColumnSorting(column, mergedSortState) {
53
+ return mergedSortState.some(state => state.columnKey === column.key && state.order);
54
+ }
@@ -0,0 +1,20 @@
1
+ import type { ColumnKey, ColumnWidthComputationItem, TableBaseColumn, TableExpandColumn, TableSelectionColumn } from '../interface';
2
+ export interface ColumnWidthConstraint {
3
+ min?: number;
4
+ max?: number;
5
+ }
6
+ export declare function clampValueFollowCSSRules(value: number, min?: number | string, max?: number | string): number;
7
+ export declare function parseLengthToNumber(value: number | string | undefined): number | undefined;
8
+ export declare function resolveColumnWidthConstraint(column: TableBaseColumn | TableSelectionColumn | TableExpandColumn | ColumnWidthComputationItem, systemMinWidth?: number | string, systemMaxWidth?: number | string): ColumnWidthConstraint;
9
+ export declare function computeFixedTableColumnWidths(columns: ColumnWidthComputationItem[], { containerWidth, systemMinWidth, systemMaxWidth, preferredWidths }: {
10
+ containerWidth?: number;
11
+ systemMinWidth?: number | string;
12
+ systemMaxWidth?: number | string;
13
+ preferredWidths?: Record<ColumnKey, number>;
14
+ }): Record<ColumnKey, number>;
15
+ export declare function sanitizeColumnWidthMap(columns: ColumnWidthComputationItem[], { systemMinWidth, systemMaxWidth, source }: {
16
+ systemMinWidth?: number | string;
17
+ systemMaxWidth?: number | string;
18
+ source: Record<ColumnKey, number> | undefined;
19
+ }): Record<ColumnKey, number>;
20
+ export declare function areColumnWidthMapsEqual(previousWidths: Record<ColumnKey, number>, nextWidths: Record<ColumnKey, number>, keys: ColumnKey[]): boolean;
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clampValueFollowCSSRules = clampValueFollowCSSRules;
4
+ exports.parseLengthToNumber = parseLengthToNumber;
5
+ exports.resolveColumnWidthConstraint = resolveColumnWidthConstraint;
6
+ exports.computeFixedTableColumnWidths = computeFixedTableColumnWidths;
7
+ exports.sanitizeColumnWidthMap = sanitizeColumnWidthMap;
8
+ exports.areColumnWidthMapsEqual = areColumnWidthMapsEqual;
9
+ const WIDTH_PRECISION = 1000;
10
+ const WIDTH_EPSILON = 1e-6;
11
+ // priority: min-width > max-width > width
12
+ function clampValueFollowCSSRules(value, min, max) {
13
+ if (max !== undefined) {
14
+ value = Math.min(value, typeof max === 'number' ? max : Number.parseFloat(max));
15
+ }
16
+ if (min !== undefined) {
17
+ value = Math.max(value, typeof min === 'number' ? min : Number.parseFloat(min));
18
+ }
19
+ return value;
20
+ }
21
+ function parseLengthToNumber(value) {
22
+ if (value === undefined)
23
+ return;
24
+ const parsed = typeof value === 'number' ? value : Number.parseFloat(value);
25
+ if (!Number.isFinite(parsed))
26
+ return;
27
+ return parsed;
28
+ }
29
+ function roundWidth(width) {
30
+ return Math.round(width * WIDTH_PRECISION) / WIDTH_PRECISION;
31
+ }
32
+ function normalizeWidthConstraint(min, max) {
33
+ if (min !== undefined && max !== undefined && max < min) {
34
+ return {
35
+ min,
36
+ max: min
37
+ };
38
+ }
39
+ return { min, max };
40
+ }
41
+ function resolveColumnWidthConstraint(column, systemMinWidth, systemMaxWidth) {
42
+ var _a, _b;
43
+ const min = parseLengthToNumber((_a = column.minWidth) !== null && _a !== void 0 ? _a : systemMinWidth);
44
+ const max = parseLengthToNumber((_b = column.maxWidth) !== null && _b !== void 0 ? _b : systemMaxWidth);
45
+ return normalizeWidthConstraint(min, max);
46
+ }
47
+ function clampByConstraint(value, constraint) {
48
+ return clampValueFollowCSSRules(value, constraint.min, constraint.max);
49
+ }
50
+ function normalizeIncomingWidth(value, constraint) {
51
+ if (typeof value !== 'number' || !Number.isFinite(value))
52
+ return;
53
+ if (value <= 0)
54
+ return;
55
+ return roundWidth(clampByConstraint(value, constraint));
56
+ }
57
+ function fillRemainingWidthFrom(widths, constraints, delta, startIndex) {
58
+ if (delta <= 0 || widths.length === 0)
59
+ return;
60
+ let remaining = delta;
61
+ let cursor = startIndex;
62
+ let blockedTurns = 0;
63
+ while (remaining > WIDTH_EPSILON && blockedTurns < widths.length) {
64
+ const index = (cursor + widths.length) % widths.length;
65
+ const { max } = constraints[index];
66
+ const current = widths[index];
67
+ const capacity = max === undefined ? Number.POSITIVE_INFINITY : max - current;
68
+ if (capacity > WIDTH_EPSILON) {
69
+ const append = capacity === Number.POSITIVE_INFINITY
70
+ ? remaining
71
+ : Math.min(capacity, remaining);
72
+ widths[index] = roundWidth(current + append);
73
+ remaining = roundWidth(remaining - append);
74
+ blockedTurns = 0;
75
+ }
76
+ else {
77
+ blockedTurns += 1;
78
+ }
79
+ cursor += 1;
80
+ }
81
+ }
82
+ function assignFlexibleWidths(widths, constraints, target, flexibleIndexes) {
83
+ const unresolved = new Set(flexibleIndexes);
84
+ let remainingTarget = target;
85
+ while (unresolved.size > 0) {
86
+ const share = remainingTarget / unresolved.size;
87
+ let didClamp = false;
88
+ for (const index of Array.from(unresolved)) {
89
+ const limited = roundWidth(clampByConstraint(share, constraints[index]));
90
+ if (Math.abs(limited - share) > WIDTH_EPSILON) {
91
+ widths[index] = limited;
92
+ unresolved.delete(index);
93
+ remainingTarget = roundWidth(remainingTarget - limited);
94
+ didClamp = true;
95
+ }
96
+ }
97
+ if (!didClamp) {
98
+ unresolved.forEach((index) => {
99
+ widths[index] = roundWidth(clampByConstraint(share, constraints[index]));
100
+ });
101
+ unresolved.clear();
102
+ }
103
+ }
104
+ }
105
+ function computeFixedTableColumnWidths(columns, { containerWidth, systemMinWidth, systemMaxWidth, preferredWidths }) {
106
+ var _a;
107
+ const constraints = columns.map(column => resolveColumnWidthConstraint(column, systemMinWidth, systemMaxWidth));
108
+ const widths = columns.map((column, index) => {
109
+ const preferred = normalizeIncomingWidth(preferredWidths === null || preferredWidths === void 0 ? void 0 : preferredWidths[column.key], constraints[index]);
110
+ if (preferred !== undefined)
111
+ return preferred;
112
+ const width = parseLengthToNumber(column.width);
113
+ if (width === undefined)
114
+ return undefined;
115
+ return roundWidth(clampByConstraint(width, constraints[index]));
116
+ });
117
+ const canFitContainer = containerWidth !== undefined
118
+ && Number.isFinite(containerWidth)
119
+ && containerWidth > 0;
120
+ const flexibleIndexes = [];
121
+ widths.forEach((width, index) => {
122
+ if (width === undefined)
123
+ flexibleIndexes.push(index);
124
+ });
125
+ if (flexibleIndexes.length) {
126
+ if (canFitContainer) {
127
+ const allocated = (_a = widths.reduce((accumulatedWidth = 0, width) => accumulatedWidth + (width !== null && width !== void 0 ? width : 0), 0)) !== null && _a !== void 0 ? _a : 0;
128
+ assignFlexibleWidths(widths, constraints, containerWidth - allocated, flexibleIndexes);
129
+ }
130
+ else {
131
+ flexibleIndexes.forEach((index) => {
132
+ const { min, max } = constraints[index];
133
+ if (min !== undefined) {
134
+ widths[index] = roundWidth(min);
135
+ }
136
+ else if (max !== undefined) {
137
+ widths[index] = roundWidth(max);
138
+ }
139
+ else {
140
+ widths[index] = 0;
141
+ }
142
+ });
143
+ }
144
+ }
145
+ const normalizedWidths = widths.map((width, index) => {
146
+ const base = width !== null && width !== void 0 ? width : 0;
147
+ return roundWidth(clampByConstraint(base, constraints[index]));
148
+ });
149
+ if (canFitContainer) {
150
+ const totalWidth = normalizedWidths.reduce((accumulatedWidth, width) => accumulatedWidth + width, 0);
151
+ if (totalWidth < containerWidth) {
152
+ fillRemainingWidthFrom(normalizedWidths, constraints, containerWidth - totalWidth, normalizedWidths.length - 1);
153
+ }
154
+ }
155
+ const result = {};
156
+ columns.forEach((column, index) => {
157
+ result[column.key] = roundWidth(normalizedWidths[index]);
158
+ });
159
+ return result;
160
+ }
161
+ function sanitizeColumnWidthMap(columns, { systemMinWidth, systemMaxWidth, source }) {
162
+ if (!source)
163
+ return {};
164
+ const result = {};
165
+ columns.forEach((column) => {
166
+ const constraint = resolveColumnWidthConstraint(column, systemMinWidth, systemMaxWidth);
167
+ const sanitized = normalizeIncomingWidth(source[column.key], constraint);
168
+ if (sanitized !== undefined) {
169
+ result[column.key] = sanitized;
170
+ }
171
+ });
172
+ return result;
173
+ }
174
+ function areColumnWidthMapsEqual(previousWidths, nextWidths, keys) {
175
+ var _a, _b;
176
+ for (const key of keys) {
177
+ if (((_a = previousWidths[key]) !== null && _a !== void 0 ? _a : undefined) !== ((_b = nextWidths[key]) !== null && _b !== void 0 ? _b : undefined)) {
178
+ return false;
179
+ }
180
+ }
181
+ return true;
182
+ }
@@ -1,25 +1 @@
1
- import type { CSSProperties } from 'vue';
2
- import type { CreateRowClassName, InternalRowData, RowData, SortOrder, SortOrderFlag, SortState, TableBaseColumn, TableColumn, TableColumnMaskObject, TableExpandColumn, TableSelectionColumn } from './interface';
3
- import type { DataTableGetCsvCell, DataTableGetCsvHeader } from './public-types';
4
- export declare const SELECTION_COL_WIDTH = 40;
5
- export declare const EXPAND_COL_WIDTH = 40;
6
- export declare const REGEX: {
7
- ONLY_DIGITS: RegExp;
8
- ONLY_NUMERIC_AND_DOT: RegExp;
9
- };
10
- export declare const defaultNumericMask: TableColumnMaskObject;
11
- export declare function getNumberColWidth(col: TableColumn): number | undefined;
12
- export declare function getStringColWidth(col: TableColumn): string | undefined;
13
- export declare function getColKey(col: TableColumn): string | number;
14
- export declare function createShallowClonedObject<T>(object: T): T;
15
- export declare function getFlagOfOrder(order: SortOrder): SortOrderFlag;
16
- export declare function clampValueFollowCSSRules(value: number, min?: number | string, max?: number | string): number;
17
- export declare function createCustomWidthStyle(column: TableBaseColumn | TableSelectionColumn | TableExpandColumn, resizedWidth?: string): CSSProperties;
18
- export declare function createRowClassName(row: InternalRowData, index: number, rowClassName?: string | CreateRowClassName): string;
19
- export declare function shouldUseArrayInSingleMode(column: TableBaseColumn): boolean;
20
- export declare function isColumnSortable(column: TableColumn): boolean;
21
- export declare function isColumnResizable(column: TableColumn): boolean;
22
- export declare function isColumnFilterable(column: TableColumn): boolean;
23
- export declare function createNextSorter(column: TableBaseColumn, currentSortState: SortState | null): SortState | null;
24
- export declare function isColumnSorting(column: TableColumn, mergedSortState: SortState[]): boolean;
25
- export declare function generateCsv(columns: TableColumn[], data: RowData[], getCsvCell: DataTableGetCsvCell | undefined, getCsvHeader: DataTableGetCsvHeader | undefined): string;
1
+ export * from './utils/index';
@@ -1,231 +1,17 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultNumericMask = exports.REGEX = exports.EXPAND_COL_WIDTH = exports.SELECTION_COL_WIDTH = void 0;
4
- exports.getNumberColWidth = getNumberColWidth;
5
- exports.getStringColWidth = getStringColWidth;
6
- exports.getColKey = getColKey;
7
- exports.createShallowClonedObject = createShallowClonedObject;
8
- exports.getFlagOfOrder = getFlagOfOrder;
9
- exports.clampValueFollowCSSRules = clampValueFollowCSSRules;
10
- exports.createCustomWidthStyle = createCustomWidthStyle;
11
- exports.createRowClassName = createRowClassName;
12
- exports.shouldUseArrayInSingleMode = shouldUseArrayInSingleMode;
13
- exports.isColumnSortable = isColumnSortable;
14
- exports.isColumnResizable = isColumnResizable;
15
- exports.isColumnFilterable = isColumnFilterable;
16
- exports.createNextSorter = createNextSorter;
17
- exports.isColumnSorting = isColumnSorting;
18
- exports.generateCsv = generateCsv;
19
- const seemly_1 = require("seemly");
20
- const _utils_1 = require("../../_utils");
21
- exports.SELECTION_COL_WIDTH = 40;
22
- exports.EXPAND_COL_WIDTH = 40;
23
- exports.REGEX = {
24
- ONLY_DIGITS: /\D/g,
25
- ONLY_NUMERIC_AND_DOT: /[^\d.]/g
26
- };
27
- exports.defaultNumericMask = {
28
- postProcess: (value) => {
29
- if (!value)
30
- return '';
31
- const isNegative = value.trim().startsWith('-');
32
- const cleaned = value.replace(/[^\d.,]/g, '').replace(',', '.');
33
- const [intPartRaw, decimalPartRaw = ''] = cleaned.split('.', 2);
34
- const intPart = intPartRaw.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
35
- const decimalPart = decimalPartRaw.slice(0, 2);
36
- const result = cleaned.includes('.') ? `${intPart}.${decimalPart}` : intPart;
37
- return isNegative ? `-${result}` : result;
38
- }
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
39
15
  };
40
- function getNumberColWidth(col) {
41
- if (col.type === 'selection') {
42
- return col.width === undefined ? exports.SELECTION_COL_WIDTH : (0, seemly_1.depx)(col.width);
43
- }
44
- if (col.type === 'expand') {
45
- return col.width === undefined ? exports.EXPAND_COL_WIDTH : (0, seemly_1.depx)(col.width);
46
- }
47
- if ('children' in col)
48
- return undefined;
49
- if (typeof col.width === 'string') {
50
- return (0, seemly_1.depx)(col.width);
51
- }
52
- return col.width;
53
- }
54
- function getStringColWidth(col) {
55
- var _a, _b;
56
- if (col.type === 'selection') {
57
- return (0, _utils_1.formatLength)((_a = col.width) !== null && _a !== void 0 ? _a : exports.SELECTION_COL_WIDTH);
58
- }
59
- if (col.type === 'expand') {
60
- return (0, _utils_1.formatLength)((_b = col.width) !== null && _b !== void 0 ? _b : exports.EXPAND_COL_WIDTH);
61
- }
62
- if ('children' in col) {
63
- return undefined;
64
- }
65
- return (0, _utils_1.formatLength)(col.width);
66
- }
67
- function getColKey(col) {
68
- if (col.type === 'selection')
69
- return '__n_selection__';
70
- if (col.type === 'expand')
71
- return '__n_expand__';
72
- return col.key;
73
- }
74
- function createShallowClonedObject(object) {
75
- if (!object)
76
- return object;
77
- if (typeof object === 'object') {
78
- return Object.assign({}, object);
79
- }
80
- return object;
81
- }
82
- function getFlagOfOrder(order) {
83
- if (order === 'ascend')
84
- return 1;
85
- else if (order === 'descend')
86
- return -1;
87
- return 0;
88
- }
89
- // priority: min-width > max-width > width
90
- function clampValueFollowCSSRules(value, min, max) {
91
- if (max !== undefined) {
92
- value = Math.min(value, typeof max === 'number' ? max : Number.parseFloat(max));
93
- }
94
- if (min !== undefined) {
95
- value = Math.max(value, typeof min === 'number' ? min : Number.parseFloat(min));
96
- }
97
- return value;
98
- }
99
- function createCustomWidthStyle(column, resizedWidth) {
100
- var _a;
101
- if (resizedWidth !== undefined) {
102
- const numWidth = (0, seemly_1.depx)(resizedWidth);
103
- const minMaxColumn = column && 'minWidth' in column && 'maxWidth' in column
104
- ? column
105
- : null;
106
- const clampedNum = minMaxColumn
107
- ? clampValueFollowCSSRules(numWidth, minMaxColumn.minWidth, minMaxColumn.maxWidth)
108
- : numWidth;
109
- const clamped = (0, _utils_1.formatLength)(clampedNum);
110
- return {
111
- width: clamped,
112
- minWidth: clamped,
113
- maxWidth: clamped
114
- };
115
- }
116
- const explicitNum = (_a = getNumberColWidth(column)) !== null && _a !== void 0 ? _a : undefined;
117
- const minWidth = column && 'minWidth' in column
118
- ? column.minWidth
119
- : undefined;
120
- const maxWidth = column && 'maxWidth' in column
121
- ? column.maxWidth
122
- : undefined;
123
- let widthNum = explicitNum;
124
- if (widthNum === undefined
125
- && (minWidth !== undefined || maxWidth !== undefined)) {
126
- widthNum = clampValueFollowCSSRules(maxWidth !== undefined
127
- ? typeof maxWidth === 'number'
128
- ? maxWidth
129
- : Number.parseFloat(maxWidth)
130
- : minWidth !== undefined
131
- ? typeof minWidth === 'number'
132
- ? minWidth
133
- : Number.parseFloat(minWidth)
134
- : 0, minWidth, maxWidth);
135
- }
136
- else if (widthNum !== undefined
137
- && (minWidth !== undefined || maxWidth !== undefined)) {
138
- widthNum = clampValueFollowCSSRules(widthNum, minWidth, maxWidth);
139
- }
140
- const width = widthNum !== undefined
141
- ? (0, _utils_1.formatLength)(widthNum)
142
- : getStringColWidth(column);
143
- return {
144
- width,
145
- minWidth: (0, _utils_1.formatLength)(minWidth) || width,
146
- maxWidth: (0, _utils_1.formatLength)(maxWidth)
147
- };
148
- }
149
- function createRowClassName(row, index, rowClassName) {
150
- if (typeof rowClassName === 'function')
151
- return rowClassName(row, index);
152
- return rowClassName || '';
153
- }
154
- // for compatibility
155
- // If column.filterOptionValues or column.defaultFilterOptionValues is set, use
156
- // array value
157
- function shouldUseArrayInSingleMode(column) {
158
- return (column.filterOptionValues !== undefined
159
- || (column.filterOptionValue === undefined
160
- && column.defaultFilterOptionValues !== undefined));
161
- }
162
- function isColumnSortable(column) {
163
- if ('children' in column)
164
- return false;
165
- return !!column.sorter;
166
- }
167
- function isColumnResizable(column) {
168
- if ('children' in column && !!column.children.length)
169
- return false;
170
- return !!column.resizable;
171
- }
172
- function isColumnFilterable(column) {
173
- if ('children' in column)
174
- return false;
175
- return (!!column.filter && (!!column.filterOptions || !!column.renderFilterMenu));
176
- }
177
- function getNextOrderOf(order) {
178
- if (!order)
179
- return 'descend';
180
- else if (order === 'descend')
181
- return 'ascend';
182
- return false;
183
- }
184
- function createNextSorter(column, currentSortState) {
185
- if (column.sorter === undefined)
186
- return null;
187
- if (currentSortState === null || currentSortState.columnKey !== column.key) {
188
- return {
189
- columnKey: column.key,
190
- sorter: column.sorter,
191
- order: getNextOrderOf(false)
192
- };
193
- }
194
- else {
195
- return Object.assign(Object.assign({}, currentSortState), { order: getNextOrderOf(currentSortState.order) });
196
- }
197
- }
198
- function isColumnSorting(column, mergedSortState) {
199
- return (mergedSortState.find(state => state.columnKey === column.key && state.order) !== undefined);
200
- }
201
- function formatCsvCell(value) {
202
- if (typeof value === 'string') {
203
- return value.replace(/,/g, '\\,');
204
- }
205
- else if (value === null || value === undefined) {
206
- return '';
207
- }
208
- else {
209
- return `${value}`.replace(/,/g, '\\,');
210
- }
211
- }
212
- function generateCsv(columns, data, getCsvCell, getCsvHeader) {
213
- const exportableColumns = columns.filter(column => column.type !== 'expand'
214
- && column.type !== 'selection'
215
- && column.allowExport !== false);
216
- const header = exportableColumns
217
- .map((col) => {
218
- return getCsvHeader ? getCsvHeader(col) : col.title;
219
- })
220
- .join(',');
221
- const rows = data.map((row) => {
222
- return exportableColumns
223
- .map((col) => {
224
- return getCsvCell
225
- ? getCsvCell(row[col.key], row, col)
226
- : formatCsvCell(row[col.key]);
227
- })
228
- .join(',');
229
- });
230
- return [header, ...rows].join('\n');
231
- }
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./utils/index"), exports);
@@ -96,11 +96,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
96
96
  readonly default: 0;
97
97
  };
98
98
  }>> & Readonly<{}>, {
99
+ readonly cols: string | number;
99
100
  readonly responsive: "self" | "screen";
100
101
  readonly collapsed: boolean;
101
102
  readonly xGap: string | number;
102
103
  readonly yGap: string | number;
103
- readonly cols: string | number;
104
104
  readonly layoutShiftDisabled: boolean;
105
105
  readonly itemResponsive: boolean;
106
106
  readonly collapsedRows: number;
@@ -75,7 +75,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
75
75
  }>> & Readonly<{}>, {
76
76
  readonly loading: boolean;
77
77
  readonly results: HeaderSearchResult[];
78
- readonly version: "desktop" | "mobile";
78
+ readonly version: "mobile" | "desktop";
79
79
  readonly query: string;
80
80
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
81
81
  export default _default;
@@ -119,7 +119,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
119
119
  cols: number;
120
120
  }, any>>>;
121
121
  }>> & Readonly<{}>, {
122
- readonly items: IconBarItemProps[];
123
122
  readonly cols: number;
123
+ readonly items: IconBarItemProps[];
124
124
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
125
125
  export default _default;
@@ -1134,10 +1134,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1134
1134
  defaultValue: string | [string, string] | null;
1135
1135
  round: boolean;
1136
1136
  loadingSkeleton: boolean;
1137
+ rows: string | number;
1137
1138
  stateful: boolean;
1138
1139
  resizable: boolean;
1139
1140
  pair: boolean;
1140
- rows: string | number;
1141
1141
  autosize: boolean | {
1142
1142
  minRows?: number;
1143
1143
  maxRows?: number;
@@ -1,6 +1,6 @@
1
1
  import type { Component, ComputedRef, Slot } from 'vue';
2
2
  import type { ArrayEmptyHandler, ArrayFocusHandler, ArrayKeyboardHandler, ArrayMouseHandler, KeyboardEventHandler, MouseEventHandler } from '../../_utils';
3
- import type { Size } from './interface';
3
+ import type { RenderableType, Size } from './interface';
4
4
  import type { DescriptionPropsObject, HeaderPropObject } from './props';
5
5
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
6
  avatar: {
@@ -155,7 +155,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
155
155
  loadingSkeleton: import("./interface").BooleanProp;
156
156
  icon: import("./interface").RenderableProp;
157
157
  }>> & Readonly<{}>, {
158
- icon: import("./interface").RenderableType;
158
+ icon: RenderableType;
159
159
  avatar: import("../../avatar").AvatarProps & {
160
160
  icon: Component;
161
161
  hasBadge?: boolean;