@cloud-ru/ds-table 2.2.12 → 2.2.13-preview-15dc0d59.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/README.md +27 -334
- package/dist/cjs/components/ServerTable/ServerTable.js +1 -1
- package/dist/cjs/components/Table/Table.d.ts +1 -1
- package/dist/cjs/components/Table/Table.js +9 -3
- package/dist/cjs/components/Table/hooks/useTableInstance.d.ts +2 -1
- package/dist/cjs/components/Table/hooks/useTableInstance.js +2 -1
- package/dist/cjs/components/Table/styles.module.css +1 -0
- package/dist/cjs/components/types.d.ts +6 -3
- package/dist/cjs/helperComponents/Cells/RowActionsCell/components/RowActionsButton.js +1 -4
- package/dist/cjs/helperComponents/Cells/RowActionsCell/styles.module.css +2 -0
- package/dist/cjs/helperComponents/Cells/TreeCell/TreeLine/styles.module.css +1 -0
- package/dist/cjs/helperComponents/TableEmptyState/hooks.d.ts +2 -1
- package/dist/cjs/helperComponents/TableEmptyState/hooks.js +5 -2
- package/dist/cjs/helperComponents/TablePagination/TablePagination.js +31 -7
- package/dist/cjs/helperComponents/TablePagination/styles.module.css +8 -0
- package/dist/cjs/hooks/useCellSizes.js +4 -2
- package/dist/cjs/hooks/useColumnsSettingsToolbarSlot/useColumnsSettingsToolbarSlot.js +1 -0
- package/dist/cjs/hooks/useTableSortingToolbarSlot/useTableSortingToolbarSlot.js +1 -1
- package/dist/cjs/locale/index.d.ts +28 -8
- package/dist/cjs/locale/index.js +14 -4
- package/dist/cjs/presets/index.d.ts +0 -3
- package/dist/cjs/presets/index.js +0 -3
- package/dist/cjs/presets/simpleTable/SimpleTable.d.ts +1 -1
- package/dist/cjs/presets/simpleTable/SimpleTable.js +1 -1
- package/dist/cjs/presets/simpleTable/toSimpleTableProps.d.ts +5 -6
- package/dist/cjs/presets/simpleTable/toSimpleTableProps.js +6 -6
- package/dist/cjs/presets/simpleTable/useSimpleTableProps.js +1 -4
- package/dist/cjs/presets/treeTable/toTreeTableProps.d.ts +7 -7
- package/dist/cjs/presets/treeTable/toTreeTableProps.js +2 -3
- package/dist/cjs/style.css +12 -0
- package/dist/esm/components/ServerTable/ServerTable.js +1 -1
- package/dist/esm/components/Table/Table.d.ts +1 -1
- package/dist/esm/components/Table/Table.js +9 -3
- package/dist/esm/components/Table/hooks/useTableInstance.d.ts +2 -1
- package/dist/esm/components/Table/hooks/useTableInstance.js +2 -1
- package/dist/esm/components/Table/styles.module.css +1 -0
- package/dist/esm/components/types.d.ts +6 -3
- package/dist/esm/helperComponents/Cells/RowActionsCell/components/RowActionsButton.js +1 -4
- package/dist/esm/helperComponents/Cells/RowActionsCell/styles.module.css +2 -0
- package/dist/esm/helperComponents/Cells/TreeCell/TreeLine/styles.module.css +1 -0
- package/dist/esm/helperComponents/TableEmptyState/hooks.d.ts +2 -1
- package/dist/esm/helperComponents/TableEmptyState/hooks.js +5 -2
- package/dist/esm/helperComponents/TablePagination/TablePagination.js +31 -7
- package/dist/esm/helperComponents/TablePagination/styles.module.css +8 -0
- package/dist/esm/hooks/useCellSizes.js +5 -3
- package/dist/esm/hooks/useColumnsSettingsToolbarSlot/useColumnsSettingsToolbarSlot.js +1 -0
- package/dist/esm/hooks/useTableSortingToolbarSlot/useTableSortingToolbarSlot.js +1 -1
- package/dist/esm/locale/index.d.ts +28 -8
- package/dist/esm/locale/index.js +14 -4
- package/dist/esm/presets/index.d.ts +0 -3
- package/dist/esm/presets/index.js +0 -3
- package/dist/esm/presets/simpleTable/SimpleTable.d.ts +1 -1
- package/dist/esm/presets/simpleTable/SimpleTable.js +1 -1
- package/dist/esm/presets/simpleTable/toSimpleTableProps.d.ts +5 -6
- package/dist/esm/presets/simpleTable/toSimpleTableProps.js +7 -7
- package/dist/esm/presets/simpleTable/useSimpleTableProps.js +1 -4
- package/dist/esm/presets/treeTable/toTreeTableProps.d.ts +7 -7
- package/dist/esm/presets/treeTable/toTreeTableProps.js +3 -4
- package/dist/esm/style.css +12 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +20 -20
- package/src/components/ServerTable/ServerTable.tsx +1 -0
- package/src/components/Table/STRUCTURE.md +12 -6
- package/src/components/Table/Table.tsx +9 -2
- package/src/components/Table/hooks/useTableInstance.tsx +3 -0
- package/src/components/Table/styles.module.scss +2 -3
- package/src/components/types.ts +6 -3
- package/src/helperComponents/Cells/RowActionsCell/components/RowActionsButton.tsx +1 -3
- package/src/helperComponents/Cells/RowActionsCell/styles.module.scss +2 -0
- package/src/helperComponents/Cells/TreeCell/TreeLine/styles.module.scss +3 -0
- package/src/helperComponents/TableEmptyState/{hooks.ts → hooks.tsx} +7 -1
- package/src/helperComponents/TablePagination/TablePagination.tsx +80 -10
- package/src/helperComponents/TablePagination/styles.module.scss +9 -0
- package/src/hooks/useCellSizes.ts +5 -3
- package/src/hooks/useColumnsSettingsToolbarSlot/useColumnsSettingsToolbarSlot.tsx +1 -0
- package/src/hooks/useTableSortingToolbarSlot/useTableSortingToolbarSlot.tsx +2 -0
- package/src/locale/index.ts +14 -4
- package/src/presets/index.ts +0 -3
- package/src/presets/simpleTable/SimpleTable.tsx +1 -1
- package/src/presets/simpleTable/toSimpleTableProps.ts +35 -30
- package/src/presets/simpleTable/useSimpleTableProps.ts +1 -5
- package/src/presets/treeTable/toTreeTableProps.ts +24 -23
- package/dist/cjs/presets/adminTable/AdminTable.d.ts +0 -4
- package/dist/cjs/presets/adminTable/AdminTable.js +0 -11
- package/dist/cjs/presets/adminTable/index.d.ts +0 -4
- package/dist/cjs/presets/adminTable/index.js +0 -9
- package/dist/cjs/presets/adminTable/toAdminTableProps.d.ts +0 -31
- package/dist/cjs/presets/adminTable/toAdminTableProps.js +0 -57
- package/dist/cjs/presets/adminTable/useAdminTableProps.d.ts +0 -5
- package/dist/cjs/presets/adminTable/useAdminTableProps.js +0 -25
- package/dist/cjs/presets/serverAdminTable/ServerAdminTable.d.ts +0 -4
- package/dist/cjs/presets/serverAdminTable/ServerAdminTable.js +0 -11
- package/dist/cjs/presets/serverAdminTable/index.d.ts +0 -4
- package/dist/cjs/presets/serverAdminTable/index.js +0 -9
- package/dist/cjs/presets/serverAdminTable/toServerAdminTableProps.d.ts +0 -13
- package/dist/cjs/presets/serverAdminTable/toServerAdminTableProps.js +0 -25
- package/dist/cjs/presets/serverAdminTable/useServerAdminTableProps.d.ts +0 -5
- package/dist/cjs/presets/serverAdminTable/useServerAdminTableProps.js +0 -25
- package/dist/cjs/presets/serverSimpleTable/ServerSimpleTable.d.ts +0 -3
- package/dist/cjs/presets/serverSimpleTable/ServerSimpleTable.js +0 -11
- package/dist/cjs/presets/serverSimpleTable/index.d.ts +0 -4
- package/dist/cjs/presets/serverSimpleTable/index.js +0 -9
- package/dist/cjs/presets/serverSimpleTable/toServerSimpleTableProps.d.ts +0 -13
- package/dist/cjs/presets/serverSimpleTable/toServerSimpleTableProps.js +0 -25
- package/dist/cjs/presets/serverSimpleTable/useServerSimpleTableProps.d.ts +0 -4
- package/dist/cjs/presets/serverSimpleTable/useServerSimpleTableProps.js +0 -21
- package/dist/esm/presets/adminTable/AdminTable.d.ts +0 -4
- package/dist/esm/presets/adminTable/AdminTable.js +0 -8
- package/dist/esm/presets/adminTable/index.d.ts +0 -4
- package/dist/esm/presets/adminTable/index.js +0 -3
- package/dist/esm/presets/adminTable/toAdminTableProps.d.ts +0 -31
- package/dist/esm/presets/adminTable/toAdminTableProps.js +0 -54
- package/dist/esm/presets/adminTable/useAdminTableProps.d.ts +0 -5
- package/dist/esm/presets/adminTable/useAdminTableProps.js +0 -22
- package/dist/esm/presets/serverAdminTable/ServerAdminTable.d.ts +0 -4
- package/dist/esm/presets/serverAdminTable/ServerAdminTable.js +0 -8
- package/dist/esm/presets/serverAdminTable/index.d.ts +0 -4
- package/dist/esm/presets/serverAdminTable/index.js +0 -3
- package/dist/esm/presets/serverAdminTable/toServerAdminTableProps.d.ts +0 -13
- package/dist/esm/presets/serverAdminTable/toServerAdminTableProps.js +0 -22
- package/dist/esm/presets/serverAdminTable/useServerAdminTableProps.d.ts +0 -5
- package/dist/esm/presets/serverAdminTable/useServerAdminTableProps.js +0 -22
- package/dist/esm/presets/serverSimpleTable/ServerSimpleTable.d.ts +0 -3
- package/dist/esm/presets/serverSimpleTable/ServerSimpleTable.js +0 -8
- package/dist/esm/presets/serverSimpleTable/index.d.ts +0 -4
- package/dist/esm/presets/serverSimpleTable/index.js +0 -3
- package/dist/esm/presets/serverSimpleTable/toServerSimpleTableProps.d.ts +0 -13
- package/dist/esm/presets/serverSimpleTable/toServerSimpleTableProps.js +0 -22
- package/dist/esm/presets/serverSimpleTable/useServerSimpleTableProps.d.ts +0 -4
- package/dist/esm/presets/serverSimpleTable/useServerSimpleTableProps.js +0 -18
- package/src/presets/adminTable/AdminTable.tsx +0 -14
- package/src/presets/adminTable/index.ts +0 -4
- package/src/presets/adminTable/toAdminTableProps.ts +0 -140
- package/src/presets/adminTable/useAdminTableProps.ts +0 -35
- package/src/presets/serverAdminTable/ServerAdminTable.tsx +0 -14
- package/src/presets/serverAdminTable/index.ts +0 -4
- package/src/presets/serverAdminTable/toServerAdminTableProps.ts +0 -44
- package/src/presets/serverAdminTable/useServerAdminTableProps.ts +0 -35
- package/src/presets/serverSimpleTable/ServerSimpleTable.tsx +0 -10
- package/src/presets/serverSimpleTable/index.ts +0 -4
- package/src/presets/serverSimpleTable/toServerSimpleTableProps.ts +0 -56
- package/src/presets/serverSimpleTable/useServerSimpleTableProps.ts +0 -27
|
@@ -328,6 +328,7 @@ export type InfiniteTableProps<TData extends object, TFilters extends FiltersSta
|
|
|
328
328
|
pagination?: never;
|
|
329
329
|
autoResetPageIndex?: never;
|
|
330
330
|
pageCount?: never;
|
|
331
|
+
rowCount?: never;
|
|
331
332
|
/** Режим работы "бесконечной" загрузки */
|
|
332
333
|
infiniteLoading?: boolean;
|
|
333
334
|
suppressPagination?: never;
|
|
@@ -336,7 +337,7 @@ export type InfiniteTableProps<TData extends object, TFilters extends FiltersSta
|
|
|
336
337
|
/**
|
|
337
338
|
* Колбэк дозагрузки следующей порции данных.
|
|
338
339
|
* В режиме `loadMoreTrigger='scroll'` вызывается автоматически при достижении конца списка;
|
|
339
|
-
* в режиме `loadMoreTrigger='button'` — по нажатию кнопки
|
|
340
|
+
* в режиме `loadMoreTrigger='button'` — по нажатию кнопки «Показать ещё».
|
|
340
341
|
*/
|
|
341
342
|
onLoadMore?: () => void;
|
|
342
343
|
/** Есть ли ещё данные для загрузки. Управляет видимостью кнопки / активностью observer-а. */
|
|
@@ -344,7 +345,7 @@ export type InfiniteTableProps<TData extends object, TFilters extends FiltersSta
|
|
|
344
345
|
/**
|
|
345
346
|
* Механизм подгрузки следующей порции данных.
|
|
346
347
|
* - `'scroll'` (по умолчанию) — IntersectionObserver на scroll-stub в конце списка.
|
|
347
|
-
* - `'button'` — кнопка
|
|
348
|
+
* - `'button'` — кнопка «Показать ещё» под таблицей.
|
|
348
349
|
*/
|
|
349
350
|
loadMoreTrigger?: LoadMoreTrigger;
|
|
350
351
|
};
|
|
@@ -363,6 +364,8 @@ export type ClientTableProps<TData extends object, TFilters extends FiltersState
|
|
|
363
364
|
autoResetPageIndex?: boolean;
|
|
364
365
|
/** Кол-во страниц (для внешнего управления) */
|
|
365
366
|
pageCount?: number;
|
|
367
|
+
/** Общее количество строк при внешнем управлении пагинацией. */
|
|
368
|
+
rowCount?: number;
|
|
366
369
|
/** Отключение пагинации */
|
|
367
370
|
suppressPagination?: boolean;
|
|
368
371
|
manualPagination?: boolean;
|
|
@@ -374,7 +377,7 @@ export type ClientTableProps<TData extends object, TFilters extends FiltersState
|
|
|
374
377
|
toolbarCheckBoxMode?: ToolbarCheckBoxMode;
|
|
375
378
|
};
|
|
376
379
|
export type TableProps<TData extends object, TFilters extends FiltersState = Record<string, unknown>> = InfiniteTableProps<TData, TFilters> | ClientTableProps<TData, TFilters>;
|
|
377
|
-
export type ServerTableProps<TData extends object, TFilters extends FiltersState = Record<string, unknown>> = Omit<ClientTableProps<TData, TFilters>, 'pageSize' | 'pageCount' | 'pagination' | 'search' | 'data' | 'toolbarCheckBoxMode'> & {
|
|
380
|
+
export type ServerTableProps<TData extends object, TFilters extends FiltersState = Record<string, unknown>> = Omit<ClientTableProps<TData, TFilters>, 'pageSize' | 'pageCount' | 'rowCount' | 'pagination' | 'search' | 'data' | 'toolbarCheckBoxMode'> & {
|
|
378
381
|
/** Данные для отрисовки */
|
|
379
382
|
items?: TData[];
|
|
380
383
|
/** Общее кол-во строк @default 10 */
|
|
@@ -8,10 +8,7 @@ const constants_1 = require("../../../../constants");
|
|
|
8
8
|
const contexts_1 = require("../../../../contexts");
|
|
9
9
|
function RowActionsButton({ variant = 'cell', size, ...rest }) {
|
|
10
10
|
const { isCardsView } = (0, contexts_1.useTableContext)();
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(button_1.Button, { ...rest,
|
|
12
|
-
// В table-строке мастер (actionWrapper 16236:23147) — кнопка size=l (40×40). В карточке
|
|
13
|
-
// размещение действий макетом не задано, оставляем дефолт.
|
|
14
|
-
size: size ?? (isCardsView ? undefined : button_1.SIZE.L), appearance: 'neutral', view: button_1.VIEW.Function, style: variant === 'placeholder'
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(button_1.Button, { ...rest, size: size ?? (isCardsView ? undefined : button_1.SIZE.S), appearance: 'neutral', view: button_1.VIEW.Function, style: variant === 'placeholder'
|
|
15
12
|
? {
|
|
16
13
|
visibility: 'hidden',
|
|
17
14
|
pointerEvents: 'none',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.rowActionsHeader{
|
|
2
|
+
min-width:var(--sn-table-anatomy-content-headLine-actionWrapper-maxWidth, var(--sn-table-anatomy-content-tableLine-actionWrapper-maxWidth, var(--sn-primitive-dimension-40, 40px)));
|
|
2
3
|
max-width:var(--sn-table-anatomy-content-headLine-actionWrapper-maxWidth, var(--sn-table-anatomy-content-tableLine-actionWrapper-maxWidth, var(--sn-primitive-dimension-40, 40px)));
|
|
3
4
|
padding:0 !important;
|
|
4
5
|
}
|
|
@@ -10,6 +11,7 @@
|
|
|
10
11
|
|
|
11
12
|
.rowActionsCell{
|
|
12
13
|
position:relative;
|
|
14
|
+
min-width:var(--sn-table-anatomy-content-tableLine-actionWrapper-maxWidth, var(--sn-primitive-dimension-40, 40px));
|
|
13
15
|
max-width:var(--sn-table-anatomy-content-tableLine-actionWrapper-maxWidth, var(--sn-primitive-dimension-40, 40px));
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.treeLine{
|
|
2
2
|
position:relative;
|
|
3
3
|
flex-shrink:0;
|
|
4
|
+
box-sizing:border-box;
|
|
4
5
|
width:var(--sn-table-anatomy-content-tableLine-pinnedWrapper-elementWrapper-treeControl-centeredWrapper-childLine-maxWidth, var(--sn-density-icon-s, var(--sn-platform-comfort-icon-s, var(--sn-primitive-dimension-24, 24px))));
|
|
5
6
|
height:100%;
|
|
6
7
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { EmptyStateProps } from './TableEmptyState';
|
|
2
|
-
export declare function useEmptyState({ noDataState: noDataStateProp, noResultsState: noResultsStateProp, errorDataState: errorDataStateProp, }: {
|
|
2
|
+
export declare function useEmptyState({ noDataState: noDataStateProp, noResultsState: noResultsStateProp, errorDataState: errorDataStateProp, onRefresh, }: {
|
|
3
3
|
noDataState?: EmptyStateProps;
|
|
4
4
|
noResultsState?: EmptyStateProps;
|
|
5
5
|
errorDataState?: EmptyStateProps;
|
|
6
|
+
onRefresh?(): void;
|
|
6
7
|
}): {
|
|
7
8
|
noDataState: EmptyStateProps;
|
|
8
9
|
noResultsState: EmptyStateProps;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useEmptyState = useEmptyState;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const button_1 = require("@cloud-ru/ds-button");
|
|
4
6
|
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
5
7
|
const react_1 = require("react");
|
|
6
8
|
const locale_1 = require("../../locale");
|
|
7
|
-
function useEmptyState({ noDataState: noDataStateProp, noResultsState: noResultsStateProp, errorDataState: errorDataStateProp, }) {
|
|
9
|
+
function useEmptyState({ noDataState: noDataStateProp, noResultsState: noResultsStateProp, errorDataState: errorDataStateProp, onRefresh, }) {
|
|
8
10
|
const { t } = locale_1.tableLocale.useTranslations();
|
|
9
11
|
return (0, react_1.useMemo)(() => {
|
|
10
12
|
const noDataState = {
|
|
@@ -22,6 +24,7 @@ function useEmptyState({ noDataState: noDataStateProp, noResultsState: noResults
|
|
|
22
24
|
icon: { icon: system_1.CrossSVG, appearance: 'neutral', background: true },
|
|
23
25
|
title: t('errorData.title'),
|
|
24
26
|
content: t('errorData.content'),
|
|
27
|
+
footer: onRefresh ? ((0, jsx_runtime_1.jsx)(button_1.Button, { label: t('refresh'), onClick: onRefresh, size: 's', appearance: 'neutral', view: 'outline' })) : undefined,
|
|
25
28
|
...errorDataStateProp,
|
|
26
29
|
};
|
|
27
30
|
return {
|
|
@@ -29,5 +32,5 @@ function useEmptyState({ noDataState: noDataStateProp, noResultsState: noResults
|
|
|
29
32
|
noResultsState,
|
|
30
33
|
errorDataState,
|
|
31
34
|
};
|
|
32
|
-
}, [errorDataStateProp, noDataStateProp, noResultsStateProp, t]);
|
|
35
|
+
}, [errorDataStateProp, noDataStateProp, noResultsStateProp, onRefresh, t]);
|
|
33
36
|
}
|
|
@@ -5,12 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TablePagination = TablePagination;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const adaptive_1 = require("@cloud-ru/ds-adaptive");
|
|
9
|
+
const button_1 = require("@cloud-ru/ds-button");
|
|
8
10
|
const chips_1 = require("@cloud-ru/ds-chips");
|
|
11
|
+
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
9
12
|
const pagination_1 = require("@cloud-ru/ds-pagination");
|
|
10
13
|
const react_1 = require("react");
|
|
11
14
|
const locale_1 = require("../../locale");
|
|
12
15
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
16
|
+
const MAX_PAGE_OPTIONS = 1000;
|
|
13
17
|
function TablePagination({ table, options: optionsProp, optionsLabel: optionsLabelProp, optionsRender, view, }) {
|
|
18
|
+
const { layoutType } = (0, adaptive_1.useAdaptiveLayout)();
|
|
19
|
+
const mobile = (0, adaptive_1.isMobileLayout)(layoutType);
|
|
14
20
|
const { t } = locale_1.tableLocale.useTranslations();
|
|
15
21
|
const optionsLabel = optionsLabelProp ?? t('rowsOptionsLabel');
|
|
16
22
|
const handlePaginationOnChange = (0, react_1.useCallback)((pageIndex) => {
|
|
@@ -19,16 +25,34 @@ function TablePagination({ table, options: optionsProp, optionsLabel: optionsLab
|
|
|
19
25
|
const handleRowsVolumeOnChange = (0, react_1.useCallback)((value) => {
|
|
20
26
|
table.setPageSize(Number(value));
|
|
21
27
|
}, [table]);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
const handlePreviousPage = (0, react_1.useCallback)(() => table.previousPage(), [table]);
|
|
29
|
+
const handleNextPage = (0, react_1.useCallback)(() => table.nextPage(), [table]);
|
|
30
|
+
const handlePageSelect = (0, react_1.useCallback)((value) => {
|
|
31
|
+
if (value !== undefined) {
|
|
32
|
+
handlePaginationOnChange(Number(value));
|
|
33
|
+
}
|
|
34
|
+
}, [handlePaginationOnChange]);
|
|
35
|
+
const tablePaginationState = table.getState().pagination;
|
|
36
|
+
const options = (0, react_1.useMemo)(() => (optionsProp?.length ? Array.from(new Set([...optionsProp, tablePaginationState.pageSize])) : undefined)
|
|
37
|
+
?.sort((a, b) => a - b)
|
|
25
38
|
.map((value, idx) => ({
|
|
26
39
|
label: String(optionsRender ? optionsRender(value, idx) : value),
|
|
27
40
|
value: String(value),
|
|
28
|
-
})), [optionsProp, optionsRender]);
|
|
29
|
-
const
|
|
30
|
-
|
|
41
|
+
})), [optionsProp, optionsRender, tablePaginationState.pageSize]);
|
|
42
|
+
const pageCount = table.getPageCount();
|
|
43
|
+
const currentPage = tablePaginationState.pageIndex + 1;
|
|
44
|
+
const hasKnownPageCount = Number.isSafeInteger(pageCount) && pageCount >= 0;
|
|
45
|
+
const showPagination = !hasKnownPageCount || pageCount > 1;
|
|
46
|
+
const showPagePicker = mobile && hasKnownPageCount && pageCount > 1 && pageCount <= MAX_PAGE_OPTIONS;
|
|
47
|
+
const useCompactPagination = mobile || !hasKnownPageCount;
|
|
48
|
+
const pageOptions = (0, react_1.useMemo)(() => showPagePicker
|
|
49
|
+
? Array.from({ length: pageCount }, (_, index) => {
|
|
50
|
+
const page = String(index + 1);
|
|
51
|
+
return { label: page, value: page };
|
|
52
|
+
})
|
|
53
|
+
: [], [showPagePicker, pageCount]);
|
|
54
|
+
if (!showPagination && !options?.length) {
|
|
31
55
|
return null;
|
|
32
56
|
}
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.footer, "data-view": view, children: [table.
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.footer, "data-view": view, children: [showPagination && useCompactPagination && ((0, jsx_runtime_1.jsxs)("nav", { className: styles_module_scss_1.default.mobilePagination, "aria-label": t('pagination'), children: [(0, jsx_runtime_1.jsx)(button_1.Button, { size: 's', view: 'outline', appearance: 'neutral', icon: (0, jsx_runtime_1.jsx)(system_1.ChevronLeftSVG, {}), "aria-label": t('previousPage'), disabled: !table.getCanPreviousPage(), onClick: handlePreviousPage }), showPagePicker && ((0, jsx_runtime_1.jsx)(chips_1.ChipChoice.Single, { label: t('page'), value: String(currentPage), options: pageOptions, onChange: handlePageSelect, size: 's', droplistSize: 's', withDividers: false })), (0, jsx_runtime_1.jsx)(button_1.Button, { size: 's', view: 'outline', appearance: 'neutral', icon: (0, jsx_runtime_1.jsx)(system_1.ChevronRightSVG, {}), "aria-label": t('nextPage'), disabled: !table.getCanNextPage(), onClick: handleNextPage })] })), showPagination && !useCompactPagination && ((0, jsx_runtime_1.jsx)(pagination_1.Pagination, { total: pageCount, page: currentPage, onChange: handlePaginationOnChange, size: 's', className: styles_module_scss_1.default.pagination })), options && options.length > 0 && (mobile || table.getRowCount() >= Number(options[0].value)) && ((0, jsx_runtime_1.jsx)(chips_1.ChipChoice.Single, { value: String(tablePaginationState.pageSize), onChange: value => handleRowsVolumeOnChange(String(value)), placement: 'top-end', options: options, label: optionsLabel, widthStrategy: 'eq', size: 's', droplistSize: 's', withDividers: false }))] }));
|
|
34
58
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
4
4
|
align-items:center;
|
|
5
5
|
justify-content:flex-end;
|
|
6
|
+
box-sizing:border-box;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
.pagination{
|
|
@@ -11,4 +12,11 @@
|
|
|
11
12
|
|
|
12
13
|
.footer[data-view=cards] .pagination{
|
|
13
14
|
flex:1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.mobilePagination{
|
|
18
|
+
display:flex;
|
|
19
|
+
gap:var(--sn-primitive-dimension-4, 4px);
|
|
20
|
+
align-items:center;
|
|
21
|
+
margin-right:auto;
|
|
14
22
|
}
|
|
@@ -7,8 +7,10 @@ const constants_1 = require("../constants");
|
|
|
7
7
|
function useCellSizes(element, options) {
|
|
8
8
|
const column = element.column;
|
|
9
9
|
const transform = options?.transform ?? null;
|
|
10
|
-
|
|
11
|
-
const
|
|
10
|
+
// Ширину служебной колонки действий задаёт токен actionWrapper в SCSS.
|
|
11
|
+
const isRowActions = column.id === constants_1.DefaultColumns.RowActions;
|
|
12
|
+
const minWidth = isRowActions ? undefined : column.columnDef.minSize;
|
|
13
|
+
const maxWidth = isRowActions ? undefined : column.columnDef.maxSize;
|
|
12
14
|
const width = `var(${constants_1.TABLE_COLUMN_CSS_VARS.size(column.id)})`;
|
|
13
15
|
const flexShrink = `var(${constants_1.TABLE_COLUMN_CSS_VARS.flex(column.id)})`;
|
|
14
16
|
const isHeaderCell = 'headerGroup' in element;
|
|
@@ -50,6 +50,7 @@ function useColumnsSettingsToolbarSlot({ enabled = true, columnsSettings, enable
|
|
|
50
50
|
scroll: true,
|
|
51
51
|
className: useColumnsSettingsToolbarSlot_module_scss_1.default.columnsSettings,
|
|
52
52
|
size: list_1.SIZE.M,
|
|
53
|
+
withDividers: false,
|
|
53
54
|
selection,
|
|
54
55
|
placement: 'bottom-end',
|
|
55
56
|
open,
|
|
@@ -37,6 +37,6 @@ function useTableSortingToolbarSlot({ enabled = true, table, sorting, columnDefi
|
|
|
37
37
|
SortIcon = currentSort.desc ? system_1.ArrowDownSVG : system_1.ArrowUpSVG;
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
|
-
afterContent: ((0, jsx_runtime_1.jsx)(list_1.Droplist, { scroll: true, items: items, selection: selection, virtualized: items.length > 10, pinBottom: clearItem, open: open, onOpenChange: setOpen, label: t('sort'), "data-test-id": constants_1.TEST_IDS.viewSort.droplist, children: (0, jsx_runtime_1.jsx)(button_1.Button, { size: 'm', view: button_1.VIEW.Function, icon: (0, jsx_runtime_1.jsx)(SortIcon, {}), appearance: selectedSortId ? button_1.APPEARANCE.Primary : button_1.APPEARANCE.Neutral, "aria-label": t('sort'), "data-test-id": constants_1.TEST_IDS.viewSort.droplistTrigger }) })),
|
|
40
|
+
afterContent: ((0, jsx_runtime_1.jsx)(list_1.Droplist, { scroll: true, size: 'm', withDividers: false, items: items, selection: selection, virtualized: items.length > 10, pinBottom: clearItem, open: open, onOpenChange: setOpen, label: t('sort'), "data-test-id": constants_1.TEST_IDS.viewSort.droplist, children: (0, jsx_runtime_1.jsx)(button_1.Button, { size: 'm', view: button_1.VIEW.Function, icon: (0, jsx_runtime_1.jsx)(SortIcon, {}), appearance: selectedSortId ? button_1.APPEARANCE.Primary : button_1.APPEARANCE.Neutral, "aria-label": t('sort'), "data-test-id": constants_1.TEST_IDS.viewSort.droplistTrigger }) })),
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
declare const TABLE_MESSAGES: {
|
|
2
2
|
readonly 'en-GB': {
|
|
3
3
|
readonly searchPlaceholder: "Search";
|
|
4
|
-
readonly rowsOptionsLabel: "Rows
|
|
4
|
+
readonly rowsOptionsLabel: "Rows";
|
|
5
|
+
readonly pagination: "Pagination";
|
|
6
|
+
readonly page: "Page";
|
|
7
|
+
readonly previousPage: "Previous page";
|
|
8
|
+
readonly nextPage: "Next page";
|
|
5
9
|
readonly settingsHeaderLabel: "Columns settings";
|
|
6
10
|
readonly sort: "Sort";
|
|
7
11
|
readonly clearSort: "Clear sorting";
|
|
8
12
|
readonly export: "Export";
|
|
9
|
-
readonly loadMore: "
|
|
13
|
+
readonly loadMore: "Show more";
|
|
14
|
+
readonly refresh: "Refresh";
|
|
10
15
|
readonly groupSelectButton: {
|
|
11
16
|
readonly show: "Show all";
|
|
12
17
|
readonly hide: "Hide all";
|
|
@@ -25,12 +30,17 @@ declare const TABLE_MESSAGES: {
|
|
|
25
30
|
};
|
|
26
31
|
readonly 'ru-RU': {
|
|
27
32
|
readonly searchPlaceholder: "Поиск";
|
|
28
|
-
readonly rowsOptionsLabel: "
|
|
33
|
+
readonly rowsOptionsLabel: "Строки";
|
|
34
|
+
readonly pagination: "Навигация по страницам";
|
|
35
|
+
readonly page: "Страница";
|
|
36
|
+
readonly previousPage: "Предыдущая страница";
|
|
37
|
+
readonly nextPage: "Следующая страница";
|
|
29
38
|
readonly settingsHeaderLabel: "Настройки колонок";
|
|
30
39
|
readonly sort: "Сортировка";
|
|
31
40
|
readonly clearSort: "Сбросить сортировку";
|
|
32
41
|
readonly export: "Экспорт";
|
|
33
|
-
readonly loadMore: "
|
|
42
|
+
readonly loadMore: "Показать ещё";
|
|
43
|
+
readonly refresh: "Обновить";
|
|
34
44
|
readonly groupSelectButton: {
|
|
35
45
|
readonly show: "Показать все";
|
|
36
46
|
readonly hide: "Скрыть все";
|
|
@@ -53,12 +63,17 @@ export type TableMessages = (typeof TABLE_MESSAGES)['en-GB'];
|
|
|
53
63
|
export declare const tableLocale: import("@cloud-ru/ds-locale").DefinedLocale<{
|
|
54
64
|
readonly 'en-GB': {
|
|
55
65
|
readonly searchPlaceholder: "Search";
|
|
56
|
-
readonly rowsOptionsLabel: "Rows
|
|
66
|
+
readonly rowsOptionsLabel: "Rows";
|
|
67
|
+
readonly pagination: "Pagination";
|
|
68
|
+
readonly page: "Page";
|
|
69
|
+
readonly previousPage: "Previous page";
|
|
70
|
+
readonly nextPage: "Next page";
|
|
57
71
|
readonly settingsHeaderLabel: "Columns settings";
|
|
58
72
|
readonly sort: "Sort";
|
|
59
73
|
readonly clearSort: "Clear sorting";
|
|
60
74
|
readonly export: "Export";
|
|
61
|
-
readonly loadMore: "
|
|
75
|
+
readonly loadMore: "Show more";
|
|
76
|
+
readonly refresh: "Refresh";
|
|
62
77
|
readonly groupSelectButton: {
|
|
63
78
|
readonly show: "Show all";
|
|
64
79
|
readonly hide: "Hide all";
|
|
@@ -77,12 +92,17 @@ export declare const tableLocale: import("@cloud-ru/ds-locale").DefinedLocale<{
|
|
|
77
92
|
};
|
|
78
93
|
readonly 'ru-RU': {
|
|
79
94
|
readonly searchPlaceholder: "Поиск";
|
|
80
|
-
readonly rowsOptionsLabel: "
|
|
95
|
+
readonly rowsOptionsLabel: "Строки";
|
|
96
|
+
readonly pagination: "Навигация по страницам";
|
|
97
|
+
readonly page: "Страница";
|
|
98
|
+
readonly previousPage: "Предыдущая страница";
|
|
99
|
+
readonly nextPage: "Следующая страница";
|
|
81
100
|
readonly settingsHeaderLabel: "Настройки колонок";
|
|
82
101
|
readonly sort: "Сортировка";
|
|
83
102
|
readonly clearSort: "Сбросить сортировку";
|
|
84
103
|
readonly export: "Экспорт";
|
|
85
|
-
readonly loadMore: "
|
|
104
|
+
readonly loadMore: "Показать ещё";
|
|
105
|
+
readonly refresh: "Обновить";
|
|
86
106
|
readonly groupSelectButton: {
|
|
87
107
|
readonly show: "Показать все";
|
|
88
108
|
readonly hide: "Скрыть все";
|
package/dist/cjs/locale/index.js
CHANGED
|
@@ -5,12 +5,17 @@ const locale_1 = require("@cloud-ru/ds-locale");
|
|
|
5
5
|
const TABLE_MESSAGES = (0, locale_1.defineMessages)({
|
|
6
6
|
'en-GB': {
|
|
7
7
|
searchPlaceholder: 'Search',
|
|
8
|
-
rowsOptionsLabel: 'Rows
|
|
8
|
+
rowsOptionsLabel: 'Rows',
|
|
9
|
+
pagination: 'Pagination',
|
|
10
|
+
page: 'Page',
|
|
11
|
+
previousPage: 'Previous page',
|
|
12
|
+
nextPage: 'Next page',
|
|
9
13
|
settingsHeaderLabel: 'Columns settings',
|
|
10
14
|
sort: 'Sort',
|
|
11
15
|
clearSort: 'Clear sorting',
|
|
12
16
|
export: 'Export',
|
|
13
|
-
loadMore: '
|
|
17
|
+
loadMore: 'Show more',
|
|
18
|
+
refresh: 'Refresh',
|
|
14
19
|
groupSelectButton: {
|
|
15
20
|
show: 'Show all',
|
|
16
21
|
hide: 'Hide all',
|
|
@@ -29,12 +34,17 @@ const TABLE_MESSAGES = (0, locale_1.defineMessages)({
|
|
|
29
34
|
},
|
|
30
35
|
'ru-RU': {
|
|
31
36
|
searchPlaceholder: 'Поиск',
|
|
32
|
-
rowsOptionsLabel: '
|
|
37
|
+
rowsOptionsLabel: 'Строки',
|
|
38
|
+
pagination: 'Навигация по страницам',
|
|
39
|
+
page: 'Страница',
|
|
40
|
+
previousPage: 'Предыдущая страница',
|
|
41
|
+
nextPage: 'Следующая страница',
|
|
33
42
|
settingsHeaderLabel: 'Настройки колонок',
|
|
34
43
|
sort: 'Сортировка',
|
|
35
44
|
clearSort: 'Сбросить сортировку',
|
|
36
45
|
export: 'Экспорт',
|
|
37
|
-
loadMore: '
|
|
46
|
+
loadMore: 'Показать ещё',
|
|
47
|
+
refresh: 'Обновить',
|
|
38
48
|
groupSelectButton: {
|
|
39
49
|
show: 'Показать все',
|
|
40
50
|
hide: 'Скрыть все',
|
|
@@ -14,10 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./adminTable"), exports);
|
|
18
17
|
__exportStar(require("./entitiesTable"), exports);
|
|
19
18
|
__exportStar(require("./infiniteTable"), exports);
|
|
20
|
-
__exportStar(require("./serverAdminTable"), exports);
|
|
21
|
-
__exportStar(require("./serverSimpleTable"), exports);
|
|
22
19
|
__exportStar(require("./simpleTable"), exports);
|
|
23
20
|
__exportStar(require("./treeTable"), exports);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SimpleTableInput } from './toSimpleTableProps';
|
|
2
|
-
/**
|
|
2
|
+
/** Клиентская таблица с декларативными колонками, без панели инструментов и пагинации. */
|
|
3
3
|
export declare function SimpleTable<TData extends object>(props: SimpleTableInput<TData>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ exports.SimpleTable = SimpleTable;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const Table_1 = require("../../components/Table");
|
|
6
6
|
const useSimpleTableProps_1 = require("./useSimpleTableProps");
|
|
7
|
-
/**
|
|
7
|
+
/** Клиентская таблица с декларативными колонками, без панели инструментов и пагинации. */
|
|
8
8
|
function SimpleTable(props) {
|
|
9
9
|
const tableProps = (0, useSimpleTableProps_1.useSimpleTableProps)(props);
|
|
10
10
|
return (0, jsx_runtime_1.jsx)(Table_1.Table, { ...tableProps });
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
2
|
+
import { SimpleColumnDef } from '../../columnUtils';
|
|
2
3
|
import { ClientTableProps } from '../../components/types';
|
|
3
4
|
/** Входные пропсы `SimpleTable` / `useSimpleTableProps` */
|
|
4
|
-
export type SimpleTableInput<TData extends object> =
|
|
5
|
+
export type SimpleTableInput<TData extends object> = WithSupportProps<{
|
|
5
6
|
/** Данные для отрисовки */
|
|
6
7
|
data: TData[];
|
|
7
8
|
/** Декларативное описание колонок */
|
|
8
9
|
columns: SimpleColumnDef<TData>[];
|
|
9
|
-
/** Количество строк на страницу @default 10 */
|
|
10
|
-
pageSize?: number;
|
|
11
10
|
/** Стабильный идентификатор строки */
|
|
12
|
-
getRowId
|
|
13
|
-
} &
|
|
11
|
+
getRowId?(row: TData): string;
|
|
12
|
+
} & Pick<ClientTableProps<TData>, 'className' | 'outline' | 'fullWidth' | 'loading' | 'dataError' | 'noDataState' | 'errorDataState' | 'onRowClick' | 'rowAutoHeight' | 'suppressHeader' | 'dataFiltered' | 'noResultsState' | 'onRefresh' | 'rowPinning'>>;
|
|
14
13
|
/** Маппинг упрощённых пропсов в `ClientTableProps` для `Table` */
|
|
15
14
|
export declare function toSimpleTableProps<TData extends object>(input: SimpleTableInput<TData>): ClientTableProps<TData>;
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toSimpleTableProps = toSimpleTableProps;
|
|
4
4
|
const columnUtils_1 = require("../../columnUtils");
|
|
5
|
-
const constants_1 = require("../../constants");
|
|
6
|
-
const constants_2 = require("../constants");
|
|
7
5
|
const wrapGetRowId_1 = require("../wrapGetRowId");
|
|
8
6
|
/** Маппинг упрощённых пропсов в `ClientTableProps` для `Table` */
|
|
9
7
|
function toSimpleTableProps(input) {
|
|
10
|
-
const { data, columns,
|
|
8
|
+
const { data, columns, getRowId, outline, ...rest } = input;
|
|
11
9
|
return {
|
|
12
10
|
...rest,
|
|
13
|
-
|
|
11
|
+
view: 'table',
|
|
14
12
|
data,
|
|
15
13
|
columnDefinitions: (0, columnUtils_1.defineColumns)(columns),
|
|
16
14
|
outline: outline ?? true,
|
|
17
|
-
pageSize:
|
|
18
|
-
|
|
15
|
+
pageSize: Math.max(data.length, 1),
|
|
16
|
+
manualPagination: true,
|
|
17
|
+
suppressToolbar: true,
|
|
18
|
+
suppressPagination: true,
|
|
19
19
|
getRowId: (0, wrapGetRowId_1.wrapGetRowId)(getRowId),
|
|
20
20
|
};
|
|
21
21
|
}
|
|
@@ -3,19 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useSimpleTableProps = useSimpleTableProps;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const columnUtils_1 = require("../../columnUtils");
|
|
6
|
-
const constants_1 = require("../constants");
|
|
7
6
|
const wrapGetRowId_1 = require("../wrapGetRowId");
|
|
8
7
|
const toSimpleTableProps_1 = require("./toSimpleTableProps");
|
|
9
8
|
/** Возвращает готовые пропсы для `Table` из упрощённого API `SimpleTable` */
|
|
10
9
|
function useSimpleTableProps(input) {
|
|
11
|
-
const { columns, getRowId
|
|
10
|
+
const { columns, getRowId } = input;
|
|
12
11
|
const columnDefinitions = (0, react_1.useMemo)(() => (0, columnUtils_1.defineColumns)(columns), [columns]);
|
|
13
12
|
const wrappedGetRowId = (0, react_1.useMemo)(() => (0, wrapGetRowId_1.wrapGetRowId)(getRowId), [getRowId]);
|
|
14
|
-
const defaultPagination = (0, react_1.useMemo)(() => ({ options: [...constants_1.DEFAULT_PRESET_PAGINATION_OPTIONS] }), []);
|
|
15
13
|
return {
|
|
16
14
|
...(0, toSimpleTableProps_1.toSimpleTableProps)(input),
|
|
17
15
|
columnDefinitions,
|
|
18
16
|
getRowId: wrappedGetRowId,
|
|
19
|
-
pagination: pagination ?? defaultPagination,
|
|
20
17
|
};
|
|
21
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RowSelectionState } from '@tanstack/react-table';
|
|
2
|
-
import {
|
|
2
|
+
import { SimpleColumnDef } from '../../columnUtils';
|
|
3
3
|
import { ClientTableProps } from '../../components/types';
|
|
4
4
|
import { ExpandedState } from '../../types';
|
|
5
5
|
type TreeTablePrimaryColumn<TData extends object> = {
|
|
@@ -13,22 +13,22 @@ type TreeTablePrimaryColumn<TData extends object> = {
|
|
|
13
13
|
type TreeTableSelectionConfig<TData extends object> = {
|
|
14
14
|
multiRow?: boolean;
|
|
15
15
|
enable?: boolean | ((row: TData) => boolean);
|
|
16
|
-
onChange
|
|
16
|
+
onChange?(state: RowSelectionState): void;
|
|
17
17
|
state?: RowSelectionState;
|
|
18
18
|
initialState?: RowSelectionState;
|
|
19
19
|
};
|
|
20
20
|
/** Входные пропсы `TreeTable` / `useTreeTableProps` */
|
|
21
|
-
export type TreeTableInput<TData extends object> =
|
|
21
|
+
export type TreeTableInput<TData extends object> = {
|
|
22
22
|
data: TData[];
|
|
23
|
-
getChildren
|
|
23
|
+
getChildren(row: TData): TData[] | undefined;
|
|
24
24
|
primaryColumn: TreeTablePrimaryColumn<TData>;
|
|
25
25
|
secondaryColumns?: SimpleColumnDef<TData>[];
|
|
26
26
|
selection?: TreeTableSelectionConfig<TData>;
|
|
27
27
|
expandingInitialState?: ExpandedState;
|
|
28
28
|
expandingState?: ExpandedState;
|
|
29
|
-
onExpandingChange
|
|
30
|
-
getRowId
|
|
31
|
-
} & Omit<ClientTableProps<TData>, 'data' | 'columnDefinitions' | 'getRowId' | 'headlineId' | 'expanding' | '
|
|
29
|
+
onExpandingChange?(state: ExpandedState): void;
|
|
30
|
+
getRowId(row: TData): string;
|
|
31
|
+
} & Omit<ClientTableProps<TData>, 'data' | 'columnDefinitions' | 'getRowId' | 'headlineId' | 'expanding' | 'view' | 'defaultView' | 'onViewChange' | 'renderCard' | 'cardColumns' | 'cardMinWidth' | 'showDataView' | 'rowSelection' | 'rowPinning'>;
|
|
32
32
|
/** Маппинг упрощённых пропсов в `ClientTableProps` для `Table` */
|
|
33
33
|
export declare function toTreeTableProps<TData extends object>(input: TreeTableInput<TData>): ClientTableProps<TData>;
|
|
34
34
|
export {};
|
|
@@ -20,14 +20,13 @@ function mapSelectionEnable(enable) {
|
|
|
20
20
|
}
|
|
21
21
|
/** Маппинг упрощённых пропсов в `ClientTableProps` для `Table` */
|
|
22
22
|
function toTreeTableProps(input) {
|
|
23
|
-
const { data, getChildren, primaryColumn, secondaryColumns = [], selection, expandingInitialState, expandingState, onExpandingChange, getRowId,
|
|
23
|
+
const { data, getChildren, primaryColumn, secondaryColumns = [], selection, expandingInitialState, expandingState, onExpandingChange, getRowId, outline, ...rest } = input;
|
|
24
24
|
return {
|
|
25
25
|
...rest,
|
|
26
|
-
|
|
26
|
+
view: 'table',
|
|
27
27
|
data,
|
|
28
28
|
columnDefinitions: (0, columnUtils_1.defineColumns)(secondaryColumns),
|
|
29
29
|
getRowId: (0, wrapGetRowId_1.wrapGetRowId)(getRowId),
|
|
30
|
-
suppressPagination: true,
|
|
31
30
|
outline: outline ?? true,
|
|
32
31
|
expanding: {
|
|
33
32
|
getSubRows: getChildren,
|
package/dist/cjs/style.css
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
position:relative;
|
|
5
5
|
display:grid;
|
|
6
6
|
grid-template-rows:minmax(0, 100%) max-content;
|
|
7
|
+
box-sizing:border-box;
|
|
7
8
|
width:100%;
|
|
8
9
|
max-width:100%;
|
|
9
10
|
min-height:0;
|
|
@@ -798,6 +799,7 @@
|
|
|
798
799
|
height:var(--sn-density-icon-xs, var(--sn-platform-comfort-icon-xs, var(--sn-primitive-dimension-24, 24px))) !important;
|
|
799
800
|
}
|
|
800
801
|
.rowActionsHeader{
|
|
802
|
+
min-width:var(--sn-table-anatomy-content-headLine-actionWrapper-maxWidth, var(--sn-table-anatomy-content-tableLine-actionWrapper-maxWidth, var(--sn-primitive-dimension-40, 40px)));
|
|
801
803
|
max-width:var(--sn-table-anatomy-content-headLine-actionWrapper-maxWidth, var(--sn-table-anatomy-content-tableLine-actionWrapper-maxWidth, var(--sn-primitive-dimension-40, 40px)));
|
|
802
804
|
padding:0 !important;
|
|
803
805
|
}
|
|
@@ -809,6 +811,7 @@
|
|
|
809
811
|
|
|
810
812
|
.rowActionsCell{
|
|
811
813
|
position:relative;
|
|
814
|
+
min-width:var(--sn-table-anatomy-content-tableLine-actionWrapper-maxWidth, var(--sn-primitive-dimension-40, 40px));
|
|
812
815
|
max-width:var(--sn-table-anatomy-content-tableLine-actionWrapper-maxWidth, var(--sn-primitive-dimension-40, 40px));
|
|
813
816
|
}
|
|
814
817
|
|
|
@@ -864,6 +867,7 @@
|
|
|
864
867
|
.treeLine{
|
|
865
868
|
position:relative;
|
|
866
869
|
flex-shrink:0;
|
|
870
|
+
box-sizing:border-box;
|
|
867
871
|
width:var(--sn-table-anatomy-content-tableLine-pinnedWrapper-elementWrapper-treeControl-centeredWrapper-childLine-maxWidth, var(--sn-density-icon-s, var(--sn-platform-comfort-icon-s, var(--sn-primitive-dimension-24, 24px))));
|
|
868
872
|
height:100%;
|
|
869
873
|
}
|
|
@@ -1554,6 +1558,7 @@
|
|
|
1554
1558
|
gap:var(--sn-primitive-dimension-8, 8px);
|
|
1555
1559
|
align-items:center;
|
|
1556
1560
|
justify-content:flex-end;
|
|
1561
|
+
box-sizing:border-box;
|
|
1557
1562
|
}
|
|
1558
1563
|
|
|
1559
1564
|
.pagination{
|
|
@@ -1563,6 +1568,13 @@
|
|
|
1563
1568
|
.footer[data-view=cards] .pagination{
|
|
1564
1569
|
flex:1;
|
|
1565
1570
|
}
|
|
1571
|
+
|
|
1572
|
+
.mobilePagination{
|
|
1573
|
+
display:flex;
|
|
1574
|
+
gap:var(--sn-primitive-dimension-4, 4px);
|
|
1575
|
+
align-items:center;
|
|
1576
|
+
margin-right:auto;
|
|
1577
|
+
}
|
|
1566
1578
|
@charset "UTF-8";
|
|
1567
1579
|
.root{
|
|
1568
1580
|
cursor:pointer;
|
|
@@ -33,7 +33,7 @@ export function ServerTable({ items, total = DEFAULT_PAGINATION_LIMIT, limit = D
|
|
|
33
33
|
onChange: handleSearch,
|
|
34
34
|
loading: searchProp?.loading,
|
|
35
35
|
placeholder: searchProp?.placeholder,
|
|
36
|
-
}, columnFilters: columnFilters, pageCount: pageCount, pagination: {
|
|
36
|
+
}, columnFilters: columnFilters, pageCount: pageCount, rowCount: total, pagination: {
|
|
37
37
|
...pagination,
|
|
38
38
|
state: {
|
|
39
39
|
pageIndex,
|
|
@@ -4,7 +4,7 @@ import { TableLayoutDefaults, TableProps } from '../types.js';
|
|
|
4
4
|
/** DS-пресет адаптива `Table`: mobile-дефолты sticky-хрома, `fullWidth` и стартовый вид `cards`. Desktop — `BASE_TABLE_LAYOUT_DEFAULTS`. */
|
|
5
5
|
export declare const TABLE_LAYOUT_PRESETS: LayoutPresets<TableLayoutDefaults>;
|
|
6
6
|
/** Компонент таблицы */
|
|
7
|
-
export declare function Table<TData extends object, TFilters extends FiltersState = Record<string, unknown>>({ data, rowPinning, columnDefinitions, keepPinnedRows, copyPinnedRows, enableSelectPinned, rowSelection: rowSelectionProp, search, sorting: sortingProp, columnFilters, pagination: paginationProp, className, onRowClick, onRefresh, pageSize, pageCount, loading, infiniteLoading, onLoadMore, hasMore, loadMoreTrigger, outline, fullWidth, moreActions, onExport, dataFiltered, dataError, noDataState, noResultsState, errorDataState, suppressToolbar, suppressHeader, suppressSearch, toolbarAfter, suppressPagination, manualSorting, manualPagination: manualPaginationProp, manualFiltering, autoResetPageIndex, scrollRef, scrollContainerRef, stickyControls: stickyControlsProp, layoutPresets, getRowId, enableFuzzySearch, savedState, expanding: expandingProp, bulkActions: bulkActionsProp, rowAutoHeight, columnsSettings: columnsSettingsProp, getRowBackgroundColor, headerRowBackgroundColor, toolbarCheckBoxMode, view: viewProp, defaultView: defaultViewProp, onViewChange, showDataView, headlineId, cardColumns, cardMinWidth, renderCard, enableRowVirtualization, rowVirtualizerOptions, rowVirtualizerInstanceRef, enableColumnVirtualization, columnVirtualizerOptions, columnVirtualizerInstanceRef, ...rest }: TableProps<TData, TFilters>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function Table<TData extends object, TFilters extends FiltersState = Record<string, unknown>>({ data, rowPinning, columnDefinitions, keepPinnedRows, copyPinnedRows, enableSelectPinned, rowSelection: rowSelectionProp, search, sorting: sortingProp, columnFilters, pagination: paginationProp, className, onRowClick, onRefresh, pageSize, pageCount, rowCount, loading, infiniteLoading, onLoadMore, hasMore, loadMoreTrigger, outline, fullWidth, moreActions, onExport, dataFiltered, dataError, noDataState, noResultsState, errorDataState, suppressToolbar, suppressHeader, suppressSearch, toolbarAfter, suppressPagination, manualSorting, manualPagination: manualPaginationProp, manualFiltering, autoResetPageIndex, scrollRef, scrollContainerRef, stickyControls: stickyControlsProp, layoutPresets, getRowId, enableFuzzySearch, savedState, expanding: expandingProp, bulkActions: bulkActionsProp, rowAutoHeight, columnsSettings: columnsSettingsProp, getRowBackgroundColor, headerRowBackgroundColor, toolbarCheckBoxMode, view: viewProp, defaultView: defaultViewProp, onViewChange, showDataView, headlineId, cardColumns, cardMinWidth, renderCard, enableRowVirtualization, rowVirtualizerOptions, rowVirtualizerInstanceRef, enableColumnVirtualization, columnVirtualizerOptions, columnVirtualizerInstanceRef, ...rest }: TableProps<TData, TFilters>): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare namespace Table {
|
|
9
9
|
var getStatusColumnDef: typeof import("../..").getStatusColumnDef;
|
|
10
10
|
var statusAppearances: {
|