hrm_ui_lib 3.2.3 → 3.4.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/components/Alert/Alert.js +2 -2
- package/components/Avatar/types.d.ts +1 -3
- package/components/Badge/Badge.js +2 -2
- package/components/BadgeV2/BadgeV2.js +3 -3
- package/components/Breadcrumb/Breadcrumb.js +3 -3
- package/components/Button/types.d.ts +1 -2
- package/components/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/components/ButtonGroup/ButtonGroup.js +3 -3
- package/components/ButtonGroup/ButtonGroupItem.d.ts +1 -1
- package/components/ButtonGroup/ButtonGroupItem.js +2 -2
- package/components/ButtonGroup/types.d.ts +1 -1
- package/components/Card/types.d.ts +1 -2
- package/components/CardGroup/types.d.ts +1 -2
- package/components/Checkbox/Checkbox.js +4 -4
- package/components/Chips/Chips.js +1 -1
- package/components/Chips/types.d.ts +0 -1
- package/components/Collapse/types.d.ts +3 -6
- package/components/Container/Container.js +2 -2
- package/components/Container/types.d.ts +1 -1
- package/components/Copy/types.d.ts +1 -2
- package/components/DarkModeSwitcher/DarkModeSwitcher.d.ts +2 -4
- package/components/DarkModeSwitcher/DarkModeSwitcher.js +2 -2
- package/components/DatePicker/types.d.ts +0 -1
- package/components/Divider/Divider.js +2 -2
- package/components/Divider/types.d.ts +1 -1
- package/components/Empty/Empty.js +3 -2
- package/components/Empty/types.d.ts +1 -1
- package/components/FileUpload/DropzoneFileUpload/DropzoneFileUpload.js +5 -5
- package/components/FileUpload/DropzoneFileUpload/ErrorItem.d.ts +2 -1
- package/components/FileUpload/DropzoneFileUpload/ErrorItem.js +2 -2
- package/components/FileUpload/DropzoneFileUpload/PreviewItem.d.ts +2 -1
- package/components/FileUpload/DropzoneFileUpload/PreviewItem.js +2 -2
- package/components/FileUpload/FileUpload.js +2 -2
- package/components/FileUpload/UploadItems.js +3 -3
- package/components/FileUpload/types.d.ts +1 -1
- package/components/FormContainer/FormContainer.js +4 -4
- package/components/FormContainer/types.d.ts +1 -1
- package/components/FormField/types.d.ts +1 -2
- package/components/Heading/types.d.ts +1 -2
- package/components/Image/Image.js +3 -3
- package/components/Image/types.d.ts +1 -1
- package/components/LineChart/LineChart.d.ts +1 -1
- package/components/LineChart/LineChart.js +4 -4
- package/components/LineChart/types.d.ts +1 -1
- package/components/Link/types.d.ts +1 -2
- package/components/Menu/types.d.ts +1 -2
- package/components/More/More.js +2 -2
- package/components/More/types.d.ts +1 -1
- package/components/Pagination/Pagination.js +4 -4
- package/components/Pagination/types.d.ts +1 -1
- package/components/Progress/Progress.js +3 -3
- package/components/Progress/types.d.ts +1 -1
- package/components/ProgressStep/ProgressStep.js +3 -3
- package/components/ProgressStep/Step.js +6 -6
- package/components/ProgressStep/types.d.ts +2 -2
- package/components/Radio/types.d.ts +1 -2
- package/components/Select/ButtonSelect/ButtonSelect.js +3 -2
- package/components/Select/FilterSelect/FilterDropdown.js +4 -3
- package/components/Select/FilterSelect/FilterSelect.js +3 -3
- package/components/Select/MultiSelect/DesktopWrapper.d.ts +1 -0
- package/components/Select/MultiSelect/DesktopWrapper.js +2 -2
- package/components/Select/MultiSelect/MobileWrapper.d.ts +1 -0
- package/components/Select/MultiSelect/MobileWrapper.js +2 -2
- package/components/Select/MultiSelect/MultiBase/MultiBase.js +4 -3
- package/components/Select/MultiSelect/MultiSelect.js +3 -3
- package/components/Select/MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js +5 -4
- package/components/Select/MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js +5 -4
- package/components/Select/MultiSelect/OptionsWrapper.d.ts +1 -0
- package/components/Select/NestedSelect/NestedSelect.js +5 -4
- package/components/Select/ProfileDropdown/index.js +2 -2
- package/components/Select/Select/Select.js +2 -2
- package/components/Select/Select/SelectDesktop/index.js +4 -3
- package/components/Select/Select/SelectMobile/MobileTopContent.d.ts +2 -1
- package/components/Select/Select/SelectMobile/MobileTopContent.js +2 -2
- package/components/Select/Select/SelectMobile/index.js +3 -2
- package/components/Select/SharedComponents/ButtonSelectWrapper/ButtonSelectWrapper.js +1 -1
- package/components/Select/SharedComponents/ContentTop.d.ts +1 -0
- package/components/Select/SharedComponents/ContentTop.js +6 -5
- package/components/Select/SharedComponents/Footer.js +2 -2
- package/components/Select/SharedComponents/InputSelectWrapper/InputSelectWrapper.js +3 -3
- package/components/Select/helper.d.ts +1 -0
- package/components/Select/helper.js +7 -1
- package/components/Select/types.d.ts +5 -5
- package/components/SideSheet/Footer/Footer.d.ts +2 -1
- package/components/SideSheet/Footer/Footer.js +2 -2
- package/components/SideSheet/SideSheet.js +3 -3
- package/components/SideSheet/types.d.ts +1 -1
- package/components/Skeleton/types.d.ts +1 -2
- package/components/Status/Status.js +3 -3
- package/components/Status/types.d.ts +0 -1
- package/components/Stepper/Stepper.js +2 -2
- package/components/Stepper/types.d.ts +2 -2
- package/components/Tab/Tab.js +3 -3
- package/components/Tab/TabItem.js +1 -1
- package/components/Tab/types.d.ts +2 -4
- package/components/Table/Header.d.ts +2 -2
- package/components/Table/Header.js +2 -2
- package/components/Table/IndeterminateCheckbox.d.ts +2 -4
- package/components/Table/IndeterminateCheckbox.js +2 -2
- package/components/Table/Row.d.ts +2 -2
- package/components/Table/Row.js +6 -6
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +5 -5
- package/components/Table/types.d.ts +1 -1
- package/components/Table/utils.d.ts +1 -1
- package/components/Table/utils.js +3 -3
- package/components/TableV2/AdvancedPagination.d.ts +2 -2
- package/components/TableV2/AdvancedPagination.js +3 -3
- package/components/TableV2/ColumnHeader.d.ts +2 -2
- package/components/TableV2/ColumnHeader.js +3 -3
- package/components/TableV2/IndeterminateCheckbox.d.ts +2 -4
- package/components/TableV2/IndeterminateCheckbox.js +2 -2
- package/components/TableV2/Table.d.ts +1 -1
- package/components/TableV2/Table.js +15 -12
- package/components/TableV2/hooks/useTableControl.d.ts +1 -1
- package/components/TableV2/hooks/useTableControl.js +4 -4
- package/components/TableV2/types.d.ts +2 -2
- package/components/Text/types.d.ts +1 -2
- package/components/UnderConstruction/UnderConstruction.js +2 -2
- package/components/UnderConstruction/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { TTableProps } from './types';
|
|
3
|
-
export declare function Table({ columns, data, onChange, fixedHeader, withSelect, handleRowClick, className, language, containerRefHandler, submitButtons }: TTableProps): ReactElement;
|
|
3
|
+
export declare function Table({ columns, data, onChange, fixedHeader, withSelect, handleRowClick, className, language, containerRefHandler, submitButtons, dataId }: TTableProps): ReactElement;
|
|
@@ -11,7 +11,7 @@ import { TABLE_LOCALIZATION } from './localization';
|
|
|
11
11
|
import { setTranslationValue } from '../../utils/helpers';
|
|
12
12
|
import IconCheckmark from '../SVGIcons/IconCheckmark';
|
|
13
13
|
import IconDismiss from '../SVGIcons/IconDismiss';
|
|
14
|
-
export function Table({ columns, data, onChange, fixedHeader, withSelect = false, handleRowClick, className, language = 'en', containerRefHandler, submitButtons }) {
|
|
14
|
+
export function Table({ columns, data, onChange, fixedHeader, withSelect = false, handleRowClick, className, language = 'en', containerRefHandler, submitButtons, dataId = '' }) {
|
|
15
15
|
const tableRef = useRef(null);
|
|
16
16
|
const [tableWidth, setTableWidth] = useState(400);
|
|
17
17
|
const uniqueKey = useId();
|
|
@@ -42,7 +42,7 @@ export function Table({ columns, data, onChange, fixedHeader, withSelect = false
|
|
|
42
42
|
const { getTableProps, getTableBodyProps, selectedFlatRows, headerGroups, rows, prepareRow, toggleAllRowsSelected, state } = useTable({
|
|
43
43
|
columns: sortedColumns,
|
|
44
44
|
data
|
|
45
|
-
}, useSortBy, useRowSelect, (hooks) => setSelectedRows(hooks, withSelect));
|
|
45
|
+
}, useSortBy, useRowSelect, (hooks) => setSelectedRows(hooks, withSelect, dataId));
|
|
46
46
|
const handleResize = useCallback(() => {
|
|
47
47
|
var _a;
|
|
48
48
|
if (tableRef.current) {
|
|
@@ -65,10 +65,10 @@ export function Table({ columns, data, onChange, fixedHeader, withSelect = false
|
|
|
65
65
|
const onClearSelectedRows = useCallback(() => {
|
|
66
66
|
toggleAllRowsSelected(false);
|
|
67
67
|
}, []);
|
|
68
|
-
return (_jsxs("div", { ref: containerRefHandler, children: [withSelect && selectedFlatRows.length > 0 && (_jsxs("div", { className: "table-wrapper__selected-rows", children: [_jsx(Button, { buttonText: setTranslationValue(TABLE_LOCALIZATION[language].n_selected || '', selectedFlatRows.length), onClick: onClearSelectedRows, type: "tertiary", size: "medium", iconProps: { alignment: 'left', Component: IconDismiss } }), submitButtons === null || submitButtons === void 0 ? void 0 : submitButtons.map(({ buttonText, isLoading, onClick, iconProps }) => (_jsx(Button, { iconProps: iconProps || { alignment: 'left', Component: IconCheckmark }, onClick: (event) => {
|
|
68
|
+
return (_jsxs("div", { ref: containerRefHandler, "data-id": dataId, children: [withSelect && selectedFlatRows.length > 0 && (_jsxs("div", { className: "table-wrapper__selected-rows", children: [_jsx(Button, { buttonText: setTranslationValue(TABLE_LOCALIZATION[language].n_selected || '', selectedFlatRows.length), onClick: onClearSelectedRows, type: "tertiary", size: "medium", iconProps: { alignment: 'left', Component: IconDismiss }, dataId: dataId ? `${dataId}-clear-selected` : '' }), submitButtons === null || submitButtons === void 0 ? void 0 : submitButtons.map(({ buttonText, isLoading, onClick, iconProps }, i) => (_jsx(Button, { iconProps: iconProps || { alignment: 'left', Component: IconCheckmark }, onClick: (event) => {
|
|
69
69
|
onClick(event, state, onClearSelectedRows);
|
|
70
|
-
}, buttonText: buttonText || 'Submit', type: "secondary", size: "medium", className: "mr-8", isLoading: isLoading })))] })), _jsx("div", { onScroll: dispatchScrollEvent, className: classNames('table-wrapper scrollbar scrollbar--horizontal scrollbar--vertical', className, { 'table-row-clickable': !!handleRowClick }), style: { maxHeight: fixedHeader === null || fixedHeader === void 0 ? void 0 : fixedHeader.y }, children: _jsxs("table", Object.assign({}, getTableProps(), { ref: tableRef, children: [_jsx("thead", { children: headerGroups.map((headerGroup, i) => (_jsx(Header, { withSelect: withSelect, fixedHeader: Boolean(fixedHeader), headerGroup: headerGroup, tableWidth: tableWidth, uniqueKey: uniqueKey }, `table_head_${uniqueKey}_${i}`))) }), _jsx("tbody", Object.assign({}, getTableBodyProps(), { children: rows.map((row) => {
|
|
70
|
+
}, buttonText: buttonText || 'Submit', type: "secondary", size: "medium", className: "mr-8", isLoading: isLoading, dataId: dataId ? `${dataId}-submit-${i}` : '' })))] })), _jsx("div", { onScroll: dispatchScrollEvent, className: classNames('table-wrapper scrollbar scrollbar--horizontal scrollbar--vertical', className, { 'table-row-clickable': !!handleRowClick }), style: { maxHeight: fixedHeader === null || fixedHeader === void 0 ? void 0 : fixedHeader.y }, children: _jsxs("table", Object.assign({}, getTableProps(), { ref: tableRef, children: [_jsx("thead", { children: headerGroups.map((headerGroup, i) => (_jsx(Header, { withSelect: withSelect, fixedHeader: Boolean(fixedHeader), headerGroup: headerGroup, tableWidth: tableWidth, uniqueKey: uniqueKey, dataId: dataId }, `table_head_${uniqueKey}_${i}`))) }), _jsx("tbody", Object.assign({}, getTableBodyProps(), { children: rows.map((row) => {
|
|
71
71
|
prepareRow(row);
|
|
72
|
-
return (_jsx(Row, { handleRowClick: handleRowClick, withSelect: withSelect, selectedFlatRows: selectedFlatRows, row: row, uniqueKey: uniqueKey }, `table_row_${uniqueKey}_${row.id}`));
|
|
72
|
+
return (_jsx(Row, { handleRowClick: handleRowClick, withSelect: withSelect, selectedFlatRows: selectedFlatRows, row: row, uniqueKey: uniqueKey, dataId: dataId }, `table_row_${uniqueKey}_${row.id}`));
|
|
73
73
|
}) }))] })) })] }));
|
|
74
74
|
}
|
|
@@ -15,7 +15,7 @@ export type TColumn = Column & TColumnFields;
|
|
|
15
15
|
export interface IButtonPropTypes extends Omit<TButtonPropTypes, 'onClick'> {
|
|
16
16
|
onClick: (event: TClickEventType, data: any, clearRowSelection?: () => void) => void;
|
|
17
17
|
}
|
|
18
|
-
export type TTableProps = {
|
|
18
|
+
export type TTableProps = IBaseProps & {
|
|
19
19
|
className?: string;
|
|
20
20
|
columns: TColumn[];
|
|
21
21
|
data: any[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hooks } from 'react-table';
|
|
2
2
|
export declare const CHECKBOX_HEADER_ID = "selection";
|
|
3
3
|
export declare const CHECKBOX_DEFAULT_WIDTH = 48;
|
|
4
|
-
export declare function setSelectedRows(hooks: Hooks, withSelect: boolean): void;
|
|
4
|
+
export declare function setSelectedRows(hooks: Hooks, withSelect: boolean, dataId?: string): void;
|
|
5
5
|
export declare function calcColumnWidth(percent: number, tableWidth: number): number;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { IndeterminateCheckbox } from './IndeterminateCheckbox';
|
|
3
3
|
export const CHECKBOX_HEADER_ID = 'selection';
|
|
4
4
|
export const CHECKBOX_DEFAULT_WIDTH = 48;
|
|
5
|
-
export function setSelectedRows(hooks, withSelect) {
|
|
5
|
+
export function setSelectedRows(hooks, withSelect, dataId = '') {
|
|
6
6
|
if (withSelect) {
|
|
7
7
|
hooks.visibleColumns.push((columns) => [
|
|
8
8
|
{
|
|
@@ -15,7 +15,7 @@ export function setSelectedRows(hooks, withSelect) {
|
|
|
15
15
|
checked: allSelected,
|
|
16
16
|
indeterminate: !allSelected && someSelected,
|
|
17
17
|
disabled: allEnabledRows.length === 0
|
|
18
|
-
}), { onChange: (e) => {
|
|
18
|
+
}), { dataId: dataId ? `${dataId}-select-all` : '', onChange: (e) => {
|
|
19
19
|
const checked = e.target.checked;
|
|
20
20
|
allEnabledRows.forEach((row) => {
|
|
21
21
|
toggleRowSelected(row.id, checked);
|
|
@@ -26,7 +26,7 @@ export function setSelectedRows(hooks, withSelect) {
|
|
|
26
26
|
const disabled = 'enableSelection' in row.original ? !row.original.enableSelection : false;
|
|
27
27
|
return (_jsx(IndeterminateCheckbox, Object.assign({}, row.getToggleRowSelectedProps({
|
|
28
28
|
disabled
|
|
29
|
-
}))));
|
|
29
|
+
}), { dataId: dataId ? `${dataId}-row-${row.index}-select` : '' })));
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
...columns
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Table } from '@tanstack/react-table';
|
|
2
|
-
interface PaginationProps<T> {
|
|
2
|
+
interface PaginationProps<T> extends IBaseProps {
|
|
3
3
|
table: Table<T>;
|
|
4
4
|
totalCount: number;
|
|
5
5
|
buttonText?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function AdvancedPagination<TData>({ table, totalCount, buttonText }: PaginationProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function AdvancedPagination<TData>({ table, totalCount, buttonText, dataId }: PaginationProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -11,7 +11,7 @@ import IconChevronRight from '../SVGIcons/IconChevronRight';
|
|
|
11
11
|
import IconChevronDoubleLeft from '../SVGIcons/IconChevronDoubleLeft';
|
|
12
12
|
import IconChevronDoubleRight from '../SVGIcons/IconChevronDoubleRight';
|
|
13
13
|
import IconMore from '../SVGIcons/IconMore';
|
|
14
|
-
export function AdvancedPagination({ table, totalCount, buttonText }) {
|
|
14
|
+
export function AdvancedPagination({ table, totalCount, buttonText, dataId = '' }) {
|
|
15
15
|
const [navigatePage, setNavigatePage] = useState('1');
|
|
16
16
|
const pageIndex = table.getState().pagination.pageIndex;
|
|
17
17
|
const pageSize = table.getState().pagination.pageSize;
|
|
@@ -56,7 +56,7 @@ export function AdvancedPagination({ table, totalCount, buttonText }) {
|
|
|
56
56
|
setNavigatePage('1');
|
|
57
57
|
}
|
|
58
58
|
}, [table.getPageCount(), table.getState().pagination]);
|
|
59
|
-
return (_jsxs("div", { className: "advanced-table__pagination", children: [_jsx(Select, { setSelectedItem: (value) => onRowCountChange(value), selectedItem: `${pageSize}`, className: 'no-border', options: OPTIONS }), _jsxs("div", { className: 'advanced-table__pagination__right', children: [_jsxs(Text, { type: 'tertiary', children: [pageIndex * pageSize + 1, " - ", (pageIndex + 1) * pageSize, " / ", totalCount] }), _jsxs("div", { className: "flexbox align-items--center", children: [_jsx(Input, { currentValue: navigatePage, size: "small", onChange: (e) => onNavigateToPage(e.target.value), className: "advanced-table__pagination__right__input mr-8" }), _jsx(Button, { onClick: onGoToPage, type: "secondary", size: "medium", buttonText: buttonText !== null && buttonText !== void 0 ? buttonText : 'Go to page' })] }), _jsxs("ul", { className: "pagination", children: [_jsx("li", { className: `previous ${!table.getCanPreviousPage() ? 'disabled' : ''}`, children: _jsx("a", { rel: 'prev', role: 'button', onClick: () => table.firstPage(), children: _jsx(IconChevronDoubleLeft, { size: 'small' }) }) }), _jsx("li", { className: `previous ${!table.getCanPreviousPage() ? 'disabled' : ''}`, children: _jsx("a", { rel: 'prev', role: 'button', onClick: () => table.previousPage(), children: _jsx(IconChevronLeft, { size: 'small' }) }) }), getVisiblePageNumbers().map((pageNumber, index) => pageNumber === '---' ? (_jsx("li", { className: 'pagination__more', children: _jsx("a", { role: 'button', onClick: () => table.setPageIndex(+pageIndex - 3), children: _jsx(IconMore, { size: 'small' }) }) }, `ellipsis-${index}`)) : pageNumber === '+++' ? (_jsx("li", { className: 'pagination__more', children: _jsx("a", { role: 'button', onClick: () => table.setPageIndex(+pageIndex + 3), children: _jsx(IconMore, { size: 'small' }) }) }, `ellipsis-${index}`)) : (_jsx("li", { className: classnames({
|
|
59
|
+
return (_jsxs("div", { className: "advanced-table__pagination", "data-id": dataId, children: [_jsx(Select, { setSelectedItem: (value) => onRowCountChange(value), selectedItem: `${pageSize}`, className: 'no-border', options: OPTIONS, dataId: dataId ? `${dataId}-page-size` : '' }), _jsxs("div", { className: 'advanced-table__pagination__right', children: [_jsxs(Text, { type: 'tertiary', children: [pageIndex * pageSize + 1, " - ", (pageIndex + 1) * pageSize, " / ", totalCount] }), _jsxs("div", { className: "flexbox align-items--center", children: [_jsx(Input, { currentValue: navigatePage, size: "small", onChange: (e) => onNavigateToPage(e.target.value), className: "advanced-table__pagination__right__input mr-8", dataId: dataId ? `${dataId}-page-input` : '' }), _jsx(Button, { onClick: onGoToPage, type: "secondary", size: "medium", buttonText: buttonText !== null && buttonText !== void 0 ? buttonText : 'Go to page', dataId: dataId ? `${dataId}-goto` : '' })] }), _jsxs("ul", { className: "pagination", "data-id": dataId ? `${dataId}-pagination` : '', children: [_jsx("li", { className: `previous ${!table.getCanPreviousPage() ? 'disabled' : ''}`, children: _jsx("a", { rel: 'prev', role: 'button', onClick: () => table.firstPage(), "data-id": dataId ? `${dataId}-first` : '', children: _jsx(IconChevronDoubleLeft, { size: 'small' }) }) }), _jsx("li", { className: `previous ${!table.getCanPreviousPage() ? 'disabled' : ''}`, children: _jsx("a", { rel: 'prev', role: 'button', onClick: () => table.previousPage(), "data-id": dataId ? `${dataId}-prev` : '', children: _jsx(IconChevronLeft, { size: 'small' }) }) }), getVisiblePageNumbers().map((pageNumber, index) => pageNumber === '---' ? (_jsx("li", { className: 'pagination__more', children: _jsx("a", { role: 'button', onClick: () => table.setPageIndex(+pageIndex - 3), "data-id": dataId ? `${dataId}-ellipsis-prev` : '', children: _jsx(IconMore, { size: 'small' }) }) }, `ellipsis-${index}`)) : pageNumber === '+++' ? (_jsx("li", { className: 'pagination__more', children: _jsx("a", { role: 'button', onClick: () => table.setPageIndex(+pageIndex + 3), "data-id": dataId ? `${dataId}-ellipsis-next` : '', children: _jsx(IconMore, { size: 'small' }) }) }, `ellipsis-${index}`)) : (_jsx("li", { className: classnames({
|
|
60
60
|
['active']: pageNumber === pageIndex + 1
|
|
61
|
-
}), children: _jsx("a", { role: 'button', onClick: () => table.setPageIndex(+pageNumber - 1), children: pageNumber }) }, pageNumber))), _jsx("li", { className: `next ${!table.getCanNextPage() ? 'disabled' : ''}`, children: _jsx("a", { rel: 'next', role: 'button', onClick: () => table.nextPage(), children: _jsx(IconChevronRight, { size: 'small' }) }) }), _jsx("li", { className: `next ${!table.getCanNextPage() ? 'disabled' : ''}`, children: _jsx("a", { rel: 'next', role: 'button', onClick: () => table.lastPage(), children: _jsx(IconChevronDoubleRight, { size: 'small' }) }) })] })] })] }));
|
|
61
|
+
}), children: _jsx("a", { role: 'button', onClick: () => table.setPageIndex(+pageNumber - 1), "data-id": dataId ? `${dataId}-page-${pageNumber}` : '', children: pageNumber }) }, pageNumber))), _jsx("li", { className: `next ${!table.getCanNextPage() ? 'disabled' : ''}`, children: _jsx("a", { rel: 'next', role: 'button', onClick: () => table.nextPage(), "data-id": dataId ? `${dataId}-next` : '', children: _jsx(IconChevronRight, { size: 'small' }) }) }), _jsx("li", { className: `next ${!table.getCanNextPage() ? 'disabled' : ''}`, children: _jsx("a", { rel: 'next', role: 'button', onClick: () => table.lastPage(), "data-id": dataId ? `${dataId}-last` : '', children: _jsx(IconChevronDoubleRight, { size: 'small' }) }) })] })] })] }));
|
|
62
62
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import type { Header } from '@tanstack/react-table';
|
|
3
|
-
interface DraggableColumnHeaderProps<TData> {
|
|
3
|
+
interface DraggableColumnHeaderProps<TData> extends IBaseProps {
|
|
4
4
|
header: Header<TData, unknown>;
|
|
5
5
|
isPinned?: boolean;
|
|
6
6
|
pinnedStyles: CSSProperties;
|
|
7
7
|
}
|
|
8
|
-
export declare function ColumnHeader<TData>({ header, pinnedStyles }: DraggableColumnHeaderProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ColumnHeader<TData>({ header, pinnedStyles, dataId }: DraggableColumnHeaderProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -6,7 +6,7 @@ import IconArrowSort from '../SVGIcons/IconArrowSort';
|
|
|
6
6
|
import IconArrowUp from '../SVGIcons/IconArrowUp';
|
|
7
7
|
import { Text } from '../Text';
|
|
8
8
|
import classnames from 'classnames';
|
|
9
|
-
export function ColumnHeader({ header, pinnedStyles }) {
|
|
9
|
+
export function ColumnHeader({ header, pinnedStyles, dataId = '' }) {
|
|
10
10
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
|
11
11
|
id: header.id
|
|
12
12
|
});
|
|
@@ -23,10 +23,10 @@ export function ColumnHeader({ header, pinnedStyles }) {
|
|
|
23
23
|
position: 'relative',
|
|
24
24
|
zIndex: isDragging ? 1 : 0
|
|
25
25
|
};
|
|
26
|
-
return (_jsxs("th", Object.assign({ ref: setNodeRef, style: Object.assign(Object.assign({}, style), pinnedStyles), className: classnames('select-none', {
|
|
26
|
+
return (_jsxs("th", Object.assign({ ref: setNodeRef, "data-id": dataId ? `${dataId}-header-${header.column.id}` : '', style: Object.assign(Object.assign({}, style), pinnedStyles), className: classnames('select-none', {
|
|
27
27
|
['with-checkbox']: header.column.id === 'select',
|
|
28
28
|
['actions-header']: header.column.id === 'actions',
|
|
29
29
|
['cursor-pointer']: header.column.getCanSort()
|
|
30
|
-
}) }, attributes, { children: [_jsxs("div", { onClick: header.column.getToggleSortingHandler(), className: "flexbox align-items--center", children: [_jsx("div", Object.assign({}, listeners, { children: _jsx(Text, { className: "text-left", weight: 'bold', children: flexRender(header.column.columnDef.header, header.getContext()) }) })), _jsx("span", { className: "ml-4", children: header.column.getCanSort() &&
|
|
30
|
+
}) }, attributes, { children: [_jsxs("div", { onClick: header.column.getToggleSortingHandler(), "data-id": dataId ? `${dataId}-sort-${header.column.id}` : '', className: "flexbox align-items--center", children: [_jsx("div", Object.assign({}, listeners, { children: _jsx(Text, { className: "text-left", weight: 'bold', children: flexRender(header.column.columnDef.header, header.getContext()) }) })), _jsx("span", { className: "ml-4", children: header.column.getCanSort() &&
|
|
31
31
|
(header.column.getIsSorted() === 'asc' ? (_jsx(IconArrowUp, { size: "xsmall" })) : header.column.getIsSorted() === 'desc' ? (_jsx(IconArrowDown, { size: "xsmall" })) : (_jsx(IconArrowSort, { size: "xsmall" }))) })] }), _jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: "resize-icon select-none touch-none" })] })));
|
|
32
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
export declare const IndeterminateCheckbox: React.ForwardRefExoticComponent<IBaseProps & {
|
|
3
3
|
indeterminate: boolean;
|
|
4
4
|
checked: boolean;
|
|
5
5
|
onChange: (e: {
|
|
@@ -8,6 +8,4 @@ type IndeterminateCheckboxProps = {
|
|
|
8
8
|
};
|
|
9
9
|
}) => void;
|
|
10
10
|
disabled?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const IndeterminateCheckbox: React.ForwardRefExoticComponent<IndeterminateCheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
13
|
-
export {};
|
|
11
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useEffect, useRef } from 'react';
|
|
3
3
|
import { Checkbox } from '../Checkbox';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
export const IndeterminateCheckbox = forwardRef(({ indeterminate, checked, onChange, disabled }, ref) => {
|
|
5
|
+
export const IndeterminateCheckbox = forwardRef(({ indeterminate, checked, onChange, disabled, dataId = '' }, ref) => {
|
|
6
6
|
const defaultRef = useRef(null);
|
|
7
7
|
const resolvedRef = ref !== null && ref !== void 0 ? ref : defaultRef;
|
|
8
8
|
useEffect(() => {
|
|
@@ -11,6 +11,6 @@ export const IndeterminateCheckbox = forwardRef(({ indeterminate, checked, onCha
|
|
|
11
11
|
const handleChange = (v) => {
|
|
12
12
|
onChange({ target: { checked: v } });
|
|
13
13
|
};
|
|
14
|
-
return (_jsx("div", { className: 'actions-list', children: _jsx(Checkbox, { className: classNames('actions-list__checkbox', { 'active-checkbox': checked }), value: checked, disabled: disabled, onClick: handleChange, ref: resolvedRef }) }));
|
|
14
|
+
return (_jsx("div", { className: 'actions-list', children: _jsx(Checkbox, { className: classNames('actions-list__checkbox', { 'active-checkbox': checked }), value: checked, disabled: disabled, onClick: handleChange, ref: resolvedRef, dataId: dataId }) }));
|
|
15
15
|
});
|
|
16
16
|
IndeterminateCheckbox.displayName = 'IndeterminateCheckbox';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TTableProps } from './types';
|
|
2
2
|
import 'react-loading-skeleton/dist/skeleton.css';
|
|
3
|
-
export declare function Table<TData>({ data, columns, isLoading, hasError, isActionsVisible, totalCount, emptyTitle, emptySubTitle, emptyIllustration, withSelect, withBorder, defaultPageIndex, defaultPageSize, defaultHiddenColumns, collapsibleRows, renderExpandedContent, renderHeader, renderFooter, onSortChange, onRowClick, tableSettings, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function Table<TData>({ data, dataId, columns, isLoading, hasError, isActionsVisible, totalCount, emptyTitle, emptySubTitle, emptyIllustration, withSelect, withBorder, defaultPageIndex, defaultPageSize, defaultHiddenColumns, collapsibleRows, renderExpandedContent, renderHeader, renderFooter, onSortChange, onRowClick, tableSettings, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,19 +19,19 @@ var ColumnId;
|
|
|
19
19
|
ColumnId["Actions"] = "actions";
|
|
20
20
|
ColumnId["Expand"] = "expand";
|
|
21
21
|
})(ColumnId || (ColumnId = {}));
|
|
22
|
-
const ExpandColumn = ({ row, expandedRows, onToggle }) => {
|
|
22
|
+
const ExpandColumn = ({ row, expandedRows, onToggle, dataId = '' }) => {
|
|
23
23
|
var _a, _b, _c;
|
|
24
24
|
const hasSubRows = ((_a = row.original) === null || _a === void 0 ? void 0 : _a.subRows) && ((_c = (_b = row.original) === null || _b === void 0 ? void 0 : _b.subRows) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
|
25
25
|
if (!hasSubRows)
|
|
26
26
|
return null;
|
|
27
27
|
return (_jsx(Button, { type: "tertiary", size: "medium", className: classnames('advanced-table__expand-button'), iconProps: {
|
|
28
28
|
Component: expandedRows.has(row.id) ? IconChevronUp : IconChevronDown
|
|
29
|
-
}, onClick: (e) => {
|
|
29
|
+
}, dataId: dataId ? `${dataId}-expand-${row.index}` : '', onClick: (e) => {
|
|
30
30
|
e.stopPropagation();
|
|
31
31
|
onToggle(row.id);
|
|
32
32
|
} }));
|
|
33
33
|
};
|
|
34
|
-
export function Table({ data, columns, isLoading, hasError, isActionsVisible = false, totalCount = 0, emptyTitle, emptySubTitle, emptyIllustration, withSelect = false, withBorder = true, defaultPageIndex, defaultPageSize, defaultHiddenColumns, collapsibleRows = false, renderExpandedContent, renderHeader, renderFooter, onSortChange, onRowClick, tableSettings, onRowSelection, onColumnSizing, onPaginationChange }) {
|
|
34
|
+
export function Table({ data, dataId = '', columns, isLoading, hasError, isActionsVisible = false, totalCount = 0, emptyTitle, emptySubTitle, emptyIllustration, withSelect = false, withBorder = true, defaultPageIndex, defaultPageSize, defaultHiddenColumns, collapsibleRows = false, renderExpandedContent, renderHeader, renderFooter, onSortChange, onRowClick, tableSettings, onRowSelection, onColumnSizing, onPaginationChange }) {
|
|
35
35
|
const [expandedRows, setExpandedRows] = useState(new Set());
|
|
36
36
|
const handleToggleRow = useCallback((rowId) => {
|
|
37
37
|
setExpandedRows((prev) => {
|
|
@@ -52,7 +52,7 @@ export function Table({ data, columns, isLoading, hasError, isActionsVisible = f
|
|
|
52
52
|
size: 50,
|
|
53
53
|
minSize: 50,
|
|
54
54
|
maxSize: 50,
|
|
55
|
-
cell: ({ row }) => (_jsx(ExpandColumn, { row: row, expandedRows: expandedRows, onToggle: handleToggleRow })),
|
|
55
|
+
cell: ({ row }) => (_jsx(ExpandColumn, { row: row, expandedRows: expandedRows, onToggle: handleToggleRow, dataId: dataId })),
|
|
56
56
|
meta: {
|
|
57
57
|
enableHiding: false,
|
|
58
58
|
enableColumnDragging: false,
|
|
@@ -61,9 +61,10 @@ export function Table({ data, columns, isLoading, hasError, isActionsVisible = f
|
|
|
61
61
|
headerVisible: false,
|
|
62
62
|
enableSorting: false
|
|
63
63
|
}
|
|
64
|
-
}), [expandedRows, handleToggleRow]);
|
|
64
|
+
}), [expandedRows, handleToggleRow, dataId]);
|
|
65
65
|
const { table, sensors, handleDragStart, handleDragEnd, handleDragCancel, activeHeader } = useTableControl({
|
|
66
66
|
data,
|
|
67
|
+
dataId,
|
|
67
68
|
tableSettings,
|
|
68
69
|
columns: collapsibleRows ? [expandColumn, ...columns] : columns,
|
|
69
70
|
withSelect,
|
|
@@ -100,24 +101,26 @@ export function Table({ data, columns, isLoading, hasError, isActionsVisible = f
|
|
|
100
101
|
const skeletonRowSize = useMemo(() => {
|
|
101
102
|
return Array.from({ length: table.getState().pagination.pageSize });
|
|
102
103
|
}, [table.getState().pagination.pageSize]);
|
|
103
|
-
return (_jsxs("div", { className: classnames('advanced-table', {
|
|
104
|
+
return (_jsxs("div", { "data-id": dataId, className: classnames('advanced-table', {
|
|
104
105
|
'with-border': withBorder
|
|
105
|
-
}), children: [header, _jsx("div", { className: classnames('advanced-table__inner scrollbar scrollbar--horizontal scrollbar--vertical'), children: _jsxs(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDragCancel: handleDragCancel, children: [_jsx("div", { children: _jsx("table", { style: tableStyle, children: !isLoading && (!(data === null || data === void 0 ? void 0 : data.length) || hasError) ? (_jsx(Empty, { mainMessage: emptyTitle, paragraphMessage: emptySubTitle, illustration: emptyIllustration })) : (_jsxs(_Fragment, { children: [_jsx("thead", { className: classnames('advanced-table__thead'), children: table.getHeaderGroups().map((headerGroup) => (_jsx("tr", { children: _jsx(SortableContext, { items: headerGroup.headers.map((header) => header.id), strategy: horizontalListSortingStrategy, children: headerGroup.headers.map((header) => {
|
|
106
|
+
}), children: [header, _jsx("div", { className: classnames('advanced-table__inner scrollbar scrollbar--horizontal scrollbar--vertical'), children: _jsxs(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDragCancel: handleDragCancel, children: [_jsx("div", { children: _jsx("table", { style: tableStyle, children: !isLoading && (!(data === null || data === void 0 ? void 0 : data.length) || hasError) ? (_jsx(Empty, { mainMessage: emptyTitle, paragraphMessage: emptySubTitle, illustration: emptyIllustration, dataId: dataId ? `${dataId}-empty` : '' })) : (_jsxs(_Fragment, { children: [_jsx("thead", { className: classnames('advanced-table__thead'), children: table.getHeaderGroups().map((headerGroup) => (_jsx("tr", { children: _jsx(SortableContext, { items: headerGroup.headers.map((header) => header.id), strategy: horizontalListSortingStrategy, children: headerGroup.headers.map((header) => {
|
|
106
107
|
if (header.id === ColumnId.Actions && !isActionsVisible)
|
|
107
108
|
return null;
|
|
108
|
-
return (_jsx(ColumnHeader, { pinnedStyles: Object.assign({}, getCommonPinningStyles(header.column)), header: header }, header.id));
|
|
109
|
+
return (_jsx(ColumnHeader, { pinnedStyles: Object.assign({}, getCommonPinningStyles(header.column)), header: header, dataId: dataId }, header.id));
|
|
109
110
|
}) }) }, headerGroup.id))) }), _jsx("tbody", { children: isLoading
|
|
110
|
-
? skeletonRowSize.map((_, i) => (_jsx("tr", { children: table.getVisibleFlatColumns().map((column) => (_jsx("td", { className: classnames({
|
|
111
|
+
? skeletonRowSize.map((_, i) => (_jsx("tr", { "data-id": dataId ? `${dataId}-loader-row-${i}` : '', children: table.getVisibleFlatColumns().map((column) => (_jsx("td", { className: classnames({
|
|
111
112
|
'with-checkbox': column.id === ColumnId.Select,
|
|
112
113
|
'pinned-cell': column.getIsPinned(),
|
|
113
114
|
'action-column': column.id === ColumnId.Actions && !isActionsVisible
|
|
114
115
|
}), style: Object.assign({}, getCommonPinningStyles(column)), children: _jsx(Skeleton, {}) }, column.id))) }, `skeleton-row-${i}`)))
|
|
115
|
-
: table.getRowModel().rows.map((row) => (_jsxs(React.Fragment, { children: [_jsx("tr", { className: classnames({ selected: row.getIsSelected() }), children: row.getVisibleCells().map((cell) => (_jsx("td", { className: classnames({
|
|
116
|
+
: table.getRowModel().rows.map((row) => (_jsxs(React.Fragment, { children: [_jsx("tr", { className: classnames({ selected: row.getIsSelected() }), "data-id": dataId ? `${dataId}-row-${row.index}` : '', children: row.getVisibleCells().map((cell) => (_jsx("td", { className: classnames({
|
|
116
117
|
'with-checkbox': cell.column.id === ColumnId.Select,
|
|
117
118
|
'pinned-cell': cell.column.getIsPinned(),
|
|
118
119
|
'action-column': cell.column.id === ColumnId.Actions && !isActionsVisible,
|
|
119
120
|
'expand-column': cell.column.id === ColumnId.Expand
|
|
120
|
-
}), id: cell.id,
|
|
121
|
+
}), id: cell.id, "data-id": dataId
|
|
122
|
+
? `${dataId}-row-${row.index}-cell-${cell.column.id}`
|
|
123
|
+
: '', onClick: () => handleRowClick(cell.column, row), style: Object.assign({}, getCommonPinningStyles(cell.column)), children: cell.column.id === ColumnId.Actions && !isActionsVisible ? (_jsx("div", { className: classnames('actions-list__right'), children: flexRender(cell.column.columnDef.cell, cell.getContext()) })) : (flexRender(cell.column.columnDef.cell, cell.getContext())) }, cell.id))) }), collapsibleRows &&
|
|
121
124
|
expandedRows.has(row.id) &&
|
|
122
|
-
renderExpandedContent && (_jsx("tr", { className: classnames('advanced-table__expanded-row'), children: _jsx("td", { colSpan: row.getVisibleCells().length, children: renderExpandedContent(row) }) }))] }, row.id))) })] })) }) }), _jsx(DragOverlay, { dropAnimation: null, children: activeHeader && (_jsx("table", { style: { width: activeHeader.getSize() }, children: _jsx("thead", { children: _jsx("tr", { children: _jsx("th", { className: classnames('draggable-col'), style: { width: activeHeader.getSize() }, children: _jsx(Text, { weight: 'bold', children: flexRender(activeHeader.column.columnDef.header, activeHeader.getContext()) }) }) }) }) })) })] }) }), !!data.length && !hasError && footer] }));
|
|
125
|
+
renderExpandedContent && (_jsx("tr", { className: classnames('advanced-table__expanded-row'), "data-id": dataId ? `${dataId}-row-${row.index}-expanded` : '', children: _jsx("td", { colSpan: row.getVisibleCells().length, children: renderExpandedContent(row) }) }))] }, row.id))) })] })) }) }), _jsx(DragOverlay, { dropAnimation: null, children: activeHeader && (_jsx("table", { style: { width: activeHeader.getSize() }, children: _jsx("thead", { children: _jsx("tr", { children: _jsx("th", { className: classnames('draggable-col'), style: { width: activeHeader.getSize() }, children: _jsx(Text, { weight: 'bold', children: flexRender(activeHeader.column.columnDef.header, activeHeader.getContext()) }) }) }) }) })) })] }) }), !!data.length && !hasError && footer] }));
|
|
123
126
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DragEndEvent, DragStartEvent } from '@dnd-kit/core';
|
|
2
2
|
import type { Column, TTableProps } from '../types';
|
|
3
|
-
export declare function useTableControl<TData>({ withSelect, columns, data, tableSettings, totalCount, defaultPageSize, defaultPageIndex, defaultHiddenColumns, onSortChange, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): {
|
|
3
|
+
export declare function useTableControl<TData>({ withSelect, columns, data, dataId, tableSettings, totalCount, defaultPageSize, defaultPageIndex, defaultHiddenColumns, onSortChange, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): {
|
|
4
4
|
table: import("@tanstack/react-table").Table<TData>;
|
|
5
5
|
activeHeader: import("@tanstack/react-table").Header<TData, unknown> | null | undefined;
|
|
6
6
|
sensors: import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").SensorOptions>[];
|
|
@@ -7,7 +7,7 @@ import { arrayMove } from '@dnd-kit/sortable';
|
|
|
7
7
|
import { loadTableSettings } from '../loadTableSettings';
|
|
8
8
|
import { useTableColumnSettings } from './useTableColumnSettings';
|
|
9
9
|
import { STORAGE_TYPE, TABLE_NAME_PREFIX } from '../constants';
|
|
10
|
-
export function useTableControl({ withSelect, columns, data, tableSettings, totalCount = 0, defaultPageSize = 10, defaultPageIndex = 0, defaultHiddenColumns = [], onSortChange, onRowSelection, onColumnSizing, onPaginationChange }) {
|
|
10
|
+
export function useTableControl({ withSelect, columns, data, dataId = '', tableSettings, totalCount = 0, defaultPageSize = 10, defaultPageIndex = 0, defaultHiddenColumns = [], onSortChange, onRowSelection, onColumnSizing, onPaginationChange }) {
|
|
11
11
|
var _a, _b;
|
|
12
12
|
const shouldPersistToStorage = (tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.persistColumnSettings) === STORAGE_TYPE.LOCAL;
|
|
13
13
|
const shouldEmitExternal = (tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.persistColumnSettings) === STORAGE_TYPE.EXTERNAL;
|
|
@@ -40,12 +40,12 @@ export function useTableControl({ withSelect, columns, data, tableSettings, tota
|
|
|
40
40
|
enableHiding: false,
|
|
41
41
|
enableColumnDragging: false,
|
|
42
42
|
enablePinning: true,
|
|
43
|
-
header: ({ table }) => (_jsx(IndeterminateCheckbox, { checked: table.getIsAllRowsSelected(), indeterminate: table.getIsSomeRowsSelected(), onChange: table.getToggleAllRowsSelectedHandler() })),
|
|
44
|
-
cell: ({ row }) => (_jsx(IndeterminateCheckbox, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), indeterminate: row.getIsSomeSelected(), onChange: row.getToggleSelectedHandler() }))
|
|
43
|
+
header: ({ table }) => (_jsx(IndeterminateCheckbox, { checked: table.getIsAllRowsSelected(), indeterminate: table.getIsSomeRowsSelected(), onChange: table.getToggleAllRowsSelectedHandler(), dataId: dataId ? `${dataId}-select-all` : '' })),
|
|
44
|
+
cell: ({ row }) => (_jsx(IndeterminateCheckbox, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), indeterminate: row.getIsSomeSelected(), onChange: row.getToggleSelectedHandler(), dataId: dataId ? `${dataId}-row-${row.index}-select` : '' }))
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
return columnsList;
|
|
48
|
-
}, [columns]);
|
|
48
|
+
}, [columns, dataId]);
|
|
49
49
|
const [columnOrder, setColumnOrder] = useState(((_b = savedSettings.columnOrder) === null || _b === void 0 ? void 0 : _b.length) && savedSettings.columnOrder.length === memoizedColumns.length
|
|
50
50
|
? savedSettings.columnOrder
|
|
51
51
|
: memoizedColumns.map((column) => column.id));
|
|
@@ -5,7 +5,7 @@ export type TRowSelectionState = RowSelectionState;
|
|
|
5
5
|
export type TColumnSizingState = ColumnSizingState;
|
|
6
6
|
export type TPaginationState = PaginationState;
|
|
7
7
|
export type TPersistColumnSettings = 'localStorage' | 'external';
|
|
8
|
-
export type TTableProps<TData> = {
|
|
8
|
+
export type TTableProps<TData> = IBaseProps & {
|
|
9
9
|
data: (TData & {
|
|
10
10
|
subRows?: TData[];
|
|
11
11
|
})[];
|
|
@@ -58,7 +58,7 @@ export interface TableData {
|
|
|
58
58
|
subRows: TableData[];
|
|
59
59
|
[key: string]: unknown;
|
|
60
60
|
}
|
|
61
|
-
export interface ExpandColumnProps<TData> {
|
|
61
|
+
export interface ExpandColumnProps<TData> extends IBaseProps {
|
|
62
62
|
row: Row<TData>;
|
|
63
63
|
expandedRows: Set<string>;
|
|
64
64
|
onToggle: (rowId: string) => void;
|
|
@@ -3,7 +3,7 @@ type TTextTypes = 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'inverse'
|
|
|
3
3
|
export type TTextSize = 'xxsmall' | 'xsmall' | 'small' | 'standard' | 'medium' | 'large' | 'xlarge';
|
|
4
4
|
type TTextWeight = 'regular' | 'semibold' | 'bold' | 'bolder';
|
|
5
5
|
type TTextLineHeight = 'xsmall' | 'small' | 'medium' | 'large';
|
|
6
|
-
export interface TextPropTypes {
|
|
6
|
+
export interface TextPropTypes extends IBaseProps {
|
|
7
7
|
id?: string;
|
|
8
8
|
as?: ElementType;
|
|
9
9
|
title?: string;
|
|
@@ -13,7 +13,6 @@ export interface TextPropTypes {
|
|
|
13
13
|
weight?: TTextWeight;
|
|
14
14
|
lineHeight?: TTextLineHeight;
|
|
15
15
|
className?: string;
|
|
16
|
-
dataId?: string;
|
|
17
16
|
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
18
17
|
}
|
|
19
18
|
export {};
|
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import noResultImage from '../../assets/images/under-construction.webp';
|
|
6
6
|
import { SELECT_TRANSLATIONS } from './localization';
|
|
7
7
|
export const UnderConstruction = (props) => {
|
|
8
|
-
const { size = 'large', mainMessage, paragraphMessage, className, illustration = noResultImage, language = 'en' } = props;
|
|
8
|
+
const { size = 'large', mainMessage, paragraphMessage, className, illustration = noResultImage, language = 'en', dataId = '' } = props;
|
|
9
9
|
const localizations = SELECT_TRANSLATIONS[language];
|
|
10
|
-
return (_jsxs("div", { className: classNames(`under-construction ${size === 'large' ? 'under-construction--large' : 'under-construction--small'}`, className), children: [_jsx("div", { className: "under-construction__icon", children: _jsx(Image, { imagePath: illustration }) }), _jsxs("div", { className: "under-construction__content", children: [_jsx(Text, { size: size == 'large' ? 'large' : 'medium', weight: "bold", children: mainMessage !== null && mainMessage !== void 0 ? mainMessage : localizations.mainMessage }), _jsx(Text, { size: size == 'large' ? 'standard' : 'small', children: paragraphMessage !== null && paragraphMessage !== void 0 ? paragraphMessage : localizations.paragraphMessage })] })] }));
|
|
10
|
+
return (_jsxs("div", { className: classNames(`under-construction ${size === 'large' ? 'under-construction--large' : 'under-construction--small'}`, className), "data-id": dataId, children: [_jsx("div", { className: "under-construction__icon", children: _jsx(Image, { imagePath: illustration, dataId: dataId ? `${dataId}-image` : '' }) }), _jsxs("div", { className: "under-construction__content", children: [_jsx(Text, { size: size == 'large' ? 'large' : 'medium', weight: "bold", dataId: dataId ? `${dataId}-text` : '', children: mainMessage !== null && mainMessage !== void 0 ? mainMessage : localizations.mainMessage }), _jsx(Text, { size: size == 'large' ? 'standard' : 'small', dataId: dataId ? `${dataId}-subtext` : '', children: paragraphMessage !== null && paragraphMessage !== void 0 ? paragraphMessage : localizations.paragraphMessage })] })] }));
|
|
11
11
|
};
|