@inceptionbg/iui 2.0.8 → 2.0.10

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 (138) hide show
  1. package/dist/icons/index.d.ts +2 -2
  2. package/dist/icons/index.js +1 -1
  3. package/dist/index.d.ts +286 -259
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/iui.css +1 -1
  7. package/idea/GridTable/GridTable.tsx +119 -0
  8. package/idea/GridTable/gridTable.scss +42 -0
  9. package/{src/components → idea}/Table/Components/Print/CustomTablePrint.tsx +2 -2
  10. package/{src/components → idea}/Table/Components/Print/TablePrint.tsx +2 -2
  11. package/{src/components → idea}/Table/Components/SetTableFilter.tsx +1 -1
  12. package/{src/components → idea}/Table/Components/TableOptions.tsx +4 -4
  13. package/idea/{Table2 → Table}/Table.tsx +151 -281
  14. package/idea/Table/hooks/useDefaultTemplate.ts +20 -0
  15. package/{src/components → idea}/Table/hooks/useTableKeyboard.ts +1 -2
  16. package/idea/Table/hooks/useTableSelect.ts +11 -0
  17. package/package.json +1 -1
  18. package/src/assets/icons/index.ts +1 -1
  19. package/src/assets/icons/light/faClipboardCheck.ts +15 -0
  20. package/src/assets/icons/light/faHouse.ts +15 -15
  21. package/src/assets/icons/light/faIdBadge.ts +15 -15
  22. package/src/assets/icons/light/faPen.ts +15 -0
  23. package/src/components/Button/IconButton.tsx +3 -1
  24. package/src/components/Dialog/Dialog.tsx +59 -123
  25. package/src/components/Dialog/components/DialogFooter.tsx +92 -0
  26. package/src/components/Dialog/hooks/useDialogKeyboard.ts +6 -5
  27. package/src/components/Header/Header.tsx +1 -1
  28. package/src/components/Inputs/DateInput/DateInput.tsx +108 -102
  29. package/src/components/Inputs/DateInput/components/DatePartInput.tsx +7 -3
  30. package/src/components/Inputs/InputWrapper.tsx +6 -1
  31. package/src/components/Inputs/SearchInput.tsx +9 -4
  32. package/src/components/Inputs/Select2/Select.tsx +65 -30
  33. package/src/components/Inputs/Select2/select.scss +13 -14
  34. package/src/components/Inputs/Selects/components/SelectWrapper.tsx +4 -2
  35. package/src/components/Inputs/Selects/utils/selectStyles.ts +9 -12
  36. package/src/components/Menu/Menu.tsx +10 -2
  37. package/src/components/Menu/MenuItem.tsx +11 -10
  38. package/src/components/Menu/hooks/useMenuPosition.tsx +23 -6
  39. package/src/components/Pullover/Pullover.tsx +122 -59
  40. package/src/components/Table/Table.tsx +78 -342
  41. package/src/components/Table/components/edit/TableEditRow.tsx +69 -0
  42. package/src/components/Table/components/filters/FilterItem.tsx +15 -0
  43. package/src/components/Table/components/filters/TableFilters.tsx +125 -0
  44. package/src/components/Table/components/footer/TableFooter.tsx +128 -0
  45. package/src/components/Table/components/header/TableHeader.tsx +42 -0
  46. package/src/components/Table/components/header/TableHeaderRow.tsx +47 -0
  47. package/src/components/Table/components/items/TableItemActions.tsx +66 -0
  48. package/src/components/Table/components/select/TableSelect.tsx +49 -0
  49. package/src/components/Table/components/sort/TableSort.tsx +52 -0
  50. package/src/components/Table/contexts/TableContext.tsx +123 -0
  51. package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +73 -0
  52. package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +78 -0
  53. package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +173 -0
  54. package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +12 -0
  55. package/src/components/Table/hooks/useTableEdit.tsx +111 -0
  56. package/src/components/Table/hooks/useTableFilterFields.tsx +150 -0
  57. package/src/components/Table/hooks/useTablePagination.ts +16 -0
  58. package/src/components/Table/hooks/useTableSearch.ts +29 -0
  59. package/src/components/Table/hooks/useTableSort.ts +8 -0
  60. package/src/components/Tooltip/Tooltip.tsx +1 -1
  61. package/src/components/Wrappers/PageLayout.tsx +9 -12
  62. package/src/hooks/useGetFocusableElements.ts +42 -0
  63. package/src/hooks/useLocalPopoverControl.ts +38 -0
  64. package/src/hooks/usePopupControl.ts +13 -0
  65. package/src/index.ts +53 -39
  66. package/src/styles/components/_accordions.scss +1 -1
  67. package/src/styles/components/_badge.scss +4 -3
  68. package/src/styles/components/_card.scss +1 -1
  69. package/src/styles/components/_dialog.scss +8 -8
  70. package/src/styles/components/_input.scss +1 -1
  71. package/src/styles/components/_inputCheckbox.scss +1 -1
  72. package/src/styles/components/_inputDateTime.scss +2 -2
  73. package/src/styles/components/_inputRadio.scss +1 -1
  74. package/src/styles/components/_inputSelect.scss +6 -4
  75. package/src/styles/components/_menu-v2.scss +1 -1
  76. package/src/styles/components/_menu.scss +23 -15
  77. package/src/styles/components/_pullover.scss +74 -18
  78. package/src/styles/components/_table.scss +151 -142
  79. package/src/styles/components/_widget.scss +1 -1
  80. package/src/styles/variables/_bp.scss +1 -0
  81. package/src/styles/variables/_variables.scss +4 -2
  82. package/src/types/IKeyboard.ts +2 -1
  83. package/src/types/IMenu.ts +1 -0
  84. package/src/types/ISelect.ts +1 -0
  85. package/src/types/ITable.ts +87 -80
  86. package/src/utils/fileUtils.ts +3 -3
  87. package/src/utils/i18n/i18nIUICyrilic.ts +4 -0
  88. package/src/utils/i18n/i18nIUILatin.ts +3 -1
  89. package/src/utils/i18n/i18nIUIMe.ts +4 -0
  90. package/src/utils/{ObjectUtils.ts → objectUtils.ts} +8 -8
  91. package/src/utils/popupUtils.ts +82 -0
  92. package/src/utils/{TableUtils.ts → tableUtils.ts} +5 -5
  93. package/src/utils/{Toasts.ts → toasts.ts} +6 -6
  94. package/src/utils/{UrlUtils.ts → urlUtils.ts} +4 -4
  95. package/idea/Table2/Components/Columns/ColumnsList.tsx +0 -56
  96. package/idea/Table2/Components/Columns/SetColumnsList.tsx +0 -107
  97. package/idea/Table2/Components/Edit/ItemActionsMenu.tsx +0 -87
  98. package/idea/Table2/Components/Edit/ItemEditOptionsButtons.tsx +0 -32
  99. package/idea/Table2/Components/Edit/TableEditRow.tsx +0 -56
  100. package/idea/Table2/Components/FilterItem.tsx +0 -20
  101. package/idea/Table2/Components/Header/TableHeader.tsx +0 -35
  102. package/idea/Table2/Components/Header/TableHeaderRow.tsx +0 -37
  103. package/idea/Table2/Components/Print/CustomTablePrint.tsx +0 -119
  104. package/idea/Table2/Components/Print/TablePrint.tsx +0 -208
  105. package/idea/Table2/Components/SetSortList.tsx +0 -33
  106. package/idea/Table2/Components/SetTableFilter.tsx +0 -90
  107. package/idea/Table2/Components/TableFooter.tsx +0 -107
  108. package/idea/Table2/Components/TableOptions.tsx +0 -211
  109. package/idea/Table2/Components/Templates/TemplateCreate.tsx +0 -75
  110. package/idea/Table2/Components/Templates/TemplateCreateDefault.tsx +0 -45
  111. package/idea/Table2/Components/Templates/TemplateList.tsx +0 -167
  112. package/idea/Table2/Components/Templates/repo/TemplateRepo.ts +0 -51
  113. package/idea/Table2/_table.scss +0 -300
  114. package/idea/Table2/hooks/useDefaultTemplate.ts +0 -22
  115. package/idea/Table2/hooks/useTableKeyboard.ts +0 -115
  116. package/src/assets/icons/light/faPenField.ts +0 -15
  117. package/src/assets/icons/solid/faMagnifyingGlass.ts +0 -15
  118. package/src/components/Dialog/DeleteItemDialog.tsx +0 -52
  119. package/src/components/Dialog/hooks/useDialogObserver.ts +0 -21
  120. /package/{src/components → idea}/Table/Components/Columns/ColumnsList.tsx +0 -0
  121. /package/{src/components → idea}/Table/Components/Columns/SetColumnsList.tsx +0 -0
  122. /package/{src/components → idea}/Table/Components/Edit/ItemActionsMenu.tsx +0 -0
  123. /package/{src/components → idea}/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -0
  124. /package/{src/components → idea}/Table/Components/Edit/TableEditRow.tsx +0 -0
  125. /package/{src/components → idea}/Table/Components/FilterItem.tsx +0 -0
  126. /package/{src/components → idea}/Table/Components/Header/TableHeader.tsx +0 -0
  127. /package/{src/components → idea}/Table/Components/Header/TableHeaderRow.tsx +0 -0
  128. /package/{src/components → idea}/Table/Components/SetSortList.tsx +0 -0
  129. /package/{src/components → idea}/Table/Components/TableFooter.tsx +0 -0
  130. /package/{src/components → idea}/Table/Components/Templates/TemplateCreate.tsx +0 -0
  131. /package/{src/components → idea}/Table/Components/Templates/TemplateCreateDefault.tsx +0 -0
  132. /package/{src/components → idea}/Table/Components/Templates/TemplateList.tsx +0 -0
  133. /package/{src/components → idea}/Table/Components/Templates/repo/TemplateRepo.ts +0 -0
  134. /package/src/utils/{DateUtils.ts → dateUtils.ts} +0 -0
  135. /package/src/utils/{LocalStorageHelper.ts → localStorageHelper.ts} +0 -0
  136. /package/src/utils/{NumberUtils.ts → numberUtils.ts} +0 -0
  137. /package/src/utils/{RootDir.ts → rootDir.ts} +0 -0
  138. /package/src/utils/{StringUtils.ts → stringUtils.ts} +0 -0
