@inceptionbg/iui 2.0.11 → 2.0.13
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 +174 -79
- 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/rollup.config.js +1 -5
- 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 +5 -5
- 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 +2 -2
- package/src/components/Button/IconButton.tsx +1 -1
- package/src/components/Button/SplitButton.tsx +91 -0
- package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +1 -1
- package/src/components/Dialog/components/DialogFooter.tsx +6 -2
- package/src/components/Header/Components/ModuleSelect.tsx +14 -6
- package/src/components/Inputs/InputWrapper.tsx +1 -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/Pullover/Pullover.tsx +15 -6
- 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 +3 -6
- 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 +21 -1
- package/src/components/Table/components/templates/TableTemplates.tsx +98 -0
- package/src/components/Table/components/templates/components/CreateTemplateDialog.tsx +41 -0
- package/src/components/Table/hooks/useTablePrint.ts +75 -0
- package/src/index.ts +10 -0
- package/src/styles/App.scss +3 -0
- package/src/styles/common/_animations.scss +8 -14
- package/src/styles/common/helpers/_base.scss +0 -4
- package/src/styles/common/maps/_buttonMaps.scss +42 -0
- package/src/styles/components/_button.scss +11 -50
- package/src/styles/components/_buttonSplit.scss +90 -0
- package/src/styles/components/_header.scss +21 -9
- package/src/styles/components/_list.scss +41 -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 +17 -23
- package/src/styles/variables/_variables.scss +1 -0
- package/src/types/ITable.ts +42 -32
- package/src/utils/i18n/i18nIUICyrilic.ts +3 -2
- package/src/utils/i18n/i18nIUILatin.ts +18 -12
- package/src/utils/i18n/i18nIUIMe.ts +3 -2
- package/src/utils/icons.ts +1 -1
- package/tsconfig.json +2 -0
|
@@ -2,7 +2,7 @@ import { FC } from 'react';
|
|
|
2
2
|
import { Link } from 'react-router';
|
|
3
3
|
import { Menu } from '../../Menu/Menu';
|
|
4
4
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
5
|
+
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
6
6
|
import { useIsMenuOpen } from '../../../hooks/useIsMenuOpen';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
@@ -19,7 +19,6 @@ export const ModuleSelect: FC<Props> = ({ modules, activeModule }) => {
|
|
|
19
19
|
<Menu
|
|
20
20
|
isOpen={isMenuOpen}
|
|
21
21
|
onClose={onMenuClose}
|
|
22
|
-
// id="headerModuleSelect"
|
|
23
22
|
renderButton={ref => (
|
|
24
23
|
<button ref={ref} className="header-button clickable" onClick={onMenuOpen}>
|
|
25
24
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
|
|
@@ -36,10 +35,19 @@ export const ModuleSelect: FC<Props> = ({ modules, activeModule }) => {
|
|
|
36
35
|
</svg>
|
|
37
36
|
</button>
|
|
38
37
|
)}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
className="modules-menu"
|
|
39
|
+
>
|
|
40
|
+
{modules.map(e => (
|
|
41
|
+
<Link to={e.url} key={e.name}>
|
|
42
|
+
<div className="module-item clickable hover-neutral">
|
|
43
|
+
<div className="menu-item-icon">
|
|
44
|
+
<FontAwesomeIcon icon={e.icon} />
|
|
45
|
+
</div>
|
|
46
|
+
<p className="menu-item-label">{e.name}</p>
|
|
47
|
+
</div>
|
|
48
|
+
</Link>
|
|
49
|
+
))}
|
|
50
|
+
</Menu>
|
|
43
51
|
)}
|
|
44
52
|
|
|
45
53
|
{activeModule && (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
1
|
+
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
2
2
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { FC, ReactNode, Ref } from 'react';
|
|
@@ -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 || 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();
|
|
@@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
12
12
|
import { onPopupKeyDown } from '../../utils/popupUtils';
|
|
13
13
|
import { ILocalPopupControl } from '../../types/IPopup';
|
|
14
14
|
import { Loader } from '../Loader/Loader';
|
|
15
|
+
import { SplitButton } from '../Button/SplitButton';
|
|
15
16
|
|
|
16
17
|
interface Props {
|
|
17
18
|
id?: string;
|
|
@@ -22,30 +23,35 @@ interface Props {
|
|
|
22
23
|
};
|
|
23
24
|
isLoading?: boolean;
|
|
24
25
|
onFormSubmit?: () => void;
|
|
26
|
+
onContentClick?: () => void;
|
|
25
27
|
onCloseCallback?: () => void;
|
|
26
28
|
footer?: IDialogFooterActions;
|
|
27
29
|
size?: 'vw25' | 'vw50' | 'vw75' | 'vw100' | 'w500' | 'w600';
|
|
28
30
|
className?: string;
|
|
29
31
|
contentClassName?: string;
|
|
32
|
+
portalTarget?: HTMLElement;
|
|
30
33
|
children: ReactNode;
|
|
31
34
|
}
|
|
32
|
-
|
|
33
35
|
export const Pullover: FC<Props> = ({
|
|
34
36
|
id,
|
|
35
37
|
control,
|
|
36
38
|
header,
|
|
37
39
|
isLoading = false,
|
|
38
40
|
onFormSubmit,
|
|
41
|
+
onContentClick,
|
|
39
42
|
onCloseCallback,
|
|
40
43
|
footer,
|
|
41
44
|
size = 'vw50',
|
|
42
45
|
className,
|
|
43
46
|
contentClassName,
|
|
47
|
+
portalTarget,
|
|
44
48
|
children,
|
|
45
49
|
}) => {
|
|
46
50
|
const { t } = useTranslation();
|
|
47
51
|
const searchRef = useRef<HTMLInputElement>(null);
|
|
48
52
|
|
|
53
|
+
const ConfirmButton = footer?.confirmButton.splitActions ? SplitButton : Button;
|
|
54
|
+
|
|
49
55
|
const { elementRef, isOpen, onClose } = useLocalPopoverControl({
|
|
50
56
|
control,
|
|
51
57
|
onCloseCallback,
|
|
@@ -98,7 +104,7 @@ export const Pullover: FC<Props> = ({
|
|
|
98
104
|
<div className={clsx('container', size)} onClick={e => e.stopPropagation()}>
|
|
99
105
|
<div className={clsx('content', className)}>
|
|
100
106
|
{header && (
|
|
101
|
-
<div className="pullover-header">
|
|
107
|
+
<div className="pullover-header no-print">
|
|
102
108
|
<h3>{header.title}</h3>
|
|
103
109
|
{header.onSearch && (
|
|
104
110
|
<SearchInput
|
|
@@ -126,14 +132,17 @@ export const Pullover: FC<Props> = ({
|
|
|
126
132
|
>
|
|
127
133
|
{/* CONTENT */}
|
|
128
134
|
<Loader isLoading={isLoading}>
|
|
129
|
-
<div
|
|
135
|
+
<div
|
|
136
|
+
onClick={onContentClick}
|
|
137
|
+
className={clsx('pullover-content', contentClassName)}
|
|
138
|
+
>
|
|
130
139
|
{children}
|
|
131
140
|
</div>
|
|
132
141
|
</Loader>
|
|
133
142
|
|
|
134
143
|
{/* FOOTER */}
|
|
135
144
|
{footer && (
|
|
136
|
-
<div className={clsx('pullover-footer', className)}>
|
|
145
|
+
<div className={clsx('pullover-footer no-print', className)}>
|
|
137
146
|
{footer.additionalButton && (
|
|
138
147
|
<Button
|
|
139
148
|
{...footer.additionalButton}
|
|
@@ -148,7 +157,7 @@ export const Pullover: FC<Props> = ({
|
|
|
148
157
|
onClick={onClose}
|
|
149
158
|
disabled={isLoading}
|
|
150
159
|
/>
|
|
151
|
-
<
|
|
160
|
+
<ConfirmButton
|
|
152
161
|
{...footer.confirmButton}
|
|
153
162
|
label={footer.confirmButton.label ?? t('Confirm')}
|
|
154
163
|
disabled={footer.confirmButton.disabled || isLoading}
|
|
@@ -162,7 +171,7 @@ export const Pullover: FC<Props> = ({
|
|
|
162
171
|
</div>
|
|
163
172
|
</div>
|
|
164
173
|
</div>,
|
|
165
|
-
rootDir
|
|
174
|
+
portalTarget ?? rootDir
|
|
166
175
|
)
|
|
167
176
|
: null;
|
|
168
177
|
};
|
|
@@ -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.templateData && <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 { control, 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,
|
|
@@ -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
|
-
);
|
|
@@ -4,9 +4,10 @@ import clsx from 'clsx';
|
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
row: ITableColumn[];
|
|
7
|
+
print?: boolean;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
export const TableHeaderRow: FC<Props> = ({ row }) => {
|
|
10
|
+
export const TableHeaderRow: FC<Props> = ({ row, print }) => {
|
|
10
11
|
// const { sortData } = useTableContext();
|
|
11
12
|
// const { sort, setSort, sortOptions } = sortData ?? {};
|
|
12
13
|
// const activeSortOption = sortOptions?.find(e => sort?.startsWith(e.value));
|
|
@@ -18,18 +19,26 @@ export const TableHeaderRow: FC<Props> = ({ row }) => {
|
|
|
18
19
|
key={col.id}
|
|
19
20
|
colSpan={col.colSpan}
|
|
20
21
|
rowSpan={col.rowSpan}
|
|
21
|
-
className={
|
|
22
|
+
className={
|
|
23
|
+
print
|
|
24
|
+
? undefined
|
|
25
|
+
: clsx(col.color, col.className, {
|
|
26
|
+
'not-first-cell': col.notFirstCell,
|
|
27
|
+
})
|
|
28
|
+
}
|
|
22
29
|
// onClick={() => {
|
|
23
30
|
// const sortValue = sortOptions?.find(e => col.label === e.label)?.value;
|
|
24
31
|
// sortValue &&
|
|
25
32
|
// setSort?.(sort === sortValue + desc ? sortValue + asc : sortValue + desc);
|
|
26
33
|
// }}
|
|
27
34
|
style={
|
|
28
|
-
|
|
29
|
-
?
|
|
30
|
-
: col.
|
|
31
|
-
? {
|
|
32
|
-
:
|
|
35
|
+
print
|
|
36
|
+
? undefined
|
|
37
|
+
: col.minWidth
|
|
38
|
+
? { minWidth: col.minWidth }
|
|
39
|
+
: col.width
|
|
40
|
+
? { width: col.width }
|
|
41
|
+
: undefined
|
|
33
42
|
}
|
|
34
43
|
hidden={col.hidden}
|
|
35
44
|
>
|