@snack-uikit/table 0.37.20 → 0.37.21-preview-89561ede.0
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/cjs/components/Table/Table.js +2 -2
- package/dist/cjs/components/Table/hooks/useColumnOrderByDrag/utils/prepareInitialState.js +1 -1
- package/dist/cjs/components/Table/hooks/useColumnSettings/useColumnSettings.js +1 -1
- package/dist/cjs/components/Table/utils/columnSize.js +2 -2
- package/dist/cjs/components/Table/utils/getColumnStyleVars.js +2 -2
- package/dist/cjs/components/Table/utils/getCurrentlyConfiguredHeaderWidth.js +1 -1
- package/dist/cjs/exportTable.js +3 -3
- package/dist/cjs/helperComponents/Cells/HeaderCell/ResizeHandle.js +1 -1
- package/dist/cjs/helperComponents/hooks.js +2 -2
- package/package.json +5 -5
|
@@ -304,7 +304,7 @@ function Table(_a) {
|
|
|
304
304
|
vars[flexKey] = '100%';
|
|
305
305
|
} else {
|
|
306
306
|
const originalColumnDefSize = originalColDef === null || originalColDef === void 0 ? void 0 : originalColDef.size;
|
|
307
|
-
let initSize = originalColumnDefSize ?
|
|
307
|
+
let initSize = originalColumnDefSize ? "".concat(originalColumnDefSize, "px") : '100%';
|
|
308
308
|
const prevSize = (_a = columnSizeVarsRef.current) === null || _a === void 0 ? void 0 : _a[sizeKey];
|
|
309
309
|
const isResizeSavedToStore = (originalColDef === null || originalColDef === void 0 ? void 0 : originalColDef.enableResizing) && (savedState === null || savedState === void 0 ? void 0 : savedState.id) && (savedState === null || savedState === void 0 ? void 0 : savedState.resize) !== false;
|
|
310
310
|
if (isResizeSavedToStore) {
|
|
@@ -323,7 +323,7 @@ function Table(_a) {
|
|
|
323
323
|
if (currentSize !== colDefSize || i < resizedColumnIndex && prevSize === '100%') {
|
|
324
324
|
const realSize = prevSize === '100%' ? (0, utils_3.getCurrentlyConfiguredHeaderWidth)(header.id) : currentSize;
|
|
325
325
|
realSizes[header.id] = realSize;
|
|
326
|
-
size =
|
|
326
|
+
size = "".concat(realSize, "px");
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
if (isResizeSavedToStore) {
|
|
@@ -7,7 +7,7 @@ exports.getLocalStorageColumnOrderKey = void 0;
|
|
|
7
7
|
exports.prepareInitialState = prepareInitialState;
|
|
8
8
|
const utils_1 = require("@snack-uikit/utils");
|
|
9
9
|
const utils_2 = require("../../../utils");
|
|
10
|
-
const getLocalStorageColumnOrderKey = id =>
|
|
10
|
+
const getLocalStorageColumnOrderKey = id => "".concat(id, "_columnOrder");
|
|
11
11
|
exports.getLocalStorageColumnOrderKey = getLocalStorageColumnOrderKey;
|
|
12
12
|
function prepareInitialState(tableColumns, savedState) {
|
|
13
13
|
const columnOrder = tableColumns.filter(column => column.pinned !== 'left' && column.pinned !== 'right').map(utils_2.getColumnIdentifier);
|
|
@@ -22,7 +22,7 @@ function useColumnSettings(_ref) {
|
|
|
22
22
|
const {
|
|
23
23
|
t
|
|
24
24
|
} = (0, locale_1.useLocale)('Table');
|
|
25
|
-
const localStorageKey =
|
|
25
|
+
const localStorageKey = "".concat(savedState === null || savedState === void 0 ? void 0 : savedState.id, "_columnSettings");
|
|
26
26
|
const configurableColumns = (0, react_1.useMemo)(() => columnDefinitions.filter(utils_3.isColumnVisibilityConfigurable), [columnDefinitions]);
|
|
27
27
|
const [enabledColumns, setEnabledColumns] = (0, react_1.useState)(() => (0, utils_3.getEnabledColumnsInitialState)(configurableColumns, savedState, localStorageKey));
|
|
28
28
|
const setEnabledColumnsOuter = (0, react_1.useCallback)(value => {
|
|
@@ -18,7 +18,7 @@ function getInitColumnSizeFromLocalStorage(_ref) {
|
|
|
18
18
|
if (!savedStateFromStorage) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
return (_a = savedStateFromStorage.resizeState) === null || _a === void 0 ? void 0 : _a[
|
|
21
|
+
return (_a = savedStateFromStorage.resizeState) === null || _a === void 0 ? void 0 : _a["".concat(RESIZED_KEY, "-").concat(columnId)];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
function saveStateToLocalStorage(_ref2) {
|
|
@@ -30,7 +30,7 @@ function saveStateToLocalStorage(_ref2) {
|
|
|
30
30
|
if ((0, utils_1.isBrowser)()) {
|
|
31
31
|
const savedStateFromStorage = JSON.parse(localStorage.getItem(id) || 'null');
|
|
32
32
|
const newResizeState = (savedStateFromStorage === null || savedStateFromStorage === void 0 ? void 0 : savedStateFromStorage.resizeState) || {};
|
|
33
|
-
newResizeState[
|
|
33
|
+
newResizeState["".concat(RESIZED_KEY, "-").concat(columnId)] = size;
|
|
34
34
|
localStorage.setItem(id, JSON.stringify(Object.assign(Object.assign({}, savedStateFromStorage || {}), {
|
|
35
35
|
resizeState: newResizeState
|
|
36
36
|
})));
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getColumnStyleVars = getColumnStyleVars;
|
|
7
7
|
function getColumnStyleVars(id) {
|
|
8
8
|
return {
|
|
9
|
-
sizeKey:
|
|
10
|
-
flexKey:
|
|
9
|
+
sizeKey: "--table-column-".concat(id, "-size"),
|
|
10
|
+
flexKey: "--table-column-".concat(id, "-flex")
|
|
11
11
|
};
|
|
12
12
|
}
|
|
@@ -7,7 +7,7 @@ exports.getCurrentlyConfiguredHeaderWidth = getCurrentlyConfiguredHeaderWidth;
|
|
|
7
7
|
const utils_1 = require("@snack-uikit/utils");
|
|
8
8
|
function getCurrentlyConfiguredHeaderWidth(id) {
|
|
9
9
|
if ((0, utils_1.isBrowser)()) {
|
|
10
|
-
const cell = document.querySelector(
|
|
10
|
+
const cell = document.querySelector("[data-header-id=\"".concat(id, "\"]"));
|
|
11
11
|
const resizeHandler = cell === null || cell === void 0 ? void 0 : cell.querySelector('[data-test-id="table__header-cell-resize-handle-moving-part"]');
|
|
12
12
|
if (cell) {
|
|
13
13
|
const {
|
package/dist/cjs/exportTable.js
CHANGED
|
@@ -67,9 +67,9 @@ function exportToCSV(_ref2) {
|
|
|
67
67
|
const table = [headers, ...xlsxData];
|
|
68
68
|
const csv = table.map(line => line.map(el => {
|
|
69
69
|
if (Array.isArray(el)) {
|
|
70
|
-
return
|
|
70
|
+
return "\"".concat(el.join(', '), "\"");
|
|
71
71
|
}
|
|
72
|
-
return el === undefined ?
|
|
72
|
+
return el === undefined ? "\"\"" : "\"".concat(el, "\"");
|
|
73
73
|
}).join(',')).join('\n');
|
|
74
74
|
const utf8Prefix = new Uint8Array([0xef, 0xbb, 0xbf]);
|
|
75
75
|
const blob = new Blob([utf8Prefix, csv], {
|
|
@@ -126,6 +126,6 @@ function exportToXLSX(_ref3) {
|
|
|
126
126
|
worksheet['!cols'] = getColumnsWidth(worksheetData);
|
|
127
127
|
}
|
|
128
128
|
xlsx_1.utils.book_append_sheet(workbook, worksheet);
|
|
129
|
-
(0, xlsx_1.writeFileXLSX)(workbook,
|
|
129
|
+
(0, xlsx_1.writeFileXLSX)(workbook, "".concat(fileName, ".xlsx"));
|
|
130
130
|
return worksheet;
|
|
131
131
|
}
|
|
@@ -72,7 +72,7 @@ function ResizeHandle(_ref2) {
|
|
|
72
72
|
"data-test-id": 'table__header-cell-resize-handle-moving-part',
|
|
73
73
|
className: styles_module_scss_1.default.tableHeaderResizeIndicator,
|
|
74
74
|
style: {
|
|
75
|
-
'--offset':
|
|
75
|
+
'--offset': "".concat(offset, "px")
|
|
76
76
|
}
|
|
77
77
|
})]
|
|
78
78
|
});
|
|
@@ -75,8 +75,8 @@ function useCellSizes(element, options) {
|
|
|
75
75
|
});
|
|
76
76
|
const minWidth = column.columnDef.minSize;
|
|
77
77
|
const maxWidth = column.columnDef.maxSize;
|
|
78
|
-
const width =
|
|
79
|
-
const flexShrink =
|
|
78
|
+
const width = "var(--table-column-".concat(column.id, "-size)");
|
|
79
|
+
const flexShrink = "var(--table-column-".concat(column.id, "-flex)");
|
|
80
80
|
const isHeaderCell = 'headerGroup' in element;
|
|
81
81
|
return (0, react_1.useMemo)(() => {
|
|
82
82
|
const styles = {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Table",
|
|
7
|
-
"version": "0.37.
|
|
7
|
+
"version": "0.37.21-preview-89561ede.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"@dnd-kit/sortable": "10.0.0",
|
|
43
43
|
"@dnd-kit/utilities": "3.2.2",
|
|
44
44
|
"@snack-uikit/button": "0.19.16",
|
|
45
|
-
"@snack-uikit/chips": "0.28.
|
|
45
|
+
"@snack-uikit/chips": "0.28.9-preview-89561ede.0",
|
|
46
46
|
"@snack-uikit/icons": "0.27.3",
|
|
47
47
|
"@snack-uikit/info-block": "0.6.33",
|
|
48
|
-
"@snack-uikit/list": "0.32.
|
|
48
|
+
"@snack-uikit/list": "0.32.8-preview-89561ede.0",
|
|
49
49
|
"@snack-uikit/pagination": "0.10.20",
|
|
50
50
|
"@snack-uikit/scroll": "0.10.5",
|
|
51
51
|
"@snack-uikit/skeleton": "0.6.9",
|
|
52
52
|
"@snack-uikit/toggles": "0.13.22",
|
|
53
|
-
"@snack-uikit/toolbar": "0.14.
|
|
53
|
+
"@snack-uikit/toolbar": "0.14.11-preview-89561ede.0",
|
|
54
54
|
"@snack-uikit/truncate-string": "0.7.4",
|
|
55
55
|
"@snack-uikit/typography": "0.8.11",
|
|
56
56
|
"@snack-uikit/utils": "4.0.0",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@snack-uikit/locale": "*"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "de5270049691fdddf8df10ab11b5414141015dcf"
|
|
69
69
|
}
|