@inceptionbg/iui 2.0.7 → 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 (148) hide show
  1. package/dist/NoAccessPage-DBq5IzIf.js +2 -0
  2. package/dist/{NoAccessPage-BozT_Suz.js.map → NoAccessPage-DBq5IzIf.js.map} +1 -1
  3. package/dist/NotFoundPage-DM-I96ar.js +2 -0
  4. package/dist/{NotFoundPage-WWiekDef.js.map → NotFoundPage-DM-I96ar.js.map} +1 -1
  5. package/dist/icons/index.d.ts +2 -2
  6. package/dist/icons/index.js +1 -1
  7. package/dist/index.d.ts +286 -259
  8. package/dist/index.js +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/iui.css +1 -1
  11. package/idea/GridTable/GridTable.tsx +119 -0
  12. package/idea/GridTable/gridTable.scss +42 -0
  13. package/{src/components → idea}/Table/Components/Print/CustomTablePrint.tsx +2 -2
  14. package/{src/components → idea}/Table/Components/Print/TablePrint.tsx +2 -2
  15. package/{src/components → idea}/Table/Components/SetTableFilter.tsx +1 -1
  16. package/{src/components → idea}/Table/Components/TableOptions.tsx +4 -4
  17. package/idea/{Table2 → Table}/Table.tsx +151 -281
  18. package/idea/Table/hooks/useDefaultTemplate.ts +20 -0
  19. package/{src/components → idea}/Table/hooks/useTableKeyboard.ts +1 -2
  20. package/idea/Table/hooks/useTableSelect.ts +11 -0
  21. package/package.json +3 -2
  22. package/src/assets/icons/index.ts +1 -1
  23. package/src/assets/icons/light/faClipboardCheck.ts +15 -0
  24. package/src/assets/icons/light/faHouse.ts +15 -15
  25. package/src/assets/icons/light/faIdBadge.ts +15 -15
  26. package/src/assets/icons/light/faPen.ts +15 -0
  27. package/src/components/Button/IconButton.tsx +3 -1
  28. package/src/components/Dialog/Dialog.tsx +60 -124
  29. package/src/components/Dialog/components/DialogFooter.tsx +92 -0
  30. package/src/components/Dialog/hooks/useDialogKeyboard.ts +6 -5
  31. package/src/components/Header/Components/ModuleSelect.tsx +1 -1
  32. package/src/components/Header/Header.tsx +1 -1
  33. package/src/components/Inputs/DateInput/DateInput.tsx +108 -101
  34. package/src/components/Inputs/DateInput/components/DatePartInput.tsx +7 -3
  35. package/src/components/Inputs/InputWrapper.tsx +6 -1
  36. package/src/components/Inputs/SearchInput.tsx +9 -4
  37. package/src/components/Inputs/Select2/Select.tsx +65 -30
  38. package/src/components/Inputs/Select2/select.scss +13 -14
  39. package/src/components/Inputs/Selects/components/SelectWrapper.tsx +4 -2
  40. package/src/components/Inputs/Selects/utils/selectStyles.ts +9 -12
  41. package/src/components/Menu/Menu.tsx +10 -2
  42. package/src/components/Menu/MenuItem.tsx +11 -10
  43. package/src/components/Menu/hooks/useMenuPosition.tsx +23 -6
  44. package/src/components/Pullover/Pullover.tsx +122 -59
  45. package/src/components/Table/Table.tsx +78 -342
  46. package/src/components/Table/components/edit/TableEditRow.tsx +69 -0
  47. package/src/components/Table/components/filters/FilterItem.tsx +15 -0
  48. package/src/components/Table/components/filters/TableFilters.tsx +125 -0
  49. package/src/components/Table/components/footer/TableFooter.tsx +128 -0
  50. package/src/components/Table/components/header/TableHeader.tsx +42 -0
  51. package/src/components/Table/components/header/TableHeaderRow.tsx +47 -0
  52. package/src/components/Table/components/items/TableItemActions.tsx +66 -0
  53. package/src/components/Table/components/select/TableSelect.tsx +49 -0
  54. package/src/components/Table/components/sort/TableSort.tsx +52 -0
  55. package/src/components/Table/contexts/TableContext.tsx +123 -0
  56. package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +73 -0
  57. package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +78 -0
  58. package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +173 -0
  59. package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +12 -0
  60. package/src/components/Table/hooks/useTableEdit.tsx +111 -0
  61. package/src/components/Table/hooks/useTableFilterFields.tsx +150 -0
  62. package/src/components/Table/hooks/useTablePagination.ts +16 -0
  63. package/src/components/Table/hooks/useTableSearch.ts +29 -0
  64. package/src/components/Table/hooks/useTableSort.ts +8 -0
  65. package/src/components/Tooltip/Tooltip.tsx +1 -1
  66. package/src/components/Wrappers/PageLayout.tsx +13 -18
  67. package/src/hooks/useGetFocusableElements.ts +42 -0
  68. package/src/hooks/useLocalPopoverControl.ts +38 -0
  69. package/src/hooks/usePopupControl.ts +13 -0
  70. package/src/index.ts +53 -39
  71. package/src/styles/common/_typography.scss +3 -0
  72. package/src/styles/common/helpers/_size.scss +1 -1
  73. package/src/styles/components/_accordions.scss +1 -1
  74. package/src/styles/components/_badge.scss +4 -3
  75. package/src/styles/components/_card.scss +1 -1
  76. package/src/styles/components/_dialog.scss +15 -13
  77. package/src/styles/components/_input.scss +1 -1
  78. package/src/styles/components/_inputCheckbox.scss +1 -1
  79. package/src/styles/components/_inputDateTime.scss +2 -2
  80. package/src/styles/components/_inputRadio.scss +1 -1
  81. package/src/styles/components/_inputSelect.scss +6 -4
  82. package/src/styles/components/_menu-v2.scss +1 -1
  83. package/src/styles/components/_menu.scss +23 -15
  84. package/src/styles/components/_page.scss +3 -2
  85. package/src/styles/components/_pullover.scss +74 -18
  86. package/src/styles/components/_table.scss +151 -142
  87. package/src/styles/components/_widget.scss +1 -1
  88. package/src/styles/variables/_bp.scss +1 -0
  89. package/src/styles/variables/_variables.scss +4 -2
  90. package/src/types/IKeyboard.ts +2 -1
  91. package/src/types/IMenu.ts +1 -0
  92. package/src/types/ISelect.ts +1 -0
  93. package/src/types/ITable.ts +87 -80
  94. package/src/utils/fileUtils.ts +7 -6
  95. package/src/utils/i18n/i18nIUICyrilic.ts +4 -0
  96. package/src/utils/i18n/i18nIUILatin.ts +3 -1
  97. package/src/utils/i18n/i18nIUIMe.ts +4 -0
  98. package/src/utils/{ObjectUtils.ts → objectUtils.ts} +8 -8
  99. package/src/utils/popupUtils.ts +82 -0
  100. package/src/utils/{TableUtils.ts → tableUtils.ts} +5 -5
  101. package/src/utils/{Toasts.ts → toasts.ts} +6 -6
  102. package/src/utils/{UrlUtils.ts → urlUtils.ts} +4 -4
  103. package/dist/NoAccessPage-BozT_Suz.js +0 -2
  104. package/dist/NotFoundPage-WWiekDef.js +0 -2
  105. package/idea/Table2/Components/Columns/ColumnsList.tsx +0 -56
  106. package/idea/Table2/Components/Columns/SetColumnsList.tsx +0 -107
  107. package/idea/Table2/Components/Edit/ItemActionsMenu.tsx +0 -87
  108. package/idea/Table2/Components/Edit/ItemEditOptionsButtons.tsx +0 -32
  109. package/idea/Table2/Components/Edit/TableEditRow.tsx +0 -56
  110. package/idea/Table2/Components/FilterItem.tsx +0 -20
  111. package/idea/Table2/Components/Header/TableHeader.tsx +0 -35
  112. package/idea/Table2/Components/Header/TableHeaderRow.tsx +0 -37
  113. package/idea/Table2/Components/Print/CustomTablePrint.tsx +0 -119
  114. package/idea/Table2/Components/Print/TablePrint.tsx +0 -208
  115. package/idea/Table2/Components/SetSortList.tsx +0 -33
  116. package/idea/Table2/Components/SetTableFilter.tsx +0 -90
  117. package/idea/Table2/Components/TableFooter.tsx +0 -107
  118. package/idea/Table2/Components/TableOptions.tsx +0 -211
  119. package/idea/Table2/Components/Templates/TemplateCreate.tsx +0 -75
  120. package/idea/Table2/Components/Templates/TemplateCreateDefault.tsx +0 -45
  121. package/idea/Table2/Components/Templates/TemplateList.tsx +0 -167
  122. package/idea/Table2/Components/Templates/repo/TemplateRepo.ts +0 -51
  123. package/idea/Table2/_table.scss +0 -300
  124. package/idea/Table2/hooks/useDefaultTemplate.ts +0 -22
  125. package/idea/Table2/hooks/useTableKeyboard.ts +0 -115
  126. package/src/assets/icons/light/faPenField.ts +0 -15
  127. package/src/assets/icons/solid/faMagnifyingGlass.ts +0 -15
  128. package/src/components/Dialog/DeleteItemDialog.tsx +0 -52
  129. package/src/components/Dialog/hooks/useDialogObserver.ts +0 -21
  130. /package/{src/components → idea}/Table/Components/Columns/ColumnsList.tsx +0 -0
  131. /package/{src/components → idea}/Table/Components/Columns/SetColumnsList.tsx +0 -0
  132. /package/{src/components → idea}/Table/Components/Edit/ItemActionsMenu.tsx +0 -0
  133. /package/{src/components → idea}/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -0
  134. /package/{src/components → idea}/Table/Components/Edit/TableEditRow.tsx +0 -0
  135. /package/{src/components → idea}/Table/Components/FilterItem.tsx +0 -0
  136. /package/{src/components → idea}/Table/Components/Header/TableHeader.tsx +0 -0
  137. /package/{src/components → idea}/Table/Components/Header/TableHeaderRow.tsx +0 -0
  138. /package/{src/components → idea}/Table/Components/SetSortList.tsx +0 -0
  139. /package/{src/components → idea}/Table/Components/TableFooter.tsx +0 -0
  140. /package/{src/components → idea}/Table/Components/Templates/TemplateCreate.tsx +0 -0
  141. /package/{src/components → idea}/Table/Components/Templates/TemplateCreateDefault.tsx +0 -0
  142. /package/{src/components → idea}/Table/Components/Templates/TemplateList.tsx +0 -0
  143. /package/{src/components → idea}/Table/Components/Templates/repo/TemplateRepo.ts +0 -0
  144. /package/src/utils/{DateUtils.ts → dateUtils.ts} +0 -0
  145. /package/src/utils/{LocalStorageHelper.ts → localStorageHelper.ts} +0 -0
  146. /package/src/utils/{NumberUtils.ts → numberUtils.ts} +0 -0
  147. /package/src/utils/{RootDir.ts → rootDir.ts} +0 -0
  148. /package/src/utils/{StringUtils.ts → stringUtils.ts} +0 -0
