@inceptionbg/iui 2.0.7 → 2.0.10
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/NoAccessPage-DBq5IzIf.js +2 -0
- package/dist/{NoAccessPage-BozT_Suz.js.map → NoAccessPage-DBq5IzIf.js.map} +1 -1
- package/dist/NotFoundPage-DM-I96ar.js +2 -0
- package/dist/{NotFoundPage-WWiekDef.js.map → NotFoundPage-DM-I96ar.js.map} +1 -1
- package/dist/icons/index.d.ts +2 -2
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +286 -259
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/iui.css +1 -1
- package/idea/GridTable/GridTable.tsx +119 -0
- package/idea/GridTable/gridTable.scss +42 -0
- package/{src/components → idea}/Table/Components/Print/CustomTablePrint.tsx +2 -2
- package/{src/components → idea}/Table/Components/Print/TablePrint.tsx +2 -2
- package/{src/components → idea}/Table/Components/SetTableFilter.tsx +1 -1
- package/{src/components → idea}/Table/Components/TableOptions.tsx +4 -4
- package/idea/{Table2 → Table}/Table.tsx +151 -281
- package/idea/Table/hooks/useDefaultTemplate.ts +20 -0
- package/{src/components → idea}/Table/hooks/useTableKeyboard.ts +1 -2
- package/idea/Table/hooks/useTableSelect.ts +11 -0
- package/package.json +3 -2
- package/src/assets/icons/index.ts +1 -1
- package/src/assets/icons/light/faClipboardCheck.ts +15 -0
- package/src/assets/icons/light/faHouse.ts +15 -15
- package/src/assets/icons/light/faIdBadge.ts +15 -15
- package/src/assets/icons/light/faPen.ts +15 -0
- package/src/components/Button/IconButton.tsx +3 -1
- package/src/components/Dialog/Dialog.tsx +60 -124
- package/src/components/Dialog/components/DialogFooter.tsx +92 -0
- package/src/components/Dialog/hooks/useDialogKeyboard.ts +6 -5
- package/src/components/Header/Components/ModuleSelect.tsx +1 -1
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Inputs/DateInput/DateInput.tsx +108 -101
- package/src/components/Inputs/DateInput/components/DatePartInput.tsx +7 -3
- package/src/components/Inputs/InputWrapper.tsx +6 -1
- package/src/components/Inputs/SearchInput.tsx +9 -4
- package/src/components/Inputs/Select2/Select.tsx +65 -30
- package/src/components/Inputs/Select2/select.scss +13 -14
- package/src/components/Inputs/Selects/components/SelectWrapper.tsx +4 -2
- package/src/components/Inputs/Selects/utils/selectStyles.ts +9 -12
- package/src/components/Menu/Menu.tsx +10 -2
- package/src/components/Menu/MenuItem.tsx +11 -10
- package/src/components/Menu/hooks/useMenuPosition.tsx +23 -6
- package/src/components/Pullover/Pullover.tsx +122 -59
- package/src/components/Table/Table.tsx +78 -342
- package/src/components/Table/components/edit/TableEditRow.tsx +69 -0
- package/src/components/Table/components/filters/FilterItem.tsx +15 -0
- package/src/components/Table/components/filters/TableFilters.tsx +125 -0
- package/src/components/Table/components/footer/TableFooter.tsx +128 -0
- package/src/components/Table/components/header/TableHeader.tsx +42 -0
- package/src/components/Table/components/header/TableHeaderRow.tsx +47 -0
- package/src/components/Table/components/items/TableItemActions.tsx +66 -0
- package/src/components/Table/components/select/TableSelect.tsx +49 -0
- package/src/components/Table/components/sort/TableSort.tsx +52 -0
- package/src/components/Table/contexts/TableContext.tsx +123 -0
- package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +73 -0
- package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +78 -0
- package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +173 -0
- package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +12 -0
- package/src/components/Table/hooks/useTableEdit.tsx +111 -0
- package/src/components/Table/hooks/useTableFilterFields.tsx +150 -0
- package/src/components/Table/hooks/useTablePagination.ts +16 -0
- package/src/components/Table/hooks/useTableSearch.ts +29 -0
- package/src/components/Table/hooks/useTableSort.ts +8 -0
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/Wrappers/PageLayout.tsx +13 -18
- package/src/hooks/useGetFocusableElements.ts +42 -0
- package/src/hooks/useLocalPopoverControl.ts +38 -0
- package/src/hooks/usePopupControl.ts +13 -0
- package/src/index.ts +53 -39
- package/src/styles/common/_typography.scss +3 -0
- package/src/styles/common/helpers/_size.scss +1 -1
- package/src/styles/components/_accordions.scss +1 -1
- package/src/styles/components/_badge.scss +4 -3
- package/src/styles/components/_card.scss +1 -1
- package/src/styles/components/_dialog.scss +15 -13
- package/src/styles/components/_input.scss +1 -1
- package/src/styles/components/_inputCheckbox.scss +1 -1
- package/src/styles/components/_inputDateTime.scss +2 -2
- package/src/styles/components/_inputRadio.scss +1 -1
- package/src/styles/components/_inputSelect.scss +6 -4
- package/src/styles/components/_menu-v2.scss +1 -1
- package/src/styles/components/_menu.scss +23 -15
- package/src/styles/components/_page.scss +3 -2
- package/src/styles/components/_pullover.scss +74 -18
- package/src/styles/components/_table.scss +151 -142
- package/src/styles/components/_widget.scss +1 -1
- package/src/styles/variables/_bp.scss +1 -0
- package/src/styles/variables/_variables.scss +4 -2
- package/src/types/IKeyboard.ts +2 -1
- package/src/types/IMenu.ts +1 -0
- package/src/types/ISelect.ts +1 -0
- package/src/types/ITable.ts +87 -80
- package/src/utils/fileUtils.ts +7 -6
- package/src/utils/i18n/i18nIUICyrilic.ts +4 -0
- package/src/utils/i18n/i18nIUILatin.ts +3 -1
- package/src/utils/i18n/i18nIUIMe.ts +4 -0
- package/src/utils/{ObjectUtils.ts → objectUtils.ts} +8 -8
- package/src/utils/popupUtils.ts +82 -0
- package/src/utils/{TableUtils.ts → tableUtils.ts} +5 -5
- package/src/utils/{Toasts.ts → toasts.ts} +6 -6
- package/src/utils/{UrlUtils.ts → urlUtils.ts} +4 -4
- package/dist/NoAccessPage-BozT_Suz.js +0 -2
- package/dist/NotFoundPage-WWiekDef.js +0 -2
- package/idea/Table2/Components/Columns/ColumnsList.tsx +0 -56
- package/idea/Table2/Components/Columns/SetColumnsList.tsx +0 -107
- package/idea/Table2/Components/Edit/ItemActionsMenu.tsx +0 -87
- package/idea/Table2/Components/Edit/ItemEditOptionsButtons.tsx +0 -32
- package/idea/Table2/Components/Edit/TableEditRow.tsx +0 -56
- package/idea/Table2/Components/FilterItem.tsx +0 -20
- package/idea/Table2/Components/Header/TableHeader.tsx +0 -35
- package/idea/Table2/Components/Header/TableHeaderRow.tsx +0 -37
- package/idea/Table2/Components/Print/CustomTablePrint.tsx +0 -119
- package/idea/Table2/Components/Print/TablePrint.tsx +0 -208
- package/idea/Table2/Components/SetSortList.tsx +0 -33
- package/idea/Table2/Components/SetTableFilter.tsx +0 -90
- package/idea/Table2/Components/TableFooter.tsx +0 -107
- package/idea/Table2/Components/TableOptions.tsx +0 -211
- package/idea/Table2/Components/Templates/TemplateCreate.tsx +0 -75
- package/idea/Table2/Components/Templates/TemplateCreateDefault.tsx +0 -45
- package/idea/Table2/Components/Templates/TemplateList.tsx +0 -167
- package/idea/Table2/Components/Templates/repo/TemplateRepo.ts +0 -51
- package/idea/Table2/_table.scss +0 -300
- package/idea/Table2/hooks/useDefaultTemplate.ts +0 -22
- package/idea/Table2/hooks/useTableKeyboard.ts +0 -115
- package/src/assets/icons/light/faPenField.ts +0 -15
- package/src/assets/icons/solid/faMagnifyingGlass.ts +0 -15
- package/src/components/Dialog/DeleteItemDialog.tsx +0 -52
- package/src/components/Dialog/hooks/useDialogObserver.ts +0 -21
- /package/{src/components → idea}/Table/Components/Columns/ColumnsList.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Columns/SetColumnsList.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Edit/ItemActionsMenu.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Edit/TableEditRow.tsx +0 -0
- /package/{src/components → idea}/Table/Components/FilterItem.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Header/TableHeader.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Header/TableHeaderRow.tsx +0 -0
- /package/{src/components → idea}/Table/Components/SetSortList.tsx +0 -0
- /package/{src/components → idea}/Table/Components/TableFooter.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Templates/TemplateCreate.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Templates/TemplateCreateDefault.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Templates/TemplateList.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Templates/repo/TemplateRepo.ts +0 -0
- /package/src/utils/{DateUtils.ts → dateUtils.ts} +0 -0
- /package/src/utils/{LocalStorageHelper.ts → localStorageHelper.ts} +0 -0
- /package/src/utils/{NumberUtils.ts → numberUtils.ts} +0 -0
- /package/src/utils/{RootDir.ts → rootDir.ts} +0 -0
- /package/src/utils/{StringUtils.ts → stringUtils.ts} +0 -0
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { FC, useEffect, useState } from 'react';
|
|
2
|
-
import { ITableColumn } from '../../../../types/ITable';
|
|
3
|
-
import { Draggable, Droppable } from 'react-beautiful-dnd';
|
|
4
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
import { faGripDotsVertical } from '../../../../icons/solid/faGripDotsVertical';
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
id: 'hidden' | 'visible';
|
|
9
|
-
items: ITableColumn[];
|
|
10
|
-
search: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const ColumnsList: FC<Props> = ({ id, items, search }) => {
|
|
14
|
-
const [filteredItems, setFilteredItems] = useState<ITableColumn[]>([]);
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
search.length &&
|
|
18
|
-
setFilteredItems(
|
|
19
|
-
items.filter(e =>
|
|
20
|
-
(typeof e.label === 'string' ? e.label : e.labelForFilter ?? '')
|
|
21
|
-
.toLocaleLowerCase()
|
|
22
|
-
.includes(search.toLocaleLowerCase())
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
}, [search, items]);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Droppable droppableId={id}>
|
|
29
|
-
{({ droppableProps, innerRef, placeholder }) => (
|
|
30
|
-
<div {...droppableProps} ref={innerRef} className="list-box">
|
|
31
|
-
{(search.length ? filteredItems : items).map(c => (
|
|
32
|
-
<Draggable key={c.id} draggableId={c.id} index={items.indexOf(c)}>
|
|
33
|
-
{({ innerRef, draggableProps, dragHandleProps }) => (
|
|
34
|
-
<div
|
|
35
|
-
className="item"
|
|
36
|
-
ref={innerRef}
|
|
37
|
-
{...draggableProps}
|
|
38
|
-
{...dragHandleProps}
|
|
39
|
-
style={{
|
|
40
|
-
...draggableProps.style,
|
|
41
|
-
top: 'unset',
|
|
42
|
-
left: 'unset',
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
{c.label}
|
|
46
|
-
<FontAwesomeIcon icon={faGripDotsVertical} />
|
|
47
|
-
</div>
|
|
48
|
-
)}
|
|
49
|
-
</Draggable>
|
|
50
|
-
))}
|
|
51
|
-
{placeholder}
|
|
52
|
-
</div>
|
|
53
|
-
)}
|
|
54
|
-
</Droppable>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { FC, useEffect, useState } from 'react';
|
|
2
|
-
import { DragDropContext, OnDragEndResponder } from 'react-beautiful-dnd';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import { ITableColumn } from '../../../../types/ITable';
|
|
5
|
-
import { Dialog } from '../../../Dialog/Dialog';
|
|
6
|
-
import { faArrowRightArrowLeft } from '../../../../icons/regular/faArrowRightArrowLeft';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
import { ColumnsList } from './ColumnsList';
|
|
9
|
-
import { SearchInput } from '../../../Inputs/SearchInput';
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
columns: ITableColumn[];
|
|
13
|
-
setColumns: (data: ITableColumn[]) => void;
|
|
14
|
-
isOpen: boolean;
|
|
15
|
-
onClose: () => void;
|
|
16
|
-
withSearch?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export const SetColumnsList: FC<Props> = ({
|
|
19
|
-
columns,
|
|
20
|
-
setColumns,
|
|
21
|
-
isOpen,
|
|
22
|
-
onClose,
|
|
23
|
-
withSearch,
|
|
24
|
-
}) => {
|
|
25
|
-
const [hidden, setHidden] = useState<ITableColumn[]>([]);
|
|
26
|
-
const [visible, setVisible] = useState<ITableColumn[]>([]);
|
|
27
|
-
const [searchHidden, setSearchHidden] = useState('');
|
|
28
|
-
const [searchVisible, setSearchVisible] = useState('');
|
|
29
|
-
|
|
30
|
-
const { t } = useTranslation();
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (isOpen) {
|
|
34
|
-
let hiddenCols: ITableColumn[] = [];
|
|
35
|
-
let visibleCols: ITableColumn[] = [];
|
|
36
|
-
columns.forEach(
|
|
37
|
-
col =>
|
|
38
|
-
col.id !== 'actions' &&
|
|
39
|
-
(!!col.hidden ? hiddenCols.push(col) : visibleCols.push(col))
|
|
40
|
-
);
|
|
41
|
-
setHidden(hiddenCols);
|
|
42
|
-
setVisible(visibleCols);
|
|
43
|
-
}
|
|
44
|
-
}, [isOpen, columns]);
|
|
45
|
-
|
|
46
|
-
const onDragEnd: OnDragEndResponder = ({ source, destination }) => {
|
|
47
|
-
if (!destination) return;
|
|
48
|
-
const hiddenCols = [...hidden];
|
|
49
|
-
const visibleCols = [...visible];
|
|
50
|
-
const destinationIsHidden = destination.droppableId === 'hidden';
|
|
51
|
-
|
|
52
|
-
const sourceList = source.droppableId === 'hidden' ? hiddenCols : visibleCols;
|
|
53
|
-
const destinationList = destinationIsHidden ? hiddenCols : visibleCols;
|
|
54
|
-
|
|
55
|
-
const [removed] = sourceList.splice(source.index, 1);
|
|
56
|
-
destinationList.splice(destination.index, 0, removed);
|
|
57
|
-
if (source.droppableId !== destination.droppableId) {
|
|
58
|
-
destinationList[destination.index].hidden = destinationIsHidden;
|
|
59
|
-
setHidden(hiddenCols);
|
|
60
|
-
setVisible(visibleCols);
|
|
61
|
-
} else {
|
|
62
|
-
destinationIsHidden ? setHidden(hiddenCols) : setVisible(visibleCols);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const onSubmit = () => {
|
|
67
|
-
setColumns([...visible, ...hidden]);
|
|
68
|
-
onClose();
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<DragDropContext onDragEnd={onDragEnd}>
|
|
73
|
-
<Dialog
|
|
74
|
-
isOpen={isOpen}
|
|
75
|
-
onClose={onClose}
|
|
76
|
-
confirmButton={{
|
|
77
|
-
label: t('Confirm'),
|
|
78
|
-
onClick: onSubmit,
|
|
79
|
-
}}
|
|
80
|
-
cancelButton={{ label: t('Cancel') }}
|
|
81
|
-
noBackgroundClick
|
|
82
|
-
>
|
|
83
|
-
<div className="dual-list-container">
|
|
84
|
-
<p className="pb-3">{t('DragDropListsInfo')}</p>
|
|
85
|
-
<div className="dual-list-content">
|
|
86
|
-
<p className="bold ml-2">{t('HiddenColumns')}:</p>
|
|
87
|
-
<div />
|
|
88
|
-
<p className="bold ml-2">{t('SelectedColumns')}:</p>
|
|
89
|
-
|
|
90
|
-
{withSearch && (
|
|
91
|
-
<>
|
|
92
|
-
<SearchInput onSearch={setSearchHidden} />
|
|
93
|
-
<div />
|
|
94
|
-
<SearchInput onSearch={setSearchVisible} />
|
|
95
|
-
</>
|
|
96
|
-
)}
|
|
97
|
-
<ColumnsList id="hidden" items={hidden} search={searchHidden} />
|
|
98
|
-
<div className="exchange-icon">
|
|
99
|
-
<FontAwesomeIcon icon={faArrowRightArrowLeft} />
|
|
100
|
-
</div>
|
|
101
|
-
<ColumnsList id="visible" items={visible} search={searchVisible} />
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
</Dialog>
|
|
105
|
-
</DragDropContext>
|
|
106
|
-
);
|
|
107
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { FC, useState } from 'react';
|
|
2
|
-
import { faEllipsisVertical } from '../../../../icons/light/faEllipsisVertical';
|
|
3
|
-
import { IconButton } from '../../../Button/IconButton';
|
|
4
|
-
import { Menu } from '../../../Menu/Menu';
|
|
5
|
-
import { MenuItem } from '../../../Menu/MenuItem';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
item: any;
|
|
10
|
-
setSelectedItem?: (item: any) => void;
|
|
11
|
-
setItemToDeleteUuid?: (uuid: string) => void;
|
|
12
|
-
actions?: {
|
|
13
|
-
label: string;
|
|
14
|
-
onClick: (uuid: string) => void;
|
|
15
|
-
hidden?: boolean;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
}[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const ItemActionsMenu: FC<Props> = ({
|
|
21
|
-
item,
|
|
22
|
-
setSelectedItem,
|
|
23
|
-
setItemToDeleteUuid,
|
|
24
|
-
actions,
|
|
25
|
-
}) => {
|
|
26
|
-
const [menuOpen, setMenuOpen] = useState(false);
|
|
27
|
-
|
|
28
|
-
const { t } = useTranslation();
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Menu
|
|
32
|
-
isOpen={menuOpen}
|
|
33
|
-
onClose={() => setMenuOpen(false)}
|
|
34
|
-
placementX="right"
|
|
35
|
-
renderButton={ref => (
|
|
36
|
-
<IconButton
|
|
37
|
-
ref={ref}
|
|
38
|
-
icon={faEllipsisVertical}
|
|
39
|
-
active={menuOpen}
|
|
40
|
-
onClick={e => {
|
|
41
|
-
e.stopPropagation();
|
|
42
|
-
setMenuOpen(!menuOpen);
|
|
43
|
-
}}
|
|
44
|
-
/>
|
|
45
|
-
)}
|
|
46
|
-
>
|
|
47
|
-
{!!setSelectedItem && (
|
|
48
|
-
<MenuItem
|
|
49
|
-
onClick={e => {
|
|
50
|
-
e.stopPropagation();
|
|
51
|
-
setSelectedItem(item);
|
|
52
|
-
setMenuOpen(false);
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
<p>{t('Edit')}</p>
|
|
56
|
-
</MenuItem>
|
|
57
|
-
)}
|
|
58
|
-
{actions?.map(
|
|
59
|
-
action =>
|
|
60
|
-
!action.hidden && (
|
|
61
|
-
<MenuItem
|
|
62
|
-
key={action.label}
|
|
63
|
-
disabled={!!action.disabled}
|
|
64
|
-
onClick={e => {
|
|
65
|
-
e.stopPropagation();
|
|
66
|
-
action.onClick(item.uuid);
|
|
67
|
-
setMenuOpen(false);
|
|
68
|
-
}}
|
|
69
|
-
>
|
|
70
|
-
<p>{action.label}</p>
|
|
71
|
-
</MenuItem>
|
|
72
|
-
)
|
|
73
|
-
)}
|
|
74
|
-
{!!setItemToDeleteUuid && (
|
|
75
|
-
<MenuItem
|
|
76
|
-
onClick={e => {
|
|
77
|
-
e.stopPropagation();
|
|
78
|
-
setItemToDeleteUuid(item.uuid);
|
|
79
|
-
setMenuOpen(false);
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
<p>{t('Delete')}</p>
|
|
83
|
-
</MenuItem>
|
|
84
|
-
)}
|
|
85
|
-
</Menu>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FC, RefObject } from 'react';
|
|
2
|
-
import { faCheck } from '../../../../icons/light/faCheck';
|
|
3
|
-
import { faXmark } from '../../../../icons/light/faXmark';
|
|
4
|
-
import { IconButton } from '../../../Button/IconButton';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
setData: (item: any) => void;
|
|
8
|
-
clearItem: () => void;
|
|
9
|
-
inputFocusRef?: RefObject<any>;
|
|
10
|
-
defaultDataValue?: any;
|
|
11
|
-
}
|
|
12
|
-
export const ItemEditOptionsButtons: FC<Props> = ({
|
|
13
|
-
setData,
|
|
14
|
-
clearItem,
|
|
15
|
-
inputFocusRef,
|
|
16
|
-
defaultDataValue,
|
|
17
|
-
}) => {
|
|
18
|
-
return (
|
|
19
|
-
<div className="flex center gap-1">
|
|
20
|
-
<IconButton icon={faCheck} className="p-1" />
|
|
21
|
-
<IconButton
|
|
22
|
-
icon={faXmark}
|
|
23
|
-
className="p-1"
|
|
24
|
-
onClick={() => {
|
|
25
|
-
setData(defaultDataValue || {});
|
|
26
|
-
inputFocusRef?.current?.focus();
|
|
27
|
-
clearItem();
|
|
28
|
-
}}
|
|
29
|
-
/>
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { FC, isValidElement, useEffect } from 'react';
|
|
2
|
-
import { ITableDataItem, ITableEditRow } from '../../../../types/ITable';
|
|
3
|
-
import { ItemEditOptionsButtons } from './ItemEditOptionsButtons';
|
|
4
|
-
|
|
5
|
-
export const TableEditRow: FC<ITableEditRow> = ({
|
|
6
|
-
columns,
|
|
7
|
-
defaultDataValue,
|
|
8
|
-
data,
|
|
9
|
-
setData,
|
|
10
|
-
item,
|
|
11
|
-
clearItem,
|
|
12
|
-
inputFocusRef,
|
|
13
|
-
}) => {
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
inputFocusRef?.current?.focus();
|
|
16
|
-
setData(item ?? defaultDataValue ?? {});
|
|
17
|
-
}, [item, defaultDataValue, inputFocusRef, setData]);
|
|
18
|
-
|
|
19
|
-
let cells = {
|
|
20
|
-
...data,
|
|
21
|
-
actions: {
|
|
22
|
-
value: (
|
|
23
|
-
<ItemEditOptionsButtons
|
|
24
|
-
setData={setData}
|
|
25
|
-
clearItem={clearItem}
|
|
26
|
-
defaultDataValue={defaultDataValue}
|
|
27
|
-
inputFocusRef={inputFocusRef}
|
|
28
|
-
/>
|
|
29
|
-
),
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
Object.keys(cells).forEach(key => {
|
|
34
|
-
isValidElement(cells[key].value) && (cells[key].className = 'p-1');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const rowData: ITableDataItem = { uuid: item?.uuid, cells };
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<tr data-id={rowData.uuid} className="edit-row">
|
|
41
|
-
{columns.map(
|
|
42
|
-
column =>
|
|
43
|
-
!column.hidden && (
|
|
44
|
-
<td
|
|
45
|
-
key={column.id}
|
|
46
|
-
align={column.align}
|
|
47
|
-
colSpan={rowData.cells[column.id]?.span}
|
|
48
|
-
className={rowData.cells[column.id]?.className}
|
|
49
|
-
>
|
|
50
|
-
{rowData.cells[column.id]?.value}
|
|
51
|
-
</td>
|
|
52
|
-
)
|
|
53
|
-
)}
|
|
54
|
-
</tr>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { ITableFilterItem } from '../../../types/ITable';
|
|
3
|
-
import { Button } from '../../Button/Button';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
item: ITableFilterItem;
|
|
8
|
-
}
|
|
9
|
-
export const FilterItem: FC<Props> = ({ item }) => {
|
|
10
|
-
const { t } = useTranslation();
|
|
11
|
-
return (
|
|
12
|
-
<div key={item.label} className="table-filter-item">
|
|
13
|
-
{/* Added zero-width non-breaking space symbol (⁠)
|
|
14
|
-
because of losing focus from input field when first letter of the label is pressed. */}
|
|
15
|
-
<p className="label">⁠{item.label}</p>
|
|
16
|
-
<div className="field">{item.field}</div>
|
|
17
|
-
<Button label={t('Delete')} onClick={() => item.resetField()} size="m" />
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { ITableColumn } from '../../../../types/ITable';
|
|
4
|
-
import { TableHeaderRow } from './TableHeaderRow';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
columns: ITableColumn[];
|
|
8
|
-
customHeader?: ITableColumn[][];
|
|
9
|
-
headerWrap?: boolean;
|
|
10
|
-
printTable?: boolean;
|
|
11
|
-
sticky?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export const HeaderTable: FC<Props> = ({
|
|
14
|
-
columns,
|
|
15
|
-
customHeader,
|
|
16
|
-
headerWrap,
|
|
17
|
-
printTable,
|
|
18
|
-
sticky,
|
|
19
|
-
}) => (
|
|
20
|
-
<thead
|
|
21
|
-
className={clsx({
|
|
22
|
-
'no-wrap': !headerWrap,
|
|
23
|
-
'sticky-header': sticky,
|
|
24
|
-
})}
|
|
25
|
-
>
|
|
26
|
-
{customHeader ? (
|
|
27
|
-
customHeader?.map((row, i) => (
|
|
28
|
-
// No array manipulation will be performed, so using key 'i' is acceptable.
|
|
29
|
-
<TableHeaderRow key={i} row={row} printTable={printTable} />
|
|
30
|
-
))
|
|
31
|
-
) : (
|
|
32
|
-
<TableHeaderRow row={columns} printTable={printTable} />
|
|
33
|
-
)}
|
|
34
|
-
</thead>
|
|
35
|
-
);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { ITableColumn } from '../../../../types/ITable';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
row: ITableColumn[];
|
|
6
|
-
printTable?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const TableHeaderRow: FC<Props> = ({ row, printTable }) => (
|
|
10
|
-
<tr>
|
|
11
|
-
{row.map(col => (
|
|
12
|
-
<th
|
|
13
|
-
key={col.id}
|
|
14
|
-
colSpan={col.colSpan}
|
|
15
|
-
rowSpan={col.rowSpan}
|
|
16
|
-
className={col.color}
|
|
17
|
-
style={
|
|
18
|
-
col.minWidth
|
|
19
|
-
? { minWidth: col.minWidth }
|
|
20
|
-
: col.width
|
|
21
|
-
? { width: col.width }
|
|
22
|
-
: undefined
|
|
23
|
-
}
|
|
24
|
-
hidden={col.hidden}
|
|
25
|
-
>
|
|
26
|
-
<div className="flex align-center">
|
|
27
|
-
{typeof col.label === 'string' ? (
|
|
28
|
-
<p className={`full-width text-${col.align || 'left'}`}>{col.label}</p>
|
|
29
|
-
) : (
|
|
30
|
-
<div className={`full-width text-${col.align || 'left'}`}>{col.label}</div>
|
|
31
|
-
)}
|
|
32
|
-
{/* {!printTable && <div className="vertical-separator" />} */}
|
|
33
|
-
</div>
|
|
34
|
-
</th>
|
|
35
|
-
))}
|
|
36
|
-
</tr>
|
|
37
|
-
);
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { FC, useEffect } from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
3
|
-
import { faFileArrowDown } from '../../../../icons/regular/faFileArrowDown';
|
|
4
|
-
import { faPrint } from '../../../../icons/solid/faPrint';
|
|
5
|
-
import { faXmark } from '../../../../icons/solid/faXmark';
|
|
6
|
-
import { ICustomPrintData } from '../../../../types/ITable';
|
|
7
|
-
import { formatDate, getCurrentDateFormatted } from '../../../../utils/DateUtils';
|
|
8
|
-
import { Button } from '../../../Button/Button';
|
|
9
|
-
import { useTranslation } from 'react-i18next';
|
|
10
|
-
import { rootDir } from '../../../../utils/RootDir';
|
|
11
|
-
import { useHideZendesk } from '../../../../hooks/useZendesk';
|
|
12
|
-
|
|
13
|
-
interface Props extends ICustomPrintData {
|
|
14
|
-
isOpen: boolean;
|
|
15
|
-
onClose: () => void;
|
|
16
|
-
}
|
|
17
|
-
export const CustomTablePrint: FC<Props> = ({
|
|
18
|
-
isOpen,
|
|
19
|
-
onClose,
|
|
20
|
-
label,
|
|
21
|
-
organization,
|
|
22
|
-
filters,
|
|
23
|
-
content,
|
|
24
|
-
saveXlsx,
|
|
25
|
-
}) => {
|
|
26
|
-
const { t } = useTranslation();
|
|
27
|
-
useHideZendesk();
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
rootDir?.classList.add('hidden');
|
|
31
|
-
return () => {
|
|
32
|
-
rootDir?.classList.remove('hidden');
|
|
33
|
-
};
|
|
34
|
-
}, []);
|
|
35
|
-
|
|
36
|
-
return isOpen
|
|
37
|
-
? createPortal(
|
|
38
|
-
<div className="iui-print-dialog">
|
|
39
|
-
<div className="content">
|
|
40
|
-
<div className="flex justify-between">
|
|
41
|
-
{organization ? (
|
|
42
|
-
<div>
|
|
43
|
-
<p className="name">{organization.name}</p>
|
|
44
|
-
{organization.taxId && <p>{`${t('TaxId')}: ${organization.taxId}`}</p>}
|
|
45
|
-
{organization.registrationNumber && (
|
|
46
|
-
<p>{`${t('BusinessCode')}: ${organization.registrationNumber}`}</p>
|
|
47
|
-
)}
|
|
48
|
-
{organization.jbkjs && <p>JBKJS: {organization.jbkjs}</p>}
|
|
49
|
-
{organization.email && <p>Email: {organization.email}</p>}
|
|
50
|
-
</div>
|
|
51
|
-
) : (
|
|
52
|
-
<div />
|
|
53
|
-
)}
|
|
54
|
-
<div className="text-right">
|
|
55
|
-
<p>{`${t('PrintDate')}: ${getCurrentDateFormatted()}`}</p>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
<h4 className="my-3 text-center">{label}</h4>
|
|
59
|
-
{filters && (
|
|
60
|
-
<div className="flex justify-between">
|
|
61
|
-
<div>
|
|
62
|
-
{filters.basic?.map(
|
|
63
|
-
e =>
|
|
64
|
-
!!e.value && (
|
|
65
|
-
<div key={e.value} className="mb-2">
|
|
66
|
-
<p>{`${e.label}: ${e.value}`}</p>
|
|
67
|
-
</div>
|
|
68
|
-
)
|
|
69
|
-
)}
|
|
70
|
-
</div>
|
|
71
|
-
{filters.date && (
|
|
72
|
-
<div>
|
|
73
|
-
{filters.date.map(
|
|
74
|
-
e =>
|
|
75
|
-
(!!e.from || !!e.to) && (
|
|
76
|
-
<div key={e.label} className="mb-2 text-right">
|
|
77
|
-
<p>
|
|
78
|
-
{e.label} {!!e.from && `${t('from')} ${formatDate(e.from)}`}{' '}
|
|
79
|
-
{`${t('to')} ${formatDate(e.to || new Date().toString())}`}
|
|
80
|
-
</p>
|
|
81
|
-
</div>
|
|
82
|
-
)
|
|
83
|
-
)}
|
|
84
|
-
</div>
|
|
85
|
-
)}
|
|
86
|
-
</div>
|
|
87
|
-
)}
|
|
88
|
-
{content}
|
|
89
|
-
</div>
|
|
90
|
-
<div className="iui-print-actions no-print">
|
|
91
|
-
<Button
|
|
92
|
-
label={t('Cancel')}
|
|
93
|
-
icon={faXmark}
|
|
94
|
-
onClick={e => {
|
|
95
|
-
e.stopPropagation();
|
|
96
|
-
onClose();
|
|
97
|
-
}}
|
|
98
|
-
className="mr-3"
|
|
99
|
-
/>
|
|
100
|
-
{!!saveXlsx && (
|
|
101
|
-
<Button
|
|
102
|
-
label={t('SaveXlsx')}
|
|
103
|
-
icon={faFileArrowDown}
|
|
104
|
-
onClick={() => saveXlsx()}
|
|
105
|
-
className="mr-3"
|
|
106
|
-
/>
|
|
107
|
-
)}
|
|
108
|
-
<Button
|
|
109
|
-
label={t('Print')}
|
|
110
|
-
icon={faPrint}
|
|
111
|
-
solid
|
|
112
|
-
onClick={() => window.print()}
|
|
113
|
-
/>
|
|
114
|
-
</div>
|
|
115
|
-
</div>,
|
|
116
|
-
document.body
|
|
117
|
-
)
|
|
118
|
-
: null;
|
|
119
|
-
};
|