@inceptionbg/iui 2.0.21 → 2.0.23
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 +3 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +89 -48
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/iui.css +1 -1
- package/package.json +1 -1
- package/src/assets/icons/index.ts +1 -0
- package/src/components/Accordions/Accordions.tsx +4 -6
- package/src/components/Dialog/Dialog.tsx +22 -20
- package/src/components/Helper/Collapse.tsx +1 -5
- package/src/components/Inputs/PhoneInput/PhoneInput.tsx +108 -0
- package/src/components/Inputs/PhoneInput/utils/countryCode.ts +20 -0
- package/src/components/Table/components/templates/CreateTemplateDialog.tsx +17 -8
- package/src/components/Table/components/templates/TableTemplates.tsx +21 -69
- package/src/components/Table/components/templates/TemplatesPullover.tsx +88 -0
- package/src/index.ts +6 -2
- package/src/styles/components/_accordions.scss +1 -0
- package/src/styles/components/_dialog.scss +2 -2
- package/src/styles/components/_input.scss +9 -0
- package/src/styles/components/_page.scss +2 -3
- package/src/types/ITable.ts +3 -1
- package/src/utils/i18n/i18nIUICyrilic.ts +3 -0
- package/src/utils/i18n/i18nIUILatin.ts +3 -0
- package/src/utils/i18n/i18nIUIMe.ts +3 -0
|
@@ -2,19 +2,15 @@ import { useEffect, type FC } from 'react';
|
|
|
2
2
|
import { IconButton } from '../../../Button/IconButton';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useTableContext } from '../../contexts/TableContext';
|
|
5
|
-
import { faBookmark
|
|
6
|
-
import { Pullover } from '../../../Pullover/Pullover';
|
|
7
|
-
import { List } from '../../../List/List';
|
|
5
|
+
import { faBookmark } from '../../../../assets/icons';
|
|
8
6
|
import { setTemplateData } from '../../../../utils/tableUtils';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { TemplatesPullover } from './TemplatesPullover';
|
|
8
|
+
import { IReportTemplate } from '../../../../types/ITable';
|
|
11
9
|
|
|
12
10
|
export const TableTemplates: FC = () => {
|
|
13
11
|
const { t } = useTranslation();
|
|
14
12
|
const { templateData, columnData, filterData, sortData } = useTableContext();
|
|
15
13
|
|
|
16
|
-
const createTemplatePopupController = usePopupControl();
|
|
17
|
-
|
|
18
14
|
useEffect(() => {
|
|
19
15
|
if (templateData?.defaultTemplate) {
|
|
20
16
|
setTemplateData({
|
|
@@ -42,71 +38,27 @@ export const TableTemplates: FC = () => {
|
|
|
42
38
|
size="s"
|
|
43
39
|
variant="outlined"
|
|
44
40
|
/>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
<TemplatesPullover
|
|
42
|
+
templateData={templateData}
|
|
43
|
+
onResetTemplate={() => {
|
|
44
|
+
columnData?.setColumns?.(columnData.defaultColumns);
|
|
45
|
+
filterData?.setSearchData(filterData.defaultSearch ?? {});
|
|
46
|
+
filterData?.onSearch(filterData.defaultSearch ?? {});
|
|
47
|
+
sortData?.setSort('');
|
|
48
|
+
templateData.popupController.onClose();
|
|
52
49
|
}}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
icon: faBookmark,
|
|
61
|
-
onClick: templateData.createItem.onCreateDefault,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
additionalButton: {
|
|
66
|
-
label: t('ResetTemplate'),
|
|
67
|
-
icon: faBookmarkSlash,
|
|
68
|
-
onClick: () => {
|
|
69
|
-
columnData?.setColumns?.(columnData.defaultColumns);
|
|
70
|
-
filterData?.setSearchData(filterData.defaultSearch ?? {});
|
|
71
|
-
filterData?.onSearch(filterData.defaultSearch ?? {});
|
|
72
|
-
sortData?.setSort('');
|
|
73
|
-
templateData.popupController.onClose();
|
|
50
|
+
onItemClick={(item: IReportTemplate) => {
|
|
51
|
+
setTemplateData({
|
|
52
|
+
template: item,
|
|
53
|
+
columnData,
|
|
54
|
+
setFilters: e => {
|
|
55
|
+
filterData?.setSearchData(e);
|
|
56
|
+
filterData?.onSearch(e);
|
|
74
57
|
},
|
|
75
|
-
|
|
58
|
+
setSort: sortData?.setSort,
|
|
59
|
+
});
|
|
76
60
|
}}
|
|
77
|
-
|
|
78
|
-
size="w600"
|
|
79
|
-
>
|
|
80
|
-
<List
|
|
81
|
-
items={templateData.items.map(item => ({
|
|
82
|
-
id: item.uuid,
|
|
83
|
-
label: item.name,
|
|
84
|
-
desc: item.isPublic ? t('PublicTemplate') : t('PrivateTemplate'),
|
|
85
|
-
onClick: () => {
|
|
86
|
-
setTemplateData({
|
|
87
|
-
template: item,
|
|
88
|
-
columnData,
|
|
89
|
-
setFilters: e => {
|
|
90
|
-
filterData?.setSearchData(e);
|
|
91
|
-
filterData?.onSearch(e);
|
|
92
|
-
},
|
|
93
|
-
setSort: sortData?.setSort,
|
|
94
|
-
});
|
|
95
|
-
templateData.popupController.onClose();
|
|
96
|
-
},
|
|
97
|
-
actions: [
|
|
98
|
-
{
|
|
99
|
-
icon: faTrashCan,
|
|
100
|
-
onClick: () => templateData.setItemToDeleteUuids([item.uuid]),
|
|
101
|
-
color: 'danger',
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
}))}
|
|
105
|
-
noItemsMessage={t('NoTemplatesAvailable')}
|
|
106
|
-
/>
|
|
107
|
-
</Pullover>
|
|
108
|
-
<CreateTemplateDialog control={createTemplatePopupController.control} />
|
|
109
|
-
{templateData.DeleteDialog}
|
|
61
|
+
/>
|
|
110
62
|
</>
|
|
111
63
|
);
|
|
112
64
|
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import { IReportTemplate, ITableTemplateData } from '../../../../types/ITable';
|
|
3
|
+
import { Pullover } from '../../../Pullover/Pullover';
|
|
4
|
+
import { List } from '../../../List/List';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { usePopupControl } from '../../../../hooks/usePopupControl';
|
|
7
|
+
import { faBookmark, faBookmarkSlash, faTrashCan } from '../../../../assets/icons';
|
|
8
|
+
import { CreateTemplateDialog } from './CreateTemplateDialog';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
templateData: ITableTemplateData;
|
|
12
|
+
onItemClick: (item: IReportTemplate) => void;
|
|
13
|
+
onResetTemplate?: () => void;
|
|
14
|
+
createDialogTitle?: string;
|
|
15
|
+
hideDefaultTemplateOption?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const TemplatesPullover: FC<Props> = ({
|
|
19
|
+
templateData,
|
|
20
|
+
onItemClick,
|
|
21
|
+
onResetTemplate,
|
|
22
|
+
createDialogTitle,
|
|
23
|
+
hideDefaultTemplateOption,
|
|
24
|
+
}) => {
|
|
25
|
+
const { t } = useTranslation();
|
|
26
|
+
const createTemplatePopupController = usePopupControl();
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<Pullover
|
|
31
|
+
isLoading={templateData.isLoading}
|
|
32
|
+
isFetching={templateData.isFetching}
|
|
33
|
+
control={templateData.popupController.control}
|
|
34
|
+
header={{
|
|
35
|
+
title: t('Templates'),
|
|
36
|
+
onSearch: templateData.setSearch,
|
|
37
|
+
}}
|
|
38
|
+
footer={{
|
|
39
|
+
confirmButton: {
|
|
40
|
+
label: t('CreateTemplate'),
|
|
41
|
+
onClick: createTemplatePopupController.onOpen,
|
|
42
|
+
splitActions: [
|
|
43
|
+
{
|
|
44
|
+
label: t('CreateDefaultTemplate'),
|
|
45
|
+
icon: faBookmark,
|
|
46
|
+
onClick: templateData.createItem.onCreateDefault,
|
|
47
|
+
hidden: hideDefaultTemplateOption,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
additionalButton: onResetTemplate && {
|
|
52
|
+
label: t('ResetTemplate'),
|
|
53
|
+
icon: faBookmarkSlash,
|
|
54
|
+
onClick: onResetTemplate,
|
|
55
|
+
},
|
|
56
|
+
}}
|
|
57
|
+
onCloseCallback={() => templateData.setSearch?.('')}
|
|
58
|
+
size="w600"
|
|
59
|
+
>
|
|
60
|
+
<List
|
|
61
|
+
items={templateData.items.map(item => ({
|
|
62
|
+
id: item.uuid,
|
|
63
|
+
label: item.name,
|
|
64
|
+
desc: item.isPublic ? t('PublicTemplate') : t('PrivateTemplate'),
|
|
65
|
+
onClick: () => {
|
|
66
|
+
onItemClick(item);
|
|
67
|
+
templateData.popupController.onClose();
|
|
68
|
+
},
|
|
69
|
+
actions: [
|
|
70
|
+
{
|
|
71
|
+
icon: faTrashCan,
|
|
72
|
+
onClick: () => templateData.setItemToDeleteUuids([item.uuid]),
|
|
73
|
+
color: 'danger',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
}))}
|
|
77
|
+
noItemsMessage={t('NoTemplatesAvailable')}
|
|
78
|
+
/>
|
|
79
|
+
</Pullover>
|
|
80
|
+
<CreateTemplateDialog
|
|
81
|
+
control={createTemplatePopupController.control}
|
|
82
|
+
createItem={templateData.createItem}
|
|
83
|
+
title={createDialogTitle}
|
|
84
|
+
/>
|
|
85
|
+
{templateData.DeleteDialog}
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd';
|
|
6
|
-
import { ToastContainer } from 'react-toastify';
|
|
6
|
+
import { ToastContainer, toast, type ToastContainerProps } from 'react-toastify';
|
|
7
7
|
|
|
8
8
|
import type { IFormWrapper } from './components/Wrappers/FormWrapper';
|
|
9
9
|
import type {
|
|
@@ -72,6 +72,7 @@ import { Collapse } from './components/Helper/Collapse';
|
|
|
72
72
|
import { Checkbox } from './components/Inputs/Checkbox';
|
|
73
73
|
import { CurrencyInput } from './components/Inputs/CurrencyInput';
|
|
74
74
|
import { DateInput } from './components/Inputs/DateInput/DateInput';
|
|
75
|
+
import { PhoneInput } from './components/Inputs/PhoneInput/PhoneInput';
|
|
75
76
|
import { TimeInput } from './components/Inputs/TimeInput/TimeInput';
|
|
76
77
|
import { TextAreaInput } from './components/Inputs/TextAreaInput';
|
|
77
78
|
import { NumberInput } from './components/Inputs/NumberInput';
|
|
@@ -104,6 +105,7 @@ import { Pullover } from './components/Pullover/Pullover';
|
|
|
104
105
|
///// TABLE /////
|
|
105
106
|
import { Table } from './components/Table/Table';
|
|
106
107
|
import { CreateTemplateDialog } from './components/Table/components/templates/CreateTemplateDialog';
|
|
108
|
+
import { TemplatesPullover } from './components/Table/components/templates/TemplatesPullover';
|
|
107
109
|
// import { ItemEditOptionsButtons } from './components/Table/Components/Edit/ItemEditOptionsButtons';
|
|
108
110
|
// import { TableEditRow } from './components/Table/Components/Edit/TableEditRow';
|
|
109
111
|
// import { FilterItem } from './components/Table/Components/FilterItem';
|
|
@@ -198,6 +200,7 @@ import { useIsMenuOpen } from './hooks/useIsMenuOpen';
|
|
|
198
200
|
import { usePopupControl } from './hooks/usePopupControl';
|
|
199
201
|
|
|
200
202
|
export { Router, type IRoute, type ISidebarItem };
|
|
203
|
+
export { ToastContainer, toast, type ToastContainerProps };
|
|
201
204
|
|
|
202
205
|
export {
|
|
203
206
|
Accordions,
|
|
@@ -226,6 +229,7 @@ export {
|
|
|
226
229
|
NumberInput,
|
|
227
230
|
PageLayout,
|
|
228
231
|
PasswordInput,
|
|
232
|
+
PhoneInput,
|
|
229
233
|
ProgressBar,
|
|
230
234
|
Pullover,
|
|
231
235
|
PillBadge,
|
|
@@ -240,7 +244,6 @@ export {
|
|
|
240
244
|
Tabs,
|
|
241
245
|
TextInput,
|
|
242
246
|
TimeInput,
|
|
243
|
-
ToastContainer,
|
|
244
247
|
Tooltip,
|
|
245
248
|
Tree,
|
|
246
249
|
};
|
|
@@ -248,6 +251,7 @@ export {
|
|
|
248
251
|
export {
|
|
249
252
|
Table,
|
|
250
253
|
CreateTemplateDialog,
|
|
254
|
+
TemplatesPullover,
|
|
251
255
|
// SetTableFilter,
|
|
252
256
|
// GridTable,
|
|
253
257
|
// TablePrint,
|
package/src/types/ITable.ts
CHANGED
|
@@ -251,6 +251,7 @@ export interface IReportTemplate {
|
|
|
251
251
|
name: string;
|
|
252
252
|
identifier: string;
|
|
253
253
|
filterValues?: IReportTemplateFilterValue[];
|
|
254
|
+
options?: { key: string; value?: any }[];
|
|
254
255
|
columns: string[];
|
|
255
256
|
organization?: ISimpleObject;
|
|
256
257
|
subsystem?: string; // IModuleId;
|
|
@@ -270,9 +271,10 @@ export interface IReportTemplateFilterValue {
|
|
|
270
271
|
}
|
|
271
272
|
|
|
272
273
|
export interface IReportTemplateData {
|
|
273
|
-
searchData
|
|
274
|
+
searchData?: IAnyObject;
|
|
274
275
|
visibleColumns?: string[];
|
|
275
276
|
sorts?: string[];
|
|
277
|
+
options?: { key: string; value?: any }[];
|
|
276
278
|
}
|
|
277
279
|
|
|
278
280
|
export const tableStandardLimit = [5, 10, 25, 50, 100];
|
|
@@ -83,6 +83,9 @@ export const i18nIUICyrilic = {
|
|
|
83
83
|
CharMin: 'Минималан број карактера: {{from}}',
|
|
84
84
|
CharRange: 'Број карактера од {{from}} до {{-to}}',
|
|
85
85
|
CharNumber: 'Број карактера {{number}}',
|
|
86
|
+
PhoneValidation: 'Неисправан број телефона',
|
|
87
|
+
Serbia: 'Србија',
|
|
88
|
+
Montenegro: 'Црна Гора',
|
|
86
89
|
|
|
87
90
|
////// TOAST //////
|
|
88
91
|
Pending: 'У току',
|
|
@@ -83,6 +83,9 @@ export const i18nIUILatin = {
|
|
|
83
83
|
CharMin: 'Minimalan broj karaktera: {{from}}',
|
|
84
84
|
CharRange: 'Broj karaktera od {{from}} do {{-to}}',
|
|
85
85
|
CharNumber: 'Broj karaktera {{number}}',
|
|
86
|
+
PhoneValidation: 'Neispravan broj telefona',
|
|
87
|
+
Serbia: 'Srbija',
|
|
88
|
+
Montenegro: 'Crna Gora',
|
|
86
89
|
|
|
87
90
|
////// TOAST //////
|
|
88
91
|
Pending: 'U toku',
|
|
@@ -82,6 +82,9 @@ export const i18nIUIMe = {
|
|
|
82
82
|
CharMin: 'Minimalan broj karaktera: {{from}}',
|
|
83
83
|
CharRange: 'Broj karaktera od {{from}} do {{-to}}',
|
|
84
84
|
CharNumber: 'Broj karaktera {{number}}',
|
|
85
|
+
PhoneValidation: 'Neispravan broj telefona',
|
|
86
|
+
Serbia: 'Srbija',
|
|
87
|
+
Montenegro: 'Crna Gora',
|
|
85
88
|
|
|
86
89
|
////// TOAST //////
|
|
87
90
|
Pending: 'U toku',
|