@inceptionbg/iui 2.0.5 → 2.0.7

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.
Files changed (257) hide show
  1. package/dist/{NoAccessPage-C6nBt-PN.js → NoAccessPage-BozT_Suz.js} +2 -2
  2. package/dist/{NoAccessPage-C6nBt-PN.js.map → NoAccessPage-BozT_Suz.js.map} +1 -1
  3. package/dist/{NotFoundPage-DatmJOrr.js → NotFoundPage-WWiekDef.js} +2 -2
  4. package/dist/{NotFoundPage-DatmJOrr.js.map → NotFoundPage-WWiekDef.js.map} +1 -1
  5. package/dist/icons/index.d.ts +43 -0
  6. package/dist/icons/index.js +1 -0
  7. package/dist/index.d.ts +32 -20
  8. package/dist/index.js +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/iui.css +1 -1
  11. package/idea/Menu/Menu.tsx +119 -0
  12. package/idea/Menu/MenuItem.tsx +74 -0
  13. package/idea/Menu/hooks/useMenuControl.ts +13 -0
  14. package/idea/Menu.tsx +132 -0
  15. package/idea/NoAccessInfo.tsx +193 -0
  16. package/idea/Notifications.tsx +245 -0
  17. package/idea/Table2/Components/Columns/ColumnsList.tsx +56 -0
  18. package/idea/Table2/Components/Columns/SetColumnsList.tsx +107 -0
  19. package/idea/Table2/Components/Edit/ItemActionsMenu.tsx +87 -0
  20. package/idea/Table2/Components/Edit/ItemEditOptionsButtons.tsx +32 -0
  21. package/idea/Table2/Components/Edit/TableEditRow.tsx +56 -0
  22. package/idea/Table2/Components/FilterItem.tsx +20 -0
  23. package/idea/Table2/Components/Header/TableHeader.tsx +35 -0
  24. package/idea/Table2/Components/Header/TableHeaderRow.tsx +37 -0
  25. package/idea/Table2/Components/Print/CustomTablePrint.tsx +119 -0
  26. package/idea/Table2/Components/Print/TablePrint.tsx +208 -0
  27. package/idea/Table2/Components/SetSortList.tsx +33 -0
  28. package/idea/Table2/Components/SetTableFilter.tsx +90 -0
  29. package/idea/Table2/Components/TableFooter.tsx +107 -0
  30. package/idea/Table2/Components/TableOptions.tsx +211 -0
  31. package/idea/Table2/Components/Templates/TemplateCreate.tsx +75 -0
  32. package/idea/Table2/Components/Templates/TemplateCreateDefault.tsx +45 -0
  33. package/idea/Table2/Components/Templates/TemplateList.tsx +167 -0
  34. package/idea/Table2/Components/Templates/repo/TemplateRepo.ts +51 -0
  35. package/idea/Table2/Table.tsx +657 -0
  36. package/idea/Table2/_table.scss +300 -0
  37. package/idea/Table2/hooks/useDefaultTemplate.ts +22 -0
  38. package/idea/Table2/hooks/useTableKeyboard.ts +115 -0
  39. package/package.json +9 -4
  40. package/rollup.config.js +80 -0
  41. package/src/assets/icons/duotone/faCircleUser.ts +17 -0
  42. package/src/assets/icons/index.ts +20 -0
  43. package/src/assets/icons/light/faArrowDownShortWide.ts +15 -0
  44. package/src/assets/icons/light/faArrowDownWideShort.ts +15 -0
  45. package/src/assets/icons/light/faArrowUpArrowDown.ts +15 -0
  46. package/src/assets/icons/light/faArrowUpRightFromSquare.ts +15 -0
  47. package/src/assets/icons/light/faArrowsToLine.ts +15 -0
  48. package/src/assets/icons/light/faArrowsUpDown.ts +15 -0
  49. package/src/assets/icons/light/faCalendarPlus.ts +15 -0
  50. package/src/assets/icons/light/faCheck.ts +15 -0
  51. package/src/assets/icons/light/faChevronDown.ts +15 -0
  52. package/src/assets/icons/light/faChevronRight.ts +15 -0
  53. package/src/assets/icons/light/faCircleInfo.ts +15 -0
  54. package/src/assets/icons/light/faCircleXmark.ts +15 -0
  55. package/src/assets/icons/light/faClockRotateLeft.ts +15 -0
  56. package/src/assets/icons/light/faEllipsisVertical.ts +15 -0
  57. package/src/assets/icons/light/faEye.ts +15 -0
  58. package/src/assets/icons/light/faEyeSlash.ts +15 -0
  59. package/src/assets/icons/light/faFilter.ts +15 -0
  60. package/src/assets/icons/light/faGear.ts +15 -0
  61. package/src/assets/icons/light/faHouse.ts +15 -0
  62. package/src/assets/icons/light/faIdBadge.ts +15 -0
  63. package/src/assets/icons/light/faLineColumns.ts +15 -0
  64. package/src/assets/icons/light/faLink.ts +15 -0
  65. package/src/assets/icons/light/faMagnifyingGlass.ts +15 -0
  66. package/src/assets/icons/light/faPenField.ts +15 -0
  67. package/src/assets/icons/light/faPrint.ts +15 -0
  68. package/src/assets/icons/light/faQuestion.ts +15 -0
  69. package/src/assets/icons/light/faRotateRight.ts +15 -0
  70. package/src/assets/icons/light/faTrashCan.ts +15 -0
  71. package/src/assets/icons/light/faTriangleExclamation.ts +15 -0
  72. package/src/assets/icons/light/faXmark.ts +15 -0
  73. package/src/assets/icons/regular/faArrowLeft.ts +15 -0
  74. package/src/assets/icons/regular/faArrowRightArrowLeft.ts +15 -0
  75. package/src/assets/icons/regular/faCircleCheck.ts +15 -0
  76. package/src/assets/icons/regular/faCircleExclamation.ts +15 -0
  77. package/src/assets/icons/regular/faCircleInfo.ts +15 -0
  78. package/src/assets/icons/regular/faFileArrowDown.ts +15 -0
  79. package/src/assets/icons/regular/faFilterCircleXmark.ts +15 -0
  80. package/src/assets/icons/regular/faTriangleExclamation.ts +15 -0
  81. package/src/assets/icons/solid/faAngleLeft.ts +15 -0
  82. package/src/assets/icons/solid/faAngleRight.ts +15 -0
  83. package/src/assets/icons/solid/faArrowDownWideShort.ts +15 -0
  84. package/src/assets/icons/solid/faCaretDown.ts +15 -0
  85. package/src/assets/icons/solid/faCheck.ts +15 -0
  86. package/src/assets/icons/solid/faEllipsisVertical.ts +15 -0
  87. package/src/assets/icons/solid/faFilter.ts +15 -0
  88. package/src/assets/icons/solid/faFloppyDisk.ts +15 -0
  89. package/src/assets/icons/solid/faGripDotsVertical.ts +15 -0
  90. package/src/assets/icons/solid/faListUl.ts +15 -0
  91. package/src/assets/icons/solid/faMagnifyingGlass.ts +15 -0
  92. package/src/assets/icons/solid/faMinus.ts +15 -0
  93. package/src/assets/icons/solid/faPlus.ts +15 -0
  94. package/src/assets/icons/solid/faPrint.ts +15 -0
  95. package/src/assets/icons/solid/faRotateRight.ts +15 -0
  96. package/src/assets/icons/solid/faXmark.ts +15 -0
  97. package/src/assets/images/logo/mts.svg +5703 -0
  98. package/src/assets/images/logo/paperless.svg +21 -0
  99. package/src/assets/images/logo/pismonosa.png +0 -0
  100. package/src/assets/images/not-found.svg +19 -0
  101. package/src/components/Accordions/Accordions.tsx +64 -0
  102. package/src/components/Alert/Alert.tsx +31 -0
  103. package/src/components/Badge/DotBadge.tsx +16 -0
  104. package/src/components/Badge/NotificationBadge.tsx +29 -0
  105. package/src/components/Badge/PillBadge.tsx +13 -0
  106. package/src/components/Button/Button.tsx +56 -0
  107. package/src/components/Button/IconButton.tsx +49 -0
  108. package/src/components/Dashboard/Dashboard.tsx +9 -0
  109. package/src/components/Dashboard/DashboardWidget.tsx +44 -0
  110. package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +37 -0
  111. package/src/components/Dialog/DeleteItemDialog.tsx +52 -0
  112. package/src/components/Dialog/Dialog.tsx +226 -0
  113. package/src/components/Dialog/hooks/useDialogKeyboard.ts +41 -0
  114. package/src/components/Dialog/hooks/useDialogObserver.ts +21 -0
  115. package/src/components/Header/Components/ModuleSelect.tsx +55 -0
  116. package/src/components/Header/Components/UserMenu.tsx +52 -0
  117. package/src/components/Header/Header.tsx +31 -0
  118. package/src/components/Helper/Collapse.tsx +52 -0
  119. package/src/components/Inputs/Checkbox.tsx +53 -0
  120. package/src/components/Inputs/CurrencyInput.tsx +123 -0
  121. package/src/components/Inputs/DateInput/DateInput.tsx +177 -0
  122. package/src/components/Inputs/DateInput/components/DatePartInput.tsx +154 -0
  123. package/src/components/Inputs/InputWrapper.tsx +90 -0
  124. package/src/components/Inputs/NumberInput.tsx +83 -0
  125. package/src/components/Inputs/PasswordInput.tsx +38 -0
  126. package/src/components/Inputs/Radio.tsx +59 -0
  127. package/src/components/Inputs/RadioGroup.tsx +48 -0
  128. package/src/components/Inputs/RadioLarge.tsx +39 -0
  129. package/src/components/Inputs/SearchInput.tsx +40 -0
  130. package/src/components/Inputs/Select2/Select.tsx +224 -0
  131. package/src/components/Inputs/Select2/select.scss +43 -0
  132. package/src/components/Inputs/Selects/Select.tsx +17 -0
  133. package/src/components/Inputs/Selects/components/CustomSelectComponents.tsx +19 -0
  134. package/src/components/Inputs/Selects/components/SelectWrapper.tsx +126 -0
  135. package/src/components/Inputs/Selects/utils/selectStyles.ts +104 -0
  136. package/src/components/Inputs/TextAreaInput.tsx +67 -0
  137. package/src/components/Inputs/TextInput.tsx +98 -0
  138. package/src/components/Inputs/TimeInput/TimeInput.tsx +81 -0
  139. package/src/components/Loader/Loader.tsx +53 -0
  140. package/src/components/Menu/Menu.tsx +68 -0
  141. package/src/components/Menu/MenuItem.tsx +47 -0
  142. package/src/components/Menu/NewMenu.tsx +66 -0
  143. package/src/components/Menu/hooks/useMenuPosition.tsx +80 -0
  144. package/src/components/Pullover/Pullover.tsx +89 -0
  145. package/src/components/Router/Router.tsx +51 -0
  146. package/src/components/Sidebar/AddButton.tsx +22 -0
  147. package/src/components/Sidebar/Sidebar.tsx +81 -0
  148. package/src/components/Sidebar/SidebarItem.tsx +84 -0
  149. package/src/components/Sidebar/types/ISidebar.ts +28 -0
  150. package/src/components/Table/Components/Columns/ColumnsList.tsx +61 -0
  151. package/src/components/Table/Components/Columns/SetColumnsList.tsx +113 -0
  152. package/src/components/Table/Components/Edit/ItemActionsMenu.tsx +84 -0
  153. package/src/components/Table/Components/Edit/ItemEditOptionsButtons.tsx +31 -0
  154. package/src/components/Table/Components/Edit/TableEditRow.tsx +56 -0
  155. package/src/components/Table/Components/FilterItem.tsx +20 -0
  156. package/src/components/Table/Components/Header/TableHeader.tsx +45 -0
  157. package/src/components/Table/Components/Header/TableHeaderRow.tsx +37 -0
  158. package/src/components/Table/Components/Print/CustomTablePrint.tsx +114 -0
  159. package/src/components/Table/Components/Print/TablePrint.tsx +207 -0
  160. package/src/components/Table/Components/SetSortList.tsx +30 -0
  161. package/src/components/Table/Components/SetTableFilter.tsx +90 -0
  162. package/src/components/Table/Components/TableFooter.tsx +135 -0
  163. package/src/components/Table/Components/TableOptions.tsx +226 -0
  164. package/src/components/Table/Components/Templates/TemplateCreate.tsx +80 -0
  165. package/src/components/Table/Components/Templates/TemplateCreateDefault.tsx +45 -0
  166. package/src/components/Table/Components/Templates/TemplateList.tsx +167 -0
  167. package/src/components/Table/Components/Templates/repo/TemplateRepo.ts +53 -0
  168. package/src/components/Table/Table.tsx +527 -0
  169. package/src/components/Table/hooks/useDefaultTemplate.ts +20 -0
  170. package/src/components/Table/hooks/useTableKeyboard.ts +138 -0
  171. package/src/components/Table/hooks/useTableSelect.ts +11 -0
  172. package/src/components/Tabs/Tabs.tsx +66 -0
  173. package/src/components/Tooltip/Tooltip.tsx +133 -0
  174. package/src/components/Tree/Tree.tsx +22 -0
  175. package/src/components/Tree/TreeItem.tsx +56 -0
  176. package/src/components/Wrappers/AppLayout.tsx +17 -0
  177. package/src/components/Wrappers/ConditionalWrapper.tsx +10 -0
  178. package/src/components/Wrappers/FormWrapper.tsx +81 -0
  179. package/src/components/Wrappers/PageLayout.tsx +152 -0
  180. package/src/hooks/useBackgroundClose.ts +18 -0
  181. package/src/hooks/useIsMenuOpen.ts +11 -0
  182. package/src/hooks/useOnEsc.ts +14 -0
  183. package/src/hooks/useZendesk.ts +21 -0
  184. package/src/index.ts +324 -0
  185. package/src/pages/NoAccessPage.tsx +27 -0
  186. package/src/pages/NotFoundPage.tsx +26 -0
  187. package/src/styles/App.scss +43 -0
  188. package/src/styles/common/_animations.scss +64 -0
  189. package/src/styles/common/_typography.scss +88 -0
  190. package/src/styles/common/helpers/_base.scss +55 -0
  191. package/src/styles/common/helpers/_color.scss +7 -0
  192. package/src/styles/common/helpers/_display.scss +85 -0
  193. package/src/styles/common/helpers/_size.scss +25 -0
  194. package/src/styles/common/maps/_align.scss +21 -0
  195. package/src/styles/common/maps/_info-types.scss +1 -0
  196. package/src/styles/common/maps/_spacing.scss +78 -0
  197. package/src/styles/common/maps/_text.scss +14 -0
  198. package/src/styles/components/_accordions.scss +46 -0
  199. package/src/styles/components/_alert.scss +23 -0
  200. package/src/styles/components/_badge.scss +76 -0
  201. package/src/styles/components/_button.scss +138 -0
  202. package/src/styles/components/_card.scss +24 -0
  203. package/src/styles/components/_dialog.scss +111 -0
  204. package/src/styles/components/_form.scss +8 -0
  205. package/src/styles/components/_header.scss +109 -0
  206. package/src/styles/components/_input.scss +158 -0
  207. package/src/styles/components/_inputCheckbox.scss +105 -0
  208. package/src/styles/components/_inputDateTime.scss +161 -0
  209. package/src/styles/components/_inputRadio.scss +83 -0
  210. package/src/styles/components/_inputSelect.scss +6 -0
  211. package/src/styles/components/_loader.scss +44 -0
  212. package/src/styles/components/_menu-v2.scss +67 -0
  213. package/src/styles/components/_menu.scss +53 -0
  214. package/src/styles/components/_page.scss +62 -0
  215. package/src/styles/components/_portal.scss +8 -0
  216. package/src/styles/components/_print.scss +87 -0
  217. package/src/styles/components/_pullover.scss +43 -0
  218. package/src/styles/components/_scrollbar.scss +18 -0
  219. package/src/styles/components/_sidebar.scss +206 -0
  220. package/src/styles/components/_smallComponents.scss +23 -0
  221. package/src/styles/components/_table.scss +270 -0
  222. package/src/styles/components/_tabs.scss +33 -0
  223. package/src/styles/components/_tooltip.scss +48 -0
  224. package/src/styles/components/_tree.scss +21 -0
  225. package/src/styles/components/_widget.scss +90 -0
  226. package/src/styles/pages/_fullScreenPage.scss +64 -0
  227. package/src/styles/variables/_bp.scss +5 -0
  228. package/src/styles/variables/_variables.scss +130 -0
  229. package/src/types/Base/custom.d.ts +9 -0
  230. package/src/types/IBasic.ts +31 -0
  231. package/src/types/IError.ts +5 -0
  232. package/src/types/IHeader.ts +34 -0
  233. package/src/types/IInfo.ts +1 -0
  234. package/src/types/IKeyboard.ts +37 -0
  235. package/src/types/IMenu.ts +18 -0
  236. package/src/types/IRouter.ts +6 -0
  237. package/src/types/ISelect.ts +52 -0
  238. package/src/types/ITab.ts +10 -0
  239. package/src/types/ITable.ts +249 -0
  240. package/src/types/ITree.ts +6 -0
  241. package/src/utils/DateUtils.ts +32 -0
  242. package/src/utils/InputPatternValidation.ts +12 -0
  243. package/src/utils/LocalStorageHelper.ts +24 -0
  244. package/src/utils/NumberUtils.ts +21 -0
  245. package/src/utils/ObjectUtils.ts +85 -0
  246. package/src/utils/RootDir.ts +1 -0
  247. package/src/utils/StringUtils.ts +18 -0
  248. package/src/utils/TableUtils.ts +130 -0
  249. package/src/utils/Toasts.ts +6 -0
  250. package/src/utils/UrlUtils.ts +4 -0
  251. package/src/utils/fileUtils.ts +176 -0
  252. package/src/utils/i18n/i18nIUICyrilic.ts +90 -0
  253. package/src/utils/i18n/i18nIUILatin.ts +90 -0
  254. package/src/utils/i18n/i18nIUIMe.ts +88 -0
  255. package/src/utils/icons.ts +13 -0
  256. package/tsconfig.icons.json +5 -0
  257. package/tsconfig.json +19 -0
