@inceptionbg/iui 2.0.23 → 2.0.24

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 (232) hide show
  1. package/dist/NoAccessPage-CJisyKrk.js +2 -0
  2. package/dist/{NoAccessPage-BmizYfw0.js.map → NoAccessPage-CJisyKrk.js.map} +1 -1
  3. package/dist/NotFoundPage-BeRit0kr.js +2 -0
  4. package/dist/{NotFoundPage-Cv544vAr.js.map → NotFoundPage-BeRit0kr.js.map} +1 -1
  5. package/dist/index.d.ts +432 -430
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/iui.css +1 -1
  9. package/idea/GridTable/GridTable.tsx +1 -1
  10. package/idea/Menu/Menu.tsx +5 -3
  11. package/idea/Menu/MenuItem.tsx +3 -2
  12. package/idea/Menu/hooks/useMenuControl.ts +1 -1
  13. package/idea/Menu.tsx +3 -2
  14. package/idea/NoAccessInfo.tsx +1 -1
  15. package/idea/Table/Components/Edit/ItemActionsMenu.tsx +2 -1
  16. package/idea/Table/Components/Edit/ItemEditOptionsButtons.tsx +1 -1
  17. package/idea/Table/Components/Edit/TableEditRow.tsx +3 -2
  18. package/idea/Table/Components/FilterItem.tsx +2 -2
  19. package/idea/Table/Components/Header/TableHeader.tsx +3 -2
  20. package/idea/Table/Components/Header/TableHeaderRow.tsx +2 -2
  21. package/idea/Table/Components/Print/CustomTablePrint.tsx +3 -2
  22. package/idea/Table/Components/SetSortList.tsx +2 -2
  23. package/idea/Table/Components/SetTableFilter.tsx +3 -2
  24. package/idea/Table/Components/TableFooter.tsx +6 -4
  25. package/idea/Table/Components/TableOptions.tsx +3 -2
  26. package/idea/Table/Table.tsx +3 -2
  27. package/idea/Table/hooks/useTableKeyboard.ts +2 -2
  28. package/package.json +1 -1
  29. package/src/assets/icons/duotone/faBell.ts +17 -17
  30. package/src/assets/icons/duotone/faCircleUser.ts +17 -17
  31. package/src/assets/icons/index.ts +25 -25
  32. package/src/assets/icons/light/faArrowDownShortWide.ts +15 -15
  33. package/src/assets/icons/light/faArrowDownWideShort.ts +15 -15
  34. package/src/assets/icons/light/faArrowLeft.ts +5 -5
  35. package/src/assets/icons/light/faArrowRight.ts +5 -5
  36. package/src/assets/icons/light/faArrowUpArrowDown.ts +15 -15
  37. package/src/assets/icons/light/faArrowUpRightFromSquare.ts +15 -15
  38. package/src/assets/icons/light/faArrowsToLine.ts +15 -15
  39. package/src/assets/icons/light/faArrowsUpDown.ts +15 -15
  40. package/src/assets/icons/light/faBell.ts +15 -15
  41. package/src/assets/icons/light/faBookmark.ts +15 -15
  42. package/src/assets/icons/light/faBookmarkSlash.ts +15 -15
  43. package/src/assets/icons/light/faCalendarPlus.ts +15 -15
  44. package/src/assets/icons/light/faCheck.ts +15 -15
  45. package/src/assets/icons/light/faChevronDown.ts +15 -15
  46. package/src/assets/icons/light/faChevronRight.ts +15 -15
  47. package/src/assets/icons/light/faCircleInfo.ts +15 -15
  48. package/src/assets/icons/light/faCircleXmark.ts +15 -15
  49. package/src/assets/icons/light/faClipboardCheck.ts +15 -15
  50. package/src/assets/icons/light/faClockRotateLeft.ts +15 -15
  51. package/src/assets/icons/light/faEllipsisVertical.ts +15 -15
  52. package/src/assets/icons/light/faEnvelope.ts +15 -15
  53. package/src/assets/icons/light/faEye.ts +15 -15
  54. package/src/assets/icons/light/faEyeSlash.ts +15 -15
  55. package/src/assets/icons/light/faFilter.ts +15 -15
  56. package/src/assets/icons/light/faGear.ts +15 -15
  57. package/src/assets/icons/light/faHouse.ts +15 -15
  58. package/src/assets/icons/light/faIdBadge.ts +15 -15
  59. package/src/assets/icons/light/faLineColumns.ts +15 -15
  60. package/src/assets/icons/light/faLink.ts +15 -15
  61. package/src/assets/icons/light/faMagnifyingGlass.ts +15 -15
  62. package/src/assets/icons/light/faPen.ts +15 -15
  63. package/src/assets/icons/light/faPrint.ts +15 -15
  64. package/src/assets/icons/light/faQuestion.ts +15 -15
  65. package/src/assets/icons/light/faRotateRight.ts +15 -15
  66. package/src/assets/icons/light/faTrashCan.ts +15 -15
  67. package/src/assets/icons/light/faTriangleExclamation.ts +15 -15
  68. package/src/assets/icons/light/faXmark.ts +15 -15
  69. package/src/assets/icons/regular/faArrowLeft.ts +15 -15
  70. package/src/assets/icons/regular/faArrowRightArrowLeft.ts +15 -15
  71. package/src/assets/icons/regular/faCircleCheck.ts +15 -15
  72. package/src/assets/icons/regular/faCircleExclamation.ts +15 -15
  73. package/src/assets/icons/regular/faCircleInfo.ts +15 -15
  74. package/src/assets/icons/regular/faFileArrowDown.ts +15 -15
  75. package/src/assets/icons/regular/faFilterCircleXmark.ts +15 -15
  76. package/src/assets/icons/regular/faTriangleExclamation.ts +15 -15
  77. package/src/assets/icons/solid/faAngleLeft.ts +15 -15
  78. package/src/assets/icons/solid/faAngleRight.ts +15 -15
  79. package/src/assets/icons/solid/faArrowDownWideShort.ts +15 -15
  80. package/src/assets/icons/solid/faCaretDown.ts +15 -15
  81. package/src/assets/icons/solid/faCheck.ts +15 -15
  82. package/src/assets/icons/solid/faEllipsisVertical.ts +15 -15
  83. package/src/assets/icons/solid/faEnvelopeDot.ts +15 -15
  84. package/src/assets/icons/solid/faFilter.ts +15 -15
  85. package/src/assets/icons/solid/faFloppyDisk.ts +15 -15
  86. package/src/assets/icons/solid/faGripDotsVertical.ts +15 -15
  87. package/src/assets/icons/solid/faListUl.ts +15 -15
  88. package/src/assets/icons/solid/faMinus.ts +15 -15
  89. package/src/assets/icons/solid/faPlus.ts +15 -15
  90. package/src/assets/icons/solid/faPrint.ts +15 -15
  91. package/src/assets/icons/solid/faRotateRight.ts +15 -15
  92. package/src/assets/icons/solid/faXmark.ts +15 -15
  93. package/src/components/Accordions/Accordions.tsx +75 -74
  94. package/src/components/Alert/Alert.tsx +31 -31
  95. package/src/components/Badge/DotBadge.tsx +16 -16
  96. package/src/components/Badge/NotificationBadge.tsx +29 -29
  97. package/src/components/Badge/PillBadge.tsx +13 -13
  98. package/src/components/Button/Button.tsx +56 -56
  99. package/src/components/Button/IconButton.tsx +51 -51
  100. package/src/components/Button/SplitButton.tsx +91 -91
  101. package/src/components/Dashboard/Dashboard.tsx +9 -9
  102. package/src/components/Dashboard/DashboardWidget.tsx +44 -44
  103. package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +37 -37
  104. package/src/components/Dialog/Dialog.tsx +166 -164
  105. package/src/components/Dialog/components/DialogFooter.tsx +100 -98
  106. package/src/components/Header/Components/EnvBadge.tsx +17 -17
  107. package/src/components/Header/Components/ModuleSelect.tsx +68 -68
  108. package/src/components/Header/Components/Notifications.tsx +202 -208
  109. package/src/components/Header/Components/UserMenu.tsx +52 -52
  110. package/src/components/Header/Header.tsx +37 -36
  111. package/src/components/Helper/Collapse.tsx +53 -52
  112. package/src/components/Inputs/Checkbox.tsx +53 -53
  113. package/src/components/Inputs/CurrencyInput.tsx +124 -123
  114. package/src/components/Inputs/DateInput/DateInput.tsx +184 -183
  115. package/src/components/Inputs/DateInput/components/DatePartInput.tsx +159 -158
  116. package/src/components/Inputs/InputWrapper.tsx +95 -95
  117. package/src/components/Inputs/NumberInput.tsx +86 -86
  118. package/src/components/Inputs/PasswordInput.tsx +40 -39
  119. package/src/components/Inputs/PhoneInput/PhoneInput.tsx +108 -108
  120. package/src/components/Inputs/PhoneInput/utils/countryCode.ts +20 -20
  121. package/src/components/Inputs/Radio.tsx +59 -59
  122. package/src/components/Inputs/RadioGroup.tsx +48 -48
  123. package/src/components/Inputs/RadioLarge.tsx +39 -39
  124. package/src/components/Inputs/SearchInput.tsx +46 -45
  125. package/src/components/Inputs/Selects/Select.tsx +17 -17
  126. package/src/components/Inputs/Selects/components/CustomSelectComponents.tsx +20 -19
  127. package/src/components/Inputs/Selects/components/SelectWrapper.tsx +118 -118
  128. package/src/components/Inputs/Selects/utils/selectStyles.ts +101 -101
  129. package/src/components/Inputs/TextAreaInput.tsx +68 -67
  130. package/src/components/Inputs/TextInput.tsx +100 -99
  131. package/src/components/Inputs/TimeInput/TimeInput.tsx +81 -81
  132. package/src/components/List/List.tsx +21 -20
  133. package/src/components/List/ListItem.tsx +70 -69
  134. package/src/components/Loader/Loader.tsx +59 -53
  135. package/src/components/Loader/ProgressBar.tsx +41 -41
  136. package/src/components/Menu/Menu.tsx +81 -80
  137. package/src/components/Menu/MenuItem.tsx +46 -46
  138. package/src/components/Menu/NewMenu.tsx +63 -63
  139. package/src/components/Menu/hooks/useMenuPosition.tsx +116 -115
  140. package/src/components/Pullover/Pullover.tsx +197 -196
  141. package/src/components/Router/Router.tsx +52 -51
  142. package/src/components/Sidebar/AddButton.tsx +22 -22
  143. package/src/components/Sidebar/Sidebar.tsx +85 -83
  144. package/src/components/Sidebar/SidebarItem.tsx +84 -84
  145. package/src/components/Sidebar/types/ISidebar.ts +28 -28
  146. package/src/components/Table/Table.tsx +259 -258
  147. package/src/components/Table/components/columns/ColumnsList.tsx +60 -59
  148. package/src/components/Table/components/columns/TableColumnsEdit.tsx +114 -112
  149. package/src/components/Table/components/edit/TableEditRow.tsx +78 -77
  150. package/src/components/Table/components/filters/FilterItem.tsx +15 -15
  151. package/src/components/Table/components/filters/TableFilters.tsx +126 -125
  152. package/src/components/Table/components/footer/TableFooter.tsx +126 -124
  153. package/src/components/Table/components/header/TableHeader.tsx +40 -40
  154. package/src/components/Table/components/header/TableHeaderRow.tsx +57 -57
  155. package/src/components/Table/components/items/TableItemActions.tsx +78 -78
  156. package/src/components/Table/components/print/TablePrint.tsx +200 -199
  157. package/src/components/Table/components/select/TableSelect.tsx +50 -49
  158. package/src/components/Table/components/sort/TableSort.tsx +73 -72
  159. package/src/components/Table/components/templates/CreateTemplateDialog.tsx +58 -57
  160. package/src/components/Table/components/templates/TableTemplates.tsx +65 -64
  161. package/src/components/Table/components/templates/TemplatesPullover.tsx +88 -88
  162. package/src/components/Table/contexts/TableContext.tsx +116 -123
  163. package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +70 -70
  164. package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +84 -84
  165. package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +176 -177
  166. package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +12 -12
  167. package/src/components/Table/hooks/useTableColumns.ts +34 -34
  168. package/src/components/Table/hooks/useTableEdit.tsx +140 -140
  169. package/src/components/Table/hooks/useTableFilterFields.tsx +150 -150
  170. package/src/components/Table/hooks/useTablePagination.ts +19 -19
  171. package/src/components/Table/hooks/useTablePrint.ts +83 -83
  172. package/src/components/Table/hooks/useTableSearch.ts +31 -30
  173. package/src/components/Table/hooks/useTableSelect.ts +19 -19
  174. package/src/components/Table/hooks/useTableSort.ts +8 -8
  175. package/src/components/Tabs/Tabs.tsx +68 -67
  176. package/src/components/Tooltip/Tooltip.tsx +191 -200
  177. package/src/components/Tree/Tree.tsx +22 -22
  178. package/src/components/Tree/TreeItem.tsx +57 -56
  179. package/src/components/Wrappers/AppLayout.tsx +17 -17
  180. package/src/components/Wrappers/ConditionalWrapper.tsx +10 -10
  181. package/src/components/Wrappers/FormWrapper.tsx +84 -83
  182. package/src/components/Wrappers/PageLayout.tsx +156 -155
  183. package/src/hooks/useBackgroundClose.ts +19 -18
  184. package/src/hooks/useGetFocusableElements.ts +43 -42
  185. package/src/hooks/useIsMenuOpen.ts +11 -11
  186. package/src/hooks/useLocalPopoverControl.ts +32 -32
  187. package/src/hooks/useOnEsc.ts +14 -14
  188. package/src/hooks/usePopupControl.ts +22 -22
  189. package/src/hooks/useZendesk.ts +21 -21
  190. package/src/index.ts +379 -386
  191. package/src/pages/NoAccessPage.tsx +27 -27
  192. package/src/pages/NotFoundPage.tsx +26 -26
  193. package/src/styles/common/helpers/_size.scss +0 -3
  194. package/src/styles/components/_accordions.scss +1 -1
  195. package/src/styles/components/_buttonSplit.scss +4 -29
  196. package/src/types/IBasic.ts +32 -31
  197. package/src/types/ICountryCode.ts +5 -0
  198. package/src/types/IError.ts +5 -5
  199. package/src/types/IHeader.ts +40 -40
  200. package/src/types/IInfo.ts +1 -1
  201. package/src/types/IKeyboard.ts +33 -33
  202. package/src/types/IMenu.ts +19 -19
  203. package/src/types/INotifications.ts +15 -15
  204. package/src/types/IPopup.ts +17 -17
  205. package/src/types/IRouter.ts +6 -6
  206. package/src/types/ISelect.ts +54 -54
  207. package/src/types/ITab.ts +1 -1
  208. package/src/types/ITable.ts +290 -281
  209. package/src/types/ITree.ts +6 -6
  210. package/src/utils/InputPatternValidation.ts +12 -12
  211. package/src/utils/dateUtils.ts +32 -32
  212. package/src/utils/fileUtils.ts +177 -177
  213. package/src/utils/i18n/i18nIUICyrilic.ts +119 -119
  214. package/src/utils/i18n/i18nIUILatin.ts +120 -120
  215. package/src/utils/i18n/i18nIUIMe.ts +118 -118
  216. package/src/utils/icons.ts +13 -13
  217. package/src/utils/localStorageHelper.ts +24 -24
  218. package/src/utils/logoUtils.ts +7 -7
  219. package/src/utils/numberUtils.ts +21 -21
  220. package/src/utils/objectUtils.ts +114 -114
  221. package/src/utils/popupUtils.ts +82 -82
  222. package/src/utils/rootDir.ts +1 -1
  223. package/src/utils/stringUtils.ts +18 -18
  224. package/src/utils/tableUtils.ts +130 -130
  225. package/src/utils/toasts.ts +6 -6
  226. package/src/utils/urlUtils.ts +4 -4
  227. package/tsconfig.json +1 -0
  228. package/dist/NoAccessPage-BmizYfw0.js +0 -2
  229. package/dist/NotFoundPage-Cv544vAr.js +0 -2
  230. package/src/components/Dialog/hooks/useDialogKeyboard.ts +0 -42
  231. package/src/components/Inputs/Select2/Select.tsx +0 -258
  232. package/src/components/Inputs/Select2/select.scss +0 -42