@@ -1,51 +0,0 @@
1
- import { IPagination, IReportTemplate } from '../../../../../types/ITable';
2
- import { getActiveOrgUuid } from '../../../../../utils/LocalStorageHelper';
3
-
4
- const baseUrl =
5
- window.location.host.includes("test.inception.rs") || window.location.host.includes("localhost:")
6
- ? 'https://report-templates.api.test.inception.rs'
7
- : 'https://report-templates.api.inception.rs';
8
-
9
- export const getReportTemplates = (
10
- pagination: IPagination,
11
- search: { identifier: string; nameLike?: string; onlyLoggedInUserTemplates?: boolean },
12
- fetchOptions?: ('SORT' | 'FILTER_VALUES' | 'COLUMNS' | 'CREATED_BY' | 'ORGANIZATION')[]
13
- ) =>
14
- axiosInstance
15
- .get('/report-templates', {
16
- params: {
17
- ...pagination,
18
- ...search,
19
- fetchOptions,
20
- organizationUuid: getActiveOrgUuid(),
21
- subsystem: moduleId,
22
- },
23
- headers: { baseUrl },
24
- })
25
- .then(({ data }) => ({
26
- templates: data.reportTemplates as IReportTemplate[],
27
- totalRows: data.pagination.totalRows as number,
28
- }));
29
-
30
- export const getDefaultReportTemplate = (identifier: string) =>
31
- axiosInstance
32
- .get(`/report-templates/${identifier}/default`, {
33
- params: { organizationUuid: getActiveOrgUuid() },
34
- headers: { baseUrl },
35
- })
36
- .then(({ data }) => data as IReportTemplate);
37
-
38
- export const createReportTemplate = (data: Partial<IReportTemplate>) =>
39
- axiosInstance.post(
40
- `/report-template`,
41
- {
42
- ...data,
43
- organization: { uuid: getActiveOrgUuid() },
44
- subsystem: moduleId,
45
- },
46
- { headers: { baseUrl } }
47
- );
48
- export const deleteReportTemplate = (templateUuid: string) =>
49
- axiosInstance.delete(`/report-templates/${templateUuid}`, {
50
- headers: { baseUrl },
51
- });
@@ -1,300 +0,0 @@
1
- table {
2
- border-spacing: 0px;
3
- border-collapse: collapse;
4
- }
5
- // .iui-table {
6
- // //// Header ////
7
- // th {
8
- // border-bottom: var(--table-border);
9
- // font-size: var(--fs-m);
10
- // &:last-child {
11
- // .vertical-separator {
12
- // display: none;
13
- // }
14
- // }
15
- // }
16
- // .table-container {
17
- // overflow: auto;
18
- // // scroll-snap-type: y mandatory;
19
- // }
20
- // .sticky-header {
21
- // position: sticky;
22
- // top: 0;
23
- // background-color: white;
24
- // }
25
- // .vertical-separator {
26
- // height: 14px;
27
- // width: 2px;
28
- // background-color: #00000030;
29
- // }
30
-
31
- // //// Body ////
32
- // tbody.no-last-border tr:last-child td {
33
- // border: none;
34
- // }
35
- // // Row
36
- // tr {
37
- // // scroll-snap-align: start;
38
- // margin-bottom: 2px;
39
- // &.clickable:hover,
40
- // &.selected {
41
- // background-color: rgba(0, 0, 0, 0.05);
42
- // }
43
- // &.focused {
44
- // background-color: var(--primary-o10);
45
- // }
46
- // &.loading {
47
- // opacity: 0.5;
48
- // pointer-events: none;
49
- // }
50
- // }
51
- // // Cell
52
- // th,
53
- // td {
54
- // // Cell colors
55
- // &.secondary {
56
- // background-color: rgba(0, 0, 0, 0.04);
57
- // border-bottom: 1px solid #d3d3d3;
58
- // }
59
- // }
60
- // td {
61
- // height: 52px;
62
- // padding: 7px 16px;
63
- // font-size: var(--fs-m);
64
- // box-sizing: border-box;
65
- // border-bottom: var(--table-border);
66
- // }
67
- // .clickable-column:hover {
68
- // background-color: var(--primary-o10) !important;
69
- // }
70
-
71
- // //// Footer ////
72
-
73
- // .table-footer {
74
- // display: flex;
75
- // align-items: center;
76
- // width: 100%;
77
- // height: 52px;
78
- // padding: 7px 16px;
79
- // font-size: var(--fs-m);
80
- // box-sizing: border-box;
81
- // }
82
- // .pagination {
83
- // display: flex;
84
- // align-items: center;
85
- // color: rgba(0, 0, 0, 0.8);
86
- // @media #{$bp-mobile} {
87
- // flex-direction: column;
88
- // align-items: end;
89
- // }
90
- // select {
91
- // color: rgba(0, 0, 0, 0.8);
92
- // background: none;
93
- // border: none;
94
- // text-align: right;
95
- // cursor: pointer;
96
- // padding: 0 8px;
97
- // user-select: none;
98
- // margin-left: 8px;
99
- // margin-right: 16px;
100
- // }
101
- // .offset-input {
102
- // width: 30px;
103
- // border: none;
104
- // border-bottom: 1px solid rgba(0, 0, 0, 0.3);
105
- // background: none;
106
- // text-align: center;
107
- // padding: 5px 0;
108
- // }
109
- // }
110
-
111
- // @media #{$portrait} {
112
- // tbody,
113
- // tr {
114
- // display: block;
115
- // }
116
- // tr {
117
- // padding: 20px 0;
118
- // }
119
- // td {
120
- // display: flex;
121
- // align-items: center;
122
- // height: unset !important;
123
- // text-align: left;
124
- // }
125
- // thead {
126
- // display: none;
127
- // }
128
- // tbody tr td {
129
- // &:before {
130
- // content: attr(data-th);
131
- // font-weight: bold;
132
- // text-align: left;
133
- // padding-right: 10px;
134
- // }
135
- // }
136
- // }
137
- // }
138
-
139
- .iui-table-filter {
140
- .iui-dialog-content {
141
- padding: 0;
142
- margin: 8px 0;
143
- }
144
- .filters-search {
145
- display: flex;
146
- align-items: center;
147
- justify-content: space-between;
148
- gap: 8px;
149
- .search-input {
150
- max-width: 250px;
151
- }
152
- }
153
- .table-filter-item {
154
- display: flex;
155
- align-items: center;
156
- justify-content: space-between;
157
- padding: 8px 16px;
158
- .label {
159
- width: 150px;
160
- }
161
- .field {
162
- display: inline-flex;
163
- margin: 0 8px;
164
- width: 100%;
165
- }
166
- }
167
- }
168
-
169
- .dual-list-container {
170
- .dual-list-content {
171
- display: grid;
172
- grid-template-columns: 1fr auto 1fr;
173
- gap: 12px;
174
- }
175
- .list-box {
176
- border: var(--table-border);
177
- border-radius: 16px;
178
- padding: 10px;
179
- user-select: none;
180
- & > .item {
181
- display: flex;
182
- justify-content: space-between;
183
- align-items: center;
184
- padding: 8px;
185
- font-size: 12px;
186
- svg {
187
- color: rgba(0, 0, 0, 0.6);
188
- margin-left: 1rem;
189
- }
190
- &:hover {
191
- background-color: var(--primary-o10);
192
- }
193
- &:active {
194
- background-color: var(--primary-o25);
195
- }
196
- }
197
- }
198
- .exchange-icon {
199
- display: flex;
200
- align-items: center;
201
- svg {
202
- height: 20px;
203
- width: 20px;
204
- }
205
- }
206
- }
207
-
208
- .edit-row {
209
- background: #3d497714;
210
- }
211
- .primary-row {
212
- background-color: rgba(var(--primary-rgb), 0.15);
213
- }
214
- .secondary-row {
215
- background-color: #f1f1f1;
216
- }
217
-
218
- .table-options {
219
- display: flex;
220
- align-items: center;
221
- justify-content: space-between;
222
- margin-bottom: 4px;
223
- .table-options-btn {
224
- background: var(--background-dark);
225
- border-radius: 4px;
226
- font-weight: 700;
227
- &:hover {
228
- background-color: #dfe1eb !important;
229
- }
230
- svg {
231
- height: 12px;
232
- width: 12px;
233
- }
234
- }
235
- }
236
-
237
- //
238
-
239
- .grid-table {
240
- display: grid;
241
- // grid-template-rows: auto 1fr; /* Header auto height, body fills */
242
- grid-template-columns: repeat(9, auto); /* Adjust based on columns */
243
- thead,
244
- tbody {
245
- display: contents;
246
- }
247
-
248
- tbody {
249
- max-height: 400px;
250
- overflow-y: auto;
251
- }
252
- // thead {
253
- // position: sticky;
254
- // top: 0;
255
- // background: #f9f9f9;
256
- // z-index: 1;
257
- // }
258
-
259
- // tbody {
260
- // display: grid;
261
- // grid-template-columns: repeat(3, 1fr); /* Match columns */
262
- // }
263
-
264
- tr {
265
- display: contents; /* Allows rows to use the grid structure */
266
- }
267
-
268
- th,
269
- td {
270
- box-sizing: border-box;
271
- display: flex;
272
- padding: 12px;
273
- flex-grow: 1;
274
- align-items: center;
275
- min-height: 20px;
276
- border: 1px solid #ddd; /* Apply borders to th and td */
277
- }
278
-
279
- // th:first-child,
280
- // td:first-child {
281
- // border-left: none; /* Remove left border for the first column */
282
- // }
283
-
284
- // tr:last-child .td {
285
- // border-bottom: none; /* Remove bottom border from the last row */
286
- // }
287
-
288
- th {
289
- background-color: #f4f4f4; /* Light background for the header */
290
- }
291
-
292
- tr:hover {
293
- outline: 2px solid #007bff;
294
- background: #6aa1ce;
295
- }
296
-
297
- tr + tr td {
298
- border-top: none; /* Remove top border from subsequent rows */
299
- }
300
- }
@@ -1,22 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { getDefaultReportTemplate } from '../Components/Templates/repo/TemplateRepo';
3
- import { IReportTemplate } from '../../../types/ITable';
4
-
5
- export const useDefaultTemplate = (identifier?: string) => {
6
- const [template, setTemplate] = useState<IReportTemplate | null>(null);
7
- const [isLoading, setIsLoading] = useState(true);
8
-
9
- useEffect(() => {
10
- if (identifier) {
11
- getDefaultReportTemplate(identifier)
12
- .then(setTemplate)
13
- .catch(() => {})
14
- .finally(() => setIsLoading(false));
15
- }
16
- }, [identifier]);
17
-
18
- return {
19
- defaultTemplate: template,
20
- isLoadingDefaultTemplate: !!identifier && isLoading,
21
- };
22
- };
@@ -1,115 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { ITableDataItem } from '../../../types/ITable';
3
- import { IKeyboardAction, ITableKeyboardActionsProp } from '../../../types/IKeyboard';
4
- import { useDialogObserver } from '../../Dialog/hooks/useDialogObserver';
5
- import { scrollToRow } from '../../../utils/TableUtils';
6
-
7
- export const useTableKeyboard = ({
8
- enabled,
9
- rows,
10
- actions,
11
- }: {
12
- enabled: boolean;
13
- rows: ITableDataItem[];
14
- actions: ITableKeyboardActionsProp;
15
- }) => {
16
- const [focusedRow, setFocusedRow] = useState<ITableDataItem | null>(null);
17
- const isDialogOpen = useDialogObserver();
18
-
19
- useEffect(() => {
20
- if (enabled && !isDialogOpen) {
21
- const isEditing = !!actions.edit?.item;
22
- const isAdding = !!actions.add?.isAdding;
23
-
24
- const handleKeyDown = (event: KeyboardEvent) => {
25
- const isControlKeyPressed = event.ctrlKey || event.metaKey;
26
- const rowIndex = focusedRow
27
- ? rows.findIndex(row => row.uuid === focusedRow.uuid)
28
- : -1;
29
-
30
- const allActions: IKeyboardAction[] = [
31
- {
32
- key: 'ArrowDown',
33
- isActive: !isEditing && !actions.moveDisabled,
34
- onAction: () => {
35
- // Leave action enabled to prevent default scroll movement
36
- const nextRow = rowIndex + 1;
37
- if (nextRow < rows.length) {
38
- // rowIndex will be -1 if no row is selected so the next row will be 0
39
- setFocusedRow(rows[nextRow]);
40
- scrollToRow(rows[nextRow].uuid);
41
- }
42
- },
43
- },
44
- {
45
- key: 'ArrowUp',
46
- isActive: !isEditing && !actions.moveDisabled,
47
- onAction: () => {
48
- if (rowIndex !== 0) {
49
- const prevRow = rowIndex > 0 ? rowIndex - 1 : rows.length - 1;
50
- setFocusedRow(rows[prevRow]);
51
- scrollToRow(rows[prevRow].uuid);
52
- }
53
- },
54
- },
55
- {
56
- key: 'e',
57
- normalizedKey: true,
58
- ctrl: true,
59
- isActive: !!actions.edit?.enabled && !!focusedRow,
60
- onAction: () => !isEditing && actions.edit?.setItem(focusedRow?.item ?? null),
61
- },
62
- {
63
- key: 'Enter',
64
- isActive: !isEditing && !isAdding && !!focusedRow?.onRowClick,
65
- onAction: focusedRow?.onRowClick!,
66
- },
67
- {
68
- key: 'Escape',
69
- isActive: !!focusedRow || !!isAdding,
70
- onAction: () =>
71
- isAdding
72
- ? actions.add?.setIsAdding(false)
73
- : actions.edit?.item
74
- ? actions.edit?.setItem(null)
75
- : setFocusedRow(null),
76
- },
77
- {
78
- key: 'Insert',
79
- isActive: !!actions.add?.enabled && !isAdding,
80
- onAction: () => {
81
- actions.add?.setIsAdding(true);
82
- setFocusedRow(null);
83
- },
84
- },
85
- {
86
- key: 'Delete',
87
- isActive: !isEditing && !!actions.delete?.enabled && !!focusedRow,
88
- onAction: () =>
89
- actions.delete?.onAction ?? actions.delete?.setItemUuid(focusedRow!.uuid),
90
- },
91
- ...(actions?.additional?.({ focusedRow, isEditing, isAdding }) || []),
92
- ];
93
-
94
- allActions.forEach(item => {
95
- if (
96
- item.isActive &&
97
- item.key === (item.normalizedKey ? event.key.toLowerCase() : event.key) &&
98
- !!item.ctrl === isControlKeyPressed
99
- ) {
100
- event.preventDefault();
101
- event.stopPropagation();
102
- item.onAction();
103
- }
104
- });
105
- };
106
-
107
- window.addEventListener('keydown', handleKeyDown);
108
- return () => {
109
- window.removeEventListener('keydown', handleKeyDown);
110
- };
111
- }
112
- }, [enabled, rows, focusedRow, actions, isDialogOpen]);
113
-
114
- return focusedRow;
115
- };
@@ -1,15 +0,0 @@
1
- import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
2
-
3
- const prefix = "fal";
4
- const iconName = "pen-field";
5
- const width = 640;
6
- const height = 512;
7
- const unicode = "e211";
8
- const svgPathData =
9
- "M560 256C551.2 256 544 263.2 544 272V448c0 17.67-14.33 32-32 32H64c-17.67 0-32-14.33-32-32V192c0-17.67 14.33-32 32-32h240C312.8 160 320 152.8 320 144S312.8 128 304 128H63.1C28.65 128 0 156.7 0 192v256c0 35.35 28.65 64 63.1 64h447.1c35.35 0 63.1-28.65 63.1-63.1L576 272C576 263.2 568.8 256 560 256zM640 76.14c0-12.28-4.686-24.57-14.06-33.94l-28.13-28.14C588.4 4.688 576.2 0 563.9 0s-24.57 4.688-33.94 14.06l-207.5 207.5C313.5 230.5 307.4 241.9 304.9 254.3l-16.66 83.35c-.162 .8104-.2393 1.612-.2393 2.396C288 346.6 293.4 352 299.1 352c.7852 0 1.586-.0781 2.398-.2402l83.35-16.67c12.39-2.479 23.77-8.566 32.7-17.5l207.5-207.5C635.3 100.7 640 88.42 640 76.14zM395.8 294.1c-4.48 4.48-10.13 7.506-16.35 8.748L325.5 314.5l10.78-53.93c1.244-6.219 4.27-11.88 8.754-16.36l146.3-146.3l50.76 50.76L395.8 294.1zM603.3 87.45l-38.62 38.62l-50.76-50.76l38.62-38.62C556.6 32.61 561.4 32 563.9 32s7.236 .6094 11.31 4.686l28.13 28.14C607.4 68.9 608 73.66 608 76.14C608 78.61 607.4 83.38 603.3 87.45zM104 320c0 13.25 10.75 24 24 24S152 333.3 152 320c0-13.26-10.75-24-24-24S104 306.7 104 320zM200 320c0 13.25 10.75 24 24 24S248 333.3 248 320c0-13.26-10.75-24-24-24S200 306.7 200 320z";
10
-
11
- export const faPenField: IconDefinition = {
12
- prefix,
13
- iconName,
14
- icon: [width, height, [], unicode, svgPathData],
15
- };
@@ -1,15 +0,0 @@
1
- import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
-
3
- const prefix = 'fas';
4
- const iconName = 'magnifying-glass';
5
- const width = 512;
6
- const height = 512;
7
- const unicode = 'f002';
8
- const svgPathData =
9
- 'M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z';
10
-
11
- export const faMagnifyingGlass: IconDefinition = {
12
- prefix,
13
- iconName,
14
- icon: [width, height, [], unicode, svgPathData],
15
- };
@@ -1,52 +0,0 @@
1
- import { Dispatch, FC, SetStateAction, useState } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { Dialog } from './Dialog';
4
- import { faTrashCan } from '../../assets/icons';
5
-
6
- interface Props {
7
- textId: string;
8
- itemUuid: string;
9
- setItemUuid: Dispatch<SetStateAction<string>>;
10
- reloadItems: () => void;
11
- deleteItemFunction: (itemUuid: string) => Promise<any>;
12
- }
13
-
14
- export const DeleteItemDialog: FC<Props> = ({
15
- textId,
16
- itemUuid,
17
- setItemUuid,
18
- reloadItems,
19
- deleteItemFunction,
20
- }) => {
21
- const [isLoading, setIsLoading] = useState(false);
22
-
23
- const { t } = useTranslation();
24
-
25
- const handOnDelete = () => {
26
- setIsLoading(true);
27
- deleteItemFunction(itemUuid)
28
- .then(() => {
29
- reloadItems();
30
- setItemUuid('');
31
- })
32
- .catch(() => {})
33
- .finally(() => setIsLoading(false));
34
- };
35
-
36
- return (
37
- <Dialog
38
- isOpen={!!itemUuid}
39
- onClose={() => setItemUuid('')}
40
- title={t(`Delete${textId}Title`)}
41
- desc={t(`Delete${textId}Desc`)}
42
- isLoading={isLoading}
43
- type="info"
44
- confirmButton={{
45
- label: t('Delete'),
46
- icon: faTrashCan,
47
- keepOpen: true,
48
- onClick: handOnDelete,
49
- }}
50
- />
51
- );
52
- };
@@ -1,21 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { rootDir } from '../../../utils/RootDir';
3
-
4
- export const useDialogObserver = () => {
5
- const [isDialogOpen, setIsDialogOpen] = useState(false);
6
-
7
- useEffect(() => {
8
- const observer = new MutationObserver(mutationsList => {
9
- if (mutationsList.find(mutation => mutation.type === 'childList')) {
10
- const isDialogInRoot = rootDir.getElementsByClassName('iui-dialog').length > 0;
11
- setIsDialogOpen(isDialogInRoot);
12
- }
13
- });
14
-
15
- observer.observe(rootDir, { childList: true });
16
-
17
- return () => observer.disconnect();
18
- }, []);
19
-
20
- return isDialogOpen;
21
- };
File without changes
File without changes
File without changes
File without changes