@omniumretail/component-library 1.2.51 → 1.2.52

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.2.51",
3
+ "version": "1.2.52",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -9,10 +9,10 @@ import {
9
9
  ExportOutlined,
10
10
  PrinterOutlined
11
11
  } from '@ant-design/icons';
12
- import { t } from 'i18next';
13
12
  import moment from 'moment';
14
13
  import React, { useEffect, useRef, useState } from 'react';
15
14
  import omniumLogo from '../../assets/images/omnium-retail-logo-white.png';
15
+ import { useTranslation } from 'react-i18next';
16
16
 
17
17
  interface Action {
18
18
  key: string;
@@ -68,16 +68,6 @@ export interface Footer2Props {
68
68
  disableNotifications?: boolean;
69
69
  }
70
70
 
71
- // Mapeamento de tipos de ações para seus ícones e labels padrão
72
- const defaultActionProps: Record<string, { icon: React.ReactNode; label: string }> = {
73
- [ActionType.DELETE]: { icon: <DeleteOutlined />, label: t('navigation.delete') },
74
- [ActionType.UPDATE]: { icon: <ReloadOutlined />, label: t('navigation.update') },
75
- [ActionType.CREATE]: { icon: <PlusOutlined />, label: t('navigation.create') },
76
- [ActionType.EDIT]: { icon: <EditOutlined />, label: t('navigation.edit') },
77
- [ActionType.EXPORT]: { icon: <ExportOutlined />, label: t('navigation.export') },
78
- [ActionType.PRINT]: { icon: <PrinterOutlined />, label: t('navigation.print') },
79
- };
80
-
81
71
  export const Footer2 = (props: Footer2Props) => {
82
72
  const {
83
73
  onBackClick,
@@ -96,6 +86,17 @@ export const Footer2 = (props: Footer2Props) => {
96
86
  const [isMenuOpen, setIsMenuOpen] = useState(false);
97
87
  const menuRef = useRef<HTMLDivElement>(null);
98
88
  const [isMobile, setIsMobile] = useState(window.innerWidth < 768);
89
+ const { t } = useTranslation();
90
+
91
+ // Mapeamento de tipos de ações para seus ícones e labels padrão
92
+ const defaultActionProps: Record<string, { icon: React.ReactNode; label: string }> = {
93
+ [ActionType.DELETE]: { icon: <DeleteOutlined />, label: t('navigation.delete') },
94
+ [ActionType.UPDATE]: { icon: <ReloadOutlined />, label: t('navigation.update') },
95
+ [ActionType.CREATE]: { icon: <PlusOutlined />, label: t('navigation.create') },
96
+ [ActionType.EDIT]: { icon: <EditOutlined />, label: t('navigation.edit') },
97
+ [ActionType.EXPORT]: { icon: <ExportOutlined />, label: t('navigation.export') },
98
+ [ActionType.PRINT]: { icon: <PrinterOutlined />, label: t('navigation.print') },
99
+ };
99
100
 
100
101
  useEffect(() => {
101
102
  const time = (function updateDate() {
@@ -124,11 +125,11 @@ export const Footer2 = (props: Footer2Props) => {
124
125
  // Converter ActionConfig para Action
125
126
  const standardActions = actions.map(actionConfig => {
126
127
  const actionType = actionConfig.type;
127
- const defaultProps = defaultActionProps[actionType] || {
128
+ const defaultProps = defaultActionProps[actionType] || {
128
129
  label: String(actionType),
129
130
  icon: <PlusOutlined />
130
131
  };
131
-
132
+
132
133
  return {
133
134
  key: actionType,
134
135
  label: defaultProps.label,
@@ -140,7 +141,7 @@ export const Footer2 = (props: Footer2Props) => {
140
141
 
141
142
  // Combinar com ações personalizadas
142
143
  const combinedActions = [...standardActions, ...customActions];
143
-
144
+
144
145
  // Ordenar por label
145
146
  return combinedActions.sort((a, b) => a.label.localeCompare(b.label));
146
147
  };
@@ -185,8 +186,8 @@ export const Footer2 = (props: Footer2Props) => {
185
186
 
186
187
  <div className={styles.navigation}>
187
188
  {onBackClick && (
188
- <div
189
- className={`${styles.navItem} ${disableBackButton ? styles.disabled : ''}`}
189
+ <div
190
+ className={`${styles.navItem} ${disableBackButton ? styles.disabled : ''}`}
190
191
  onClick={disableBackButton ? undefined : onBackClick}
191
192
  >
192
193
  <ArrowLeftOutlined className={styles.navIcon} />