@omniumretail/component-library 1.2.71 → 1.2.72
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 +12 -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,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import * as XLSX from 'xlsx';
|
|
3
|
-
import { FileExcelOutlined } from '@ant-design/icons';
|
|
4
|
-
import styles from './styles.module.scss';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
|
|
7
|
-
interface TableExportButtonProps {
|
|
8
|
-
data: Record<string, any>[];
|
|
9
|
-
fileName: string;
|
|
10
|
-
customClass?: string;
|
|
11
|
-
columnTranslations: Record<string, string>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const TableExportButton = (props: TableExportButtonProps) => {
|
|
15
|
-
const exportToXLS = () => {
|
|
16
|
-
const wb = XLSX.utils.book_new();
|
|
17
|
-
const ws = XLSX.utils.json_to_sheet(props.data);
|
|
18
|
-
|
|
19
|
-
// Aplicar estilos às células do cabeçalho
|
|
20
|
-
const headerKeys = Object.keys(props.columnTranslations);
|
|
21
|
-
headerKeys.forEach((key, index) => {
|
|
22
|
-
const cellAddress = XLSX.utils.encode_cell({ c: index, r: 0 });
|
|
23
|
-
ws[cellAddress].v = props.columnTranslations[key]; // Substituir o valor pela tradução
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
|
27
|
-
XLSX.writeFile(wb, `${props.fileName}.xlsx`);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const linkClasses = classNames({
|
|
31
|
-
[`${props.customClass}`]: props.customClass,
|
|
32
|
-
}, [styles.iconStyle]);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<FileExcelOutlined onClick={exportToXLS} className={linkClasses} />
|
|
36
|
-
);
|
|
37
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react-vite";
|
|
2
|
-
import { Footer, FooterProps } from '.';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Footer',
|
|
6
|
-
component: Footer,
|
|
7
|
-
} as Meta;
|
|
8
|
-
|
|
9
|
-
const Template: StoryFn<FooterProps> = (args: any) => <Footer {...args}></Footer>;
|
|
10
|
-
|
|
11
|
-
export const Primary = Template.bind({});
|
|
12
|
-
Primary.args = {
|
|
13
|
-
storeName: 'Levis',
|
|
14
|
-
favIcon: true
|
|
15
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import styles from './styles.module.scss';
|
|
3
|
-
import omniumLogo from '../../assets/images/omnium-retail-logo-white.png';
|
|
4
|
-
import omniumIcon from '../../assets/images/omnium-retail_icon.png';
|
|
5
|
-
import dayjs from "dayjs";
|
|
6
|
-
|
|
7
|
-
export interface FooterProps {
|
|
8
|
-
storeName: string;
|
|
9
|
-
favIcon?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Footer = (props: FooterProps) => {
|
|
13
|
-
const [date, setDate] = useState(dayjs());
|
|
14
|
-
const { storeName = 'Missing Store Name' } = props;
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const time = (function updateDate() {
|
|
18
|
-
const nextMinute = dayjs().add(1, "minute");
|
|
19
|
-
return setTimeout(() => {
|
|
20
|
-
setDate(dayjs());
|
|
21
|
-
updateDate();
|
|
22
|
-
}, nextMinute.valueOf() - dayjs().valueOf());
|
|
23
|
-
}());
|
|
24
|
-
|
|
25
|
-
return () => clearTimeout(time);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div className={styles.footer}>
|
|
30
|
-
<div className={styles.content}>
|
|
31
|
-
<div className={styles.brand}>{storeName}</div>
|
|
32
|
-
<div className={styles.date}>{date.format('DD/MM/YYYY')}</div>
|
|
33
|
-
<div className={styles.time}>{date.format('HH:mm')}</div>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<div>
|
|
37
|
-
{props.favIcon && <img src={omniumIcon} className={styles.omniumLogoImg} alt="omnium icon" />}
|
|
38
|
-
|
|
39
|
-
<img src={omniumLogo} className={styles.omniumLogoImg} alt="omnium logo" />
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
.footer {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: space-between;
|
|
4
|
-
align-items: center;
|
|
5
|
-
flex-wrap: nowrap;
|
|
6
|
-
gap: 0 16px;
|
|
7
|
-
background-color: var(--color-black);
|
|
8
|
-
position: fixed;
|
|
9
|
-
bottom: 0;
|
|
10
|
-
width: 100%;
|
|
11
|
-
padding: 12px 24px;
|
|
12
|
-
font-size: var(--font-size-body-1);
|
|
13
|
-
color: var(--color-grey-light);
|
|
14
|
-
height: 60px;
|
|
15
|
-
flex-direction: row;
|
|
16
|
-
text-align: left;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
|
|
19
|
-
.brand {
|
|
20
|
-
color: var(--grey2);
|
|
21
|
-
width: 100%;
|
|
22
|
-
margin-bottom: 4px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.time {
|
|
26
|
-
margin-left: 8px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.date,
|
|
30
|
-
.time {
|
|
31
|
-
display: inline-block;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.omniumLogoImg {
|
|
35
|
-
height: 25px;
|
|
36
|
-
align-self: flex-end;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react-vite";
|
|
2
|
-
import { Footer2, Footer2Props, ActionType } from '.';
|
|
3
|
-
import {
|
|
4
|
-
SettingOutlined,
|
|
5
|
-
FileTextOutlined,
|
|
6
|
-
TableOutlined,
|
|
7
|
-
FilePdfOutlined,
|
|
8
|
-
PrinterOutlined,
|
|
9
|
-
EyeOutlined,
|
|
10
|
-
UserOutlined,
|
|
11
|
-
FileOutlined,
|
|
12
|
-
BarChartOutlined,
|
|
13
|
-
} from '@ant-design/icons';
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
title: 'Footer2',
|
|
17
|
-
component: Footer2,
|
|
18
|
-
} as Meta;
|
|
19
|
-
|
|
20
|
-
const Template: StoryFn<Footer2Props> = (args: any) => <Footer2 {...args}></Footer2>;
|
|
21
|
-
|
|
22
|
-
const notifications = [
|
|
23
|
-
{
|
|
24
|
-
"Id": "662C390B-A38F-45AB-B97C-2D00F0A8ACAD",
|
|
25
|
-
"Title": "Creation of an Evaluation Cycle",
|
|
26
|
-
"Description": "A new evaluation cycle was created. You must answer it.",
|
|
27
|
-
"RedirectURL": "https://www.google.pt",
|
|
28
|
-
"Icon": "https://omniumfont.s3.eu-west-1.amazonaws.com/Assets/images/aacp-image.png",
|
|
29
|
-
"ExpirationDate": 1736899200,
|
|
30
|
-
"Criticality": {
|
|
31
|
-
"Id": "F133ED4C-6C72-4CDC-86A1-27A76E6BDE7F",
|
|
32
|
-
"Name": "High",
|
|
33
|
-
"ColorHex": "#E05151"
|
|
34
|
-
},
|
|
35
|
-
"IsRead": true
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"Id": "0AF18720-1C94-48CD-8DF3-D254077E8363",
|
|
39
|
-
"Title": "Creation of an Evaluation Cycle",
|
|
40
|
-
"Description": "A new evaluation cycle was created. You must answer it.",
|
|
41
|
-
"RedirectURL": "https://www.google.pt",
|
|
42
|
-
"Icon": "https://omniumfont.s3.eu-west-1.amazonaws.com/Assets/images/aacp-image.png",
|
|
43
|
-
"ExpirationDate": 1736899200,
|
|
44
|
-
"Criticality": {
|
|
45
|
-
"Id": "F133ED4C-6C72-4CDC-86A1-27A76E6BDE7F",
|
|
46
|
-
"Name": "High",
|
|
47
|
-
"ColorHex": "#E05151"
|
|
48
|
-
},
|
|
49
|
-
"IsRead": true
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
const customActions = [
|
|
54
|
-
{
|
|
55
|
-
key: 'definicoes',
|
|
56
|
-
label: 'Definições',
|
|
57
|
-
icon: <SettingOutlined />,
|
|
58
|
-
onClick: () => console.log('Definições'),
|
|
59
|
-
disabled: true
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
key: 'relatorios',
|
|
63
|
-
label: 'Relatórios Relatórios',
|
|
64
|
-
icon: <BarChartOutlined />,
|
|
65
|
-
subItems: [
|
|
66
|
-
{
|
|
67
|
-
key: 'relatorio-mensal',
|
|
68
|
-
label: 'Relatório Mensal',
|
|
69
|
-
icon: <FileTextOutlined />,
|
|
70
|
-
onClick: () => console.log('Relatório Mensal')
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
key: 'relatorio-anual',
|
|
74
|
-
label: 'Relatório Anual',
|
|
75
|
-
icon: <FileTextOutlined />,
|
|
76
|
-
onClick: () => console.log('Relatório Anual')
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
// Ações padrão com submenus
|
|
83
|
-
const handleCreate = () => console.log('Criar novo item');
|
|
84
|
-
const handleEdit = () => console.log('Editar item');
|
|
85
|
-
const handleDelete = () => console.log('Excluir item');
|
|
86
|
-
const handleExport = () => console.log('Exportar item');
|
|
87
|
-
|
|
88
|
-
const actions2 = [
|
|
89
|
-
{
|
|
90
|
-
type: ActionType.CREATE,
|
|
91
|
-
subItems: [
|
|
92
|
-
{
|
|
93
|
-
key: 'create-user',
|
|
94
|
-
label: 'Criar Usuário',
|
|
95
|
-
icon: <UserOutlined />,
|
|
96
|
-
onClick: () => console.log('Criar Usuário')
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
key: 'create-document',
|
|
100
|
-
label: 'Criar Documento',
|
|
101
|
-
icon: <FileOutlined />,
|
|
102
|
-
onClick: () => console.log('Criar Documento')
|
|
103
|
-
}
|
|
104
|
-
]
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
type: ActionType.EDIT,
|
|
108
|
-
onClick: handleEdit,
|
|
109
|
-
disabled: true
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
type: ActionType.DELETE,
|
|
113
|
-
onClick: handleDelete
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
type: ActionType.EXPORT,
|
|
117
|
-
subItems: [
|
|
118
|
-
{
|
|
119
|
-
key: 'export-pdf',
|
|
120
|
-
label: 'Exportar PDF',
|
|
121
|
-
icon: <FilePdfOutlined />,
|
|
122
|
-
onClick: () => console.log('Exportar PDF')
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
key: 'export-excel',
|
|
126
|
-
label: 'Exportar Excel',
|
|
127
|
-
icon: <TableOutlined />,
|
|
128
|
-
onClick: () => console.log('Exportar Excel')
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
type: ActionType.PRINT,
|
|
134
|
-
subItems: [
|
|
135
|
-
{
|
|
136
|
-
key: 'print-preview',
|
|
137
|
-
label: 'Visualizar',
|
|
138
|
-
icon: <EyeOutlined />,
|
|
139
|
-
onClick: () => console.log('Visualizar Impressão')
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
key: 'print-direct',
|
|
143
|
-
label: 'Imprimir',
|
|
144
|
-
icon: <PrinterOutlined />,
|
|
145
|
-
onClick: () => console.log('Imprimir Diretamente')
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
];
|
|
150
|
-
|
|
151
|
-
export const Primary = Template.bind({});
|
|
152
|
-
Primary.args = {
|
|
153
|
-
notifications: notifications,
|
|
154
|
-
customActions: customActions,
|
|
155
|
-
actions: actions2,
|
|
156
|
-
disableBackButton: true,
|
|
157
|
-
companyName: 'a2ai',
|
|
158
|
-
footerName: 'Minha Aplicação',
|
|
159
|
-
onBackClick: () => console.log('Voltar'),
|
|
160
|
-
onFilterChange: (filter: any) => console.log('Filtro:', filter),
|
|
161
|
-
onNotificationClick: (id: any, url: any) => console.log('Notificação:', id, url),
|
|
162
|
-
handleMarkAllAsRead: () => console.log('Marcar todas como lidas'),
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export const WithoutSubmenus = Template.bind({});
|
|
166
|
-
WithoutSubmenus.args = {
|
|
167
|
-
notifications: notifications,
|
|
168
|
-
customActions: [
|
|
169
|
-
{
|
|
170
|
-
key: 'definicoes',
|
|
171
|
-
label: 'Definições',
|
|
172
|
-
icon: <SettingOutlined />,
|
|
173
|
-
onClick: () => console.log('Definições')
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
actions: [
|
|
177
|
-
{ type: ActionType.CREATE, onClick: handleCreate },
|
|
178
|
-
{ type: ActionType.EDIT, onClick: handleEdit },
|
|
179
|
-
{ type: ActionType.DELETE, onClick: handleDelete }
|
|
180
|
-
],
|
|
181
|
-
disableBackButton: false,
|
|
182
|
-
companyName: 'omnium',
|
|
183
|
-
footerName: 'Sem Submenus',
|
|
184
|
-
};
|
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
import { BellNotifications } from '../BellNotifications';
|
|
2
|
-
import styles from './styles.module.scss';
|
|
3
|
-
import {
|
|
4
|
-
ArrowLeftOutlined,
|
|
5
|
-
PlusOutlined,
|
|
6
|
-
DeleteOutlined,
|
|
7
|
-
ReloadOutlined,
|
|
8
|
-
EditOutlined,
|
|
9
|
-
ExportOutlined,
|
|
10
|
-
PrinterOutlined,
|
|
11
|
-
RightOutlined,
|
|
12
|
-
LeftCircleOutlined
|
|
13
|
-
} from '@ant-design/icons';
|
|
14
|
-
import dayjs from "dayjs";
|
|
15
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
16
|
-
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import { getCompanyLogos } from '../../constants/logoCompanyHelper';
|
|
18
|
-
|
|
19
|
-
interface SubAction {
|
|
20
|
-
key: string;
|
|
21
|
-
label: string;
|
|
22
|
-
icon: React.ReactNode;
|
|
23
|
-
onClick: () => void;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface Action {
|
|
28
|
-
key: string;
|
|
29
|
-
label: string;
|
|
30
|
-
icon: React.ReactNode;
|
|
31
|
-
onClick?: () => void;
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
subItems?: SubAction[];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface Criticality {
|
|
37
|
-
Id: string;
|
|
38
|
-
Name: string;
|
|
39
|
-
ColorHex: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface BellNotification {
|
|
43
|
-
Id: string;
|
|
44
|
-
Title: string;
|
|
45
|
-
Description: string;
|
|
46
|
-
RedirectURL: string;
|
|
47
|
-
Icon: string;
|
|
48
|
-
ExpirationDate: number;
|
|
49
|
-
Criticality: Criticality;
|
|
50
|
-
IsRead: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Definindo ações padrão disponíveis
|
|
54
|
-
export enum ActionType {
|
|
55
|
-
DELETE = 'delete',
|
|
56
|
-
UPDATE = 'update',
|
|
57
|
-
CREATE = 'create',
|
|
58
|
-
EDIT = 'edit',
|
|
59
|
-
EXPORT = 'export',
|
|
60
|
-
PRINT = 'print'
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface ActionConfig {
|
|
64
|
-
type: ActionType | string;
|
|
65
|
-
onClick?: () => void;
|
|
66
|
-
disabled?: boolean;
|
|
67
|
-
subItems?: SubAction[];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface Footer2Props {
|
|
71
|
-
onBackClick?: () => void;
|
|
72
|
-
notifications: BellNotification[];
|
|
73
|
-
onFilterChange: (filter: 'all' | 'unread') => void;
|
|
74
|
-
onNotificationClick: (id: string, url: string) => void;
|
|
75
|
-
handleMarkAllAsRead: () => void;
|
|
76
|
-
customActions?: Action[];
|
|
77
|
-
actions?: ActionConfig[];
|
|
78
|
-
footerName: string;
|
|
79
|
-
disableBackButton?: boolean;
|
|
80
|
-
disableNotifications?: boolean;
|
|
81
|
-
companyName?: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export const Footer2 = (props: Footer2Props) => {
|
|
85
|
-
const {
|
|
86
|
-
onBackClick,
|
|
87
|
-
notifications,
|
|
88
|
-
onFilterChange,
|
|
89
|
-
onNotificationClick,
|
|
90
|
-
handleMarkAllAsRead,
|
|
91
|
-
customActions = [],
|
|
92
|
-
actions = [],
|
|
93
|
-
footerName = '',
|
|
94
|
-
disableBackButton = false,
|
|
95
|
-
disableNotifications = false,
|
|
96
|
-
companyName = 'omnium',
|
|
97
|
-
} = props;
|
|
98
|
-
|
|
99
|
-
const [date, setDate] = useState(dayjs());
|
|
100
|
-
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
101
|
-
const [currentSubmenu, setCurrentSubmenu] = useState<string | null>(null);
|
|
102
|
-
const menuRef = useRef<HTMLDivElement>(null);
|
|
103
|
-
const [isMobile, setIsMobile] = useState(window.innerWidth < 768);
|
|
104
|
-
const { t } = useTranslation();
|
|
105
|
-
const companyLogos = getCompanyLogos(companyName);
|
|
106
|
-
|
|
107
|
-
// Mapeamento de tipos de ações para seus ícones e labels padrão
|
|
108
|
-
const defaultActionProps: Record<string, { icon: React.ReactNode; label: string }> = {
|
|
109
|
-
[ActionType.DELETE]: { icon: <DeleteOutlined />, label: t('navigation.delete') },
|
|
110
|
-
[ActionType.UPDATE]: { icon: <ReloadOutlined />, label: t('navigation.update') },
|
|
111
|
-
[ActionType.CREATE]: { icon: <PlusOutlined />, label: t('navigation.create') },
|
|
112
|
-
[ActionType.EDIT]: { icon: <EditOutlined />, label: t('navigation.edit') },
|
|
113
|
-
[ActionType.EXPORT]: { icon: <ExportOutlined />, label: t('navigation.export') },
|
|
114
|
-
[ActionType.PRINT]: { icon: <PrinterOutlined />, label: t('navigation.print') },
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
useEffect(() => {
|
|
118
|
-
const time = (function updateDate() {
|
|
119
|
-
const nextMinute = dayjs().add(1, "minute");
|
|
120
|
-
return setTimeout(() => {
|
|
121
|
-
setDate(dayjs());
|
|
122
|
-
updateDate();
|
|
123
|
-
}, nextMinute.valueOf() - dayjs().valueOf());
|
|
124
|
-
}());
|
|
125
|
-
|
|
126
|
-
return () => clearTimeout(time);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
const handleResize = () => {
|
|
131
|
-
setIsMobile(window.innerWidth < 768);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
window.addEventListener('resize', handleResize);
|
|
135
|
-
return () => {
|
|
136
|
-
window.removeEventListener('resize', handleResize);
|
|
137
|
-
};
|
|
138
|
-
}, []);
|
|
139
|
-
|
|
140
|
-
const getAllActions = (): Action[] => {
|
|
141
|
-
// Converter ActionConfig para Action
|
|
142
|
-
const standardActions = actions.map(actionConfig => {
|
|
143
|
-
const actionType = actionConfig.type;
|
|
144
|
-
const defaultProps = defaultActionProps[actionType] || {
|
|
145
|
-
label: String(actionType),
|
|
146
|
-
icon: <PlusOutlined />
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
key: actionType,
|
|
151
|
-
label: defaultProps.label,
|
|
152
|
-
icon: defaultProps.icon,
|
|
153
|
-
onClick: actionConfig.onClick,
|
|
154
|
-
disabled: actionConfig.disabled || false,
|
|
155
|
-
subItems: actionConfig.subItems
|
|
156
|
-
};
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
// Combinar com ações personalizadas
|
|
160
|
-
const combinedActions = [...standardActions, ...customActions];
|
|
161
|
-
|
|
162
|
-
// Ordenar por label
|
|
163
|
-
return combinedActions.sort((a, b) => a.label.localeCompare(b.label));
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const allActions = getAllActions();
|
|
167
|
-
|
|
168
|
-
const toggleMenu = () => {
|
|
169
|
-
if (isMenuOpen) {
|
|
170
|
-
setCurrentSubmenu(null);
|
|
171
|
-
}
|
|
172
|
-
setIsMenuOpen(!isMenuOpen);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const handleActionClick = (action: Action) => {
|
|
176
|
-
if (action.subItems && action.subItems.length > 0) {
|
|
177
|
-
setCurrentSubmenu(action.key);
|
|
178
|
-
} else {
|
|
179
|
-
if (action.onClick && !action.disabled) {
|
|
180
|
-
action.onClick();
|
|
181
|
-
setIsMenuOpen(false);
|
|
182
|
-
setCurrentSubmenu(null);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
const handleBackToMain = () => {
|
|
188
|
-
setCurrentSubmenu(null);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const handleSubActionClick = (subAction: SubAction) => {
|
|
192
|
-
if (subAction.onClick && !subAction.disabled) {
|
|
193
|
-
subAction.onClick();
|
|
194
|
-
setIsMenuOpen(false);
|
|
195
|
-
setCurrentSubmenu(null);
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
// Handle click outside to close menu
|
|
200
|
-
useEffect(() => {
|
|
201
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
202
|
-
if (
|
|
203
|
-
isMenuOpen &&
|
|
204
|
-
menuRef.current &&
|
|
205
|
-
!menuRef.current.contains(event.target as Node) &&
|
|
206
|
-
!(event.target as Element).closest(`.${styles.addButton}`)
|
|
207
|
-
) {
|
|
208
|
-
setIsMenuOpen(false);
|
|
209
|
-
setCurrentSubmenu(null);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
214
|
-
|
|
215
|
-
return () => {
|
|
216
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
217
|
-
};
|
|
218
|
-
}, [isMenuOpen]);
|
|
219
|
-
|
|
220
|
-
const plusIconClass = isMenuOpen ? `${styles.addIcon} ${styles.rotateIcon}` : styles.addIcon;
|
|
221
|
-
|
|
222
|
-
const getCurrentActions = () => {
|
|
223
|
-
if (currentSubmenu) {
|
|
224
|
-
const parentAction = allActions.find(action => action.key === currentSubmenu);
|
|
225
|
-
return parentAction?.subItems || [];
|
|
226
|
-
}
|
|
227
|
-
return allActions;
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const currentActions = getCurrentActions();
|
|
231
|
-
|
|
232
|
-
return (
|
|
233
|
-
<div className={`${styles.footer}`}>
|
|
234
|
-
{!isMobile &&
|
|
235
|
-
<div className={styles.content}>
|
|
236
|
-
<div className={styles.brand}>{footerName}</div>
|
|
237
|
-
<div className={styles.date}>{date.format('DD/MM/YYYY')}</div>
|
|
238
|
-
<div className={styles.time}>{date.format('HH:mm')}</div>
|
|
239
|
-
</div>
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
<div className={styles.navigation}>
|
|
243
|
-
{onBackClick && (
|
|
244
|
-
<div
|
|
245
|
-
className={`${styles.navItem} ${disableBackButton ? styles.disabled : ''}`}
|
|
246
|
-
onClick={disableBackButton ? undefined : onBackClick}
|
|
247
|
-
>
|
|
248
|
-
<ArrowLeftOutlined className={styles.navIcon} />
|
|
249
|
-
<span className={styles.navText}>{t('navigation.back')}</span>
|
|
250
|
-
</div>
|
|
251
|
-
)}
|
|
252
|
-
|
|
253
|
-
<div className={styles.addButtonContainer}>
|
|
254
|
-
<div className={styles.addButton} onClick={toggleMenu}>
|
|
255
|
-
<PlusOutlined className={plusIconClass} />
|
|
256
|
-
</div>
|
|
257
|
-
|
|
258
|
-
{isMenuOpen && (
|
|
259
|
-
<div className={`${styles.circularMenu}`} ref={menuRef}>
|
|
260
|
-
{currentSubmenu && (
|
|
261
|
-
|
|
262
|
-
<div
|
|
263
|
-
className={styles.backButton}
|
|
264
|
-
onClick={handleBackToMain}
|
|
265
|
-
>
|
|
266
|
-
<LeftCircleOutlined className={styles.backIcon} />
|
|
267
|
-
</div>
|
|
268
|
-
)}
|
|
269
|
-
|
|
270
|
-
{currentActions.map((action, index) => (
|
|
271
|
-
<div
|
|
272
|
-
key={action.key}
|
|
273
|
-
className={`${styles.circleMenuItem} ${action.disabled ? styles.disabled : ''}`}
|
|
274
|
-
onClick={() => {
|
|
275
|
-
if (currentSubmenu) {
|
|
276
|
-
handleSubActionClick(action as SubAction);
|
|
277
|
-
} else {
|
|
278
|
-
handleActionClick(action as Action);
|
|
279
|
-
}
|
|
280
|
-
}}
|
|
281
|
-
>
|
|
282
|
-
<div className={styles.circleMenuIcon}>
|
|
283
|
-
{action.icon}
|
|
284
|
-
</div>
|
|
285
|
-
|
|
286
|
-
<div className={styles.circleMenuLabel}>
|
|
287
|
-
{action.label}
|
|
288
|
-
</div>
|
|
289
|
-
|
|
290
|
-
{!currentSubmenu && (action as Action).subItems && (action as Action).subItems!.length > 0 && (
|
|
291
|
-
<div className={styles.submenuIndicator}>
|
|
292
|
-
<RightOutlined />
|
|
293
|
-
</div>
|
|
294
|
-
)}
|
|
295
|
-
</div>
|
|
296
|
-
))}
|
|
297
|
-
</div>
|
|
298
|
-
)}
|
|
299
|
-
</div>
|
|
300
|
-
|
|
301
|
-
{!disableNotifications && (
|
|
302
|
-
<div className={styles.navItem}>
|
|
303
|
-
<BellNotifications
|
|
304
|
-
notifications={notifications}
|
|
305
|
-
onFilterChange={onFilterChange}
|
|
306
|
-
onNotificationClick={onNotificationClick}
|
|
307
|
-
handleMarkAllAsRead={handleMarkAllAsRead}
|
|
308
|
-
/>
|
|
309
|
-
|
|
310
|
-
<span className={styles.navText}>{t('navigation.notifications')}</span>
|
|
311
|
-
</div>
|
|
312
|
-
)}
|
|
313
|
-
</div>
|
|
314
|
-
|
|
315
|
-
{!isMobile &&
|
|
316
|
-
<div>
|
|
317
|
-
<img src={companyLogos.white} alt={companyLogos.alt} className={companyName === 'omnium' ? styles.omniumLogoImg : styles.a2aiLogoImg} />
|
|
318
|
-
</div>
|
|
319
|
-
}
|
|
320
|
-
</div>
|
|
321
|
-
);
|
|
322
|
-
};
|