@@ -1,199 +1,200 @@
1
- import { useEffect, useMemo, type FC } from 'react';
2
- import { IconButton } from '../../../Button/IconButton';
3
- import { faPrint } from '../../../../assets/icons';
4
- import { useTranslation } from 'react-i18next';
5
- import { Pullover } from '../../../Pullover/Pullover';
6
- import { useTableContext } from '../../contexts/TableContext';
7
- import { IPrintData } from '../../../../types/ITable';
8
- import { useHideZendesk } from '../../../../hooks/useZendesk';
9
- import { formatDate, getCurrentDateFormatted } from '../../../../utils/dateUtils';
10
- import { HeaderTable } from '../header/TableHeader';
11
- import clsx from 'clsx';
12
- import { faFileArrowDown } from '../../../../assets/icons/regular/faFileArrowDown';
13
- import { ProgressBar } from '../../../Loader/ProgressBar';
14
-
15
- export const TablePrint: FC = () => {
16
- const { t } = useTranslation();
17
- useHideZendesk();
18
- const {
19
- columnData: { columns },
20
- printData,
21
- } = useTableContext();
22
-
23
- const {
24
- label,
25
- tableData: data,
26
- isLoading,
27
- progress,
28
- paginationControl,
29
- printPopupControl,
30
- customHeader,
31
- filters,
32
- optionalNode,
33
- organization,
34
- saveXlsx,
35
- totals,
36
- } = useMemo(() => (printData ?? {}) as IPrintData, [printData]);
37
- const { control, onOpen } = printPopupControl;
38
-
39
- const cols = useMemo(() => columns.filter(e => !e.hidden && !e.printHidden), [columns]);
40
-
41
- useEffect(() => {
42
- if (control.isOpen) {
43
- paginationControl?.setLimit(1000);
44
- paginationControl?.setOffset(0);
45
- }
46
- }, [paginationControl, control.isOpen]);
47
-
48
- return (
49
- printData && (
50
- <>
51
- <IconButton
52
- tooltip={t('PrintExport')}
53
- icon={faPrint}
54
- onClick={onOpen}
55
- size="s"
56
- variant="outlined"
57
- />
58
-
59
- <Pullover
60
- control={control}
61
- header={{ title: t('PrintExport') }}
62
- footer={{
63
- confirmButton: {
64
- label: t('Print'),
65
- onClick: window.print,
66
- // type: 'submit',
67
- },
68
- additionalButton: saveXlsx
69
- ? {
70
- label: t('SaveXlsx'),
71
- icon: faFileArrowDown,
72
- onClick: saveXlsx,
73
- }
74
- : undefined,
75
- }}
76
- contentClassName="iui-print"
77
- size="vw100"
78
- portalTarget={document.body}
79
- >
80
- <div className="print-content">
81
- <div className="flex justify-between">
82
- {organization ? (
83
- <div>
84
- <p className="name">{organization.name}</p>
85
- {organization.taxId && <p>{`${t('TaxId')}: ${organization.taxId}`}</p>}
86
- {organization.registrationNumber && (
87
- <p>{`${t('BusinessCode')}: ${organization.registrationNumber}`}</p>
88
- )}
89
- {organization.jbkjs && <p>JBKJS: {organization.jbkjs}</p>}
90
- {organization.email && <p>Email: {organization.email}</p>}
91
- </div>
92
- ) : (
93
- <div />
94
- )}
95
- <div className="text-right">
96
- <p>{`${t('PrintDate')}: ${getCurrentDateFormatted()}`}</p>
97
- </div>
98
- </div>
99
- <h3 className="my-3 text-center">{label}</h3>
100
- {filters && (
101
- <div className="flex justify-between">
102
- <div>
103
- {filters.basic?.map(
104
- e =>
105
- !!e.value && (
106
- <div key={e.value} className="mb-2">
107
- <p>{`${e.label}: ${e.value}`}</p>
108
- </div>
109
- )
110
- )}
111
- </div>
112
- {filters.date && (
113
- <div>
114
- {filters.date.map(
115
- e =>
116
- (!!e.from || !!e.to) && (
117
- <div key={e.label} className="mb-2 text-right">
118
- <p>
119
- {e.label} {!!e.from && `${t('from')} ${formatDate(e.from)}`}{' '}
120
- {`${t('to')} ${formatDate(e.to || new Date().toString())}`}
121
- </p>
122
- </div>
123
- )
124
- )}
125
- </div>
126
- )}
127
- </div>
128
- )}
129
- {optionalNode?.aboveTable}
130
- {isLoading ? (
131
- <ProgressBar progress={progress} />
132
- ) : (
133
- data && (
134
- <table width="100%" className="print-table">
135
- <HeaderTable
136
- columns={cols}
137
- customHeader={customHeader}
138
- headerWrap
139
- print
140
- />
141
- <tbody>
142
- {data.map(row => {
143
- let totalColsSpan = 0;
144
- return (
145
- <tr key={row.uuid} className={row.className}>
146
- {cols.map(column => {
147
- const cell = row.cells[column.id];
148
-
149
- totalColsSpan += cell?.span
150
- ? // If span is -1 or larger then the number of columns
151
- cell.span === -1 || cell.span > cols.length
152
- ? // ...fill the rest of the table
153
- cols.length - totalColsSpan
154
- : cell.span
155
- : 1;
156
-
157
- return (
158
- cols.length >= totalColsSpan && (
159
- <td
160
- key={column.id}
161
- align={cell?.align || column.align}
162
- className={clsx(column.color, cell?.className, {
163
- 'word-break': column.break,
164
- })}
165
- colSpan={cell?.span === -1 ? cols.length : cell?.span}
166
- >
167
- {cell?.printValue ?? cell?.value}
168
- </td>
169
- )
170
- );
171
- })}
172
- </tr>
173
- );
174
- })}
175
- {!!totals && (
176
- <tr>
177
- {cols.map(({ id: columnId }) => (
178
- <td
179
- key={columnId}
180
- align={totals.cells[columnId]?.align || 'right'}
181
- colSpan={totals.cells[columnId]?.span}
182
- className="py-3"
183
- >
184
- <strong>{totals.cells[columnId]?.value}</strong>
185
- </td>
186
- ))}
187
- </tr>
188
- )}
189
- </tbody>
190
- </table>
191
- )
192
- )}
193
- {optionalNode?.bellowTable}
194
- </div>
195
- </Pullover>
196
- </>
197
- )
198
- );
199
- };
1
+ import type { FC } from 'react';
2
+ import type { IPrintData } from '../../../../types/ITable';
3
+ import { useEffect, useMemo } from 'react';
4
+ import clsx from 'clsx';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { faPrint } from '../../../../assets/icons';
7
+ import { faFileArrowDown } from '../../../../assets/icons/regular/faFileArrowDown';
8
+ import { useHideZendesk } from '../../../../hooks/useZendesk';
9
+ import { formatDate, getCurrentDateFormatted } from '../../../../utils/dateUtils';
10
+ import { IconButton } from '../../../Button/IconButton';
11
+ import { ProgressBar } from '../../../Loader/ProgressBar';
12
+ import { Pullover } from '../../../Pullover/Pullover';
13
+ import { useTableContext } from '../../contexts/TableContext';
14
+ import { HeaderTable } from '../header/TableHeader';
15
+
16
+ export const TablePrint: FC = () => {
17
+ const { t } = useTranslation();
18
+ useHideZendesk();
19
+ const {
20
+ columnData: { columns },
21
+ printData,
22
+ } = useTableContext();
23
+
24
+ const {
25
+ label,
26
+ tableData: data,
27
+ isLoading,
28
+ progress,
29
+ paginationControl,
30
+ printPopupControl,
31
+ customHeader,
32
+ filters,
33
+ optionalNode,
34
+ organization,
35
+ saveXlsx,
36
+ totals,
37
+ } = useMemo(() => (printData ?? {}) as IPrintData, [printData]);
38
+ const { control, onOpen } = printPopupControl;
39
+
40
+ const cols = useMemo(() => columns.filter(e => !e.hidden && !e.printHidden), [columns]);
41
+
42
+ useEffect(() => {
43
+ if (control.isOpen) {
44
+ paginationControl?.setLimit(1000);
45
+ paginationControl?.setOffset(0);
46
+ }
47
+ }, [paginationControl, control.isOpen]);
48
+
49
+ return (
50
+ printData && (
51
+ <>
52
+ <IconButton
53
+ tooltip={t('PrintExport')}
54
+ icon={faPrint}
55
+ onClick={onOpen}
56
+ size="s"
57
+ variant="outlined"
58
+ />
59
+
60
+ <Pullover
61
+ control={control}
62
+ header={{ title: t('PrintExport') }}
63
+ footer={{
64
+ confirmButton: {
65
+ label: t('Print'),
66
+ onClick: window.print,
67
+ // type: 'submit',
68
+ },
69
+ additionalButton: saveXlsx
70
+ ? {
71
+ label: t('SaveXlsx'),
72
+ icon: faFileArrowDown,
73
+ onClick: saveXlsx,
74
+ }
75
+ : undefined,
76
+ }}
77
+ contentClassName="iui-print"
78
+ size="vw100"
79
+ portalTarget={document.body}
80
+ >
81
+ <div className="print-content">
82
+ <div className="flex justify-between">
83
+ {organization ? (
84
+ <div>
85
+ <p className="name">{organization.name}</p>
86
+ {organization.taxId && <p>{`${t('TaxId')}: ${organization.taxId}`}</p>}
87
+ {organization.registrationNumber && (
88
+ <p>{`${t('BusinessCode')}: ${organization.registrationNumber}`}</p>
89
+ )}
90
+ {organization.jbkjs && <p>JBKJS: {organization.jbkjs}</p>}
91
+ {organization.email && <p>Email: {organization.email}</p>}
92
+ </div>
93
+ ) : (
94
+ <div />
95
+ )}
96
+ <div className="text-right">
97
+ <p>{`${t('PrintDate')}: ${getCurrentDateFormatted()}`}</p>
98
+ </div>
99
+ </div>
100
+ <h3 className="my-3 text-center">{label}</h3>
101
+ {filters && (
102
+ <div className="flex justify-between">
103
+ <div>
104
+ {filters.basic?.map(
105
+ e =>
106
+ !!e.value && (
107
+ <div key={e.value} className="mb-2">
108
+ <p>{`${e.label}: ${e.value}`}</p>
109
+ </div>
110
+ )
111
+ )}
112
+ </div>
113
+ {filters.date && (
114
+ <div>
115
+ {filters.date.map(
116
+ e =>
117
+ (!!e.from || !!e.to) && (
118
+ <div key={e.label} className="mb-2 text-right">
119
+ <p>
120
+ {e.label} {!!e.from && `${t('from')} ${formatDate(e.from)}`}{' '}
121
+ {`${t('to')} ${formatDate(e.to || new Date().toString())}`}
122
+ </p>
123
+ </div>
124
+ )
125
+ )}
126
+ </div>
127
+ )}
128
+ </div>
129
+ )}
130
+ {optionalNode?.aboveTable}
131
+ {isLoading ? (
132
+ <ProgressBar progress={progress} />
133
+ ) : (
134
+ data && (
135
+ <table width="100%" className="print-table">
136
+ <HeaderTable
137
+ columns={cols}
138
+ customHeader={customHeader}
139
+ headerWrap
140
+ print
141
+ />
142
+ <tbody>
143
+ {data.map(row => {
144
+ let totalColsSpan = 0;
145
+ return (
146
+ <tr key={row.uuid} className={row.className}>
147
+ {cols.map(column => {
148
+ const cell = row.cells[column.id];
149
+
150
+ totalColsSpan += cell?.span
151
+ ? // If span is -1 or larger then the number of columns
152
+ cell.span === -1 || cell.span > cols.length
153
+ ? // ...fill the rest of the table
154
+ cols.length - totalColsSpan
155
+ : cell.span
156
+ : 1;
157
+
158
+ return (
159
+ cols.length >= totalColsSpan && (
160
+ <td
161
+ key={column.id}
162
+ align={cell?.align || column.align}
163
+ className={clsx(column.color, cell?.className, {
164
+ 'word-break': column.break,
165
+ })}
166
+ colSpan={cell?.span === -1 ? cols.length : cell?.span}
167
+ >
168
+ {cell?.printValue ?? cell?.value}
169
+ </td>
170
+ )
171
+ );
172
+ })}
173
+ </tr>
174
+ );
175
+ })}
176
+ {!!totals && (
177
+ <tr>
178
+ {cols.map(({ id: columnId }) => (
179
+ <td
180
+ key={columnId}
181
+ align={totals.cells[columnId]?.align || 'right'}
182
+ colSpan={totals.cells[columnId]?.span}
183
+ className="py-3"
184
+ >
185
+ <strong>{totals.cells[columnId]?.value}</strong>
186
+ </td>
187
+ ))}
188
+ </tr>
189
+ )}
190
+ </tbody>
191
+ </table>
192
+ )
193
+ )}
194
+ {optionalNode?.bellowTable}
195
+ </div>
196
+ </Pullover>
197
+ </>
198
+ )
199
+ );
200
+ };
@@ -1,49 +1,50 @@
1
- import { useState, type FC } from 'react';
2
- import { useTableContext } from '../../contexts/TableContext';
3
- import { Menu } from '../../../Menu/Menu';
4
- import { useTranslation } from 'react-i18next';
5
- import { IconButton } from '../../../Button/IconButton';
6
- import { faClipboardCheck } from '../../../../assets/icons/light/faClipboardCheck';
7
- import { NotificationBadge } from '../../../Badge/NotificationBadge';
8
- import { Tooltip } from '../../../Tooltip/Tooltip';
9
-
10
- export const TableSelect: FC = () => {
11
- const [isOpen, setIsOpen] = useState(false);
12
-
13
- const { t } = useTranslation();
14
- const { rowSelect, selectActions } = useTableContext();
15
-
16
- return !!rowSelect && selectActions.length > 0 ? (
17
- <Menu
18
- isOpen={isOpen}
19
- onClose={() => setIsOpen(false)}
20
- placement="bottom-left"
21
- renderButton={ref => (
22
- <NotificationBadge number={rowSelect.selectedRows.size}>
23
- <Tooltip
24
- ref={ref}
25
- label={t('TableSelect')}
26
- disabled={!rowSelect.selectedRows.size}
27
- >
28
- <IconButton
29
- icon={faClipboardCheck}
30
- active={isOpen}
31
- onClick={() => setIsOpen(!isOpen)}
32
- disabled={!rowSelect.selectedRows.size}
33
- variant="outlined"
34
- size="s"
35
- />
36
- </Tooltip>
37
- </NotificationBadge>
38
- )}
39
- items={selectActions.map(action => ({
40
- ...action,
41
- onClick: () => {
42
- action.onClick!(rowSelect.selectedRows);
43
- setIsOpen(false);
44
- action.clearSelected && rowSelect.setSelectedRows(new Set<string>());
45
- },
46
- }))}
47
- />
48
- ) : null;
49
- };
1
+ import type { FC } from 'react';
2
+ import { useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { faClipboardCheck } from '../../../../assets/icons/light/faClipboardCheck';
5
+ import { NotificationBadge } from '../../../Badge/NotificationBadge';
6
+ import { IconButton } from '../../../Button/IconButton';
7
+ import { Menu } from '../../../Menu/Menu';
8
+ import { Tooltip } from '../../../Tooltip/Tooltip';
9
+ import { useTableContext } from '../../contexts/TableContext';
10
+
11
+ export const TableSelect: FC = () => {
12
+ const [isOpen, setIsOpen] = useState(false);
13
+
14
+ const { t } = useTranslation();
15
+ const { rowSelect, selectActions } = useTableContext();
16
+
17
+ return !!rowSelect && selectActions.length > 0 ? (
18
+ <Menu
19
+ isOpen={isOpen}
20
+ onClose={() => setIsOpen(false)}
21
+ placement="bottom-left"
22
+ renderButton={ref => (
23
+ <NotificationBadge number={rowSelect.selectedRows.size}>
24
+ <Tooltip
25
+ ref={ref}
26
+ label={t('TableSelect')}
27
+ disabled={!rowSelect.selectedRows.size}
28
+ >
29
+ <IconButton
30
+ icon={faClipboardCheck}
31
+ active={isOpen}
32
+ onClick={() => setIsOpen(!isOpen)}
33
+ disabled={!rowSelect.selectedRows.size}
34
+ variant="outlined"
35
+ size="s"
36
+ />
37
+ </Tooltip>
38
+ </NotificationBadge>
39
+ )}
40
+ items={selectActions.map(action => ({
41
+ ...action,
42
+ onClick: () => {
43
+ action.onClick!(rowSelect.selectedRows);
44
+ setIsOpen(false);
45
+ action.clearSelected && rowSelect.setSelectedRows(new Set<string>());
46
+ },
47
+ }))}
48
+ />
49
+ ) : null;
50
+ };