@@ -0,0 +1,34 @@
1
+ import { IconDefinition, RotateProp } from '@fortawesome/fontawesome-svg-core';
2
+ import { IButtonColor } from '../components/Button/Button';
3
+ import { IMenuItem } from './IMenu';
4
+ import { FC } from 'react';
5
+
6
+ export interface IHeaderAction {
7
+ label: string;
8
+ icon?: IconDefinition;
9
+ iconRotation?: RotateProp;
10
+ to?: string;
11
+ onClick?: () => void;
12
+ solid?: boolean;
13
+ color?: IButtonColor;
14
+ disabled?: boolean;
15
+ hidden?: boolean;
16
+ }
17
+
18
+ export type IHeaderUserMenuProps = {
19
+ isOpen: boolean;
20
+ setIsOpen: (isOpen: boolean) => void;
21
+ userName?: string;
22
+ organizationName?: string;
23
+ showBadge?: boolean;
24
+ menuItems?: IMenuItem[];
25
+
26
+ HeaderUserMenuDialogs: FC<{
27
+ openedDialog: string | null;
28
+ setOpenedDialog: (dialog: string | null) => void;
29
+ refetchOrganizationInvites?: () => void;
30
+ }>;
31
+ openedDialog: string | null;
32
+ setOpenedDialog: (dialog: string | null) => void;
33
+ refetchOrganizationInvites?: () => void;
34
+ };
@@ -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,6 @@
1
+ import { ReactElement } from 'react';
2
+
3
+ export interface IRoute {
4
+ path: string;
5
+ element: ReactElement;
6
+ }
@@ -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,10 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface ITab {
4
+ value: string;
5
+ label: string;
6
+ icon?: any;
7
+ component: ReactNode;
8
+ disabled?: boolean;
9
+ hidden?: boolean;
10
+ }
@@ -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,6 @@
1
+ export interface ITreeItem {
2
+ uuid: string;
3
+ name: string;
4
+ code?: string;
5
+ children?: ITreeItem[];
6
+ }
@@ -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 || ''}}$`;