react-science 14.0.0 → 16.0.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/lib/components/accordion/accordion.d.ts +29 -7
- package/lib/components/accordion/accordion.d.ts.map +1 -1
- package/lib/components/accordion/accordion.js +24 -9
- package/lib/components/accordion/accordion.js.map +1 -1
- package/lib/components/accordion/accordion_context.d.ts +8 -15
- package/lib/components/accordion/accordion_context.d.ts.map +1 -1
- package/lib/components/accordion/accordion_context.js +7 -25
- package/lib/components/accordion/accordion_context.js.map +1 -1
- package/lib/components/accordion/accordion_context_provider.d.ts +7 -0
- package/lib/components/accordion/accordion_context_provider.d.ts.map +1 -0
- package/lib/components/accordion/accordion_context_provider.js +62 -0
- package/lib/components/accordion/accordion_context_provider.js.map +1 -0
- package/lib/components/accordion/accordion_context_utils.d.ts +15 -0
- package/lib/components/accordion/accordion_context_utils.d.ts.map +1 -0
- package/lib/components/accordion/accordion_context_utils.js +4 -0
- package/lib/components/accordion/accordion_context_utils.js.map +1 -0
- package/lib/components/accordion/accordion_hooks.d.ts +8 -0
- package/lib/components/accordion/accordion_hooks.d.ts.map +1 -0
- package/lib/components/accordion/accordion_hooks.js +16 -0
- package/lib/components/accordion/accordion_hooks.js.map +1 -0
- package/lib/components/accordion/index.d.ts +2 -3
- package/lib/components/accordion/index.d.ts.map +1 -1
- package/lib/components/accordion/index.js +2 -3
- package/lib/components/accordion/index.js.map +1 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/split_pane/index.d.ts +3 -0
- package/lib/components/split_pane/index.d.ts.map +1 -0
- package/lib/components/split_pane/index.js +3 -0
- package/lib/components/split_pane/index.js.map +1 -0
- package/lib/components/{split-pane/SplitPane.d.ts → split_pane/split_pane.d.ts} +7 -5
- package/lib/components/split_pane/split_pane.d.ts.map +1 -0
- package/lib/components/{split-pane/SplitPane.js → split_pane/split_pane.js} +25 -32
- package/lib/components/split_pane/split_pane.js.map +1 -0
- package/lib/components/split_pane/split_pane_helpers.d.ts +9 -0
- package/lib/components/split_pane/split_pane_helpers.d.ts.map +1 -0
- package/lib/components/split_pane/split_pane_helpers.js +10 -0
- package/lib/components/split_pane/split_pane_helpers.js.map +1 -0
- package/lib/components/{split-pane/useSplitPaneSize.d.ts → split_pane/use_split_pane_size.d.ts} +5 -3
- package/lib/components/split_pane/use_split_pane_size.d.ts.map +1 -0
- package/lib/components/split_pane/use_split_pane_size.js +78 -0
- package/lib/components/split_pane/use_split_pane_size.js.map +1 -0
- package/lib/components/table/index.d.ts +1 -0
- package/lib/components/table/index.d.ts.map +1 -1
- package/lib/components/table/index.js +1 -0
- package/lib/components/table/index.js.map +1 -1
- package/lib/components/table/reorder_rows/draggable_row_context.d.ts +9 -0
- package/lib/components/table/reorder_rows/draggable_row_context.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/draggable_row_context.js +10 -0
- package/lib/components/table/reorder_rows/draggable_row_context.js.map +1 -0
- package/lib/components/table/reorder_rows/draggable_row_tr.d.ts +18 -0
- package/lib/components/table/reorder_rows/draggable_row_tr.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/draggable_row_tr.js +107 -0
- package/lib/components/table/reorder_rows/draggable_row_tr.js.map +1 -0
- package/lib/components/table/reorder_rows/drop_indicator.d.ts +18 -0
- package/lib/components/table/reorder_rows/drop_indicator.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/drop_indicator.js +19 -0
- package/lib/components/table/reorder_rows/drop_indicator.js.map +1 -0
- package/lib/components/table/reorder_rows/dropped_item_context.d.ts +3 -0
- package/lib/components/table/reorder_rows/dropped_item_context.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/dropped_item_context.js +10 -0
- package/lib/components/table/reorder_rows/dropped_item_context.js.map +1 -0
- package/lib/components/table/reorder_rows/dropped_item_provider.d.ts +5 -0
- package/lib/components/table/reorder_rows/dropped_item_provider.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/dropped_item_provider.js +8 -0
- package/lib/components/table/reorder_rows/dropped_item_provider.js.map +1 -0
- package/lib/components/table/reorder_rows/index.d.ts +5 -0
- package/lib/components/table/reorder_rows/index.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/index.js +5 -0
- package/lib/components/table/reorder_rows/index.js.map +1 -0
- package/lib/components/table/reorder_rows/item_data.d.ts +26 -0
- package/lib/components/table/reorder_rows/item_data.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/item_data.js +13 -0
- package/lib/components/table/reorder_rows/item_data.js.map +1 -0
- package/lib/components/table/reorder_rows/item_order_context.d.ts +15 -0
- package/lib/components/table/reorder_rows/item_order_context.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/item_order_context.js +10 -0
- package/lib/components/table/reorder_rows/item_order_context.js.map +1 -0
- package/lib/components/table/reorder_rows/item_order_provider.d.ts +10 -0
- package/lib/components/table/reorder_rows/item_order_provider.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/item_order_provider.js +34 -0
- package/lib/components/table/reorder_rows/item_order_provider.js.map +1 -0
- package/lib/components/table/reorder_rows/table_drag_row_handler.d.ts +2 -0
- package/lib/components/table/reorder_rows/table_drag_row_handler.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/table_drag_row_handler.js +9 -0
- package/lib/components/table/reorder_rows/table_drag_row_handler.js.map +1 -0
- package/lib/components/table/reorder_rows/use_drop_monitor.d.ts +9 -0
- package/lib/components/table/reorder_rows/use_drop_monitor.d.ts.map +1 -0
- package/lib/components/table/reorder_rows/use_drop_monitor.js +57 -0
- package/lib/components/table/reorder_rows/use_drop_monitor.js.map +1 -0
- package/lib/components/table/table_body.d.ts +4 -1
- package/lib/components/table/table_body.d.ts.map +1 -1
- package/lib/components/table/table_body.js +20 -6
- package/lib/components/table/table_body.js.map +1 -1
- package/lib/components/table/table_root.d.ts +37 -1
- package/lib/components/table/table_root.d.ts.map +1 -1
- package/lib/components/table/table_root.js +41 -7
- package/lib/components/table/table_root.js.map +1 -1
- package/lib/components/table/table_row_cell.d.ts +2 -1
- package/lib/components/table/table_row_cell.d.ts.map +1 -1
- package/lib/components/table/table_row_cell.js +2 -2
- package/lib/components/table/table_row_cell.js.map +1 -1
- package/lib/components/table/table_utils.d.ts +11 -2
- package/lib/components/table/table_utils.d.ts.map +1 -1
- package/lib/components/table/table_utils.js.map +1 -1
- package/package.json +4 -1
- package/src/components/accordion/accordion.tsx +65 -20
- package/src/components/accordion/accordion_context.ts +17 -37
- package/src/components/accordion/accordion_context_provider.tsx +79 -0
- package/src/components/accordion/accordion_context_utils.ts +22 -0
- package/src/components/accordion/accordion_hooks.ts +32 -0
- package/src/components/accordion/index.ts +2 -6
- package/src/components/index.ts +1 -1
- package/src/components/split_pane/index.ts +2 -0
- package/src/components/{split-pane/SplitPane.tsx → split_pane/split_pane.tsx} +63 -56
- package/src/components/split_pane/split_pane_helpers.ts +19 -0
- package/src/components/split_pane/use_split_pane_size.tsx +120 -0
- package/src/components/table/index.ts +1 -0
- package/src/components/table/reorder_rows/draggable_row_context.ts +23 -0
- package/src/components/table/reorder_rows/draggable_row_tr.tsx +166 -0
- package/src/components/table/reorder_rows/drop_indicator.tsx +28 -0
- package/src/components/table/reorder_rows/dropped_item_context.ts +23 -0
- package/src/components/table/reorder_rows/dropped_item_provider.tsx +13 -0
- package/src/components/table/reorder_rows/index.ts +4 -0
- package/src/components/table/reorder_rows/item_data.ts +33 -0
- package/src/components/table/reorder_rows/item_order_context.ts +27 -0
- package/src/components/table/reorder_rows/item_order_provider.tsx +61 -0
- package/src/components/table/reorder_rows/table_drag_row_handler.tsx +22 -0
- package/src/components/table/reorder_rows/use_drop_monitor.ts +74 -0
- package/src/components/table/table_body.tsx +58 -9
- package/src/components/table/table_root.tsx +167 -35
- package/src/components/table/table_row_cell.tsx +5 -3
- package/src/components/table/table_utils.ts +16 -2
- package/lib/components/accordion/accordion_context.provider.d.ts +0 -13
- package/lib/components/accordion/accordion_context.provider.d.ts.map +0 -1
- package/lib/components/accordion/accordion_context.provider.js +0 -55
- package/lib/components/accordion/accordion_context.provider.js.map +0 -1
- package/lib/components/accordion/accordion_context.utils.d.ts +0 -23
- package/lib/components/accordion/accordion_context.utils.d.ts.map +0 -1
- package/lib/components/accordion/accordion_context.utils.js +0 -40
- package/lib/components/accordion/accordion_context.utils.js.map +0 -1
- package/lib/components/split-pane/SplitPane.d.ts.map +0 -1
- package/lib/components/split-pane/SplitPane.js.map +0 -1
- package/lib/components/split-pane/index.d.ts +0 -2
- package/lib/components/split-pane/index.d.ts.map +0 -1
- package/lib/components/split-pane/index.js +0 -2
- package/lib/components/split-pane/index.js.map +0 -1
- package/lib/components/split-pane/useSplitPaneSize.d.ts.map +0 -1
- package/lib/components/split-pane/useSplitPaneSize.js +0 -60
- package/lib/components/split-pane/useSplitPaneSize.js.map +0 -1
- package/src/components/accordion/accordion_context.provider.tsx +0 -91
- package/src/components/accordion/accordion_context.utils.ts +0 -66
- package/src/components/split-pane/index.ts +0 -1
- package/src/components/split-pane/useSplitPaneSize.tsx +0 -99
|
@@ -1,23 +1,37 @@
|
|
|
1
|
+
import { Tag } from '@blueprintjs/core';
|
|
1
2
|
import type { Row, RowData } from '@tanstack/react-table';
|
|
2
3
|
import type { VirtualItem, Virtualizer } from '@tanstack/react-virtual';
|
|
3
4
|
import { notUndefined } from '@tanstack/react-virtual';
|
|
4
5
|
import type { ReactNode } from 'react';
|
|
5
6
|
import { Fragment } from 'react';
|
|
6
7
|
|
|
8
|
+
import { TableDraggableRowTr } from './reorder_rows/index.js';
|
|
7
9
|
import { TableRowCell } from './table_row_cell.js';
|
|
8
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
GetTdProps,
|
|
12
|
+
TableRowPreviewRenderer,
|
|
13
|
+
TableRowTrProps,
|
|
14
|
+
TableRowTrRenderer,
|
|
15
|
+
} from './table_utils.js';
|
|
9
16
|
|
|
10
17
|
interface TableBodyProps<TData extends RowData> {
|
|
11
18
|
rows: Array<Row<TData>>;
|
|
19
|
+
getTdProps?: GetTdProps<TData>;
|
|
12
20
|
renderRowTr: TableRowTrRenderer<TData> | undefined;
|
|
13
21
|
virtualizeRows?: boolean;
|
|
14
22
|
virtualizer: Virtualizer<HTMLDivElement, Element>;
|
|
23
|
+
isReorderingEnabled: boolean;
|
|
24
|
+
renderRowPreview?: TableRowPreviewRenderer<TData>;
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
export function TableBody<TData extends RowData>(props: TableBodyProps<TData>) {
|
|
18
28
|
const {
|
|
19
29
|
rows,
|
|
20
|
-
|
|
30
|
+
getTdProps,
|
|
31
|
+
renderRowTr = getDefaultRenderRowTr(
|
|
32
|
+
props.isReorderingEnabled,
|
|
33
|
+
props.renderRowPreview as TableRowPreviewRenderer<unknown>,
|
|
34
|
+
) as TableRowTrRenderer<TData>,
|
|
21
35
|
virtualizer,
|
|
22
36
|
virtualizeRows,
|
|
23
37
|
} = props;
|
|
@@ -43,7 +57,7 @@ export function TableBody<TData extends RowData>(props: TableBodyProps<TData>) {
|
|
|
43
57
|
key={virtualItem.index}
|
|
44
58
|
row={rows[virtualItem.index]}
|
|
45
59
|
renderRowTr={(row) => {
|
|
46
|
-
const trProps = getTrRenderProps<TData>(row, {
|
|
60
|
+
const trProps = getTrRenderProps<TData>(row, getTdProps, {
|
|
47
61
|
...virtualItem,
|
|
48
62
|
virtualIndex: index,
|
|
49
63
|
});
|
|
@@ -65,7 +79,9 @@ export function TableBody<TData extends RowData>(props: TableBodyProps<TData>) {
|
|
|
65
79
|
<TableRow
|
|
66
80
|
key={row.id}
|
|
67
81
|
row={row}
|
|
68
|
-
renderRowTr={(row) =>
|
|
82
|
+
renderRowTr={(row) =>
|
|
83
|
+
renderRowTr(getTrRenderProps(row, getTdProps), row)
|
|
84
|
+
}
|
|
69
85
|
/>
|
|
70
86
|
))}
|
|
71
87
|
</tbody>
|
|
@@ -84,10 +100,6 @@ function TableRow<TData>({
|
|
|
84
100
|
return <Fragment>{renderRowTr(row)}</Fragment>;
|
|
85
101
|
}
|
|
86
102
|
|
|
87
|
-
const defaultRenderRowTr: TableRowTrRenderer<unknown> = (trProps) => (
|
|
88
|
-
<tr {...trProps} />
|
|
89
|
-
);
|
|
90
|
-
|
|
91
103
|
type RenderRowVirtualItem = VirtualItem & {
|
|
92
104
|
/**
|
|
93
105
|
* The index of the element within the virtual list being currently rendered.
|
|
@@ -97,6 +109,7 @@ type RenderRowVirtualItem = VirtualItem & {
|
|
|
97
109
|
|
|
98
110
|
function getTrRenderProps<TData extends RowData>(
|
|
99
111
|
row: Row<TData>,
|
|
112
|
+
getTdProps: GetTdProps<TData> | undefined,
|
|
100
113
|
virtualItem?: RenderRowVirtualItem,
|
|
101
114
|
): TableRowTrProps {
|
|
102
115
|
const index = virtualItem ? virtualItem.index : row.index;
|
|
@@ -104,9 +117,45 @@ function getTrRenderProps<TData extends RowData>(
|
|
|
104
117
|
return {
|
|
105
118
|
// index is 0-indexed, so odd rows are even indices
|
|
106
119
|
className: index % 2 === 0 ? 'odd' : '',
|
|
120
|
+
style: { position: 'relative' },
|
|
107
121
|
children: row
|
|
108
122
|
.getVisibleCells()
|
|
109
|
-
.map((cell) =>
|
|
123
|
+
.map((cell) => (
|
|
124
|
+
<TableRowCell<TData>
|
|
125
|
+
key={cell.id}
|
|
126
|
+
cell={cell}
|
|
127
|
+
getTdProps={getTdProps}
|
|
128
|
+
/>
|
|
129
|
+
)),
|
|
110
130
|
'data-row-id': row.id,
|
|
111
131
|
};
|
|
112
132
|
}
|
|
133
|
+
|
|
134
|
+
function getDefaultRenderRowTr(
|
|
135
|
+
isReorderingEnabled: boolean,
|
|
136
|
+
renderRowPreview: TableRowPreviewRenderer<unknown> | undefined,
|
|
137
|
+
): TableRowTrRenderer<unknown> {
|
|
138
|
+
if (isReorderingEnabled) {
|
|
139
|
+
return getDefaultRenderDraggableRowTr(renderRowPreview);
|
|
140
|
+
} else {
|
|
141
|
+
return defaultRenderRowTr;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const defaultRenderRowTr: TableRowTrRenderer<unknown> = (trProps) => (
|
|
146
|
+
<tr {...trProps} />
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
function getDefaultRenderDraggableRowTr(
|
|
150
|
+
renderRowPreview: TableRowPreviewRenderer<unknown> | undefined,
|
|
151
|
+
): TableRowTrRenderer<unknown> {
|
|
152
|
+
return (trProps, row) => (
|
|
153
|
+
<TableDraggableRowTr
|
|
154
|
+
trProps={trProps}
|
|
155
|
+
row={row}
|
|
156
|
+
renderRowPreview={
|
|
157
|
+
renderRowPreview ?? ((row) => <Tag>Row {row.index + 1}</Tag>)
|
|
158
|
+
}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLTable } from '@blueprintjs/core';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
|
-
import type { RowData, TableOptions } from '@tanstack/react-table';
|
|
3
|
+
import type { Header, RowData, TableOptions } from '@tanstack/react-table';
|
|
4
4
|
import {
|
|
5
5
|
getCoreRowModel,
|
|
6
6
|
getSortedRowModel,
|
|
@@ -8,14 +8,19 @@ import {
|
|
|
8
8
|
} from '@tanstack/react-table';
|
|
9
9
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
10
10
|
import type { ReactNode, RefObject, TableHTMLAttributes } from 'react';
|
|
11
|
-
import { useRef } from 'react';
|
|
11
|
+
import { useEffect, useRef } from 'react';
|
|
12
12
|
|
|
13
|
+
import { DroppedItemProvider } from './reorder_rows/dropped_item_provider.js';
|
|
14
|
+
import { ItemOrderProvider } from './reorder_rows/item_order_provider.js';
|
|
15
|
+
import { useDropMonitor } from './reorder_rows/use_drop_monitor.js';
|
|
13
16
|
import { TableBody } from './table_body.js';
|
|
14
17
|
import { TableHeader } from './table_header.js';
|
|
15
18
|
import type { HeaderCellRenderer } from './table_header_cell.js';
|
|
16
19
|
import type {
|
|
20
|
+
GetTdProps,
|
|
17
21
|
Scroller,
|
|
18
22
|
TableColumnDef,
|
|
23
|
+
TableRowPreviewRenderer,
|
|
19
24
|
TableRowTrRenderer,
|
|
20
25
|
VirtualScroller,
|
|
21
26
|
} from './table_utils.js';
|
|
@@ -34,7 +39,7 @@ const CustomHTMLTable = styled(HTMLTable, {
|
|
|
34
39
|
box-shadow: inset 0 -1px #11141826;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
tbody tr:first-
|
|
42
|
+
tbody tr:first-of-type td {
|
|
38
43
|
box-shadow: ${
|
|
39
44
|
props.bordered
|
|
40
45
|
? 'inset 1px 0 0 0 #11141826 !important'
|
|
@@ -42,7 +47,7 @@ const CustomHTMLTable = styled(HTMLTable, {
|
|
|
42
47
|
};
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
tbody tr:first-
|
|
50
|
+
tbody tr:first-of-type td:first-of-type {
|
|
46
51
|
box-shadow: none !important;
|
|
47
52
|
}
|
|
48
53
|
`;
|
|
@@ -57,6 +62,9 @@ const CustomHTMLTable = styled(HTMLTable, {
|
|
|
57
62
|
`;
|
|
58
63
|
|
|
59
64
|
interface TableBaseProps<TData extends RowData> {
|
|
65
|
+
/**
|
|
66
|
+
* The original data to display in the table.
|
|
67
|
+
*/
|
|
60
68
|
data: TData[];
|
|
61
69
|
/**
|
|
62
70
|
* Tanstack table definition of columns in the table.
|
|
@@ -115,19 +123,55 @@ interface TableBaseProps<TData extends RowData> {
|
|
|
115
123
|
*/
|
|
116
124
|
renderHeaderCell?: HeaderCellRenderer<TData>;
|
|
117
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Pass custom props to the `<td>`.
|
|
128
|
+
* The callback is called for each cell and receives the row's data.
|
|
129
|
+
* The returned properties are spread onto the `<td>` element.
|
|
130
|
+
*/
|
|
131
|
+
getTdProps?: GetTdProps<TData>;
|
|
132
|
+
|
|
118
133
|
/**
|
|
119
134
|
* A ref which will be set with a callback to scroll to a row in the
|
|
120
135
|
* table, specified by the row's ID.
|
|
121
136
|
*/
|
|
122
137
|
scrollToRowRef?: RefObject<VirtualScroller | ScrollToOptions | undefined>;
|
|
123
138
|
|
|
139
|
+
/**
|
|
140
|
+
* An accessor which should return a unique identifier for the row.
|
|
141
|
+
*/
|
|
124
142
|
getRowId?: TableOptions<TData>['getRowId'];
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Called when the user changed the order of the rows.
|
|
146
|
+
* Specifying this callback enables row reordering by drag and drop.
|
|
147
|
+
* Make sure to specify `getRowId` and not to use column sorting when you
|
|
148
|
+
* enable row reordering.
|
|
149
|
+
* Use the `TableDragRowHandler` component within table cells to provide the
|
|
150
|
+
* drag and drop interface for reordering rows.
|
|
151
|
+
* @param rows The rows in their new order.
|
|
152
|
+
*/
|
|
153
|
+
onRowOrderChanged?: (rows: TData[]) => void;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Render function to customize the preview of the row being dragged
|
|
157
|
+
* when reordering.
|
|
158
|
+
* It receives the row being dragged.
|
|
159
|
+
* Ignored when using custom row rendering with `renderRowTr`.
|
|
160
|
+
*/
|
|
161
|
+
renderRowPreview?: TableRowPreviewRenderer<TData>;
|
|
125
162
|
}
|
|
126
163
|
|
|
127
164
|
interface RegularTableProps<TData extends RowData>
|
|
128
165
|
extends TableBaseProps<TData> {
|
|
129
166
|
virtualizeRows?: false | undefined;
|
|
130
167
|
scrollToRowRef?: RefObject<Scroller | undefined>;
|
|
168
|
+
/**
|
|
169
|
+
* Specify a custom scrollable reference, which will be used to
|
|
170
|
+
* automatically scroll the table when reordering elements.
|
|
171
|
+
* By default, the table itself is used as the scrollable element, but
|
|
172
|
+
* you must style it to make it scrollable.
|
|
173
|
+
*/
|
|
174
|
+
scrollableElementRef?: RefObject<Element>;
|
|
131
175
|
}
|
|
132
176
|
|
|
133
177
|
interface VirtualizedTableProps<TData extends RowData>
|
|
@@ -162,11 +206,14 @@ export function Table<TData extends RowData>(props: TableProps<TData>) {
|
|
|
162
206
|
className,
|
|
163
207
|
renderRowTr,
|
|
164
208
|
renderHeaderCell,
|
|
209
|
+
getTdProps,
|
|
165
210
|
|
|
166
211
|
virtualizeRows,
|
|
167
212
|
getRowId,
|
|
213
|
+
onRowOrderChanged,
|
|
214
|
+
renderRowPreview,
|
|
168
215
|
} = props;
|
|
169
|
-
|
|
216
|
+
const isReorderingEnabled = !!onRowOrderChanged;
|
|
170
217
|
const scrollElementRef = useRef<HTMLDivElement>(null);
|
|
171
218
|
const columnDefs = useTableColumns(columns);
|
|
172
219
|
const table = useReactTable<TData>({
|
|
@@ -199,31 +246,56 @@ export function Table<TData extends RowData>(props: TableProps<TData>) {
|
|
|
199
246
|
finalClassName = tableProps?.className;
|
|
200
247
|
}
|
|
201
248
|
|
|
249
|
+
const tableHeaders = table.getFlatHeaders();
|
|
250
|
+
useCheckProps(
|
|
251
|
+
props as TableProps<unknown>,
|
|
252
|
+
tableHeaders as Array<Header<unknown, unknown>>,
|
|
253
|
+
);
|
|
202
254
|
return (
|
|
203
|
-
<
|
|
204
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
striped={striped}
|
|
210
|
-
stickyHeader={stickyHeader}
|
|
211
|
-
{...tableProps}
|
|
212
|
-
className={finalClassName}
|
|
255
|
+
<DroppedItemProvider>
|
|
256
|
+
<ItemOrderProvider
|
|
257
|
+
items={table.getRowModel().rows}
|
|
258
|
+
onOrderChanged={(items) => {
|
|
259
|
+
onRowOrderChanged?.(items.map((item) => item.original));
|
|
260
|
+
}}
|
|
213
261
|
>
|
|
214
|
-
<
|
|
215
|
-
sticky={stickyHeader}
|
|
216
|
-
headers={table.getFlatHeaders()}
|
|
217
|
-
renderHeaderCell={renderHeaderCell}
|
|
218
|
-
/>
|
|
219
|
-
<TableBody
|
|
220
|
-
rows={table.getRowModel().rows}
|
|
221
|
-
renderRowTr={renderRowTr}
|
|
222
|
-
virtualizer={tanstackVirtualizer}
|
|
262
|
+
<Container
|
|
223
263
|
virtualizeRows={virtualizeRows}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
264
|
+
scrollRef={
|
|
265
|
+
virtualizeRows
|
|
266
|
+
? scrollElementRef
|
|
267
|
+
: props.scrollableElementRef || tableRef
|
|
268
|
+
}
|
|
269
|
+
isReorderingEnabled={isReorderingEnabled}
|
|
270
|
+
>
|
|
271
|
+
<CustomHTMLTable
|
|
272
|
+
ref={tableRef}
|
|
273
|
+
bordered={bordered}
|
|
274
|
+
compact={compact}
|
|
275
|
+
interactive={interactive}
|
|
276
|
+
striped={striped}
|
|
277
|
+
stickyHeader={stickyHeader}
|
|
278
|
+
{...tableProps}
|
|
279
|
+
className={finalClassName}
|
|
280
|
+
>
|
|
281
|
+
<TableHeader
|
|
282
|
+
sticky={stickyHeader}
|
|
283
|
+
headers={tableHeaders}
|
|
284
|
+
renderHeaderCell={renderHeaderCell}
|
|
285
|
+
/>
|
|
286
|
+
<TableBody
|
|
287
|
+
rows={table.getRowModel().rows}
|
|
288
|
+
renderRowTr={renderRowTr}
|
|
289
|
+
getTdProps={getTdProps}
|
|
290
|
+
virtualizer={tanstackVirtualizer}
|
|
291
|
+
virtualizeRows={virtualizeRows}
|
|
292
|
+
renderRowPreview={renderRowPreview}
|
|
293
|
+
isReorderingEnabled={isReorderingEnabled}
|
|
294
|
+
/>
|
|
295
|
+
</CustomHTMLTable>
|
|
296
|
+
</Container>
|
|
297
|
+
</ItemOrderProvider>
|
|
298
|
+
</DroppedItemProvider>
|
|
227
299
|
);
|
|
228
300
|
}
|
|
229
301
|
|
|
@@ -232,17 +304,77 @@ const ScrollRefDiv = styled.div`
|
|
|
232
304
|
overflow: auto;
|
|
233
305
|
`;
|
|
234
306
|
|
|
235
|
-
|
|
236
|
-
virtualizeRows,
|
|
237
|
-
scrollRef,
|
|
238
|
-
children,
|
|
239
|
-
}: {
|
|
307
|
+
interface ContainerProps {
|
|
240
308
|
virtualizeRows?: boolean;
|
|
241
309
|
children: ReactNode;
|
|
242
|
-
scrollRef: RefObject<
|
|
243
|
-
|
|
310
|
+
scrollRef: RefObject<Element>;
|
|
311
|
+
isReorderingEnabled: boolean;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function Container(props: ContainerProps) {
|
|
315
|
+
const { virtualizeRows, scrollRef, isReorderingEnabled, children } = props;
|
|
244
316
|
if (virtualizeRows) {
|
|
245
|
-
return
|
|
317
|
+
return (
|
|
318
|
+
<ContainerVirtual
|
|
319
|
+
scrollElementRef={scrollRef}
|
|
320
|
+
enabled={isReorderingEnabled}
|
|
321
|
+
>
|
|
322
|
+
{children}
|
|
323
|
+
</ContainerVirtual>
|
|
324
|
+
);
|
|
246
325
|
}
|
|
326
|
+
return (
|
|
327
|
+
<ContainerTable scrollElementRef={scrollRef} enabled={isReorderingEnabled}>
|
|
328
|
+
{children}
|
|
329
|
+
</ContainerTable>
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
interface ContainerWithReorderingProps {
|
|
334
|
+
scrollElementRef: RefObject<Element>;
|
|
335
|
+
enabled: boolean;
|
|
336
|
+
children: ReactNode;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function ContainerVirtual(props: ContainerWithReorderingProps) {
|
|
340
|
+
const { scrollElementRef, enabled, children } = props;
|
|
341
|
+
useDropMonitor(scrollElementRef, enabled);
|
|
342
|
+
|
|
343
|
+
return (
|
|
344
|
+
<ScrollRefDiv ref={scrollElementRef as RefObject<HTMLDivElement>}>
|
|
345
|
+
{children}
|
|
346
|
+
</ScrollRefDiv>
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
interface ContainerTableProps {
|
|
351
|
+
scrollElementRef: RefObject<Element>;
|
|
352
|
+
enabled: boolean;
|
|
353
|
+
children: ReactNode;
|
|
354
|
+
}
|
|
355
|
+
function ContainerTable(props: ContainerTableProps) {
|
|
356
|
+
const { scrollElementRef, enabled, children } = props;
|
|
357
|
+
useDropMonitor(scrollElementRef, enabled);
|
|
247
358
|
return <>{children}</>;
|
|
248
359
|
}
|
|
360
|
+
|
|
361
|
+
function useCheckProps(
|
|
362
|
+
props: TableProps<unknown>,
|
|
363
|
+
headers: Array<Header<unknown, unknown>>,
|
|
364
|
+
) {
|
|
365
|
+
const { onRowOrderChanged, getRowId } = props;
|
|
366
|
+
useEffect(() => {
|
|
367
|
+
if (onRowOrderChanged && !getRowId) {
|
|
368
|
+
// eslint-disable-next-line no-console
|
|
369
|
+
console.warn(
|
|
370
|
+
'When reordering rows is enabled via the `onRowOrderChanged` prop, the `getRowId` prop must be provided to identify each row unambiguously.',
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
if (headers.some((header) => header.column.getCanSort())) {
|
|
374
|
+
// eslint-disable-next-line no-console
|
|
375
|
+
console.warn(
|
|
376
|
+
'When reordering rows is enabled via the `onRowOrderChanged` prop, none of the columns should be sortable as data order will be overriden by internal sorting.',
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
}, [onRowOrderChanged, getRowId, headers]);
|
|
380
|
+
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import type { Cell, RowData } from '@tanstack/react-table';
|
|
2
2
|
import { flexRender } from '@tanstack/react-table';
|
|
3
3
|
|
|
4
|
+
import type { GetTdProps } from './table_utils.js';
|
|
5
|
+
|
|
4
6
|
interface TableRowCellProps<TData extends RowData> {
|
|
5
7
|
cell: Cell<TData, unknown>;
|
|
6
|
-
|
|
8
|
+
getTdProps: GetTdProps<TData> | undefined;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export function TableRowCell<TData extends RowData>(
|
|
10
12
|
props: TableRowCellProps<TData>,
|
|
11
13
|
) {
|
|
12
|
-
const { cell,
|
|
14
|
+
const { cell, getTdProps } = props;
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
|
-
<td
|
|
17
|
+
<td {...getTdProps?.(cell)}>
|
|
16
18
|
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
17
19
|
</td>
|
|
18
20
|
);
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import type { ColumnDef, Row, RowData } from '@tanstack/react-table';
|
|
1
|
+
import type { Cell, ColumnDef, Row, RowData } from '@tanstack/react-table';
|
|
2
2
|
import { createColumnHelper } from '@tanstack/react-table';
|
|
3
3
|
import type { ScrollToOptions } from '@tanstack/react-virtual';
|
|
4
|
-
import type { ReactNode } from 'react';
|
|
4
|
+
import type { CSSProperties, ReactNode, TdHTMLAttributes } from 'react';
|
|
5
5
|
|
|
6
6
|
export type TableColumnDef<TData extends RowData, TValue = unknown> = ColumnDef<
|
|
7
7
|
TData,
|
|
8
8
|
TValue
|
|
9
9
|
>;
|
|
10
10
|
|
|
11
|
+
type TableTdProps = TdHTMLAttributes<HTMLTableCellElement>;
|
|
12
|
+
|
|
13
|
+
export type GetTdProps<TData extends RowData> = (
|
|
14
|
+
cell: Cell<TData, unknown>,
|
|
15
|
+
) => TableTdProps;
|
|
16
|
+
|
|
11
17
|
export function createTableColumnHelper<TData extends RowData>() {
|
|
12
18
|
return createColumnHelper<TData>();
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
export interface TableRowTrProps {
|
|
16
22
|
className: string;
|
|
23
|
+
style: CSSProperties;
|
|
17
24
|
children: ReactNode;
|
|
18
25
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
26
|
'data-row-id': string;
|
|
@@ -24,6 +31,13 @@ export type TableRowTrRenderer<TData extends RowData> = (
|
|
|
24
31
|
row: Row<TData>,
|
|
25
32
|
) => ReactNode;
|
|
26
33
|
|
|
34
|
+
export type TableRowPreviewRenderer<TData extends RowData> = (
|
|
35
|
+
/**
|
|
36
|
+
* The row being dragged, for which to render a preview.
|
|
37
|
+
*/
|
|
38
|
+
row: Row<TData>,
|
|
39
|
+
) => ReactNode;
|
|
40
|
+
|
|
27
41
|
export interface VirtualScroller {
|
|
28
42
|
scrollIntoView: (id: string, options?: ScrollToOptions) => void;
|
|
29
43
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { AccordionItemState, ActionType } from './accordion_context.utils.js';
|
|
3
|
-
interface AccordionProviderProps {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
unmountChildren?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export type AccordionActions = ActionType<'CHANGE', {
|
|
8
|
-
title: string;
|
|
9
|
-
isOpen: boolean;
|
|
10
|
-
}> | ActionType<'CLEAR', string> | ActionType<'TOGGLE', string> | ActionType<'REMOVE', string> | ActionType<'CREATE', AccordionItemState>;
|
|
11
|
-
export declare function AccordionProvider(props: AccordionProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=accordion_context.provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accordion_context.provider.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion_context.provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACX,MAAM,8BAA8B,CAAC;AAQtC,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,gBAAgB,GACxB,UAAU,CAAC,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,GACxD,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,GAC3B,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,GAC5B,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,GAC5B,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AAyB7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAsC9D"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useReducer } from 'react';
|
|
3
|
-
import { match } from 'ts-pattern';
|
|
4
|
-
import { accordionContext } from './accordion_context.js';
|
|
5
|
-
import { changeItem, clearItem, removeItem, toggleItem, } from './accordion_context.utils.js';
|
|
6
|
-
function reducer(previous, action) {
|
|
7
|
-
return match(action)
|
|
8
|
-
.with({ type: 'CHANGE' }, ({ payload }) => {
|
|
9
|
-
return changeItem(previous, payload);
|
|
10
|
-
})
|
|
11
|
-
.with({ type: 'CLEAR' }, ({ payload }) => {
|
|
12
|
-
return clearItem(previous, payload);
|
|
13
|
-
})
|
|
14
|
-
.with({ type: 'TOGGLE' }, ({ payload }) => {
|
|
15
|
-
return toggleItem(previous, payload);
|
|
16
|
-
})
|
|
17
|
-
.with({ type: 'REMOVE' }, ({ payload }) => {
|
|
18
|
-
return removeItem(previous, payload);
|
|
19
|
-
})
|
|
20
|
-
.with({ type: 'CREATE' }, ({ payload }) => {
|
|
21
|
-
return [...previous, payload];
|
|
22
|
-
})
|
|
23
|
-
.exhaustive();
|
|
24
|
-
}
|
|
25
|
-
export function AccordionProvider(props) {
|
|
26
|
-
const { unmountChildren = false, children } = props;
|
|
27
|
-
const [items, dispatch] = useReducer(reducer, []);
|
|
28
|
-
const utils = useMemo(() => {
|
|
29
|
-
return {
|
|
30
|
-
change: (title, isOpen) => dispatch({ type: 'CHANGE', payload: { title, isOpen } }),
|
|
31
|
-
clear: (except) => dispatch({ type: 'CLEAR', payload: except }),
|
|
32
|
-
toggle: (title) => dispatch({ type: 'TOGGLE', payload: title }),
|
|
33
|
-
remove: (title) => dispatch({ type: 'REMOVE', payload: title }),
|
|
34
|
-
create: (title, defaultOpened) => {
|
|
35
|
-
const item = {
|
|
36
|
-
title,
|
|
37
|
-
isOpen: defaultOpened || false,
|
|
38
|
-
};
|
|
39
|
-
dispatch({ type: 'CREATE', payload: item });
|
|
40
|
-
return item;
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}, []);
|
|
44
|
-
const contextValue = useMemo(() => {
|
|
45
|
-
return [
|
|
46
|
-
{
|
|
47
|
-
items,
|
|
48
|
-
unmountChildren,
|
|
49
|
-
},
|
|
50
|
-
utils,
|
|
51
|
-
];
|
|
52
|
-
}, [items, unmountChildren, utils]);
|
|
53
|
-
return (_jsx(accordionContext.Provider, { value: contextValue, children: children }));
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=accordion_context.provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accordion_context.provider.js","sourceRoot":"","sources":["../../../src/components/accordion/accordion_context.provider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK1D,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,GACX,MAAM,8BAA8B,CAAC;AActC,SAAS,OAAO,CACd,QAA8B,EAC9B,MAAwB;IAExB,OAAO,KAAK,CAAC,MAAM,CAAC;SACjB,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QACxC,OAAO,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QACvC,OAAO,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QACxC,OAAO,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,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I,GAAuB;oBAC/B,KAAK;oBACL,MAAM,EAAE,aAAa,IAAI,KAAK;iBAC/B,CAAC;gBAEF,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC5C,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,YAAY,GAAG,OAAO,CAAc,GAAG,EAAE;QAC7C,OAAO;YACL;gBACE,KAAK;gBACL,eAAe;aAChB;YACD,KAAK;SACN,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC,CAAC;IAEpC,OAAO,CACL,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC3C,QAAQ,GACiB,CAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface AccordionItemState {
|
|
2
|
-
title: string;
|
|
3
|
-
isOpen: boolean;
|
|
4
|
-
}
|
|
5
|
-
export interface AccordionState {
|
|
6
|
-
items: AccordionItemState[];
|
|
7
|
-
unmountChildren: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare function getItem(title: string, items: AccordionItemState[]): AccordionItemState | undefined;
|
|
10
|
-
export type ActionType<Action, Payload = void> = Payload extends void ? {
|
|
11
|
-
type: Action;
|
|
12
|
-
} : {
|
|
13
|
-
type: Action;
|
|
14
|
-
payload: Payload;
|
|
15
|
-
};
|
|
16
|
-
export declare function removeItem(array: AccordionItemState[], title: string): AccordionItemState[];
|
|
17
|
-
export declare function changeItem(array: AccordionItemState[], payload: {
|
|
18
|
-
title: string;
|
|
19
|
-
isOpen: boolean;
|
|
20
|
-
}): AccordionItemState[];
|
|
21
|
-
export declare function clearItem(array: AccordionItemState[], except: string): AccordionItemState[];
|
|
22
|
-
export declare function toggleItem(array: AccordionItemState[], title: string): AccordionItemState[];
|
|
23
|
-
//# sourceMappingURL=accordion_context.utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accordion_context.utils.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion_context.utils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,EAAE,kCAEjE;AAED,MAAM,MAAM,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,IAAI,OAAO,SAAS,IAAI,GACjE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvC,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,EAAE,EAAE,KAAK,EAAE,MAAM,wBAEpE;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,kBAAkB,EAAE,EAC3B,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,wBAU5C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,MAAM,wBAapE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,EAAE,EAAE,KAAK,EAAE,MAAM,wBAcpE"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export function getItem(title, items) {
|
|
2
|
-
return items.find((element) => element.title === title);
|
|
3
|
-
}
|
|
4
|
-
export function removeItem(array, title) {
|
|
5
|
-
return array.filter((element) => element.title !== title);
|
|
6
|
-
}
|
|
7
|
-
export function changeItem(array, payload) {
|
|
8
|
-
const { title, isOpen } = payload;
|
|
9
|
-
const item = getItem(title, array);
|
|
10
|
-
if (item) {
|
|
11
|
-
return [...removeItem(array, title), { ...item, isOpen }];
|
|
12
|
-
}
|
|
13
|
-
return array;
|
|
14
|
-
}
|
|
15
|
-
export function clearItem(array, except) {
|
|
16
|
-
const item = getItem(except, array);
|
|
17
|
-
if (!item) {
|
|
18
|
-
return [...array, { isOpen: true, title: except }];
|
|
19
|
-
}
|
|
20
|
-
return array.map((element) => {
|
|
21
|
-
return {
|
|
22
|
-
...element,
|
|
23
|
-
isOpen: element.title === item.title,
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
export function toggleItem(array, title) {
|
|
28
|
-
const item = getItem(title, array);
|
|
29
|
-
if (!item) {
|
|
30
|
-
return [...array, { title, isOpen: true }];
|
|
31
|
-
}
|
|
32
|
-
return [
|
|
33
|
-
...removeItem(array, title),
|
|
34
|
-
{
|
|
35
|
-
...item,
|
|
36
|
-
isOpen: !item.isOpen,
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=accordion_context.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accordion_context.utils.js","sourceRoot":"","sources":["../../../src/components/accordion/accordion_context.utils.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,OAAO,CAAC,KAAa,EAAE,KAA2B;IAChE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AAC1D,CAAC;AAMD,MAAM,UAAU,UAAU,CAAC,KAA2B,EAAE,KAAa;IACnE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,KAA2B,EAC3B,O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":3,"file":"SplitPane.d.ts","sourceRoot":"","sources":["../../../src/components/split-pane/SplitPane.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,SAAS,EAEV,MAAM,OAAO,CAAC;AAOf,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,YAAY,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,CAAC;AAC5C,MAAM,MAAM,aAAa,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC;IAE/B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC;IAE5B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IAE7C;;OAEG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAE7C;;OAEG;IACH,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CAClC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAsG9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SplitPane.js","sourceRoot":"","sources":["../../../src/components/split-pane/SplitPane.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,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI;gBACzC,OAAO,EAAE,MAAM;aAChB;YACH,CAAC,CAAC;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;gBACf,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;aAC7C,CAAC;IACR,CAAC;AACH,CAAC;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAGtB;sBACoB,MAAM,CAAC,WAAW;;;;;;;;;wBAShB,MAAM,CAAC,WAAW;;;IAGtC,CAAC,KAAK,EAAE,EAAE,CACV,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;KACnB,IAAI,CACH,YAAY,EACZ,GAAG,EAAE,CAAC;kBACI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;;OAElD,CACA;KACA,IAAI,CACH,UAAU,EACV,GAAG,EAAE,CAAC;;kBAEI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;OAClD,CACA;KACA,UAAU,EAAE;CAClB,CAAC;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAM9B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/split-pane/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/split-pane/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|