@inceptionbg/iui 2.0.35 → 2.0.36

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 (241) hide show
  1. package/package.json +4 -1
  2. package/idea/GridTable/GridTable.tsx +0 -119
  3. package/idea/GridTable/gridTable.scss +0 -42
  4. package/idea/Menu/Menu.tsx +0 -121
  5. package/idea/Menu/MenuItem.tsx +0 -75
  6. package/idea/Menu/hooks/useMenuControl.ts +0 -13
  7. package/idea/Menu.tsx +0 -133
  8. package/idea/NoAccessInfo.tsx +0 -193
  9. package/idea/Table/Components/Edit/ItemActionsMenu.tsx +0 -85
  10. package/idea/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -31
  11. package/idea/Table/Components/Edit/TableEditRow.tsx +0 -57
  12. package/idea/Table/Components/FilterItem.tsx +0 -20
  13. package/idea/Table/Components/Header/TableHeader.tsx +0 -46
  14. package/idea/Table/Components/Header/TableHeaderRow.tsx +0 -37
  15. package/idea/Table/Components/Print/CustomTablePrint.tsx +0 -115
  16. package/idea/Table/Components/SetSortList.tsx +0 -30
  17. package/idea/Table/Components/SetTableFilter.tsx +0 -91
  18. package/idea/Table/Components/TableFooter.tsx +0 -137
  19. package/idea/Table/Components/TableOptions.tsx +0 -227
  20. package/idea/Table/Components/Templates/TemplateCreate.tsx +0 -80
  21. package/idea/Table/Components/Templates/TemplateCreateDefault.tsx +0 -45
  22. package/idea/Table/Components/Templates/TemplateList.tsx +0 -167
  23. package/idea/Table/Components/Templates/repo/TemplateRepo.ts +0 -53
  24. package/idea/Table/Table.tsx +0 -528
  25. package/idea/Table/hooks/useDefaultTemplate.ts +0 -20
  26. package/idea/Table/hooks/useTableKeyboard.ts +0 -137
  27. package/idea/Table/hooks/useTableSelect.ts +0 -11
  28. package/rollup.config.js +0 -52
  29. package/src/assets/icons/duotone/faBell.ts +0 -17
  30. package/src/assets/icons/duotone/faCircleUser.ts +0 -17
  31. package/src/assets/icons/regular/faArrowLeft.ts +0 -15
  32. package/src/assets/icons/regular/faArrowRightArrowLeft.ts +0 -15
  33. package/src/assets/icons/regular/faCircleCheck.ts +0 -15
  34. package/src/assets/icons/regular/faCircleExclamation.ts +0 -15
  35. package/src/assets/icons/regular/faCircleInfo.ts +0 -15
  36. package/src/assets/icons/regular/faFileArrowDown.ts +0 -15
  37. package/src/assets/icons/regular/faFilterCircleXmark.ts +0 -15
  38. package/src/assets/icons/regular/faTriangleExclamation.ts +0 -15
  39. package/src/assets/icons/solid/faAngleLeft.ts +0 -15
  40. package/src/assets/icons/solid/faAngleRight.ts +0 -15
  41. package/src/assets/icons/solid/faArrowDownWideShort.ts +0 -15
  42. package/src/assets/icons/solid/faCaretDown.ts +0 -15
  43. package/src/assets/icons/solid/faCheck.ts +0 -15
  44. package/src/assets/icons/solid/faEllipsisVertical.ts +0 -15
  45. package/src/assets/icons/solid/faEnvelopeDot.ts +0 -15
  46. package/src/assets/icons/solid/faFilter.ts +0 -15
  47. package/src/assets/icons/solid/faFloppyDisk.ts +0 -15
  48. package/src/assets/icons/solid/faGripDotsVertical.ts +0 -15
  49. package/src/assets/icons/solid/faListUl.ts +0 -15
  50. package/src/assets/icons/solid/faMinus.ts +0 -15
  51. package/src/assets/icons/solid/faPlus.ts +0 -15
  52. package/src/assets/icons/solid/faPrint.ts +0 -15
  53. package/src/assets/icons/solid/faRotateRight.ts +0 -15
  54. package/src/assets/icons/solid/faXmark.ts +0 -15
  55. package/src/assets/images/logo/inception.svg +0 -22
  56. package/src/assets/images/logo/mts.svg +0 -5703
  57. package/src/assets/images/logo/paperless.svg +0 -21
  58. package/src/assets/images/logo/pismonosa.png +0 -0
  59. package/src/assets/images/not-found.svg +0 -19
  60. package/src/components/Accordions/Accordions.tsx +0 -74
  61. package/src/components/Alert/Alert.tsx +0 -31
  62. package/src/components/Badge/DotBadge.tsx +0 -16
  63. package/src/components/Badge/NotificationBadge.tsx +0 -29
  64. package/src/components/Badge/PillBadge.tsx +0 -13
  65. package/src/components/Button/Button.tsx +0 -56
  66. package/src/components/Button/IconButton.tsx +0 -51
  67. package/src/components/Button/SplitButton.tsx +0 -91
  68. package/src/components/Dashboard/Dashboard.tsx +0 -9
  69. package/src/components/Dashboard/DashboardWidget.tsx +0 -44
  70. package/src/components/Dashboard/FastLinksWidget/FastLinksWidget.tsx +0 -36
  71. package/src/components/Dialog/Dialog.tsx +0 -178
  72. package/src/components/Dialog/components/DialogFooter.tsx +0 -100
  73. package/src/components/Header/Components/EnvBadge.tsx +0 -17
  74. package/src/components/Header/Components/ModuleSelect.tsx +0 -68
  75. package/src/components/Header/Components/Notifications.tsx +0 -204
  76. package/src/components/Header/Components/UserMenu.tsx +0 -52
  77. package/src/components/Header/Header.tsx +0 -45
  78. package/src/components/Helper/Collapse.tsx +0 -53
  79. package/src/components/Inputs/Checkbox.tsx +0 -53
  80. package/src/components/Inputs/CurrencyInput.tsx +0 -124
  81. package/src/components/Inputs/DateInput/DateInput.tsx +0 -184
  82. package/src/components/Inputs/DateInput/components/DatePartInput.tsx +0 -159
  83. package/src/components/Inputs/InputWrapper.tsx +0 -95
  84. package/src/components/Inputs/NumberInput.tsx +0 -86
  85. package/src/components/Inputs/PasswordInput.tsx +0 -39
  86. package/src/components/Inputs/PhoneInput/PhoneInput.tsx +0 -108
  87. package/src/components/Inputs/PhoneInput/utils/countryCode.ts +0 -20
  88. package/src/components/Inputs/Radio.tsx +0 -59
  89. package/src/components/Inputs/RadioGroup.tsx +0 -48
  90. package/src/components/Inputs/RadioLarge.tsx +0 -39
  91. package/src/components/Inputs/SearchInput.tsx +0 -46
  92. package/src/components/Inputs/Selects/Select.tsx +0 -17
  93. package/src/components/Inputs/Selects/components/CustomSelectComponents.tsx +0 -19
  94. package/src/components/Inputs/Selects/components/SelectWrapper.tsx +0 -118
  95. package/src/components/Inputs/Selects/utils/selectStyles.ts +0 -101
  96. package/src/components/Inputs/TextAreaInput.tsx +0 -68
  97. package/src/components/Inputs/TextInput.tsx +0 -100
  98. package/src/components/Inputs/TimeInput/TimeInput.tsx +0 -81
  99. package/src/components/List/List.tsx +0 -21
  100. package/src/components/List/ListItem.tsx +0 -70
  101. package/src/components/Loader/Loader.tsx +0 -66
  102. package/src/components/Loader/ProgressBar.tsx +0 -41
  103. package/src/components/Menu/Menu.tsx +0 -81
  104. package/src/components/Menu/MenuItem.tsx +0 -46
  105. package/src/components/Menu/NewMenu.tsx +0 -63
  106. package/src/components/Menu/hooks/useMenuPosition.tsx +0 -116
  107. package/src/components/PageComponents/ScrollableContent.tsx +0 -11
  108. package/src/components/Pullover/Pullover.tsx +0 -197
  109. package/src/components/Router/Router.tsx +0 -52
  110. package/src/components/Sidebar/AddButton.tsx +0 -22
  111. package/src/components/Sidebar/Sidebar.tsx +0 -85
  112. package/src/components/Sidebar/SidebarItem.tsx +0 -84
  113. package/src/components/Sidebar/types/ISidebar.ts +0 -28
  114. package/src/components/Table/Table.tsx +0 -258
  115. package/src/components/Table/components/columns/ColumnsList.tsx +0 -60
  116. package/src/components/Table/components/columns/TableColumnsEdit.tsx +0 -114
  117. package/src/components/Table/components/edit/TableEditRow.tsx +0 -78
  118. package/src/components/Table/components/filters/FilterItem.tsx +0 -15
  119. package/src/components/Table/components/filters/TableFilters.tsx +0 -126
  120. package/src/components/Table/components/footer/TableFooter.tsx +0 -126
  121. package/src/components/Table/components/header/TableHeader.tsx +0 -40
  122. package/src/components/Table/components/header/TableHeaderRow.tsx +0 -57
  123. package/src/components/Table/components/items/TableItemActions.tsx +0 -78
  124. package/src/components/Table/components/print/TablePrint.tsx +0 -200
  125. package/src/components/Table/components/select/TableSelect.tsx +0 -50
  126. package/src/components/Table/components/sort/TableSort.tsx +0 -75
  127. package/src/components/Table/components/templates/CreateTemplateDialog.tsx +0 -58
  128. package/src/components/Table/components/templates/TableTemplates.tsx +0 -65
  129. package/src/components/Table/components/templates/TemplatesPullover.tsx +0 -88
  130. package/src/components/Table/contexts/TableContext.tsx +0 -117
  131. package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +0 -70
  132. package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +0 -82
  133. package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +0 -175
  134. package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +0 -12
  135. package/src/components/Table/hooks/useTableColumns.ts +0 -34
  136. package/src/components/Table/hooks/useTableEdit.tsx +0 -140
  137. package/src/components/Table/hooks/useTableFilterFields.tsx +0 -150
  138. package/src/components/Table/hooks/useTablePagination.ts +0 -19
  139. package/src/components/Table/hooks/useTablePrint.ts +0 -83
  140. package/src/components/Table/hooks/useTableSearch.ts +0 -31
  141. package/src/components/Table/hooks/useTableSelect.ts +0 -19
  142. package/src/components/Table/hooks/useTableSort.ts +0 -8
  143. package/src/components/Tabs/Tabs.tsx +0 -68
  144. package/src/components/Tooltip/Tooltip.tsx +0 -191
  145. package/src/components/Tree/Tree.tsx +0 -22
  146. package/src/components/Tree/TreeItem.tsx +0 -57
  147. package/src/components/Wrappers/AppLayout.tsx +0 -17
  148. package/src/components/Wrappers/ConditionalWrapper.tsx +0 -10
  149. package/src/components/Wrappers/FormWrapper.tsx +0 -84
  150. package/src/components/Wrappers/PageLayout.tsx +0 -168
  151. package/src/hooks/useBackgroundClose.ts +0 -19
  152. package/src/hooks/useGetFocusableElements.ts +0 -43
  153. package/src/hooks/useIsMenuOpen.ts +0 -11
  154. package/src/hooks/useLocalPopoverControl.ts +0 -63
  155. package/src/hooks/useOnEsc.ts +0 -14
  156. package/src/hooks/usePopupControl.ts +0 -22
  157. package/src/hooks/useZendesk.ts +0 -22
  158. package/src/index.ts +0 -387
  159. package/src/pages/NoAccessPage.tsx +0 -27
  160. package/src/pages/NotFoundPage.tsx +0 -26
  161. package/src/styles/App.scss +0 -47
  162. package/src/styles/common/_animations.scss +0 -58
  163. package/src/styles/common/_typography.scss +0 -91
  164. package/src/styles/common/helpers/_base.scss +0 -55
  165. package/src/styles/common/helpers/_color.scss +0 -10
  166. package/src/styles/common/helpers/_display.scss +0 -85
  167. package/src/styles/common/helpers/_size.scss +0 -25
  168. package/src/styles/common/maps/_align.scss +0 -21
  169. package/src/styles/common/maps/_buttonMaps.scss +0 -42
  170. package/src/styles/common/maps/_info-types.scss +0 -1
  171. package/src/styles/common/maps/_spacing.scss +0 -78
  172. package/src/styles/common/maps/_text.scss +0 -14
  173. package/src/styles/components/_accordions.scss +0 -51
  174. package/src/styles/components/_alert.scss +0 -23
  175. package/src/styles/components/_badge.scss +0 -84
  176. package/src/styles/components/_button.scss +0 -99
  177. package/src/styles/components/_buttonSplit.scss +0 -74
  178. package/src/styles/components/_card.scss +0 -24
  179. package/src/styles/components/_dialog.scss +0 -119
  180. package/src/styles/components/_form.scss +0 -8
  181. package/src/styles/components/_header.scss +0 -157
  182. package/src/styles/components/_input.scss +0 -167
  183. package/src/styles/components/_inputCheckbox.scss +0 -48
  184. package/src/styles/components/_inputDateTime.scss +0 -161
  185. package/src/styles/components/_inputRadio.scss +0 -83
  186. package/src/styles/components/_inputSelect.scss +0 -8
  187. package/src/styles/components/_list.scss +0 -58
  188. package/src/styles/components/_loader.scss +0 -55
  189. package/src/styles/components/_menu-v2.scss +0 -67
  190. package/src/styles/components/_menu.scss +0 -62
  191. package/src/styles/components/_notifications.scss +0 -71
  192. package/src/styles/components/_page.scss +0 -84
  193. package/src/styles/components/_portal.scss +0 -8
  194. package/src/styles/components/_print.scss +0 -77
  195. package/src/styles/components/_progressBar.scss +0 -83
  196. package/src/styles/components/_pullover.scss +0 -95
  197. package/src/styles/components/_scrollbar.scss +0 -18
  198. package/src/styles/components/_sidebar.scss +0 -204
  199. package/src/styles/components/_smallComponents.scss +0 -23
  200. package/src/styles/components/_table.scss +0 -340
  201. package/src/styles/components/_tabs.scss +0 -33
  202. package/src/styles/components/_tooltip.scss +0 -48
  203. package/src/styles/components/_tree.scss +0 -21
  204. package/src/styles/components/_widget.scss +0 -90
  205. package/src/styles/pages/_fullScreenPage.scss +0 -64
  206. package/src/styles/variables/_bp.scss +0 -6
  207. package/src/styles/variables/_variables.scss +0 -142
  208. package/src/types/Base/custom.d.ts +0 -9
  209. package/src/types/IBasic.ts +0 -32
  210. package/src/types/ICountryCode.ts +0 -5
  211. package/src/types/IError.ts +0 -5
  212. package/src/types/IHeader.ts +0 -40
  213. package/src/types/IInfo.ts +0 -1
  214. package/src/types/IKeyboard.ts +0 -33
  215. package/src/types/IMenu.ts +0 -19
  216. package/src/types/INotifications.ts +0 -15
  217. package/src/types/IPopup.ts +0 -17
  218. package/src/types/IRouter.ts +0 -6
  219. package/src/types/ISelect.ts +0 -54
  220. package/src/types/ITab.ts +0 -10
  221. package/src/types/ITable.ts +0 -291
  222. package/src/types/ITree.ts +0 -6
  223. package/src/utils/InputPatternValidation.ts +0 -12
  224. package/src/utils/dateUtils.ts +0 -32
  225. package/src/utils/fileUtils.ts +0 -177
  226. package/src/utils/i18n/i18nIUICyrilic.ts +0 -119
  227. package/src/utils/i18n/i18nIUILatin.ts +0 -120
  228. package/src/utils/i18n/i18nIUIMe.ts +0 -118
  229. package/src/utils/icons.ts +0 -13
  230. package/src/utils/localStorageHelper.ts +0 -24
  231. package/src/utils/logoUtils.ts +0 -7
  232. package/src/utils/numberUtils.ts +0 -21
  233. package/src/utils/objectUtils.ts +0 -114
  234. package/src/utils/popupUtils.ts +0 -82
  235. package/src/utils/rootDir.ts +0 -1
  236. package/src/utils/stringUtils.ts +0 -18
  237. package/src/utils/tableUtils.ts +0 -130
  238. package/src/utils/toasts.ts +0 -6
  239. package/src/utils/urlUtils.ts +0 -4
  240. package/tsconfig.icons.json +0 -5
  241. package/tsconfig.json +0 -22
