@omniumretail/component-library 1.2.53 → 1.2.54

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.
@@ -48,5 +48,6 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
48
48
  cleanRowSelection?: boolean;
49
49
  getRowActions?: (record: any) => any;
50
50
  customSelectAllButton?: string;
51
+ buttonActionIcon?: any;
51
52
  }
52
53
  export declare const ResponsiveTable: (props: ResponsiveTableCustomProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.2.53",
3
+ "version": "1.2.54",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -54,6 +54,7 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
54
54
  cleanRowSelection?: boolean;
55
55
  getRowActions?: (record: any) => any;
56
56
  customSelectAllButton?: string;
57
+ buttonActionIcon?: any;
57
58
  }
58
59
 
59
60
  export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
@@ -85,7 +86,8 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
85
86
  buttonActionLabel,
86
87
  cleanRowSelection,
87
88
  getRowActions,
88
- customSelectAllButton
89
+ customSelectAllButton,
90
+ buttonActionIcon
89
91
  } = props;
90
92
 
91
93
  const [customFilters, setCustomFilters] = useState<any>([]);
@@ -217,21 +219,46 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
217
219
  render: (_: any, record: any) => {
218
220
  const rowActions = getRowActions ? getRowActions(record) : null;
219
221
 
220
- if ((!items?.[0] && !rowActions)) return null;
222
+ if ((!items?.[0] && !rowActions)) return null;
221
223
 
222
224
  const actions = rowActions ? rowActions : items;
223
225
 
224
226
  const buttonLabel = buttonActionLabel ? buttonActionLabel(record) : null;
225
-
226
- const buttonClass = typeof buttonActionStyle === 'function'
227
- ? buttonActionStyle(record) // Se for uma função, chama com o `record`
228
- : buttonActionStyle || ''; // Se for string, usa diretamente
227
+
228
+ const buttonClass = typeof buttonActionStyle === 'function'
229
+ ? buttonActionStyle(record) // Se for uma função, chama com o `record`
230
+ : buttonActionStyle || ''; // Se for string, usa diretamente
231
+
232
+ const renderActionElement = () => {
233
+ if (buttonActionIcon) {
234
+ return (
235
+ <span
236
+ className={buttonClass}
237
+ onClick={() => buttonActionMethod?.()}
238
+ >
239
+ {buttonActionIcon}
240
+ </span>
241
+ );
242
+ }
243
+
244
+ // Senão, renderiza botão como antes
245
+ if (buttonActionName || buttonLabel) {
246
+ return (
247
+ <Button
248
+ customClass={buttonClass}
249
+ onClick={() => buttonActionMethod?.()}
250
+ >
251
+ {buttonActionName || buttonLabel}
252
+ </Button>
253
+ );
254
+ }
255
+
256
+ return null;
257
+ };
229
258
 
230
259
  return (
231
260
  <Space size="middle">
232
- {(buttonActionName || buttonLabel) &&
233
- <Button customClass={buttonClass} onClick={() => buttonActionMethod?.()}>{buttonActionName || buttonLabel}</Button>
234
- }
261
+ {renderActionElement()}
235
262
 
236
263
  <Dropdown menu={{ items: actions }}>
237
264
  <a>