@worknice/whiteboard 0.52.0 → 0.53.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/dist/{presentation/TableColumnFilterModal.d.ts → controls/FilterModal.d.ts} +10 -3
- package/dist/{presentation/TableColumnFilterModal.js → controls/FilterModal.js} +32 -32
- package/dist/controls/FilterModal.module.js +13 -0
- package/dist/controls/FilterModal_module.css +60 -0
- package/dist/controls/MenuButton.js +1 -1
- package/dist/icons/MessagesIcon.d.ts +3 -0
- package/dist/icons/MessagesIcon.js +11 -0
- package/dist/icons/SlidersIcon.d.ts +3 -0
- package/dist/icons/SlidersIcon.js +12 -0
- package/dist/icons/WarningIcon.js +3 -3
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +3 -1
- package/dist/presentation/CustomizableTable/CustomizableTable.d.ts +2 -2
- package/dist/presentation/CustomizableTable/CustomizableTable.js +9 -7
- package/dist/presentation/RichList/RichList.d.ts +150 -0
- package/dist/presentation/RichList/RichList.js +507 -0
- package/dist/presentation/RichList/RichList.module.js +12 -0
- package/dist/presentation/RichList/RichList.stories.d.ts +24 -0
- package/dist/presentation/RichList/RichList.stories.js +334 -0
- package/dist/presentation/RichList/RichListBulkActionBar.d.ts +21 -0
- package/dist/presentation/RichList/RichListBulkActionBar.js +112 -0
- package/dist/presentation/RichList/RichListBulkActionBar.module.js +7 -0
- package/dist/presentation/RichList/RichListBulkActionBar_module.css +18 -0
- package/dist/presentation/RichList/RichListDisplayModal.d.ts +33 -0
- package/dist/presentation/RichList/RichListDisplayModal.js +198 -0
- package/dist/presentation/RichList/RichListRow.d.ts +39 -0
- package/dist/presentation/RichList/RichListRow.js +278 -0
- package/dist/presentation/RichList/RichListRow.module.js +34 -0
- package/dist/presentation/RichList/RichListRow_module.css +313 -0
- package/dist/presentation/RichList/RichListToolbar.d.ts +21 -0
- package/dist/presentation/RichList/RichListToolbar.js +104 -0
- package/dist/presentation/RichList/RichListToolbar.module.js +12 -0
- package/dist/presentation/RichList/RichListToolbar_module.css +100 -0
- package/dist/presentation/RichList/RichList_module.css +77 -0
- package/dist/presentation/RichList/helpers.d.ts +77 -0
- package/dist/presentation/RichList/helpers.js +121 -0
- package/dist/presentation/RichList/stories/ComplianceGroups.d.ts +9 -0
- package/dist/presentation/RichList/stories/ComplianceGroups.js +141 -0
- package/dist/presentation/RichList/stories/CustomFields.d.ts +13 -0
- package/dist/presentation/RichList/stories/CustomFields.js +80 -0
- package/dist/presentation/RichList/stories/EmployeeCompliance.d.ts +15 -0
- package/dist/presentation/RichList/stories/EmployeeCompliance.js +300 -0
- package/dist/presentation/RichList/stories/EmployeePaperwork.d.ts +21 -0
- package/dist/presentation/RichList/stories/EmployeePaperwork.js +225 -0
- package/dist/presentation/RichList/stories/EmployeePeople.d.ts +10 -0
- package/dist/presentation/RichList/stories/EmployeePeople.js +170 -0
- package/dist/presentation/RichList/stories/Leave.d.ts +21 -0
- package/dist/presentation/RichList/stories/Leave.js +332 -0
- package/dist/presentation/RichList/stories/Paperwork.d.ts +22 -0
- package/dist/presentation/RichList/stories/Paperwork.js +446 -0
- package/dist/presentation/RichList/stories/PaperworkApprovals.d.ts +23 -0
- package/dist/presentation/RichList/stories/PaperworkApprovals.js +342 -0
- package/dist/presentation/RichList/stories/PeopleList.d.ts +19 -0
- package/dist/presentation/RichList/stories/PeopleList.js +391 -0
- package/dist/presentation/RichList/stories/PeopleTags.d.ts +14 -0
- package/dist/presentation/RichList/stories/PeopleTags.js +106 -0
- package/dist/presentation/RichList/stories/Positions.d.ts +22 -0
- package/dist/presentation/RichList/stories/Positions.js +519 -0
- package/dist/presentation/RichList/stories/SavedQuestions.d.ts +13 -0
- package/dist/presentation/RichList/stories/SavedQuestions.js +152 -0
- package/dist/presentation/RichList/stories/Tables.d.ts +9 -0
- package/dist/presentation/RichList/stories/Tables.js +85 -0
- package/dist/presentation/RichList/stories/Tasks.d.ts +16 -0
- package/dist/presentation/RichList/stories/Tasks.js +340 -0
- package/dist/presentation/RichList/stories/shared/bulkActionStubs.d.ts +9 -0
- package/dist/presentation/RichList/stories/shared/bulkActionStubs.js +122 -0
- package/dist/presentation/RichList/stories/shared.d.ts +8 -0
- package/dist/presentation/RichList/stories/shared.js +2 -0
- package/dist/presentation/RichList/types.d.ts +342 -0
- package/dist/presentation/RichList/types.js +0 -0
- package/dist/presentation/Table.d.ts +1 -1
- package/dist/presentation/Table.js +2 -2
- package/dist/presentation/Table.module.js +0 -10
- package/dist/presentation/Table_module.css +1 -61
- package/package.json +2 -2
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import { type ZodTypeAny } from "zod";
|
|
3
|
+
import { type RichListBulkAction, type RichListContentSlot, type RichListMainSlot, type RichListRowAction, type RichListSlot } from "./types";
|
|
4
|
+
type CommonProps<Type> = {
|
|
5
|
+
data: Array<Type>;
|
|
6
|
+
getRowId: (row: Type) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Area before the main column (e.g. avatar or icon). Pass an array to render
|
|
9
|
+
* multiple leading slots; combine each entry's `layoutVisibility` to swap content
|
|
10
|
+
* across breakpoints (e.g. one `whenWide`, one `whenCompact`). Each entry must
|
|
11
|
+
* have a unique `id`.
|
|
12
|
+
* @default (omitted) no leading column.
|
|
13
|
+
*/
|
|
14
|
+
leadingSlot?: RichListSlot<Type> | Array<RichListSlot<Type>>;
|
|
15
|
+
/**
|
|
16
|
+
* Primary line (main identifier) and optional secondary line (supporting context) in
|
|
17
|
+
* the same column as the content slots. Use `RichListTextField` object form for search,
|
|
18
|
+
* filters, CSV, and `prefixOnWide` / `suffixOnWide` adornments.
|
|
19
|
+
*
|
|
20
|
+
* Optional **`size`** (pixels on `RichListMainSlot`) sets the max width of this whole
|
|
21
|
+
* column (both lines together).
|
|
22
|
+
*/
|
|
23
|
+
mainSlot: RichListMainSlot<Type>;
|
|
24
|
+
/**
|
|
25
|
+
* Fills columns between the main slot and the trailing column. Content slots accept
|
|
26
|
+
* the additional `columnWidthMode`, `canToggleVisibility`, and `hiddenByDefault`
|
|
27
|
+
* options on top of the shared `RichListSlot` shape. To drop a content column at
|
|
28
|
+
* compact, use `layoutVisibility: "whenWide"` on it.
|
|
29
|
+
* @default `[]`
|
|
30
|
+
*/
|
|
31
|
+
contentSlots?: Array<RichListContentSlot<Type>>;
|
|
32
|
+
/**
|
|
33
|
+
* `justify-content` for the **content slot** section (the flex area beside the main slot).
|
|
34
|
+
* @default `space-evenly`
|
|
35
|
+
*/
|
|
36
|
+
contentAlignment?: NonNullable<CSSProperties["justifyContent"]>;
|
|
37
|
+
/**
|
|
38
|
+
* Column at the end of the row. Pass an array to render multiple trailing slots;
|
|
39
|
+
* combine each entry's `layoutVisibility` to swap content across breakpoints
|
|
40
|
+
* (e.g. one `whenWide`, one `whenCompact`). Each entry must have a unique `id`.
|
|
41
|
+
* @default (omitted) no trailing column.
|
|
42
|
+
*/
|
|
43
|
+
trailingSlot?: RichListSlot<Type> | Array<RichListSlot<Type>>;
|
|
44
|
+
/**
|
|
45
|
+
* Row actions and an overflow menu. Return `null` to skip a slot;
|
|
46
|
+
* use `predicate` on an action to hide it for some rows.
|
|
47
|
+
* @default (omitted) no row actions.
|
|
48
|
+
*/
|
|
49
|
+
rowActions?: (row: Type) => Array<RichListRowAction<Type> | null>;
|
|
50
|
+
/**
|
|
51
|
+
* @default `"medium"`
|
|
52
|
+
*/
|
|
53
|
+
rowHeight?: number | "small" | "medium" | "large";
|
|
54
|
+
/**
|
|
55
|
+
* File name for CSV export when columns with `csvExport: true` are included.
|
|
56
|
+
* @default (omitted) no CSV download from the list toolbar.
|
|
57
|
+
*/
|
|
58
|
+
csvFilename?: string;
|
|
59
|
+
/**
|
|
60
|
+
* If the list lives in a fixed-height area, set this so the list grows to at most
|
|
61
|
+
* that height and scrolls inside instead of growing the page.
|
|
62
|
+
* @default `false`
|
|
63
|
+
*/
|
|
64
|
+
fillContainerHeight?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* List width in pixels at/under which, measured on **`RichList`’s scroll/list scope**
|
|
67
|
+
* only, the list switches to compact behavior. This is the **only** width guardrail
|
|
68
|
+
* in `RichList` — every "narrow"/"mobile" rule cascades from this one threshold.
|
|
69
|
+
*
|
|
70
|
+
* Effects at/under `compactBreakpoint`:
|
|
71
|
+
*
|
|
72
|
+
* - `compactSize` is used instead of `size` when set (slots that define it).
|
|
73
|
+
* - Slots / fields with `layoutVisibility: "whenWide"` are hidden, and `"whenCompact"`
|
|
74
|
+
* ones become visible (see `RichListLayoutVisibility`).
|
|
75
|
+
* - If no content column is visible at compact (none have `layoutVisibility` `"always"`
|
|
76
|
+
* or `"whenCompact"`), the middle **content** slot strip is hidden
|
|
77
|
+
* (`rowMainCompact`).
|
|
78
|
+
* - Main-slot `prefixOnWide` / `suffixOnWide` adornments are hidden
|
|
79
|
+
* (`rowListAtCompactBreakpoint`).
|
|
80
|
+
* - Hover-only controls become always-visible (row bulk-action checkbox lane,
|
|
81
|
+
* toolbar select-all) and toolbar button labels collapse to icons. These rules
|
|
82
|
+
* live in CSS keyed off the `data-richlist-compact` attribute that JS sets on
|
|
83
|
+
* `.richListQueryScope` from this same `isCompactContentSlots` signal.
|
|
84
|
+
* - The Display dialog's column-visibility section is hidden (no room).
|
|
85
|
+
*
|
|
86
|
+
* @default `RICH_LIST_CONTENT_COMPACT_MAX_PX` (1024); see `helpers.ts`
|
|
87
|
+
*/
|
|
88
|
+
compactBreakpoint?: number;
|
|
89
|
+
/**
|
|
90
|
+
* If `true`, users can change sort order from the Display dialog. Resets to the
|
|
91
|
+
* default are separate from the toolbar filter reset.
|
|
92
|
+
* @default `false`
|
|
93
|
+
*/
|
|
94
|
+
enableSorting?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Content when a filter or search returns no rows.
|
|
97
|
+
* @default the string `No results`
|
|
98
|
+
*/
|
|
99
|
+
emptyState?: ReactNode;
|
|
100
|
+
/**
|
|
101
|
+
* Optional block **above the toolbar** (e.g. section title). Same horizontal padding
|
|
102
|
+
* as list rows; render your own content inside a wrapper if you need extra layout.
|
|
103
|
+
* @default (omitted) no header.
|
|
104
|
+
*/
|
|
105
|
+
header?: () => ReactNode;
|
|
106
|
+
/**
|
|
107
|
+
* Set with `pathName` if you want column filters and visibility saved between visits.
|
|
108
|
+
* @default (omitted) persistence disabled.
|
|
109
|
+
*/
|
|
110
|
+
id?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Scope for saved list settings; use together with `id` so persistence is enabled.
|
|
113
|
+
* @default (omitted) persistence disabled.
|
|
114
|
+
*/
|
|
115
|
+
pathName?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Schema for validating stored list state when using `id` and `pathName`.
|
|
118
|
+
* @default (omitted) stored JSON is not parsed with Zod before use.
|
|
119
|
+
*/
|
|
120
|
+
localStorageSchema?: ZodTypeAny;
|
|
121
|
+
};
|
|
122
|
+
type NavigationProps<Type> = {
|
|
123
|
+
/**
|
|
124
|
+
* Each row’s main content zone (leading, main slot, content slots, trailing) links
|
|
125
|
+
* here. When `bulkActions` is also set, row selection uses the checkboxes only; the
|
|
126
|
+
* link covers the rest of the row (same idea as row actions not covering the whole row).
|
|
127
|
+
*/
|
|
128
|
+
href?: (row: Type) => string;
|
|
129
|
+
/**
|
|
130
|
+
* Primary bulk actions in the bar when rows are selected. Each can open a panel (the
|
|
131
|
+
* `render` on the action). Row selection is enabled when this or `secondaryBulkActions`
|
|
132
|
+
* is non-empty.
|
|
133
|
+
*/
|
|
134
|
+
bulkActions?: Array<RichListBulkAction<Type>>;
|
|
135
|
+
/**
|
|
136
|
+
* More bulk actions in the overflow area.
|
|
137
|
+
*/
|
|
138
|
+
secondaryBulkActions?: Array<RichListBulkAction<Type>>;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Public props for `RichList`. Top-level defaults match the component parameter list
|
|
142
|
+
* (`contentSlots` → `[]`, `contentAlignment` → `space-evenly`, `rowHeight` → `"medium"`,
|
|
143
|
+
* etc.). For slot/field sub-options, see `RichListMainSlot`, `RichListTextField`, `RichListSlot`, and
|
|
144
|
+
* `RichListContentSlot` in `types.ts` and `normalizeTextField` / `normalizeSlot` in
|
|
145
|
+
* `helpers.ts`.
|
|
146
|
+
*/
|
|
147
|
+
export type RichListProps<Type> = CommonProps<Type> & NavigationProps<Type>;
|
|
148
|
+
declare const RichList: <Type>({ data, getRowId, leadingSlot, mainSlot, contentSlots, contentAlignment, trailingSlot, href, rowActions, bulkActions, secondaryBulkActions, rowHeight, csvFilename, fillContainerHeight, compactBreakpoint: compactBreakpointProp, enableSorting, emptyState, id, pathName, localStorageSchema, header, }: RichListProps<Type>) => import("react/jsx-runtime").JSX.Element;
|
|
149
|
+
export default RichList;
|
|
150
|
+
export type { RichListBulkAction, RichListColumnWidthMode, RichListContentSlot, RichListLayoutVisibility, RichListMainSlot, RichListRowAction, RichListSlot, RichListSlotSize, RichListTextField, } from "./types";
|
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__floating_ui_react_dom_d5bb3c23__ from "@floating-ui/react-dom";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__react_hook_throttle_d66151d4__ from "@react-hook/throttle";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__ from "@tanstack/react-table";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_clsx__ from "clsx";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__controls_Button_js_2f50b64a__ from "../../controls/Button.js";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE__controls_FilterModal_js_c5dcd344__ from "../../controls/FilterModal.js";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_customProperties_js_3d9c174d__ from "../../utils/customProperties.js";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE__PlainText_js_6d36b5d5__ from "../PlainText.js";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__ from "./helpers.js";
|
|
13
|
+
import * as __WEBPACK_EXTERNAL_MODULE__RichList_module_js_320d4975__ from "./RichList.module.js";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE__RichListBulkActionBar_js_d46cecae__ from "./RichListBulkActionBar.js";
|
|
15
|
+
import * as __WEBPACK_EXTERNAL_MODULE__RichListDisplayModal_js_6277e838__ from "./RichListDisplayModal.js";
|
|
16
|
+
import * as __WEBPACK_EXTERNAL_MODULE__RichListRow_js_08189b13__ from "./RichListRow.js";
|
|
17
|
+
import * as __WEBPACK_EXTERNAL_MODULE__RichListToolbar_js_747b658d__ from "./RichListToolbar.js";
|
|
18
|
+
const RichList = ({ data, getRowId, leadingSlot, mainSlot, contentSlots = [], contentAlignment = "space-evenly", trailingSlot, href, rowActions, bulkActions = [], secondaryBulkActions = [], rowHeight = "medium", csvFilename, fillContainerHeight = false, compactBreakpoint: compactBreakpointProp, enableSorting = false, emptyState = "No results", id, pathName, localStorageSchema, header })=>{
|
|
19
|
+
const [searchTerm, setSearchTerm] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)("");
|
|
20
|
+
const [isFilterModalOpen, setIsFilterModalOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
21
|
+
const [isDisplayModalOpen, setIsDisplayModalOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
22
|
+
const lastSelectedRowRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(void 0);
|
|
23
|
+
const { refs, x: bulkSelectionModalXCoordinate } = (0, __WEBPACK_EXTERNAL_MODULE__floating_ui_react_dom_d5bb3c23__.useFloating)({
|
|
24
|
+
placement: "bottom",
|
|
25
|
+
whileElementsMounted: __WEBPACK_EXTERNAL_MODULE__floating_ui_react_dom_d5bb3c23__.autoUpdate
|
|
26
|
+
});
|
|
27
|
+
const listScopeRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
28
|
+
const [isCompactContentSlots, setIsCompactContentSlots] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
29
|
+
const compactBreakpointPx = compactBreakpointProp ?? __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.RICH_LIST_CONTENT_COMPACT_MAX_PX;
|
|
30
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect)(()=>{
|
|
31
|
+
const el = listScopeRef.current;
|
|
32
|
+
if (!el) return;
|
|
33
|
+
const update = ()=>{
|
|
34
|
+
const w = el.clientWidth;
|
|
35
|
+
setIsCompactContentSlots(w > 0 && w <= compactBreakpointPx);
|
|
36
|
+
};
|
|
37
|
+
update();
|
|
38
|
+
const ro = new ResizeObserver(update);
|
|
39
|
+
ro.observe(el);
|
|
40
|
+
return ()=>ro.disconnect();
|
|
41
|
+
}, [
|
|
42
|
+
compactBreakpointPx
|
|
43
|
+
]);
|
|
44
|
+
const enableRowSelection = bulkActions.length + secondaryBulkActions.length > 0;
|
|
45
|
+
const normalizedPrimary = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>(0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.normalizeTextField)(mainSlot.primary, "primary"), [
|
|
46
|
+
mainSlot.primary
|
|
47
|
+
]);
|
|
48
|
+
const normalizedSecondary = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>mainSlot.secondary ? (0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.normalizeTextField)(mainSlot.secondary, "secondary") : null, [
|
|
49
|
+
mainSlot.secondary
|
|
50
|
+
]);
|
|
51
|
+
const normalizedLeadingSlots = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
52
|
+
const arr = Array.isArray(leadingSlot) ? leadingSlot : void 0 !== leadingSlot ? [
|
|
53
|
+
leadingSlot
|
|
54
|
+
] : [];
|
|
55
|
+
return arr.map((slot, index)=>(0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.normalizeSlot)(slot, "leading", index));
|
|
56
|
+
}, [
|
|
57
|
+
leadingSlot
|
|
58
|
+
]);
|
|
59
|
+
const normalizedContentSlots = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>contentSlots.map((slot, index)=>(0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.normalizeSlot)(slot, "content", index)), [
|
|
60
|
+
contentSlots
|
|
61
|
+
]);
|
|
62
|
+
const normalizedTrailingSlots = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
63
|
+
const arr = Array.isArray(trailingSlot) ? trailingSlot : void 0 !== trailingSlot ? [
|
|
64
|
+
trailingSlot
|
|
65
|
+
] : [];
|
|
66
|
+
return arr.map((slot, index)=>(0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.normalizeSlot)(slot, "trailing", index));
|
|
67
|
+
}, [
|
|
68
|
+
trailingSlot
|
|
69
|
+
]);
|
|
70
|
+
const rowMainHidesContentSlotColumns = isCompactContentSlots && !normalizedContentSlots.some((s)=>(0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.isVisibleAtBreakpoint)(s.layoutVisibility, true));
|
|
71
|
+
const allEntries = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>[
|
|
72
|
+
...normalizedLeadingSlots,
|
|
73
|
+
normalizedPrimary,
|
|
74
|
+
normalizedSecondary,
|
|
75
|
+
...normalizedContentSlots,
|
|
76
|
+
...normalizedTrailingSlots
|
|
77
|
+
], [
|
|
78
|
+
normalizedLeadingSlots,
|
|
79
|
+
normalizedPrimary,
|
|
80
|
+
normalizedSecondary,
|
|
81
|
+
normalizedContentSlots,
|
|
82
|
+
normalizedTrailingSlots
|
|
83
|
+
]);
|
|
84
|
+
const entriesWithFilter = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>allEntries.filter((e)=>null !== e && void 0 !== e.filter && e.filter.options.length > 0), [
|
|
85
|
+
allEntries
|
|
86
|
+
]);
|
|
87
|
+
const entriesWithGlobalFilter = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>allEntries.filter((e)=>null !== e && e.globalFiltering && void 0 !== e.value), [
|
|
88
|
+
allEntries
|
|
89
|
+
]);
|
|
90
|
+
const entriesWithCsvExport = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>allEntries.filter((e)=>null !== e && e.csvExport), [
|
|
91
|
+
allEntries
|
|
92
|
+
]);
|
|
93
|
+
const csvExportColumns = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>entriesWithCsvExport.filter((e)=>void 0 !== e.value).map((entry)=>({
|
|
94
|
+
id: entry.id,
|
|
95
|
+
header: entry.label ?? entry.id
|
|
96
|
+
})), [
|
|
97
|
+
entriesWithCsvExport
|
|
98
|
+
]);
|
|
99
|
+
const toggleableContentSlots = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>allEntries.filter((e)=>(0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.isToggleableContentColumn)(e)), [
|
|
100
|
+
allEntries
|
|
101
|
+
]);
|
|
102
|
+
const sortableEntries = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>allEntries.filter((e)=>null !== e && void 0 !== e.value), [
|
|
103
|
+
allEntries
|
|
104
|
+
]);
|
|
105
|
+
const columnDefs = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
106
|
+
const columnHelper = (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.createColumnHelper)();
|
|
107
|
+
const columns = allEntries.filter((e)=>null !== e).map((entry)=>{
|
|
108
|
+
if (void 0 === entry.value) return columnHelper.display({
|
|
109
|
+
id: entry.id,
|
|
110
|
+
cell: ({ row })=>entry.render(row.original),
|
|
111
|
+
enableHiding: (0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.isColumnWithVisibilityState)(entry),
|
|
112
|
+
enableGlobalFilter: false,
|
|
113
|
+
enableColumnFilter: void 0 !== entry.filter
|
|
114
|
+
});
|
|
115
|
+
const value = entry.value;
|
|
116
|
+
return columnHelper.accessor((row)=>value(row), {
|
|
117
|
+
id: entry.id,
|
|
118
|
+
cell: ({ row })=>entry.render(row.original),
|
|
119
|
+
enableHiding: (0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.isColumnWithVisibilityState)(entry),
|
|
120
|
+
enableGlobalFilter: entry.globalFiltering,
|
|
121
|
+
...enableSorting ? {
|
|
122
|
+
enableSorting: true,
|
|
123
|
+
sortUndefined: 1
|
|
124
|
+
} : {
|
|
125
|
+
enableSorting: false
|
|
126
|
+
},
|
|
127
|
+
filterFn: entry.filter ? (row, _columnId, filterValue)=>{
|
|
128
|
+
const filter = entry.filter;
|
|
129
|
+
if (!filter) return true;
|
|
130
|
+
if (filter.isMulti && Array.isArray(filterValue)) {
|
|
131
|
+
if (0 === filterValue.length) return true;
|
|
132
|
+
return filterValue.some((optionId)=>{
|
|
133
|
+
const option = filter.options.find((opt)=>opt.id === optionId);
|
|
134
|
+
return option ? option.predicate(row.original) : false;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
if (!filter.isMulti && "string" == typeof filterValue) {
|
|
138
|
+
const option = filter.options.find((opt)=>opt.id === filterValue);
|
|
139
|
+
return option?.predicate?.(row.original) ?? true;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
} : void 0
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
const selectColumn = enableRowSelection ? columnHelper.display({
|
|
146
|
+
id: __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.SELECT_COLUMN_ID,
|
|
147
|
+
enableHiding: false
|
|
148
|
+
}) : void 0;
|
|
149
|
+
return selectColumn ? [
|
|
150
|
+
selectColumn,
|
|
151
|
+
...columns
|
|
152
|
+
] : columns;
|
|
153
|
+
}, [
|
|
154
|
+
allEntries,
|
|
155
|
+
enableRowSelection,
|
|
156
|
+
enableSorting
|
|
157
|
+
]);
|
|
158
|
+
const columnFiltersInitialState = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>entriesWithFilter.map((entry)=>{
|
|
159
|
+
const filter = entry.filter;
|
|
160
|
+
if (filter.isMulti) return {
|
|
161
|
+
id: entry.id,
|
|
162
|
+
value: []
|
|
163
|
+
};
|
|
164
|
+
return {
|
|
165
|
+
id: entry.id,
|
|
166
|
+
value: filter.options[0].id
|
|
167
|
+
};
|
|
168
|
+
}), [
|
|
169
|
+
entriesWithFilter
|
|
170
|
+
]);
|
|
171
|
+
const storageKey = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>pathName && id ? `${pathName}#${id}_richList` : null, [
|
|
172
|
+
pathName,
|
|
173
|
+
id
|
|
174
|
+
]);
|
|
175
|
+
const localStorageData = "undefined" != typeof window && storageKey ? window.localStorage.getItem(storageKey) : null;
|
|
176
|
+
let parsedLocalStorage = {};
|
|
177
|
+
if (localStorageData && localStorageSchema) try {
|
|
178
|
+
parsedLocalStorage = JSON.parse(localStorageData);
|
|
179
|
+
localStorageSchema.parse(parsedLocalStorage);
|
|
180
|
+
} catch (error) {
|
|
181
|
+
console.error("Error parsing localStorage data:", error);
|
|
182
|
+
parsedLocalStorage = {};
|
|
183
|
+
}
|
|
184
|
+
const permanentlyHiddenColumnIds = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>new Set(allEntries.filter((e)=>null !== e && "canToggleVisibility" in e && e.hiddenByDefault && !e.canToggleVisibility).map((e)=>e.id)), [
|
|
185
|
+
allEntries
|
|
186
|
+
]);
|
|
187
|
+
const columnVisibilityDefaultForHiddenByDefault = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Object.fromEntries(allEntries.filter((e)=>null !== e && "canToggleVisibility" in e && e.hiddenByDefault).map((e)=>[
|
|
188
|
+
e.id,
|
|
189
|
+
false
|
|
190
|
+
])), [
|
|
191
|
+
allEntries
|
|
192
|
+
]);
|
|
193
|
+
const initialColumnVisibility = (()=>{
|
|
194
|
+
const base = columnVisibilityDefaultForHiddenByDefault;
|
|
195
|
+
const saved = parsedLocalStorage.columnVisibility;
|
|
196
|
+
if (!saved) return base;
|
|
197
|
+
const next = {
|
|
198
|
+
...base,
|
|
199
|
+
...saved
|
|
200
|
+
};
|
|
201
|
+
for (const id of permanentlyHiddenColumnIds)next[id] = false;
|
|
202
|
+
return next;
|
|
203
|
+
})();
|
|
204
|
+
const isRowSelectable = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((row)=>{
|
|
205
|
+
const all = [
|
|
206
|
+
...bulkActions,
|
|
207
|
+
...secondaryBulkActions
|
|
208
|
+
];
|
|
209
|
+
return all.some((action)=>!action.predicate || action.predicate(row.original));
|
|
210
|
+
}, [
|
|
211
|
+
bulkActions,
|
|
212
|
+
secondaryBulkActions
|
|
213
|
+
]);
|
|
214
|
+
const table = (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.useReactTable)({
|
|
215
|
+
data,
|
|
216
|
+
columns: columnDefs,
|
|
217
|
+
getRowId,
|
|
218
|
+
getCoreRowModel: (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.getCoreRowModel)(),
|
|
219
|
+
getFilteredRowModel: (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.getFilteredRowModel)(),
|
|
220
|
+
...enableSorting ? {
|
|
221
|
+
getSortedRowModel: (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.getSortedRowModel)()
|
|
222
|
+
} : {},
|
|
223
|
+
getColumnCanGlobalFilter: ()=>true,
|
|
224
|
+
enableRowSelection: enableRowSelection ? isRowSelectable : false,
|
|
225
|
+
initialState: {
|
|
226
|
+
columnFilters: parsedLocalStorage.columnFilters ?? columnFiltersInitialState,
|
|
227
|
+
columnVisibility: initialColumnVisibility,
|
|
228
|
+
globalFilter: "",
|
|
229
|
+
sorting: parsedLocalStorage.sorting ?? []
|
|
230
|
+
},
|
|
231
|
+
defaultColumn: {
|
|
232
|
+
enableColumnFilter: false,
|
|
233
|
+
enableGlobalFilter: false,
|
|
234
|
+
enableSorting: false
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect)(()=>{
|
|
238
|
+
if (0 === permanentlyHiddenColumnIds.size) return;
|
|
239
|
+
let anyVisible = false;
|
|
240
|
+
const next = {};
|
|
241
|
+
for (const id of permanentlyHiddenColumnIds)if (table.getColumn(id)?.getIsVisible()) {
|
|
242
|
+
anyVisible = true;
|
|
243
|
+
next[id] = false;
|
|
244
|
+
}
|
|
245
|
+
if (anyVisible) table.setColumnVisibility((prev)=>({
|
|
246
|
+
...prev,
|
|
247
|
+
...next
|
|
248
|
+
}));
|
|
249
|
+
}, [
|
|
250
|
+
permanentlyHiddenColumnIds,
|
|
251
|
+
table
|
|
252
|
+
]);
|
|
253
|
+
const tableState = table.getState();
|
|
254
|
+
const rows = table.getRowModel().rows;
|
|
255
|
+
const filteredSelectedRows = table.getFilteredSelectedRowModel();
|
|
256
|
+
const throttledSetGlobalFilter = (0, __WEBPACK_EXTERNAL_MODULE__react_hook_throttle_d66151d4__.useThrottleCallback)((value)=>table.setGlobalFilter(value), 4);
|
|
257
|
+
const activeFilterCount = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
258
|
+
const currentFilters = tableState.columnFilters;
|
|
259
|
+
return columnFiltersInitialState.filter((initialFilter)=>{
|
|
260
|
+
const currentFilter = currentFilters.find((f)=>f.id === initialFilter.id);
|
|
261
|
+
const currentValue = currentFilter?.value;
|
|
262
|
+
const initialValue = initialFilter.value;
|
|
263
|
+
if (Array.isArray(initialValue) && Array.isArray(currentValue)) return currentValue.length !== initialValue.length || initialValue.some((v, i)=>v !== currentValue[i]);
|
|
264
|
+
return currentValue !== initialValue;
|
|
265
|
+
}).length;
|
|
266
|
+
}, [
|
|
267
|
+
tableState.columnFilters,
|
|
268
|
+
columnFiltersInitialState
|
|
269
|
+
]);
|
|
270
|
+
const showSearchReset = activeFilterCount > 0 || "" !== tableState.globalFilter;
|
|
271
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
272
|
+
if (storageKey) window.localStorage.setItem(storageKey, JSON.stringify({
|
|
273
|
+
columnFilters: tableState.columnFilters,
|
|
274
|
+
columnVisibility: tableState.columnVisibility,
|
|
275
|
+
sorting: tableState.sorting
|
|
276
|
+
}));
|
|
277
|
+
}, [
|
|
278
|
+
tableState.columnFilters,
|
|
279
|
+
tableState.columnVisibility,
|
|
280
|
+
tableState.sorting,
|
|
281
|
+
storageKey
|
|
282
|
+
]);
|
|
283
|
+
const validPrimaryBulkActions = bulkActions.filter((bulkAction)=>filteredSelectedRows.rows.some((row)=>bulkAction.predicate ? bulkAction.predicate(row.original) : true));
|
|
284
|
+
const validSecondaryBulkActions = secondaryBulkActions.filter((bulkAction)=>filteredSelectedRows.rows.some((row)=>bulkAction.predicate ? bulkAction.predicate(row.original) : true));
|
|
285
|
+
const shouldShowCsvExport = csvExportColumns.length > 0 && Boolean(csvFilename);
|
|
286
|
+
const getBulkActionRows = (bulkAction)=>filteredSelectedRows.flatRows.filter((row)=>bulkAction.predicate ? bulkAction.predicate(row.original) : true).map((row)=>row.original);
|
|
287
|
+
const primaryBulkActionRowsMap = new Map(validPrimaryBulkActions.map((bulkAction)=>[
|
|
288
|
+
bulkAction.key,
|
|
289
|
+
getBulkActionRows(bulkAction)
|
|
290
|
+
]));
|
|
291
|
+
const secondaryBulkActionRowsMap = new Map(validSecondaryBulkActions.map((bulkAction)=>[
|
|
292
|
+
bulkAction.key,
|
|
293
|
+
getBulkActionRows(bulkAction)
|
|
294
|
+
]));
|
|
295
|
+
const allBulkActionRowCounts = [
|
|
296
|
+
...Array.from(primaryBulkActionRowsMap.values()).map((xs)=>xs.length),
|
|
297
|
+
...Array.from(secondaryBulkActionRowsMap.values()).map((xs)=>xs.length)
|
|
298
|
+
];
|
|
299
|
+
const bulkActionRowCountsDiffer = new Set(allBulkActionRowCounts).size > 1;
|
|
300
|
+
const hasMultipleActions = allBulkActionRowCounts.length > 1;
|
|
301
|
+
const allRowsCanDoAllActions = hasMultipleActions && allBulkActionRowCounts.every((count)=>count === filteredSelectedRows.rows.length);
|
|
302
|
+
const showBulkActionCounts = bulkActionRowCountsDiffer || hasMultipleActions && !allRowsCanDoAllActions;
|
|
303
|
+
const resolvedRowHeightPx = "number" == typeof rowHeight ? rowHeight : __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.ROW_HEIGHT_PRESETS[rowHeight];
|
|
304
|
+
const listRootStyle = (0, __WEBPACK_EXTERNAL_MODULE__utils_customProperties_js_3d9c174d__["default"])({
|
|
305
|
+
"--row-height": `${resolvedRowHeightPx}px`,
|
|
306
|
+
"--richlist-padding-inline": `${(0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.richListInlinePaddingPx)(rowHeight)}px`
|
|
307
|
+
});
|
|
308
|
+
const showDisplayForColumnVisibility = !isCompactContentSlots && toggleableContentSlots.length > 0;
|
|
309
|
+
const showDisplayButton = enableSorting && sortableEntries.length > 0 || showDisplayForColumnVisibility;
|
|
310
|
+
const defaultDisplayColumnVisibility = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>Object.fromEntries(toggleableContentSlots.map((entry)=>[
|
|
311
|
+
entry.id,
|
|
312
|
+
!("hiddenByDefault" in entry && entry.hiddenByDefault)
|
|
313
|
+
])), [
|
|
314
|
+
toggleableContentSlots
|
|
315
|
+
]);
|
|
316
|
+
const sortableColumnsForModal = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>sortableEntries.map((entry)=>({
|
|
317
|
+
id: entry.id,
|
|
318
|
+
label: entry.label ?? entry.id
|
|
319
|
+
})), [
|
|
320
|
+
sortableEntries
|
|
321
|
+
]);
|
|
322
|
+
const displayColumnsForModal = toggleableContentSlots.map((entry)=>({
|
|
323
|
+
id: entry.id,
|
|
324
|
+
label: entry.label ?? entry.id,
|
|
325
|
+
visible: table.getColumn(entry.id)?.getIsVisible() ?? true,
|
|
326
|
+
defaultVisible: !("hiddenByDefault" in entry && entry.hiddenByDefault)
|
|
327
|
+
}));
|
|
328
|
+
const displayColumnsForDisplayModal = isCompactContentSlots ? [] : displayColumnsForModal;
|
|
329
|
+
const displayActiveCount = (0, __WEBPACK_EXTERNAL_MODULE__RichListDisplayModal_js_6277e838__.getDisplayFormActiveExpanderCount)(enableSorting && sortableEntries.length > 0, tableState.sorting, displayColumnsForDisplayModal);
|
|
330
|
+
const hasToolbar = enableRowSelection || entriesWithGlobalFilter.length > 0 || entriesWithFilter.length > 0 || showDisplayButton || shouldShowCsvExport;
|
|
331
|
+
const actionsByRowId = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
332
|
+
const map = new Map();
|
|
333
|
+
if (!rowActions) return map;
|
|
334
|
+
for (const row of data){
|
|
335
|
+
const resolved = rowActions(row).filter((a)=>null !== a).filter((a)=>!a.predicate || a.predicate(row));
|
|
336
|
+
map.set(getRowId(row), resolved);
|
|
337
|
+
}
|
|
338
|
+
return map;
|
|
339
|
+
}, [
|
|
340
|
+
data,
|
|
341
|
+
rowActions,
|
|
342
|
+
getRowId
|
|
343
|
+
]);
|
|
344
|
+
const maxAlwaysVisibleActions = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
345
|
+
let max = 0;
|
|
346
|
+
for (const actions of actionsByRowId.values()){
|
|
347
|
+
const count = actions.filter((a)=>a.alwaysVisible).length;
|
|
348
|
+
if (count > max) max = count;
|
|
349
|
+
}
|
|
350
|
+
return max;
|
|
351
|
+
}, [
|
|
352
|
+
actionsByRowId
|
|
353
|
+
]);
|
|
354
|
+
const anyRowHasOverflowAction = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
355
|
+
for (const actions of actionsByRowId.values())if (actions.some((a)=>!a.alwaysVisible)) return true;
|
|
356
|
+
return false;
|
|
357
|
+
}, [
|
|
358
|
+
actionsByRowId
|
|
359
|
+
]);
|
|
360
|
+
const filterableColumnsForModal = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>entriesWithFilter.map((entry)=>({
|
|
361
|
+
id: entry.id,
|
|
362
|
+
filter: entry.filter
|
|
363
|
+
})), [
|
|
364
|
+
entriesWithFilter
|
|
365
|
+
]);
|
|
366
|
+
const showBulkBar = validPrimaryBulkActions.length > 0 || validSecondaryBulkActions.length > 0;
|
|
367
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
|
|
368
|
+
children: [
|
|
369
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
370
|
+
ref: refs.setReference,
|
|
371
|
+
className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__RichList_module_js_320d4975__["default"].root, fillContainerHeight && __WEBPACK_EXTERNAL_MODULE__RichList_module_js_320d4975__["default"].rootFillHeight),
|
|
372
|
+
style: listRootStyle,
|
|
373
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
374
|
+
ref: listScopeRef,
|
|
375
|
+
className: __WEBPACK_EXTERNAL_MODULE__RichList_module_js_320d4975__["default"].richListQueryScope,
|
|
376
|
+
"data-richlist-compact": isCompactContentSlots ? "" : void 0,
|
|
377
|
+
children: [
|
|
378
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
379
|
+
className: __WEBPACK_EXTERNAL_MODULE__RichList_module_js_320d4975__["default"].richListHead,
|
|
380
|
+
children: [
|
|
381
|
+
showBulkBar ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__RichListBulkActionBar_js_d46cecae__["default"], {
|
|
382
|
+
table: table,
|
|
383
|
+
floatingRef: refs.setFloating,
|
|
384
|
+
leftCoordinate: bulkSelectionModalXCoordinate,
|
|
385
|
+
selectedCount: filteredSelectedRows.rows.length,
|
|
386
|
+
primaryBulkActions: validPrimaryBulkActions,
|
|
387
|
+
secondaryBulkActions: validSecondaryBulkActions,
|
|
388
|
+
primaryBulkActionRowsMap: primaryBulkActionRowsMap,
|
|
389
|
+
secondaryBulkActionRowsMap: secondaryBulkActionRowsMap,
|
|
390
|
+
showBulkActionCounts: showBulkActionCounts,
|
|
391
|
+
csvExportColumns: csvExportColumns,
|
|
392
|
+
csvFilename: csvFilename
|
|
393
|
+
}) : null,
|
|
394
|
+
header ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
395
|
+
className: __WEBPACK_EXTERNAL_MODULE__RichList_module_js_320d4975__["default"].listHeader,
|
|
396
|
+
children: header()
|
|
397
|
+
}) : null,
|
|
398
|
+
hasToolbar ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__RichListToolbar_js_747b658d__["default"], {
|
|
399
|
+
hasGlobalSearch: entriesWithGlobalFilter.length > 0,
|
|
400
|
+
searchTerm: searchTerm,
|
|
401
|
+
onSearchTermChange: (value)=>{
|
|
402
|
+
setSearchTerm(value);
|
|
403
|
+
throttledSetGlobalFilter(value);
|
|
404
|
+
},
|
|
405
|
+
hasFilters: entriesWithFilter.length > 0,
|
|
406
|
+
activeFilterCount: activeFilterCount,
|
|
407
|
+
onOpenFilterModal: ()=>setIsFilterModalOpen(true),
|
|
408
|
+
showDisplay: showDisplayButton,
|
|
409
|
+
onOpenDisplayModal: ()=>setIsDisplayModalOpen(true),
|
|
410
|
+
displayActiveCount: displayActiveCount,
|
|
411
|
+
showCsvExport: shouldShowCsvExport && Boolean(csvFilename),
|
|
412
|
+
onDownloadCsv: ()=>(0, __WEBPACK_EXTERNAL_MODULE__helpers_js_87289b43__.handleDownloadCsv)(csvFilename, csvExportColumns, table.getRowModel().rows),
|
|
413
|
+
showSelectAll: enableRowSelection,
|
|
414
|
+
selectAllAllSelected: table.getIsAllRowsSelected(),
|
|
415
|
+
selectAllSomeSelected: table.getIsSomeRowsSelected(),
|
|
416
|
+
selectAllDisabled: 0 === table.getRowModel().rows.filter((r)=>r.getCanSelect()).length,
|
|
417
|
+
onSelectAllChange: ()=>{
|
|
418
|
+
const all = table.getIsAllRowsSelected();
|
|
419
|
+
const some = table.getIsSomeRowsSelected();
|
|
420
|
+
table.toggleAllRowsSelected(!(all || some));
|
|
421
|
+
}
|
|
422
|
+
}) : null,
|
|
423
|
+
showSearchReset ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
424
|
+
className: __WEBPACK_EXTERNAL_MODULE__RichList_module_js_320d4975__["default"].toolbarStatus,
|
|
425
|
+
children: [
|
|
426
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_6d36b5d5__["default"], {
|
|
427
|
+
font: "small",
|
|
428
|
+
tone: "muted",
|
|
429
|
+
children: [
|
|
430
|
+
"Showing ",
|
|
431
|
+
table.getFilteredRowModel().flatRows.length,
|
|
432
|
+
" of",
|
|
433
|
+
" ",
|
|
434
|
+
table.getPreFilteredRowModel().flatRows.length
|
|
435
|
+
]
|
|
436
|
+
}),
|
|
437
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_Button_js_2f50b64a__["default"], {
|
|
438
|
+
onClick: ()=>{
|
|
439
|
+
table.setColumnFilters(columnFiltersInitialState);
|
|
440
|
+
table.resetGlobalFilter();
|
|
441
|
+
setSearchTerm("");
|
|
442
|
+
},
|
|
443
|
+
type: "secondary",
|
|
444
|
+
size: "small",
|
|
445
|
+
children: "Reset"
|
|
446
|
+
})
|
|
447
|
+
]
|
|
448
|
+
}) : null
|
|
449
|
+
]
|
|
450
|
+
}),
|
|
451
|
+
rows.length > 0 ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("ul", {
|
|
452
|
+
className: __WEBPACK_EXTERNAL_MODULE__RichList_module_js_320d4975__["default"].list,
|
|
453
|
+
children: rows.map((row)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__RichListRow_js_08189b13__["default"], {
|
|
454
|
+
row: row,
|
|
455
|
+
table: table,
|
|
456
|
+
enableRowSelection: enableRowSelection,
|
|
457
|
+
href: href,
|
|
458
|
+
normalizedLeadingSlots: normalizedLeadingSlots,
|
|
459
|
+
normalizedPrimary: normalizedPrimary,
|
|
460
|
+
normalizedSecondary: normalizedSecondary,
|
|
461
|
+
mainSlotMaxWidthPx: mainSlot.size,
|
|
462
|
+
normalizedContentSlots: normalizedContentSlots,
|
|
463
|
+
normalizedTrailingSlots: normalizedTrailingSlots,
|
|
464
|
+
isCompactContentSlots: isCompactContentSlots,
|
|
465
|
+
rowMainHidesContentSlotColumns: rowMainHidesContentSlotColumns,
|
|
466
|
+
contentSlotsJustifyContent: contentAlignment,
|
|
467
|
+
actionsForRow: actionsByRowId.get(row.id) ?? [],
|
|
468
|
+
maxAlwaysVisibleActions: maxAlwaysVisibleActions,
|
|
469
|
+
anyRowHasOverflowAction: anyRowHasOverflowAction,
|
|
470
|
+
lastSelectedRowRef: lastSelectedRowRef
|
|
471
|
+
}, row.id))
|
|
472
|
+
}) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
473
|
+
className: __WEBPACK_EXTERNAL_MODULE__RichList_module_js_320d4975__["default"].emptyState,
|
|
474
|
+
children: emptyState
|
|
475
|
+
})
|
|
476
|
+
]
|
|
477
|
+
})
|
|
478
|
+
}),
|
|
479
|
+
isFilterModalOpen && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_FilterModal_js_c5dcd344__["default"], {
|
|
480
|
+
onClose: ()=>setIsFilterModalOpen(false),
|
|
481
|
+
filterableColumns: filterableColumnsForModal,
|
|
482
|
+
currentFilters: tableState.columnFilters,
|
|
483
|
+
onFiltersChange: (filters)=>table.setColumnFilters(filters)
|
|
484
|
+
}),
|
|
485
|
+
isDisplayModalOpen && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__RichListDisplayModal_js_6277e838__["default"], {
|
|
486
|
+
onClose: ()=>setIsDisplayModalOpen(false),
|
|
487
|
+
sortableColumns: enableSorting ? sortableColumnsForModal : [],
|
|
488
|
+
currentSorting: tableState.sorting,
|
|
489
|
+
onApplySorting: (sorting)=>table.setSorting(sorting),
|
|
490
|
+
displayColumns: displayColumnsForDisplayModal,
|
|
491
|
+
onApplyColumnVisibility: (vis)=>{
|
|
492
|
+
table.setColumnVisibility((prev)=>{
|
|
493
|
+
const next = {
|
|
494
|
+
...prev
|
|
495
|
+
};
|
|
496
|
+
for (const [id, visible] of Object.entries(vis))next[id] = visible;
|
|
497
|
+
return next;
|
|
498
|
+
});
|
|
499
|
+
},
|
|
500
|
+
defaultSorting: [],
|
|
501
|
+
defaultColumnVisibility: defaultDisplayColumnVisibility
|
|
502
|
+
})
|
|
503
|
+
]
|
|
504
|
+
});
|
|
505
|
+
};
|
|
506
|
+
const RichList_rslib_entry_ = RichList;
|
|
507
|
+
export { RichList_rslib_entry_ as default };
|