@inceptionbg/iui 2.0.35 → 2.0.36
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/package.json +4 -1
- package/idea/GridTable/GridTable.tsx +0 -119
- package/idea/GridTable/gridTable.scss +0 -42
- package/idea/Menu/Menu.tsx +0 -121
- package/idea/Menu/MenuItem.tsx +0 -75
- package/idea/Menu/hooks/useMenuControl.ts +0 -13
- package/idea/Menu.tsx +0 -133
- package/idea/NoAccessInfo.tsx +0 -193
- package/idea/Table/Components/Edit/ItemActionsMenu.tsx +0 -85
- package/idea/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -31
- package/idea/Table/Components/Edit/TableEditRow.tsx +0 -57
- package/idea/Table/Components/FilterItem.tsx +0 -20
- package/idea/Table/Components/Header/TableHeader.tsx +0 -46
- package/idea/Table/Components/Header/TableHeaderRow.tsx +0 -37
- package/idea/Table/Components/Print/CustomTablePrint.tsx +0 -115
- package/idea/Table/Components/SetSortList.tsx +0 -30
- package/idea/Table/Components/SetTableFilter.tsx +0 -91
- package/idea/Table/Components/TableFooter.tsx +0 -137
- package/idea/Table/Components/TableOptions.tsx +0 -227
- package/idea/Table/Components/Templates/TemplateCreate.tsx +0 -80
- package/idea/Table/Components/Templates/TemplateCreateDefault.tsx +0 -45
- package/idea/Table/Components/Templates/TemplateList.tsx +0 -167
- package/idea/Table/Components/Templates/repo/TemplateRepo.ts +0 -53
- package/idea/Table/Table.tsx +0 -528
- package/idea/Table/hooks/useDefaultTemplate.ts +0 -20
- package/idea/Table/hooks/useTableKeyboard.ts +0 -137
- package/idea/Table/hooks/useTableSelect.ts +0 -11
- package/rollup.config.js +0 -52
- package/src/assets/icons/duotone/faBell.ts +0 -17
- package/src/assets/icons/duotone/faCircleUser.ts +0 -17
- package/src/assets/icons/regular/faArrowLeft.ts +0 -15
- package/src/assets/icons/regular/faArrowRightArrowLeft.ts +0 -15
- package/src/assets/icons/regular/faCircleCheck.ts +0 -15
- package/src/assets/icons/regular/faCircleExclamation.ts +0 -15
- package/src/assets/icons/regular/faCircleInfo.ts +0 -15
- package/src/assets/icons/regular/faFileArrowDown.ts +0 -15
- package/src/assets/icons/regular/faFilterCircleXmark.ts +0 -15
- package/src/assets/icons/regular/faTriangleExclamation.ts +0 -15
- package/src/assets/icons/solid/faAngleLeft.ts +0 -15
- package/src/assets/icons/solid/faAngleRight.ts +0 -15
- package/src/assets/icons/solid/faArrowDownWideShort.ts +0 -15
- package/src/assets/icons/solid/faCaretDown.ts +0 -15
- package/src/assets/icons/solid/faCheck.ts +0 -15
- package/src/assets/icons/solid/faEllipsisVertical.ts +0 -15
- package/src/assets/icons/solid/faEnvelopeDot.ts +0 -15
- package/src/assets/icons/solid/faFilter.ts +0 -15
- package/src/assets/icons/solid/faFloppyDisk.ts +0 -15
- package/src/assets/icons/solid/faGripDotsVertical.ts +0 -15
- package/src/assets/icons/solid/faListUl.ts +0 -15
- package/src/assets/icons/solid/faMinus.ts +0 -15
- package/src/assets/icons/solid/faPlus.ts +0 -15
- package/src/assets/icons/solid/faPrint.ts +0 -15
- package/src/assets/icons/solid/faRotateRight.ts +0 -15
- package/src/assets/icons/solid/faXmark.ts +0 -15
- package/src/assets/images/logo/inception.svg +0 -22
- package/src/assets/images/logo/mts.svg +0 -5703
- package/src/assets/images/logo/paperless.svg +0 -21
- package/src/assets/images/logo/pismonosa.png +0 -0
- package/src/assets/images/not-found.svg +0 -19
- package/src/components/Accordions/Accordions.tsx +0 -74
- package/src/components/Alert/Alert.tsx +0 -31
- package/src/components/Badge/DotBadge.tsx +0 -16
- package/src/components/Badge/NotificationBadge.tsx +0 -29
- package/src/components/Badge/PillBadge.tsx +0 -13
- package/src/components/Button/Button.tsx +0 -56
- package/src/components/Button/IconButton.tsx +0 -51
- package/src/components/Button/SplitButton.tsx +0 -91
- package/src/components/Dashboard/Dashboard.tsx +0 -9
- package/src/components/Dashboard/DashboardWidget.tsx +0 -44
- package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +0 -36
- package/src/components/Dialog/Dialog.tsx +0 -178
- package/src/components/Dialog/components/DialogFooter.tsx +0 -100
- package/src/components/Header/Components/EnvBadge.tsx +0 -17
- package/src/components/Header/Components/ModuleSelect.tsx +0 -68
- package/src/components/Header/Components/Notifications.tsx +0 -204
- package/src/components/Header/Components/UserMenu.tsx +0 -52
- package/src/components/Header/Header.tsx +0 -45
- package/src/components/Helper/Collapse.tsx +0 -53
- package/src/components/Inputs/Checkbox.tsx +0 -53
- package/src/components/Inputs/CurrencyInput.tsx +0 -124
- package/src/components/Inputs/DateInput/DateInput.tsx +0 -184
- package/src/components/Inputs/DateInput/components/DatePartInput.tsx +0 -159
- package/src/components/Inputs/InputWrapper.tsx +0 -95
- package/src/components/Inputs/NumberInput.tsx +0 -86
- package/src/components/Inputs/PasswordInput.tsx +0 -39
- package/src/components/Inputs/PhoneInput/PhoneInput.tsx +0 -108
- package/src/components/Inputs/PhoneInput/utils/countryCode.ts +0 -20
- package/src/components/Inputs/Radio.tsx +0 -59
- package/src/components/Inputs/RadioGroup.tsx +0 -48
- package/src/components/Inputs/RadioLarge.tsx +0 -39
- package/src/components/Inputs/SearchInput.tsx +0 -46
- package/src/components/Inputs/Selects/Select.tsx +0 -17
- package/src/components/Inputs/Selects/components/CustomSelectComponents.tsx +0 -19
- package/src/components/Inputs/Selects/components/SelectWrapper.tsx +0 -118
- package/src/components/Inputs/Selects/utils/selectStyles.ts +0 -101
- package/src/components/Inputs/TextAreaInput.tsx +0 -68
- package/src/components/Inputs/TextInput.tsx +0 -100
- package/src/components/Inputs/TimeInput/TimeInput.tsx +0 -81
- package/src/components/List/List.tsx +0 -21
- package/src/components/List/ListItem.tsx +0 -70
- package/src/components/Loader/Loader.tsx +0 -66
- package/src/components/Loader/ProgressBar.tsx +0 -41
- package/src/components/Menu/Menu.tsx +0 -81
- package/src/components/Menu/MenuItem.tsx +0 -46
- package/src/components/Menu/NewMenu.tsx +0 -63
- package/src/components/Menu/hooks/useMenuPosition.tsx +0 -116
- package/src/components/PageComponents/ScrollableContent.tsx +0 -11
- package/src/components/Pullover/Pullover.tsx +0 -197
- package/src/components/Router/Router.tsx +0 -52
- package/src/components/Sidebar/AddButton.tsx +0 -22
- package/src/components/Sidebar/Sidebar.tsx +0 -85
- package/src/components/Sidebar/SidebarItem.tsx +0 -84
- package/src/components/Sidebar/types/ISidebar.ts +0 -28
- package/src/components/Table/Table.tsx +0 -258
- package/src/components/Table/components/columns/ColumnsList.tsx +0 -60
- package/src/components/Table/components/columns/TableColumnsEdit.tsx +0 -114
- package/src/components/Table/components/edit/TableEditRow.tsx +0 -78
- package/src/components/Table/components/filters/FilterItem.tsx +0 -15
- package/src/components/Table/components/filters/TableFilters.tsx +0 -126
- package/src/components/Table/components/footer/TableFooter.tsx +0 -126
- package/src/components/Table/components/header/TableHeader.tsx +0 -40
- package/src/components/Table/components/header/TableHeaderRow.tsx +0 -57
- package/src/components/Table/components/items/TableItemActions.tsx +0 -78
- package/src/components/Table/components/print/TablePrint.tsx +0 -200
- package/src/components/Table/components/select/TableSelect.tsx +0 -50
- package/src/components/Table/components/sort/TableSort.tsx +0 -75
- package/src/components/Table/components/templates/CreateTemplateDialog.tsx +0 -58
- package/src/components/Table/components/templates/TableTemplates.tsx +0 -65
- package/src/components/Table/components/templates/TemplatesPullover.tsx +0 -88
- package/src/components/Table/contexts/TableContext.tsx +0 -117
- package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +0 -70
- package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +0 -82
- package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +0 -175
- package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +0 -12
- package/src/components/Table/hooks/useTableColumns.ts +0 -34
- package/src/components/Table/hooks/useTableEdit.tsx +0 -140
- package/src/components/Table/hooks/useTableFilterFields.tsx +0 -150
- package/src/components/Table/hooks/useTablePagination.ts +0 -19
- package/src/components/Table/hooks/useTablePrint.ts +0 -83
- package/src/components/Table/hooks/useTableSearch.ts +0 -31
- package/src/components/Table/hooks/useTableSelect.ts +0 -19
- package/src/components/Table/hooks/useTableSort.ts +0 -8
- package/src/components/Tabs/Tabs.tsx +0 -68
- package/src/components/Tooltip/Tooltip.tsx +0 -191
- package/src/components/Tree/Tree.tsx +0 -22
- package/src/components/Tree/TreeItem.tsx +0 -57
- package/src/components/Wrappers/AppLayout.tsx +0 -17
- package/src/components/Wrappers/ConditionalWrapper.tsx +0 -10
- package/src/components/Wrappers/FormWrapper.tsx +0 -84
- package/src/components/Wrappers/PageLayout.tsx +0 -168
- package/src/hooks/useBackgroundClose.ts +0 -19
- package/src/hooks/useGetFocusableElements.ts +0 -43
- package/src/hooks/useIsMenuOpen.ts +0 -11
- package/src/hooks/useLocalPopoverControl.ts +0 -63
- package/src/hooks/useOnEsc.ts +0 -14
- package/src/hooks/usePopupControl.ts +0 -22
- package/src/hooks/useZendesk.ts +0 -22
- package/src/index.ts +0 -387
- package/src/pages/NoAccessPage.tsx +0 -27
- package/src/pages/NotFoundPage.tsx +0 -26
- package/src/styles/App.scss +0 -47
- package/src/styles/common/_animations.scss +0 -58
- package/src/styles/common/_typography.scss +0 -91
- package/src/styles/common/helpers/_base.scss +0 -55
- package/src/styles/common/helpers/_color.scss +0 -10
- package/src/styles/common/helpers/_display.scss +0 -85
- package/src/styles/common/helpers/_size.scss +0 -25
- package/src/styles/common/maps/_align.scss +0 -21
- package/src/styles/common/maps/_buttonMaps.scss +0 -42
- package/src/styles/common/maps/_info-types.scss +0 -1
- package/src/styles/common/maps/_spacing.scss +0 -78
- package/src/styles/common/maps/_text.scss +0 -14
- package/src/styles/components/_accordions.scss +0 -51
- package/src/styles/components/_alert.scss +0 -23
- package/src/styles/components/_badge.scss +0 -84
- package/src/styles/components/_button.scss +0 -99
- package/src/styles/components/_buttonSplit.scss +0 -74
- package/src/styles/components/_card.scss +0 -24
- package/src/styles/components/_dialog.scss +0 -119
- package/src/styles/components/_form.scss +0 -8
- package/src/styles/components/_header.scss +0 -157
- package/src/styles/components/_input.scss +0 -167
- package/src/styles/components/_inputCheckbox.scss +0 -48
- package/src/styles/components/_inputDateTime.scss +0 -161
- package/src/styles/components/_inputRadio.scss +0 -83
- package/src/styles/components/_inputSelect.scss +0 -8
- package/src/styles/components/_list.scss +0 -58
- package/src/styles/components/_loader.scss +0 -55
- package/src/styles/components/_menu-v2.scss +0 -67
- package/src/styles/components/_menu.scss +0 -62
- package/src/styles/components/_notifications.scss +0 -71
- package/src/styles/components/_page.scss +0 -84
- package/src/styles/components/_portal.scss +0 -8
- package/src/styles/components/_print.scss +0 -77
- package/src/styles/components/_progressBar.scss +0 -83
- package/src/styles/components/_pullover.scss +0 -95
- package/src/styles/components/_scrollbar.scss +0 -18
- package/src/styles/components/_sidebar.scss +0 -204
- package/src/styles/components/_smallComponents.scss +0 -23
- package/src/styles/components/_table.scss +0 -340
- package/src/styles/components/_tabs.scss +0 -33
- package/src/styles/components/_tooltip.scss +0 -48
- package/src/styles/components/_tree.scss +0 -21
- package/src/styles/components/_widget.scss +0 -90
- package/src/styles/pages/_fullScreenPage.scss +0 -64
- package/src/styles/variables/_bp.scss +0 -6
- package/src/styles/variables/_variables.scss +0 -142
- package/src/types/Base/custom.d.ts +0 -9
- package/src/types/IBasic.ts +0 -32
- package/src/types/ICountryCode.ts +0 -5
- package/src/types/IError.ts +0 -5
- package/src/types/IHeader.ts +0 -40
- package/src/types/IInfo.ts +0 -1
- package/src/types/IKeyboard.ts +0 -33
- package/src/types/IMenu.ts +0 -19
- package/src/types/INotifications.ts +0 -15
- package/src/types/IPopup.ts +0 -17
- package/src/types/IRouter.ts +0 -6
- package/src/types/ISelect.ts +0 -54
- package/src/types/ITab.ts +0 -10
- package/src/types/ITable.ts +0 -291
- package/src/types/ITree.ts +0 -6
- package/src/utils/InputPatternValidation.ts +0 -12
- package/src/utils/dateUtils.ts +0 -32
- package/src/utils/fileUtils.ts +0 -177
- package/src/utils/i18n/i18nIUICyrilic.ts +0 -119
- package/src/utils/i18n/i18nIUILatin.ts +0 -120
- package/src/utils/i18n/i18nIUIMe.ts +0 -118
- package/src/utils/icons.ts +0 -13
- package/src/utils/localStorageHelper.ts +0 -24
- package/src/utils/logoUtils.ts +0 -7
- package/src/utils/numberUtils.ts +0 -21
- package/src/utils/objectUtils.ts +0 -114
- package/src/utils/popupUtils.ts +0 -82
- package/src/utils/rootDir.ts +0 -1
- package/src/utils/stringUtils.ts +0 -18
- package/src/utils/tableUtils.ts +0 -130
- package/src/utils/toasts.ts +0 -6
- package/src/utils/urlUtils.ts +0 -4
- package/tsconfig.icons.json +0 -5
- package/tsconfig.json +0 -22
package/idea/Table/Table.tsx
DELETED
|
@@ -1,528 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import type { FC} from 'react';
|
|
3
|
-
import { Fragment, useEffect, useState } from 'react';
|
|
4
|
-
import type {
|
|
5
|
-
ITable,
|
|
6
|
-
ITableColumn,
|
|
7
|
-
ITableDataItem,
|
|
8
|
-
ITableSelectedActions,
|
|
9
|
-
} from '../../types/ITable';
|
|
10
|
-
import { Loader } from '../Loader/Loader';
|
|
11
|
-
import { Tooltip } from '../Tooltip/Tooltip';
|
|
12
|
-
import { ConditionalWrapper } from '../Wrappers/ConditionalWrapper';
|
|
13
|
-
import { TableFooter } from './Components/TableFooter';
|
|
14
|
-
import { HeaderTable } from './Components/Header/TableHeader';
|
|
15
|
-
import { TableOptions } from './Components/TableOptions';
|
|
16
|
-
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import { Checkbox } from '../Inputs/Checkbox';
|
|
18
|
-
import { Menu } from '../Menu/Menu';
|
|
19
|
-
import { faEllipsisVertical } from '../../assets/icons/solid/faEllipsisVertical';
|
|
20
|
-
import { MenuItem } from '../Menu/MenuItem';
|
|
21
|
-
import { Button } from '../Button/Button';
|
|
22
|
-
import { useTableKeyboard } from './hooks/useTableKeyboard';
|
|
23
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
24
|
-
import { faPlus } from '../../assets/icons/solid/faPlus';
|
|
25
|
-
|
|
26
|
-
export const Table: FC<ITable> = ({
|
|
27
|
-
columns,
|
|
28
|
-
setColumns,
|
|
29
|
-
withColumnsSearch,
|
|
30
|
-
customHeader,
|
|
31
|
-
data: tableData,
|
|
32
|
-
sumRows,
|
|
33
|
-
isLoading,
|
|
34
|
-
headerWrap,
|
|
35
|
-
serverSidePagination,
|
|
36
|
-
customPagination,
|
|
37
|
-
selectedRowUuid,
|
|
38
|
-
footerAction,
|
|
39
|
-
hideFooter,
|
|
40
|
-
noTotalRows,
|
|
41
|
-
showLastBorder,
|
|
42
|
-
className,
|
|
43
|
-
filterData,
|
|
44
|
-
sortData,
|
|
45
|
-
printData,
|
|
46
|
-
customPrintData,
|
|
47
|
-
templates,
|
|
48
|
-
additionsalOptions,
|
|
49
|
-
rowSelect,
|
|
50
|
-
rowHeight = 'm',
|
|
51
|
-
maxHeight,
|
|
52
|
-
editable,
|
|
53
|
-
keyboard,
|
|
54
|
-
}) => {
|
|
55
|
-
const [limit, setLimit] = useState(customPagination?.defaultLimit ?? 5);
|
|
56
|
-
const [offset, setOffset] = useState(0);
|
|
57
|
-
const [cols, setCols] = useState<ITableColumn[]>([]);
|
|
58
|
-
const [data, setData] = useState<ITableDataItem[]>([]);
|
|
59
|
-
const [extendedRow, setExtendedRow] = useState('');
|
|
60
|
-
const [editableData, setEditableData] = useState<object>({});
|
|
61
|
-
const [isAdding, setIsAdding] = useState(false);
|
|
62
|
-
const [selectedActionOpen, setSelectedActionOpen] = useState(false);
|
|
63
|
-
const [activeSelectOptions, setActiveSelectOptions] = useState<ITableSelectedActions[]>(
|
|
64
|
-
[]
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
const { t } = useTranslation();
|
|
68
|
-
|
|
69
|
-
const pagination = {
|
|
70
|
-
limit: serverSidePagination?.limit ?? limit,
|
|
71
|
-
offset: serverSidePagination?.offset ?? offset,
|
|
72
|
-
setLimit: serverSidePagination?.setLimit ?? setLimit,
|
|
73
|
-
setOffset: serverSidePagination?.setOffset ?? setOffset,
|
|
74
|
-
totalRows: serverSidePagination?.totalRows ?? tableData.length,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const focusedRow = useTableKeyboard({
|
|
78
|
-
enabled: !!keyboard?.enabled,
|
|
79
|
-
rows: data,
|
|
80
|
-
selected: {
|
|
81
|
-
enabled: !!rowSelect && activeSelectOptions.length > 0,
|
|
82
|
-
rows: rowSelect?.selectedRows ?? new Set<string>(),
|
|
83
|
-
resetSelected: () => rowSelect?.setSelectedRows(new Set<string>()),
|
|
84
|
-
},
|
|
85
|
-
actions: {
|
|
86
|
-
moveDisabled: !!keyboard?.actions?.moveDisabled || isAdding,
|
|
87
|
-
...keyboard?.actions,
|
|
88
|
-
add: {
|
|
89
|
-
isAdding,
|
|
90
|
-
setIsAdding,
|
|
91
|
-
enabled: !!editable?.EditableRow && !editable.addDisabled,
|
|
92
|
-
},
|
|
93
|
-
edit: {
|
|
94
|
-
item: editable?.selectedItem,
|
|
95
|
-
setItem: editable?.setSelectedItem!,
|
|
96
|
-
enabled:
|
|
97
|
-
!!editable && !!editable!.setSelectedItem && !keyboard?.actions.editDisabled,
|
|
98
|
-
},
|
|
99
|
-
additional: additionalProps => [
|
|
100
|
-
...(keyboard?.actions?.additional?.(additionalProps) || []),
|
|
101
|
-
{
|
|
102
|
-
key: 'PageUp',
|
|
103
|
-
isActive: !additionalProps.isEditing,
|
|
104
|
-
onAction: () =>
|
|
105
|
-
pagination.offset > 0 && pagination.setOffset(pagination.offset - 1),
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
key: 'PageDown',
|
|
109
|
-
isActive: !additionalProps.isEditing,
|
|
110
|
-
onAction: () => {
|
|
111
|
-
if (
|
|
112
|
-
noTotalRows
|
|
113
|
-
? pagination.limit <= pagination.totalRows
|
|
114
|
-
: pagination.offset + 1 <
|
|
115
|
-
Math.ceil(pagination.totalRows / pagination.limit)
|
|
116
|
-
) {
|
|
117
|
-
pagination.setOffset(pagination.offset + 1);
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
key: ' ',
|
|
123
|
-
isActive: activeSelectOptions.length > 0 && !!focusedRow?.uuid,
|
|
124
|
-
onAction: () => {
|
|
125
|
-
const rowUuid = focusedRow?.uuid!;
|
|
126
|
-
const isRowSelected = rowSelect?.selectedRows.has(rowUuid);
|
|
127
|
-
rowSelect?.setSelectedRows(oldSet => {
|
|
128
|
-
const newSet = new Set(oldSet);
|
|
129
|
-
newSet[isRowSelected ? 'delete' : 'add'](rowUuid);
|
|
130
|
-
return newSet;
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
// Set Active Select Options
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
rowSelect?.actions.length &&
|
|
141
|
-
setActiveSelectOptions(rowSelect.actions.filter(e => !e.hidden) || []);
|
|
142
|
-
}, [rowSelect?.actions]);
|
|
143
|
-
|
|
144
|
-
useEffect(
|
|
145
|
-
() => {
|
|
146
|
-
// Active Column
|
|
147
|
-
const activeColumns = columns.filter(e => !e.hidden && !e.unavailable);
|
|
148
|
-
|
|
149
|
-
// Select Column
|
|
150
|
-
let selectCol;
|
|
151
|
-
if (rowSelect && activeSelectOptions.length > 0) {
|
|
152
|
-
const selectableData = data.filter(e => !e.disableSelect);
|
|
153
|
-
const selectedSome =
|
|
154
|
-
!!rowSelect.selectedRows.size &&
|
|
155
|
-
selectableData.some(e => !rowSelect.selectedRows.has(e.uuid));
|
|
156
|
-
const selectedAll = !!rowSelect.selectedRows.size && !selectedSome;
|
|
157
|
-
selectCol = {
|
|
158
|
-
id: 'select',
|
|
159
|
-
label: (
|
|
160
|
-
<Checkbox
|
|
161
|
-
value={selectedSome ? 'middle' : selectedAll}
|
|
162
|
-
// label={`${selected.size}`}
|
|
163
|
-
setValue={() => {
|
|
164
|
-
selectedAll
|
|
165
|
-
? rowSelect.setSelectedRows(new Set<string>())
|
|
166
|
-
: rowSelect.setSelectedRows(oldValue => {
|
|
167
|
-
let newSet = new Set(oldValue);
|
|
168
|
-
selectableData.forEach(e => newSet.add(e.uuid!));
|
|
169
|
-
return newSet;
|
|
170
|
-
});
|
|
171
|
-
}}
|
|
172
|
-
/>
|
|
173
|
-
),
|
|
174
|
-
width: '50px',
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
let newCols: ITableColumn[] = [];
|
|
179
|
-
|
|
180
|
-
selectCol && newCols.push(selectCol);
|
|
181
|
-
newCols = newCols.concat(activeColumns);
|
|
182
|
-
|
|
183
|
-
setCols(newCols);
|
|
184
|
-
},
|
|
185
|
-
// eslint-disable-next-line
|
|
186
|
-
[
|
|
187
|
-
columns,
|
|
188
|
-
editable,
|
|
189
|
-
rowSelect?.selectedRows,
|
|
190
|
-
activeSelectOptions,
|
|
191
|
-
serverSidePagination,
|
|
192
|
-
]
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
useEffect(() => {
|
|
196
|
-
// const data = editable
|
|
197
|
-
// ? tableData.map((e) => ({
|
|
198
|
-
// ...e,
|
|
199
|
-
// cells: {
|
|
200
|
-
// ...e.cells,
|
|
201
|
-
// actions: {
|
|
202
|
-
// value: (
|
|
203
|
-
// <ItemActionsMenu
|
|
204
|
-
// item={e}
|
|
205
|
-
// setSelectedItem={editable!.setSelectedItem}
|
|
206
|
-
// />
|
|
207
|
-
// ),
|
|
208
|
-
// },
|
|
209
|
-
// },
|
|
210
|
-
// }))
|
|
211
|
-
// : tableData;
|
|
212
|
-
const data =
|
|
213
|
-
serverSidePagination || limit <= 0
|
|
214
|
-
? tableData
|
|
215
|
-
: tableData.slice(offset * limit, offset * limit + limit);
|
|
216
|
-
|
|
217
|
-
rowSelect &&
|
|
218
|
-
activeSelectOptions.length > 0 &&
|
|
219
|
-
data.map(
|
|
220
|
-
e =>
|
|
221
|
-
(e.cells.select = {
|
|
222
|
-
value: (
|
|
223
|
-
<Checkbox
|
|
224
|
-
value={rowSelect.selectedRows.has(e.uuid!)}
|
|
225
|
-
setValue={checked => {
|
|
226
|
-
rowSelect.setSelectedRows(oldSet => {
|
|
227
|
-
const newSet = new Set(oldSet);
|
|
228
|
-
checked ? newSet.add(e.uuid!) : newSet.delete(e.uuid!);
|
|
229
|
-
return newSet;
|
|
230
|
-
});
|
|
231
|
-
}}
|
|
232
|
-
disabled={e.disableSelect}
|
|
233
|
-
/>
|
|
234
|
-
),
|
|
235
|
-
unclickable: true,
|
|
236
|
-
})
|
|
237
|
-
);
|
|
238
|
-
setData(data);
|
|
239
|
-
}, [
|
|
240
|
-
tableData,
|
|
241
|
-
limit,
|
|
242
|
-
offset,
|
|
243
|
-
rowSelect?.selectedRows,
|
|
244
|
-
activeSelectOptions,
|
|
245
|
-
serverSidePagination,
|
|
246
|
-
rowSelect,
|
|
247
|
-
]);
|
|
248
|
-
|
|
249
|
-
const EditableRow = editable?.EditableRow;
|
|
250
|
-
|
|
251
|
-
return (
|
|
252
|
-
<Loader isLoading={!!isLoading}>
|
|
253
|
-
<div
|
|
254
|
-
className={clsx('iui-table', className, {
|
|
255
|
-
'pb-3': data.length === 0,
|
|
256
|
-
})}
|
|
257
|
-
>
|
|
258
|
-
<div className="flex column gap-2">
|
|
259
|
-
{(!!filterData ||
|
|
260
|
-
!!sortData ||
|
|
261
|
-
!!setColumns ||
|
|
262
|
-
!!printData ||
|
|
263
|
-
!!customPrintData) && (
|
|
264
|
-
<TableOptions
|
|
265
|
-
columns={cols}
|
|
266
|
-
columnsData={
|
|
267
|
-
setColumns
|
|
268
|
-
? { columns, setColumns, withSearch: withColumnsSearch }
|
|
269
|
-
: undefined
|
|
270
|
-
}
|
|
271
|
-
filterData={filterData}
|
|
272
|
-
sortData={sortData}
|
|
273
|
-
printData={printData}
|
|
274
|
-
customPrintData={customPrintData}
|
|
275
|
-
templates={templates}
|
|
276
|
-
additionsalOptions={additionsalOptions}
|
|
277
|
-
/>
|
|
278
|
-
)}
|
|
279
|
-
{/* ////// SELECT ////// */}
|
|
280
|
-
{!!rowSelect && activeSelectOptions.length > 0 && (
|
|
281
|
-
<div className="flex gap-2 align-center pl-3">
|
|
282
|
-
<p className="fs-12">{`${t('Selected')}: ${
|
|
283
|
-
rowSelect.selectedRows.size
|
|
284
|
-
}`}</p>
|
|
285
|
-
<Menu
|
|
286
|
-
isOpen={selectedActionOpen}
|
|
287
|
-
onClose={() => setSelectedActionOpen(false)}
|
|
288
|
-
placement="bottom-left"
|
|
289
|
-
renderButton={ref => (
|
|
290
|
-
<Button
|
|
291
|
-
ref={ref}
|
|
292
|
-
label={t('Actions')}
|
|
293
|
-
icon={faEllipsisVertical}
|
|
294
|
-
active={selectedActionOpen}
|
|
295
|
-
disabled={!rowSelect.selectedRows.size}
|
|
296
|
-
onClick={() => setSelectedActionOpen(!selectedActionOpen)}
|
|
297
|
-
size="s"
|
|
298
|
-
/>
|
|
299
|
-
)}
|
|
300
|
-
>
|
|
301
|
-
{activeSelectOptions.map(action => (
|
|
302
|
-
<MenuItem
|
|
303
|
-
key={action.label}
|
|
304
|
-
label={action.label}
|
|
305
|
-
disabled={action.disabled}
|
|
306
|
-
onClick={() => {
|
|
307
|
-
action.onClick!(rowSelect.selectedRows);
|
|
308
|
-
setSelectedActionOpen(false);
|
|
309
|
-
action.clearSelected &&
|
|
310
|
-
rowSelect.setSelectedRows(new Set<string>());
|
|
311
|
-
}}
|
|
312
|
-
/>
|
|
313
|
-
))}
|
|
314
|
-
</Menu>
|
|
315
|
-
</div>
|
|
316
|
-
)}
|
|
317
|
-
</div>
|
|
318
|
-
<div className="table-container" style={{ maxHeight }}>
|
|
319
|
-
<ConditionalWrapper
|
|
320
|
-
condition={!!editable}
|
|
321
|
-
wrapper={children => (
|
|
322
|
-
<form
|
|
323
|
-
onSubmit={e => {
|
|
324
|
-
e.preventDefault();
|
|
325
|
-
e.stopPropagation();
|
|
326
|
-
editable!.onSubmit(editableData, () => {
|
|
327
|
-
!editable?.keepEditOnSubmit &&
|
|
328
|
-
editable!.inputFocusRef?.current?.focus();
|
|
329
|
-
if (!editable?.selectedItem || !editable?.keepEditOnSubmit) {
|
|
330
|
-
setEditableData(editable!.defaultDataValue ?? {});
|
|
331
|
-
editable?.setSelectedItem && editable.setSelectedItem(null);
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}}
|
|
335
|
-
>
|
|
336
|
-
{children}
|
|
337
|
-
</form>
|
|
338
|
-
)}
|
|
339
|
-
>
|
|
340
|
-
<table className="full-width">
|
|
341
|
-
<HeaderTable
|
|
342
|
-
columns={cols}
|
|
343
|
-
headerWrap={headerWrap}
|
|
344
|
-
customHeader={customHeader}
|
|
345
|
-
sticky={!!maxHeight}
|
|
346
|
-
/>
|
|
347
|
-
<tbody
|
|
348
|
-
className={clsx({ 'no-last-border': hideFooter && !showLastBorder })}
|
|
349
|
-
>
|
|
350
|
-
{data.length ? (
|
|
351
|
-
<>
|
|
352
|
-
{data.map(row => {
|
|
353
|
-
const isExtended =
|
|
354
|
-
row.extendable &&
|
|
355
|
-
!row.extendable.isLoading &&
|
|
356
|
-
extendedRow === row.uuid;
|
|
357
|
-
return (
|
|
358
|
-
<Fragment key={row.uuid}>
|
|
359
|
-
{/* ////// EDITABLE ROW ////// */}
|
|
360
|
-
{!!EditableRow &&
|
|
361
|
-
row.uuid === editable?.selectedItem?.uuid &&
|
|
362
|
-
editable.setSelectedItem ? (
|
|
363
|
-
<EditableRow
|
|
364
|
-
columns={cols}
|
|
365
|
-
data={editableData}
|
|
366
|
-
setData={setEditableData}
|
|
367
|
-
item={editable.selectedItem}
|
|
368
|
-
clearItem={() => editable.setSelectedItem!(null)}
|
|
369
|
-
defaultDataValue={editable.defaultDataValue}
|
|
370
|
-
inputFocusRef={editable.inputFocusRef}
|
|
371
|
-
/>
|
|
372
|
-
) : (
|
|
373
|
-
////// REGULAR ROW //////
|
|
374
|
-
<tr
|
|
375
|
-
data-id={row.uuid}
|
|
376
|
-
className={clsx(row.className, {
|
|
377
|
-
selected:
|
|
378
|
-
!!selectedRowUuid && selectedRowUuid === row.uuid,
|
|
379
|
-
clickable: !!row.onRowClick || !!row.extendable,
|
|
380
|
-
focused: !!focusedRow && focusedRow.uuid === row.uuid,
|
|
381
|
-
loading: row.extendable?.isLoading,
|
|
382
|
-
})}
|
|
383
|
-
onClick={e => {
|
|
384
|
-
row.onRowClick && row.onRowClick(e);
|
|
385
|
-
row.extendable &&
|
|
386
|
-
setExtendedRow(
|
|
387
|
-
extendedRow === row.uuid ? '' : row.uuid
|
|
388
|
-
);
|
|
389
|
-
}}
|
|
390
|
-
>
|
|
391
|
-
{cols.map(column => {
|
|
392
|
-
const cell = row.cells[column.id];
|
|
393
|
-
return (
|
|
394
|
-
<Tooltip
|
|
395
|
-
key={column.id}
|
|
396
|
-
label={cell?.tooltip!}
|
|
397
|
-
position="top"
|
|
398
|
-
disabled={!cell?.tooltip}
|
|
399
|
-
>
|
|
400
|
-
<td
|
|
401
|
-
data-th={
|
|
402
|
-
column.id === 'select'
|
|
403
|
-
? t('Selected') + ':'
|
|
404
|
-
: column.label
|
|
405
|
-
? column.label + ': '
|
|
406
|
-
: '/'
|
|
407
|
-
}
|
|
408
|
-
align={cell?.align || column.align}
|
|
409
|
-
onClick={
|
|
410
|
-
cell?.onClick || cell?.unclickable
|
|
411
|
-
? e => {
|
|
412
|
-
e.stopPropagation();
|
|
413
|
-
cell?.onClick && cell?.onClick!(e);
|
|
414
|
-
}
|
|
415
|
-
: undefined
|
|
416
|
-
}
|
|
417
|
-
className={clsx(
|
|
418
|
-
column.color,
|
|
419
|
-
cell?.className,
|
|
420
|
-
rowHeight,
|
|
421
|
-
{
|
|
422
|
-
link: cell?.link,
|
|
423
|
-
'p-0': !cell?.value && cell?.value !== 0,
|
|
424
|
-
'clickable-column': cell?.onClick,
|
|
425
|
-
'word-break': column.break,
|
|
426
|
-
'no-border': isExtended,
|
|
427
|
-
}
|
|
428
|
-
)}
|
|
429
|
-
colSpan={cell?.span}
|
|
430
|
-
>
|
|
431
|
-
{cell?.value}
|
|
432
|
-
</td>
|
|
433
|
-
</Tooltip>
|
|
434
|
-
);
|
|
435
|
-
})}
|
|
436
|
-
</tr>
|
|
437
|
-
)}
|
|
438
|
-
{/* ////// EXTENDABLE ROW ////// */}
|
|
439
|
-
{isExtended && (
|
|
440
|
-
<tr>
|
|
441
|
-
<td colSpan={cols.length} className={rowHeight}>
|
|
442
|
-
{row.extendable!.element}
|
|
443
|
-
</td>
|
|
444
|
-
</tr>
|
|
445
|
-
)}
|
|
446
|
-
</Fragment>
|
|
447
|
-
);
|
|
448
|
-
})}
|
|
449
|
-
</>
|
|
450
|
-
) : (
|
|
451
|
-
<tr>
|
|
452
|
-
<td className="no-border" colSpan={cols.length}>
|
|
453
|
-
{t('NoResults')}
|
|
454
|
-
</td>
|
|
455
|
-
</tr>
|
|
456
|
-
)}
|
|
457
|
-
</tbody>
|
|
458
|
-
<tfoot
|
|
459
|
-
// className="sticky-footer"
|
|
460
|
-
>
|
|
461
|
-
{!!EditableRow &&
|
|
462
|
-
!editable.selectedItem &&
|
|
463
|
-
!editable.addDisabled &&
|
|
464
|
-
// TO DO -> Remove keyboard condition to enable this for every table
|
|
465
|
-
(keyboard?.enabled && !isAdding ? (
|
|
466
|
-
////// NEW ITEM ROW //////
|
|
467
|
-
<tr
|
|
468
|
-
data-id="add"
|
|
469
|
-
className={`clickable${
|
|
470
|
-
focusedRow?.uuid === 'add' ? ' focused' : ''
|
|
471
|
-
}`}
|
|
472
|
-
onClick={() => setIsAdding(true)}
|
|
473
|
-
>
|
|
474
|
-
<td className={`text-center ${rowHeight}`} colSpan={columns.length}>
|
|
475
|
-
<div className="flex center gap-2">
|
|
476
|
-
<FontAwesomeIcon icon={faPlus} className="c-primary icon24" />
|
|
477
|
-
<p>{editable.addLabel || t('AddItem')}</p>
|
|
478
|
-
</div>
|
|
479
|
-
</td>
|
|
480
|
-
</tr>
|
|
481
|
-
) : (
|
|
482
|
-
<EditableRow
|
|
483
|
-
columns={cols}
|
|
484
|
-
data={editableData}
|
|
485
|
-
setData={setEditableData}
|
|
486
|
-
defaultDataValue={editable.defaultDataValue}
|
|
487
|
-
clearItem={() => {
|
|
488
|
-
editable.setSelectedItem?.(null);
|
|
489
|
-
isAdding && setIsAdding(false);
|
|
490
|
-
}}
|
|
491
|
-
inputFocusRef={editable.inputFocusRef}
|
|
492
|
-
/>
|
|
493
|
-
))}
|
|
494
|
-
{!!sumRows &&
|
|
495
|
-
!!data.length &&
|
|
496
|
-
sumRows.map(row => (
|
|
497
|
-
<tr key={row.uuid}>
|
|
498
|
-
{cols.map(({ id: columnId }) => (
|
|
499
|
-
<td
|
|
500
|
-
key={columnId}
|
|
501
|
-
align={row.cells[columnId]?.align || 'right'}
|
|
502
|
-
colSpan={row.cells[columnId]?.span}
|
|
503
|
-
className={rowHeight}
|
|
504
|
-
>
|
|
505
|
-
<strong>{row.cells[columnId]?.value}</strong>
|
|
506
|
-
</td>
|
|
507
|
-
))}
|
|
508
|
-
</tr>
|
|
509
|
-
))}
|
|
510
|
-
</tfoot>
|
|
511
|
-
</table>
|
|
512
|
-
</ConditionalWrapper>
|
|
513
|
-
</div>
|
|
514
|
-
{!hideFooter &&
|
|
515
|
-
(!!data.length ||
|
|
516
|
-
(noTotalRows && (serverSidePagination?.offset || offset) > 0)) && (
|
|
517
|
-
<TableFooter
|
|
518
|
-
customLimit={customPagination?.customLimit}
|
|
519
|
-
pagination={pagination}
|
|
520
|
-
footerAction={footerAction}
|
|
521
|
-
noTotalRows={noTotalRows}
|
|
522
|
-
dataLength={data.length}
|
|
523
|
-
/>
|
|
524
|
-
)}
|
|
525
|
-
</div>
|
|
526
|
-
</Loader>
|
|
527
|
-
);
|
|
528
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// import { useEffect, useState } from 'react';
|
|
2
|
-
// import { getDefaultReportTemplate } from '../Components/Templates/repo/TemplateRepo';
|
|
3
|
-
// import { IReportTemplate } from '../../../types/ITable';
|
|
4
|
-
|
|
5
|
-
export const useDefaultTemplate = (identifier?: string) => {
|
|
6
|
-
// const [template, setTemplate] = useState<IReportTemplate | null>(null);
|
|
7
|
-
// const [isLoading, setIsLoading] = useState(true);
|
|
8
|
-
// useEffect(() => {
|
|
9
|
-
// if (identifier) {
|
|
10
|
-
// getDefaultReportTemplate(identifier)
|
|
11
|
-
// .then(setTemplate)
|
|
12
|
-
// .catch(() => {})
|
|
13
|
-
// .finally(() => setIsLoading(false));
|
|
14
|
-
// }
|
|
15
|
-
// }, [identifier]);
|
|
16
|
-
// return {
|
|
17
|
-
// defaultTemplate: template,
|
|
18
|
-
// isLoadingDefaultTemplate: !!identifier && isLoading,
|
|
19
|
-
// };
|
|
20
|
-
};
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import type { ITableDataItem } from '../../../types/ITable';
|
|
3
|
-
import type { IKeyboardAction, ITableKeyboardActionsProp } from '../../../types/IKeyboard';
|
|
4
|
-
import { useDialogObserver } from '../../Dialog/hooks/useDialogObserver';
|
|
5
|
-
import { scrollToRow } from '../../../utils/tableUtils';
|
|
6
|
-
|
|
7
|
-
export const useTableKeyboard = ({
|
|
8
|
-
enabled,
|
|
9
|
-
rows,
|
|
10
|
-
selected,
|
|
11
|
-
actions,
|
|
12
|
-
}: {
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
rows: ITableDataItem[];
|
|
15
|
-
selected: {
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
rows: Set<string>;
|
|
18
|
-
resetSelected: () => void;
|
|
19
|
-
};
|
|
20
|
-
actions: ITableKeyboardActionsProp;
|
|
21
|
-
}) => {
|
|
22
|
-
const [focusedRow, setFocusedRow] = useState<ITableDataItem | null>(null);
|
|
23
|
-
const isDialogOpen = useDialogObserver();
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (enabled && !isDialogOpen) {
|
|
27
|
-
const isEditing = !!actions.edit?.item;
|
|
28
|
-
const isAdding = !!actions.add?.isAdding;
|
|
29
|
-
|
|
30
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
31
|
-
const isControlKeyPressed = event.ctrlKey || event.metaKey;
|
|
32
|
-
const rowIndex = focusedRow
|
|
33
|
-
? rows.findIndex(row => row.uuid === focusedRow.uuid)
|
|
34
|
-
: -1;
|
|
35
|
-
|
|
36
|
-
const allActions: IKeyboardAction[] = [
|
|
37
|
-
{
|
|
38
|
-
key: 'ArrowDown',
|
|
39
|
-
disabled: isEditing || actions.moveDisabled,
|
|
40
|
-
onAction: () => {
|
|
41
|
-
// Leave action enabled to prevent default scroll movement
|
|
42
|
-
const nextRow = rowIndex + 1;
|
|
43
|
-
if (nextRow < rows.length) {
|
|
44
|
-
// rowIndex will be -1 if no row is selected so the next row will be 0
|
|
45
|
-
setFocusedRow(rows[nextRow]);
|
|
46
|
-
scrollToRow(rows[nextRow].uuid);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
key: 'ArrowUp',
|
|
52
|
-
disabled: isEditing || actions.moveDisabled,
|
|
53
|
-
onAction: () => {
|
|
54
|
-
if (rowIndex !== 0) {
|
|
55
|
-
const prevRow = rowIndex > 0 ? rowIndex - 1 : rows.length - 1;
|
|
56
|
-
setFocusedRow(rows[prevRow]);
|
|
57
|
-
scrollToRow(rows[prevRow].uuid);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
key: 'e',
|
|
63
|
-
normalizedKey: true,
|
|
64
|
-
ctrl: true,
|
|
65
|
-
disabled: !actions.edit?.enabled || !focusedRow,
|
|
66
|
-
onAction: () => !isEditing && actions.edit?.setItem(focusedRow?.item ?? null),
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
key: 'Enter',
|
|
70
|
-
disabled: isEditing || isAdding || !focusedRow?.onRowClick,
|
|
71
|
-
onAction: focusedRow?.onRowClick!,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
key: 'Escape',
|
|
75
|
-
disabled: !focusedRow && !isAdding,
|
|
76
|
-
onAction: () =>
|
|
77
|
-
isAdding
|
|
78
|
-
? actions.add?.setIsAdding(false)
|
|
79
|
-
: actions.edit?.item
|
|
80
|
-
? actions.edit?.setItem(null)
|
|
81
|
-
: setFocusedRow(null),
|
|
82
|
-
},
|
|
83
|
-
...['Insert', '+'].map(
|
|
84
|
-
key =>
|
|
85
|
-
({
|
|
86
|
-
key,
|
|
87
|
-
disabled: !actions.add?.enabled || isAdding || isEditing,
|
|
88
|
-
onAction: () => {
|
|
89
|
-
actions.add?.setIsAdding(true);
|
|
90
|
-
setFocusedRow(null);
|
|
91
|
-
},
|
|
92
|
-
} as IKeyboardAction)
|
|
93
|
-
),
|
|
94
|
-
{
|
|
95
|
-
key: 'Delete',
|
|
96
|
-
disabled: isEditing || !actions.delete?.enabled || !focusedRow,
|
|
97
|
-
onAction: () =>
|
|
98
|
-
actions.delete?.onAction ??
|
|
99
|
-
actions.delete?.setItemToDeleteUuids(
|
|
100
|
-
selected.enabled && selected.rows && selected.rows.size > 0
|
|
101
|
-
? Array.from(selected.rows)
|
|
102
|
-
: [focusedRow!.uuid]
|
|
103
|
-
),
|
|
104
|
-
},
|
|
105
|
-
...(actions?.additional?.({
|
|
106
|
-
focusedRow,
|
|
107
|
-
isEditing,
|
|
108
|
-
isAdding,
|
|
109
|
-
}) || []),
|
|
110
|
-
];
|
|
111
|
-
|
|
112
|
-
allActions.forEach(item => {
|
|
113
|
-
if (
|
|
114
|
-
!item.disabled &&
|
|
115
|
-
item.key === (item.normalizedKey ? event.key.toLowerCase() : event.key) &&
|
|
116
|
-
!!item.ctrl === isControlKeyPressed
|
|
117
|
-
) {
|
|
118
|
-
event.preventDefault();
|
|
119
|
-
event.stopPropagation();
|
|
120
|
-
if (item.onBulkAction && selected?.enabled && selected.rows.size > 0) {
|
|
121
|
-
item.onBulkAction(Array.from(selected.rows));
|
|
122
|
-
} else {
|
|
123
|
-
item.onAction();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
130
|
-
return () => {
|
|
131
|
-
window.removeEventListener('keydown', handleKeyDown);
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
}, [enabled, rows, focusedRow, actions, isDialogOpen, selected.enabled, selected.rows]);
|
|
135
|
-
|
|
136
|
-
return focusedRow;
|
|
137
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
export const useTableSelect = () => {
|
|
4
|
-
const [selectedRows, setSelectedRows] = useState(new Set<string>());
|
|
5
|
-
|
|
6
|
-
return {
|
|
7
|
-
selectedRows,
|
|
8
|
-
setSelectedRows,
|
|
9
|
-
resetSelectedRows: () => setSelectedRows(new Set<string>()),
|
|
10
|
-
};
|
|
11
|
-
};
|