next-helios-fe 1.7.12 → 1.7.14

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.12",
3
+ "version": "1.7.14",
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,6 +64,7 @@ interface TableProps {
63
64
  }[]
64
65
  ) => void;
65
66
  };
67
+ loading?: boolean;
66
68
  actionColumn?: (e?: any) => React.ReactNode;
67
69
  }
68
70
 
@@ -76,6 +78,7 @@ export const Table: TableComponentProps = ({
76
78
  data,
77
79
  options,
78
80
  checkbox,
81
+ loading,
79
82
  actionColumn,
80
83
  }) => {
81
84
  const paginationRef = useRef<HTMLDivElement>(null);
@@ -495,18 +498,20 @@ export const Table: TableComponentProps = ({
495
498
  ? "bg-danger hover:bg-danger-dark"
496
499
  : "bg-primary hover:bg-primary-dark";
497
500
 
498
- return (
499
- <button
500
- key={index}
501
- type="button"
502
- className={`p-1.5 rounded-full text-white ${variant}`}
503
- onClick={(e) => {
504
- item.onClick && item.onClick(e);
505
- }}
506
- >
507
- <Icon icon={item.icon} className="text-2xl" />
508
- </button>
509
- );
501
+ if (item.show !== false) {
502
+ return (
503
+ <button
504
+ key={index}
505
+ type="button"
506
+ className={`p-1.5 rounded-full text-white ${variant}`}
507
+ onClick={(e) => {
508
+ item.onClick && item.onClick(e);
509
+ }}
510
+ >
511
+ <Icon icon={item.icon} className="text-2xl" />
512
+ </button>
513
+ );
514
+ }
510
515
  })}
511
516
  {options?.toolbar?.addData?.show !== false && (
512
517
  <button
@@ -706,12 +711,19 @@ export const Table: TableComponentProps = ({
706
711
  </tr>
707
712
  </thead>
708
713
  <tbody className="divide-y">
709
- {filteredData && filteredData.length !== 0 && dataArr}
714
+ {!loading && filteredData && filteredData.length !== 0 && dataArr}
710
715
  </tbody>
711
716
  </table>
712
- {(!filteredData || filteredData.length === 0) && (
717
+ {(loading || !filteredData || filteredData.length === 0) && (
713
718
  <div className="flex justify-center items-center px-4 py-1.5 h-full bg-secondary-bg text-center whitespace-nowrap">
714
- <span>No data found</span>
719
+ {loading ? (
720
+ <Icon
721
+ icon="mingcute:loading-fill"
722
+ className="text-3xl text-primary animate-spin"
723
+ />
724
+ ) : (
725
+ <span>No data found</span>
726
+ )}
715
727
  </div>
716
728
  )}
717
729
  </div>