@inceptionbg/iui 2.0.10 → 2.0.12
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/icons/index.d.ts +5 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +169 -85
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/iui.css +1 -1
- package/package.json +1 -1
- package/src/assets/icons/duotone/faCircleUser.ts +6 -6
- package/src/assets/icons/index.ts +2 -0
- package/src/assets/icons/light/faArrowDownShortWide.ts +1 -1
- package/src/assets/icons/light/faArrowDownWideShort.ts +1 -1
- package/src/assets/icons/light/faArrowUpArrowDown.ts +5 -5
- package/src/assets/icons/light/faArrowUpRightFromSquare.ts +1 -1
- package/src/assets/icons/light/faArrowsToLine.ts +1 -1
- package/src/assets/icons/light/faArrowsUpDown.ts +1 -1
- package/src/assets/icons/light/faBookmark.ts +15 -0
- package/src/assets/icons/light/faBookmarkSlash.ts +15 -0
- package/src/assets/icons/light/faCalendarPlus.ts +5 -5
- package/src/assets/icons/light/faCheck.ts +1 -1
- package/src/assets/icons/light/faChevronDown.ts +5 -5
- package/src/assets/icons/light/faChevronRight.ts +5 -5
- package/src/assets/icons/light/faCircleInfo.ts +5 -5
- package/src/assets/icons/light/faCircleXmark.ts +5 -5
- package/src/assets/icons/light/faClipboardCheck.ts +5 -5
- package/src/assets/icons/light/faClockRotateLeft.ts +1 -1
- package/src/assets/icons/light/faEllipsisVertical.ts +1 -1
- package/src/assets/icons/light/faEye.ts +5 -5
- package/src/assets/icons/light/faEyeSlash.ts +5 -5
- package/src/assets/icons/light/faFilter.ts +5 -5
- package/src/assets/icons/light/faGear.ts +1 -1
- package/src/assets/icons/light/faHouse.ts +5 -5
- package/src/assets/icons/light/faIdBadge.ts +5 -5
- package/src/assets/icons/light/faLineColumns.ts +5 -5
- package/src/assets/icons/light/faLink.ts +1 -1
- package/src/assets/icons/light/faMagnifyingGlass.ts +5 -5
- package/src/assets/icons/light/faPen.ts +15 -15
- package/src/assets/icons/light/faPrint.ts +5 -5
- package/src/assets/icons/light/faQuestion.ts +5 -5
- package/src/assets/icons/light/faRotateRight.ts +5 -5
- package/src/assets/icons/light/faTrashCan.ts +5 -5
- package/src/assets/icons/light/faTriangleExclamation.ts +5 -5
- package/src/assets/icons/light/faXmark.ts +1 -1
- package/src/assets/icons/regular/faArrowLeft.ts +6 -6
- package/src/assets/icons/regular/faArrowRightArrowLeft.ts +1 -1
- package/src/assets/icons/regular/faCircleCheck.ts +1 -1
- package/src/assets/icons/regular/faCircleExclamation.ts +1 -1
- package/src/assets/icons/regular/faCircleInfo.ts +1 -1
- package/src/assets/icons/regular/faFileArrowDown.ts +1 -1
- package/src/assets/icons/regular/faFilterCircleXmark.ts +1 -1
- package/src/assets/icons/regular/faTriangleExclamation.ts +1 -1
- package/src/assets/icons/solid/faAngleLeft.ts +1 -1
- package/src/assets/icons/solid/faAngleRight.ts +1 -1
- package/src/assets/icons/solid/faArrowDownWideShort.ts +1 -1
- package/src/assets/icons/solid/faCaretDown.ts +1 -1
- package/src/assets/icons/solid/faCheck.ts +5 -5
- package/src/assets/icons/solid/faEllipsisVertical.ts +1 -1
- package/src/assets/icons/solid/faFilter.ts +1 -1
- package/src/assets/icons/solid/faFloppyDisk.ts +1 -1
- package/src/assets/icons/solid/faGripDotsVertical.ts +1 -1
- package/src/assets/icons/solid/faListUl.ts +1 -1
- package/src/assets/icons/solid/faMinus.ts +6 -6
- package/src/assets/icons/solid/faPlus.ts +6 -6
- package/src/assets/icons/solid/faPrint.ts +1 -1
- package/src/assets/icons/solid/faRotateRight.ts +1 -1
- package/src/assets/icons/solid/faXmark.ts +1 -1
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Button/IconButton.tsx +1 -1
- package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +1 -1
- package/src/components/Dialog/Dialog.tsx +6 -8
- package/src/components/Dialog/components/DialogFooter.tsx +1 -1
- package/src/components/Header/Components/ModuleSelect.tsx +14 -6
- package/src/components/Header/Components/UserMenu.tsx +2 -4
- package/src/components/Inputs/DateInput/DateInput.tsx +1 -2
- package/src/components/Inputs/InputWrapper.tsx +1 -1
- package/src/components/Inputs/PasswordInput.tsx +2 -1
- package/src/components/Inputs/Select2/Select.tsx +0 -1
- package/src/components/Inputs/TextInput.tsx +1 -1
- package/src/components/List/List.tsx +18 -0
- package/src/components/List/ListItem.tsx +24 -0
- package/src/components/Loader/ProgressBar.tsx +41 -0
- package/src/components/Menu/Menu.tsx +0 -3
- package/src/components/Menu/MenuItem.tsx +21 -23
- package/src/components/Menu/NewMenu.tsx +0 -3
- package/src/components/Menu/hooks/useMenuPosition.tsx +26 -8
- package/src/components/Pullover/Pullover.tsx +33 -16
- package/src/components/Sidebar/types/ISidebar.ts +1 -1
- package/src/components/Table/Table.tsx +18 -11
- package/src/components/Table/components/filters/TableFilters.tsx +5 -8
- package/src/components/Table/components/footer/TableFooter.tsx +6 -10
- package/src/components/Table/components/header/TableHeader.tsx +22 -24
- package/src/components/Table/components/header/TableHeaderRow.tsx +16 -7
- package/{idea/Table/Components/Print → src/components/Table/components/print}/TablePrint.tsx +89 -96
- package/src/components/Table/components/sort/TableSort.tsx +2 -0
- package/src/components/Table/components/templates/TableTemplates.tsx +81 -0
- package/src/components/Table/hooks/useTablePrint.ts +75 -0
- package/src/components/Wrappers/PageLayout.tsx +1 -1
- package/src/hooks/useLocalPopoverControl.ts +11 -17
- package/src/hooks/usePopupControl.ts +11 -7
- package/src/index.ts +11 -0
- package/src/styles/App.scss +2 -0
- package/src/styles/common/_animations.scss +8 -14
- package/src/styles/common/_typography.scss +1 -1
- package/src/styles/common/helpers/_base.scss +0 -4
- package/src/styles/components/_header.scss +21 -9
- package/src/styles/components/_list.scss +40 -0
- package/src/styles/components/_loader.scss +3 -1
- package/src/styles/components/_menu.scss +19 -18
- package/src/styles/components/_print.scss +36 -46
- package/src/styles/components/_progressBar.scss +83 -0
- package/src/styles/components/_table.scss +16 -22
- package/src/types/IHeader.ts +13 -7
- package/src/types/IPopup.ts +17 -0
- package/src/types/ITable.ts +55 -32
- package/src/utils/i18n/i18nIUICyrilic.ts +2 -1
- package/src/utils/i18n/i18nIUILatin.ts +16 -12
- package/src/utils/i18n/i18nIUIMe.ts +2 -1
- package/src/utils/icons.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
1
|
+
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
2
2
|
import { FC, FocusEventHandler, InputHTMLAttributes, Ref, useState } from 'react';
|
|
3
3
|
import { InputWrapper } from './InputWrapper';
|
|
4
4
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import { IListItem, ListItem } from './ListItem';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
items: IListItem[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const List: FC<Props> = ({ items }) => {
|
|
9
|
+
if (items.length === 0) return null;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className="iui-list">
|
|
13
|
+
{items.map(item => (
|
|
14
|
+
<ListItem key={item.id ?? item.label} {...item} />
|
|
15
|
+
))}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import type { FC } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface IListItem {
|
|
5
|
+
id?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
desc?: string;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
active?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ListItem: FC<IListItem> = ({ label, desc, onClick, active, disabled }) => (
|
|
14
|
+
<div
|
|
15
|
+
className={clsx('iui-list-item', { active, disabled })}
|
|
16
|
+
onClick={e => {
|
|
17
|
+
e.stopPropagation();
|
|
18
|
+
onClick?.();
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<p className="bold">{label}</p>
|
|
22
|
+
{desc && <div className="iui-list-item-desc">{desc}</div>}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import type { CSSProperties, FC } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
progress?: number;
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ProgressBar: FC<Props> = ({ progress, label }) => {
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
|
|
13
|
+
if (progress === undefined) return null;
|
|
14
|
+
|
|
15
|
+
const now = Math.round(Math.min(Math.max(progress, 0), 100)); // Ensure percentage is between 0 and 100
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className="progress-bar-container">
|
|
19
|
+
<div className="progress-label">{label ?? t('LoadingProgress')}</div>
|
|
20
|
+
<div
|
|
21
|
+
className="progress-bar-bg"
|
|
22
|
+
role="progressbar"
|
|
23
|
+
aria-valuemin={0}
|
|
24
|
+
aria-valuemax={100}
|
|
25
|
+
aria-valuenow={now}
|
|
26
|
+
style={
|
|
27
|
+
{
|
|
28
|
+
'--progress-clip': `${now}%`,
|
|
29
|
+
'--progress-text': `'${now}%'`,
|
|
30
|
+
} as CSSProperties
|
|
31
|
+
}
|
|
32
|
+
>
|
|
33
|
+
<div
|
|
34
|
+
className={clsx('progress-bar-fill', { loading: now < 100 })}
|
|
35
|
+
style={{ width: `${now}%` }}
|
|
36
|
+
/>
|
|
37
|
+
<span className="progress-bar-text">{now}%</span>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -15,7 +15,6 @@ interface Props {
|
|
|
15
15
|
placement?: IMenuPlacement;
|
|
16
16
|
size?: 's' | 'm' | 'l';
|
|
17
17
|
className?: string;
|
|
18
|
-
classNameItem?: string;
|
|
19
18
|
children?: ReactNode;
|
|
20
19
|
}
|
|
21
20
|
|
|
@@ -27,7 +26,6 @@ export const Menu: FC<Props> = ({
|
|
|
27
26
|
placement = 'bottom-left',
|
|
28
27
|
size,
|
|
29
28
|
className,
|
|
30
|
-
classNameItem,
|
|
31
29
|
children,
|
|
32
30
|
}) => {
|
|
33
31
|
const menuRef = useRef<HTMLDivElement>(null);
|
|
@@ -58,7 +56,6 @@ export const Menu: FC<Props> = ({
|
|
|
58
56
|
<MenuItem
|
|
59
57
|
{...item}
|
|
60
58
|
key={item.label}
|
|
61
|
-
className={classNameItem}
|
|
62
59
|
onClick={e => {
|
|
63
60
|
item.onClick?.(e);
|
|
64
61
|
!item.keepOpen && onClose();
|
|
@@ -20,29 +20,27 @@ export const MenuItem: FC<IMenuItem> = ({
|
|
|
20
20
|
className,
|
|
21
21
|
}) =>
|
|
22
22
|
hidden ? null : (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
clickable: !!onClick || !!to,
|
|
27
|
-
disabled,
|
|
28
|
-
active,
|
|
29
|
-
'with-devider': withDevider,
|
|
30
|
-
})}
|
|
23
|
+
<ConditionalWrapper
|
|
24
|
+
condition={!disabled && !!to}
|
|
25
|
+
wrapper={children => <Link to={to!}>{children}</Link>}
|
|
31
26
|
>
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
<div
|
|
28
|
+
className={clsx('iui-menu-item', className, {
|
|
29
|
+
clickable: !!onClick || !!to,
|
|
30
|
+
disabled,
|
|
31
|
+
active,
|
|
32
|
+
'with-devider': withDevider,
|
|
33
|
+
})}
|
|
34
|
+
onClick={disabled ? undefined : onClick}
|
|
35
35
|
>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</ConditionalWrapper>
|
|
47
|
-
</div>
|
|
36
|
+
{icon && (
|
|
37
|
+
<div className="menu-item-icon">
|
|
38
|
+
<FontAwesomeIcon icon={icon} rotation={iconRotation} />
|
|
39
|
+
</div>
|
|
40
|
+
)}
|
|
41
|
+
<NotificationBadge number={badge} size="s" className="menu-item-badge">
|
|
42
|
+
<p className="menu-item-label">{label}</p>
|
|
43
|
+
</NotificationBadge>
|
|
44
|
+
</div>
|
|
45
|
+
</ConditionalWrapper>
|
|
48
46
|
);
|
|
@@ -14,7 +14,6 @@ interface Props {
|
|
|
14
14
|
placement?: IMenuPlacement;
|
|
15
15
|
size?: 's' | 'm' | 'l';
|
|
16
16
|
className?: string;
|
|
17
|
-
classNameItem?: string;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
export const MenuV2: FC<Props> = ({
|
|
@@ -24,7 +23,6 @@ export const MenuV2: FC<Props> = ({
|
|
|
24
23
|
placement = 'bottom-left',
|
|
25
24
|
size,
|
|
26
25
|
className,
|
|
27
|
-
classNameItem,
|
|
28
26
|
}) => {
|
|
29
27
|
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
30
28
|
const popoverRef = useRef<HTMLDivElement>(null);
|
|
@@ -52,7 +50,6 @@ export const MenuV2: FC<Props> = ({
|
|
|
52
50
|
<MenuItem
|
|
53
51
|
{...item}
|
|
54
52
|
key={item.label}
|
|
55
|
-
className={classNameItem}
|
|
56
53
|
onClick={e => {
|
|
57
54
|
item.onClick?.(e);
|
|
58
55
|
!item.keepOpen && popoverRef.current?.hidePopover();
|
|
@@ -33,18 +33,29 @@ export const useMenuPosition = ({
|
|
|
33
33
|
if (containerRef.current && menuRef.current) {
|
|
34
34
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
35
35
|
const menuRect = menuRef.current.getBoundingClientRect();
|
|
36
|
-
|
|
36
|
+
let [placementY, placementX] = placement.split('-');
|
|
37
37
|
|
|
38
38
|
setMinWidth(containerRect.width);
|
|
39
39
|
|
|
40
40
|
let offsetTop = containerRect.bottom + 5;
|
|
41
|
-
// let offsetTop = containerRect.bottom + document.documentElement.scrollTop + 5;
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
let offsetLeft =
|
|
44
43
|
containerRect.left +
|
|
45
44
|
(placementX === 'right' ? containerRect.width - menuRect.width : 0);
|
|
46
45
|
// + document.documentElement.scrollLeft;
|
|
47
46
|
|
|
47
|
+
// Check for horizontal overflow and adjust placement
|
|
48
|
+
if (placementX === 'right' && offsetLeft < 0) {
|
|
49
|
+
placementX = 'left';
|
|
50
|
+
offsetLeft = containerRect.left;
|
|
51
|
+
} else if (
|
|
52
|
+
placementX === 'left' &&
|
|
53
|
+
offsetLeft + menuRect.width > window.innerWidth
|
|
54
|
+
) {
|
|
55
|
+
placementX = 'right';
|
|
56
|
+
offsetLeft = containerRect.left + containerRect.width - menuRect.width;
|
|
57
|
+
}
|
|
58
|
+
|
|
48
59
|
if (placementY === 'bottom') {
|
|
49
60
|
setMaxHeight(window.innerHeight - containerRect.bottom - 20);
|
|
50
61
|
}
|
|
@@ -56,10 +67,21 @@ export const useMenuPosition = ({
|
|
|
56
67
|
);
|
|
57
68
|
}
|
|
58
69
|
|
|
70
|
+
// Check for vertical overflow and adjust placement
|
|
71
|
+
if (placementY === 'bottom' && offsetTop + menuRect.height > window.innerHeight) {
|
|
72
|
+
placementY = 'top';
|
|
73
|
+
offsetTop = containerRect.top - menuRect.height - 5;
|
|
74
|
+
setMaxHeight(containerRect.top - 20);
|
|
75
|
+
} else if (placementY === 'top' && offsetTop < 0) {
|
|
76
|
+
placementY = 'bottom';
|
|
77
|
+
offsetTop = containerRect.bottom + 5;
|
|
78
|
+
setMaxHeight(window.innerHeight - containerRect.bottom - 20);
|
|
79
|
+
}
|
|
80
|
+
|
|
59
81
|
// check for space on the bottom
|
|
60
82
|
if (
|
|
61
83
|
(placementY === 'auto' && offsetTop + menuRect.height > window.innerHeight) ||
|
|
62
|
-
|
|
84
|
+
(placement.split('-')[0] === 'top' && placementY !== 'bottom')
|
|
63
85
|
) {
|
|
64
86
|
offsetTop = containerRect.top - menuRect.height - 5; //+ document.documentElement.scrollTop
|
|
65
87
|
}
|
|
@@ -72,10 +94,6 @@ export const useMenuPosition = ({
|
|
|
72
94
|
isOpen
|
|
73
95
|
? document.addEventListener('resize', recalculatePosition)
|
|
74
96
|
: document.removeEventListener('resize', recalculatePosition);
|
|
75
|
-
// Disable scroll & fix page resize on menu open
|
|
76
|
-
document.body.style.marginRight =
|
|
77
|
-
isOpen && window.innerWidth > document.body.clientWidth ? '19px' : '';
|
|
78
|
-
// document.body.style.overflow = isOpen ? 'hidden' : '';
|
|
79
97
|
|
|
80
98
|
recalculatePosition();
|
|
81
99
|
return () => {
|
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
import { FC, KeyboardEventHandler, ReactNode,
|
|
1
|
+
import { FC, KeyboardEventHandler, ReactNode, useEffect, useRef } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import { rootDir } from '../../utils/rootDir';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { SearchInput } from '../Inputs/SearchInput';
|
|
6
|
-
import {
|
|
7
|
-
PopupControlRef,
|
|
8
|
-
useLocalPopoverControl,
|
|
9
|
-
} from '../../hooks/useLocalPopoverControl';
|
|
6
|
+
import { useLocalPopoverControl } from '../../hooks/useLocalPopoverControl';
|
|
10
7
|
import { ConditionalWrapper } from '../Wrappers/ConditionalWrapper';
|
|
11
8
|
import { useGetFocusableElements } from '../../hooks/useGetFocusableElements';
|
|
12
9
|
import { IDialogFooterActions } from '../Dialog/components/DialogFooter';
|
|
13
10
|
import { Button } from '../Button/Button';
|
|
14
11
|
import { useTranslation } from 'react-i18next';
|
|
15
12
|
import { onPopupKeyDown } from '../../utils/popupUtils';
|
|
13
|
+
import { ILocalPopupControl } from '../../types/IPopup';
|
|
14
|
+
import { Loader } from '../Loader/Loader';
|
|
16
15
|
|
|
17
16
|
interface Props {
|
|
18
|
-
|
|
17
|
+
id?: string;
|
|
18
|
+
control: ILocalPopupControl;
|
|
19
19
|
header?: {
|
|
20
20
|
title: string;
|
|
21
21
|
onSearch?: (search: string) => void;
|
|
22
22
|
};
|
|
23
|
+
isLoading?: boolean;
|
|
23
24
|
onFormSubmit?: () => void;
|
|
24
25
|
onCloseCallback?: () => void;
|
|
25
26
|
footer?: IDialogFooterActions;
|
|
26
27
|
size?: 'vw25' | 'vw50' | 'vw75' | 'vw100' | 'w500' | 'w600';
|
|
27
28
|
className?: string;
|
|
28
29
|
contentClassName?: string;
|
|
30
|
+
portalTarget?: HTMLElement;
|
|
29
31
|
children: ReactNode;
|
|
30
32
|
}
|
|
31
|
-
|
|
32
33
|
export const Pullover: FC<Props> = ({
|
|
33
|
-
|
|
34
|
+
id,
|
|
35
|
+
control,
|
|
34
36
|
header,
|
|
37
|
+
isLoading = false,
|
|
35
38
|
onFormSubmit,
|
|
36
39
|
onCloseCallback,
|
|
37
40
|
footer,
|
|
38
41
|
size = 'vw50',
|
|
39
42
|
className,
|
|
40
43
|
contentClassName,
|
|
44
|
+
portalTarget,
|
|
41
45
|
children,
|
|
42
46
|
}) => {
|
|
43
47
|
const { t } = useTranslation();
|
|
44
48
|
const searchRef = useRef<HTMLInputElement>(null);
|
|
45
49
|
|
|
46
50
|
const { elementRef, isOpen, onClose } = useLocalPopoverControl({
|
|
47
|
-
|
|
51
|
+
control,
|
|
48
52
|
onCloseCallback,
|
|
49
53
|
});
|
|
50
54
|
|
|
@@ -84,6 +88,7 @@ export const Pullover: FC<Props> = ({
|
|
|
84
88
|
return isOpen
|
|
85
89
|
? createPortal(
|
|
86
90
|
<div
|
|
91
|
+
id={id}
|
|
87
92
|
ref={elementRef}
|
|
88
93
|
className="pullover"
|
|
89
94
|
onClick={onClose}
|
|
@@ -94,7 +99,7 @@ export const Pullover: FC<Props> = ({
|
|
|
94
99
|
<div className={clsx('container', size)} onClick={e => e.stopPropagation()}>
|
|
95
100
|
<div className={clsx('content', className)}>
|
|
96
101
|
{header && (
|
|
97
|
-
<div className="pullover-header">
|
|
102
|
+
<div className="pullover-header no-print">
|
|
98
103
|
<h3>{header.title}</h3>
|
|
99
104
|
{header.onSearch && (
|
|
100
105
|
<SearchInput
|
|
@@ -121,24 +126,36 @@ export const Pullover: FC<Props> = ({
|
|
|
121
126
|
)}
|
|
122
127
|
>
|
|
123
128
|
{/* CONTENT */}
|
|
124
|
-
<
|
|
125
|
-
{
|
|
126
|
-
|
|
129
|
+
<Loader isLoading={isLoading}>
|
|
130
|
+
<div className={clsx('pullover-content', contentClassName)}>
|
|
131
|
+
{children}
|
|
132
|
+
</div>
|
|
133
|
+
</Loader>
|
|
127
134
|
|
|
128
135
|
{/* FOOTER */}
|
|
129
136
|
{footer && (
|
|
130
|
-
<div className={clsx('pullover-footer', className)}>
|
|
137
|
+
<div className={clsx('pullover-footer no-print', className)}>
|
|
131
138
|
{footer.additionalButton && (
|
|
132
139
|
<Button
|
|
133
140
|
{...footer.additionalButton}
|
|
141
|
+
disabled={footer.additionalButton.disabled || isLoading}
|
|
134
142
|
variant="simple"
|
|
135
143
|
className="mr-auto"
|
|
136
144
|
/>
|
|
137
145
|
)}
|
|
138
|
-
<Button
|
|
146
|
+
<Button
|
|
147
|
+
label={t('Cancel')}
|
|
148
|
+
variant="outlined"
|
|
149
|
+
onClick={onClose}
|
|
150
|
+
disabled={isLoading}
|
|
151
|
+
/>
|
|
139
152
|
<Button
|
|
140
153
|
{...footer.confirmButton}
|
|
141
154
|
label={footer.confirmButton.label ?? t('Confirm')}
|
|
155
|
+
disabled={footer.confirmButton.disabled || isLoading}
|
|
156
|
+
type={
|
|
157
|
+
(footer.confirmButton.type ?? onFormSubmit) ? 'submit' : 'button'
|
|
158
|
+
}
|
|
142
159
|
/>
|
|
143
160
|
</div>
|
|
144
161
|
)}
|
|
@@ -146,7 +163,7 @@ export const Pullover: FC<Props> = ({
|
|
|
146
163
|
</div>
|
|
147
164
|
</div>
|
|
148
165
|
</div>,
|
|
149
|
-
rootDir
|
|
166
|
+
portalTarget ?? rootDir
|
|
150
167
|
)
|
|
151
168
|
: null;
|
|
152
169
|
};
|
|
@@ -15,27 +15,28 @@ import { TableSelect } from './components/select/TableSelect';
|
|
|
15
15
|
import { TableSort } from './components/sort/TableSort';
|
|
16
16
|
import { TableFilters } from './components/filters/TableFilters';
|
|
17
17
|
import { TableEditRow } from './components/edit/TableEditRow';
|
|
18
|
+
import { TablePrint } from './components/print/TablePrint';
|
|
19
|
+
import { TableTemplates } from './components/templates/TableTemplates';
|
|
18
20
|
|
|
19
21
|
export const TableContent: FC = () => {
|
|
20
22
|
const {
|
|
21
23
|
columns,
|
|
24
|
+
customHeader,
|
|
25
|
+
headerWrap,
|
|
22
26
|
// setColumns,
|
|
23
27
|
// withColumnsSearch,
|
|
24
28
|
data,
|
|
25
29
|
sumRows,
|
|
26
30
|
isLoading,
|
|
27
|
-
|
|
28
|
-
// filterData,
|
|
29
31
|
selectedRowUuid,
|
|
30
|
-
// printData,
|
|
31
32
|
// customPrintData,
|
|
32
33
|
// templates,
|
|
33
34
|
// additionsalOptions,
|
|
34
35
|
footer,
|
|
35
|
-
className,
|
|
36
36
|
rowHeight = 'm',
|
|
37
37
|
maxHeight,
|
|
38
38
|
editable,
|
|
39
|
+
...props
|
|
39
40
|
} = useTableContext();
|
|
40
41
|
|
|
41
42
|
const [extendedRow, setExtendedRow] = useState('');
|
|
@@ -48,7 +49,7 @@ export const TableContent: FC = () => {
|
|
|
48
49
|
<Loader isLoading={!!isLoading}>
|
|
49
50
|
<div
|
|
50
51
|
// onKeyDown={handleKeyDown}
|
|
51
|
-
className={clsx('iui-table', className, {
|
|
52
|
+
className={clsx('iui-table', props.className, {
|
|
52
53
|
'pb-3': data.length === 0,
|
|
53
54
|
})}
|
|
54
55
|
// tabIndex={-1}
|
|
@@ -74,9 +75,11 @@ export const TableContent: FC = () => {
|
|
|
74
75
|
additionsalOptions={additionsalOptions}
|
|
75
76
|
/>
|
|
76
77
|
)} */}
|
|
77
|
-
<TableSelect />
|
|
78
|
-
<TableFilters />
|
|
79
|
-
<TableSort />
|
|
78
|
+
{props.selectActions.length > 0 && <TableSelect />}
|
|
79
|
+
{props.filterData && <TableFilters />}
|
|
80
|
+
{props.sortData && <TableSort />}
|
|
81
|
+
{props.templates && <TableTemplates />}
|
|
82
|
+
{props.printData && <TablePrint />}
|
|
80
83
|
</div>
|
|
81
84
|
<div className="table-container" style={{ maxHeight }}>
|
|
82
85
|
<ConditionalWrapper
|
|
@@ -99,7 +102,12 @@ export const TableContent: FC = () => {
|
|
|
99
102
|
)}
|
|
100
103
|
>
|
|
101
104
|
<table className="full-width">
|
|
102
|
-
<HeaderTable
|
|
105
|
+
<HeaderTable
|
|
106
|
+
columns={columns}
|
|
107
|
+
customHeader={customHeader}
|
|
108
|
+
headerWrap={headerWrap}
|
|
109
|
+
maxHeight={maxHeight}
|
|
110
|
+
/>
|
|
103
111
|
<tbody>
|
|
104
112
|
{data.length ? (
|
|
105
113
|
<>
|
|
@@ -167,7 +175,6 @@ export const TableContent: FC = () => {
|
|
|
167
175
|
link: cell?.link,
|
|
168
176
|
'clickable-column': cell?.onClick,
|
|
169
177
|
'word-break': column.break,
|
|
170
|
-
'no-border': isExtended,
|
|
171
178
|
}
|
|
172
179
|
)}
|
|
173
180
|
colSpan={cell?.span}
|
|
@@ -247,7 +254,7 @@ export const TableContent: FC = () => {
|
|
|
247
254
|
totalRows={footer.totalRows}
|
|
248
255
|
noTotalRows={noTotalRows}
|
|
249
256
|
customLimit={footer.customPagination?.customLimit}
|
|
250
|
-
|
|
257
|
+
refetch={footer.refetch}
|
|
251
258
|
dataLength={data.length}
|
|
252
259
|
/>
|
|
253
260
|
)}
|
|
@@ -19,15 +19,13 @@ import { faFilterCircleXmark } from '../../../../assets/icons/regular/faFilterCi
|
|
|
19
19
|
import { usePopupControl } from '../../../../hooks/usePopupControl';
|
|
20
20
|
|
|
21
21
|
export const TableFilters: FC = () => {
|
|
22
|
-
const { controlRef, isOpen, onClose, onOpen } = usePopupControl();
|
|
23
|
-
|
|
24
|
-
const [filterSearch, setFilterSearch] = useState('');
|
|
25
|
-
|
|
26
22
|
const { t } = useTranslation();
|
|
27
23
|
const { columns, filterData } = useTableContext();
|
|
28
|
-
|
|
24
|
+
const { control, onClose, onOpen } = usePopupControl();
|
|
29
25
|
const columnIds = getVisibleColumnsIds(columns);
|
|
30
26
|
|
|
27
|
+
const [filterSearch, setFilterSearch] = useState('');
|
|
28
|
+
|
|
31
29
|
const {
|
|
32
30
|
filters,
|
|
33
31
|
additionalFilters,
|
|
@@ -67,7 +65,7 @@ export const TableFilters: FC = () => {
|
|
|
67
65
|
<IconButton
|
|
68
66
|
tooltip={t('Filter')}
|
|
69
67
|
icon={faFilter}
|
|
70
|
-
active={isOpen}
|
|
68
|
+
active={control.isOpen}
|
|
71
69
|
onClick={onOpen}
|
|
72
70
|
size="s"
|
|
73
71
|
variant="outlined"
|
|
@@ -75,7 +73,7 @@ export const TableFilters: FC = () => {
|
|
|
75
73
|
</NotificationBadge>
|
|
76
74
|
|
|
77
75
|
<Pullover
|
|
78
|
-
|
|
76
|
+
control={control}
|
|
79
77
|
header={{
|
|
80
78
|
title: t('Filter'),
|
|
81
79
|
onSearch: visibleFilters.length > 2 ? setFilterSearch : undefined,
|
|
@@ -102,7 +100,6 @@ export const TableFilters: FC = () => {
|
|
|
102
100
|
? JSON.stringify(searchData) === JSON.stringify(defaultSearch)
|
|
103
101
|
: Object.keys(searchData).length === 0,
|
|
104
102
|
},
|
|
105
|
-
// onClose,
|
|
106
103
|
}}
|
|
107
104
|
contentClassName="iui-filters-list"
|
|
108
105
|
onCloseCallback={() => setFilterSearch('')}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
2
1
|
import { FC, MouseEventHandler, useEffect, useState } from 'react';
|
|
3
2
|
import { faAngleLeft } from '../../../../assets/icons/solid/faAngleLeft';
|
|
4
3
|
import { faAngleRight } from '../../../../assets/icons/solid/faAngleRight';
|
|
@@ -15,10 +14,7 @@ interface Props {
|
|
|
15
14
|
pagination: IPaginationControl;
|
|
16
15
|
noTotalRows?: boolean;
|
|
17
16
|
dataLength: number;
|
|
18
|
-
|
|
19
|
-
icon?: IconDefinition;
|
|
20
|
-
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
21
|
-
};
|
|
17
|
+
refetch?: MouseEventHandler<HTMLButtonElement>;
|
|
22
18
|
totalRows?: number;
|
|
23
19
|
customLimit?: number[];
|
|
24
20
|
}
|
|
@@ -28,7 +24,7 @@ export const TableFooter: FC<Props> = ({
|
|
|
28
24
|
totalRows = 0,
|
|
29
25
|
noTotalRows,
|
|
30
26
|
dataLength,
|
|
31
|
-
|
|
27
|
+
refetch,
|
|
32
28
|
customLimit,
|
|
33
29
|
}) => {
|
|
34
30
|
const [tempOffset, setTempOffset] = useState(offset + 1);
|
|
@@ -48,11 +44,11 @@ export const TableFooter: FC<Props> = ({
|
|
|
48
44
|
const maxOffset = Math.ceil(totalRows / limit);
|
|
49
45
|
|
|
50
46
|
return (
|
|
51
|
-
<div className={`table-footer ${
|
|
52
|
-
{!!
|
|
47
|
+
<div className={`table-footer ${refetch ? 'justify-between' : 'justify-right'}`}>
|
|
48
|
+
{!!refetch && (
|
|
53
49
|
<IconButton
|
|
54
|
-
icon={
|
|
55
|
-
onClick={
|
|
50
|
+
icon={faRotateRight}
|
|
51
|
+
onClick={refetch}
|
|
56
52
|
tooltip={t('RefreshData')}
|
|
57
53
|
variant="outlined"
|
|
58
54
|
size="s"
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import { FC
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { TableHeaderRow } from './TableHeaderRow';
|
|
4
|
-
import {
|
|
4
|
+
import { ITableColumn } from '../../../../types/ITable';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
type Props = {
|
|
7
|
+
columns: ITableColumn[];
|
|
8
|
+
customHeader?: ITableColumn[][];
|
|
9
|
+
headerWrap?: boolean;
|
|
10
|
+
maxHeight?: number | string;
|
|
11
|
+
print?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const HeaderTable: FC<Props> = ({
|
|
15
|
+
columns,
|
|
16
|
+
customHeader,
|
|
17
|
+
headerWrap,
|
|
18
|
+
maxHeight,
|
|
19
|
+
print,
|
|
20
|
+
}) => {
|
|
21
|
+
const isSticky = !print && !!maxHeight;
|
|
9
22
|
|
|
10
23
|
return (
|
|
11
24
|
<thead
|
|
@@ -14,29 +27,14 @@ export const HeaderTable: FC = () => {
|
|
|
14
27
|
'sticky-header': isSticky,
|
|
15
28
|
})}
|
|
16
29
|
>
|
|
17
|
-
<BorderRow span={columns.length} />
|
|
18
30
|
{customHeader ? (
|
|
19
|
-
customHeader
|
|
20
|
-
// No array manipulation will be performed, so using key 'i' is
|
|
21
|
-
<
|
|
22
|
-
<TableHeaderRow row={row} />
|
|
23
|
-
{(isSticky || i + 1 < customHeader.length) && (
|
|
24
|
-
<BorderRow span={columns.length} />
|
|
25
|
-
)}
|
|
26
|
-
</Fragment>
|
|
31
|
+
customHeader.map((row, i) => (
|
|
32
|
+
// No array manipulation will be performed, so using key 'i' is fine.
|
|
33
|
+
<TableHeaderRow key={i} row={row} print={print} />
|
|
27
34
|
))
|
|
28
35
|
) : (
|
|
29
|
-
|
|
30
|
-
<TableHeaderRow row={columns} />
|
|
31
|
-
<BorderRow span={columns.length} />
|
|
32
|
-
</>
|
|
36
|
+
<TableHeaderRow row={columns} print={print} />
|
|
33
37
|
)}
|
|
34
38
|
</thead>
|
|
35
39
|
);
|
|
36
40
|
};
|
|
37
|
-
|
|
38
|
-
const BorderRow: FC<{ span?: number }> = ({ span }) => (
|
|
39
|
-
<tr>
|
|
40
|
-
<th className="border-row" colSpan={span} />
|
|
41
|
-
</tr>
|
|
42
|
-
);
|