@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.
- package/dist/icons/index.d.ts +2 -2
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +286 -259
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/iui.css +1 -1
- package/idea/GridTable/GridTable.tsx +119 -0
- package/idea/GridTable/gridTable.scss +42 -0
- package/{src/components → idea}/Table/Components/Print/CustomTablePrint.tsx +2 -2
- package/{src/components → idea}/Table/Components/Print/TablePrint.tsx +2 -2
- package/{src/components → idea}/Table/Components/SetTableFilter.tsx +1 -1
- package/{src/components → idea}/Table/Components/TableOptions.tsx +4 -4
- package/idea/{Table2 → Table}/Table.tsx +151 -281
- package/idea/Table/hooks/useDefaultTemplate.ts +20 -0
- package/{src/components → idea}/Table/hooks/useTableKeyboard.ts +1 -2
- package/idea/Table/hooks/useTableSelect.ts +11 -0
- package/package.json +1 -1
- package/src/assets/icons/index.ts +1 -1
- package/src/assets/icons/light/faClipboardCheck.ts +15 -0
- package/src/assets/icons/light/faHouse.ts +15 -15
- package/src/assets/icons/light/faIdBadge.ts +15 -15
- package/src/assets/icons/light/faPen.ts +15 -0
- package/src/components/Button/IconButton.tsx +3 -1
- package/src/components/Dialog/Dialog.tsx +59 -123
- package/src/components/Dialog/components/DialogFooter.tsx +92 -0
- package/src/components/Dialog/hooks/useDialogKeyboard.ts +6 -5
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Inputs/DateInput/DateInput.tsx +108 -102
- package/src/components/Inputs/DateInput/components/DatePartInput.tsx +7 -3
- package/src/components/Inputs/InputWrapper.tsx +6 -1
- package/src/components/Inputs/SearchInput.tsx +9 -4
- package/src/components/Inputs/Select2/Select.tsx +65 -30
- package/src/components/Inputs/Select2/select.scss +13 -14
- package/src/components/Inputs/Selects/components/SelectWrapper.tsx +4 -2
- package/src/components/Inputs/Selects/utils/selectStyles.ts +9 -12
- package/src/components/Menu/Menu.tsx +10 -2
- package/src/components/Menu/MenuItem.tsx +11 -10
- package/src/components/Menu/hooks/useMenuPosition.tsx +23 -6
- package/src/components/Pullover/Pullover.tsx +122 -59
- package/src/components/Table/Table.tsx +78 -342
- package/src/components/Table/components/edit/TableEditRow.tsx +69 -0
- package/src/components/Table/components/filters/FilterItem.tsx +15 -0
- package/src/components/Table/components/filters/TableFilters.tsx +125 -0
- package/src/components/Table/components/footer/TableFooter.tsx +128 -0
- package/src/components/Table/components/header/TableHeader.tsx +42 -0
- package/src/components/Table/components/header/TableHeaderRow.tsx +47 -0
- package/src/components/Table/components/items/TableItemActions.tsx +66 -0
- package/src/components/Table/components/select/TableSelect.tsx +49 -0
- package/src/components/Table/components/sort/TableSort.tsx +52 -0
- package/src/components/Table/contexts/TableContext.tsx +123 -0
- package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +73 -0
- package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +78 -0
- package/src/components/Table/hooks/localHooks/useLocalTableKeyboard.ts +173 -0
- package/src/components/Table/hooks/localHooks/useLocalTablePagination.ts +12 -0
- package/src/components/Table/hooks/useTableEdit.tsx +111 -0
- package/src/components/Table/hooks/useTableFilterFields.tsx +150 -0
- package/src/components/Table/hooks/useTablePagination.ts +16 -0
- package/src/components/Table/hooks/useTableSearch.ts +29 -0
- package/src/components/Table/hooks/useTableSort.ts +8 -0
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/Wrappers/PageLayout.tsx +9 -12
- package/src/hooks/useGetFocusableElements.ts +42 -0
- package/src/hooks/useLocalPopoverControl.ts +38 -0
- package/src/hooks/usePopupControl.ts +13 -0
- package/src/index.ts +53 -39
- package/src/styles/components/_accordions.scss +1 -1
- package/src/styles/components/_badge.scss +4 -3
- package/src/styles/components/_card.scss +1 -1
- package/src/styles/components/_dialog.scss +8 -8
- package/src/styles/components/_input.scss +1 -1
- package/src/styles/components/_inputCheckbox.scss +1 -1
- package/src/styles/components/_inputDateTime.scss +2 -2
- package/src/styles/components/_inputRadio.scss +1 -1
- package/src/styles/components/_inputSelect.scss +6 -4
- package/src/styles/components/_menu-v2.scss +1 -1
- package/src/styles/components/_menu.scss +23 -15
- package/src/styles/components/_pullover.scss +74 -18
- package/src/styles/components/_table.scss +151 -142
- package/src/styles/components/_widget.scss +1 -1
- package/src/styles/variables/_bp.scss +1 -0
- package/src/styles/variables/_variables.scss +4 -2
- package/src/types/IKeyboard.ts +2 -1
- package/src/types/IMenu.ts +1 -0
- package/src/types/ISelect.ts +1 -0
- package/src/types/ITable.ts +87 -80
- package/src/utils/fileUtils.ts +3 -3
- package/src/utils/i18n/i18nIUICyrilic.ts +4 -0
- package/src/utils/i18n/i18nIUILatin.ts +3 -1
- package/src/utils/i18n/i18nIUIMe.ts +4 -0
- package/src/utils/{ObjectUtils.ts → objectUtils.ts} +8 -8
- package/src/utils/popupUtils.ts +82 -0
- package/src/utils/{TableUtils.ts → tableUtils.ts} +5 -5
- package/src/utils/{Toasts.ts → toasts.ts} +6 -6
- package/src/utils/{UrlUtils.ts → urlUtils.ts} +4 -4
- package/idea/Table2/Components/Columns/ColumnsList.tsx +0 -56
- package/idea/Table2/Components/Columns/SetColumnsList.tsx +0 -107
- package/idea/Table2/Components/Edit/ItemActionsMenu.tsx +0 -87
- package/idea/Table2/Components/Edit/ItemEditOptionsButtons.tsx +0 -32
- package/idea/Table2/Components/Edit/TableEditRow.tsx +0 -56
- package/idea/Table2/Components/FilterItem.tsx +0 -20
- package/idea/Table2/Components/Header/TableHeader.tsx +0 -35
- package/idea/Table2/Components/Header/TableHeaderRow.tsx +0 -37
- package/idea/Table2/Components/Print/CustomTablePrint.tsx +0 -119
- package/idea/Table2/Components/Print/TablePrint.tsx +0 -208
- package/idea/Table2/Components/SetSortList.tsx +0 -33
- package/idea/Table2/Components/SetTableFilter.tsx +0 -90
- package/idea/Table2/Components/TableFooter.tsx +0 -107
- package/idea/Table2/Components/TableOptions.tsx +0 -211
- package/idea/Table2/Components/Templates/TemplateCreate.tsx +0 -75
- package/idea/Table2/Components/Templates/TemplateCreateDefault.tsx +0 -45
- package/idea/Table2/Components/Templates/TemplateList.tsx +0 -167
- package/idea/Table2/Components/Templates/repo/TemplateRepo.ts +0 -51
- package/idea/Table2/_table.scss +0 -300
- package/idea/Table2/hooks/useDefaultTemplate.ts +0 -22
- package/idea/Table2/hooks/useTableKeyboard.ts +0 -115
- package/src/assets/icons/light/faPenField.ts +0 -15
- package/src/assets/icons/solid/faMagnifyingGlass.ts +0 -15
- package/src/components/Dialog/DeleteItemDialog.tsx +0 -52
- package/src/components/Dialog/hooks/useDialogObserver.ts +0 -21
- /package/{src/components → idea}/Table/Components/Columns/ColumnsList.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Columns/SetColumnsList.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Edit/ItemActionsMenu.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Edit/ItemEditOptionsButtons.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Edit/TableEditRow.tsx +0 -0
- /package/{src/components → idea}/Table/Components/FilterItem.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Header/TableHeader.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Header/TableHeaderRow.tsx +0 -0
- /package/{src/components → idea}/Table/Components/SetSortList.tsx +0 -0
- /package/{src/components → idea}/Table/Components/TableFooter.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Templates/TemplateCreate.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Templates/TemplateCreateDefault.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Templates/TemplateList.tsx +0 -0
- /package/{src/components → idea}/Table/Components/Templates/repo/TemplateRepo.ts +0 -0
- /package/src/utils/{DateUtils.ts → dateUtils.ts} +0 -0
- /package/src/utils/{LocalStorageHelper.ts → localStorageHelper.ts} +0 -0
- /package/src/utils/{NumberUtils.ts → numberUtils.ts} +0 -0
- /package/src/utils/{RootDir.ts → rootDir.ts} +0 -0
- /package/src/utils/{StringUtils.ts → stringUtils.ts} +0 -0
package/src/types/ITable.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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;
|
package/src/utils/fileUtils.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// import i18next from 'i18next';
|
|
2
2
|
import { IBooleanObject } from '../types/IBasic';
|
|
3
|
-
import { lsGet } from './
|
|
4
|
-
import { convertBooleanObjectToArray } from './
|
|
5
|
-
import { toastError } from './
|
|
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) {
|
|
@@ -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
|
-
[
|
|
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
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
|
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,56 +0,0 @@
|
|
|
1
|
-
import { FC, useEffect, useState } from 'react';
|
|
2
|
-
import { ITableColumn } from '../../../../types/ITable';
|
|
3
|
-
import { Draggable, Droppable } from 'react-beautiful-dnd';
|
|
4
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
import { faGripDotsVertical } from '../../../../icons/solid/faGripDotsVertical';
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
id: 'hidden' | 'visible';
|
|
9
|
-
items: ITableColumn[];
|
|
10
|
-
search: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const ColumnsList: FC<Props> = ({ id, items, search }) => {
|
|
14
|
-
const [filteredItems, setFilteredItems] = useState<ITableColumn[]>([]);
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
search.length &&
|
|
18
|
-
setFilteredItems(
|
|
19
|
-
items.filter(e =>
|
|
20
|
-
(typeof e.label === 'string' ? e.label : e.labelForFilter ?? '')
|
|
21
|
-
.toLocaleLowerCase()
|
|
22
|
-
.includes(search.toLocaleLowerCase())
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
}, [search, items]);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Droppable droppableId={id}>
|
|
29
|
-
{({ droppableProps, innerRef, placeholder }) => (
|
|
30
|
-
<div {...droppableProps} ref={innerRef} className="list-box">
|
|
31
|
-
{(search.length ? filteredItems : items).map(c => (
|
|
32
|
-
<Draggable key={c.id} draggableId={c.id} index={items.indexOf(c)}>
|
|
33
|
-
{({ innerRef, draggableProps, dragHandleProps }) => (
|
|
34
|
-
<div
|
|
35
|
-
className="item"
|
|
36
|
-
ref={innerRef}
|
|
37
|
-
{...draggableProps}
|
|
38
|
-
{...dragHandleProps}
|
|
39
|
-
style={{
|
|
40
|
-
...draggableProps.style,
|
|
41
|
-
top: 'unset',
|
|
42
|
-
left: 'unset',
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
{c.label}
|
|
46
|
-
<FontAwesomeIcon icon={faGripDotsVertical} />
|
|
47
|
-
</div>
|
|
48
|
-
)}
|
|
49
|
-
</Draggable>
|
|
50
|
-
))}
|
|
51
|
-
{placeholder}
|
|
52
|
-
</div>
|
|
53
|
-
)}
|
|
54
|
-
</Droppable>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { FC, useEffect, useState } from 'react';
|
|
2
|
-
import { DragDropContext, OnDragEndResponder } from 'react-beautiful-dnd';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import { ITableColumn } from '../../../../types/ITable';
|
|
5
|
-
import { Dialog } from '../../../Dialog/Dialog';
|
|
6
|
-
import { faArrowRightArrowLeft } from '../../../../icons/regular/faArrowRightArrowLeft';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
import { ColumnsList } from './ColumnsList';
|
|
9
|
-
import { SearchInput } from '../../../Inputs/SearchInput';
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
columns: ITableColumn[];
|
|
13
|
-
setColumns: (data: ITableColumn[]) => void;
|
|
14
|
-
isOpen: boolean;
|
|
15
|
-
onClose: () => void;
|
|
16
|
-
withSearch?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export const SetColumnsList: FC<Props> = ({
|
|
19
|
-
columns,
|
|
20
|
-
setColumns,
|
|
21
|
-
isOpen,
|
|
22
|
-
onClose,
|
|
23
|
-
withSearch,
|
|
24
|
-
}) => {
|
|
25
|
-
const [hidden, setHidden] = useState<ITableColumn[]>([]);
|
|
26
|
-
const [visible, setVisible] = useState<ITableColumn[]>([]);
|
|
27
|
-
const [searchHidden, setSearchHidden] = useState('');
|
|
28
|
-
const [searchVisible, setSearchVisible] = useState('');
|
|
29
|
-
|
|
30
|
-
const { t } = useTranslation();
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (isOpen) {
|
|
34
|
-
let hiddenCols: ITableColumn[] = [];
|
|
35
|
-
let visibleCols: ITableColumn[] = [];
|
|
36
|
-
columns.forEach(
|
|
37
|
-
col =>
|
|
38
|
-
col.id !== 'actions' &&
|
|
39
|
-
(!!col.hidden ? hiddenCols.push(col) : visibleCols.push(col))
|
|
40
|
-
);
|
|
41
|
-
setHidden(hiddenCols);
|
|
42
|
-
setVisible(visibleCols);
|
|
43
|
-
}
|
|
44
|
-
}, [isOpen, columns]);
|
|
45
|
-
|
|
46
|
-
const onDragEnd: OnDragEndResponder = ({ source, destination }) => {
|
|
47
|
-
if (!destination) return;
|
|
48
|
-
const hiddenCols = [...hidden];
|
|
49
|
-
const visibleCols = [...visible];
|
|
50
|
-
const destinationIsHidden = destination.droppableId === 'hidden';
|
|
51
|
-
|
|
52
|
-
const sourceList = source.droppableId === 'hidden' ? hiddenCols : visibleCols;
|
|
53
|
-
const destinationList = destinationIsHidden ? hiddenCols : visibleCols;
|
|
54
|
-
|
|
55
|
-
const [removed] = sourceList.splice(source.index, 1);
|
|
56
|
-
destinationList.splice(destination.index, 0, removed);
|
|
57
|
-
if (source.droppableId !== destination.droppableId) {
|
|
58
|
-
destinationList[destination.index].hidden = destinationIsHidden;
|
|
59
|
-
setHidden(hiddenCols);
|
|
60
|
-
setVisible(visibleCols);
|
|
61
|
-
} else {
|
|
62
|
-
destinationIsHidden ? setHidden(hiddenCols) : setVisible(visibleCols);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const onSubmit = () => {
|
|
67
|
-
setColumns([...visible, ...hidden]);
|
|
68
|
-
onClose();
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<DragDropContext onDragEnd={onDragEnd}>
|
|
73
|
-
<Dialog
|
|
74
|
-
isOpen={isOpen}
|
|
75
|
-
onClose={onClose}
|
|
76
|
-
confirmButton={{
|
|
77
|
-
label: t('Confirm'),
|
|
78
|
-
onClick: onSubmit,
|
|
79
|
-
}}
|
|
80
|
-
cancelButton={{ label: t('Cancel') }}
|
|
81
|
-
noBackgroundClick
|
|
82
|
-
>
|
|
83
|
-
<div className="dual-list-container">
|
|
84
|
-
<p className="pb-3">{t('DragDropListsInfo')}</p>
|
|
85
|
-
<div className="dual-list-content">
|
|
86
|
-
<p className="bold ml-2">{t('HiddenColumns')}:</p>
|
|
87
|
-
<div />
|
|
88
|
-
<p className="bold ml-2">{t('SelectedColumns')}:</p>
|
|
89
|
-
|
|
90
|
-
{withSearch && (
|
|
91
|
-
<>
|
|
92
|
-
<SearchInput onSearch={setSearchHidden} />
|
|
93
|
-
<div />
|
|
94
|
-
<SearchInput onSearch={setSearchVisible} />
|
|
95
|
-
</>
|
|
96
|
-
)}
|
|
97
|
-
<ColumnsList id="hidden" items={hidden} search={searchHidden} />
|
|
98
|
-
<div className="exchange-icon">
|
|
99
|
-
<FontAwesomeIcon icon={faArrowRightArrowLeft} />
|
|
100
|
-
</div>
|
|
101
|
-
<ColumnsList id="visible" items={visible} search={searchVisible} />
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
</Dialog>
|
|
105
|
-
</DragDropContext>
|
|
106
|
-
);
|
|
107
|
-
};
|