next-helios-fe 1.8.75 → 1.8.77

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.75",
3
+ "version": "1.8.77",
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 ? a.toString() : "").localeCompare(b ? 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,8 +313,17 @@ export const Table: TableComponentProps = ({
306
313
  dataItem[item.key as keyof typeof dataItem]
307
314
  )
308
315
  ?.sort((a, b) =>
309
- (a ? a.toString() : "").localeCompare(
310
- b ? 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()
311
327
  )
312
328
  )
313
329
  ?.filter(
@@ -329,10 +345,16 @@ export const Table: TableComponentProps = ({
329
345
  }
330
346
  }}
331
347
  >
332
- <div className="pointer-events-none">
348
+ <div className="capitalize pointer-events-none">
333
349
  <Form.Checkbox
334
350
  options={{ disableHover: true }}
335
- label={value?.toString()}
351
+ label={
352
+ value === undefined
353
+ ? "undefined"
354
+ : value === null
355
+ ? "null"
356
+ : value?.toString()
357
+ }
336
358
  checked={categoryFilter.includes(value)}
337
359
  readOnly
338
360
  />
@@ -451,7 +473,7 @@ export const Table: TableComponentProps = ({
451
473
  </td>
452
474
  )}
453
475
  {!options?.hideNumberColumn && (
454
- <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">
455
477
  {(page - 1) * maxRow + index + 1}
456
478
  </td>
457
479
  )}
@@ -462,7 +484,7 @@ export const Table: TableComponentProps = ({
462
484
  return (
463
485
  <td
464
486
  key={headerItem.key}
465
- className="px-4 py-1.5 bg-secondary-bg whitespace-nowrap"
487
+ className="px-4 py-1.5 bg-secondary-bg capitalize whitespace-nowrap"
466
488
  >
467
489
  {headerItem.render(item) || "-"}
468
490
  </td>
@@ -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-50 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
  };