@inceptionbg/iui 2.0.35 → 2.0.37

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 (244) hide show
  1. package/dist/index.d.ts +7 -6
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/package.json +4 -1
  5. package/idea/GridTable/GridTable.tsx +0 -119
  6. package/idea/GridTable/gridTable.scss +0 -42
  7. package/idea/Menu/Menu.tsx +0 -121
  8. package/idea/Menu/MenuItem.tsx +0 -75
  9. package/idea/Menu/hooks/useMenuControl.ts +0 -13
  10. package/idea/Menu.tsx +0 -133
  11. package/idea/NoAccessInfo.tsx +0 -193
  12. package/idea/Table/Components/Edit/ItemActionsMenu.tsx +0 -85
  13. package/idea/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -31
  14. package/idea/Table/Components/Edit/TableEditRow.tsx +0 -57
  15. package/idea/Table/Components/FilterItem.tsx +0 -20
  16. package/idea/Table/Components/Header/TableHeader.tsx +0 -46
  17. package/idea/Table/Components/Header/TableHeaderRow.tsx +0 -37
  18. package/idea/Table/Components/Print/CustomTablePrint.tsx +0 -115
  19. package/idea/Table/Components/SetSortList.tsx +0 -30
  20. package/idea/Table/Components/SetTableFilter.tsx +0 -91
  21. package/idea/Table/Components/TableFooter.tsx +0 -137
  22. package/idea/Table/Components/TableOptions.tsx +0 -227
  23. package/idea/Table/Components/Templates/TemplateCreate.tsx +0 -80
  24. package/idea/Table/Components/Templates/TemplateCreateDefault.tsx +0 -45
  25. package/idea/Table/Components/Templates/TemplateList.tsx +0 -167
  26. package/idea/Table/Components/Templates/repo/TemplateRepo.ts +0 -53
  27. package/idea/Table/Table.tsx +0 -528
  28. package/idea/Table/hooks/useDefaultTemplate.ts +0 -20
  29. package/idea/Table/hooks/useTableKeyboard.ts +0 -137
  30. package/idea/Table/hooks/useTableSelect.ts +0 -11
  31. package/rollup.config.js +0 -52
  32. package/src/assets/icons/duotone/faBell.ts +0 -17
  33. package/src/assets/icons/duotone/faCircleUser.ts +0 -17
  34. package/src/assets/icons/regular/faArrowLeft.ts +0 -15
  35. package/src/assets/icons/regular/faArrowRightArrowLeft.ts +0 -15
  36. package/src/assets/icons/regular/faCircleCheck.ts +0 -15
  37. package/src/assets/icons/regular/faCircleExclamation.ts +0 -15
  38. package/src/assets/icons/regular/faCircleInfo.ts +0 -15
  39. package/src/assets/icons/regular/faFileArrowDown.ts +0 -15
  40. package/src/assets/icons/regular/faFilterCircleXmark.ts +0 -15
  41. package/src/assets/icons/regular/faTriangleExclamation.ts +0 -15
  42. package/src/assets/icons/solid/faAngleLeft.ts +0 -15
  43. package/src/assets/icons/solid/faAngleRight.ts +0 -15
  44. package/src/assets/icons/solid/faArrowDownWideShort.ts +0 -15
  45. package/src/assets/icons/solid/faCaretDown.ts +0 -15
  46. package/src/assets/icons/solid/faCheck.ts +0 -15
  47. package/src/assets/icons/solid/faEllipsisVertical.ts +0 -15
  48. package/src/assets/icons/solid/faEnvelopeDot.ts +0 -15
  49. package/src/assets/icons/solid/faFilter.ts +0 -15
  50. package/src/assets/icons/solid/faFloppyDisk.ts +0 -15
  51. package/src/assets/icons/solid/faGripDotsVertical.ts +0 -15
  52. package/src/assets/icons/solid/faListUl.ts +0 -15
  53. package/src/assets/icons/solid/faMinus.ts +0 -15
  54. package/src/assets/icons/solid/faPlus.ts +0 -15
  55. package/src/assets/icons/solid/faPrint.ts +0 -15
  56. package/src/assets/icons/solid/faRotateRight.ts +0 -15
  57. package/src/assets/icons/solid/faXmark.ts +0 -15
  58. package/src/assets/images/logo/inception.svg +0 -22
  59. package/src/assets/images/logo/mts.svg +0 -5703
  60. package/src/assets/images/logo/paperless.svg +0 -21
  61. package/src/assets/images/logo/pismonosa.png +0 -0
  62. package/src/assets/images/not-found.svg +0 -19
  63. package/src/components/Accordions/Accordions.tsx +0 -74
  64. package/src/components/Alert/Alert.tsx +0 -31
  65. package/src/components/Badge/DotBadge.tsx +0 -16
  66. package/src/components/Badge/NotificationBadge.tsx +0 -29
  67. package/src/components/Badge/PillBadge.tsx +0 -13
  68. package/src/components/Button/Button.tsx +0 -56
  69. package/src/components/Button/IconButton.tsx +0 -51
  70. package/src/components/Button/SplitButton.tsx +0 -91
  71. package/src/components/Dashboard/Dashboard.tsx +0 -9
  72. package/src/components/Dashboard/DashboardWidget.tsx +0 -44
  73. package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +0 -36
  74. package/src/components/Dialog/Dialog.tsx +0 -178
  75. package/src/components/Dialog/components/DialogFooter.tsx +0 -100
  76. package/src/components/Header/Components/EnvBadge.tsx +0 -17
  77. package/src/components/Header/Components/ModuleSelect.tsx +0 -68
  78. package/src/components/Header/Components/Notifications.tsx +0 -204
  79. package/src/components/Header/Components/UserMenu.tsx +0 -52
  80. package/src/components/Header/Header.tsx +0 -45
  81. package/src/components/Helper/Collapse.tsx +0 -53
  82. package/src/components/Inputs/Checkbox.tsx +0 -53
  83. package/src/components/Inputs/CurrencyInput.tsx +0 -124
  84. package/src/components/Inputs/DateInput/DateInput.tsx +0 -184
  85. package/src/components/Inputs/DateInput/components/DatePartInput.tsx +0 -159
  86. package/src/components/Inputs/InputWrapper.tsx +0 -95
  87. package/src/components/Inputs/NumberInput.tsx +0 -86
  88. package/src/components/Inputs/PasswordInput.tsx +0 -39
  89. package/src/components/Inputs/PhoneInput/PhoneInput.tsx +0 -108
  90. package/src/components/Inputs/PhoneInput/utils/countryCode.ts +0 -20
  91. package/src/components/Inputs/Radio.tsx +0 -59
  92. package/src/components/Inputs/RadioGroup.tsx +0 -48
  93. package/src/components/Inputs/RadioLarge.tsx +0 -39
  94. package/src/components/Inputs/SearchInput.tsx +0 -46
  95. package/src/components/Inputs/Selects/Select.tsx +0 -17
  96. package/src/components/Inputs/Selects/components/CustomSelectComponents.tsx +0 -19
  97. package/src/components/Inputs/Selects/components/SelectWrapper.tsx +0 -118
  98. package/src/components/Inputs/Selects/utils/selectStyles.ts +0 -101
  99. package/src/components/Inputs/TextAreaInput.tsx +0 -68
  100. package/src/components/Inputs/TextInput.tsx +0 -100
  101. package/src/components/Inputs/TimeInput/TimeInput.tsx +0 -81
  102. package/src/components/List/List.tsx +0 -21
  103. package/src/components/List/ListItem.tsx +0 -70
  104. package/src/components/Loader/Loader.tsx +0 -66
  105. package/src/components/Loader/ProgressBar.tsx +0 -41
  106. package/src/components/Menu/Menu.tsx +0 -81
  107. package/src/components/Menu/MenuItem.tsx +0 -46
  108. package/src/components/Menu/NewMenu.tsx +0 -63
  109. package/src/components/Menu/hooks/useMenuPosition.tsx +0 -116
  110. package/src/components/PageComponents/ScrollableContent.tsx +0 -11
  111. package/src/components/Pullover/Pullover.tsx +0 -197
  112. package/src/components/Router/Router.tsx +0 -52
  113. package/src/components/Sidebar/AddButton.tsx +0 -22
  114. package/src/components/Sidebar/Sidebar.tsx +0 -85
  115. package/src/components/Sidebar/SidebarItem.tsx +0 -84
  116. package/src/components/Sidebar/types/ISidebar.ts +0 -28
  117. package/src/components/Table/Table.tsx +0 -258
  118. package/src/components/Table/components/columns/ColumnsList.tsx +0 -60
  119. package/src/components/Table/components/columns/TableColumnsEdit.tsx +0 -114
  120. package/src/components/Table/components/edit/TableEditRow.tsx +0 -78
  121. package/src/components/Table/components/filters/FilterItem.tsx +0 -15
  122. package/src/components/Table/components/filters/TableFilters.tsx +0 -126
  123. package/src/components/Table/components/footer/TableFooter.tsx +0 -126
  124. package/src/components/Table/components/header/TableHeader.tsx +0 -40
  125. package/src/components/Table/components/header/TableHeaderRow.tsx +0 -57
  126. package/src/components/Table/components/items/TableItemActions.tsx +0 -78
  127. package/src/components/Table/components/print/TablePrint.tsx +0 -200
  128. package/src/components/Table/components/select/TableSelect.tsx +0 -50
  129. package/src/components/Table/components/sort/TableSort.tsx +0 -75
  130. package/src/components/Table/components/templates/CreateTemplateDialog.tsx +0 -58
  131. package/src/components/Table/components/templates/TableTemplates.tsx +0 -65
  132. package/src/components/Table/components/templates/TemplatesPullover.tsx +0 -88
  133. package/src/components/Table/contexts/TableContext.tsx +0 -117
  134. package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +0 -70
  135. package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +0 -82
  136. package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +0 -175
  137. package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +0 -12
  138. package/src/components/Table/hooks/useTableColumns.ts +0 -34
  139. package/src/components/Table/hooks/useTableEdit.tsx +0 -140
  140. package/src/components/Table/hooks/useTableFilterFields.tsx +0 -150
  141. package/src/components/Table/hooks/useTablePagination.ts +0 -19
  142. package/src/components/Table/hooks/useTablePrint.ts +0 -83
  143. package/src/components/Table/hooks/useTableSearch.ts +0 -31
  144. package/src/components/Table/hooks/useTableSelect.ts +0 -19
  145. package/src/components/Table/hooks/useTableSort.ts +0 -8
  146. package/src/components/Tabs/Tabs.tsx +0 -68
  147. package/src/components/Tooltip/Tooltip.tsx +0 -191
  148. package/src/components/Tree/Tree.tsx +0 -22
  149. package/src/components/Tree/TreeItem.tsx +0 -57
  150. package/src/components/Wrappers/AppLayout.tsx +0 -17
  151. package/src/components/Wrappers/ConditionalWrapper.tsx +0 -10
  152. package/src/components/Wrappers/FormWrapper.tsx +0 -84
  153. package/src/components/Wrappers/PageLayout.tsx +0 -168
  154. package/src/hooks/useBackgroundClose.ts +0 -19
  155. package/src/hooks/useGetFocusableElements.ts +0 -43
  156. package/src/hooks/useIsMenuOpen.ts +0 -11
  157. package/src/hooks/useLocalPopoverControl.ts +0 -63
  158. package/src/hooks/useOnEsc.ts +0 -14
  159. package/src/hooks/usePopupControl.ts +0 -22
  160. package/src/hooks/useZendesk.ts +0 -22
  161. package/src/index.ts +0 -387
  162. package/src/pages/NoAccessPage.tsx +0 -27
  163. package/src/pages/NotFoundPage.tsx +0 -26
  164. package/src/styles/App.scss +0 -47
  165. package/src/styles/common/_animations.scss +0 -58
  166. package/src/styles/common/_typography.scss +0 -91
  167. package/src/styles/common/helpers/_base.scss +0 -55
  168. package/src/styles/common/helpers/_color.scss +0 -10
  169. package/src/styles/common/helpers/_display.scss +0 -85
  170. package/src/styles/common/helpers/_size.scss +0 -25
  171. package/src/styles/common/maps/_align.scss +0 -21
  172. package/src/styles/common/maps/_buttonMaps.scss +0 -42
  173. package/src/styles/common/maps/_info-types.scss +0 -1
  174. package/src/styles/common/maps/_spacing.scss +0 -78
  175. package/src/styles/common/maps/_text.scss +0 -14
  176. package/src/styles/components/_accordions.scss +0 -51
  177. package/src/styles/components/_alert.scss +0 -23
  178. package/src/styles/components/_badge.scss +0 -84
  179. package/src/styles/components/_button.scss +0 -99
  180. package/src/styles/components/_buttonSplit.scss +0 -74
  181. package/src/styles/components/_card.scss +0 -24
  182. package/src/styles/components/_dialog.scss +0 -119
  183. package/src/styles/components/_form.scss +0 -8
  184. package/src/styles/components/_header.scss +0 -157
  185. package/src/styles/components/_input.scss +0 -167
  186. package/src/styles/components/_inputCheckbox.scss +0 -48
  187. package/src/styles/components/_inputDateTime.scss +0 -161
  188. package/src/styles/components/_inputRadio.scss +0 -83
  189. package/src/styles/components/_inputSelect.scss +0 -8
  190. package/src/styles/components/_list.scss +0 -58
  191. package/src/styles/components/_loader.scss +0 -55
  192. package/src/styles/components/_menu-v2.scss +0 -67
  193. package/src/styles/components/_menu.scss +0 -62
  194. package/src/styles/components/_notifications.scss +0 -71
  195. package/src/styles/components/_page.scss +0 -84
  196. package/src/styles/components/_portal.scss +0 -8
  197. package/src/styles/components/_print.scss +0 -77
  198. package/src/styles/components/_progressBar.scss +0 -83
  199. package/src/styles/components/_pullover.scss +0 -95
  200. package/src/styles/components/_scrollbar.scss +0 -18
  201. package/src/styles/components/_sidebar.scss +0 -204
  202. package/src/styles/components/_smallComponents.scss +0 -23
  203. package/src/styles/components/_table.scss +0 -340
  204. package/src/styles/components/_tabs.scss +0 -33
  205. package/src/styles/components/_tooltip.scss +0 -48
  206. package/src/styles/components/_tree.scss +0 -21
  207. package/src/styles/components/_widget.scss +0 -90
  208. package/src/styles/pages/_fullScreenPage.scss +0 -64
  209. package/src/styles/variables/_bp.scss +0 -6
  210. package/src/styles/variables/_variables.scss +0 -142
  211. package/src/types/Base/custom.d.ts +0 -9
  212. package/src/types/IBasic.ts +0 -32
  213. package/src/types/ICountryCode.ts +0 -5
  214. package/src/types/IError.ts +0 -5
  215. package/src/types/IHeader.ts +0 -40
  216. package/src/types/IInfo.ts +0 -1
  217. package/src/types/IKeyboard.ts +0 -33
  218. package/src/types/IMenu.ts +0 -19
  219. package/src/types/INotifications.ts +0 -15
  220. package/src/types/IPopup.ts +0 -17
  221. package/src/types/IRouter.ts +0 -6
  222. package/src/types/ISelect.ts +0 -54
  223. package/src/types/ITab.ts +0 -10
  224. package/src/types/ITable.ts +0 -291
  225. package/src/types/ITree.ts +0 -6
  226. package/src/utils/InputPatternValidation.ts +0 -12
  227. package/src/utils/dateUtils.ts +0 -32
  228. package/src/utils/fileUtils.ts +0 -177
  229. package/src/utils/i18n/i18nIUICyrilic.ts +0 -119
  230. package/src/utils/i18n/i18nIUILatin.ts +0 -120
  231. package/src/utils/i18n/i18nIUIMe.ts +0 -118
  232. package/src/utils/icons.ts +0 -13
  233. package/src/utils/localStorageHelper.ts +0 -24
  234. package/src/utils/logoUtils.ts +0 -7
  235. package/src/utils/numberUtils.ts +0 -21
  236. package/src/utils/objectUtils.ts +0 -114
  237. package/src/utils/popupUtils.ts +0 -82
  238. package/src/utils/rootDir.ts +0 -1
  239. package/src/utils/stringUtils.ts +0 -18
  240. package/src/utils/tableUtils.ts +0 -130
  241. package/src/utils/toasts.ts +0 -6
  242. package/src/utils/urlUtils.ts +0 -4
  243. package/tsconfig.icons.json +0 -5
  244. package/tsconfig.json +0 -22
