@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,207 @@
1
+ import { FC, useEffect, useState } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { faFileArrowDown } from '../../../../assets/icons/regular/faFileArrowDown';
4
+ import { faPrint } from '../../../../assets/icons/solid/faPrint';
5
+ import { faXmark } from '../../../../assets/icons/solid/faXmark';
6
+ import { IPrintData, ITableColumn, ITableDataItem } from '../../../../types/ITable';
7
+ import { formatDate, getCurrentDateFormatted } from '../../../../utils/DateUtils';
8
+ import { Button } from '../../../Button/Button';
9
+ import { FullScreenLoader } from '../../../Loader/Loader';
10
+ import { useTranslation } from 'react-i18next';
11
+ import { rootDir } from '../../../../utils/RootDir';
12
+ import clsx from 'clsx';
13
+ import { HeaderTable } from '../Header/TableHeader';
14
+ import { useHideZendesk } from '../../../../hooks/useZendesk';
15
+
16
+ interface Props extends IPrintData {
17
+ isOpen: boolean;
18
+ onClose: () => void;
19
+ columns: ITableColumn[];
20
+ excludeColumnIds?: string[];
21
+ }
22
+ export const TablePrint: FC<Props> = ({
23
+ isOpen,
24
+ onClose,
25
+ columns,
26
+ excludeColumnIds = [],
27
+ customHeader,
28
+ organization,
29
+ filters,
30
+ label,
31
+ optionalNode,
32
+ getPrintData,
33
+ formatPrintData,
34
+ saveXlsx,
35
+ totals,
36
+ }) => {
37
+ const [data, setData] = useState<ITableDataItem[]>([]);
38
+ const [offset, setOffset] = useState(0);
39
+ const [isLoading, setIsLoading] = useState(false);
40
+
41
+ const { t } = useTranslation();
42
+ useHideZendesk();
43
+
44
+ const cols = columns.filter(
45
+ e => !['actions', 'select', ...excludeColumnIds].includes(e.id)
46
+ );
47
+
48
+ useEffect(() => {
49
+ rootDir?.classList.add('hidden');
50
+ return () => {
51
+ rootDir?.classList.remove('hidden');
52
+ };
53
+ }, []);
54
+
55
+ useEffect(() => {
56
+ setIsLoading(true);
57
+ getPrintData({ limit: 1000, offset })
58
+ .then(e => {
59
+ setData(prevState => {
60
+ const data = !!e.data.length ? formatPrintData(e.data) : [];
61
+ const newState = [...prevState, ...data];
62
+ e.totalRows && e.totalRows > newState.length
63
+ ? setOffset(offset + 1)
64
+ : setIsLoading(false);
65
+ return e.totalRows && e.totalRows > prevState.length ? newState : prevState;
66
+ });
67
+ })
68
+ .catch(() => setIsLoading(false));
69
+ }, [offset, formatPrintData, getPrintData]);
70
+
71
+ return isOpen
72
+ ? createPortal(
73
+ <div className="iui-print-dialog">
74
+ <div className="content">
75
+ <div className="flex justify-between">
76
+ {organization ? (
77
+ <div>
78
+ <p className="name">{organization.name}</p>
79
+ {organization.taxId && <p>{`${t('TaxId')}: ${organization.taxId}`}</p>}
80
+ {organization.registrationNumber && (
81
+ <p>{`${t('BusinessCode')}: ${organization.registrationNumber}`}</p>
82
+ )}
83
+ {organization.jbkjs && <p>JBKJS: {organization.jbkjs}</p>}
84
+ {organization.email && <p>Email: {organization.email}</p>}
85
+ </div>
86
+ ) : (
87
+ <div />
88
+ )}
89
+ <div className="text-right">
90
+ <p>{`${t('PrintDate')}: ${getCurrentDateFormatted()}`}</p>
91
+ </div>
92
+ </div>
93
+ <h3 className="my-3 text-center">{label}</h3>
94
+ {filters && (
95
+ <div className="flex justify-between">
96
+ <div>
97
+ {filters.basic?.map(
98
+ e =>
99
+ !!e.value && (
100
+ <div key={e.value} className="mb-2">
101
+ <p>{`${e.label}: ${e.value}`}</p>
102
+ </div>
103
+ )
104
+ )}
105
+ </div>
106
+ {filters.date && (
107
+ <div>
108
+ {filters.date.map(
109
+ e =>
110
+ (!!e.from || !!e.to) && (
111
+ <div key={e.label} className="mb-2 text-right">
112
+ <p>
113
+ {e.label} {!!e.from && `${t('from')} ${formatDate(e.from)}`}{' '}
114
+ {`${t('to')} ${formatDate(e.to || new Date().toString())}`}
115
+ </p>
116
+ </div>
117
+ )
118
+ )}
119
+ </div>
120
+ )}
121
+ </div>
122
+ )}
123
+ {optionalNode?.aboveTable}
124
+ {data && (
125
+ <table width="100%" className="print-table">
126
+ <HeaderTable columns={cols} customHeader={customHeader} headerWrap />
127
+ <tbody>
128
+ <>
129
+ {data.map(row => {
130
+ let totalColsSpan = 0;
131
+ return (
132
+ <tr key={row.uuid} className={row.className}>
133
+ {cols.map(column => {
134
+ const cell = row.cells[column.id];
135
+
136
+ totalColsSpan += cell?.span
137
+ ? // If span is -1 or larger then the number of columns
138
+ cell.span === -1 || cell.span > cols.length
139
+ ? // ...fill the rest of the table
140
+ cols.length - totalColsSpan
141
+ : cell.span
142
+ : 1;
143
+
144
+ return (
145
+ cols.length >= totalColsSpan && (
146
+ <td
147
+ key={column.id}
148
+ align={cell?.align || column.align}
149
+ className={clsx(column.color, cell?.className, {
150
+ 'word-break': column.break,
151
+ })}
152
+ colSpan={cell?.span === -1 ? cols.length : cell?.span}
153
+ >
154
+ {cell?.printValue ?? cell?.value}
155
+ </td>
156
+ )
157
+ );
158
+ })}
159
+ </tr>
160
+ );
161
+ })}
162
+ {!!totals && (
163
+ <tr>
164
+ {cols.map(({ id: columnId }) => (
165
+ <td
166
+ key={columnId}
167
+ align={totals.cells[columnId]?.align || 'right'}
168
+ colSpan={totals.cells[columnId]?.span}
169
+ className="py-3"
170
+ >
171
+ <strong>{totals.cells[columnId]?.value}</strong>
172
+ </td>
173
+ ))}
174
+ </tr>
175
+ )}
176
+ </>
177
+ </tbody>
178
+ </table>
179
+ )}
180
+ {optionalNode?.bellowTable}
181
+ </div>
182
+ <div className="iui-print-actions no-print">
183
+ <Button
184
+ label={t('Cancel')}
185
+ icon={faXmark}
186
+ onClick={e => {
187
+ e.stopPropagation();
188
+ onClose();
189
+ }}
190
+ className="mr-3"
191
+ />
192
+ {!!saveXlsx && (
193
+ <Button
194
+ label={t('SaveXlsx')}
195
+ icon={faFileArrowDown}
196
+ onClick={() => saveXlsx()}
197
+ className="mr-3"
198
+ />
199
+ )}
200
+ <Button label={t('Print')} icon={faPrint} onClick={() => window.print()} />
201
+ </div>
202
+ <FullScreenLoader isLoading={isLoading} />
203
+ </div>,
204
+ document.body
205
+ )
206
+ : null;
207
+ };
@@ -0,0 +1,30 @@
1
+ import { FC } from 'react';
2
+ // import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
+ import { ITableSort } from '../../../types/ITable';
4
+ import { faArrowDownWideShort } from '../../../assets/icons/light/faArrowDownWideShort';
5
+ import { faArrowDownShortWide } from '../../../assets/icons/light/faArrowDownShortWide';
6
+ import { MenuItem } from '../../Menu/MenuItem';
7
+
8
+ interface Props {
9
+ sort: string;
10
+ setSort: (sort: string) => void;
11
+ sortOptions: ITableSort[];
12
+ }
13
+ export const SetSortList: FC<Props> = ({ sortOptions, sort, setSort }) => (
14
+ <>
15
+ {sortOptions.map(e => (
16
+ <MenuItem
17
+ key={e.label}
18
+ label={e.label}
19
+ className="menu-item-m"
20
+ onClick={() => setSort(sort === e.desc ? e.asc : e.desc)}
21
+ icon={sort === e.desc ? faArrowDownWideShort : faArrowDownShortWide}
22
+ />
23
+ // <div className="flex center justify-between full-width">
24
+ // {/* <p className="mr-5 mb-0">{e.label}</p> */}
25
+ // {sort === e.desc && <FontAwesomeIcon icon={faArrowDownWideShort} />}
26
+ // {sort === e.asc && <FontAwesomeIcon icon={faArrowDownShortWide} />}
27
+ // </div>
28
+ ))}
29
+ </>
30
+ );
@@ -0,0 +1,90 @@
1
+ import { FC, useMemo, useState } from 'react';
2
+ import { faFilterCircleXmark } from '../../../assets/icons/regular/faFilterCircleXmark';
3
+ import { faMagnifyingGlass } from '../../../assets/icons/solid/faMagnifyingGlass';
4
+ import { faXmark } from '../../../assets/icons/solid/faXmark';
5
+ import { ITableFilterData, ITableFilterItem } from '../../../types/ITable';
6
+ import { deleteEmptyPropsIncludingArray, deleteProps } from '../../../utils/ObjectUtils';
7
+ import { Dialog } from '../../Dialog/Dialog';
8
+ import { FilterItem } from './FilterItem';
9
+ import { useTranslation } from 'react-i18next';
10
+ import { SearchInput } from '../../Inputs/SearchInput';
11
+
12
+ interface Props extends ITableFilterData {
13
+ isOpen: boolean;
14
+ onClose: () => void;
15
+ }
16
+
17
+ export const SetTableFilter: FC<Props> = ({
18
+ columns,
19
+ filters,
20
+ additionalFilters,
21
+ excludeFromSearch,
22
+ searchData,
23
+ setSearchData,
24
+ onSubmit,
25
+ resetData,
26
+ isOpen,
27
+ onClose,
28
+ }) => {
29
+ const [search, setSearch] = useState('');
30
+
31
+ const { t } = useTranslation();
32
+
33
+ const visibleFilters = useMemo(
34
+ () =>
35
+ columns.reduce(
36
+ (arr: ITableFilterItem[], col) =>
37
+ !!filters[col] ? arr.concat(filters[col]) : arr,
38
+ []
39
+ ),
40
+ [columns, filters]
41
+ );
42
+
43
+ const filteredFilters = useMemo(
44
+ () =>
45
+ visibleFilters.filter(e => e?.label.toLowerCase().includes(search.toLowerCase())),
46
+ [visibleFilters, search]
47
+ );
48
+
49
+ return (
50
+ <Dialog
51
+ className="iui-table-filter"
52
+ titleEl={
53
+ <div className="filters-search">
54
+ <h1>{t('Filter')}</h1>
55
+ <SearchInput onSearch={setSearch} className="search-input" />
56
+ </div>
57
+ }
58
+ isOpen={isOpen}
59
+ onClose={() => {
60
+ setSearch('');
61
+ onClose();
62
+ }}
63
+ cancelButton={{ icon: faXmark }}
64
+ additionalButton={{
65
+ label: t('ResetFilter'),
66
+ icon: faFilterCircleXmark,
67
+ onClick: () => {
68
+ setSearchData(resetData || {});
69
+ onSubmit(resetData || {});
70
+ },
71
+ disabled: resetData
72
+ ? JSON.stringify(searchData) === JSON.stringify(resetData)
73
+ : Object.keys(searchData).length === 0,
74
+ }}
75
+ confirmButton={{
76
+ label: t('Search'),
77
+ icon: faMagnifyingGlass,
78
+ onFormSubmit: () => {
79
+ const data = deleteEmptyPropsIncludingArray(searchData);
80
+ onSubmit(excludeFromSearch ? deleteProps(data, excludeFromSearch) : data);
81
+ },
82
+ }}
83
+ >
84
+ {filteredFilters?.map(item => (
85
+ <FilterItem key={item.label} item={item} />
86
+ ))}
87
+ {additionalFilters && <div className="pb-1">{additionalFilters}</div>}
88
+ </Dialog>
89
+ );
90
+ };
@@ -0,0 +1,135 @@
1
+ import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
+ import { FC, MouseEventHandler, useEffect, useState } from 'react';
3
+ import { faAngleLeft } from '../../../assets/icons/solid/faAngleLeft';
4
+ import { faAngleRight } from '../../../assets/icons/solid/faAngleRight';
5
+ import { faRotateRight } from '../../../assets/icons/solid/faRotateRight';
6
+ import { IconButton } from '../../Button/IconButton';
7
+ import { useTranslation } from 'react-i18next';
8
+ import { IServerSidePagination, tableStandardLimit } from '../../../types/ITable';
9
+ import { Select } from '../../Inputs/Selects/Select';
10
+ import { ISelectData } from '../../../types/ISelect';
11
+ import { TextInput } from '../../Inputs/TextInput';
12
+
13
+ interface Props {
14
+ pagination: IServerSidePagination;
15
+ noTotalRows?: boolean;
16
+ dataLength: number;
17
+ footerAction?: {
18
+ icon?: IconDefinition;
19
+ onClick: MouseEventHandler<HTMLButtonElement>;
20
+ };
21
+ customLimit?: number[];
22
+ }
23
+
24
+ export const TableFooter: FC<Props> = ({
25
+ pagination: { limit, offset, setLimit, setOffset, totalRows },
26
+ noTotalRows,
27
+ dataLength,
28
+ footerAction,
29
+ customLimit,
30
+ }) => {
31
+ const [tempOffset, setTempOffset] = useState(offset + 1);
32
+
33
+ const { t } = useTranslation();
34
+
35
+ useEffect(() => {
36
+ setTempOffset(offset + 1);
37
+ }, [offset]);
38
+
39
+ const handleChangeLimit = (value: ISelectData) => {
40
+ const newLimit = Math.floor(+value.value);
41
+ setLimit(newLimit);
42
+ setOffset(0);
43
+ };
44
+
45
+ const maxOffset = Math.ceil(totalRows / limit);
46
+
47
+ return (
48
+ <div className={`table-footer ${footerAction ? 'justify-between' : 'justify-right'}`}>
49
+ {!!footerAction && (
50
+ <IconButton
51
+ icon={footerAction.icon || faRotateRight}
52
+ onClick={footerAction.onClick}
53
+ tooltip={t('RefreshData')}
54
+ // outlined
55
+ size="s"
56
+ />
57
+ )}
58
+ <div className="pagination">
59
+ <div className="flex align-center gap-2">
60
+ <p>{t('rowsPerPage')}</p>
61
+ <Select
62
+ value={{ label: `${limit}`, value: limit }}
63
+ // size="s"
64
+ minWidth={60}
65
+ onChange={handleChangeLimit}
66
+ options={(customLimit || tableStandardLimit).map(e => ({
67
+ label: `${e}`,
68
+ value: e ?? t('allResults'),
69
+ }))}
70
+ isClearable={false}
71
+ />
72
+ {/* {(customLimit || tableStandardLimit).map(e => (
73
+ <option key={e} value={e}>
74
+ {e ? e : t('allResults')}
75
+ </option>
76
+ ))}
77
+ </Select> */}
78
+ {!noTotalRows && (
79
+ <p>
80
+ {limit
81
+ ? `${offset * limit + 1}-${
82
+ offset * limit + limit <= totalRows
83
+ ? offset * limit + limit
84
+ : totalRows
85
+ } ${t('of')} ${totalRows}`
86
+ : `${t('allResults')} ${t('of')} ${totalRows} `}
87
+ </p>
88
+ )}
89
+ </div>
90
+ <div className="separator" />
91
+ {/* <p>|</p> */}
92
+ <div className="flex gap-1 align-center">
93
+ <p>{t('page')}:</p>
94
+ <IconButton
95
+ disabled={offset < 1}
96
+ icon={faAngleLeft}
97
+ onClick={() => setOffset(offset - 1)}
98
+ size="s"
99
+ />
100
+ <TextInput
101
+ className="offset-input"
102
+ value={`${tempOffset}`}
103
+ setValue={e => !isNaN(+e) && setTempOffset(+e)}
104
+ isClearable={false}
105
+ inputProps={{
106
+ onFocus: e => e.target.select(),
107
+ onBlur: () => setTempOffset(offset + 1),
108
+ onKeyUp: e => {
109
+ if (e.key === 'Enter') {
110
+ const value = tempOffset;
111
+ if (typeof value === 'number' && value >= 0 && value <= maxOffset) {
112
+ setOffset(value - 1);
113
+ } else {
114
+ setTempOffset(offset + 1);
115
+ }
116
+ }
117
+ },
118
+ }}
119
+ />
120
+ <IconButton
121
+ disabled={
122
+ noTotalRows /* && serverSidePagination */
123
+ ? limit > dataLength
124
+ : offset + 1 >= maxOffset
125
+ }
126
+ icon={faAngleRight}
127
+ onClick={() => setOffset(offset + 1)}
128
+ size="s"
129
+ />
130
+ {!noTotalRows && <p>{`${t('of')} ${maxOffset}`}</p>}
131
+ </div>
132
+ </div>
133
+ </div>
134
+ );
135
+ };
@@ -0,0 +1,226 @@
1
+ import { FC, ReactNode, useState } from 'react';
2
+ import { faPrint } from '../../../assets/icons/solid/faPrint';
3
+ import {
4
+ ITableSortData,
5
+ ITableColumn,
6
+ ITableFilterData,
7
+ IPrintData,
8
+ ITableColumnsData,
9
+ ITable,
10
+ ICustomPrintData,
11
+ } from '../../../types/ITable';
12
+ import { getActiveFilterNumber, setTemplateData } from '../../../utils/TableUtils';
13
+ import { NotificationBadge } from '../../Badge/NotificationBadge';
14
+ import { TablePrint } from './Print/TablePrint';
15
+ import { SetColumnsList } from './Columns/SetColumnsList';
16
+ import { SetSortList } from './SetSortList';
17
+ import { SetTableFilter } from './SetTableFilter';
18
+ import { useTranslation } from 'react-i18next';
19
+ // import { TemplateList } from './Templates/TemplateList';
20
+ // import { TemplateCreate } from './Templates/TemplateCreate';
21
+ // import { TemplateCreateDefault } from './Templates/TemplateCreateDefault';
22
+ import { MenuItem } from '../../Menu/MenuItem';
23
+ import { maxChar } from '../../../utils/StringUtils';
24
+ import { deletePropsThatEndsWith } from '../../../utils/ObjectUtils';
25
+ import { CustomTablePrint } from './Print/CustomTablePrint';
26
+ import { IconButton } from '../../Button/IconButton';
27
+ import { Tooltip } from '../../Tooltip/Tooltip';
28
+ import { Menu } from '../../Menu/Menu';
29
+ import { faFilter } from '../../../assets/icons/light/faFilter';
30
+ import { faLineColumns } from '../../../assets/icons/light/faLineColumns';
31
+ import { faArrowUpArrowDown } from '../../../assets/icons/light/faArrowUpArrowDown';
32
+
33
+ interface Props {
34
+ columns: ITableColumn[];
35
+ columnsData?: ITableColumnsData;
36
+ filterData?: ITableFilterData;
37
+ sortData?: ITableSortData;
38
+ printData?: IPrintData;
39
+ customPrintData?: ICustomPrintData;
40
+ templates?: ITable['templates'];
41
+ additionsalOptions?: ReactNode;
42
+ }
43
+ export const TableOptions: FC<Props> = ({
44
+ columns,
45
+ columnsData,
46
+ filterData,
47
+ sortData,
48
+ printData,
49
+ customPrintData,
50
+ templates,
51
+ additionsalOptions,
52
+ }) => {
53
+ const [selectedTemplateName, setSelectedTemplateName] = useState('');
54
+ const [opened, setOpened] = useState<
55
+ 'filter' | 'sort' | 'columns' | 'print' | 'templates' | ''
56
+ >('');
57
+
58
+ const { t } = useTranslation();
59
+
60
+ const onClose = () => setOpened('');
61
+
62
+ return (
63
+ <div className="table-options gap-2">
64
+ <div className="flex align-center gap-3">
65
+ {filterData && (
66
+ <>
67
+ <NotificationBadge number={getActiveFilterNumber(filterData.search)} size="s">
68
+ <IconButton
69
+ icon={faFilter}
70
+ tooltip={t('Filter')}
71
+ active={opened === 'filter'}
72
+ onClick={() => setOpened('filter')}
73
+ size="s"
74
+ variant="outlined"
75
+ />
76
+ </NotificationBadge>
77
+ <SetTableFilter
78
+ {...filterData}
79
+ onSubmit={search => {
80
+ filterData.onSubmit(search);
81
+ setSelectedTemplateName('');
82
+ templates?.setTemplateName?.('');
83
+ }}
84
+ isOpen={opened === 'filter'}
85
+ onClose={onClose}
86
+ />
87
+ </>
88
+ )}
89
+ {columnsData && (
90
+ <>
91
+ <IconButton
92
+ icon={faLineColumns}
93
+ tooltip={t('Columns')}
94
+ active={opened === 'columns'}
95
+ onClick={() => setOpened('columns')}
96
+ size="s"
97
+ variant="outlined"
98
+ />
99
+ {opened === 'columns' && (
100
+ <SetColumnsList
101
+ columns={columnsData.columns}
102
+ setColumns={data => {
103
+ columnsData.setColumns(data);
104
+ setSelectedTemplateName('');
105
+ templates?.setTemplateName?.('');
106
+ }}
107
+ isOpen={true}
108
+ onClose={onClose}
109
+ withSearch={columnsData.withSearch}
110
+ />
111
+ )}
112
+ </>
113
+ )}
114
+ {sortData && (
115
+ <Menu
116
+ isOpen={opened === 'sort'}
117
+ onClose={onClose}
118
+ renderButton={ref => (
119
+ <Tooltip label={t('Sort')} ref={ref}>
120
+ <IconButton
121
+ icon={faArrowUpArrowDown}
122
+ active={opened === 'sort'}
123
+ onClick={() => setOpened('sort')}
124
+ size="s"
125
+ variant="outlined"
126
+ />
127
+ </Tooltip>
128
+ )}
129
+ size={sortData.menuSize}
130
+ >
131
+ <SetSortList
132
+ {...sortData}
133
+ setSort={data => {
134
+ sortData.setSort(data);
135
+ setSelectedTemplateName('');
136
+ templates?.setTemplateName?.('');
137
+ }}
138
+ />
139
+ </Menu>
140
+ )}
141
+ {/* {templates && (
142
+ <Menu
143
+ renderButton={ref => (
144
+ <Tooltip
145
+ label={
146
+ selectedTemplateName
147
+ ? `${t('Templates')} (${maxChar(selectedTemplateName, 30)})`
148
+ : t('Templates')
149
+ }
150
+ ref={ref}
151
+ >
152
+ <IconButton
153
+ icon={faPenField}
154
+ active={opened === 'templates'}
155
+ onClick={() => setOpened('templates')}
156
+ size="s"
157
+ variant="outlined"
158
+ />
159
+ </Tooltip>
160
+ )}
161
+ isOpen={opened === 'templates'}
162
+ onClose={onClose}
163
+ >
164
+ <TemplateList
165
+ identifier={templates.identifier}
166
+ onSelect={template => {
167
+ setTemplateData({
168
+ template,
169
+ columnsData,
170
+ setFilters: e => {
171
+ filterData?.setSearchData(e);
172
+ filterData?.onSubmit(deletePropsThatEndsWith(e, 'Obj'));
173
+ },
174
+ setSort: sortData?.setSort,
175
+ });
176
+ setSelectedTemplateName(template.name);
177
+ templates.setTemplateName?.(template.name);
178
+ onClose();
179
+ }}
180
+ />
181
+ <MenuItem
182
+ label={t('RemoveFiltersAndLook')}
183
+ onClick={() => {
184
+ templates.onClearFilters();
185
+ setSelectedTemplateName('');
186
+ templates.setTemplateName?.('');
187
+ onClose();
188
+ }}
189
+ />
190
+ <TemplateCreate
191
+ identifier={templates.identifier}
192
+ data={templates.data}
193
+ onSubmitCallback={onClose}
194
+ allowPublicCreate={templates.allowPublicCreate}
195
+ />
196
+ <TemplateCreateDefault
197
+ identifier={templates.identifier}
198
+ data={templates.data}
199
+ onClose={onClose}
200
+ />
201
+ </Menu>
202
+ )} */}
203
+ {(printData ?? customPrintData) && (
204
+ <>
205
+ <IconButton
206
+ icon={faPrint}
207
+ tooltip={t('PrintExport')}
208
+ onClick={() => setOpened('print')}
209
+ size="s"
210
+ variant="solid"
211
+ />
212
+ {opened === 'print' &&
213
+ (printData ? (
214
+ <TablePrint {...printData} isOpen onClose={onClose} columns={columns} />
215
+ ) : (
216
+ customPrintData && (
217
+ <CustomTablePrint {...customPrintData} isOpen onClose={onClose} />
218
+ )
219
+ ))}
220
+ </>
221
+ )}
222
+ {additionsalOptions}
223
+ </div>
224
+ </div>
225
+ );
226
+ };