@@ -1,73 +1,72 @@
1
- import {
2
- Dispatch,
3
- FunctionComponent,
4
- MouseEvent,
5
- ReactElement,
6
- ReactNode,
7
- RefObject,
8
- SetStateAction,
9
- } from 'react';
1
+ import { Dispatch, MouseEvent, ReactElement, ReactNode, SetStateAction } from 'react';
10
2
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
11
3
  import { IAnyObject, ISimpleObject } from './IBasic';
12
4
  import { ITableKeyboardActionsBase } from './IKeyboard';
13
5
 
14
6
  export interface ITable {
15
7
  columns: ITableColumn[];
16
- setColumns?: (data: ITableColumn[]) => void;
17
- withColumnsSearch?: boolean;
8
+ // setColumns?: (data: ITableColumn[]) => void;
9
+ // withColumnsSearch?: boolean;
18
10
  customHeader?: ITableColumn[][];
19
11
  data: ITableDataItem[];
12
+ dataActions?: {
13
+ edit?: {
14
+ hasAccess: boolean;
15
+ };
16
+ delete?: {
17
+ onClick: (itemUuid: string) => void;
18
+ hasAccess: boolean;
19
+ };
20
+ actions?: {
21
+ label: string;
22
+ onClick: (item: ITableDataItem) => void;
23
+ hasAccess: boolean;
24
+ }[];
25
+ };
20
26
  sumRows?: ITableDataItem[];
21
27
  isLoading?: boolean;
22
- serverSidePagination?: IServerSidePagination;
23
- customPagination?: {
24
- defaultLimit?: number;
25
- customLimit?: number[];
26
- };
27
- selectedRowUuid?: string;
28
- footerAction?: {
29
- icon?: IconDefinition;
30
- onClick: () => void;
31
- };
28
+
32
29
  headerWrap?: boolean;
33
- hideFooter?: boolean;
34
- noTotalRows?: boolean;
35
- showLastBorder?: boolean;
36
- filterData?: ITableFilterData;
37
- sortData?: ITableSortData;
38
- printData?: IPrintData;
39
- customPrintData?: ICustomPrintData;
40
- additionsalOptions?: ReactNode;
30
+ selectedRowUuid?: string;
41
31
  rowSelect?: {
42
32
  selectedRows: Set<string>;
43
33
  setSelectedRows: Dispatch<SetStateAction<Set<string>>>;
44
34
  actions: ITableSelectedActions[];
45
35
  };
46
- className?: string;
47
- rowHeight?: 'xs' | 's' | 'm';
48
- maxHeight?: string;
49
- editable?: {
50
- selectedItem?: any;
51
- setSelectedItem?: (item: any) => void;
52
- defaultDataValue?: any;
53
- EditableRow?: FunctionComponent<ITableEditRow>;
54
- onSubmit: (data: any, onSubmitCallback: () => void) => void;
55
- addDisabled?: boolean;
56
- addLabel?: string;
57
- inputFocusRef?: RefObject<any>;
58
- keepEditOnSubmit?: boolean;
59
- };
36
+ filterData?: ITableFilterData;
37
+ sortData?: ITableSortData;
38
+ // printData?: IPrintData;
39
+ // customPrintData?: ICustomPrintData;
40
+ // additionsalOptions?: ReactNode;
41
+ editable?: ITableEdit;
60
42
  keyboard?: {
61
43
  enabled: boolean;
62
44
  actions: ITableKeyboardActionsBase;
63
45
  };
64
- templates?: {
65
- identifier: string;
66
- data: IReportTemplateData;
67
- setTemplateName?: (templateName: string) => void;
68
- onClearFilters: () => void;
69
- allowPublicCreate?: boolean;
46
+ footer?: {
47
+ paginationControl?: IPaginationControl;
48
+ customPagination?: {
49
+ defaultLimit?: number;
50
+ customLimit?: number[];
51
+ };
52
+ totalRows?: number;
53
+ // noTotalRows?: boolean;
54
+ footerAction?: {
55
+ icon?: IconDefinition;
56
+ onClick: () => void;
57
+ };
70
58
  };
59
+
60
+ className?: string;
61
+ rowHeight?: 'xs' | 's' | 'm';
62
+ maxHeight?: string;
63
+ // templates?: {
64
+ // identifier: string;
65
+ // data: IReportTemplateData;
66
+ // setTemplateName?: (templateName: string) => void;
67
+ // onClearFilters: () => void;
68
+ // allowPublicCreate?: boolean;
69
+ // };
71
70
  }
72
71
 
73
72
  export interface ITableColumn {
@@ -88,7 +87,8 @@ export interface ITableColumn {
88
87
  desc: string;
89
88
  label: string;
90
89
  };
91
- code?: string;
90
+ // code?: string;
91
+ className?: string;
92
92
  }
93
93
 
94
94
  export interface ITableDataItem {
@@ -97,42 +97,42 @@ export interface ITableDataItem {
97
97
  className?: string;
98
98
  item?: Record<string, any>;
99
99
  disableSelect?: boolean;
100
- cells: {
101
- [id: string]: {
102
- value: any;
103
- align?: ITableColumn['align'];
104
- className?: string;
105
- onClick?: (event?: MouseEvent<HTMLTableCellElement>) => void;
106
- link?: boolean;
107
- tooltip?: string;
108
- span?: number;
109
- unclickable?: boolean;
110
- printValue?: string;
111
- };
112
- };
100
+ cells: ITableDataItemCells;
113
101
  extendable?: {
114
102
  element: ReactElement;
115
103
  isLoading?: boolean;
116
104
  };
117
105
  }
106
+ export interface ITableDataItemCells {
107
+ [id: string]: {
108
+ value: any;
109
+ align?: ITableColumn['align'];
110
+ className?: string;
111
+ onClick?: (event?: MouseEvent<HTMLTableCellElement>) => void;
112
+ link?: boolean;
113
+ tooltip?: string;
114
+ span?: number;
115
+ unclickable?: boolean;
116
+ printValue?: string;
117
+ };
118
+ }
118
119
 
119
120
  export interface ITableFilterData {
120
- columns: string[];
121
121
  filters: ITableFilter;
122
+ customFilterIdList?: string[];
122
123
  activeFilterNo?: number;
123
124
  additionalFilters?: ReactElement;
125
+ defaultSearch?: IAnyObject;
124
126
  search: IAnyObject;
125
127
  searchData: IAnyObject;
126
128
  setSearchData: (search: IAnyObject) => void;
127
- onSubmit: (search: IAnyObject) => void;
128
- resetData?: IAnyObject;
129
+ onSearch: (search: IAnyObject) => void;
129
130
  excludeFromSearch?: string[];
130
131
  }
131
132
 
132
133
  export interface ITableFilterItem {
133
134
  label: string;
134
135
  field: ReactElement;
135
- resetField: () => void;
136
136
  }
137
137
  export interface ITableFilter {
138
138
  [id: string]: ITableFilterItem;
@@ -146,8 +146,7 @@ export interface ITableSortData {
146
146
  }
147
147
  export interface ITableSort {
148
148
  label: string;
149
- asc: string;
150
- desc: string;
149
+ value: string;
151
150
  }
152
151
 
153
152
  export interface ITableColumnsData {
@@ -162,6 +161,22 @@ export interface ITableSelectedActions {
162
161
  disabled?: boolean;
163
162
  clearSelected?: boolean;
164
163
  }
164
+
165
+ ///// EDIT /////
166
+ export interface ITableEdit<T = any> {
167
+ selectedItem: T | null;
168
+ setSelectedItem: (item: T | null) => void;
169
+ editData: Partial<T>;
170
+ setEditData: Dispatch<SetStateAction<Partial<T>>>;
171
+ onSubmit: (data: T, onSubmitCallback: () => void) => void;
172
+ cells: ITableDataItemCells;
173
+ defaultDataValue?: T;
174
+ addDisabled?: boolean;
175
+ addLabel?: string;
176
+ // inputFocusRef?: RefObject<any>;
177
+ keepEditOnSubmit?: boolean;
178
+ }
179
+
165
180
  ///// PRINT /////
166
181
  export interface IBasePrintData {
167
182
  label: string;
@@ -194,27 +209,19 @@ export interface IPrintData extends IBasePrintData {
194
209
  }
195
210
  ///////////////
196
211
 
212
+ ///// PAGINATION /////
197
213
  export interface IPagination {
198
214
  limit: number;
199
215
  offset: number;
200
216
  }
201
- export interface IServerSidePagination {
217
+ export interface IPaginationControl {
202
218
  limit: number;
203
219
  offset: number;
204
220
  setLimit: Dispatch<SetStateAction<number>>;
205
221
  setOffset: Dispatch<SetStateAction<number>>;
206
- totalRows: number;
207
222
  }
208
223
 
209
- export interface ITableEditRow {
210
- columns: ITableColumn[];
211
- data: any;
212
- setData: (data: any) => void;
213
- item?: any;
214
- clearItem: () => void;
215
- defaultDataValue?: any;
216
- inputFocusRef?: RefObject<any>;
217
- }
224
+ ///// REPORT TEMPLATE /////
218
225
 
219
226
  export interface IReportTemplate {
220
227
  uuid: string;
@@ -1,8 +1,8 @@
1
- import i18next from 'i18next';
1
+ // import i18next from 'i18next';
2
2
  import { IBooleanObject } from '../types/IBasic';
3
- import { lsGet } from './LocalStorageHelper';
4
- import { convertBooleanObjectToArray } from './ObjectUtils';
5
- import { toastError } from './Toasts';
3
+ import { lsGet } from './localStorageHelper';
4
+ import { convertBooleanObjectToArray } from './objectUtils';
5
+ import { toastError } from './toasts';
6
6
 
7
7
  export const sizeInBytesPretty = (bytes?: number) => {
8
8
  if (bytes === 0) {
@@ -72,7 +72,8 @@ export const downloadDocumentFile = (
72
72
  link.href = window.URL.createObjectURL(blob);
73
73
  link.download = `${fileName}.${type}`;
74
74
  link.click();
75
- } else toastError(i18next.t('ErrorMessage'));
75
+ }
76
+ // else toastError(i18next.t('ErrorMessage'));
76
77
  };
77
78
 
78
79
  req.send();
@@ -168,7 +169,7 @@ export function downloadFile({
168
169
  document.body.removeChild(a);
169
170
  };
170
171
  req.onloadend = function () {
171
- console.log('Finished downloading file');
172
+ console.info('Finished downloading file');
172
173
  onSuccess?.();
173
174
  setIsLoading?.(false);
174
175
  };
@@ -1,5 +1,7 @@
1
1
  export const i18nIUICyrilic = {
2
2
  ////// BASIC //////
3
+ HomePage: 'Почетна',
4
+
3
5
  // Accept: 'Прихвати',
4
6
  Actions: 'Акције',
5
7
  Active: 'Активан',
@@ -37,7 +39,9 @@ export const i18nIUICyrilic = {
37
39
  Columns: 'Колоне',
38
40
  DragDropListsInfo:
39
41
  'Одаберите колоне за приказивање превлачењем са једне листе на другу',
42
+ TableSelect: 'Акције над изабраним елементима',
40
43
  Filter: 'Филтери',
44
+ ApplyFilters: 'Примени филтере',
41
45
  HiddenColumns: 'Сакривене колоне',
42
46
  NoResults: 'Нема резултата',
43
47
  of: 'од',
@@ -1,8 +1,8 @@
1
1
  export const i18nIUILatin = {
2
2
  ////// BASIC //////
3
- // Accept: 'Prihvati',
4
3
  HomePage: 'Početna',
5
4
 
5
+ // Accept: 'Prihvati',
6
6
  Actions: 'Akcije',
7
7
  Active: 'Aktivan',
8
8
  AddInput: 'Unesi',
@@ -39,7 +39,9 @@ export const i18nIUILatin = {
39
39
  Columns: 'Kolone',
40
40
  DragDropListsInfo:
41
41
  'Odaberite kolone za prikazivanje prevlačenjem sa jedne liste na drugu',
42
+ TableSelect: 'Akcije nad izabranim elementima',
42
43
  Filter: 'Filteri',
44
+ ApplyFilters: 'Primeni filtere',
43
45
  HiddenColumns: 'Sakrivene kolone',
44
46
  NoResults: 'Nema rezultata',
45
47
  of: 'od',
@@ -1,5 +1,7 @@
1
1
  export const i18nIUIMe = {
2
2
  ////// BASIC //////
3
+ HomePage: 'Početna',
4
+
3
5
  Actions: 'Akcije',
4
6
  Active: 'Aktivan',
5
7
  AddInput: 'Unesi',
@@ -35,7 +37,9 @@ export const i18nIUIMe = {
35
37
  allResults: 'Svi',
36
38
  Columns: 'Kolone',
37
39
  DragDropListsInfo: 'Izaberite kolone za prikaz prevlačenjem sa jedne liste na drugu',
40
+ TableSelect: 'Akcije nad izabranim elementima',
38
41
  Filter: 'Filteri',
42
+ ApplyFilters: 'Primijeni filtere',
39
43
  HiddenColumns: 'Skrivene kolone',
40
44
  NoResults: 'Nema rezultata',
41
45
  of: 'od',
@@ -1,5 +1,7 @@
1
1
  import { IBooleanObject } from '../types/IBasic';
2
2
 
3
+ export const hasValue = (value: any) => ![null, undefined, ''].includes(value);
4
+
3
5
  export const deleteProps = <T extends Record<string, any>>(
4
6
  obj: T,
5
7
  props: (keyof T)[]
@@ -25,9 +27,7 @@ export const deletePropsThatEndsWith = <T extends Record<string, any>>(
25
27
  export const deleteEmptyProps = <T extends Record<string, any>>(obj: T): T =>
26
28
  Object.entries(obj).reduce(
27
29
  (updatedObj, [key, value]) =>
28
- [null, undefined, ''].includes(value)
29
- ? updatedObj
30
- : ((updatedObj[key as keyof T] = value), updatedObj),
30
+ hasValue(value) ? ((updatedObj[key as keyof T] = value), updatedObj) : updatedObj,
31
31
  {} as T
32
32
  );
33
33
 
@@ -36,7 +36,7 @@ export const deleteEmptyPropsIncludingArray = <T extends Record<string, any>>(
36
36
  ): T =>
37
37
  Object.entries(obj).reduce(
38
38
  (updatedObj, [key, value]) =>
39
- [null, undefined, ''].includes(value) || (Array.isArray(value) && !value.length)
39
+ !hasValue(value) || (Array.isArray(value) && !value.length)
40
40
  ? updatedObj
41
41
  : ((updatedObj[key as keyof T] = value), updatedObj),
42
42
  {} as T
@@ -69,10 +69,10 @@ export const compareArrayItemsIndex = <T>(
69
69
  (comparison === 'greaterThan'
70
70
  ? index1 > index2
71
71
  : comparison === 'greaterThanOrEqualTo'
72
- ? index1 >= index2
73
- : comparison === 'lessThan'
74
- ? index1 < index2
75
- : index1 <= index2)
72
+ ? index1 >= index2
73
+ : comparison === 'lessThan'
74
+ ? index1 < index2
75
+ : index1 <= index2)
76
76
  );
77
77
  };
78
78
 
@@ -0,0 +1,82 @@
1
+ import { KeyboardEvent } from 'react';
2
+ import { IKeyboardAction } from '../types/IKeyboard';
3
+
4
+ export const onPopupKeyDown = (
5
+ event: KeyboardEvent<HTMLDivElement>,
6
+ {
7
+ onClose,
8
+ enter,
9
+ search,
10
+ focusableElements,
11
+ }: {
12
+ onClose: () => void;
13
+ enter?: {
14
+ onAction: () => void;
15
+ disabled?: boolean;
16
+ };
17
+ search?: {
18
+ onAction: () => void;
19
+ disabled?: boolean;
20
+ };
21
+ focusableElements?: HTMLElement[];
22
+ }
23
+ ) => {
24
+ event.stopPropagation();
25
+ const actions: IKeyboardAction[] = [
26
+ {
27
+ code: 'Enter',
28
+ onAction: () => enter?.onAction(),
29
+ disabled: !enter || !!enter.disabled,
30
+ },
31
+ { code: 'Escape', onAction: onClose },
32
+ {
33
+ code: 'KeyF',
34
+ ctrl: true,
35
+ onAction: () => {
36
+ event.preventDefault();
37
+ search?.onAction();
38
+ },
39
+ disabled: !search || !!search.disabled,
40
+ },
41
+ {
42
+ code: 'Tab',
43
+ onAction: () => {
44
+ if (focusableElements?.length) {
45
+ const first = focusableElements[0];
46
+ const last = focusableElements[focusableElements.length - 1];
47
+ if (document.activeElement === last) {
48
+ event.preventDefault();
49
+ first.focus();
50
+ }
51
+ }
52
+ },
53
+ disabled: !focusableElements?.length,
54
+ },
55
+ {
56
+ code: 'Tab',
57
+ shift: true,
58
+ onAction: () => {
59
+ if (focusableElements?.length) {
60
+ const first = focusableElements[0];
61
+ const last = focusableElements[focusableElements.length - 1];
62
+ if (document.activeElement === first) {
63
+ event.preventDefault();
64
+ last.focus();
65
+ }
66
+ }
67
+ },
68
+ disabled: !focusableElements?.length,
69
+ },
70
+ ];
71
+
72
+ actions.forEach(item => {
73
+ if (
74
+ !item.disabled &&
75
+ item.code === event.code &&
76
+ !!item.shift === event.shiftKey &&
77
+ !!item.ctrl === (event.ctrlKey || event.metaKey)
78
+ ) {
79
+ item.onAction();
80
+ }
81
+ });
82
+ };
@@ -76,10 +76,10 @@ export const convertReportTemplateFilterToSearch = (
76
76
  label: template.name,
77
77
  }
78
78
  : template.type === 'ARRAY'
79
- ? JSON.parse(template.value)
80
- : template.type === 'BOOLEAN'
81
- ? template.value === 'true'
82
- : template.value;
79
+ ? JSON.parse(template.value)
80
+ : template.type === 'BOOLEAN'
81
+ ? template.value === 'true'
82
+ : template.value;
83
83
  });
84
84
  return search;
85
85
  };
@@ -97,7 +97,7 @@ export const setTemplateData = ({
97
97
  }) => {
98
98
  const newFilters =
99
99
  template.filterValues && convertReportTemplateFilterToSearch(template.filterValues);
100
- newFilters && setFilters && setFilters(newFilters);
100
+ newFilters && setFilters?.(newFilters);
101
101
  template.columns &&
102
102
  columnsData?.setColumns(
103
103
  getVisibleColumnsFromList(columnsData.columns, template.columns)
@@ -1,6 +1,6 @@
1
- import { toast } from 'react-toastify';
2
-
3
- export const toastSuccess = (message: string) => toast.success(message);
4
- export const toastError = (message: string) => toast.error(message, { autoClose: false });
5
- // export const toastInfo = (message: string) => toast.info(message);
6
- // export const toastWarn = (message: string) => toast.warn(message);
1
+ import { toast } from 'react-toastify';
2
+
3
+ export const toastSuccess = (message: string) => toast.success(message);
4
+ export const toastError = (message: string) => toast.error(message, { autoClose: false });
5
+ // export const toastInfo = (message: string) => toast.info(message);
6
+ // export const toastWarn = (message: string) => toast.warn(message);
@@ -1,4 +1,4 @@
1
- export const parseUrlSearch = (search: string) => {
2
- const urlSearchParams = new URLSearchParams(search);
3
- return Object.fromEntries(urlSearchParams.entries());
4
- };
1
+ export const parseUrlSearch = (search: string) => {
2
+ const urlSearchParams = new URLSearchParams(search);
3
+ return Object.fromEntries(urlSearchParams.entries());
4
+ };
@@ -1,2 +0,0 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useTranslation as r}from"react-i18next";import{Link as i}from"react-router";import{Button as a}from"./index.js";import"@fortawesome/react-fontawesome";import"clsx";import"dayjs";import"react-beautiful-dnd";import"react-toastify";import"react";import"react-dom";import"react-calendar";import"react-select";import"react-select-async-paginate";import"react-select/async-creatable";import"i18next";const c=()=>{const{t:c}=r();return e("div",{className:"full-screen-page",children:[e("div",{id:"content",children:[t("h1",{children:c("NoAccessPage")}),t("p",{className:"subtitle",children:c("NoAccessPageInfo")})]}),t("p",{id:"img",className:"img-403",children:"403"}),t("div",{id:"actions",children:t(i,{to:"/",children:t(a,{label:c("ReturnToHomepage")})})})]})};export{c as default};
2
- //# sourceMappingURL=NoAccessPage-BozT_Suz.js.map