@synerise/ds-table-new 0.1.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/CHANGELOG.md +10 -0
- package/LICENSE.md +21 -0
- package/README.md +153 -0
- package/dist/Table.const.d.ts +20 -0
- package/dist/Table.const.js +42 -0
- package/dist/Table.d.ts +3 -0
- package/dist/Table.js +51 -0
- package/dist/Table.styles.d.ts +15 -0
- package/dist/Table.styles.js +29 -0
- package/dist/Table.types.d.ts +359 -0
- package/dist/Table.types.js +1 -0
- package/dist/VirtualTable.d.ts +3 -0
- package/dist/VirtualTable.js +222 -0
- package/dist/components/BaseTable/BaseTable.d.ts +3 -0
- package/dist/components/BaseTable/BaseTable.js +114 -0
- package/dist/components/BaseTable/BaseTable.styles.d.ts +28 -0
- package/dist/components/BaseTable/BaseTable.styles.js +41 -0
- package/dist/components/Cell/Action/ActionCell.d.ts +3 -0
- package/dist/components/Cell/Action/ActionCell.js +16 -0
- package/dist/components/Cell/Action/ActionCell.styles.d.ts +5 -0
- package/dist/components/Cell/Action/ActionCell.styles.js +13 -0
- package/dist/components/Cell/Action/ActionCell.types.d.ts +13 -0
- package/dist/components/Cell/Action/ActionCell.types.js +1 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.d.ts +4 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.js +42 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.styles.d.ts +27 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.styles.js +49 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.types.d.ts +22 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.types.js +1 -0
- package/dist/components/Cell/Copyable/Copyable.styles.d.ts +2 -0
- package/dist/components/Cell/Copyable/Copyable.styles.js +14 -0
- package/dist/components/Cell/Copyable/Copyable.types.d.ts +11 -0
- package/dist/components/Cell/Copyable/Copyable.types.js +1 -0
- package/dist/components/Cell/Copyable/CopyableCell.d.ts +4 -0
- package/dist/components/Cell/Copyable/CopyableCell.js +28 -0
- package/dist/components/Cell/Editable/EditableCell.d.ts +4 -0
- package/dist/components/Cell/Editable/EditableCell.js +30 -0
- package/dist/components/Cell/Editable/EditableCell.styles.d.ts +4 -0
- package/dist/components/Cell/Editable/EditableCell.styles.js +14 -0
- package/dist/components/Cell/Editable/EditableCell.types.d.ts +11 -0
- package/dist/components/Cell/Editable/EditableCell.types.js +1 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.d.ts +4 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.js +16 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.styles.d.ts +1 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.styles.js +8 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.types.d.ts +11 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.types.js +1 -0
- package/dist/components/Cell/IconLabel/IconLabel.d.ts +4 -0
- package/dist/components/Cell/IconLabel/IconLabel.js +15 -0
- package/dist/components/Cell/IconLabel/IconLabel.styles.d.ts +3 -0
- package/dist/components/Cell/IconLabel/IconLabel.styles.js +9 -0
- package/dist/components/Cell/IconLabel/IconLabel.types.d.ts +13 -0
- package/dist/components/Cell/IconLabel/IconLabel.types.js +1 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.d.ts +4 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.js +19 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.styles.d.ts +4 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.styles.js +13 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.types.d.ts +16 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.types.js +1 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.d.ts +4 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.js +11 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.styles.d.ts +3 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.styles.js +11 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.types.d.ts +7 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.types.js +1 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.d.ts +5 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.js +33 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.styles.d.ts +3 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.styles.js +18 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.types.d.ts +22 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.types.js +1 -0
- package/dist/components/Cell/LabelsWithShowMore/Modal/Modal.d.ts +4 -0
- package/dist/components/Cell/LabelsWithShowMore/Modal/Modal.js +37 -0
- package/dist/components/Cell/LabelsWithShowMore/Modal/Modal.types.d.ts +15 -0
- package/dist/components/Cell/LabelsWithShowMore/Modal/Modal.types.js +1 -0
- package/dist/components/Cell/Star/StarCell.d.ts +4 -0
- package/dist/components/Cell/Star/StarCell.js +25 -0
- package/dist/components/Cell/Star/StarCell.styles.d.ts +5 -0
- package/dist/components/Cell/Star/StarCell.styles.js +16 -0
- package/dist/components/Cell/Star/StarCell.types.d.ts +17 -0
- package/dist/components/Cell/Star/StarCell.types.js +1 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.d.ts +4 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.js +18 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.styles.d.ts +4 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.styles.js +13 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.types.d.ts +14 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.types.js +1 -0
- package/dist/components/Cell/TagIcon/TagIcon.d.ts +4 -0
- package/dist/components/Cell/TagIcon/TagIcon.js +10 -0
- package/dist/components/Cell/TagIcon/TagIcon.styles.d.ts +3 -0
- package/dist/components/Cell/TagIcon/TagIcon.styles.js +9 -0
- package/dist/components/Cell/TagIcon/TagIcon.types.d.ts +11 -0
- package/dist/components/Cell/TagIcon/TagIcon.types.js +1 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.d.ts +3 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.js +26 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.styles.d.ts +5 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.styles.js +34 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.types.d.ts +9 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.types.js +1 -0
- package/dist/components/Cell/index.d.ts +26 -0
- package/dist/components/Cell/index.js +28 -0
- package/dist/components/TableBody/TableBody.d.ts +3 -0
- package/dist/components/TableBody/TableBody.js +40 -0
- package/dist/components/TableBody/TableBody.styles.d.ts +2 -0
- package/dist/components/TableBody/TableBody.styles.js +15 -0
- package/dist/components/TableBody/TableBodySkeleton/TableBodySkeleton.d.ts +5 -0
- package/dist/components/TableBody/TableBodySkeleton/TableBodySkeleton.js +42 -0
- package/dist/components/TableBody/TableBodySkeleton/TableBodySkeleton.styles.d.ts +9 -0
- package/dist/components/TableBody/TableBodySkeleton/TableBodySkeleton.styles.js +30 -0
- package/dist/components/TableBody/TableCell/TableCell.d.ts +16 -0
- package/dist/components/TableBody/TableCell/TableCell.js +19 -0
- package/dist/components/TableBody/TableCell/TableCell.styles.d.ts +10 -0
- package/dist/components/TableBody/TableCell/TableCell.styles.js +18 -0
- package/dist/components/TableBody/TableEmptyBody/TableEmptyBody.d.ts +3 -0
- package/dist/components/TableBody/TableEmptyBody/TableEmptyBody.js +18 -0
- package/dist/components/TableBody/TableEmptyBody/TableEmptyBody.styles.d.ts +4 -0
- package/dist/components/TableBody/TableEmptyBody/TableEmptyBody.styles.js +23 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/ErrorItem.d.ts +8 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/ErrorItem.js +19 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/ErrorItem.styles.d.ts +1 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/ErrorItem.styles.js +8 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/InfiniteLoaderRow.d.ts +14 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/InfiniteLoaderRow.js +50 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/LoadingItem.d.ts +5 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/LoadingItem.js +10 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/LoadingItem.styles.d.ts +1 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/LoadingItem.styles.js +9 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/NoMoreItem.d.ts +5 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/NoMoreItem.js +10 -0
- package/dist/components/TableBody/TableRow/TableRow.d.ts +5 -0
- package/dist/components/TableBody/TableRow/TableRow.js +29 -0
- package/dist/components/TableBody/TableRow/TableRow.styles.d.ts +7 -0
- package/dist/components/TableBody/TableRow/TableRow.styles.js +15 -0
- package/dist/components/TableBody/TableRow/TableRowVirtual.d.ts +5 -0
- package/dist/components/TableBody/TableRow/TableRowVirtual.js +88 -0
- package/dist/components/TableBody/TableRowSelection/TableRowSelection.d.ts +3 -0
- package/dist/components/TableBody/TableRowSelection/TableRowSelection.js +39 -0
- package/dist/components/TableColumns/TableColumnSorter/SortIcons/DefaultSortIcon.d.ts +5 -0
- package/dist/components/TableColumns/TableColumnSorter/SortIcons/DefaultSortIcon.js +19 -0
- package/dist/components/TableColumns/TableColumnSorter/SortIcons/StringSortIcon.d.ts +5 -0
- package/dist/components/TableColumns/TableColumnSorter/SortIcons/StringSortIcon.js +19 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.const.d.ts +4 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.const.js +8 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.d.ts +3 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.js +75 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.styles.d.ts +30 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.styles.js +11 -0
- package/dist/components/TableColumns/TableColumns.d.ts +3 -0
- package/dist/components/TableColumns/TableColumns.js +28 -0
- package/dist/components/TableColumns/TableColumns.styles.d.ts +18 -0
- package/dist/components/TableColumns/TableColumns.styles.js +35 -0
- package/dist/components/TableHeader/TableCounter/TableCounter.d.ts +3 -0
- package/dist/components/TableHeader/TableCounter/TableCounter.js +33 -0
- package/dist/components/TableHeader/TableCounter/TableCounter.styles.d.ts +1 -0
- package/dist/components/TableHeader/TableCounter/TableCounter.styles.js +8 -0
- package/dist/components/TableHeader/TableHeader.d.ts +3 -0
- package/dist/components/TableHeader/TableHeader.js +103 -0
- package/dist/components/TableHeader/TableHeader.styles.d.ts +18 -0
- package/dist/components/TableHeader/TableHeader.styles.js +48 -0
- package/dist/components/TableHeader/TableHeaderSelection/TableHeaderSelection.d.ts +3 -0
- package/dist/components/TableHeader/TableHeaderSelection/TableHeaderSelection.js +123 -0
- package/dist/components/TableHeader/TableHeaderSelection/TableHeaderSelection.styles.d.ts +8 -0
- package/dist/components/TableHeader/TableHeaderSelection/TableHeaderSelection.styles.js +21 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.d.ts +3 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.js +50 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.styles.d.ts +4 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.styles.js +24 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.types.d.ts +10 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.types.js +1 -0
- package/dist/components/TableHorizontalScroll/TableHorizontalScroll.d.ts +6 -0
- package/dist/components/TableHorizontalScroll/TableHorizontalScroll.js +41 -0
- package/dist/components/TableHorizontalScroll/TableHorizontalScroll.styles.d.ts +12 -0
- package/dist/components/TableHorizontalScroll/TableHorizontalScroll.styles.js +33 -0
- package/dist/components/TableHorizontalScrollBar/TableHorizontalScrollBar.d.ts +6 -0
- package/dist/components/TableHorizontalScrollBar/TableHorizontalScrollBar.js +11 -0
- package/dist/components/TableHorizontalScrollBar/TableHorizontalScrollBar.styles.d.ts +4 -0
- package/dist/components/TableHorizontalScrollBar/TableHorizontalScrollBar.styles.js +14 -0
- package/dist/components/TablePagination/TablePagination.d.ts +3 -0
- package/dist/components/TablePagination/TablePagination.js +19 -0
- package/dist/components/TablePagination/TablePagination.styles.d.ts +1 -0
- package/dist/components/TablePagination/TablePagination.styles.js +8 -0
- package/dist/contexts/SelectionContext.d.ts +4 -0
- package/dist/contexts/SelectionContext.js +10 -0
- package/dist/contexts/StickyContext.d.ts +8 -0
- package/dist/contexts/StickyContext.js +9 -0
- package/dist/contexts/TableContext.d.ts +11 -0
- package/dist/contexts/TableContext.js +13 -0
- package/dist/hooks/useColumnSizing.d.ts +23 -0
- package/dist/hooks/useColumnSizing.js +95 -0
- package/dist/hooks/useDefaultTexts.d.ts +2 -0
- package/dist/hooks/useDefaultTexts.js +95 -0
- package/dist/hooks/useInfiniteScroll.d.ts +13 -0
- package/dist/hooks/useInfiniteScroll.js +58 -0
- package/dist/hooks/useRowKey.d.ts +4 -0
- package/dist/hooks/useRowKey.js +27 -0
- package/dist/hooks/useScrollSync.d.ts +2 -0
- package/dist/hooks/useScrollSync.js +23 -0
- package/dist/hooks/useTable.d.ts +14 -0
- package/dist/hooks/useTable.js +168 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +50 -0
- package/dist/types/table.d.js +1 -0
- package/dist/types/table.d.ts +28 -0
- package/dist/utils/arrayToTrueMap.d.ts +1 -0
- package/dist/utils/arrayToTrueMap.js +7 -0
- package/dist/utils/calculatePixels.d.ts +1 -0
- package/dist/utils/calculatePixels.js +21 -0
- package/dist/utils/compareKeys.d.ts +1 -0
- package/dist/utils/compareKeys.js +16 -0
- package/dist/utils/getChildrenColumnName.d.ts +1 -0
- package/dist/utils/getChildrenColumnName.js +7 -0
- package/dist/utils/getDefaultSkeletonColumns.d.ts +2 -0
- package/dist/utils/getDefaultSkeletonColumns.js +58 -0
- package/dist/utils/getInfiniteScrollPadding.d.ts +2 -0
- package/dist/utils/getInfiniteScrollPadding.js +13 -0
- package/dist/utils/getIsRevealed.d.ts +5 -0
- package/dist/utils/getIsRevealed.js +9 -0
- package/dist/utils/getPaginationConfig.d.ts +10 -0
- package/dist/utils/getPaginationConfig.js +19 -0
- package/dist/utils/getRecordSelectionStatus.d.ts +5 -0
- package/dist/utils/getRecordSelectionStatus.js +13 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/isRecordSelectable.d.ts +2 -0
- package/dist/utils/isRecordSelectable.js +14 -0
- package/dist/utils/legacyColumnConfigAdapter.d.ts +3 -0
- package/dist/utils/legacyColumnConfigAdapter.js +113 -0
- package/dist/utils/processColumns.d.ts +3 -0
- package/dist/utils/processColumns.js +24 -0
- package/dist/utils/sort.d.ts +3 -0
- package/dist/utils/sort.js +14 -0
- package/package.json +76 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect, useCallback } from "react";
|
|
3
|
+
import { DEFAULT_CELL_HEIGHT } from "../../Table.const.js";
|
|
4
|
+
import { useStickyContext } from "../../contexts/StickyContext.js";
|
|
5
|
+
import { useTableContext } from "../../contexts/TableContext.js";
|
|
6
|
+
import { useScrollSync } from "../../hooks/useScrollSync.js";
|
|
7
|
+
import { TableBody } from "../TableBody/TableBody.js";
|
|
8
|
+
import { TableBodySkeleton } from "../TableBody/TableBodySkeleton/TableBodySkeleton.js";
|
|
9
|
+
import { TableColumns } from "../TableColumns/TableColumns.js";
|
|
10
|
+
import { TableHeader } from "../TableHeader/TableHeader.js";
|
|
11
|
+
import { TableHorizontalScroll } from "../TableHorizontalScroll/TableHorizontalScroll.js";
|
|
12
|
+
import { TableHorizontalScrollBar } from "../TableHorizontalScrollBar/TableHorizontalScrollBar.js";
|
|
13
|
+
import { TablePagination } from "../TablePagination/TablePagination.js";
|
|
14
|
+
import { StyledTable, BaseTableWrapper, TableContainer, TableColumnsHorizontalScroll, TableBodyScrollWrapper } from "./BaseTable.styles.js";
|
|
15
|
+
const BaseTable = ({
|
|
16
|
+
infiniteScroll,
|
|
17
|
+
cellHeight = DEFAULT_CELL_HEIGHT,
|
|
18
|
+
className,
|
|
19
|
+
itemsMenu,
|
|
20
|
+
texts,
|
|
21
|
+
isCounterLoading,
|
|
22
|
+
isLoading,
|
|
23
|
+
rowKey,
|
|
24
|
+
title,
|
|
25
|
+
hideTitleBar,
|
|
26
|
+
hideTitlePart,
|
|
27
|
+
renderCustomCounter,
|
|
28
|
+
renderSelectionTitle,
|
|
29
|
+
searchComponent,
|
|
30
|
+
filterComponent,
|
|
31
|
+
headerWithBorderTop,
|
|
32
|
+
emptyDataComponent,
|
|
33
|
+
headerButton,
|
|
34
|
+
hideColumnNames,
|
|
35
|
+
expandable,
|
|
36
|
+
columnSizing,
|
|
37
|
+
isColumnSizingReady,
|
|
38
|
+
paginationProps,
|
|
39
|
+
hasPagination,
|
|
40
|
+
disableColumnNamesLineBreak,
|
|
41
|
+
dataSourceTotalCount,
|
|
42
|
+
cardStyles,
|
|
43
|
+
tableOuterRef,
|
|
44
|
+
withScroll,
|
|
45
|
+
withBodyScroll,
|
|
46
|
+
maxHeight,
|
|
47
|
+
tableBodyScrollRef,
|
|
48
|
+
onRowClick,
|
|
49
|
+
getRowTooltipProps
|
|
50
|
+
}) => {
|
|
51
|
+
const horizontalScrollRefs = useRef([]);
|
|
52
|
+
const tableBodyWrapperRef = useRef(null);
|
|
53
|
+
const tableColumnsWrapperRef = useRef(null);
|
|
54
|
+
useScrollSync(horizontalScrollRefs);
|
|
55
|
+
const {
|
|
56
|
+
table,
|
|
57
|
+
rowVirtualizer
|
|
58
|
+
} = useTableContext();
|
|
59
|
+
const stickyContext = useStickyContext();
|
|
60
|
+
const stickyContextRef = useRef(stickyContext);
|
|
61
|
+
const useUnifiedScroll = !stickyContext && !withBodyScroll;
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
stickyContextRef.current = stickyContext;
|
|
64
|
+
}, [stickyContext]);
|
|
65
|
+
const addNode = useCallback((node) => {
|
|
66
|
+
if (node && !horizontalScrollRefs.current.includes(node)) {
|
|
67
|
+
horizontalScrollRefs.current.push(node);
|
|
68
|
+
}
|
|
69
|
+
}, []);
|
|
70
|
+
const size = Object.values(columnSizing).reduce((sum, n) => sum + n, 0);
|
|
71
|
+
const isEmpty = !table.getRowModel().flatRows.length;
|
|
72
|
+
const handleRef = useCallback((element) => {
|
|
73
|
+
tableColumnsWrapperRef.current = element;
|
|
74
|
+
if (!element) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const ctx = stickyContextRef.current;
|
|
78
|
+
if (element.clientHeight && ctx && ctx.stickyData.columnHeadersHeight !== element.clientHeight) {
|
|
79
|
+
const {
|
|
80
|
+
setStickyData
|
|
81
|
+
} = ctx;
|
|
82
|
+
setStickyData((prevValue) => ({
|
|
83
|
+
...prevValue,
|
|
84
|
+
columnHeadersHeight: element.clientHeight
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
addNode(element);
|
|
88
|
+
}, [addNode]);
|
|
89
|
+
const tableBodyContent = /* @__PURE__ */ jsx(TableHorizontalScroll, { stickyRight: table.getRightTotalSize(), stickyLeft: table.getLeftTotalSize(), ref: (element) => {
|
|
90
|
+
tableBodyWrapperRef.current = element;
|
|
91
|
+
addNode(element);
|
|
92
|
+
}, children: /* @__PURE__ */ jsx(StyledTable, { role: "table", children: isLoading ? /* @__PURE__ */ jsx(TableBodySkeleton, { wrapperRef: tableBodyWrapperRef, cellHeight }, "table-body-skeleton") : /* @__PURE__ */ jsx(TableBody, { cellHeight, infiniteScroll, emptyDataComponent, texts, onRowClick, getRowTooltipProps }, "table-body") }) });
|
|
93
|
+
const unifiedTableContent = /* @__PURE__ */ jsx(TableHorizontalScroll, { stickyRight: table.getRightTotalSize(), stickyLeft: table.getLeftTotalSize(), ref: (element) => {
|
|
94
|
+
tableBodyWrapperRef.current = element;
|
|
95
|
+
addNode(element);
|
|
96
|
+
}, children: /* @__PURE__ */ jsxs(StyledTable, { role: "table", children: [
|
|
97
|
+
!hideColumnNames && (!isEmpty || isLoading) && /* @__PURE__ */ jsx(TableColumns, { texts, disableColumnNamesLineBreak }),
|
|
98
|
+
isLoading ? /* @__PURE__ */ jsx(TableBodySkeleton, { wrapperRef: tableBodyWrapperRef, cellHeight }, "table-body-skeleton") : /* @__PURE__ */ jsx(TableBody, { cellHeight, infiniteScroll, emptyDataComponent, texts, onRowClick, getRowTooltipProps }, "table-body")
|
|
99
|
+
] }) });
|
|
100
|
+
return /* @__PURE__ */ jsxs(BaseTableWrapper, { isEmpty, columnSizing, $isColumnSizingReady: isColumnSizingReady, $size: size, children: [
|
|
101
|
+
/* @__PURE__ */ jsxs(TableContainer, { ref: tableOuterRef, className, withBorderTop: headerWithBorderTop, cardStyles, withScroll, $maxHeight: maxHeight, "data-testid": "ds-table-container", children: [
|
|
102
|
+
!hideTitleBar && /* @__PURE__ */ jsx(TableHeader, { itemsMenu, texts, childrenColumnName: expandable?.childrenColumnName, isCounterLoading, isLoading, rowKey, title, hideTitlePart, renderCustomCounter, renderSelectionTitle, searchComponent, filterComponent, headerButton, dataSourceTotalCount }),
|
|
103
|
+
useUnifiedScroll ? unifiedTableContent : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
104
|
+
!hideColumnNames && (!isEmpty || isLoading) && /* @__PURE__ */ jsx(TableColumnsHorizontalScroll, { stickyRight: table.getRightTotalSize(), stickyLeft: table.getLeftTotalSize(), stickyData: stickyContext?.stickyData, isScrolled: rowVirtualizer?.scrollOffset, ref: handleRef, children: /* @__PURE__ */ jsx(StyledTable, { role: "table", children: /* @__PURE__ */ jsx(TableColumns, { texts, disableColumnNamesLineBreak }) }) }),
|
|
105
|
+
withBodyScroll ? /* @__PURE__ */ jsx(TableBodyScrollWrapper, { ref: tableBodyScrollRef, $maxHeight: maxHeight, children: tableBodyContent }) : tableBodyContent
|
|
106
|
+
] }),
|
|
107
|
+
hasPagination && /* @__PURE__ */ jsx(TablePagination, { ...paginationProps })
|
|
108
|
+
] }),
|
|
109
|
+
!isEmpty && /* @__PURE__ */ jsx(TableHorizontalScrollBar, { contentRef: (element) => addNode(element) })
|
|
110
|
+
] });
|
|
111
|
+
};
|
|
112
|
+
export {
|
|
113
|
+
BaseTable
|
|
114
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { StickyData } from '../../Table.types';
|
|
2
|
+
export declare const BaseTableWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
3
|
+
columnSizing: Record<string, number>;
|
|
4
|
+
$isColumnSizingReady?: boolean;
|
|
5
|
+
$size?: number;
|
|
6
|
+
isEmpty?: boolean;
|
|
7
|
+
}, never>;
|
|
8
|
+
export declare const TableContainer: import('styled-components').StyledComponent<"div", any, {
|
|
9
|
+
withBorderTop?: boolean;
|
|
10
|
+
cardStyles?: boolean;
|
|
11
|
+
withScroll?: boolean;
|
|
12
|
+
$maxHeight?: number;
|
|
13
|
+
}, never>;
|
|
14
|
+
export declare const TableBodyScrollWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
15
|
+
$maxHeight?: number;
|
|
16
|
+
}, never>;
|
|
17
|
+
export declare const TableSkeleton: import('styled-components').StyledComponent<({ size, numberOfSkeletons, width, height, className, }: import('@synerise/ds-skeleton').SkeletonProps) => React.JSX.Element, any, {
|
|
18
|
+
skeletonWidth?: string;
|
|
19
|
+
}, never>;
|
|
20
|
+
export declare const StyledTable: import('styled-components').StyledComponent<"table", any, {}, never>;
|
|
21
|
+
export declare const TableColumnsHorizontalScroll: import('styled-components').StyledComponent<import('react').ForwardRefExoticComponent<{
|
|
22
|
+
children?: import('react').ReactNode;
|
|
23
|
+
stickyLeft?: number;
|
|
24
|
+
stickyRight?: number;
|
|
25
|
+
} & Omit<import('react').HTMLAttributes<HTMLDivElement>, "children" | "stickyLeft" | "stickyRight"> & import('@synerise/ds-utils').DataAttributes & import('react').RefAttributes<HTMLDivElement>>, any, {
|
|
26
|
+
stickyData?: StickyData;
|
|
27
|
+
isScrolled?: number | null;
|
|
28
|
+
}, never>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import DSSkeleton from "@synerise/ds-skeleton";
|
|
3
|
+
import { TableHorizontalScroll } from "../TableHorizontalScroll/TableHorizontalScroll.js";
|
|
4
|
+
const BaseTableWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
5
|
+
displayName: "BaseTablestyles__BaseTableWrapper",
|
|
6
|
+
componentId: "sc-1oa5lc2-0"
|
|
7
|
+
})(["", " --table-size:", ";", " position:relative;z-index:1;"], (props) => css(["", ""], Object.entries(props.columnSizing || {}).map(([key, value]) => `--${key}-width: ${value}px;`).join("\n")), (props) => !props.isEmpty && props.$size ? `${props.$size}px` : "100%", (props) => !props.$isColumnSizingReady && `opacity: 0;`);
|
|
8
|
+
const TableContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
9
|
+
displayName: "BaseTablestyles__TableContainer",
|
|
10
|
+
componentId: "sc-1oa5lc2-1"
|
|
11
|
+
})(["", " ", " ", " background:", ";"], (props) => props.withScroll && css(["overflow-y:scroll;max-height:", ";"], props.$maxHeight ? `${props.$maxHeight}px` : "800px"), (props) => props.withBorderTop && css(["border-top:solid 1px ", ";"], props.theme.palette["grey-200"]), (props) => props.cardStyles && css(["border-radius:3px;box-shadow:", ";"], props.theme.variables["box-shadow-2"]), (props) => props.theme.palette["white"]);
|
|
12
|
+
const TableBodyScrollWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
13
|
+
displayName: "BaseTablestyles__TableBodyScrollWrapper",
|
|
14
|
+
componentId: "sc-1oa5lc2-2"
|
|
15
|
+
})(["overflow-y:scroll;max-height:", ";"], (props) => props.$maxHeight ? `${props.$maxHeight}px` : "800px");
|
|
16
|
+
const TableSkeleton = /* @__PURE__ */ styled(DSSkeleton).withConfig({
|
|
17
|
+
displayName: "BaseTablestyles__TableSkeleton",
|
|
18
|
+
componentId: "sc-1oa5lc2-3"
|
|
19
|
+
})(["padding:0;", ""], (props) => props.skeletonWidth && `width: ${props.skeletonWidth};`);
|
|
20
|
+
const StyledTable = /* @__PURE__ */ styled.table.withConfig({
|
|
21
|
+
displayName: "BaseTablestyles__StyledTable",
|
|
22
|
+
componentId: "sc-1oa5lc2-4"
|
|
23
|
+
})(["width:var(--table-size);border-spacing:0;border-collapse:separate;"]);
|
|
24
|
+
const TableColumnsHorizontalScroll = /* @__PURE__ */ styled(TableHorizontalScroll).withConfig({
|
|
25
|
+
displayName: "BaseTablestyles__TableColumnsHorizontalScroll",
|
|
26
|
+
componentId: "sc-1oa5lc2-5"
|
|
27
|
+
})(["", ""], ({
|
|
28
|
+
stickyData,
|
|
29
|
+
isScrolled,
|
|
30
|
+
theme
|
|
31
|
+
}) => {
|
|
32
|
+
return stickyData && css(["position:sticky;transition:top 0.3s ease-in-out;top:", ";z-index:11;background:", ";", ""], stickyData.isRevealed ? `${stickyData.titleBarHeight - stickyData.containerPaddingTop}px` : `-${stickyData.containerPaddingTop}px`, theme.palette["white"], (isScrolled && isScrolled > stickyData.titleBarHeight + stickyData.containerPaddingTop || stickyData.isRevealed) && `box-shadow: ${theme.variables["box-shadow-1"]};`);
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
BaseTableWrapper,
|
|
36
|
+
StyledTable,
|
|
37
|
+
TableBodyScrollWrapper,
|
|
38
|
+
TableColumnsHorizontalScroll,
|
|
39
|
+
TableContainer,
|
|
40
|
+
TableSkeleton
|
|
41
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ActionCell as ActionCell$1 } from "./ActionCell.styles.js";
|
|
4
|
+
const DEFAULT_GAP_SIZE = 24;
|
|
5
|
+
const ActionCellComponent = ({
|
|
6
|
+
children,
|
|
7
|
+
gapSize = DEFAULT_GAP_SIZE,
|
|
8
|
+
contentAlign = "right",
|
|
9
|
+
...htmlAttributes
|
|
10
|
+
}) => {
|
|
11
|
+
return /* @__PURE__ */ jsx(ActionCell$1, { gapSize, contentAlign, ...htmlAttributes, children });
|
|
12
|
+
};
|
|
13
|
+
const ActionCell = React.memo(ActionCellComponent);
|
|
14
|
+
export {
|
|
15
|
+
ActionCell
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const align = {
|
|
3
|
+
left: "flex-start",
|
|
4
|
+
right: "flex-end",
|
|
5
|
+
center: "center"
|
|
6
|
+
};
|
|
7
|
+
const ActionCell = /* @__PURE__ */ styled.div.withConfig({
|
|
8
|
+
displayName: "ActionCellstyles__ActionCell",
|
|
9
|
+
componentId: "sc-8cjprh-0"
|
|
10
|
+
})(["display:flex;align-items:center;justify-content:", ";gap:", ";"], (props) => align[props.contentAlign], (props) => `${props.gapSize}px`);
|
|
11
|
+
export {
|
|
12
|
+
ActionCell
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
3
|
+
export type ContentAlign = 'left' | 'right' | 'center';
|
|
4
|
+
export type BaseActionCellProps = {
|
|
5
|
+
children: ReactNode | ReactNode[];
|
|
6
|
+
gapSize?: number;
|
|
7
|
+
contentAlign?: ContentAlign;
|
|
8
|
+
};
|
|
9
|
+
export type ActionCellProps = WithHTMLAttributes<HTMLDivElement, BaseActionCellProps>;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
13
|
+
export type Props = ActionCellProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AvatarLabelProps } from './AvatarLabel.types';
|
|
3
|
+
declare const AvatarLabelCell: ({ avatar, avatarAction, avatarLink, title, labels, icon, ellipsis, maxWidth, avatarSize, loader, disabled, ...htmlAttributes }: AvatarLabelProps) => React.JSX.Element;
|
|
4
|
+
export { AvatarLabelCell };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Icon, Avatar, Description, Title, Labels, Label, Loader, AvatarLabel, AvatarLink } from "./AvatarLabel.styles.js";
|
|
3
|
+
const AvatarLabelCell = ({
|
|
4
|
+
avatar,
|
|
5
|
+
avatarAction,
|
|
6
|
+
avatarLink,
|
|
7
|
+
title,
|
|
8
|
+
labels,
|
|
9
|
+
icon,
|
|
10
|
+
ellipsis,
|
|
11
|
+
maxWidth,
|
|
12
|
+
avatarSize,
|
|
13
|
+
loader,
|
|
14
|
+
disabled,
|
|
15
|
+
...htmlAttributes
|
|
16
|
+
}) => {
|
|
17
|
+
const titleEllipsisProps = ellipsis ? {
|
|
18
|
+
ellipsis: {
|
|
19
|
+
tooltip: title
|
|
20
|
+
}
|
|
21
|
+
} : {};
|
|
22
|
+
const handleLinkClick = (event) => {
|
|
23
|
+
if (event.metaKey || event.ctrlKey) {
|
|
24
|
+
event.stopPropagation();
|
|
25
|
+
} else if (avatarAction) {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const cellContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
icon && /* @__PURE__ */ jsx(Icon, { children: icon }),
|
|
31
|
+
/* @__PURE__ */ jsx(Avatar, { clickable: Boolean(avatarAction), children: avatar }),
|
|
32
|
+
/* @__PURE__ */ jsxs(Description, { children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Title, { ...titleEllipsisProps, hasEllipsis: ellipsis, maxWidth, avatarSize, children: title }),
|
|
34
|
+
labels && /* @__PURE__ */ jsx(Labels, { ellipsis: Boolean(ellipsis), maxWidth, children: labels?.map((label, index) => /* @__PURE__ */ jsx(Label, { children: label }, `avatar-label-${index}`)) }),
|
|
35
|
+
loader && /* @__PURE__ */ jsx(Loader, { children: loader })
|
|
36
|
+
] })
|
|
37
|
+
] });
|
|
38
|
+
return /* @__PURE__ */ jsx(AvatarLabel, { ...htmlAttributes, isDisabled: disabled, onClick: avatarAction, children: avatarLink ? /* @__PURE__ */ jsx(AvatarLink, { href: avatarLink, onClick: handleLinkClick, children: cellContent }) : cellContent });
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
AvatarLabelCell
|
|
42
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const AvatarLabel: import('styled-components').StyledComponent<"div", any, {
|
|
2
|
+
onClick?: () => void;
|
|
3
|
+
isDisabled?: boolean;
|
|
4
|
+
}, never>;
|
|
5
|
+
export declare const Avatar: import('styled-components').StyledComponent<"div", any, {
|
|
6
|
+
clickable: boolean;
|
|
7
|
+
}, never>;
|
|
8
|
+
export declare const Description: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
9
|
+
export declare const AvatarLink: import('styled-components').StyledComponent<"a", any, {}, never>;
|
|
10
|
+
export declare const Title: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
|
|
11
|
+
size?: import('@synerise/ds-typography').TextSize;
|
|
12
|
+
ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
|
|
13
|
+
children?: import('react').ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: import('react').CSSProperties;
|
|
16
|
+
}) => React.JSX.Element, any, {
|
|
17
|
+
hasEllipsis?: boolean;
|
|
18
|
+
maxWidth: number | undefined;
|
|
19
|
+
avatarSize?: string | "large";
|
|
20
|
+
}, never>;
|
|
21
|
+
export declare const Labels: import('styled-components').StyledComponent<"span", any, {
|
|
22
|
+
ellipsis: boolean;
|
|
23
|
+
maxWidth: number | undefined;
|
|
24
|
+
}, never>;
|
|
25
|
+
export declare const Label: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
26
|
+
export declare const Icon: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
27
|
+
export declare const Loader: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { Text } from "@synerise/ds-typography";
|
|
3
|
+
const AvatarLabel = /* @__PURE__ */ styled.div.withConfig({
|
|
4
|
+
displayName: "AvatarLabelstyles__AvatarLabel",
|
|
5
|
+
componentId: "sc-f41gv6-0"
|
|
6
|
+
})(["display:flex;min-width:0;flex-grow:1;align-items:center;justify-content:flex-start;max-width:100%;", ";", ";"], (props) => props.isDisabled && "opacity: 0.4", (props) => props.onClick !== void 0 ? "cursor: pointer" : "");
|
|
7
|
+
const Avatar = /* @__PURE__ */ styled.div.withConfig({
|
|
8
|
+
displayName: "AvatarLabelstyles__Avatar",
|
|
9
|
+
componentId: "sc-f41gv6-1"
|
|
10
|
+
})(["margin-right:16px;display:flex;align-items:center;justify-content:center;", ";"], (props) => props.clickable ? "cursor: pointer" : "");
|
|
11
|
+
const Description = /* @__PURE__ */ styled.div.withConfig({
|
|
12
|
+
displayName: "AvatarLabelstyles__Description",
|
|
13
|
+
componentId: "sc-f41gv6-2"
|
|
14
|
+
})(["display:flex;min-width:0;flex-grow:1;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;"]);
|
|
15
|
+
const AvatarLink = /* @__PURE__ */ styled.a.withConfig({
|
|
16
|
+
displayName: "AvatarLabelstyles__AvatarLink",
|
|
17
|
+
componentId: "sc-f41gv6-3"
|
|
18
|
+
})(["display:flex;flex-grow:1;min-width:0;align-items:center;color:inherit;&:hover,&:active,&:focus{text-decoration:none;color:inherit;}"]);
|
|
19
|
+
const Title = /* @__PURE__ */ styled(Text).withConfig({
|
|
20
|
+
displayName: "AvatarLabelstyles__Title",
|
|
21
|
+
componentId: "sc-f41gv6-4"
|
|
22
|
+
})(["font-size:14px;line-height:20px;color:", ";font-weight:500;flex-grow:1;", ";"], (props) => props.theme.palette["grey-700"], (props) => Boolean(props.ellipsis) && css(["max-width:", ";"], props.maxWidth ? `${props.maxWidth}px` : "100%"));
|
|
23
|
+
const Labels = /* @__PURE__ */ styled.span.withConfig({
|
|
24
|
+
displayName: "AvatarLabelstyles__Labels",
|
|
25
|
+
componentId: "sc-f41gv6-5"
|
|
26
|
+
})(["font-size:13px;line-height:1.38;font-weight:400;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;color:", ";"], (props) => props.theme.palette["grey-700"]);
|
|
27
|
+
const Label = /* @__PURE__ */ styled.span.withConfig({
|
|
28
|
+
displayName: "AvatarLabelstyles__Label",
|
|
29
|
+
componentId: "sc-f41gv6-6"
|
|
30
|
+
})([""]);
|
|
31
|
+
const Icon = /* @__PURE__ */ styled.div.withConfig({
|
|
32
|
+
displayName: "AvatarLabelstyles__Icon",
|
|
33
|
+
componentId: "sc-f41gv6-7"
|
|
34
|
+
})(["margin-right:8px;"]);
|
|
35
|
+
const Loader = /* @__PURE__ */ styled.div.withConfig({
|
|
36
|
+
displayName: "AvatarLabelstyles__Loader",
|
|
37
|
+
componentId: "sc-f41gv6-8"
|
|
38
|
+
})([""]);
|
|
39
|
+
export {
|
|
40
|
+
Avatar,
|
|
41
|
+
AvatarLabel,
|
|
42
|
+
AvatarLink,
|
|
43
|
+
Description,
|
|
44
|
+
Icon,
|
|
45
|
+
Label,
|
|
46
|
+
Labels,
|
|
47
|
+
Loader,
|
|
48
|
+
Title
|
|
49
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
3
|
+
export type BaseAvatarLabelProps = {
|
|
4
|
+
avatar: ReactElement;
|
|
5
|
+
avatarAction?: () => void;
|
|
6
|
+
avatarLink?: string;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
labels?: ReactNode[];
|
|
9
|
+
icon?: ReactElement;
|
|
10
|
+
/** @deprecated */
|
|
11
|
+
textSize?: 'small' | 'default';
|
|
12
|
+
ellipsis?: boolean;
|
|
13
|
+
maxWidth?: number;
|
|
14
|
+
avatarSize?: string | 'large';
|
|
15
|
+
loader?: ReactElement;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type AvatarLabelProps = WithHTMLAttributes<HTMLDivElement, BaseAvatarLabelProps>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated
|
|
21
|
+
*/
|
|
22
|
+
export type Props = AvatarLabelProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { IconContainer } from "@synerise/ds-icon";
|
|
3
|
+
const CopyableValue = /* @__PURE__ */ styled.div.withConfig({
|
|
4
|
+
displayName: "Copyablestyles__CopyableValue",
|
|
5
|
+
componentId: "sc-2xpgou-0"
|
|
6
|
+
})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"]);
|
|
7
|
+
const Copyable = /* @__PURE__ */ styled.div.withConfig({
|
|
8
|
+
displayName: "Copyablestyles__Copyable",
|
|
9
|
+
componentId: "sc-2xpgou-1"
|
|
10
|
+
})(["display:flex;align-items:center;justify-content:space-between;&:hover{color:", ";", "{opacity:1;visibility:visible;}}", "{opacity:0;visibility:hidden;svg{fill:", ";color:", ";}&:hover{svg{fill:", ";color:", ";}}}"], (props) => props.theme.palette["grey-800"], IconContainer, IconContainer, (props) => props.theme.palette["grey-400"], (props) => props.theme.palette["grey-400"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"]);
|
|
11
|
+
export {
|
|
12
|
+
Copyable,
|
|
13
|
+
CopyableValue
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
2
|
+
export type BaseCopyableCellProps = {
|
|
3
|
+
value: string;
|
|
4
|
+
confirmMessage: string;
|
|
5
|
+
tooltipTimeout: number;
|
|
6
|
+
};
|
|
7
|
+
export type CopyableCellProps = WithHTMLAttributes<HTMLDivElement, BaseCopyableCellProps>;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
11
|
+
export type Props = CopyableCellProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import CopyIcon from "@synerise/ds-copy-icon";
|
|
4
|
+
import { Copyable, CopyableValue } from "./Copyable.styles.js";
|
|
5
|
+
const DEFAULT_TIMEOUT = 2e3;
|
|
6
|
+
const CopyableCell = ({
|
|
7
|
+
value,
|
|
8
|
+
confirmMessage,
|
|
9
|
+
tooltipTimeout = DEFAULT_TIMEOUT,
|
|
10
|
+
...htmlAttributes
|
|
11
|
+
}) => {
|
|
12
|
+
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const timer = setTimeout(() => {
|
|
15
|
+
setTooltipVisible(false);
|
|
16
|
+
}, tooltipTimeout);
|
|
17
|
+
return () => clearTimeout(timer);
|
|
18
|
+
}, [tooltipVisible, setTooltipVisible, tooltipTimeout]);
|
|
19
|
+
return /* @__PURE__ */ jsxs(Copyable, { ...htmlAttributes, children: [
|
|
20
|
+
/* @__PURE__ */ jsx(CopyableValue, { children: value }),
|
|
21
|
+
/* @__PURE__ */ jsx(CopyIcon, { copyValue: value, placement: "left", texts: {
|
|
22
|
+
copiedTooltip: confirmMessage
|
|
23
|
+
} })
|
|
24
|
+
] });
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
CopyableCell
|
|
28
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useMemo } from "react";
|
|
3
|
+
import Icon, { EditNolineS } from "@synerise/ds-icon";
|
|
4
|
+
import { Input } from "@synerise/ds-input";
|
|
5
|
+
import { Value, EditableCell as EditableCell$1 } from "./EditableCell.styles.js";
|
|
6
|
+
const EditableCell = ({
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
placeholder,
|
|
10
|
+
...htmlAttributes
|
|
11
|
+
}) => {
|
|
12
|
+
const [editMode, setEditMode] = useState(false);
|
|
13
|
+
const [editValue, setEditValue] = useState(value || "");
|
|
14
|
+
const enterEditMode = useCallback(() => {
|
|
15
|
+
setEditMode(true);
|
|
16
|
+
}, [setEditMode]);
|
|
17
|
+
const render = useMemo(() => {
|
|
18
|
+
return editMode ? /* @__PURE__ */ jsx(Input, { value: editValue, autoFocus: true, resetMargin: true, placeholder, onChange: (event) => setEditValue(event.target.value), onBlur: () => {
|
|
19
|
+
setEditMode(false);
|
|
20
|
+
onChange(editValue);
|
|
21
|
+
} }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(Value, { asPlaceholder: !value, children: value || placeholder }),
|
|
23
|
+
/* @__PURE__ */ jsx(Icon, { onClick: enterEditMode, component: /* @__PURE__ */ jsx(EditNolineS, {}) })
|
|
24
|
+
] });
|
|
25
|
+
}, [editMode, value, enterEditMode, editValue, setEditValue, onChange, placeholder]);
|
|
26
|
+
return /* @__PURE__ */ jsx(EditableCell$1, { ...htmlAttributes, children: render });
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
EditableCell
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { IconContainer } from "@synerise/ds-icon";
|
|
3
|
+
const EditableCell = /* @__PURE__ */ styled.div.withConfig({
|
|
4
|
+
displayName: "EditableCellstyles__EditableCell",
|
|
5
|
+
componentId: "sc-11zu6o2-0"
|
|
6
|
+
})(["display:flex;align-items:center;justify-content:flex-start;&:hover{", "{opacity:1;visibility:visible;}}", "{transition:all 0.3s ease;opacity:0;visibility:hidden;}"], IconContainer, IconContainer);
|
|
7
|
+
const Value = /* @__PURE__ */ styled.span.withConfig({
|
|
8
|
+
displayName: "EditableCellstyles__Value",
|
|
9
|
+
componentId: "sc-11zu6o2-1"
|
|
10
|
+
})(["color:", ";"], (props) => props.asPlaceholder ? props.theme.palette["grey-400"] : "inherit");
|
|
11
|
+
export {
|
|
12
|
+
EditableCell,
|
|
13
|
+
Value
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
2
|
+
export type BaseEditableCellProps = {
|
|
3
|
+
value?: string;
|
|
4
|
+
onChange: (newValue: string) => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
};
|
|
7
|
+
export type EditableCellProps = WithHTMLAttributes<HTMLDivElement, BaseEditableCellProps>;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
11
|
+
export type Props = EditableCellProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import DSFlag from "@synerise/ds-flag";
|
|
3
|
+
import { FlagLabel } from "./FlagLabelCell.styles.js";
|
|
4
|
+
const FlagLabelCell = ({
|
|
5
|
+
countryCode,
|
|
6
|
+
label,
|
|
7
|
+
...htmlAttributes
|
|
8
|
+
}) => {
|
|
9
|
+
return /* @__PURE__ */ jsxs(FlagLabel, { ...htmlAttributes, children: [
|
|
10
|
+
/* @__PURE__ */ jsx(DSFlag, { country: countryCode, size: 20 }),
|
|
11
|
+
/* @__PURE__ */ jsx("span", { children: label })
|
|
12
|
+
] });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
FlagLabelCell
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FlagLabel: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const FlagLabel = /* @__PURE__ */ styled.div.withConfig({
|
|
3
|
+
displayName: "FlagLabelCellstyles__FlagLabel",
|
|
4
|
+
componentId: "sc-17tek3-0"
|
|
5
|
+
})(["display:flex;align-items:center;justify-content:flex-start;span{margin-left:8px;}"]);
|
|
6
|
+
export {
|
|
7
|
+
FlagLabel
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CountryCode } from '@synerise/ds-flag/dist/Flag.types';
|
|
2
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
3
|
+
export type BaseFlagLabelProps = {
|
|
4
|
+
countryCode: CountryCode;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
export type FlagLabelProps = WithHTMLAttributes<HTMLDivElement, BaseFlagLabelProps>;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
11
|
+
export type Props = FlagLabelProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Icon from "@synerise/ds-icon";
|
|
3
|
+
import { IconLabelCell as IconLabelCell$1 } from "./IconLabel.styles.js";
|
|
4
|
+
const IconLabelCell = ({
|
|
5
|
+
label,
|
|
6
|
+
icon,
|
|
7
|
+
disabled,
|
|
8
|
+
...htmlAttributes
|
|
9
|
+
}) => /* @__PURE__ */ jsxs(IconLabelCell$1, { isDisabled: disabled, ...htmlAttributes, children: [
|
|
10
|
+
icon && /* @__PURE__ */ jsx(Icon, { ...icon }),
|
|
11
|
+
label && /* @__PURE__ */ jsx("span", { children: label })
|
|
12
|
+
] });
|
|
13
|
+
export {
|
|
14
|
+
IconLabelCell
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { IconContainer } from "@synerise/ds-icon";
|
|
3
|
+
const IconLabelCell = /* @__PURE__ */ styled.span.withConfig({
|
|
4
|
+
displayName: "IconLabelstyles__IconLabelCell",
|
|
5
|
+
componentId: "sc-1ydzkrb-0"
|
|
6
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;", " ", "{margin-right:8px;}"], (props) => props.isDisabled && "opacity: 0.4;", IconContainer);
|
|
7
|
+
export {
|
|
8
|
+
IconLabelCell
|
|
9
|
+
};
|