next-helios-fe 1.7.11 → 1.7.13

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": "next-helios-fe",
3
- "version": "1.7.11",
3
+ "version": "1.7.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -43,6 +43,7 @@ interface TableProps {
43
43
  customTool?: {
44
44
  icon: string;
45
45
  variant: "primary" | "secondary" | "success" | "warning" | "danger";
46
+ show?: boolean;
46
47
  onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
47
48
  }[];
48
49
  };
@@ -63,7 +64,7 @@ interface TableProps {
63
64
  }[]
64
65
  ) => void;
65
66
  };
66
- actionColumn?: (e: any) => React.ReactNode;
67
+ actionColumn?: (e?: any) => React.ReactNode;
67
68
  }
68
69
 
69
70
  interface TableComponentProps extends React.FC<TableProps> {
@@ -457,11 +458,12 @@ export const Table: TableComponentProps = ({
457
458
  );
458
459
  }
459
460
  })}
460
- {actionColumn && (
461
- <td className="sticky right-0 w-8 px-4 py-1.5 bg-secondary-bg text-center">
462
- {actionColumn(item)}
463
- </td>
464
- )}
461
+ {actionColumn &&
462
+ React.Children.toArray(actionColumn()).length !== 0 && (
463
+ <td className="sticky right-0 w-8 px-4 py-1.5 bg-secondary-bg text-center">
464
+ {actionColumn(item)}
465
+ </td>
466
+ )}
465
467
  </tr>
466
468
  );
467
469
  });
@@ -494,18 +496,20 @@ export const Table: TableComponentProps = ({
494
496
  ? "bg-danger hover:bg-danger-dark"
495
497
  : "bg-primary hover:bg-primary-dark";
496
498
 
497
- return (
498
- <button
499
- key={index}
500
- type="button"
501
- className={`p-1.5 rounded-full text-white ${variant}`}
502
- onClick={(e) => {
503
- item.onClick && item.onClick(e);
504
- }}
505
- >
506
- <Icon icon={item.icon} className="text-2xl" />
507
- </button>
508
- );
499
+ if (item.show !== false) {
500
+ return (
501
+ <button
502
+ key={index}
503
+ type="button"
504
+ className={`p-1.5 rounded-full text-white ${variant}`}
505
+ onClick={(e) => {
506
+ item.onClick && item.onClick(e);
507
+ }}
508
+ >
509
+ <Icon icon={item.icon} className="text-2xl" />
510
+ </button>
511
+ );
512
+ }
509
513
  })}
510
514
  {options?.toolbar?.addData?.show !== false && (
511
515
  <button
@@ -686,21 +690,22 @@ export const Table: TableComponentProps = ({
686
690
  </th>
687
691
  )}
688
692
  {headerArr}
689
- {actionColumn && (
690
- <th className="sticky right-0 w-8 px-4 py-2 z-10 bg-secondary-bg font-medium text-center whitespace-nowrap">
691
- <div className="flex flex-col">
692
- <span>Actions</span>
693
- {options?.toolbar?.columnSearch?.show !== false && (
694
- <div className="invisible w-0 overflow-hidden">
695
- <input
696
- type="search"
697
- className="w-full px-0 pt-0 pb-0.5 border-default border-t-0 border-b border-x-0 bg-secondary-bg text-sm font-normal placeholder:duration-300 placeholder:translate-x-0 [&::-webkit-search-cancel-button]:appearance-none focus:placeholder:translate-x-1 placeholder:text-slate-300 focus:outline-none focus:ring-0 focus:border-primary-dark disabled:bg-secondary-light disabled:text-slate-400"
698
- />
699
- </div>
700
- )}
701
- </div>
702
- </th>
703
- )}
693
+ {actionColumn &&
694
+ React.Children.toArray(actionColumn()).length !== 0 && (
695
+ <th className="sticky right-0 w-8 px-4 py-2 z-10 bg-secondary-bg font-medium text-center whitespace-nowrap">
696
+ <div className="flex flex-col">
697
+ <span>Actions</span>
698
+ {options?.toolbar?.columnSearch?.show !== false && (
699
+ <div className="invisible w-0 overflow-hidden">
700
+ <input
701
+ type="search"
702
+ className="w-full px-0 pt-0 pb-0.5 border-default border-t-0 border-b border-x-0 bg-secondary-bg text-sm font-normal placeholder:duration-300 placeholder:translate-x-0 [&::-webkit-search-cancel-button]:appearance-none focus:placeholder:translate-x-1 placeholder:text-slate-300 focus:outline-none focus:ring-0 focus:border-primary-dark disabled:bg-secondary-light disabled:text-slate-400"
703
+ />
704
+ </div>
705
+ )}
706
+ </div>
707
+ </th>
708
+ )}
704
709
  </tr>
705
710
  </thead>
706
711
  <tbody className="divide-y">