@inceptionbg/iui 2.0.5 → 2.0.6
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 +43 -0
- package/dist/icons/index.js +1 -0
- package/dist/index.d.ts +24 -15
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/iui.css +1 -1
- package/idea/Menu/Menu.tsx +119 -0
- package/idea/Menu/MenuItem.tsx +74 -0
- package/idea/Menu/hooks/useMenuControl.ts +13 -0
- package/idea/Menu.tsx +132 -0
- package/idea/NoAccessInfo.tsx +193 -0
- package/idea/Notifications.tsx +245 -0
- package/idea/Table2/Components/Columns/ColumnsList.tsx +56 -0
- package/idea/Table2/Components/Columns/SetColumnsList.tsx +107 -0
- package/idea/Table2/Components/Edit/ItemActionsMenu.tsx +87 -0
- package/idea/Table2/Components/Edit/ItemEditOptionsButtons.tsx +32 -0
- package/idea/Table2/Components/Edit/TableEditRow.tsx +56 -0
- package/idea/Table2/Components/FilterItem.tsx +20 -0
- package/idea/Table2/Components/Header/TableHeader.tsx +35 -0
- package/idea/Table2/Components/Header/TableHeaderRow.tsx +37 -0
- package/idea/Table2/Components/Print/CustomTablePrint.tsx +119 -0
- package/idea/Table2/Components/Print/TablePrint.tsx +208 -0
- package/idea/Table2/Components/SetSortList.tsx +33 -0
- package/idea/Table2/Components/SetTableFilter.tsx +90 -0
- package/idea/Table2/Components/TableFooter.tsx +107 -0
- package/idea/Table2/Components/TableOptions.tsx +211 -0
- package/idea/Table2/Components/Templates/TemplateCreate.tsx +75 -0
- package/idea/Table2/Components/Templates/TemplateCreateDefault.tsx +45 -0
- package/idea/Table2/Components/Templates/TemplateList.tsx +167 -0
- package/idea/Table2/Components/Templates/repo/TemplateRepo.ts +51 -0
- package/idea/Table2/Table.tsx +657 -0
- package/idea/Table2/_table.scss +300 -0
- package/idea/Table2/hooks/useDefaultTemplate.ts +22 -0
- package/idea/Table2/hooks/useTableKeyboard.ts +115 -0
- package/package.json +8 -4
- package/rollup.config.js +80 -0
- package/src/assets/icons/duotone/faCircleUser.ts +17 -0
- package/src/assets/icons/index.ts +20 -0
- package/src/assets/icons/light/faArrowDownShortWide.ts +15 -0
- package/src/assets/icons/light/faArrowDownWideShort.ts +15 -0
- package/src/assets/icons/light/faArrowUpArrowDown.ts +15 -0
- package/src/assets/icons/light/faArrowUpRightFromSquare.ts +15 -0
- package/src/assets/icons/light/faArrowsToLine.ts +15 -0
- package/src/assets/icons/light/faArrowsUpDown.ts +15 -0
- package/src/assets/icons/light/faCalendarPlus.ts +15 -0
- package/src/assets/icons/light/faCheck.ts +15 -0
- package/src/assets/icons/light/faChevronDown.ts +15 -0
- package/src/assets/icons/light/faChevronRight.ts +15 -0
- package/src/assets/icons/light/faCircleInfo.ts +15 -0
- package/src/assets/icons/light/faCircleXmark.ts +15 -0
- package/src/assets/icons/light/faClockRotateLeft.ts +15 -0
- package/src/assets/icons/light/faEllipsisVertical.ts +15 -0
- package/src/assets/icons/light/faEye.ts +15 -0
- package/src/assets/icons/light/faEyeSlash.ts +15 -0
- package/src/assets/icons/light/faFilter.ts +15 -0
- package/src/assets/icons/light/faGear.ts +15 -0
- package/src/assets/icons/light/faHouse.ts +15 -0
- package/src/assets/icons/light/faIdBadge.ts +15 -0
- package/src/assets/icons/light/faLineColumns.ts +15 -0
- package/src/assets/icons/light/faLink.ts +15 -0
- package/src/assets/icons/light/faMagnifyingGlass.ts +15 -0
- package/src/assets/icons/light/faPenField.ts +15 -0
- package/src/assets/icons/light/faPrint.ts +15 -0
- package/src/assets/icons/light/faQuestion.ts +15 -0
- package/src/assets/icons/light/faRotateRight.ts +15 -0
- package/src/assets/icons/light/faTrashCan.ts +15 -0
- package/src/assets/icons/light/faTriangleExclamation.ts +15 -0
- package/src/assets/icons/light/faXmark.ts +15 -0
- package/src/assets/icons/regular/faArrowLeft.ts +15 -0
- package/src/assets/icons/regular/faArrowRightArrowLeft.ts +15 -0
- package/src/assets/icons/regular/faCircleCheck.ts +15 -0
- package/src/assets/icons/regular/faCircleExclamation.ts +15 -0
- package/src/assets/icons/regular/faCircleInfo.ts +15 -0
- package/src/assets/icons/regular/faFileArrowDown.ts +15 -0
- package/src/assets/icons/regular/faFilterCircleXmark.ts +15 -0
- package/src/assets/icons/regular/faTriangleExclamation.ts +15 -0
- package/src/assets/icons/solid/faAngleLeft.ts +15 -0
- package/src/assets/icons/solid/faAngleRight.ts +15 -0
- package/src/assets/icons/solid/faArrowDownWideShort.ts +15 -0
- package/src/assets/icons/solid/faCaretDown.ts +15 -0
- package/src/assets/icons/solid/faCheck.ts +15 -0
- package/src/assets/icons/solid/faEllipsisVertical.ts +15 -0
- package/src/assets/icons/solid/faFilter.ts +15 -0
- package/src/assets/icons/solid/faFloppyDisk.ts +15 -0
- package/src/assets/icons/solid/faGripDotsVertical.ts +15 -0
- package/src/assets/icons/solid/faListUl.ts +15 -0
- package/src/assets/icons/solid/faMagnifyingGlass.ts +15 -0
- package/src/assets/icons/solid/faMinus.ts +15 -0
- package/src/assets/icons/solid/faPlus.ts +15 -0
- package/src/assets/icons/solid/faPrint.ts +15 -0
- package/src/assets/icons/solid/faRotateRight.ts +15 -0
- package/src/assets/icons/solid/faXmark.ts +15 -0
- package/src/assets/images/logo/mts.svg +5703 -0
- package/src/assets/images/logo/paperless.svg +21 -0
- package/src/assets/images/logo/pismonosa.png +0 -0
- package/src/assets/images/not-found.svg +19 -0
- package/src/components/Accordions/Accordions.tsx +64 -0
- package/src/components/Alert/Alert.tsx +31 -0
- package/src/components/Badge/DotBadge.tsx +16 -0
- package/src/components/Badge/NotificationBadge.tsx +29 -0
- package/src/components/Badge/PillBadge.tsx +13 -0
- package/src/components/Button/Button.tsx +56 -0
- package/src/components/Button/IconButton.tsx +49 -0
- package/src/components/Dashboard/Dashboard.tsx +9 -0
- package/src/components/Dashboard/DashboardWidget.tsx +44 -0
- package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +37 -0
- package/src/components/Dialog/DeleteItemDialog.tsx +52 -0
- package/src/components/Dialog/Dialog.tsx +226 -0
- package/src/components/Dialog/hooks/useDialogKeyboard.ts +41 -0
- package/src/components/Dialog/hooks/useDialogObserver.ts +21 -0
- package/src/components/Header/Components/ModuleSelect.tsx +55 -0
- package/src/components/Header/Components/UserMenu.tsx +44 -0
- package/src/components/Header/Header.tsx +36 -0
- package/src/components/Helper/Collapse.tsx +52 -0
- package/src/components/Inputs/Checkbox.tsx +53 -0
- package/src/components/Inputs/CurrencyInput.tsx +123 -0
- package/src/components/Inputs/DateInput/DateInput.tsx +176 -0
- package/src/components/Inputs/DateInput/components/DatePartInput.tsx +154 -0
- package/src/components/Inputs/InputWrapper.tsx +90 -0
- package/src/components/Inputs/NumberInput.tsx +83 -0
- package/src/components/Inputs/PasswordInput.tsx +38 -0
- package/src/components/Inputs/Radio.tsx +59 -0
- package/src/components/Inputs/RadioGroup.tsx +48 -0
- package/src/components/Inputs/RadioLarge.tsx +39 -0
- package/src/components/Inputs/SearchInput.tsx +40 -0
- package/src/components/Inputs/Select2/Select.tsx +224 -0
- package/src/components/Inputs/Select2/select.scss +43 -0
- package/src/components/Inputs/Selects/Select.tsx +17 -0
- package/src/components/Inputs/Selects/components/CustomSelectComponents.tsx +19 -0
- package/src/components/Inputs/Selects/components/SelectWrapper.tsx +126 -0
- package/src/components/Inputs/Selects/utils/selectStyles.ts +104 -0
- package/src/components/Inputs/TextAreaInput.tsx +67 -0
- package/src/components/Inputs/TextInput.tsx +98 -0
- package/src/components/Inputs/TimeInput/TimeInput.tsx +81 -0
- package/src/components/Loader/Loader.tsx +53 -0
- package/src/components/Menu/Menu.tsx +68 -0
- package/src/components/Menu/MenuItem.tsx +47 -0
- package/src/components/Menu/NewMenu.tsx +66 -0
- package/src/components/Menu/hooks/useMenuPosition.tsx +80 -0
- package/src/components/Pullover/Pullover.tsx +89 -0
- package/src/components/Router/Router.tsx +51 -0
- package/src/components/Sidebar/AddButton.tsx +22 -0
- package/src/components/Sidebar/Sidebar.tsx +81 -0
- package/src/components/Sidebar/SidebarItem.tsx +84 -0
- package/src/components/Sidebar/types/ISidebar.ts +28 -0
- package/src/components/Table/Components/Columns/ColumnsList.tsx +61 -0
- package/src/components/Table/Components/Columns/SetColumnsList.tsx +113 -0
- package/src/components/Table/Components/Edit/ItemActionsMenu.tsx +84 -0
- package/src/components/Table/Components/Edit/ItemEditOptionsButtons.tsx +31 -0
- package/src/components/Table/Components/Edit/TableEditRow.tsx +56 -0
- package/src/components/Table/Components/FilterItem.tsx +20 -0
- package/src/components/Table/Components/Header/TableHeader.tsx +45 -0
- package/src/components/Table/Components/Header/TableHeaderRow.tsx +37 -0
- package/src/components/Table/Components/Print/CustomTablePrint.tsx +114 -0
- package/src/components/Table/Components/Print/TablePrint.tsx +207 -0
- package/src/components/Table/Components/SetSortList.tsx +30 -0
- package/src/components/Table/Components/SetTableFilter.tsx +90 -0
- package/src/components/Table/Components/TableFooter.tsx +135 -0
- package/src/components/Table/Components/TableOptions.tsx +226 -0
- package/src/components/Table/Components/Templates/TemplateCreate.tsx +80 -0
- package/src/components/Table/Components/Templates/TemplateCreateDefault.tsx +45 -0
- package/src/components/Table/Components/Templates/TemplateList.tsx +167 -0
- package/src/components/Table/Components/Templates/repo/TemplateRepo.ts +53 -0
- package/src/components/Table/Table.tsx +527 -0
- package/src/components/Table/hooks/useDefaultTemplate.ts +20 -0
- package/src/components/Table/hooks/useTableKeyboard.ts +138 -0
- package/src/components/Table/hooks/useTableSelect.ts +11 -0
- package/src/components/Tabs/Tabs.tsx +66 -0
- package/src/components/Tooltip/Tooltip.tsx +133 -0
- package/src/components/Tree/Tree.tsx +22 -0
- package/src/components/Tree/TreeItem.tsx +56 -0
- package/src/components/Wrappers/AppLayout.tsx +17 -0
- package/src/components/Wrappers/ConditionalWrapper.tsx +10 -0
- package/src/components/Wrappers/FormWrapper.tsx +81 -0
- package/src/components/Wrappers/PageLayout.tsx +152 -0
- package/src/hooks/useBackgroundClose.ts +18 -0
- package/src/hooks/useIsMenuOpen.ts +11 -0
- package/src/hooks/useOnEsc.ts +14 -0
- package/src/hooks/useZendesk.ts +21 -0
- package/src/index.ts +324 -0
- package/src/pages/NoAccessPage.tsx +27 -0
- package/src/pages/NotFoundPage.tsx +26 -0
- package/src/styles/App.scss +43 -0
- package/src/styles/common/_animations.scss +64 -0
- package/src/styles/common/_typography.scss +88 -0
- package/src/styles/common/helpers/_base.scss +55 -0
- package/src/styles/common/helpers/_color.scss +7 -0
- package/src/styles/common/helpers/_display.scss +85 -0
- package/src/styles/common/helpers/_size.scss +25 -0
- package/src/styles/common/maps/_align.scss +21 -0
- package/src/styles/common/maps/_info-types.scss +1 -0
- package/src/styles/common/maps/_spacing.scss +78 -0
- package/src/styles/common/maps/_text.scss +14 -0
- package/src/styles/components/_accordions.scss +46 -0
- package/src/styles/components/_alert.scss +23 -0
- package/src/styles/components/_badge.scss +76 -0
- package/src/styles/components/_button.scss +138 -0
- package/src/styles/components/_card.scss +24 -0
- package/src/styles/components/_dialog.scss +111 -0
- package/src/styles/components/_form.scss +8 -0
- package/src/styles/components/_header.scss +109 -0
- package/src/styles/components/_input.scss +158 -0
- package/src/styles/components/_inputCheckbox.scss +105 -0
- package/src/styles/components/_inputDateTime.scss +161 -0
- package/src/styles/components/_inputRadio.scss +83 -0
- package/src/styles/components/_inputSelect.scss +6 -0
- package/src/styles/components/_loader.scss +44 -0
- package/src/styles/components/_menu-v2.scss +67 -0
- package/src/styles/components/_menu.scss +53 -0
- package/src/styles/components/_page.scss +62 -0
- package/src/styles/components/_portal.scss +8 -0
- package/src/styles/components/_print.scss +87 -0
- package/src/styles/components/_pullover.scss +43 -0
- package/src/styles/components/_scrollbar.scss +18 -0
- package/src/styles/components/_sidebar.scss +206 -0
- package/src/styles/components/_smallComponents.scss +23 -0
- package/src/styles/components/_table.scss +270 -0
- package/src/styles/components/_tabs.scss +33 -0
- package/src/styles/components/_tooltip.scss +48 -0
- package/src/styles/components/_tree.scss +21 -0
- package/src/styles/components/_widget.scss +90 -0
- package/src/styles/pages/_fullScreenPage.scss +64 -0
- package/src/styles/variables/_bp.scss +5 -0
- package/src/styles/variables/_variables.scss +130 -0
- package/src/types/Base/custom.d.ts +9 -0
- package/src/types/IBasic.ts +31 -0
- package/src/types/IError.ts +5 -0
- package/src/types/IHeader.ts +24 -0
- package/src/types/IInfo.ts +1 -0
- package/src/types/IKeyboard.ts +37 -0
- package/src/types/IMenu.ts +18 -0
- package/src/types/IRouter.ts +6 -0
- package/src/types/ISelect.ts +52 -0
- package/src/types/ITab.ts +10 -0
- package/src/types/ITable.ts +249 -0
- package/src/types/ITree.ts +6 -0
- package/src/utils/DateUtils.ts +32 -0
- package/src/utils/InputPatternValidation.ts +12 -0
- package/src/utils/LocalStorageHelper.ts +24 -0
- package/src/utils/NumberUtils.ts +21 -0
- package/src/utils/ObjectUtils.ts +85 -0
- package/src/utils/RootDir.ts +1 -0
- package/src/utils/StringUtils.ts +18 -0
- package/src/utils/TableUtils.ts +130 -0
- package/src/utils/Toasts.ts +6 -0
- package/src/utils/UrlUtils.ts +4 -0
- package/src/utils/fileUtils.ts +176 -0
- package/src/utils/i18n/i18nIUICyrilic.ts +90 -0
- package/src/utils/i18n/i18nIUILatin.ts +90 -0
- package/src/utils/i18n/i18nIUIMe.ts +88 -0
- package/src/utils/icons.ts +13 -0
- package/tsconfig.icons.json +5 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IconDefinition, RotateProp } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
+
import { IButtonColor } from '../components/Button/Button';
|
|
3
|
+
import { IMenuItem } from './IMenu';
|
|
4
|
+
|
|
5
|
+
export interface IHeaderAction {
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: IconDefinition;
|
|
8
|
+
iconRotation?: RotateProp;
|
|
9
|
+
to?: string;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
solid?: boolean;
|
|
12
|
+
color?: IButtonColor;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
hidden?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type IHeaderUserMenuProps = {
|
|
18
|
+
isOpen: boolean;
|
|
19
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
20
|
+
userName?: string;
|
|
21
|
+
organizationName?: string;
|
|
22
|
+
showBadge?: boolean;
|
|
23
|
+
menuItems?: IMenuItem[];
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IInfoType = 'success' | 'info' | 'warning' | 'danger';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ITableDataItem } from './ITable';
|
|
2
|
+
|
|
3
|
+
export interface IKeyboardAction {
|
|
4
|
+
key: string;
|
|
5
|
+
onAction: () => void;
|
|
6
|
+
ctrl?: boolean;
|
|
7
|
+
normalizedKey?: boolean;
|
|
8
|
+
onBulkAction?: (itemUuids: string[]) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ITableKeyboardActionsBase {
|
|
13
|
+
moveDisabled?: boolean;
|
|
14
|
+
editDisabled?: boolean;
|
|
15
|
+
delete?: {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
setItemToDeleteUuids: (itemUuids: string[]) => void;
|
|
18
|
+
onAction?: () => void;
|
|
19
|
+
};
|
|
20
|
+
additional?: (props: {
|
|
21
|
+
focusedRow: ITableDataItem | null;
|
|
22
|
+
isEditing: boolean;
|
|
23
|
+
isAdding: boolean;
|
|
24
|
+
}) => IKeyboardAction[];
|
|
25
|
+
}
|
|
26
|
+
export interface ITableKeyboardActionsProp extends ITableKeyboardActionsBase {
|
|
27
|
+
add?: {
|
|
28
|
+
isAdding: boolean;
|
|
29
|
+
setIsAdding: (item: boolean) => void;
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
};
|
|
32
|
+
edit?: {
|
|
33
|
+
item: any | null;
|
|
34
|
+
setItem: (item: any | null) => void;
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IconDefinition, RotateProp } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
+
import { MouseEventHandler } from 'react';
|
|
3
|
+
|
|
4
|
+
export type IMenuPlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
5
|
+
|
|
6
|
+
export interface IMenuItem {
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: IconDefinition;
|
|
9
|
+
iconRotation?: RotateProp;
|
|
10
|
+
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
11
|
+
to?: string;
|
|
12
|
+
badge?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
hidden?: boolean;
|
|
15
|
+
withDevider?: boolean;
|
|
16
|
+
keepOpen?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { IValueLabel } from './IBasic';
|
|
3
|
+
|
|
4
|
+
export interface ISelectData extends IValueLabel {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
[id: string]: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface BaseSelectProps {
|
|
10
|
+
variant: 'basic' | 'async' | 'async-creatable';
|
|
11
|
+
label?: string;
|
|
12
|
+
value?: any;
|
|
13
|
+
isMulti?: boolean;
|
|
14
|
+
onChange: (value: any) => void;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
helperText?: string;
|
|
19
|
+
errorText?: string;
|
|
20
|
+
error?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
minWidth?: number;
|
|
23
|
+
menuWidth?: 'fit-content' | 'max-content' | number;
|
|
24
|
+
autoFocus?: boolean;
|
|
25
|
+
isClearable?: boolean;
|
|
26
|
+
isOpen?: boolean;
|
|
27
|
+
onMenuOpen?: () => void;
|
|
28
|
+
onMenuClose?: () => void;
|
|
29
|
+
openDirection?: 'top' | 'bottom' | 'auto';
|
|
30
|
+
closeMenuOnSelect?: boolean;
|
|
31
|
+
noOptionsMessage?: string;
|
|
32
|
+
formatOptionLabel?: (value: any) => any;
|
|
33
|
+
ref?: Ref<HTMLInputElement>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface BasicSelectProps extends BaseSelectProps {
|
|
37
|
+
variant: 'basic';
|
|
38
|
+
options: ISelectData[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface AsyncSelectProps extends BaseSelectProps {
|
|
42
|
+
variant: 'async';
|
|
43
|
+
loadOptions: any;
|
|
44
|
+
defaultData?: ISelectData[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface CreatableSelectProps extends BaseSelectProps {
|
|
48
|
+
variant: 'async-creatable';
|
|
49
|
+
loadOptions: any;
|
|
50
|
+
onCreate: (inputValue: string) => void;
|
|
51
|
+
defaultData?: ISelectData[];
|
|
52
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dispatch,
|
|
3
|
+
FunctionComponent,
|
|
4
|
+
MouseEvent,
|
|
5
|
+
ReactElement,
|
|
6
|
+
ReactNode,
|
|
7
|
+
RefObject,
|
|
8
|
+
SetStateAction,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
11
|
+
import { IAnyObject, ISimpleObject } from './IBasic';
|
|
12
|
+
import { ITableKeyboardActionsBase } from './IKeyboard';
|
|
13
|
+
|
|
14
|
+
export interface ITable {
|
|
15
|
+
columns: ITableColumn[];
|
|
16
|
+
setColumns?: (data: ITableColumn[]) => void;
|
|
17
|
+
withColumnsSearch?: boolean;
|
|
18
|
+
customHeader?: ITableColumn[][];
|
|
19
|
+
data: ITableDataItem[];
|
|
20
|
+
sumRows?: ITableDataItem[];
|
|
21
|
+
isLoading?: boolean;
|
|
22
|
+
serverSidePagination?: IServerSidePagination;
|
|
23
|
+
customPagination?: {
|
|
24
|
+
defaultLimit?: number;
|
|
25
|
+
customLimit?: number[];
|
|
26
|
+
};
|
|
27
|
+
selectedRowUuid?: string;
|
|
28
|
+
footerAction?: {
|
|
29
|
+
icon?: IconDefinition;
|
|
30
|
+
onClick: () => void;
|
|
31
|
+
};
|
|
32
|
+
headerWrap?: boolean;
|
|
33
|
+
hideFooter?: boolean;
|
|
34
|
+
noTotalRows?: boolean;
|
|
35
|
+
showLastBorder?: boolean;
|
|
36
|
+
filterData?: ITableFilterData;
|
|
37
|
+
sortData?: ITableSortData;
|
|
38
|
+
printData?: IPrintData;
|
|
39
|
+
customPrintData?: ICustomPrintData;
|
|
40
|
+
additionsalOptions?: ReactNode;
|
|
41
|
+
rowSelect?: {
|
|
42
|
+
selectedRows: Set<string>;
|
|
43
|
+
setSelectedRows: Dispatch<SetStateAction<Set<string>>>;
|
|
44
|
+
actions: ITableSelectedActions[];
|
|
45
|
+
};
|
|
46
|
+
className?: string;
|
|
47
|
+
rowHeight?: 'xs' | 's' | 'm';
|
|
48
|
+
maxHeight?: string;
|
|
49
|
+
editable?: {
|
|
50
|
+
selectedItem?: any;
|
|
51
|
+
setSelectedItem?: (item: any) => void;
|
|
52
|
+
defaultDataValue?: any;
|
|
53
|
+
EditableRow?: FunctionComponent<ITableEditRow>;
|
|
54
|
+
onSubmit: (data: any, onSubmitCallback: () => void) => void;
|
|
55
|
+
addDisabled?: boolean;
|
|
56
|
+
addLabel?: string;
|
|
57
|
+
inputFocusRef?: RefObject<any>;
|
|
58
|
+
keepEditOnSubmit?: boolean;
|
|
59
|
+
};
|
|
60
|
+
keyboard?: {
|
|
61
|
+
enabled: boolean;
|
|
62
|
+
actions: ITableKeyboardActionsBase;
|
|
63
|
+
};
|
|
64
|
+
templates?: {
|
|
65
|
+
identifier: string;
|
|
66
|
+
data: IReportTemplateData;
|
|
67
|
+
setTemplateName?: (templateName: string) => void;
|
|
68
|
+
onClearFilters: () => void;
|
|
69
|
+
allowPublicCreate?: boolean;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface ITableColumn {
|
|
74
|
+
id: string;
|
|
75
|
+
label?: string | ReactElement;
|
|
76
|
+
labelForFilter?: string;
|
|
77
|
+
align?: 'center' | 'left' | 'right' | 'justify' | undefined;
|
|
78
|
+
hidden?: boolean;
|
|
79
|
+
unavailable?: boolean;
|
|
80
|
+
width?: string;
|
|
81
|
+
minWidth?: string;
|
|
82
|
+
colSpan?: number;
|
|
83
|
+
rowSpan?: number;
|
|
84
|
+
break?: boolean;
|
|
85
|
+
color?: 'secondary';
|
|
86
|
+
sortOptions?: {
|
|
87
|
+
asc: string;
|
|
88
|
+
desc: string;
|
|
89
|
+
label: string;
|
|
90
|
+
};
|
|
91
|
+
code?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface ITableDataItem {
|
|
95
|
+
uuid: string;
|
|
96
|
+
onRowClick?: (event?: MouseEvent<HTMLTableRowElement>) => void;
|
|
97
|
+
className?: string;
|
|
98
|
+
item?: Record<string, any>;
|
|
99
|
+
disableSelect?: boolean;
|
|
100
|
+
cells: {
|
|
101
|
+
[id: string]: {
|
|
102
|
+
value: any;
|
|
103
|
+
align?: ITableColumn['align'];
|
|
104
|
+
className?: string;
|
|
105
|
+
onClick?: (event?: MouseEvent<HTMLTableCellElement>) => void;
|
|
106
|
+
link?: boolean;
|
|
107
|
+
tooltip?: string;
|
|
108
|
+
span?: number;
|
|
109
|
+
unclickable?: boolean;
|
|
110
|
+
printValue?: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
extendable?: {
|
|
114
|
+
element: ReactElement;
|
|
115
|
+
isLoading?: boolean;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface ITableFilterData {
|
|
120
|
+
columns: string[];
|
|
121
|
+
filters: ITableFilter;
|
|
122
|
+
activeFilterNo?: number;
|
|
123
|
+
additionalFilters?: ReactElement;
|
|
124
|
+
search: IAnyObject;
|
|
125
|
+
searchData: IAnyObject;
|
|
126
|
+
setSearchData: (search: IAnyObject) => void;
|
|
127
|
+
onSubmit: (search: IAnyObject) => void;
|
|
128
|
+
resetData?: IAnyObject;
|
|
129
|
+
excludeFromSearch?: string[];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ITableFilterItem {
|
|
133
|
+
label: string;
|
|
134
|
+
field: ReactElement;
|
|
135
|
+
resetField: () => void;
|
|
136
|
+
}
|
|
137
|
+
export interface ITableFilter {
|
|
138
|
+
[id: string]: ITableFilterItem;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface ITableSortData {
|
|
142
|
+
sort: string;
|
|
143
|
+
setSort: (sort: string) => void;
|
|
144
|
+
sortOptions: ITableSort[];
|
|
145
|
+
menuSize?: 's' | 'm' | 'l';
|
|
146
|
+
}
|
|
147
|
+
export interface ITableSort {
|
|
148
|
+
label: string;
|
|
149
|
+
asc: string;
|
|
150
|
+
desc: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface ITableColumnsData {
|
|
154
|
+
columns: ITableColumn[];
|
|
155
|
+
setColumns: (columns: ITableColumn[]) => void;
|
|
156
|
+
withSearch?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export interface ITableSelectedActions {
|
|
159
|
+
label: string;
|
|
160
|
+
onClick: (selected: Set<string>) => void;
|
|
161
|
+
hidden?: boolean;
|
|
162
|
+
disabled?: boolean;
|
|
163
|
+
clearSelected?: boolean;
|
|
164
|
+
}
|
|
165
|
+
///// PRINT /////
|
|
166
|
+
export interface IBasePrintData {
|
|
167
|
+
label: string;
|
|
168
|
+
organization?: {
|
|
169
|
+
name?: string;
|
|
170
|
+
taxId?: string;
|
|
171
|
+
registrationNumber?: string;
|
|
172
|
+
jbkjs?: string;
|
|
173
|
+
email?: string;
|
|
174
|
+
};
|
|
175
|
+
filters?: {
|
|
176
|
+
basic?: { label: string; value?: string }[];
|
|
177
|
+
date?: { label: string; from?: string; to?: string }[];
|
|
178
|
+
};
|
|
179
|
+
saveXlsx?: () => void;
|
|
180
|
+
}
|
|
181
|
+
export interface ICustomPrintData extends IBasePrintData {
|
|
182
|
+
content: ReactNode;
|
|
183
|
+
}
|
|
184
|
+
export interface IPrintData extends IBasePrintData {
|
|
185
|
+
optionalNode?: {
|
|
186
|
+
aboveTable?: ReactNode;
|
|
187
|
+
bellowTable?: ReactNode;
|
|
188
|
+
};
|
|
189
|
+
customHeader?: ITableColumn[][];
|
|
190
|
+
excludeColumns?: string[];
|
|
191
|
+
getPrintData: (pagination: IPagination) => Promise<{ data: any[]; totalRows?: number }>;
|
|
192
|
+
formatPrintData: (data: any) => ITableDataItem[];
|
|
193
|
+
totals?: ITableDataItem;
|
|
194
|
+
}
|
|
195
|
+
///////////////
|
|
196
|
+
|
|
197
|
+
export interface IPagination {
|
|
198
|
+
limit: number;
|
|
199
|
+
offset: number;
|
|
200
|
+
}
|
|
201
|
+
export interface IServerSidePagination {
|
|
202
|
+
limit: number;
|
|
203
|
+
offset: number;
|
|
204
|
+
setLimit: Dispatch<SetStateAction<number>>;
|
|
205
|
+
setOffset: Dispatch<SetStateAction<number>>;
|
|
206
|
+
totalRows: number;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface ITableEditRow {
|
|
210
|
+
columns: ITableColumn[];
|
|
211
|
+
data: any;
|
|
212
|
+
setData: (data: any) => void;
|
|
213
|
+
item?: any;
|
|
214
|
+
clearItem: () => void;
|
|
215
|
+
defaultDataValue?: any;
|
|
216
|
+
inputFocusRef?: RefObject<any>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface IReportTemplate {
|
|
220
|
+
uuid: string;
|
|
221
|
+
name: string;
|
|
222
|
+
identifier: string;
|
|
223
|
+
filterValues?: IReportTemplateFilterValue[];
|
|
224
|
+
columns: string[];
|
|
225
|
+
organization?: ISimpleObject;
|
|
226
|
+
subsystem?: string; // IModuleId;
|
|
227
|
+
sorts?: string[];
|
|
228
|
+
isPublic?: boolean;
|
|
229
|
+
isDefault?: boolean;
|
|
230
|
+
order?: number;
|
|
231
|
+
createdAt?: string;
|
|
232
|
+
createdBy?: ISimpleObject;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface IReportTemplateFilterValue {
|
|
236
|
+
filter: string;
|
|
237
|
+
value: string;
|
|
238
|
+
name?: string;
|
|
239
|
+
type: 'STRING' | 'ARRAY' | 'OBJECT' | 'BOOLEAN';
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface IReportTemplateData {
|
|
243
|
+
searchData: IAnyObject;
|
|
244
|
+
visibleColumns?: string[];
|
|
245
|
+
sorts?: string[];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export const tableStandardLimit = [5, 10, 25, 50, 100];
|
|
249
|
+
export const tableCustomLimit1000 = [...tableStandardLimit, 1000];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
|
|
3
|
+
type inputDate = string | Date | dayjs.Dayjs;
|
|
4
|
+
|
|
5
|
+
export const formatDate = (date?: inputDate) =>
|
|
6
|
+
date ? dayjs(date).format(`DD.MM.YYYY.`) : '/';
|
|
7
|
+
export const formatDateYMD = (date: inputDate) => dayjs(date).format(`YYYY-MM-DD`);
|
|
8
|
+
|
|
9
|
+
export const formatDateAndTime = (date?: inputDate, withSeconds?: boolean) =>
|
|
10
|
+
date ? dayjs(date).format(`DD.MM.YYYY. HH:mm${withSeconds ? ':ss' : ''}`) : '/';
|
|
11
|
+
|
|
12
|
+
export const formatTime = (date?: inputDate, withSeconds?: boolean) =>
|
|
13
|
+
date ? dayjs(date).format(`HH:mm${withSeconds ? ':ss' : ''}`) : '/';
|
|
14
|
+
|
|
15
|
+
export const dateAddDays = (date: inputDate, addDays: number) =>
|
|
16
|
+
dayjs(date).add(addDays, 'days').toISOString();
|
|
17
|
+
|
|
18
|
+
export const checkIfExpired = (date?: inputDate) =>
|
|
19
|
+
date ? dayjs().isAfter(dayjs(date)) : false;
|
|
20
|
+
|
|
21
|
+
export const getCurrentDateFormatted = () => dayjs().format('DD.MM.YYYY.').toString();
|
|
22
|
+
export const getCurrentDateFormattedYMD = () => dayjs().format('YYYY-MM-DD').toString();
|
|
23
|
+
|
|
24
|
+
export const getDaysLeft = (date?: inputDate) => dayjs(date).diff(new Date(), 'days');
|
|
25
|
+
|
|
26
|
+
export const formatYearMonth = (year: number, month: number) =>
|
|
27
|
+
`${year}-${month < 10 ? `0${month}` : month}`;
|
|
28
|
+
|
|
29
|
+
// export const getDayInputRegex = (max: number) =>
|
|
30
|
+
// `(0[1-9]|1[0-9]|2[0-${max === 28 ? "8" : "9"}]${
|
|
31
|
+
// max > 29 && `|3[0${max > 30 && "-1"}]`
|
|
32
|
+
// })`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const inputPattern = {
|
|
2
|
+
taxId: '^\\d{9}$',
|
|
3
|
+
businessCode: '^\\d{8}$',
|
|
4
|
+
umcn: '^\\d{13}$',
|
|
5
|
+
idCardNumber: '^\\d{9}$',
|
|
6
|
+
phoneNumber: '^\\d{8,9}$',
|
|
7
|
+
port: '^\\d{4}$',
|
|
8
|
+
year: '^\\d{4}$',
|
|
9
|
+
number: '^\\d*$',
|
|
10
|
+
strongPassword: '^.*(?=.{8,})(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).*$',
|
|
11
|
+
// email: '\\S+@\\S+\\.\\S+',
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type LocalStorageItem =
|
|
2
|
+
| 'activeUser'
|
|
3
|
+
| 'token'
|
|
4
|
+
| 'refreshToken'
|
|
5
|
+
| 'logInWay'
|
|
6
|
+
| 'nextUrl'
|
|
7
|
+
| 'codeVerifier'
|
|
8
|
+
| 'language';
|
|
9
|
+
|
|
10
|
+
export const lsGet = (key: LocalStorageItem) => localStorage.getItem(key);
|
|
11
|
+
export const lsSet = (key: LocalStorageItem, value: string) =>
|
|
12
|
+
localStorage.setItem(key, value);
|
|
13
|
+
export const lsRemove = (key: LocalStorageItem) => localStorage.removeItem(key);
|
|
14
|
+
|
|
15
|
+
// Organization
|
|
16
|
+
|
|
17
|
+
export const getDefaultOrgUuid = () =>
|
|
18
|
+
localStorage.getItem(`${lsGet('activeUser')}-defaultOrg`) as string;
|
|
19
|
+
export const setDefaultOrgUuid = (organizationUuid: string) =>
|
|
20
|
+
localStorage.setItem(`${lsGet('activeUser')}-defaultOrg`, organizationUuid);
|
|
21
|
+
export const getActiveOrgUuid = () =>
|
|
22
|
+
localStorage.getItem(`${lsGet('activeUser')}-activeOrg`) as string;
|
|
23
|
+
export const setActiveOrgUuid = (organizationUuid: string) =>
|
|
24
|
+
localStorage.setItem(`${lsGet('activeUser')}-activeOrg`, organizationUuid);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// export const toNumberOrZero = (value?: string | number) => (!!value ? +value : 0);
|
|
2
|
+
|
|
3
|
+
export const formatCurrency = (
|
|
4
|
+
number?: string | number,
|
|
5
|
+
minimumFractionDigits?: number,
|
|
6
|
+
maximumFractionDigits?: number
|
|
7
|
+
) =>
|
|
8
|
+
Number(number ?? 0).toLocaleString('sr-RS', {
|
|
9
|
+
minimumFractionDigits: minimumFractionDigits ?? 2,
|
|
10
|
+
maximumFractionDigits: maximumFractionDigits ?? minimumFractionDigits ?? 2,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const formatCurrencyNoDecimals = (number?: string | number) =>
|
|
14
|
+
// number?.toString().replace(',', '.') ?? 0;
|
|
15
|
+
Number(number ?? 0).toLocaleString('sr-RS');
|
|
16
|
+
|
|
17
|
+
export const formatDecimalNumber = (number?: string | number) =>
|
|
18
|
+
number?.toString().replace('.', ',') ?? 0;
|
|
19
|
+
|
|
20
|
+
// export const roundTwoDecimals = (value?: string | number) =>
|
|
21
|
+
// !!value ? Math.round(+value * 100) / 100 : 0;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { IBooleanObject } from '../types/IBasic';
|
|
2
|
+
|
|
3
|
+
export const deleteProps = <T extends Record<string, any>>(
|
|
4
|
+
obj: T,
|
|
5
|
+
props: (keyof T)[]
|
|
6
|
+
) => {
|
|
7
|
+
const newObj = { ...obj };
|
|
8
|
+
props.forEach(prop => delete newObj[prop]);
|
|
9
|
+
return newObj as Partial<T>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const deletePropsThatEndsWith = <T extends Record<string, any>>(
|
|
13
|
+
obj: T,
|
|
14
|
+
endsWith: string
|
|
15
|
+
) => {
|
|
16
|
+
const newObj = { ...obj };
|
|
17
|
+
for (const prop in newObj) {
|
|
18
|
+
if (prop.endsWith(endsWith)) {
|
|
19
|
+
delete newObj[prop];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return newObj;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const deleteEmptyProps = <T extends Record<string, any>>(obj: T): T =>
|
|
26
|
+
Object.entries(obj).reduce(
|
|
27
|
+
(updatedObj, [key, value]) =>
|
|
28
|
+
[null, undefined, ''].includes(value)
|
|
29
|
+
? updatedObj
|
|
30
|
+
: ((updatedObj[key as keyof T] = value), updatedObj),
|
|
31
|
+
{} as T
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export const deleteEmptyPropsIncludingArray = <T extends Record<string, any>>(
|
|
35
|
+
obj: T
|
|
36
|
+
): T =>
|
|
37
|
+
Object.entries(obj).reduce(
|
|
38
|
+
(updatedObj, [key, value]) =>
|
|
39
|
+
[null, undefined, ''].includes(value) || (Array.isArray(value) && !value.length)
|
|
40
|
+
? updatedObj
|
|
41
|
+
: ((updatedObj[key as keyof T] = value), updatedObj),
|
|
42
|
+
{} as T
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export const convertBooleanObjectToArray = (obj: IBooleanObject) =>
|
|
46
|
+
Object.keys(obj).filter(key => obj[key]);
|
|
47
|
+
|
|
48
|
+
export const convertArrayToBooleanObject = (arr?: string[]) =>
|
|
49
|
+
arr ? arr.reduce((acc: IBooleanObject, item) => ({ ...acc, [item]: true }), {}) : {};
|
|
50
|
+
|
|
51
|
+
export const deepCopy = (el: any[] | object) => JSON.parse(JSON.stringify(el));
|
|
52
|
+
|
|
53
|
+
export const areStringArraysEqual = (arr1: string[], arr2: string[]) =>
|
|
54
|
+
JSON.stringify(arr1) === JSON.stringify(arr2);
|
|
55
|
+
|
|
56
|
+
export const compareArrayItemsIndex = <T>(
|
|
57
|
+
array: T[] | readonly T[],
|
|
58
|
+
item1: T,
|
|
59
|
+
comparison: 'greaterThan' | 'greaterThanOrEqualTo' | 'lessThan' | 'lessThanOrEqualTo',
|
|
60
|
+
item2: T
|
|
61
|
+
): boolean => {
|
|
62
|
+
const index1 = array.indexOf(item1);
|
|
63
|
+
const index2 = array.indexOf(item2);
|
|
64
|
+
return (
|
|
65
|
+
// Check if items exist in array
|
|
66
|
+
index1 >= 0 &&
|
|
67
|
+
index2 >= 0 &&
|
|
68
|
+
// Compare items location in the array
|
|
69
|
+
(comparison === 'greaterThan'
|
|
70
|
+
? index1 > index2
|
|
71
|
+
: comparison === 'greaterThanOrEqualTo'
|
|
72
|
+
? index1 >= index2
|
|
73
|
+
: comparison === 'lessThan'
|
|
74
|
+
? index1 < index2
|
|
75
|
+
: index1 <= index2)
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const intersectArrays = <T>(
|
|
80
|
+
arr1: any[] | readonly T[],
|
|
81
|
+
arr2: any[] | readonly T[]
|
|
82
|
+
) => {
|
|
83
|
+
const set2 = new Set(arr2);
|
|
84
|
+
return (arr1 as T[]).filter(item => set2.has(item));
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const rootDir = (document.getElementById('root') as HTMLElement) ?? document.body;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const maxChar = (str = '', maxLength = 30) =>
|
|
2
|
+
str.length > maxLength ? `${str.substring(0, maxLength)}...` : str;
|
|
3
|
+
|
|
4
|
+
export const getInputHelperText = (
|
|
5
|
+
t: any,
|
|
6
|
+
min?: string | number,
|
|
7
|
+
max?: string | number
|
|
8
|
+
) =>
|
|
9
|
+
max
|
|
10
|
+
? min === max
|
|
11
|
+
? t('CharNumber', { number: min })
|
|
12
|
+
: t('CharRange', { from: min || 1, to: max })
|
|
13
|
+
: min
|
|
14
|
+
? t('CharMin', { from: min })
|
|
15
|
+
: undefined;
|
|
16
|
+
|
|
17
|
+
export const getInputMinMaxPattern = (min?: string | number, max?: string | number) =>
|
|
18
|
+
`^.{${min || 0},${max || ''}}$`;
|