next-helios-fe 1.0.0 → 1.0.1
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/README.md +1 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +0 -2
- package/package.json +1 -1
- package/src/components/table/index.tsx +25 -17
|
@@ -32,8 +32,6 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
32
32
|
|
|
33
33
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
34
34
|
|
|
35
|
-
/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */
|
|
36
|
-
|
|
37
35
|
/*! svg.draggable.js - v2.2.2 - 2019-01-08
|
|
38
36
|
* https://github.com/svgdotjs/svg.draggable.js
|
|
39
37
|
* Copyright (c) 2019 Wout Fierens; Licensed MIT */
|
package/package.json
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import React, { useState, useEffect, useMemo } from "react";
|
|
3
3
|
import { Icon } from "@iconify/react";
|
|
4
4
|
import { Form, Button, Dropdown } from "../../components";
|
|
5
|
-
import { exportToExcel } from "react-json-to-excel";
|
|
6
|
-
import dayjs from "dayjs";
|
|
7
5
|
import { Action, type ActionProps } from "./action";
|
|
8
6
|
|
|
9
7
|
interface TableProps {
|
|
10
8
|
title?: string;
|
|
11
|
-
header: {
|
|
9
|
+
header: {
|
|
10
|
+
title: string;
|
|
11
|
+
key: string;
|
|
12
|
+
render?: (item: any) => React.ReactNode;
|
|
13
|
+
}[];
|
|
12
14
|
data: any[];
|
|
13
15
|
options?: {
|
|
14
16
|
hideToolbar?: boolean;
|
|
@@ -190,14 +192,25 @@ export const Table: TableComponentProps = ({
|
|
|
190
192
|
{header
|
|
191
193
|
?.filter((headerItem) => !excluded.includes(headerItem.key))
|
|
192
194
|
?.map((headerItem) => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
if (headerItem?.render) {
|
|
196
|
+
return (
|
|
197
|
+
<td
|
|
198
|
+
key={headerItem.key}
|
|
199
|
+
className="px-4 py-1 border-b bg-secondary-bg whitespace-nowrap"
|
|
200
|
+
>
|
|
201
|
+
{headerItem.render(item)}
|
|
202
|
+
</td>
|
|
203
|
+
);
|
|
204
|
+
} else {
|
|
205
|
+
return (
|
|
206
|
+
<td
|
|
207
|
+
key={headerItem.key}
|
|
208
|
+
className="px-4 py-1 border-b bg-secondary-bg whitespace-nowrap"
|
|
209
|
+
>
|
|
210
|
+
{item[headerItem.key as keyof typeof item]}
|
|
211
|
+
</td>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
201
214
|
})}
|
|
202
215
|
{actions && (
|
|
203
216
|
<td className="px-4 py-1 border-b bg-secondary-bg text-center">
|
|
@@ -257,12 +270,7 @@ export const Table: TableComponentProps = ({
|
|
|
257
270
|
/>
|
|
258
271
|
<Button
|
|
259
272
|
options={{ variant: "primary", width: "fit" }}
|
|
260
|
-
onClick={() => {
|
|
261
|
-
exportToExcel(
|
|
262
|
-
data,
|
|
263
|
-
`${title}-data_${dayjs().format("YYYY-MM-DD_HH-mm-ss")}`
|
|
264
|
-
);
|
|
265
|
-
}}
|
|
273
|
+
onClick={() => {}}
|
|
266
274
|
>
|
|
267
275
|
Export
|
|
268
276
|
</Button>
|