next-helios-fe 1.8.74 → 1.8.76

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.8.74",
3
+ "version": "1.8.76",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,6 +14,7 @@ interface PermissionTableProps {
14
14
  [key: string]: any;
15
15
  }[];
16
16
  options?: {
17
+ moduleHeaderName?: string;
17
18
  height?: "full" | "fit" | "20" | "40" | "80";
18
19
  border?: boolean;
19
20
  };
@@ -147,7 +148,7 @@ export const PermissionTable: React.FC<PermissionTableProps> = ({
147
148
  <thead className="sticky top-0 z-10">
148
149
  <tr className="bg-secondary-bg">
149
150
  <th className="sticky left-0 min-w-40 py-2 z-10 bg-secondary-bg font-medium">
150
- Module
151
+ {options?.moduleHeaderName || "Module"}
151
152
  </th>
152
153
  {headerArr}
153
154
  </tr>
@@ -140,7 +140,14 @@ export const Table: TableComponentProps = ({
140
140
  data
141
141
  .map((dataItem) => dataItem[item.key as keyof typeof dataItem])
142
142
  .sort((a, b) =>
143
- (a.toString() || "").localeCompare(b.toString() || "")
143
+ (a === undefined
144
+ ? "undefined"
145
+ : a === null
146
+ ? "null"
147
+ : a.toString()
148
+ ).localeCompare(
149
+ b === undefined ? "undefined" : b === null ? "null" : b.toString()
150
+ )
144
151
  )
145
152
  .filter((value, index, self) => self.indexOf(value) === index)
146
153
  .map((value) => {
@@ -306,7 +313,18 @@ export const Table: TableComponentProps = ({
306
313
  dataItem[item.key as keyof typeof dataItem]
307
314
  )
308
315
  ?.sort((a, b) =>
309
- (a.toString() || "").localeCompare(b.toString() || "")
316
+ (a === undefined
317
+ ? "undefined"
318
+ : a === null
319
+ ? "null"
320
+ : a.toString()
321
+ ).localeCompare(
322
+ b === undefined
323
+ ? "undefined"
324
+ : b === null
325
+ ? "null"
326
+ : b.toString()
327
+ )
310
328
  )
311
329
  ?.filter(
312
330
  (value, index, self) => self.indexOf(value) === index
@@ -327,10 +345,16 @@ export const Table: TableComponentProps = ({
327
345
  }
328
346
  }}
329
347
  >
330
- <div className="pointer-events-none">
348
+ <div className="capitalize pointer-events-none">
331
349
  <Form.Checkbox
332
350
  options={{ disableHover: true }}
333
- label={value.toString()}
351
+ label={
352
+ value === undefined
353
+ ? "undefined"
354
+ : value === null
355
+ ? "null"
356
+ : value?.toString()
357
+ }
334
358
  checked={categoryFilter.includes(value)}
335
359
  readOnly
336
360
  />
@@ -449,7 +473,7 @@ export const Table: TableComponentProps = ({
449
473
  </td>
450
474
  )}
451
475
  {!options?.hideNumberColumn && (
452
- <td className="sticky z-10 left-0 w-8 px-4 py-1.5 bg-secondary-bg text-center">
476
+ <td className="sticky left-0 w-8 px-4 py-1.5 bg-secondary-bg text-center">
453
477
  {(page - 1) * maxRow + index + 1}
454
478
  </td>
455
479
  )}
@@ -460,7 +484,7 @@ export const Table: TableComponentProps = ({
460
484
  return (
461
485
  <td
462
486
  key={headerItem.key}
463
- className="px-4 py-1.5 bg-secondary-bg whitespace-nowrap"
487
+ className="px-4 py-1.5 bg-secondary-bg capitalize whitespace-nowrap"
464
488
  >
465
489
  {headerItem.render(item) || "-"}
466
490
  </td>
@@ -473,7 +497,7 @@ export const Table: TableComponentProps = ({
473
497
  >
474
498
  <Tooltip
475
499
  content={item[headerItem.key as keyof typeof item] || "-"}
476
- options={{ position: "top" }}
500
+ options={{ position: "top", enableHover: true }}
477
501
  >
478
502
  <span className="px-4 py-1.5">
479
503
  {item[headerItem.key as keyof typeof item] || "-"}
@@ -640,7 +664,7 @@ export const Table: TableComponentProps = ({
640
664
  (page - 1) * maxRow +
641
665
  filteredData?.indexOf(item) +
642
666
  1
643
- ).toString(),
667
+ )?.toString(),
644
668
  [headerItem.title]:
645
669
  item[headerItem.key as keyof typeof item],
646
670
  };
@@ -810,7 +834,7 @@ export const Table: TableComponentProps = ({
810
834
  { label: "50", value: "50" },
811
835
  { label: "100", value: "100" },
812
836
  ]}
813
- value={maxRow.toString()}
837
+ value={maxRow?.toString()}
814
838
  onChange={(e) => {
815
839
  setMaxRow(Number(e.target.value));
816
840
  setPage(1);
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
  import React, { useState, useRef, useEffect } from "react";
3
- import { createPortal } from "react-dom";
4
3
 
5
4
  interface TooltipProps {
6
5
  children: React.ReactNode;
@@ -184,51 +183,49 @@ export const Tooltip: React.FC<TooltipProps> = ({
184
183
  return (
185
184
  <div
186
185
  ref={wrapperRef}
187
- className="relative"
186
+ className="group/tooltip"
188
187
  onMouseEnter={() => setVisible(true)}
189
188
  onMouseLeave={() => setVisible(false)}
190
189
  >
191
190
  {children}
192
- {isRendered &&
193
- createPortal(
194
- <div
195
- ref={tooltipRef}
196
- className={`absolute z-10 duration-200 transition-opacity ${
197
- visible ? "" : "hidden pointer-events-none"
198
- } ${options?.enableHover ? "" : "pointer-events-none"}`}
199
- style={getTooltipPosition()}
200
- >
201
- {position === "bottom" && (
191
+ {isRendered && (
192
+ <div
193
+ ref={tooltipRef}
194
+ className={`absolute z-50 duration-200 transition-opacity hidden group-hover/tooltip:block ${
195
+ options?.enableHover ? "" : "pointer-events-none"
196
+ }`}
197
+ style={getTooltipPosition()}
198
+ >
199
+ {position === "bottom" && (
200
+ <div className="flex justify-center">
201
+ <div style={getTooltipArrowPosition()}></div>
202
+ </div>
203
+ )}
204
+ <div className="flex items-center">
205
+ {position === "right" && (
202
206
  <div className="flex justify-center">
203
207
  <div style={getTooltipArrowPosition()}></div>
204
208
  </div>
205
209
  )}
206
- <div className="flex items-center">
207
- {position === "right" && (
208
- <div className="flex justify-center">
209
- <div style={getTooltipArrowPosition()}></div>
210
- </div>
211
- )}
212
- <div
213
- className="w-fit px-3 py-1.5 rounded-md bg-black/75 text-sm text-white"
214
- style={{ maxWidth: "50dvw" }}
215
- >
216
- {content}
217
- </div>
218
- {position === "left" && (
219
- <div className="flex justify-center">
220
- <div style={getTooltipArrowPosition()}></div>
221
- </div>
222
- )}
210
+ <div
211
+ className="w-fit px-3 py-1.5 rounded-md bg-black/75 text-sm text-white text-wrap"
212
+ style={{ maxWidth: "50dvw" }}
213
+ >
214
+ {content}
223
215
  </div>
224
- {position === "top" && (
216
+ {position === "left" && (
225
217
  <div className="flex justify-center">
226
218
  <div style={getTooltipArrowPosition()}></div>
227
219
  </div>
228
220
  )}
229
- </div>,
230
- document.body
231
- )}
221
+ </div>
222
+ {position === "top" && (
223
+ <div className="flex justify-center">
224
+ <div style={getTooltipArrowPosition()}></div>
225
+ </div>
226
+ )}
227
+ </div>
228
+ )}
232
229
  </div>
233
230
  );
234
231
  };