@@ -1,126 +0,0 @@
1
- import type { FC, MouseEventHandler } from 'react';
2
- import type { ISelectData } from '../../../../types/ISelect';
3
- import type { IPaginationControl } from '../../../../types/ITable';
4
- import { useEffect, useState } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
- import { faAngleLeft } from '../../../../assets/icons/solid/faAngleLeft';
7
- import { faAngleRight } from '../../../../assets/icons/solid/faAngleRight';
8
- import { faRotateRight } from '../../../../assets/icons/solid/faRotateRight';
9
- import { tableStandardLimit } from '../../../../types/ITable';
10
- import { formatCurrencyNoDecimals } from '../../../../utils/numberUtils';
11
- import { IconButton } from '../../../Button/IconButton';
12
- import { Select } from '../../../Inputs/Selects/Select';
13
- import { TextInput } from '../../../Inputs/TextInput';
14
-
15
- interface Props {
16
- pagination: IPaginationControl;
17
- noTotalRows?: boolean;
18
- dataLength: number;
19
- refetch?: MouseEventHandler<HTMLButtonElement>;
20
- totalRows?: number;
21
- customLimit?: number[];
22
- }
23
-
24
- export const TableFooter: FC<Props> = ({
25
- pagination: { limit, offset, setLimit, setOffset },
26
- totalRows = 0,
27
- noTotalRows,
28
- dataLength,
29
- refetch,
30
- customLimit,
31
- }) => {
32
- const [tempOffset, setTempOffset] = useState(offset + 1);
33
-
34
- const { t } = useTranslation();
35
-
36
- useEffect(() => {
37
- setTempOffset(offset + 1);
38
- }, [offset]);
39
-
40
- const handleChangeLimit = (value: ISelectData) => {
41
- const newLimit = Math.floor(+value.value);
42
- setLimit(newLimit);
43
- setOffset(0);
44
- };
45
-
46
- const maxOffset = Math.ceil(totalRows / limit);
47
-
48
- return (
49
- <div className={`table-footer ${refetch ? 'justify-between' : 'justify-right'}`}>
50
- {!!refetch && (
51
- <IconButton
52
- icon={faRotateRight}
53
- onClick={refetch}
54
- tooltip={t('RefreshData')}
55
- variant="outlined"
56
- size="s"
57
- />
58
- )}
59
- <div className="pagination">
60
- <div className="flex align-center gap-2">
61
- <p>{t('rowsPerPage')}</p>
62
- <Select
63
- value={{ label: `${limit}`, value: limit }}
64
- size="s"
65
- minWidth={20}
66
- onChange={handleChangeLimit}
67
- options={(customLimit || tableStandardLimit).map(e => ({
68
- label: `${e}`,
69
- value: e ?? t('allResults'),
70
- }))}
71
- isClearable={false}
72
- />
73
- {!noTotalRows && (
74
- <p>
75
- {limit
76
- ? `${offset * limit + 1}-${
77
- offset * limit + limit <= totalRows
78
- ? offset * limit + limit
79
- : totalRows
80
- } ${t('of')} ${formatCurrencyNoDecimals(totalRows)}`
81
- : `${t('allResults')} ${t('of')} ${formatCurrencyNoDecimals(totalRows)} `}
82
- </p>
83
- )}
84
- </div>
85
- {!noTotalRows && <p>|</p>}
86
- <div className="flex gap-1 align-center">
87
- <p>{t('page')}:</p>
88
- <IconButton
89
- disabled={offset < 1}
90
- icon={faAngleLeft}
91
- onClick={() => setOffset(offset - 1)}
92
- className="p-1"
93
- size="s"
94
- />
95
- <TextInput
96
- className="offset-input"
97
- value={`${tempOffset}`}
98
- setValue={e => !isNaN(+e) && setTempOffset(+e)}
99
- isClearable={false}
100
- inputProps={{
101
- onFocus: e => e.target.select(),
102
- onBlur: () => setTempOffset(offset + 1),
103
- onKeyUp: e => {
104
- if (e.key === 'Enter') {
105
- const value = tempOffset;
106
- if (typeof value === 'number' && value >= 0 && value <= maxOffset) {
107
- setOffset(value - 1);
108
- } else {
109
- setTempOffset(offset + 1);
110
- }
111
- }
112
- },
113
- }}
114
- />
115
- <IconButton
116
- disabled={noTotalRows ? limit > dataLength : offset + 1 >= maxOffset}
117
- icon={faAngleRight}
118
- onClick={() => setOffset(offset + 1)}
119
- size="s"
120
- />
121
- {!noTotalRows && <p>{`${t('of')} ${formatCurrencyNoDecimals(maxOffset)}`}</p>}
122
- </div>
123
- </div>
124
- </div>
125
- );
126
- };
@@ -1,40 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITableColumn } from '../../../../types/ITable';
3
- import clsx from 'clsx';
4
- import { TableHeaderRow } from './TableHeaderRow';
5
-
6
- type Props = {
7
- columns: ITableColumn[];
8
- customHeader?: ITableColumn[][];
9
- headerWrap?: boolean;
10
- maxHeight?: number | string;
11
- print?: boolean;
12
- };
13
-
14
- export const HeaderTable: FC<Props> = ({
15
- columns,
16
- customHeader,
17
- headerWrap,
18
- maxHeight,
19
- print,
20
- }) => {
21
- const isSticky = !print && !!maxHeight;
22
-
23
- return (
24
- <thead
25
- className={clsx({
26
- 'no-wrap': !headerWrap,
27
- 'sticky-header': isSticky,
28
- })}
29
- >
30
- {customHeader ? (
31
- customHeader.map((row, i) => (
32
- // No array manipulation will be performed, so using key 'i' is fine.
33
- <TableHeaderRow key={i} row={row} print={print} />
34
- ))
35
- ) : (
36
- <TableHeaderRow row={columns} print={print} />
37
- )}
38
- </thead>
39
- );
40
- };
@@ -1,57 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITableColumn } from '../../../../types/ITable';
3
- import clsx from 'clsx';
4
-
5
- interface Props {
6
- row: ITableColumn[];
7
- print?: boolean;
8
- }
9
-
10
- export const TableHeaderRow: FC<Props> = ({ row, print }) => {
11
- // const { sortData } = useTableContext();
12
- // const { sort, setSort, sortOptions } = sortData ?? {};
13
- // const activeSortOption = sortOptions?.find(e => sort?.startsWith(e.value));
14
-
15
- return (
16
- <tr>
17
- {row.map(col => (
18
- <th
19
- key={col.id}
20
- colSpan={col.colSpan}
21
- rowSpan={col.rowSpan}
22
- className={
23
- print
24
- ? undefined
25
- : clsx(col.color, col.className, {
26
- 'sticky-column': col.sticky,
27
- 'not-first-cell': col.notFirstCell,
28
- })
29
- }
30
- // onClick={() => {
31
- // const sortValue = sortOptions?.find(e => col.label === e.label)?.value;
32
- // sortValue &&
33
- // setSort?.(sort === sortValue + desc ? sortValue + asc : sortValue + desc);
34
- // }}
35
- style={
36
- print
37
- ? undefined
38
- : col.minWidth
39
- ? { minWidth: col.minWidth }
40
- : col.width
41
- ? { width: col.width }
42
- : undefined
43
- }
44
- // hidden={col.hidden}
45
- >
46
- <div className="flex align-center">
47
- {typeof col.label === 'string' ? (
48
- <p className={`full-width text-${col.align || 'left'}`}>{col.label}</p>
49
- ) : (
50
- <div className={`full-width text-${col.align || 'left'}`}>{col.label}</div>
51
- )}
52
- </div>
53
- </th>
54
- ))}
55
- </tr>
56
- );
57
- };
@@ -1,78 +0,0 @@
1
- import type { ITableDataItem } from '../../../../types/ITable';
2
- import { type FC } from 'react';
3
- import { faEllipsisVertical, faPen, faTrashCan } from '@inceptionbg/icons';
4
- import { useIsMenuOpen } from '../../../../hooks/useIsMenuOpen';
5
- import { IconButton } from '../../../Button/IconButton';
6
- import { Menu } from '../../../Menu/Menu';
7
- import { useTableContext } from '../../contexts/TableContext';
8
-
9
- export const TableItemActions: FC<{ tableDataItem: ITableDataItem<any> }> = ({
10
- tableDataItem,
11
- }) => {
12
- const { isOpen, onClose, onOpen } = useIsMenuOpen();
13
-
14
- const { dataActions, itemDeleteData, editable } = useTableContext();
15
-
16
- if (!dataActions?.hasItemActions) {
17
- return null;
18
- }
19
-
20
- const filteredActions =
21
- dataActions.actions?.(tableDataItem.item).filter(e => e.hasAccess) ?? [];
22
-
23
- return (
24
- <div className="table-item-actions">
25
- {dataActions.isEditable && (
26
- <IconButton
27
- icon={faPen}
28
- onClick={e => {
29
- e.stopPropagation();
30
- editable?.setSelectedItem(tableDataItem);
31
- }}
32
- size="s"
33
- />
34
- )}
35
- {dataActions.isDeletable && (
36
- <IconButton
37
- icon={faTrashCan}
38
- onClick={e => {
39
- e.stopPropagation();
40
- itemDeleteData?.setItemToDeleteUuids([tableDataItem.uuid]);
41
- }}
42
- size="s"
43
- color="danger"
44
- />
45
- )}
46
- {!!filteredActions?.length && (
47
- <Menu
48
- isOpen={isOpen}
49
- onClose={onClose}
50
- placement="bottom-right"
51
- renderButton={ref => (
52
- <IconButton
53
- ref={ref}
54
- icon={faEllipsisVertical}
55
- active={isOpen}
56
- onClick={e => {
57
- e.stopPropagation();
58
- onOpen();
59
- }}
60
- size="s"
61
- />
62
- )}
63
- items={
64
- filteredActions?.map(action => ({
65
- label: action.label,
66
- hidden: !action.hasAccess,
67
- disabled: action.disabled,
68
- onClick: () => {
69
- action.onClick();
70
- onClose();
71
- },
72
- })) ?? []
73
- }
74
- />
75
- )}
76
- </div>
77
- );
78
- };
@@ -1,200 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { IPrintData } from '../../../../types/ITable';
3
- import { useEffect, useMemo } from 'react';
4
- import { faPrint } from '@inceptionbg/icons';
5
- import clsx from 'clsx';
6
- import { useTranslation } from 'react-i18next';
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,50 +0,0 @@
1
- import type { FC } from 'react';
2
- import { useState } from 'react';
3
- import { faClipboardCheck } from '@inceptionbg/icons';
4
- import { useTranslation } from 'react-i18next';
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
- };
@@ -1,75 +0,0 @@
1
- import type { FC } from 'react';
2
- import { useEffect, useState } from 'react';
3
- import {
4
- faArrowDownShortWide,
5
- faArrowDownWideShort,
6
- faArrowUpArrowDown,
7
- } from '@inceptionbg/icons';
8
- import { useTranslation } from 'react-i18next';
9
- import { IconButton } from '../../../Button/IconButton';
10
- import { Menu } from '../../../Menu/Menu';
11
- import { Tooltip } from '../../../Tooltip/Tooltip';
12
- import { useTableContext } from '../../contexts/TableContext';
13
-
14
- export const TableSort: FC = () => {
15
- const [isOpen, setIsOpen] = useState(false);
16
-
17
- const { t } = useTranslation();
18
- const { sortData } = useTableContext();
19
- const { sort, setSort, sortOptions } = sortData ?? {};
20
-
21
- useEffect(() => {
22
- if (isOpen) {
23
- const handleKeyDown = (event: KeyboardEvent) => {
24
- event.stopPropagation();
25
- if (event.key === 'Escape') {
26
- event.preventDefault();
27
- event.stopPropagation();
28
- setIsOpen(false);
29
- }
30
- };
31
-
32
- document.addEventListener('keydown', handleKeyDown);
33
- return () => {
34
- document.removeEventListener('keydown', handleKeyDown);
35
- };
36
- }
37
- }, [isOpen]);
38
-
39
- return sortData ? (
40
- <Menu
41
- isOpen={isOpen}
42
- onClose={() => setIsOpen(false)}
43
- renderButton={ref => (
44
- <Tooltip label={t('Sort')} ref={ref}>
45
- <IconButton
46
- icon={faArrowUpArrowDown}
47
- active={isOpen}
48
- onClick={() => setIsOpen(!isOpen)}
49
- size="s"
50
- variant="outlined"
51
- />
52
- </Tooltip>
53
- )}
54
- size={sortData.menuSize}
55
- items={sortOptions?.map(e => {
56
- const valueAsc = e.value + '_ASC';
57
- const valueDesc = e.value + '_DESC';
58
-
59
- return {
60
- label: e.label,
61
- onClick: () => setSort?.(sort === valueDesc ? valueAsc : valueDesc),
62
- active: sort?.startsWith(e.value),
63
- className: 'table-sort-item',
64
- keepOpen: true,
65
- icon:
66
- sort === valueDesc
67
- ? faArrowDownWideShort
68
- : sort === valueAsc
69
- ? faArrowDownShortWide
70
- : undefined,
71
- };
72
- })}
73
- />
74
- ) : null;
75
- };
@@ -1,58 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ILocalPopupControl } from '../../../../types/IPopup';
3
- import type { IReportTemplate, ITableTemplateData } from '../../../../types/ITable';
4
- import { useEffect, useRef, useState } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
- import { Dialog } from '../../../Dialog/Dialog';
7
- import { Checkbox } from '../../../Inputs/Checkbox';
8
- import { TextInput } from '../../../Inputs/TextInput';
9
-
10
- interface Props {
11
- control: ILocalPopupControl;
12
- createItem: ITableTemplateData['createItem'];
13
- title?: string;
14
- }
15
-
16
- export const CreateTemplateDialog: FC<Props> = ({ control, createItem, title }) => {
17
- const { t } = useTranslation();
18
-
19
- const [formData, setFormData] = useState<Partial<IReportTemplate>>({});
20
- const nameInputRef = useRef<HTMLInputElement>(null);
21
-
22
- useEffect(() => {
23
- if (control.isOpen) {
24
- nameInputRef.current?.focus();
25
- }
26
- }, [control.isOpen]);
27
-
28
- return (
29
- <Dialog
30
- title={title ?? t('CreateTemplateLong')}
31
- control={control}
32
- onFormSubmit={() => createItem.onCreate(formData)}
33
- footer={{
34
- confirmButton: {
35
- label: t('CreateTemplate'),
36
- type: 'submit',
37
- },
38
- }}
39
- classNameContent="pt-2"
40
- onCloseCallback={() => setFormData({})}
41
- >
42
- <TextInput
43
- ref={nameInputRef}
44
- label={t('TemplateName')}
45
- required
46
- value={formData.name}
47
- setValue={name => setFormData({ ...formData, name })}
48
- />
49
- {createItem.allowPublicCreate && (
50
- <Checkbox
51
- label={t('PublicTemplate')}
52
- value={formData.isPublic}
53
- setValue={isPublic => setFormData({ ...formData, isPublic })}
54
- />
55
- )}
56
- </Dialog>
57
- );
58
- };