@rebasepro/ui 0.17.3 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/components/MultiSelect.d.ts +10 -0
- package/dist/index.es.js +2 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +32 -23
- package/src/components/Alert.tsx +0 -118
- package/src/components/Autocomplete.tsx +0 -93
- package/src/components/Avatar.tsx +0 -73
- package/src/components/Badge.tsx +0 -44
- package/src/components/BooleanSwitch.tsx +0 -116
- package/src/components/BooleanSwitchWithLabel.tsx +0 -120
- package/src/components/Button.tsx +0 -110
- package/src/components/Card.tsx +0 -43
- package/src/components/CenteredView.tsx +0 -35
- package/src/components/Checkbox.tsx +0 -129
- package/src/components/Chip.tsx +0 -131
- package/src/components/CircularProgress.tsx +0 -53
- package/src/components/CircularProgressCenter.tsx +0 -27
- package/src/components/Collapse.tsx +0 -66
- package/src/components/ColorPicker.tsx +0 -140
- package/src/components/Container.tsx +0 -51
- package/src/components/DateTimeField.tsx +0 -363
- package/src/components/DebouncedTextField.tsx +0 -76
- package/src/components/Dialog.tsx +0 -159
- package/src/components/DialogActions.tsx +0 -29
- package/src/components/DialogContent.tsx +0 -27
- package/src/components/DialogTitle.tsx +0 -41
- package/src/components/ErrorBoundary.tsx +0 -236
- package/src/components/ExpandablePanel.tsx +0 -130
- package/src/components/FileUpload.tsx +0 -103
- package/src/components/FilterChip.tsx +0 -89
- package/src/components/IconButton.tsx +0 -101
- package/src/components/InfoLabel.tsx +0 -23
- package/src/components/InputLabel.tsx +0 -40
- package/src/components/Label.tsx +0 -32
- package/src/components/LoadingButton.tsx +0 -32
- package/src/components/Markdown.tsx +0 -55
- package/src/components/Menu.tsx +0 -114
- package/src/components/Menubar.tsx +0 -355
- package/src/components/MultiSelect.tsx +0 -433
- package/src/components/Paper.tsx +0 -23
- package/src/components/Popover.tsx +0 -162
- package/src/components/RadioGroup.tsx +0 -74
- package/src/components/ResizablePanels.tsx +0 -189
- package/src/components/SearchBar.tsx +0 -136
- package/src/components/Select.tsx +0 -326
- package/src/components/Separator.tsx +0 -28
- package/src/components/Sheet.tsx +0 -135
- package/src/components/Skeleton.tsx +0 -54
- package/src/components/Slider.tsx +0 -110
- package/src/components/Table.tsx +0 -178
- package/src/components/Tabs.tsx +0 -185
- package/src/components/TextField.tsx +0 -270
- package/src/components/TextareaAutosize.tsx +0 -368
- package/src/components/ToggleButtonGroup.tsx +0 -69
- package/src/components/Tooltip.tsx +0 -153
- package/src/components/Typography.tsx +0 -132
- package/src/components/VirtualTable/VirtualTable.performance.test.tsx +0 -90
- package/src/components/VirtualTable/VirtualTable.tsx +0 -700
- package/src/components/VirtualTable/VirtualTableCell.tsx +0 -59
- package/src/components/VirtualTable/VirtualTableHeader.tsx +0 -327
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +0 -250
- package/src/components/VirtualTable/VirtualTableProps.tsx +0 -339
- package/src/components/VirtualTable/VirtualTableRow.tsx +0 -51
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +0 -44
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +0 -89
- package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +0 -71
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +0 -107
- package/src/components/VirtualTable/fields/VirtualTableSwitch.tsx +0 -28
- package/src/components/VirtualTable/index.tsx +0 -10
- package/src/components/VirtualTable/selection/SelectionContext.tsx +0 -36
- package/src/components/VirtualTable/selection/SelectionStore.ts +0 -54
- package/src/components/VirtualTable/types.tsx +0 -47
- package/src/components/common/SelectInputLabel.tsx +0 -23
- package/src/components/index.tsx +0 -62
- package/src/hooks/PortalContainerContext.tsx +0 -50
- package/src/hooks/index.ts +0 -7
- package/src/hooks/useDebounceCallback.tsx +0 -21
- package/src/hooks/useDebounceValue.tsx +0 -20
- package/src/hooks/useDebouncedCallback.ts +0 -39
- package/src/hooks/useInjectStyles.tsx +0 -31
- package/src/hooks/useOutsideAlerter.tsx +0 -46
- package/src/icons/GitHubIcon.tsx +0 -21
- package/src/icons/HandleIcon.tsx +0 -23
- package/src/icons/Icon.tsx +0 -33
- package/src/icons/LucideIconByName.tsx +0 -117
- package/src/icons/cool_icon_keys.ts +0 -12
- package/src/icons/icon_keys.ts +0 -1936
- package/src/icons/index.ts +0 -179
- package/src/index.css +0 -169
- package/src/index.ts +0 -47
- package/src/scripts/fixIconSizes.cjs +0 -92
- package/src/scripts/fixIconSizesToConst.cjs +0 -106
- package/src/scripts/generateIconKeys.ts +0 -41
- package/src/scripts/generateIcons.ts +0 -4
- package/src/scripts/saveIconFiles.ts +0 -89
- package/src/styles.ts +0 -141
- package/src/theme.css +0 -168
- package/src/util/chip_colors.ts +0 -242
- package/src/util/cls.ts +0 -8
- package/src/util/debounce.ts +0 -28
- package/src/util/hash.ts +0 -11
- package/src/util/index.ts +0 -4
- package/src/util/key_to_icon_component.ts +0 -11
- package/src/util/lazy_chunk.ts +0 -101
- package/src/views/CardView.tsx +0 -281
- package/src/views/CollectionView/CollectionCardView.tsx +0 -265
- package/src/views/CollectionView/CollectionKanbanView.tsx +0 -246
- package/src/views/CollectionView/CollectionListView.tsx +0 -240
- package/src/views/CollectionView/CollectionTableView.tsx +0 -229
- package/src/views/CollectionView/CollectionView.tsx +0 -450
- package/src/views/CollectionView/CollectionViewToolbar.tsx +0 -242
- package/src/views/CollectionView/CollectionViewTypes.ts +0 -181
- package/src/views/CollectionView/DefaultCellRenderer.tsx +0 -404
- package/src/views/CollectionView/index.ts +0 -39
- package/src/views/CollectionView/resolveTitleProperty.ts +0 -52
- package/src/views/CollectionView/utils.ts +0 -14
- package/src/views/Kanban/Board.tsx +0 -384
- package/src/views/Kanban/BoardColumn.tsx +0 -138
- package/src/views/Kanban/BoardColumnTitle.tsx +0 -47
- package/src/views/Kanban/BoardSortableList.tsx +0 -182
- package/src/views/Kanban/board_types.ts +0 -80
- package/src/views/Kanban/index.tsx +0 -5
- package/src/views/Kanban/placement.ts +0 -62
- package/src/views/KanbanView.tsx +0 -32
- package/src/views/ListView.tsx +0 -296
- package/src/views/index.ts +0 -5
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useCallback, useState } from "react";
|
|
3
|
-
import { LayoutList, Table2, LayoutGrid, Kanban, Settings2 } from "lucide-react";
|
|
4
|
-
import { iconSize } from "../../icons/Icon";
|
|
5
|
-
import { SearchBar } from "../../components/SearchBar";
|
|
6
|
-
import { Popover } from "../../components/Popover";
|
|
7
|
-
import { ToggleButtonGroup } from "../../components/ToggleButtonGroup";
|
|
8
|
-
import type { ToggleButtonOption } from "../../components/ToggleButtonGroup";
|
|
9
|
-
import { Typography } from "../../components/Typography";
|
|
10
|
-
import { Select, SelectItem } from "../../components/Select";
|
|
11
|
-
import { IconButton } from "../../components/IconButton";
|
|
12
|
-
import { cls } from "../../util";
|
|
13
|
-
import type { CollectionViewMode, CollectionViewSize, KanbanPropertyOption } from "./CollectionViewTypes";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Props for the {@link CollectionViewToolbar} component.
|
|
17
|
-
* @group Collection View
|
|
18
|
-
*/
|
|
19
|
-
export type CollectionViewToolbarProps = {
|
|
20
|
-
viewMode: CollectionViewMode;
|
|
21
|
-
onViewModeChange?: (mode: CollectionViewMode) => void;
|
|
22
|
-
enabledViews?: CollectionViewMode[];
|
|
23
|
-
/**
|
|
24
|
-
* Custom view modes, supplying the label and icon for their switcher
|
|
25
|
-
* entries. Without these an `enabledViews` key outside the four built-ins
|
|
26
|
-
* has no label and no icon to draw.
|
|
27
|
-
*/
|
|
28
|
-
customViews?: { key: string, name: string, icon?: React.ReactNode }[];
|
|
29
|
-
size?: CollectionViewSize;
|
|
30
|
-
onSizeChange?: (size: CollectionViewSize) => void;
|
|
31
|
-
searchString?: string;
|
|
32
|
-
onSearchChange?: (search?: string) => void;
|
|
33
|
-
loading?: boolean;
|
|
34
|
-
actionsStart?: React.ReactNode;
|
|
35
|
-
actionsEnd?: React.ReactNode;
|
|
36
|
-
compact?: boolean;
|
|
37
|
-
kanbanPropertyOptions?: KanbanPropertyOption[];
|
|
38
|
-
selectedKanbanProperty?: string;
|
|
39
|
-
onKanbanPropertyChange?: (property: string) => void;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const VIEW_MODE_ICONS: Record<string, React.ReactNode> = {
|
|
43
|
-
list: <LayoutList size={iconSize.small} />,
|
|
44
|
-
table: <Table2 size={iconSize.small} />,
|
|
45
|
-
cards: <LayoutGrid size={iconSize.small} />,
|
|
46
|
-
kanban: <Kanban size={iconSize.small} />,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const VIEW_MODE_LABELS: Record<string, string> = {
|
|
50
|
-
list: "List",
|
|
51
|
-
table: "Table",
|
|
52
|
-
cards: "Cards",
|
|
53
|
-
kanban: "Board",
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const SIZE_LABELS: Record<CollectionViewSize, string> = {
|
|
57
|
-
xs: "Extra Small",
|
|
58
|
-
s: "Small",
|
|
59
|
-
m: "Medium",
|
|
60
|
-
l: "Large",
|
|
61
|
-
xl: "Extra Large",
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Toolbar for the headless CollectionView.
|
|
66
|
-
*
|
|
67
|
-
* Renders a search bar, view mode toggle (popover with toggle button group),
|
|
68
|
-
* optional size selector, optional kanban property selector, and action slots.
|
|
69
|
-
*
|
|
70
|
-
* @group Collection View
|
|
71
|
-
*/
|
|
72
|
-
export function CollectionViewToolbar({
|
|
73
|
-
viewMode,
|
|
74
|
-
onViewModeChange,
|
|
75
|
-
enabledViews = ["list", "table", "cards", "kanban"],
|
|
76
|
-
customViews,
|
|
77
|
-
size = "m",
|
|
78
|
-
onSizeChange,
|
|
79
|
-
searchString,
|
|
80
|
-
onSearchChange,
|
|
81
|
-
loading,
|
|
82
|
-
actionsStart,
|
|
83
|
-
actionsEnd,
|
|
84
|
-
compact,
|
|
85
|
-
kanbanPropertyOptions,
|
|
86
|
-
selectedKanbanProperty,
|
|
87
|
-
onKanbanPropertyChange,
|
|
88
|
-
}: CollectionViewToolbarProps) {
|
|
89
|
-
const [popoverOpen, setPopoverOpen] = useState(false);
|
|
90
|
-
|
|
91
|
-
// A key outside the four built-ins takes its label and icon from the
|
|
92
|
-
// custom view that declared it; without one it falls back to the key
|
|
93
|
-
// itself and the list glyph, so an entry is never blank.
|
|
94
|
-
const viewOptions: ToggleButtonOption<CollectionViewMode>[] = enabledViews.map((mode) => {
|
|
95
|
-
const custom = customViews?.find((entry) => entry.key === mode);
|
|
96
|
-
return {
|
|
97
|
-
value: mode,
|
|
98
|
-
label: VIEW_MODE_LABELS[mode] ?? custom?.name ?? mode,
|
|
99
|
-
icon: VIEW_MODE_ICONS[mode] ?? custom?.icon ?? <LayoutList size={iconSize.small} />,
|
|
100
|
-
};
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const handleViewModeChange = useCallback(
|
|
104
|
-
(mode: CollectionViewMode) => {
|
|
105
|
-
onViewModeChange?.(mode);
|
|
106
|
-
},
|
|
107
|
-
[onViewModeChange]
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
const handleSizeChange = useCallback(
|
|
111
|
-
(value: string) => {
|
|
112
|
-
onSizeChange?.(value as CollectionViewSize);
|
|
113
|
-
},
|
|
114
|
-
[onSizeChange]
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
const handleKanbanPropertyChange = useCallback(
|
|
118
|
-
(value: string) => {
|
|
119
|
-
onKanbanPropertyChange?.(value);
|
|
120
|
-
},
|
|
121
|
-
[onKanbanPropertyChange]
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
const showViewToggle = onViewModeChange && enabledViews.length > 1;
|
|
125
|
-
const showSizeSelector = onSizeChange && viewMode !== "kanban";
|
|
126
|
-
const showKanbanSelector =
|
|
127
|
-
kanbanPropertyOptions &&
|
|
128
|
-
kanbanPropertyOptions.length > 0 &&
|
|
129
|
-
viewMode === "kanban" &&
|
|
130
|
-
onKanbanPropertyChange;
|
|
131
|
-
const showPopover = showViewToggle || showSizeSelector || showKanbanSelector;
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<div
|
|
135
|
-
className={cls(
|
|
136
|
-
"flex items-center gap-2 px-2 flex-shrink-0",
|
|
137
|
-
"border-b border-surface-200 dark:border-surface-800",
|
|
138
|
-
compact ? "py-0.5 gap-1" : "py-1"
|
|
139
|
-
)}
|
|
140
|
-
>
|
|
141
|
-
{actionsStart}
|
|
142
|
-
|
|
143
|
-
{onSearchChange && (
|
|
144
|
-
<SearchBar
|
|
145
|
-
onTextSearch={onSearchChange}
|
|
146
|
-
size="small"
|
|
147
|
-
initialValue={searchString}
|
|
148
|
-
loading={loading}
|
|
149
|
-
expandable
|
|
150
|
-
/>
|
|
151
|
-
)}
|
|
152
|
-
|
|
153
|
-
<div className="flex-1" />
|
|
154
|
-
|
|
155
|
-
{actionsEnd}
|
|
156
|
-
|
|
157
|
-
{showPopover && (
|
|
158
|
-
<Popover
|
|
159
|
-
open={popoverOpen}
|
|
160
|
-
onOpenChange={setPopoverOpen}
|
|
161
|
-
side="bottom"
|
|
162
|
-
align="end"
|
|
163
|
-
trigger={
|
|
164
|
-
<IconButton
|
|
165
|
-
size="small"
|
|
166
|
-
onClick={() => setPopoverOpen((prev) => !prev)}
|
|
167
|
-
>
|
|
168
|
-
<Settings2 size={iconSize.small} />
|
|
169
|
-
</IconButton>
|
|
170
|
-
}
|
|
171
|
-
>
|
|
172
|
-
<div className="p-3 min-w-[200px] flex flex-col gap-3">
|
|
173
|
-
{showViewToggle && (
|
|
174
|
-
<div className="flex flex-col gap-1">
|
|
175
|
-
<Typography
|
|
176
|
-
variant="caption"
|
|
177
|
-
color="secondary"
|
|
178
|
-
className="font-medium uppercase tracking-wider"
|
|
179
|
-
>
|
|
180
|
-
View
|
|
181
|
-
</Typography>
|
|
182
|
-
<ToggleButtonGroup<CollectionViewMode>
|
|
183
|
-
value={viewMode}
|
|
184
|
-
onValueChange={handleViewModeChange}
|
|
185
|
-
options={viewOptions}
|
|
186
|
-
/>
|
|
187
|
-
</div>
|
|
188
|
-
)}
|
|
189
|
-
|
|
190
|
-
{showSizeSelector && (
|
|
191
|
-
<div className="flex flex-col gap-1">
|
|
192
|
-
<Typography
|
|
193
|
-
variant="caption"
|
|
194
|
-
color="secondary"
|
|
195
|
-
className="font-medium uppercase tracking-wider"
|
|
196
|
-
>
|
|
197
|
-
Size
|
|
198
|
-
</Typography>
|
|
199
|
-
<Select
|
|
200
|
-
value={size}
|
|
201
|
-
onValueChange={handleSizeChange}
|
|
202
|
-
size="small"
|
|
203
|
-
>
|
|
204
|
-
{(Object.keys(SIZE_LABELS) as CollectionViewSize[]).map(
|
|
205
|
-
(sizeKey) => (
|
|
206
|
-
<SelectItem key={sizeKey} value={sizeKey}>
|
|
207
|
-
{SIZE_LABELS[sizeKey]}
|
|
208
|
-
</SelectItem>
|
|
209
|
-
)
|
|
210
|
-
)}
|
|
211
|
-
</Select>
|
|
212
|
-
</div>
|
|
213
|
-
)}
|
|
214
|
-
|
|
215
|
-
{showKanbanSelector && (
|
|
216
|
-
<div className="flex flex-col gap-1">
|
|
217
|
-
<Typography
|
|
218
|
-
variant="caption"
|
|
219
|
-
color="secondary"
|
|
220
|
-
className="font-medium uppercase tracking-wider"
|
|
221
|
-
>
|
|
222
|
-
Group by
|
|
223
|
-
</Typography>
|
|
224
|
-
<Select
|
|
225
|
-
value={selectedKanbanProperty}
|
|
226
|
-
onValueChange={handleKanbanPropertyChange}
|
|
227
|
-
size="small"
|
|
228
|
-
>
|
|
229
|
-
{kanbanPropertyOptions.map((option) => (
|
|
230
|
-
<SelectItem key={option.key} value={option.key}>
|
|
231
|
-
{option.label}
|
|
232
|
-
</SelectItem>
|
|
233
|
-
))}
|
|
234
|
-
</Select>
|
|
235
|
-
</div>
|
|
236
|
-
)}
|
|
237
|
-
</div>
|
|
238
|
-
</Popover>
|
|
239
|
-
)}
|
|
240
|
-
</div>
|
|
241
|
-
);
|
|
242
|
-
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { VirtualTableSortKey } from "../../components/VirtualTable/VirtualTableProps";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Supported view modes.
|
|
6
|
-
*
|
|
7
|
-
* Any other string is a key into the `customViews` prop. The `(string & {})`
|
|
8
|
-
* arm keeps the four built-ins in autocomplete while admitting those keys.
|
|
9
|
-
*/
|
|
10
|
-
export type CollectionViewMode = "table" | "cards" | "kanban" | "list" | (string & {});
|
|
11
|
-
|
|
12
|
-
/** Supported collection sizes */
|
|
13
|
-
export type CollectionViewSize = "xs" | "s" | "m" | "l" | "xl";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Enum value configuration.
|
|
17
|
-
* Simple form: string label
|
|
18
|
-
* Extended form: object with label + optional color + disabled
|
|
19
|
-
*/
|
|
20
|
-
export type CollectionEnumValueConfig = string | {
|
|
21
|
-
label: string;
|
|
22
|
-
color?: string;
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* A data-agnostic property definition for rendering columns/cells.
|
|
28
|
-
* This is a UI-only type — it describes HOW to render, not WHERE data lives.
|
|
29
|
-
*
|
|
30
|
-
* This shape is deliberately compatible with Rebase's Property type,
|
|
31
|
-
* so the connected wrapper can pass properties with minimal mapping.
|
|
32
|
-
*/
|
|
33
|
-
export interface CollectionPropertyConfig {
|
|
34
|
-
/** Property data type — determines how cells are rendered */
|
|
35
|
-
type: "string" | "number" | "boolean" | "date" | "array" | "map" | "reference" | "relation" | "geopoint";
|
|
36
|
-
|
|
37
|
-
/** Display name shown in column headers and card labels */
|
|
38
|
-
name: string;
|
|
39
|
-
|
|
40
|
-
/** Optional description, shown as tooltip on column header */
|
|
41
|
-
description?: string;
|
|
42
|
-
|
|
43
|
-
// —— Display configuration ——
|
|
44
|
-
/** Column width in pixels */
|
|
45
|
-
columnWidth?: number;
|
|
46
|
-
/** If true, this property is not shown in collection views */
|
|
47
|
-
hideFromCollection?: boolean;
|
|
48
|
-
|
|
49
|
-
// —— Enum support ——
|
|
50
|
-
/** Map of value → label/config for enum properties */
|
|
51
|
-
enum?: Record<string, CollectionEnumValueConfig> | Map<string | number, CollectionEnumValueConfig>;
|
|
52
|
-
|
|
53
|
-
// —— String-specific ——
|
|
54
|
-
multiline?: boolean;
|
|
55
|
-
previewAsTag?: boolean;
|
|
56
|
-
url?: boolean | string;
|
|
57
|
-
markdown?: boolean;
|
|
58
|
-
storage?: boolean;
|
|
59
|
-
email?: boolean;
|
|
60
|
-
|
|
61
|
-
// —— Array-specific ——
|
|
62
|
-
of?: CollectionPropertyConfig;
|
|
63
|
-
|
|
64
|
-
// —— Map-specific ——
|
|
65
|
-
properties?: Record<string, CollectionPropertyConfig>;
|
|
66
|
-
propertiesOrder?: string[];
|
|
67
|
-
|
|
68
|
-
// —— Date-specific ——
|
|
69
|
-
mode?: "date" | "date_time";
|
|
70
|
-
|
|
71
|
-
// —— UI overrides ——
|
|
72
|
-
/** Custom preview component for this property */
|
|
73
|
-
Preview?: React.ComponentType<CellRendererProps>;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Data controller interface — the headless view reads data and state through this.
|
|
78
|
-
* Consumer apps can build their own implementation.
|
|
79
|
-
*/
|
|
80
|
-
export interface CollectionDataController<T = Record<string, unknown>> {
|
|
81
|
-
data: T[];
|
|
82
|
-
loading: boolean;
|
|
83
|
-
noMoreToLoad: boolean;
|
|
84
|
-
error?: Error;
|
|
85
|
-
|
|
86
|
-
filterValues?: Record<string, [string, unknown]>;
|
|
87
|
-
setFilterValues?: (values: Record<string, [string, unknown]> | undefined) => void;
|
|
88
|
-
|
|
89
|
-
/** The sort keys in order of significance; the second breaks ties on the first. */
|
|
90
|
-
sortBy?: VirtualTableSortKey[];
|
|
91
|
-
setSortBy?: (sort?: VirtualTableSortKey[]) => void;
|
|
92
|
-
|
|
93
|
-
searchString?: string;
|
|
94
|
-
setSearchString?: (search?: string) => void;
|
|
95
|
-
clearFilter?: () => void;
|
|
96
|
-
|
|
97
|
-
initialScroll?: number;
|
|
98
|
-
onScroll?: (props: {
|
|
99
|
-
scrollDirection: "forward" | "backward";
|
|
100
|
-
scrollOffset: number;
|
|
101
|
-
scrollUpdateWasRequested: boolean;
|
|
102
|
-
}) => void;
|
|
103
|
-
|
|
104
|
-
paginationEnabled?: boolean;
|
|
105
|
-
pageSize?: number;
|
|
106
|
-
itemCount?: number;
|
|
107
|
-
setItemCount?: (count: number) => void;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Props passed to cell renderers.
|
|
112
|
-
*/
|
|
113
|
-
export interface CellRendererProps<T = Record<string, unknown>> {
|
|
114
|
-
row: T;
|
|
115
|
-
propertyKey: string;
|
|
116
|
-
property: CollectionPropertyConfig;
|
|
117
|
-
value: unknown;
|
|
118
|
-
size?: "small" | "medium" | "large" | "tiny";
|
|
119
|
-
width?: number;
|
|
120
|
-
height?: number;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Custom cell renderer function type.
|
|
125
|
-
* Return undefined to fall through to the default renderer.
|
|
126
|
-
*/
|
|
127
|
-
export type CellRendererOverride<T = Record<string, unknown>> =
|
|
128
|
-
(props: CellRendererProps<T>) => React.ReactNode | undefined;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Selection controller for the headless view.
|
|
132
|
-
*/
|
|
133
|
-
export interface CollectionSelectionController<T = Record<string, unknown>> {
|
|
134
|
-
selectedItems: T[];
|
|
135
|
-
setSelectedItems: React.Dispatch<React.SetStateAction<T[]>>;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Kanban property option for the view mode toggle.
|
|
140
|
-
*/
|
|
141
|
-
export interface KanbanPropertyOption {
|
|
142
|
-
key: string;
|
|
143
|
-
label: string;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* What a custom view's component receives — the same set the built-in table,
|
|
148
|
-
* card, list and kanban views are given, so a custom view starts at parity
|
|
149
|
-
* with them and inherits the toolbar's search, the empty state and selection.
|
|
150
|
-
*/
|
|
151
|
-
export interface CollectionCustomViewProps<T = Record<string, unknown>> {
|
|
152
|
-
dataController: CollectionDataController<T>;
|
|
153
|
-
properties: Record<string, CollectionPropertyConfig>;
|
|
154
|
-
propertiesOrder?: string[];
|
|
155
|
-
idProperty?: string;
|
|
156
|
-
titleProperty?: string;
|
|
157
|
-
onRowClick?: (row: T) => void;
|
|
158
|
-
onRowCreate?: (defaults?: Record<string, unknown>) => void;
|
|
159
|
-
canCreate?: boolean;
|
|
160
|
-
cellRenderer?: CellRendererOverride<T>;
|
|
161
|
-
selectionEnabled?: boolean;
|
|
162
|
-
selectionController?: CollectionSelectionController<T>;
|
|
163
|
-
highlightedItems?: T[];
|
|
164
|
-
emptyComponent?: React.ReactNode;
|
|
165
|
-
size?: CollectionViewSize;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* A custom view registration. Either the component on its own, or the
|
|
170
|
-
* component with the label and icon its switcher entry should carry.
|
|
171
|
-
*
|
|
172
|
-
* Without a `name` the switcher falls back to the key, which is legible but
|
|
173
|
-
* rarely what you want on screen.
|
|
174
|
-
*/
|
|
175
|
-
export type CollectionCustomViewEntry<T = Record<string, unknown>> =
|
|
176
|
-
| React.ComponentType<CollectionCustomViewProps<T>>
|
|
177
|
-
| {
|
|
178
|
-
name?: string;
|
|
179
|
-
icon?: React.ReactNode;
|
|
180
|
-
Component: React.ComponentType<CollectionCustomViewProps<T>>;
|
|
181
|
-
};
|