@omniumretail/component-library 1.2.71 → 1.2.73
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/package.json +6 -3
- package/NPMPUBLISH.md +0 -29
- package/bitbucket-pipelines.yml +0 -95
- package/dist/components/AnalyticsBar/AnalyticsBar.stories.d.ts +0 -5
- package/dist/components/BellNotifications/BellNotifications.stories.d.ts +0 -5
- package/dist/components/Button/Button.stories.d.ts +0 -6
- package/dist/components/Category/Category.stories.d.ts +0 -3
- package/dist/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +0 -3
- package/dist/components/CategoryResponse/CategoryResponse.stories.d.ts +0 -3
- package/dist/components/DatePicker/DatePicker.stories.d.ts +0 -5
- package/dist/components/DatePickerTag/DatePickerTag.stories.d.ts +0 -5
- package/dist/components/DropdownButton/DropdownButton.stories.d.ts +0 -5
- package/dist/components/ExportTableData/ExportTableData.stories.d.ts +0 -3
- package/dist/components/Footer/Footer.stories.d.ts +0 -5
- package/dist/components/Footer2/Footer.stories.d.ts +0 -6
- package/dist/components/Header/Header.stories.d.ts +0 -5
- package/dist/components/Input/Input.stories.d.ts +0 -5
- package/dist/components/InputCountryCode/inputCountryCode.stories.d.ts +0 -5
- package/dist/components/Label/Label.stories.d.ts +0 -6
- package/dist/components/Link/Link.stories.d.ts +0 -7
- package/dist/components/Menu/Menu.stories.d.ts +0 -5
- package/dist/components/MobileTable/MobileTable.stories.d.ts +0 -5
- package/dist/components/ModalConfirmation/ModalConfirmation.stories.d.ts +0 -5
- package/dist/components/ModalWithTable/ModalWithTable.stories.d.ts +0 -5
- package/dist/components/Navigation/Navigation.stories.d.ts +0 -5
- package/dist/components/Notification/Notification.stories.d.ts +0 -5
- package/dist/components/Questions/Questions.stories.d.ts +0 -3
- package/dist/components/Radio/Radio.stories.d.ts +0 -5
- package/dist/components/ResponseType/ResponseType.stories.d.ts +0 -3
- package/dist/components/ResponsiveTable/ResponsiveTable.stories.d.ts +0 -9
- package/dist/components/Select/Select.stories.d.ts +0 -6
- package/dist/components/Separator/Separator.stories.d.ts +0 -6
- package/dist/components/Sidebar/Sidebar.stories.d.ts +0 -6
- package/dist/components/Switch/Switch.stories.d.ts +0 -5
- package/dist/components/Table/Table.stories.d.ts +0 -9
- package/dist/components/Tag/Tag.stories.d.ts +0 -5
- package/dist/components/Upload/Upload.stories.d.ts +0 -3
- package/dist/components/UserInfo/UserInfo.stories.d.ts +0 -3
- package/dist/components/WebCam/WebCam.stories.d.ts +0 -3
- package/dist/types/index.d.ts +0 -2
- package/public/index.ts +0 -0
- package/src/assets/code-brackets.svg +0 -1
- package/src/assets/colors.svg +0 -1
- package/src/assets/comments.svg +0 -1
- package/src/assets/direction.svg +0 -1
- package/src/assets/flow.svg +0 -1
- package/src/assets/fonts/Silka-Bold.woff2 +0 -0
- package/src/assets/fonts/Silka-Regular.woff2 +0 -0
- package/src/assets/images/A2AI-logo.png +0 -0
- package/src/assets/images/omnium-retail-logo-white.png +0 -0
- package/src/assets/images/omnium-retail-logo.png +0 -0
- package/src/assets/images/omnium-retail_icon.png +0 -0
- package/src/assets/plugin.svg +0 -1
- package/src/assets/repo.svg +0 -1
- package/src/assets/scss/_combinations.scss +0 -0
- package/src/assets/scss/_global.scss +0 -89
- package/src/assets/scss/index.scss +0 -2
- package/src/assets/stackalt.svg +0 -1
- package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +0 -236
- package/src/components/AnalyticsBar/helpers/codeMutation.tsx +0 -19
- package/src/components/AnalyticsBar/index.tsx +0 -76
- package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +0 -13
- package/src/components/AnalyticsBar/styles.module.scss +0 -137
- package/src/components/BellNotifications/BellNotifications.stories.tsx +0 -200
- package/src/components/BellNotifications/index.tsx +0 -154
- package/src/components/BellNotifications/styles.module.scss +0 -239
- package/src/components/Button/Button.stories.tsx +0 -26
- package/src/components/Button/index.tsx +0 -24
- package/src/components/Button/styles.module.scss +0 -70
- package/src/components/Category/Category.stories.tsx +0 -371
- package/src/components/Category/CategoryContent/index.tsx +0 -255
- package/src/components/Category/CategoryContent/styles.module.scss +0 -69
- package/src/components/Category/CategorySidebar/index.tsx +0 -344
- package/src/components/Category/CategorySidebar/styles.module.scss +0 -28
- package/src/components/Category/index.tsx +0 -58
- package/src/components/Category/styles.module.scss +0 -13
- package/src/components/CategoryReadOnly/CategoryReadOnly.stories.tsx +0 -274
- package/src/components/CategoryReadOnly/evaluationOptions.tsx +0 -81
- package/src/components/CategoryReadOnly/index.tsx +0 -328
- package/src/components/CategoryReadOnly/styles.module.scss +0 -214
- package/src/components/CategoryResponse/CategoryResponse.stories.tsx +0 -311
- package/src/components/CategoryResponse/evaluationOptions.tsx +0 -81
- package/src/components/CategoryResponse/index.tsx +0 -502
- package/src/components/CategoryResponse/styles.module.scss +0 -365
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -16
- package/src/components/DatePicker/index.tsx +0 -38
- package/src/components/DatePicker/styles.module.scss +0 -3
- package/src/components/DatePickerTag/DatePickerTag.stories.tsx +0 -19
- package/src/components/DatePickerTag/index.tsx +0 -91
- package/src/components/DatePickerTag/styles.module.scss +0 -32
- package/src/components/DropdownButton/DropdownButton.stories.tsx +0 -24
- package/src/components/DropdownButton/index.tsx +0 -36
- package/src/components/DropdownButton/styles.module.scss +0 -9
- package/src/components/ExportTableData/ExportTableData.stories.tsx +0 -43
- package/src/components/ExportTableData/index.tsx +0 -37
- package/src/components/ExportTableData/styles.module.scss +0 -4
- package/src/components/Footer/Footer.stories.tsx +0 -15
- package/src/components/Footer/index.tsx +0 -45
- package/src/components/Footer/styles.module.scss +0 -38
- package/src/components/Footer2/Footer.stories.tsx +0 -184
- package/src/components/Footer2/index.tsx +0 -322
- package/src/components/Footer2/styles.module.scss +0 -292
- package/src/components/Header/Header.data.ts +0 -26
- package/src/components/Header/Header.stories.tsx +0 -236
- package/src/components/Header/Header.types.ts +0 -32
- package/src/components/Header/README.md +0 -38
- package/src/components/Header/index.tsx +0 -200
- package/src/components/Header/styles.module.scss +0 -216
- package/src/components/Input/Input.stories.tsx +0 -13
- package/src/components/Input/index.tsx +0 -31
- package/src/components/Input/styles.module.scss +0 -8
- package/src/components/InputCountryCode/index.tsx +0 -79
- package/src/components/InputCountryCode/inputCountryCode.stories.tsx +0 -55
- package/src/components/InputCountryCode/styles.module.scss +0 -3
- package/src/components/Label/Label.stories.tsx +0 -21
- package/src/components/Label/index.tsx +0 -19
- package/src/components/Label/styles.module.scss +0 -17
- package/src/components/Link/Link.stories.tsx +0 -30
- package/src/components/Link/index.tsx +0 -21
- package/src/components/Link/styles.module.scss +0 -24
- package/src/components/Menu/Menu.stories.tsx +0 -178
- package/src/components/Menu/helpers/codeMutation.tsx +0 -19
- package/src/components/Menu/index.tsx +0 -24
- package/src/components/Menu/styles.module.scss +0 -0
- package/src/components/MobileTable/MobileTable.stories.tsx +0 -27
- package/src/components/MobileTable/index.tsx +0 -102
- package/src/components/MobileTable/styles.module.scss +0 -75
- package/src/components/ModalConfirmation/ModalConfirmation.stories.tsx +0 -40
- package/src/components/ModalConfirmation/ModalStatusList.tsx +0 -5
- package/src/components/ModalConfirmation/index.tsx +0 -71
- package/src/components/ModalConfirmation/styles.module.scss +0 -62
- package/src/components/ModalWithTable/ModalWithTable.stories.tsx +0 -99
- package/src/components/ModalWithTable/index.tsx +0 -238
- package/src/components/ModalWithTable/styles.module.scss +0 -77
- package/src/components/Navigation/Navigation.stories.tsx +0 -21
- package/src/components/Navigation/index.tsx +0 -91
- package/src/components/Navigation/styles.module.scss +0 -91
- package/src/components/Notification/Notification.stories.tsx +0 -32
- package/src/components/Notification/index.tsx +0 -28
- package/src/components/Questions/Questions.stories.tsx +0 -37
- package/src/components/Questions/SingleQuestion/index.tsx +0 -337
- package/src/components/Questions/SingleQuestion/styles.module.scss +0 -142
- package/src/components/Questions/index.tsx +0 -124
- package/src/components/Questions/styles.modules.scss +0 -0
- package/src/components/Radio/Radio.stories.tsx +0 -43
- package/src/components/Radio/index.tsx +0 -26
- package/src/components/Radio/styles.module.scss +0 -24
- package/src/components/ResponseType/ResponseType.stories.tsx +0 -393
- package/src/components/ResponseType/index.tsx +0 -100
- package/src/components/ResponseType/styles.module.scss +0 -31
- package/src/components/ResponsiveTable/ResponsiveTable.stories.tsx +0 -386
- package/src/components/ResponsiveTable/index.tsx +0 -389
- package/src/components/ResponsiveTable/styles.module.scss +0 -153
- package/src/components/Select/Select.stories.tsx +0 -39
- package/src/components/Select/index.tsx +0 -27
- package/src/components/Select/styles.module.scss +0 -19
- package/src/components/Separator/Separator.stories.tsx +0 -22
- package/src/components/Separator/index.tsx +0 -27
- package/src/components/Separator/styles.module.scss +0 -25
- package/src/components/Sidebar/Sidebar.stories.tsx +0 -85
- package/src/components/Sidebar/index.tsx +0 -127
- package/src/components/Sidebar/styles.module.scss +0 -141
- package/src/components/Switch/Switch.stories.tsx +0 -14
- package/src/components/Switch/index.tsx +0 -18
- package/src/components/Switch/styles.module.scss +0 -7
- package/src/components/Table/Table.stories.tsx +0 -337
- package/src/components/Table/index.tsx +0 -313
- package/src/components/Table/styles.module.scss +0 -97
- package/src/components/Tag/Tag.stories.tsx +0 -32
- package/src/components/Tag/index.tsx +0 -295
- package/src/components/Tag/styles.module.scss +0 -104
- package/src/components/Upload/Upload.stories.tsx +0 -45
- package/src/components/Upload/index.tsx +0 -112
- package/src/components/Upload/styles.module.scss +0 -29
- package/src/components/UserInfo/UserInfo.stories.tsx +0 -38
- package/src/components/UserInfo/index.tsx +0 -77
- package/src/components/UserInfo/styles.module.scss +0 -35
- package/src/components/WebCam/WebCam.stories.tsx +0 -24
- package/src/components/WebCam/index.tsx +0 -73
- package/src/components/WebCam/styles.module.scss +0 -37
- package/src/components/index.tsx +0 -34
- package/src/constants/i18n.ts +0 -25
- package/src/constants/logoCompanyHelper.ts +0 -52
- package/src/constants/translationHelper.ts +0 -7
- package/src/index.ts +0 -3
- package/src/locales/en.json +0 -142
- package/src/locales/es.json +0 -142
- package/src/locales/pt.json +0 -142
- package/src/types/Global.d.ts +0 -4
- package/tsconfig.json +0 -24
- package/vite.config.js +0 -51
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react-vite";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { ModalWithTable, ModalWithTableProps } from '.';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'ModalWithTable',
|
|
7
|
-
component: ModalWithTable,
|
|
8
|
-
} as Meta;
|
|
9
|
-
|
|
10
|
-
const Template: StoryFn<ModalWithTableProps> = (args: any) => {
|
|
11
|
-
const [modalData, setModalData] = useState<any>({});
|
|
12
|
-
const [isFetching, setIsFetching] = useState<boolean>(false);
|
|
13
|
-
const [tagsData, setTagsData] = useState<any>({});
|
|
14
|
-
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
|
15
|
-
const [selectedSupervisors, setSelectedSupervisors] = useState<any>(['232']);
|
|
16
|
-
|
|
17
|
-
const onClickMe = () => {
|
|
18
|
-
setIsModalOpen(true);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let data = {
|
|
22
|
-
dataSource: [
|
|
23
|
-
{
|
|
24
|
-
key: `1`,
|
|
25
|
-
name: `John Brown`,
|
|
26
|
-
mecanographicNumber: "232",
|
|
27
|
-
store: `Levi's Sta Catarina`,
|
|
28
|
-
role: `Gerente`,
|
|
29
|
-
type: `Efetivo`
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
key: `2`,
|
|
33
|
-
name: `Mary Brown`,
|
|
34
|
-
mecanographicNumber: "32",
|
|
35
|
-
store: `Levi's Sta Catarina`,
|
|
36
|
-
role: `Comercial`,
|
|
37
|
-
type: `Efetivo`
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
key: `3`,
|
|
41
|
-
name: `Anna Astori`,
|
|
42
|
-
mecanographicNumber: "3212",
|
|
43
|
-
store: `Levi's Sta Catarina`,
|
|
44
|
-
role: `Funcionário`,
|
|
45
|
-
type: `Efetivo`
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
key: `4`,
|
|
49
|
-
name: `Yield Ona`,
|
|
50
|
-
mecanographicNumber: "21232",
|
|
51
|
-
store: `Adidas Restaurantes`,
|
|
52
|
-
role: `Gerente`,
|
|
53
|
-
type: `Efetivo`
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
pagination: {
|
|
57
|
-
total: 4,
|
|
58
|
-
pageSize: 2
|
|
59
|
-
},
|
|
60
|
-
rowKeyValue: 'mecanographicNumber',
|
|
61
|
-
rowSelection: {
|
|
62
|
-
type: 'checkbox',
|
|
63
|
-
selectedRowKeys: selectedSupervisors?.length > 0 ? selectedSupervisors : []
|
|
64
|
-
},
|
|
65
|
-
customColumnWidths:[
|
|
66
|
-
{ columnName: "name", width: "1%" },
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if(modalData?.tagsInfo?.length > 0 && tagsData !== modalData?.tagsInfo) {
|
|
72
|
-
setTagsData(modalData.tagsInfo);
|
|
73
|
-
setIsFetching(true);
|
|
74
|
-
|
|
75
|
-
setTimeout(() => {
|
|
76
|
-
setIsFetching(false);
|
|
77
|
-
}, 1000);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if(modalData?.rowSelectionInfo?.length !== undefined) {
|
|
81
|
-
setSelectedSupervisors(modalData.rowSelectionInfo);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
setIsModalOpen(modalData?.open!);
|
|
85
|
-
}, [modalData]);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<>
|
|
89
|
-
<button onClick={() => onClickMe()}> Button </button>
|
|
90
|
-
<ModalWithTable {...args} modalData={setModalData} isLoading={isFetching} tableData={data} isOpen={isModalOpen} advancedTagsList={[{ display: "Oi", value: "State"}]}></ModalWithTable>
|
|
91
|
-
</>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export const Primary = Template.bind({});
|
|
96
|
-
Primary.args = {
|
|
97
|
-
closeText: 'cancelar',
|
|
98
|
-
buttonText: 'Alterar',
|
|
99
|
-
};
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { Button } from '../Button';
|
|
2
|
-
import { Modal } from 'antd';
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { CloseOutlined } from '@ant-design/icons';
|
|
5
|
-
import styles from './styles.module.scss';
|
|
6
|
-
import { TagField } from '../Tag';
|
|
7
|
-
import { Table, TableCustomProps } from '../Table';
|
|
8
|
-
import classnames from 'classnames';
|
|
9
|
-
|
|
10
|
-
export interface ModalWithTableProps {
|
|
11
|
-
closeText: string;
|
|
12
|
-
buttonText: string;
|
|
13
|
-
isOpen: boolean;
|
|
14
|
-
tableData: TableCustomProps,
|
|
15
|
-
modalData?: any;
|
|
16
|
-
isLoading?: boolean;
|
|
17
|
-
confirmLoading?: boolean;
|
|
18
|
-
initialRowSelectedInfo?: any;
|
|
19
|
-
// Tags List for advanced search
|
|
20
|
-
advancedTagsList?: { display: string; value: string }[];
|
|
21
|
-
}
|
|
22
|
-
function objectsAreEqual(obj1: any, obj2: any) {
|
|
23
|
-
const keys1 = Object.keys(obj1);
|
|
24
|
-
const keys2 = Object.keys(obj2);
|
|
25
|
-
|
|
26
|
-
if (keys1.length !== keys2.length) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
for (const key of keys1) {
|
|
31
|
-
if (!keys2.includes(key) || obj1[key] !== obj2[key]) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function arrayContainsObject(array: any, newObj: any) {
|
|
40
|
-
return array.some((existingObj: any) => objectsAreEqual(existingObj, newObj));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const ModalWithTable = (props: ModalWithTableProps) => {
|
|
44
|
-
const {
|
|
45
|
-
closeText,
|
|
46
|
-
buttonText,
|
|
47
|
-
isOpen = false,
|
|
48
|
-
tableData,
|
|
49
|
-
modalData,
|
|
50
|
-
isLoading,
|
|
51
|
-
initialRowSelectedInfo,
|
|
52
|
-
advancedTagsList
|
|
53
|
-
} = props;
|
|
54
|
-
|
|
55
|
-
const prevIsOpenRef = useRef<boolean>();
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
prevIsOpenRef.current = isOpen;
|
|
58
|
-
}, [isOpen]);
|
|
59
|
-
const prevIsOpen = prevIsOpenRef.current;
|
|
60
|
-
|
|
61
|
-
// Add a new state to store the initial values
|
|
62
|
-
const [initialValues, setInitialValues] = useState<any>({
|
|
63
|
-
pageInfo: {},
|
|
64
|
-
rowSelectionInfo: [],
|
|
65
|
-
tagsInfo: [],
|
|
66
|
-
advancedTagsInfo: [],
|
|
67
|
-
selectedData: [],
|
|
68
|
-
});
|
|
69
|
-
const pageBase = { currentPage: 1 };
|
|
70
|
-
const [open, setOpen] = useState((isOpen));
|
|
71
|
-
const [confirmLoading, setConfirmLoading] = useState(false);
|
|
72
|
-
const [pageInfo, setPageInfo] = useState<any>(pageBase);
|
|
73
|
-
const [rowSelectionInfo, setRowSelectionInfo] = useState<any>(undefined);
|
|
74
|
-
const [tagsInfo, setTagsInfo] = useState<any>([]);
|
|
75
|
-
const [advancedTagsInfo, setAdvancedTagsInfo] = useState<any>([]);
|
|
76
|
-
const [selectedData, setSelectedData] = useState<any>([]);
|
|
77
|
-
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
setOpen(isOpen);
|
|
80
|
-
|
|
81
|
-
if (isOpen && !prevIsOpen) {
|
|
82
|
-
setInitialValues({
|
|
83
|
-
pageInfo: pageInfo,
|
|
84
|
-
rowSelectionInfo: rowSelectionInfo,
|
|
85
|
-
tagsInfo: tagsInfo,
|
|
86
|
-
advancedTagsInfo: advancedTagsInfo,
|
|
87
|
-
selectedData: selectedData,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}, [isOpen])
|
|
91
|
-
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
initialRowSelectedInfo && setRowSelectionInfo(initialRowSelectedInfo);
|
|
94
|
-
}, [initialRowSelectedInfo])
|
|
95
|
-
|
|
96
|
-
const hideModal = () => {
|
|
97
|
-
setOpen(false);
|
|
98
|
-
setPageInfo(initialValues.pageInfo);
|
|
99
|
-
setRowSelectionInfo(initialValues.rowSelectionInfo);
|
|
100
|
-
setTagsInfo(initialValues.tagsInfo);
|
|
101
|
-
setAdvancedTagsInfo(initialValues.advancedTagsInfo)
|
|
102
|
-
setSelectedData(initialValues.selectedData);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const saveChanges = () => {
|
|
106
|
-
setOpen(false);
|
|
107
|
-
if (tableData?.rowSelection?.type === 'radio') {
|
|
108
|
-
setSelectedData([selectedData[selectedData.length - 1]]);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
if (!open) {
|
|
114
|
-
setPageInfo(pageBase);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const modalDataObj = {
|
|
118
|
-
pageInfo: pageInfo,
|
|
119
|
-
rowSelectionInfo: rowSelectionInfo,
|
|
120
|
-
tagsInfo: tagsInfo,
|
|
121
|
-
advancedTagsInfo: advancedTagsInfo,
|
|
122
|
-
open: open,
|
|
123
|
-
selectedData: selectedData,
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
modalData(modalDataObj);
|
|
127
|
-
}, [tagsInfo, advancedTagsInfo, open, rowSelectionInfo, selectedData]);
|
|
128
|
-
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
const selectedRowKeys = rowSelectionInfo || tableData.rowSelection.selectedRowKeys;
|
|
131
|
-
|
|
132
|
-
if (tableData?.rowSelection?.type === 'radio') {
|
|
133
|
-
setSelectedData((prevData: any) => {
|
|
134
|
-
const newData = tableData?.dataSource?.filter((element) => {
|
|
135
|
-
return selectedRowKeys.includes(element[tableData.rowKeyValue as any]);
|
|
136
|
-
}) || [];
|
|
137
|
-
|
|
138
|
-
if (newData.length < 1) {
|
|
139
|
-
return selectedData;
|
|
140
|
-
}
|
|
141
|
-
if (arrayContainsObject(selectedData, newData[0])) {
|
|
142
|
-
return selectedData;
|
|
143
|
-
}
|
|
144
|
-
const combinedData = [...selectedData, ...newData];
|
|
145
|
-
return combinedData;
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
setSelectedData((prevData: any) => {
|
|
152
|
-
const newData = tableData?.dataSource?.filter((element) => {
|
|
153
|
-
return selectedRowKeys.includes(element[tableData.rowKeyValue as any]);
|
|
154
|
-
}) || [];
|
|
155
|
-
|
|
156
|
-
const oldData = prevData.filter((dataItem: any) => {
|
|
157
|
-
return !tableData?.dataSource?.some(
|
|
158
|
-
(element) => element[tableData.rowKeyValue as any] === dataItem[tableData.rowKeyValue as any]
|
|
159
|
-
);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
const combinedData = [...oldData, ...newData].filter((dataItem, index, self) => {
|
|
163
|
-
return (
|
|
164
|
-
index ===
|
|
165
|
-
self.findIndex(
|
|
166
|
-
(item) => item[tableData.rowKeyValue as any] === dataItem[tableData.rowKeyValue as any]
|
|
167
|
-
)
|
|
168
|
-
);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
setInitialValues({ ...initialValues, selectedData: combinedData });
|
|
172
|
-
return combinedData;
|
|
173
|
-
});
|
|
174
|
-
}, [rowSelectionInfo])
|
|
175
|
-
|
|
176
|
-
useEffect(() => {
|
|
177
|
-
if (advancedTagsInfo.length > 0) {
|
|
178
|
-
setConfirmLoading(true);
|
|
179
|
-
}
|
|
180
|
-
setConfirmLoading(false);
|
|
181
|
-
}, [advancedTagsInfo]);
|
|
182
|
-
|
|
183
|
-
useEffect(() => {
|
|
184
|
-
if (tagsInfo.length > 0) {
|
|
185
|
-
setConfirmLoading(true);
|
|
186
|
-
}
|
|
187
|
-
}, [tagsInfo]);
|
|
188
|
-
|
|
189
|
-
useEffect(() => {
|
|
190
|
-
setConfirmLoading(isLoading!);
|
|
191
|
-
}, [isLoading]);
|
|
192
|
-
|
|
193
|
-
const modalClasses = classnames({
|
|
194
|
-
[styles.disabled]: confirmLoading,
|
|
195
|
-
}, styles.modal);
|
|
196
|
-
|
|
197
|
-
return (
|
|
198
|
-
<>
|
|
199
|
-
<Modal
|
|
200
|
-
destroyOnClose={true}
|
|
201
|
-
closeIcon={
|
|
202
|
-
<div className={styles.closeButton}>
|
|
203
|
-
<p>{closeText}</p><CloseOutlined />
|
|
204
|
-
</div>
|
|
205
|
-
}
|
|
206
|
-
open={open}
|
|
207
|
-
onOk={hideModal}
|
|
208
|
-
onCancel={hideModal}
|
|
209
|
-
maskClosable={false}
|
|
210
|
-
centered
|
|
211
|
-
width={'100%'}
|
|
212
|
-
footer={[
|
|
213
|
-
<Button key="submit" onClick={saveChanges}>
|
|
214
|
-
{buttonText}
|
|
215
|
-
</Button>
|
|
216
|
-
]}
|
|
217
|
-
className={modalClasses}
|
|
218
|
-
>
|
|
219
|
-
<div className={styles.tagsWrapper}>
|
|
220
|
-
<TagField tagsInfo={setTagsInfo} advancedTagsInfo={setAdvancedTagsInfo} advancedTags={advancedTagsList!} hideAdvancedFilters={advancedTagsList ? true : false} />
|
|
221
|
-
</div>
|
|
222
|
-
|
|
223
|
-
<div className={styles.tableWrapper}>
|
|
224
|
-
{tableData &&
|
|
225
|
-
<Table
|
|
226
|
-
{...tableData}
|
|
227
|
-
paginationInfo={setPageInfo}
|
|
228
|
-
rowSelectionInfo={setRowSelectionInfo}
|
|
229
|
-
headingTranslationsKey={tableData.headingTranslationsKey ? tableData.headingTranslationsKey : 'tableHeadings'}
|
|
230
|
-
/>
|
|
231
|
-
}
|
|
232
|
-
</div>
|
|
233
|
-
|
|
234
|
-
</Modal>
|
|
235
|
-
</>
|
|
236
|
-
)
|
|
237
|
-
}
|
|
238
|
-
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
.modal {
|
|
2
|
-
&.disabled {
|
|
3
|
-
pointer-events: none;
|
|
4
|
-
position: relative;
|
|
5
|
-
|
|
6
|
-
&:after {
|
|
7
|
-
content: '';
|
|
8
|
-
position: absolute;
|
|
9
|
-
top: 0;
|
|
10
|
-
left: 0;
|
|
11
|
-
width: 100%;
|
|
12
|
-
height: 100%;
|
|
13
|
-
background-color: rgba(var(--color-white-rgb), .6);
|
|
14
|
-
z-index: 9999999;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
:global {
|
|
19
|
-
.ant-modal-close {
|
|
20
|
-
width: auto;
|
|
21
|
-
color: var(--button-default-background);
|
|
22
|
-
|
|
23
|
-
&:hover {
|
|
24
|
-
background-color: transparent;
|
|
25
|
-
color: var(--button-default-background-hover-color);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.ant-modal-content {
|
|
30
|
-
padding: 36px 24px;
|
|
31
|
-
display: flex;
|
|
32
|
-
justify-content: center;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
text-align: center;
|
|
35
|
-
|
|
36
|
-
@media(min-width: 742px) {
|
|
37
|
-
padding: 32px;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.ant-modal-body {
|
|
42
|
-
width: 100%;
|
|
43
|
-
padding-top: 24px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ant-modal-footer {
|
|
47
|
-
button {
|
|
48
|
-
margin-left: auto;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.closeButton {
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
justify-content: center;
|
|
57
|
-
flex-direction: row;
|
|
58
|
-
gap: 8px;
|
|
59
|
-
color: inherit;
|
|
60
|
-
font-size: var(--font-size-body-3);
|
|
61
|
-
line-height: 100%;
|
|
62
|
-
font-weight: var(--font-weight-light);
|
|
63
|
-
text-transform: capitalize;
|
|
64
|
-
letter-spacing: .6px;
|
|
65
|
-
justify-self: flex-end;
|
|
66
|
-
|
|
67
|
-
> p {
|
|
68
|
-
padding: 0;
|
|
69
|
-
margin: 0;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.tagsWrapper {
|
|
74
|
-
max-width: 640px;
|
|
75
|
-
text-align: left;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react-vite";
|
|
2
|
-
import { Navigation, NavigationProps } from '.';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Navigation',
|
|
6
|
-
component: Navigation,
|
|
7
|
-
} as Meta;
|
|
8
|
-
|
|
9
|
-
const Template: StoryFn<NavigationProps> = (args: any) => <Navigation {...args}></Navigation>;
|
|
10
|
-
|
|
11
|
-
export const Primary = Template.bind({});
|
|
12
|
-
Primary.args = {
|
|
13
|
-
backLink: true,
|
|
14
|
-
homeLink: true,
|
|
15
|
-
title: 'Gestão de Aplicações',
|
|
16
|
-
loginLink: true,
|
|
17
|
-
options: [
|
|
18
|
-
{ label: 'Option 1', action: () => alert('Option 1 clicked') },
|
|
19
|
-
{ label: 'Option 2', action: () => alert('Option 2 clicked') },
|
|
20
|
-
{ label: 'Option 3', action: () => alert('Option 3 clicked') },
|
|
21
|
-
],};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import styles from './styles.module.scss';
|
|
2
|
-
import { Link } from '../Link';
|
|
3
|
-
import { DropdownButton } from '../DropdownButton';
|
|
4
|
-
import { ArrowLeftOutlined, HomeOutlined, LogoutOutlined, UserOutlined } from '@ant-design/icons';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { useEffect, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
export interface NavigationProps {
|
|
9
|
-
backLink?: boolean;
|
|
10
|
-
title: string;
|
|
11
|
-
homeLink?: boolean;
|
|
12
|
-
loginLink?: boolean;
|
|
13
|
-
userName?: string;
|
|
14
|
-
loginOnClickFunction?: () => void;
|
|
15
|
-
backLinkOnClickFunction?: () => void;
|
|
16
|
-
homeOnClickFunction?: () => void;
|
|
17
|
-
options?: { label: string, action: () => void }[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const PHONE_MAX_WIDTH = 768;
|
|
21
|
-
|
|
22
|
-
export const Navigation = (props: NavigationProps) => {
|
|
23
|
-
const { userName, backLink, title, homeLink, loginOnClickFunction, loginLink, backLinkOnClickFunction, homeOnClickFunction } = props;
|
|
24
|
-
const { t } = useTranslation();
|
|
25
|
-
|
|
26
|
-
const [isPhone, setIsPhone] = useState(false);
|
|
27
|
-
const [showDropdown, setShowDropdown] = useState(false);
|
|
28
|
-
|
|
29
|
-
const checkMediaQuery = () => {
|
|
30
|
-
const isPhoneWidth = window.innerWidth < PHONE_MAX_WIDTH;
|
|
31
|
-
setIsPhone(isPhoneWidth);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
checkMediaQuery();
|
|
36
|
-
window.addEventListener('resize', checkMediaQuery);
|
|
37
|
-
return () => window.removeEventListener('resize', checkMediaQuery);
|
|
38
|
-
}, [isPhone]);
|
|
39
|
-
|
|
40
|
-
const getInitials = (name: string) => {
|
|
41
|
-
const words = name.split(' ');
|
|
42
|
-
let initials = '';
|
|
43
|
-
|
|
44
|
-
if (isPhone) {
|
|
45
|
-
if (words.length === 1) {
|
|
46
|
-
initials = words[0].charAt(0);
|
|
47
|
-
} else if (words.length > 1) {
|
|
48
|
-
initials = `${words[0].charAt(0)}${words[words.length - 1].charAt(0)}`;
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
if (words.length === 1) {
|
|
52
|
-
initials = words[0];
|
|
53
|
-
} else if (words.length > 1) {
|
|
54
|
-
initials = `${words[0]} ${words[words.length - 1]}`;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return isPhone ? initials.toUpperCase() : initials;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div className={styles.navigation}>
|
|
63
|
-
<div className={styles.columnLeft}>
|
|
64
|
-
{backLink && <Link icon={<ArrowLeftOutlined />} linkSecondary onClick={backLinkOnClickFunction}> {!isPhone && t('navigation.back')} </Link>}
|
|
65
|
-
</div>
|
|
66
|
-
<div className={styles.columnCenter}>
|
|
67
|
-
<h1 className={`${styles.title} ${styles.titleMobile}`}>{title}</h1>
|
|
68
|
-
</div>
|
|
69
|
-
<div className={`${userName ? styles.columnRightWithUser : styles.columnRightWithNoUser}`}>
|
|
70
|
-
{userName && (
|
|
71
|
-
<DropdownButton
|
|
72
|
-
options={props.options!}
|
|
73
|
-
buttonText={props.userName!}
|
|
74
|
-
customButton={(
|
|
75
|
-
<Link
|
|
76
|
-
icon={<UserOutlined />}
|
|
77
|
-
linkSecondary
|
|
78
|
-
iconAlignRight
|
|
79
|
-
onClick={() => setShowDropdown(!showDropdown)}
|
|
80
|
-
>
|
|
81
|
-
{getInitials(userName)}
|
|
82
|
-
</Link>
|
|
83
|
-
)}
|
|
84
|
-
/>
|
|
85
|
-
)}
|
|
86
|
-
{homeLink && <Link icon={<HomeOutlined />} linkSecondary iconAlignRight onClick={homeOnClickFunction}> {!isPhone && t('navigation.home')} </Link>}
|
|
87
|
-
{loginLink && <Link onClick={loginOnClickFunction} icon={<LogoutOutlined />} linkSecondary iconAlignRight>{!isPhone && t('navigation.logout')}</Link>}
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
)
|
|
91
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
.navigation {
|
|
2
|
-
display: grid !important;
|
|
3
|
-
grid-template-columns: repeat(3, 1fr) !important;
|
|
4
|
-
justify-items: center !important;
|
|
5
|
-
align-items: center !important;
|
|
6
|
-
height: 45px !important;
|
|
7
|
-
gap: 0 24px !important;
|
|
8
|
-
position: relative !important;
|
|
9
|
-
padding: 0px !important;
|
|
10
|
-
|
|
11
|
-
@media (max-width: 767px) {
|
|
12
|
-
.navigation {
|
|
13
|
-
grid-template-columns: 1fr;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.columnLeft,
|
|
17
|
-
.columnRight {
|
|
18
|
-
justify-self: center;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.title {
|
|
22
|
-
text-align: center;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.titleMobile {
|
|
26
|
-
text-align: center;
|
|
27
|
-
white-space: nowrap;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
text-overflow: ellipsis;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.title {
|
|
34
|
-
font-size: var(--font-size-body-3);
|
|
35
|
-
font-weight: var(--font-weight-semibold);
|
|
36
|
-
text-transform: uppercase;
|
|
37
|
-
|
|
38
|
-
@media(min-width: 768px) {
|
|
39
|
-
font-size: var(--font-size-body-4);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.columnCenter {
|
|
44
|
-
align-self: center;
|
|
45
|
-
|
|
46
|
-
@media(max-width: 768px) {
|
|
47
|
-
position: unset !important;
|
|
48
|
-
top: unset !important;
|
|
49
|
-
margin: unset !important;
|
|
50
|
-
left: unset !important;
|
|
51
|
-
right: unset !important;
|
|
52
|
-
text-align: unset !important;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.columnLeft {
|
|
57
|
-
justify-self: start;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.columnRightWithUser {
|
|
61
|
-
justify-self: end;
|
|
62
|
-
|
|
63
|
-
@media(max-width: 460px) {
|
|
64
|
-
width: 80px;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
:global {
|
|
68
|
-
@media(max-width: 460px) {
|
|
69
|
-
:where(.css-dev-only-do-not-override-fpg3f5).ant-btn.ant-btn-icon-only {
|
|
70
|
-
padding-inline-start: 40px;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.columnRightWithNoUser {
|
|
77
|
-
justify-self: end;
|
|
78
|
-
|
|
79
|
-
@media(max-width: 460px) {
|
|
80
|
-
width: 60px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
:global {
|
|
84
|
-
@media(max-width: 460px) {
|
|
85
|
-
:where(.css-dev-only-do-not-override-fpg3f5).ant-btn.ant-btn-icon-only {
|
|
86
|
-
padding-inline-start: 22px;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { StoryFn } from "@storybook/react-vite";
|
|
2
|
-
import { Notification, ErrorNotificationProps } from '.';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Notification',
|
|
6
|
-
component: Notification,
|
|
7
|
-
} as any;
|
|
8
|
-
|
|
9
|
-
const Template: StoryFn<ErrorNotificationProps> = (args: any) => {
|
|
10
|
-
|
|
11
|
-
const { openNotificationWithIcon } = Notification({
|
|
12
|
-
message: args.message,
|
|
13
|
-
description: args.description,
|
|
14
|
-
showProgress: true
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<>
|
|
19
|
-
{openNotificationWithIcon('error')}
|
|
20
|
-
</>
|
|
21
|
-
)
|
|
22
|
-
};
|
|
23
|
-
export const Primary = Template.bind({});
|
|
24
|
-
Primary.args = {
|
|
25
|
-
message: "Sucesso",
|
|
26
|
-
description: "Parabéns, conseguiste!",
|
|
27
|
-
showProgress: true,
|
|
28
|
-
pauseOnHover: true
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { notification } from 'antd';
|
|
2
|
-
import { ArgsProps } from 'antd/lib/notification';
|
|
3
|
-
|
|
4
|
-
export interface ErrorNotificationProps extends ArgsProps {
|
|
5
|
-
message: string;
|
|
6
|
-
description: string;
|
|
7
|
-
duration?: number;
|
|
8
|
-
showProgress?: boolean;
|
|
9
|
-
pauseOnHover?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type NotificationType = 'success' | 'info' | 'warning' | 'error';
|
|
13
|
-
|
|
14
|
-
export const Notification = ({ message, description, duration, showProgress, pauseOnHover }: ErrorNotificationProps) => {
|
|
15
|
-
const openNotificationWithIcon = (type: NotificationType) => {
|
|
16
|
-
notification[type]({
|
|
17
|
-
message: message,
|
|
18
|
-
description: description,
|
|
19
|
-
duration: duration || 5,
|
|
20
|
-
showProgress: showProgress || false,
|
|
21
|
-
pauseOnHover: pauseOnHover || false
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
openNotificationWithIcon,
|
|
27
|
-
};
|
|
28
|
-
};
|