@worknice/whiteboard 0.20.0 → 0.21.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.
|
@@ -36,14 +36,21 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
|
|
|
36
36
|
})), [
|
|
37
37
|
"label"
|
|
38
38
|
], searchTerm) : nonNullOptions;
|
|
39
|
+
const filteredIndexById = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
40
|
+
const map = new Map();
|
|
41
|
+
filteredOptions.forEach((option, index)=>{
|
|
42
|
+
map.set(option.id, index);
|
|
43
|
+
});
|
|
44
|
+
return map;
|
|
45
|
+
}, [
|
|
46
|
+
filteredOptions
|
|
47
|
+
]);
|
|
39
48
|
const { refs: floatingUiRefs, floatingStyles, context } = (0, __WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__.useFloating)({
|
|
40
49
|
open: isOpen,
|
|
41
50
|
onOpenChange: (open)=>{
|
|
42
51
|
setIsOpen(open);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
setSearchTerm("");
|
|
46
|
-
}
|
|
52
|
+
setActiveIndex(null);
|
|
53
|
+
setSearchTerm("");
|
|
47
54
|
},
|
|
48
55
|
whileElementsMounted: __WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__.autoUpdate,
|
|
49
56
|
placement: "bottom-start",
|
|
@@ -72,6 +79,44 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
|
|
|
72
79
|
dismiss,
|
|
73
80
|
listNav
|
|
74
81
|
]);
|
|
82
|
+
const triggerOption = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(async (option, index, event, syntheticEvent)=>{
|
|
83
|
+
if (option.disabled) return;
|
|
84
|
+
if ("link" === option.type) {
|
|
85
|
+
const anchor = optionsRef.current[index]?.querySelector("a");
|
|
86
|
+
if (anchor instanceof HTMLElement) {
|
|
87
|
+
anchor.click();
|
|
88
|
+
setIsOpen(false);
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if ("onClick" === option.type) {
|
|
93
|
+
setIsOpen(false);
|
|
94
|
+
try {
|
|
95
|
+
setLoading(true);
|
|
96
|
+
await option.onClick(event ?? syntheticEvent);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (error instanceof __WEBPACK_EXTERNAL_MODULE__forms_FormError_js_7d98929f__["default"]) setErrors(error.validationErrors);
|
|
99
|
+
else error instanceof Error ? setErrors([
|
|
100
|
+
{
|
|
101
|
+
id: (0, __WEBPACK_EXTERNAL_MODULE_uuid__.v4)(),
|
|
102
|
+
message: error.message
|
|
103
|
+
}
|
|
104
|
+
]) : setErrors([
|
|
105
|
+
{
|
|
106
|
+
id: (0, __WEBPACK_EXTERNAL_MODULE_uuid__.v4)(),
|
|
107
|
+
message: "Unknown error."
|
|
108
|
+
}
|
|
109
|
+
]);
|
|
110
|
+
} finally{
|
|
111
|
+
setLoading(false);
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if ("render" === option.type) {
|
|
116
|
+
setIsOpen(false);
|
|
117
|
+
setOptionToRender(option);
|
|
118
|
+
}
|
|
119
|
+
}, []);
|
|
75
120
|
const renderOption = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((option, index)=>{
|
|
76
121
|
if ("link" === option.type) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("li", {
|
|
77
122
|
role: "option",
|
|
@@ -99,29 +144,8 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
|
|
|
99
144
|
[__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].disabled]: option.disabled
|
|
100
145
|
}),
|
|
101
146
|
...getItemProps({
|
|
102
|
-
onClick:
|
|
103
|
-
|
|
104
|
-
setOptionToRender(option);
|
|
105
|
-
} : async (event)=>{
|
|
106
|
-
setIsOpen(false);
|
|
107
|
-
try {
|
|
108
|
-
setLoading(true);
|
|
109
|
-
await option.onClick(event);
|
|
110
|
-
} catch (error) {
|
|
111
|
-
if (error instanceof __WEBPACK_EXTERNAL_MODULE__forms_FormError_js_7d98929f__["default"]) setErrors(error.validationErrors);
|
|
112
|
-
else error instanceof Error ? setErrors([
|
|
113
|
-
{
|
|
114
|
-
id: (0, __WEBPACK_EXTERNAL_MODULE_uuid__.v4)(),
|
|
115
|
-
message: error.message
|
|
116
|
-
}
|
|
117
|
-
]) : setErrors([
|
|
118
|
-
{
|
|
119
|
-
id: (0, __WEBPACK_EXTERNAL_MODULE_uuid__.v4)(),
|
|
120
|
-
message: "Unknown error."
|
|
121
|
-
}
|
|
122
|
-
]);
|
|
123
|
-
}
|
|
124
|
-
setLoading(false);
|
|
147
|
+
onClick: (event)=>{
|
|
148
|
+
triggerOption(option, index, event);
|
|
125
149
|
},
|
|
126
150
|
ref: (node)=>{
|
|
127
151
|
optionsRef.current[index] = node;
|
|
@@ -135,8 +159,19 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
|
|
|
135
159
|
optionsRef,
|
|
136
160
|
NextLink
|
|
137
161
|
]);
|
|
162
|
+
const triggerOptionAtIndex = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((index)=>{
|
|
163
|
+
if (null == index) return;
|
|
164
|
+
const option = filteredOptions[index];
|
|
165
|
+
if (!option || option.disabled) return;
|
|
166
|
+
triggerOption(option, index, void 0, new KeyboardEvent("keydown", {
|
|
167
|
+
key: "Enter"
|
|
168
|
+
}));
|
|
169
|
+
}, [
|
|
170
|
+
filteredOptions,
|
|
171
|
+
triggerOption
|
|
172
|
+
]);
|
|
138
173
|
const renderOptions = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
|
|
139
|
-
if (options) return filteredOptions.map(renderOption);
|
|
174
|
+
if (options) return filteredOptions.map((option, index)=>renderOption(option, index));
|
|
140
175
|
return optionGroups.map((group)=>{
|
|
141
176
|
if (0 === group.options.length) return null;
|
|
142
177
|
const groupOptionIds = new Set(group.options.map((o)=>o?.id));
|
|
@@ -155,7 +190,8 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
|
|
|
155
190
|
role: "group",
|
|
156
191
|
"aria-labelledby": headerId,
|
|
157
192
|
children: filteredGroupOptions.map((option)=>{
|
|
158
|
-
const optionIndex =
|
|
193
|
+
const optionIndex = filteredIndexById.get(option.id);
|
|
194
|
+
if (null == optionIndex) return null;
|
|
159
195
|
return renderOption(option, optionIndex);
|
|
160
196
|
})
|
|
161
197
|
})
|
|
@@ -167,7 +203,8 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
|
|
|
167
203
|
optionGroups,
|
|
168
204
|
options,
|
|
169
205
|
renderOption,
|
|
170
|
-
listboxId
|
|
206
|
+
listboxId,
|
|
207
|
+
filteredIndexById
|
|
171
208
|
]);
|
|
172
209
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
|
|
173
210
|
children: [
|
|
@@ -210,7 +247,14 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
|
|
|
210
247
|
ref: floatingUiRefs.setFloating,
|
|
211
248
|
style: floatingStyles,
|
|
212
249
|
className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].menu),
|
|
213
|
-
...getFloatingProps(
|
|
250
|
+
...getFloatingProps({
|
|
251
|
+
onKeyDown: (event)=>{
|
|
252
|
+
if ("Enter" === event.key && null != activeIndex) {
|
|
253
|
+
event.preventDefault();
|
|
254
|
+
triggerOptionAtIndex(activeIndex);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}),
|
|
214
258
|
children: [
|
|
215
259
|
displaySearch ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("input", {
|
|
216
260
|
type: "text",
|
|
@@ -222,10 +266,7 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
|
|
|
222
266
|
setActiveIndex(0);
|
|
223
267
|
},
|
|
224
268
|
value: searchTerm,
|
|
225
|
-
ref: searchRef
|
|
226
|
-
onKeyDown: (event)=>{
|
|
227
|
-
if ("Enter" === event.key && null != activeIndex) setIsOpen(false);
|
|
228
|
-
}
|
|
269
|
+
ref: searchRef
|
|
229
270
|
}) : null,
|
|
230
271
|
0 !== filteredOptions.length ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("ul", {
|
|
231
272
|
className: __WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].listBox,
|
|
@@ -29,10 +29,8 @@ const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, on
|
|
|
29
29
|
open: isOpen,
|
|
30
30
|
onOpenChange: (open)=>{
|
|
31
31
|
setIsOpen(open);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
setSearchTerm("");
|
|
35
|
-
}
|
|
32
|
+
setActiveIndex(0);
|
|
33
|
+
setSearchTerm("");
|
|
36
34
|
},
|
|
37
35
|
whileElementsMounted: __WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__.autoUpdate,
|
|
38
36
|
placement: "bottom-start",
|
|
@@ -129,6 +127,16 @@ const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, on
|
|
|
129
127
|
renderOption,
|
|
130
128
|
options
|
|
131
129
|
]);
|
|
130
|
+
const selectOptionAtIndex = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((index)=>{
|
|
131
|
+
if (null == index) return;
|
|
132
|
+
const option = filteredOptions[index];
|
|
133
|
+
if (!option) return;
|
|
134
|
+
setIsOpen(false);
|
|
135
|
+
onChange(option);
|
|
136
|
+
}, [
|
|
137
|
+
filteredOptions,
|
|
138
|
+
onChange
|
|
139
|
+
]);
|
|
132
140
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
|
|
133
141
|
children: [
|
|
134
142
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("button", {
|
|
@@ -177,7 +185,14 @@ const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, on
|
|
|
177
185
|
ref: floatingUiRefs.setFloating,
|
|
178
186
|
style: floatingStyles,
|
|
179
187
|
className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].menu),
|
|
180
|
-
...getFloatingProps(
|
|
188
|
+
...getFloatingProps({
|
|
189
|
+
onKeyDown: (event)=>{
|
|
190
|
+
if ("Enter" === event.key && null != activeIndex) {
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
selectOptionAtIndex(activeIndex);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}),
|
|
181
196
|
children: [
|
|
182
197
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("input", {
|
|
183
198
|
type: "text",
|
|
@@ -189,13 +204,7 @@ const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, on
|
|
|
189
204
|
setActiveIndex(0);
|
|
190
205
|
},
|
|
191
206
|
value: searchTerm,
|
|
192
|
-
ref: searchRef
|
|
193
|
-
onKeyDown: (e)=>{
|
|
194
|
-
if ("Enter" === e.key && null != activeIndex) {
|
|
195
|
-
setIsOpen(false);
|
|
196
|
-
onChange(filteredOptions[activeIndex]);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
207
|
+
ref: searchRef
|
|
199
208
|
}),
|
|
200
209
|
0 !== filteredOptions.length || onCreate ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("ul", {
|
|
201
210
|
className: __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listBox,
|
|
@@ -29,6 +29,16 @@ const Table = ({ data, columns, bulkActions = [], secondaryBulkActions = [], csv
|
|
|
29
29
|
whileElementsMounted: __WEBPACK_EXTERNAL_MODULE__floating_ui_react_dom_d5bb3c23__.autoUpdate
|
|
30
30
|
});
|
|
31
31
|
const enableRowSelection = bulkActions.length + secondaryBulkActions.length > 0;
|
|
32
|
+
const isRowSelectable = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((row)=>{
|
|
33
|
+
const allBulkActions = [
|
|
34
|
+
...bulkActions,
|
|
35
|
+
...secondaryBulkActions
|
|
36
|
+
];
|
|
37
|
+
return allBulkActions.some((bulkAction)=>!bulkAction.predicate || bulkAction.predicate(row.original));
|
|
38
|
+
}, [
|
|
39
|
+
bulkActions,
|
|
40
|
+
secondaryBulkActions
|
|
41
|
+
]);
|
|
32
42
|
const columnDefs = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
33
43
|
const columnHelper = (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.createColumnHelper)();
|
|
34
44
|
const result = columns.map((column)=>{
|
|
@@ -63,15 +73,20 @@ const Table = ({ data, columns, bulkActions = [], secondaryBulkActions = [], csv
|
|
|
63
73
|
return enableRowSelection ? [
|
|
64
74
|
{
|
|
65
75
|
id: selectColumnId,
|
|
66
|
-
header: ({ table })
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
header: ({ table })=>{
|
|
77
|
+
const selectableRows = table.getRowModel().rows.filter((row)=>row.getCanSelect());
|
|
78
|
+
const AllRowsSelected = table.getIsAllRowsSelected();
|
|
79
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__inputs_CheckboxInput_js_3a83f64b__["default"], {
|
|
80
|
+
disabled: 0 === selectableRows.length,
|
|
81
|
+
value: AllRowsSelected,
|
|
69
82
|
onChange: ()=>{
|
|
70
|
-
table.toggleAllRowsSelected(!(
|
|
83
|
+
table.toggleAllRowsSelected(!(AllRowsSelected || table.getIsSomeRowsSelected()));
|
|
71
84
|
},
|
|
72
85
|
indeterminate: table.getIsSomeRowsSelected()
|
|
73
|
-
})
|
|
86
|
+
});
|
|
87
|
+
},
|
|
74
88
|
cell: ({ table, row })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__inputs_CheckboxInput_js_3a83f64b__["default"], {
|
|
89
|
+
disabled: !row.getCanSelect(),
|
|
75
90
|
value: row.getIsSelected(),
|
|
76
91
|
onClick: (event)=>{
|
|
77
92
|
if (event.shiftKey && lastSelectedRow.current) {
|
|
@@ -80,7 +95,7 @@ const Table = ({ data, columns, bulkActions = [], secondaryBulkActions = [], csv
|
|
|
80
95
|
const lastIndex = visibleRows.findIndex((r)=>r.id === lastSelectedRow.current?.id);
|
|
81
96
|
const startIndex = Math.min(lastIndex, visibleIndex);
|
|
82
97
|
const endIndex = Math.max(lastIndex, visibleIndex);
|
|
83
|
-
const rowsToSelect = visibleRows.slice(startIndex, endIndex + 1).filter((r)=>0 === r.subRows.length);
|
|
98
|
+
const rowsToSelect = visibleRows.slice(startIndex, endIndex + 1).filter((r)=>0 === r.subRows.length && r.getCanSelect());
|
|
84
99
|
rowsToSelect.forEach((rowToSelect)=>rowToSelect.toggleSelected(!row.getIsSelected()));
|
|
85
100
|
}
|
|
86
101
|
lastSelectedRow.current = row;
|
|
@@ -124,6 +139,7 @@ const Table = ({ data, columns, bulkActions = [], secondaryBulkActions = [], csv
|
|
|
124
139
|
getFilteredRowModel: (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.getFilteredRowModel)(),
|
|
125
140
|
getExpandedRowModel: (0, __WEBPACK_EXTERNAL_MODULE__tanstack_react_table_777e1b4b__.getExpandedRowModel)(),
|
|
126
141
|
getColumnCanGlobalFilter: ()=>true,
|
|
142
|
+
enableRowSelection: enableRowSelection ? isRowSelectable : false,
|
|
127
143
|
initialState: {
|
|
128
144
|
expanded: true,
|
|
129
145
|
columnFilters: parsedLocalStorage.columnFilters ?? columnFiltersInitialState,
|
|
@@ -193,8 +209,9 @@ const Table = ({ data, columns, bulkActions = [], secondaryBulkActions = [], csv
|
|
|
193
209
|
};
|
|
194
210
|
const throttledSetGlobalFilter = (0, __WEBPACK_EXTERNAL_MODULE__react_hook_throttle_d66151d4__.useThrottleCallback)((value)=>table.setGlobalFilter(value), 4);
|
|
195
211
|
const showSearchReset = columnFiltersInitialState.some((filter, index)=>filter.value !== table.getState().columnFilters[index].value) || table.initialState.globalFilter !== table.getState().globalFilter;
|
|
196
|
-
const
|
|
197
|
-
const
|
|
212
|
+
const filteredSelectedRows = table.getFilteredSelectedRowModel();
|
|
213
|
+
const validPrimaryBulkActions = bulkActions.filter((bulkAction)=>filteredSelectedRows.rows.some((row)=>bulkAction.predicate ? bulkAction.predicate(row.original) : true));
|
|
214
|
+
const validSecondaryBulkActions = secondaryBulkActions.filter((bulkAction)=>filteredSelectedRows.rows.some((row)=>bulkAction.predicate ? bulkAction.predicate(row.original) : true));
|
|
198
215
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
199
216
|
if (pathName && id) window.localStorage.setItem(`${pathName}#${id}`, JSON.stringify({
|
|
200
217
|
columnFilters: tableState.columnFilters,
|
|
@@ -210,6 +227,23 @@ const Table = ({ data, columns, bulkActions = [], secondaryBulkActions = [], csv
|
|
|
210
227
|
]);
|
|
211
228
|
const shouldShowCsvExport = csvExportableColumns.length > 0 && csvFilename;
|
|
212
229
|
const shouldShowMoreActions = validSecondaryBulkActions.length > 0 || shouldShowCsvExport;
|
|
230
|
+
const getbulkActionRows = (bulkAction)=>filteredSelectedRows.flatRows.filter((row)=>bulkAction.predicate ? bulkAction.predicate(row.original) : true).map((row)=>row.original);
|
|
231
|
+
const primaryBulkActionRowsMap = new Map(validPrimaryBulkActions.map((bulkAction)=>[
|
|
232
|
+
bulkAction.key,
|
|
233
|
+
getbulkActionRows(bulkAction)
|
|
234
|
+
]));
|
|
235
|
+
const secondaryBulkActionRowsMap = new Map(validSecondaryBulkActions.map((bulkAction)=>[
|
|
236
|
+
bulkAction.key,
|
|
237
|
+
getbulkActionRows(bulkAction)
|
|
238
|
+
]));
|
|
239
|
+
const allBulkActionRowCounts = [
|
|
240
|
+
...Array.from(primaryBulkActionRowsMap.values()).map((rows)=>rows.length),
|
|
241
|
+
...Array.from(secondaryBulkActionRowsMap.values()).map((rows)=>rows.length)
|
|
242
|
+
];
|
|
243
|
+
const bulkActionRowCountsDiffer = new Set(allBulkActionRowCounts).size > 1;
|
|
244
|
+
const hasMultipleActions = allBulkActionRowCounts.length > 1;
|
|
245
|
+
const allRowsCanDoAllActions = hasMultipleActions && allBulkActionRowCounts.every((count)=>count === filteredSelectedRows.rows.length);
|
|
246
|
+
const showBulkActionCounts = bulkActionRowCountsDiffer || hasMultipleActions && !allRowsCanDoAllActions;
|
|
213
247
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
214
248
|
ref: refs.setReference,
|
|
215
249
|
children: [
|
|
@@ -229,35 +263,41 @@ const Table = ({ data, columns, bulkActions = [], secondaryBulkActions = [], csv
|
|
|
229
263
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_cd0b6798__["default"], {
|
|
230
264
|
font: "regular-bold",
|
|
231
265
|
children: [
|
|
232
|
-
|
|
266
|
+
filteredSelectedRows.rows.length,
|
|
233
267
|
" ",
|
|
234
|
-
1 ===
|
|
268
|
+
1 === filteredSelectedRows.rows.length ? "selection" : "selections"
|
|
235
269
|
]
|
|
236
270
|
}),
|
|
237
271
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
238
272
|
className: __WEBPACK_EXTERNAL_MODULE__Table_module_js_1c0e33be__["default"].bulkSelectionActions,
|
|
239
273
|
children: [
|
|
240
|
-
validPrimaryBulkActions.map((bulkAction)
|
|
274
|
+
validPrimaryBulkActions.map((bulkAction)=>{
|
|
275
|
+
const rows = primaryBulkActionRowsMap.get(bulkAction.key) ?? [];
|
|
276
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_Disclosure_js_6e4cc59c__["default"], {
|
|
241
277
|
render: (onClose)=>bulkAction.render({
|
|
242
|
-
rows:
|
|
278
|
+
rows: primaryBulkActionRowsMap.get(bulkAction.key) ?? [],
|
|
243
279
|
resetRowSelection: ()=>table.resetRowSelection(),
|
|
244
280
|
onClose: onClose
|
|
245
281
|
}),
|
|
246
|
-
children: bulkAction.label
|
|
247
|
-
}, bulkAction.key)
|
|
282
|
+
children: showBulkActionCounts ? `${bulkAction.label} (${rows.length})` : bulkAction.label
|
|
283
|
+
}, bulkAction.key);
|
|
284
|
+
}),
|
|
248
285
|
shouldShowMoreActions ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_MenuButton_js_b23cdd05__["default"], {
|
|
249
286
|
id: "bulkActionOverflow",
|
|
250
287
|
options: [
|
|
251
|
-
...validSecondaryBulkActions.map((bulkAction)=>
|
|
288
|
+
...validSecondaryBulkActions.map((bulkAction)=>{
|
|
289
|
+
const rows = secondaryBulkActionRowsMap.get(bulkAction.key) ?? [];
|
|
290
|
+
return {
|
|
252
291
|
id: bulkAction.key,
|
|
253
|
-
label: bulkAction.label,
|
|
292
|
+
label: showBulkActionCounts ? `${bulkAction.label} (${rows.length})` : bulkAction.label,
|
|
254
293
|
type: "render",
|
|
255
294
|
render: (onClose)=>bulkAction.render({
|
|
256
|
-
rows:
|
|
295
|
+
rows: rows,
|
|
257
296
|
resetRowSelection: ()=>table.resetRowSelection(),
|
|
258
297
|
onClose: onClose
|
|
259
298
|
})
|
|
260
|
-
}
|
|
299
|
+
};
|
|
300
|
+
}),
|
|
261
301
|
...shouldShowCsvExport ? [
|
|
262
302
|
{
|
|
263
303
|
id: "download-selected-rows",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worknice/whiteboard",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.21.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"files": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-markdown": "^10.1.0",
|
|
39
39
|
"utf8": "^3.0.0",
|
|
40
40
|
"zod": "^3.22.3",
|
|
41
|
-
"@worknice/utils": "^0.6.
|
|
41
|
+
"@worknice/utils": "^0.6.78"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@anolilab/semantic-release-pnpm": "^1.1.10",
|