@@ -1,258 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITable } from '../../types/ITable';
3
- import { Fragment, useState } from 'react';
4
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
- import clsx from 'clsx';
6
- import { useTranslation } from 'react-i18next';
7
- import { faPlus } from '../../assets/icons/solid/faPlus';
8
- import { Loader } from '../Loader/Loader';
9
- import { Tooltip } from '../Tooltip/Tooltip';
10
- import { ConditionalWrapper } from '../Wrappers/ConditionalWrapper';
11
- import { TableColumnsEdit } from './components/columns/TableColumnsEdit';
12
- import { TableEditRow } from './components/edit/TableEditRow';
13
- import { TableFilters } from './components/filters/TableFilters';
14
- import { TableFooter } from './components/footer/TableFooter';
15
- import { HeaderTable } from './components/header/TableHeader';
16
- import { TablePrint } from './components/print/TablePrint';
17
- import { TableSelect } from './components/select/TableSelect';
18
- import { TableSort } from './components/sort/TableSort';
19
- import { TableTemplates } from './components/templates/TableTemplates';
20
- import { TableProvider, useTableContext } from './contexts/TableContext';
21
- import { useLocalTableColumns } from './hooks/localHooks/useLocalTableColumns';
22
- import { useLocalTableKeyboard } from './hooks/localHooks/useLocalTableKeyboard';
23
-
24
- export const TableContent: FC = () => {
25
- const {
26
- columnData,
27
- customHeader,
28
- headerWrap,
29
- data,
30
- sumRows,
31
- isLoading,
32
- selectedRowUuid,
33
- // customPrintData,
34
- // additionsalOptions,
35
- footer,
36
- rowHeight = 'm',
37
- maxHeight,
38
- editable,
39
- ...props
40
- } = useTableContext();
41
-
42
- const [extendedRow, setExtendedRow] = useState('');
43
-
44
- const { t } = useTranslation();
45
- const { visibleColumns } = useLocalTableColumns();
46
- const { focusedRow } = useLocalTableKeyboard();
47
-
48
- const noTotalRows = footer?.totalRows === undefined;
49
-
50
- return (
51
- <Loader isLoading={!!isLoading}>
52
- <div
53
- id={props.id}
54
- // onKeyDown={handleKeyDown}
55
- className={clsx('iui-table', props.className, {
56
- 'pb-3': data.length === 0,
57
- })}
58
- // tabIndex={-1}
59
- >
60
- <div className="iui-table-header-actions">
61
- {props.selectActions.length > 0 && <TableSelect />}
62
- {props.filterData && <TableFilters />}
63
- {!!columnData.setColumns && <TableColumnsEdit />}
64
- {props.sortData && <TableSort />}
65
- {props.templateData && <TableTemplates />}
66
- {props.printData && <TablePrint />}
67
- </div>
68
- <div className="table-container" style={{ maxHeight }}>
69
- <ConditionalWrapper
70
- condition={!!editable}
71
- wrapper={children => (
72
- <form
73
- onSubmit={e => {
74
- e.preventDefault();
75
- e.stopPropagation();
76
- editable?.onSubmit(editable.editData, () => {
77
- editable.setEditData(editable.defaultDataValue ?? {});
78
- if (!editable.keepEditOnSubmit && editable.selectedItem) {
79
- editable.setSelectedItem(null);
80
- }
81
- });
82
- }}
83
- >
84
- {children}
85
- </form>
86
- )}
87
- >
88
- <table className="full-width">
89
- <HeaderTable
90
- columns={visibleColumns}
91
- customHeader={customHeader}
92
- headerWrap={headerWrap}
93
- maxHeight={maxHeight}
94
- />
95
- <tbody>
96
- {data.length ? (
97
- <>
98
- {data.map(row => {
99
- const isExtended =
100
- row.extendable &&
101
- !row.extendable.isLoading &&
102
- extendedRow === row.uuid;
103
- return (
104
- <Fragment key={row.uuid}>
105
- {/* ////// EDITABLE ROW ////// */}
106
- {!!editable && row.uuid === editable.selectedItem?.uuid ? (
107
- <TableEditRow columns={visibleColumns} />
108
- ) : (
109
- ////// REGULAR ROW //////
110
- <tr
111
- data-id={row.uuid}
112
- className={clsx(row.className, {
113
- selected:
114
- !!selectedRowUuid && selectedRowUuid === row.uuid,
115
- clickable: !!row.onRowClick || !!row.extendable,
116
- focused: !!focusedRow && focusedRow.uuid === row.uuid,
117
- loading: row.extendable?.isLoading,
118
- })}
119
- onClick={e => {
120
- row.onRowClick?.(e);
121
- row.extendable &&
122
- setExtendedRow(
123
- extendedRow === row.uuid ? '' : row.uuid
124
- );
125
- }}
126
- >
127
- {visibleColumns.map(column => {
128
- const cell = row.cells[column.id];
129
- return (
130
- <Tooltip
131
- key={column.id}
132
- label={cell?.tooltip!}
133
- position="top"
134
- disabled={!cell?.tooltip}
135
- >
136
- <td
137
- data-th={
138
- column.id === 'select'
139
- ? t('Selected') + ':'
140
- : column.label
141
- ? column.label + ': '
142
- : '/'
143
- }
144
- align={cell?.align || column.align}
145
- onClick={
146
- cell?.onClick || cell?.unclickable
147
- ? e => {
148
- e.stopPropagation();
149
- cell?.onClick && cell?.onClick!(e);
150
- }
151
- : undefined
152
- }
153
- className={clsx(
154
- column.className,
155
- column.color,
156
- cell?.className,
157
- rowHeight,
158
- {
159
- 'sticky-column': column.sticky,
160
- link: cell?.link,
161
- 'clickable-cell': cell?.onClick,
162
- 'word-break': column.break,
163
- }
164
- )}
165
- colSpan={cell?.span}
166
- >
167
- {cell?.value}
168
- </td>
169
- </Tooltip>
170
- );
171
- })}
172
- </tr>
173
- )}
174
- {/* ////// EXTENDABLE ROW ////// */}
175
- {isExtended && (
176
- <tr>
177
- <td colSpan={visibleColumns.length} className={rowHeight}>
178
- {row.extendable!.element}
179
- </td>
180
- </tr>
181
- )}
182
- </Fragment>
183
- );
184
- })}
185
- </>
186
- ) : (
187
- <tr>
188
- <td colSpan={visibleColumns.length}>{t('NoResults')}</td>
189
- </tr>
190
- )}
191
- </tbody>
192
- <tfoot>
193
- {!!editable &&
194
- !editable.selectedItem &&
195
- !editable.addDisabled &&
196
- (!editable.isAdding ? (
197
- ////// NEW ITEM ROW //////
198
- <tr
199
- data-id="add"
200
- className={clsx('clickable', {
201
- focused: focusedRow?.uuid === 'add',
202
- })}
203
- onClick={() => editable.setIsAdding(true)}
204
- >
205
- <td
206
- className={`text-center ${rowHeight}`}
207
- colSpan={visibleColumns.length}
208
- >
209
- <div className="flex center gap-2">
210
- <FontAwesomeIcon icon={faPlus} className="c-primary icon24" />
211
- <p>{editable.addLabel || t('AddItem')}</p>
212
- </div>
213
- </td>
214
- </tr>
215
- ) : (
216
- <TableEditRow columns={visibleColumns} />
217
- ))}
218
- {!!sumRows &&
219
- !!data.length &&
220
- sumRows.map(row => (
221
- <tr key={row.uuid}>
222
- {visibleColumns.map(({ id: columnId }) => (
223
- <td
224
- key={columnId}
225
- align={row.cells[columnId]?.align || 'right'}
226
- colSpan={row.cells[columnId]?.span}
227
- className={rowHeight}
228
- >
229
- <strong>{row.cells[columnId]?.value}</strong>
230
- </td>
231
- ))}
232
- </tr>
233
- ))}
234
- </tfoot>
235
- </table>
236
- </ConditionalWrapper>
237
- </div>
238
- {footer && !footer.hidden && (
239
- <TableFooter
240
- pagination={footer.paginationControl}
241
- totalRows={footer.totalRows}
242
- noTotalRows={noTotalRows}
243
- customLimit={footer.customPagination?.customLimit}
244
- refetch={footer.refetch}
245
- dataLength={data.length}
246
- />
247
- )}
248
- </div>
249
- </Loader>
250
- );
251
- };
252
-
253
- export const Table = <T,>(props: ITable<T>) => (
254
- <TableProvider<T> {...props}>
255
- <TableContent />
256
- {props.itemDeleteData?.DeleteDialog}
257
- </TableProvider>
258
- );
@@ -1,60 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITableColumn } from '../../../../types/ITable';
3
- import { useEffect, useState } from 'react';
4
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
- import { Draggable, Droppable } from '@hello-pangea/dnd';
6
- import { faGripDotsVertical } from '../../../../assets/icons/solid/faGripDotsVertical';
7
-
8
- interface Props {
9
- id: 'hidden' | 'visible';
10
- items: ITableColumn[];
11
- search: string;
12
- }
13
-
14
- export const ColumnsList: FC<Props> = ({ id, items, search }) => {
15
- const [filteredItems, setFilteredItems] = useState<ITableColumn[]>([]);
16
-
17
- useEffect(() => {
18
- if (search.length) {
19
- setFilteredItems(
20
- items.filter(e =>
21
- (typeof e.label === 'string' ? e.label : (e.labelForFilter ?? ''))
22
- .toLocaleLowerCase()
23
- .includes(search.toLocaleLowerCase())
24
- )
25
- );
26
- }
27
- }, [search, items]);
28
-
29
- const list = search.length ? filteredItems : items;
30
-
31
- return (
32
- <Droppable droppableId={id}>
33
- {({ droppableProps, innerRef, placeholder }) => (
34
- <div {...droppableProps} ref={innerRef} className="list-box">
35
- {list.map(c => (
36
- <Draggable key={c.id} draggableId={c.id} index={items.indexOf(c)}>
37
- {({ innerRef, draggableProps, dragHandleProps }, snapshot) => (
38
- <div
39
- className={`item ${snapshot.isDragging ? 'dragging' : ''}`}
40
- ref={innerRef}
41
- {...draggableProps}
42
- {...dragHandleProps}
43
- style={{
44
- ...draggableProps.style,
45
- top: 'unset',
46
- left: 'unset',
47
- }}
48
- >
49
- {c.label}
50
- <FontAwesomeIcon icon={faGripDotsVertical} />
51
- </div>
52
- )}
53
- </Draggable>
54
- ))}
55
- {placeholder}
56
- </div>
57
- )}
58
- </Droppable>
59
- );
60
- };
@@ -1,114 +0,0 @@
1
- import type { DropResult } from '@hello-pangea/dnd';
2
- import type { FC } from 'react';
3
- import type { ITableColumn } from '../../../../types/ITable';
4
- import { useEffect, useState } from 'react';
5
- import { faLineColumns } from '@inceptionbg/icons';
6
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
- import { DragDropContext } from '@hello-pangea/dnd';
8
- import { useTranslation } from 'react-i18next';
9
- import { faArrowRightArrowLeft } from '../../../../assets/icons/regular/faArrowRightArrowLeft';
10
- import { usePopupControl } from '../../../../hooks/usePopupControl';
11
- import { IconButton } from '../../../Button/IconButton';
12
- import { SearchInput } from '../../../Inputs/SearchInput';
13
- import { Pullover } from '../../../Pullover/Pullover';
14
- import { useTableContext } from '../../contexts/TableContext';
15
- import { ColumnsList } from './ColumnsList';
16
-
17
- export const TableColumnsEdit: FC = () => {
18
- const [hidden, setHidden] = useState<ITableColumn[]>([]);
19
- const [visible, setVisible] = useState<ITableColumn[]>([]);
20
- const [searchHidden, setSearchHidden] = useState('');
21
- const [searchVisible, setSearchVisible] = useState('');
22
-
23
- const { t } = useTranslation();
24
- const {
25
- columnData: { columns, setColumns },
26
- } = useTableContext();
27
- const { control, onClose, onOpen } = usePopupControl();
28
-
29
- useEffect(() => {
30
- if (control.isOpen) {
31
- let hiddenCols: ITableColumn[] = [];
32
- let visibleCols: ITableColumn[] = [];
33
- columns.forEach(col =>
34
- !!col.hidden ? hiddenCols.push(col) : visibleCols.push(col)
35
- );
36
- setHidden(hiddenCols);
37
- setVisible(visibleCols);
38
- }
39
- }, [control.isOpen, columns]);
40
-
41
- const onDragEnd = ({ source, destination }: DropResult) => {
42
- if (!destination) return;
43
- const hiddenCols = [...hidden];
44
- const visibleCols = [...visible];
45
- const destinationIsHidden = destination.droppableId === 'hidden';
46
-
47
- const sourceList = source.droppableId === 'hidden' ? hiddenCols : visibleCols;
48
- const destinationList = destinationIsHidden ? hiddenCols : visibleCols;
49
-
50
- const [removed] = sourceList.splice(source.index, 1);
51
- destinationList.splice(destination.index, 0, removed);
52
- if (source.droppableId !== destination.droppableId) {
53
- destinationList[destination.index].hidden = destinationIsHidden;
54
- setHidden(hiddenCols);
55
- setVisible(visibleCols);
56
- } else {
57
- destinationIsHidden ? setHidden(hiddenCols) : setVisible(visibleCols);
58
- }
59
- };
60
-
61
- const onSubmit = () => {
62
- if (setColumns) {
63
- const newColumns = [...visible, ...hidden];
64
- setColumns(newColumns);
65
- onClose();
66
- }
67
- };
68
-
69
- return (
70
- <>
71
- <IconButton
72
- tooltip={t('Columns')}
73
- icon={faLineColumns}
74
- active={control.isOpen}
75
- onClick={onOpen}
76
- size="s"
77
- variant="outlined"
78
- />
79
-
80
- <DragDropContext onDragEnd={onDragEnd}>
81
- <Pullover
82
- control={control}
83
- header={{ title: t('Columns') }}
84
- className="column-pullover"
85
- footer={{
86
- confirmButton: {
87
- label: t('Confirm'),
88
- onClick: onSubmit,
89
- },
90
- }}
91
- >
92
- <div className="dual-list-container">
93
- <p className="pb-3">{t('DragDropListsInfo')}</p>
94
- <div className="dual-list-content">
95
- <p className="bold ml-2">{t('HiddenColumns')}:</p>
96
- <div />
97
- <p className="bold ml-2">{t('SelectedColumns')}:</p>
98
-
99
- <SearchInput onSearch={setSearchHidden} />
100
- <div />
101
- <SearchInput onSearch={setSearchVisible} />
102
-
103
- <ColumnsList id="hidden" items={hidden} search={searchHidden} />
104
- <div className="exchange-icon">
105
- <FontAwesomeIcon icon={faArrowRightArrowLeft} />
106
- </div>
107
- <ColumnsList id="visible" items={visible} search={searchVisible} />
108
- </div>
109
- </div>
110
- </Pullover>
111
- </DragDropContext>
112
- </>
113
- );
114
- };
@@ -1,78 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITableColumn, ITableDataItem } from '../../../../types/ITable';
3
- import { useEffect, useRef } from 'react';
4
- import { faCheck, faXmark } from '@inceptionbg/icons';
5
- import clsx from 'clsx';
6
- import { useGetFocusableElements } from '../../../../hooks/useGetFocusableElements';
7
- import { IconButton } from '../../../Button/IconButton';
8
- import { useTableContext } from '../../contexts/TableContext';
9
-
10
- export const TableEditRow: FC<{ columns: ITableColumn[] }> = ({ columns }) => {
11
- const { editable } = useTableContext();
12
-
13
- const elementRef = useRef(null);
14
-
15
- const focusableElements = useGetFocusableElements({
16
- elementRef,
17
- isOpen: true,
18
- });
19
-
20
- useEffect(() => {
21
- focusableElements[0]?.focus();
22
- }, [focusableElements]);
23
-
24
- useEffect(() => {
25
- editable!.setEditData(
26
- editable!.selectedItem?.item ?? editable!.defaultDataValue ?? {}
27
- );
28
- // eslint-disable-next-line
29
- }, [editable?.setEditData, editable?.selectedItem, editable?.defaultDataValue]);
30
-
31
- let rowCells = {
32
- ...editable?.cells,
33
- actions: {
34
- value: (
35
- <div className="flex center gap-1">
36
- <IconButton icon={faCheck} size="s" type="submit" />
37
- <IconButton
38
- icon={faXmark}
39
- size="s"
40
- onClick={() => {
41
- editable?.setEditData(editable?.defaultDataValue || {});
42
- if (editable?.isAdding) {
43
- editable.setIsAdding(false);
44
- } else {
45
- editable?.setSelectedItem(null);
46
- }
47
- }}
48
- />
49
- </div>
50
- ),
51
- },
52
- };
53
-
54
- const rowData: ITableDataItem = {
55
- uuid: editable?.selectedItem?.uuid as string,
56
- cells: rowCells,
57
- };
58
-
59
- return (
60
- <tr ref={elementRef} data-id={rowData.uuid} className="edit-row">
61
- {columns.map(column => {
62
- const item = rowData.cells[column.id];
63
- return (
64
- <td
65
- key={column.id}
66
- align={column.align}
67
- colSpan={item?.span}
68
- className={clsx(item?.className, {
69
- editable: typeof item?.value === 'object',
70
- })}
71
- >
72
- {item?.value ?? ''}
73
- </td>
74
- );
75
- })}
76
- </tr>
77
- );
78
- };
@@ -1,15 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITableFilterItem } from '../../../../types/ITable';
3
-
4
- interface Props {
5
- item: ITableFilterItem;
6
- }
7
- export const FilterItem: FC<Props> = ({ item }) => (
8
- <div className="table-filter-item">
9
- {/* Added zero-width non-breaking space symbol (&#8288;)
10
- because of losing focus from input field when first letter of the label is pressed. */}
11
- {/* <p className="filter-item-label">&#8288;{item.label}</p> */}
12
- <p className="filter-item-label">{item.label}</p>
13
- {item.field}
14
- </div>
15
- );
@@ -1,126 +0,0 @@
1
- import type { FC } from 'react';
2
- import type { ITableFilterItem } from '../../../../types/ITable';
3
- import { useMemo, useState } from 'react';
4
- import { faFilter } from '@inceptionbg/icons';
5
- import { useTranslation } from 'react-i18next';
6
- import { faFilterCircleXmark } from '../../../../assets/icons/regular/faFilterCircleXmark';
7
- import { usePopupControl } from '../../../../hooks/usePopupControl';
8
- import {
9
- deleteEmptyPropsIncludingArray,
10
- deleteProps,
11
- } from '../../../../utils/objectUtils';
12
- import {
13
- getActiveFilterNumber,
14
- getVisibleColumnsIds,
15
- } from '../../../../utils/tableUtils';
16
- import { NotificationBadge } from '../../../Badge/NotificationBadge';
17
- import { IconButton } from '../../../Button/IconButton';
18
- import { Pullover } from '../../../Pullover/Pullover';
19
- import { useTableContext } from '../../contexts/TableContext';
20
- import { FilterItem } from './FilterItem';
21
-
22
- export const TableFilters: FC = () => {
23
- const { t } = useTranslation();
24
- const {
25
- columnData: { columns },
26
- filterData,
27
- } = useTableContext();
28
- const { control, onClose, onOpen } = usePopupControl();
29
- const columnIds = getVisibleColumnsIds(columns);
30
-
31
- const [filterSearch, setFilterSearch] = useState('');
32
-
33
- const {
34
- filters,
35
- additionalFilters,
36
- excludeFromSearch,
37
- search = {},
38
- searchData = {},
39
- setSearchData,
40
- defaultSearch = {},
41
- onSearch,
42
- activeFilterNo,
43
- customFilterIdList,
44
- } = filterData ?? {};
45
-
46
- const visibleFilters = useMemo(
47
- () =>
48
- filters
49
- ? (customFilterIdList ?? columnIds).reduce(
50
- (arr: ITableFilterItem[], col) =>
51
- !!filters[col] ? arr.concat(filters[col]) : arr,
52
- []
53
- )
54
- : [],
55
- [columnIds, customFilterIdList, filters]
56
- );
57
-
58
- const filteredFilters = useMemo(
59
- () =>
60
- visibleFilters.filter(e =>
61
- e?.label.toLowerCase().includes(filterSearch.toLowerCase())
62
- ),
63
- [visibleFilters, filterSearch]
64
- );
65
-
66
- return filterData ? (
67
- <>
68
- <NotificationBadge number={activeFilterNo ?? getActiveFilterNumber(search)}>
69
- <IconButton
70
- tooltip={t('Filter')}
71
- icon={faFilter}
72
- active={control.isOpen}
73
- onClick={onOpen}
74
- size="s"
75
- variant="outlined"
76
- />
77
- </NotificationBadge>
78
-
79
- <Pullover
80
- control={control}
81
- header={{
82
- title: t('Filter'),
83
- onSearch: visibleFilters.length > 2 ? setFilterSearch : undefined,
84
- }}
85
- onFormSubmit={() => {
86
- const data = deleteEmptyPropsIncludingArray(searchData);
87
- onSearch?.(excludeFromSearch ? deleteProps(data, excludeFromSearch) : data);
88
- onClose();
89
- }}
90
- footer={{
91
- confirmButton: {
92
- label: t('ApplyFilters'),
93
- type: 'submit',
94
- },
95
- additionalButton: {
96
- label: t('ResetFilter'),
97
- icon: faFilterCircleXmark,
98
- onClick: () => {
99
- setSearchData?.(defaultSearch);
100
- onSearch?.(defaultSearch);
101
- onClose();
102
- },
103
- disabled: defaultSearch
104
- ? JSON.stringify(searchData) === JSON.stringify(defaultSearch)
105
- : Object.keys(searchData).length === 0,
106
- },
107
- }}
108
- contentClassName="iui-filters-list"
109
- onCloseCallback={() => setFilterSearch('')}
110
- size="w600"
111
- >
112
- {filteredFilters?.map(item => (
113
- <FilterItem key={item.label} item={item} />
114
- ))}
115
- {additionalFilters && <div className="pb-1">{additionalFilters}</div>}
116
-
117
- {/* {filteredFilters?.map(item => (
118
- <FilterItem key={item.label + 1} item={item} />
119
- ))}
120
- {filteredFilters?.map(item => (
121
- <FilterItem key={item.label + 2} item={item} />
122
- ))} */}
123
- </Pullover>
124
- </>
125
- ) : null;
126
- };