ikoncomponents 1.1.6 → 1.1.8
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/dist/hooks/use-mobile.js +2 -38
- package/dist/ikoncomponents/action-menu/index.js +15 -18
- package/dist/ikoncomponents/action-menu/type.js +1 -2
- package/dist/ikoncomponents/alert-dialog/index.js +6 -10
- package/dist/ikoncomponents/buttons/index.js +32 -23
- package/dist/ikoncomponents/combobox-input/index.js +14 -16
- package/dist/ikoncomponents/combobox-input/type.js +1 -2
- package/dist/ikoncomponents/data-table/datatable-column-filter/index.js +13 -16
- package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.js +22 -58
- package/dist/ikoncomponents/data-table/datatable-filter-menu/index.js +18 -21
- package/dist/ikoncomponents/data-table/datatable-pagination/index.js +10 -13
- package/dist/ikoncomponents/data-table/datatable-toolbar/index.js +17 -19
- package/dist/ikoncomponents/data-table/function.js +4 -7
- package/dist/ikoncomponents/data-table/index.js +81 -116
- package/dist/ikoncomponents/data-table/type.js +1 -2
- package/dist/ikoncomponents/e-chart/index.js +32 -37
- package/dist/ikoncomponents/file-input/index.js +20 -11
- package/dist/ikoncomponents/glowing-effect/index.js +16 -18
- package/dist/ikoncomponents/icon/index.js +16 -40
- package/dist/ikoncomponents/loading-spinner/index.js +16 -8
- package/dist/ikoncomponents/multi-combobox/index.js +31 -30
- package/dist/ikoncomponents/no-data/index.js +4 -7
- package/dist/ikoncomponents/page-wrapper/index.js +5 -8
- package/dist/ikoncomponents/password-strength-meter/index.js +6 -13
- package/dist/ikoncomponents/phone-input/index.js +30 -54
- package/dist/ikoncomponents/resource-spreadsheet/index.js +11 -48
- package/dist/ikoncomponents/search-input/index.js +18 -9
- package/dist/ikoncomponents/sheet/index.js +5 -8
- package/dist/ikoncomponents/simple-widget/index.js +8 -11
- package/dist/ikoncomponents/tabs/index.js +20 -22
- package/dist/ikoncomponents/tabs/type.js +1 -2
- package/dist/ikoncomponents/theme-toggle-btn/index.js +8 -11
- package/dist/ikoncomponents/title-progress/index.js +4 -7
- package/dist/ikoncomponents/tooltip/index.js +4 -7
- package/dist/ikoncomponents/twolevel-dropdown/index.js +20 -53
- package/dist/ikoncomponents/widgets/index.js +10 -13
- package/dist/ikoncomponents/widgets/type.js +1 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +70 -123
- package/dist/shadcn/accordion.js +28 -51
- package/dist/shadcn/alert-dialog.js +60 -70
- package/dist/shadcn/alert.d.ts +1 -1
- package/dist/shadcn/alert.js +25 -15
- package/dist/shadcn/avatar.js +24 -47
- package/dist/shadcn/badge.d.ts +1 -1
- package/dist/shadcn/badge.js +21 -13
- package/dist/shadcn/button.d.ts +1 -1
- package/dist/shadcn/button.js +21 -13
- package/dist/shadcn/calendar.js +42 -97
- package/dist/shadcn/card.js +35 -25
- package/dist/shadcn/checkbox.js +19 -42
- package/dist/shadcn/command.js +53 -43
- package/dist/shadcn/date-input.js +25 -60
- package/dist/shadcn/date-range-picker.js +14 -18
- package/dist/shadcn/dialog.js +56 -79
- package/dist/shadcn/dropdown-menu.js +61 -84
- package/dist/shadcn/hover-card.js +24 -47
- package/dist/shadcn/input.js +17 -7
- package/dist/shadcn/label.js +18 -41
- package/dist/shadcn/navigation-menu.d.ts +1 -1
- package/dist/shadcn/navigation-menu.js +43 -68
- package/dist/shadcn/popover.js +27 -50
- package/dist/shadcn/progress.js +19 -42
- package/dist/shadcn/radio-group.js +23 -45
- package/dist/shadcn/scroll-area.js +22 -45
- package/dist/shadcn/select.js +58 -81
- package/dist/shadcn/separator.js +18 -41
- package/dist/shadcn/sheet.js +52 -73
- package/dist/shadcn/sidebar.d.ts +1 -1
- package/dist/shadcn/sidebar.js +113 -141
- package/dist/shadcn/skeleton.js +17 -7
- package/dist/shadcn/slider.js +19 -42
- package/dist/shadcn/sonner.js +20 -11
- package/dist/shadcn/switch.js +18 -41
- package/dist/shadcn/table.js +46 -36
- package/dist/shadcn/tabs.js +27 -50
- package/dist/shadcn/textarea.js +17 -7
- package/dist/shadcn/tooltip.js +27 -50
- package/dist/shadcn/workflow.js +8 -8
- package/dist/utils/cn.js +4 -7
- package/dist/utils/theme-provider/index.js +16 -7
- package/package.json +2 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return column?.columnDef?.title ||
|
|
6
|
-
(column?.columnDef?.header && typeof column.columnDef.header == 'string' && column?.columnDef?.header) ||
|
|
1
|
+
export const getDataTableColumnTitle = (column) => {
|
|
2
|
+
var _a, _b, _c;
|
|
3
|
+
return ((_a = column === null || column === void 0 ? void 0 : column.columnDef) === null || _a === void 0 ? void 0 : _a.title) ||
|
|
4
|
+
(((_b = column === null || column === void 0 ? void 0 : column.columnDef) === null || _b === void 0 ? void 0 : _b.header) && typeof column.columnDef.header == 'string' && ((_c = column === null || column === void 0 ? void 0 : column.columnDef) === null || _c === void 0 ? void 0 : _c.header)) ||
|
|
7
5
|
column.id;
|
|
8
6
|
};
|
|
9
|
-
exports.getDataTableColumnTitle = getDataTableColumnTitle;
|
|
@@ -1,59 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.DataTable = void 0;
|
|
38
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
-
const react_1 = __importStar(require("react"));
|
|
40
|
-
const react_table_1 = require("@tanstack/react-table");
|
|
41
|
-
const lucide_react_1 = require("lucide-react");
|
|
42
|
-
const button_1 = require("../../shadcn/button");
|
|
43
|
-
const table_1 = require("../../shadcn/table");
|
|
44
|
-
const datatable_toolbar_1 = require("./datatable-toolbar");
|
|
45
|
-
const function_1 = require("./function");
|
|
46
|
-
const checkbox_1 = require("../../shadcn/checkbox");
|
|
47
|
-
const datatable_pagination_1 = require("./datatable-pagination");
|
|
48
|
-
const action_menu_1 = require("../action-menu");
|
|
49
|
-
const class_variance_authority_1 = require("class-variance-authority");
|
|
50
|
-
exports.DataTable = (({ columns, data, extraParams, onTableReady }, ref) => {
|
|
51
|
-
const [sorting, setSorting] = react_1.default.useState([]);
|
|
52
|
-
const [globalFilter, setGlobalFilter] = react_1.default.useState("");
|
|
53
|
-
const [columnFilters, setColumnFilters] = react_1.default.useState([]);
|
|
54
|
-
const [pagination, setPagination] = react_1.default.useState({
|
|
55
|
-
pageIndex: extraParams?.pageIndex || 0,
|
|
56
|
-
pageSize: extraParams?.pageSize || 15,
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { useEffect, useImperativeHandle, useState, } from "react";
|
|
4
|
+
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, getGroupedRowModel, getExpandedRowModel, useReactTable, getFacetedUniqueValues, getFacetedMinMaxValues, getFacetedRowModel, } from "@tanstack/react-table";
|
|
5
|
+
import { ChevronDown, ChevronRight, ChevronUp, X, } from "lucide-react";
|
|
6
|
+
import { Button } from "../../shadcn/button";
|
|
7
|
+
import { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from "../../shadcn/table";
|
|
8
|
+
import { DataTableToolbar } from "./datatable-toolbar";
|
|
9
|
+
import { getDataTableColumnTitle } from "./function";
|
|
10
|
+
import { Checkbox } from "../../shadcn/checkbox";
|
|
11
|
+
import { DataTablePagination } from "./datatable-pagination";
|
|
12
|
+
import { ActionMenu } from "../action-menu";
|
|
13
|
+
import { cx } from "class-variance-authority";
|
|
14
|
+
export const DataTable = (({ columns, data, extraParams, onTableReady }, ref) => {
|
|
15
|
+
const [sorting, setSorting] = React.useState([]);
|
|
16
|
+
const [globalFilter, setGlobalFilter] = React.useState("");
|
|
17
|
+
const [columnFilters, setColumnFilters] = React.useState([]);
|
|
18
|
+
const [pagination, setPagination] = React.useState({
|
|
19
|
+
pageIndex: (extraParams === null || extraParams === void 0 ? void 0 : extraParams.pageIndex) || 0,
|
|
20
|
+
pageSize: (extraParams === null || extraParams === void 0 ? void 0 : extraParams.pageSize) || 15,
|
|
57
21
|
});
|
|
58
22
|
// useImperativeHandle(ref, () => ({
|
|
59
23
|
// toggleAllRowsExpanded: (expanded: boolean) => {
|
|
@@ -61,48 +25,48 @@ exports.DataTable = (({ columns, data, extraParams, onTableReady }, ref) => {
|
|
|
61
25
|
// },
|
|
62
26
|
// getTableInstance: () => table, // Optional: Expose the entire table instance if needed
|
|
63
27
|
// }));
|
|
64
|
-
const [columnVisibility, setColumnVisibility] =
|
|
65
|
-
const [grouping, setGrouping] =
|
|
66
|
-
const [expanded, setExpanded] =
|
|
67
|
-
const [rowSelection, setRowSelection] =
|
|
28
|
+
const [columnVisibility, setColumnVisibility] = React.useState({});
|
|
29
|
+
const [grouping, setGrouping] = React.useState([]);
|
|
30
|
+
const [expanded, setExpanded] = React.useState({});
|
|
31
|
+
const [rowSelection, setRowSelection] = React.useState({});
|
|
68
32
|
columns = columns.map((column) => {
|
|
69
|
-
if (!column
|
|
33
|
+
if (!(column === null || column === void 0 ? void 0 : column.filterFn)) {
|
|
70
34
|
column.filterFn = "arrIncludesSome";
|
|
71
35
|
}
|
|
72
36
|
return column;
|
|
73
37
|
});
|
|
74
|
-
|
|
75
|
-
if (extraParams
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (extraParams === null || extraParams === void 0 ? void 0 : extraParams.checkBoxColumnCallback)
|
|
76
40
|
extraParams.checkBoxColumnCallback(table.getFilteredSelectedRowModel().rows);
|
|
77
41
|
}, [rowSelection]);
|
|
78
|
-
if (extraParams
|
|
42
|
+
if (extraParams === null || extraParams === void 0 ? void 0 : extraParams.checkBoxColumn) {
|
|
79
43
|
columns.splice(0, 0, {
|
|
80
44
|
id: "checkBoxColumn",
|
|
81
|
-
header: ({ table }) => ((
|
|
45
|
+
header: ({ table }) => (_jsx(Checkbox, { checked: table.getIsAllPageRowsSelected() ||
|
|
82
46
|
(table.getIsSomePageRowsSelected() && "indeterminate"), onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value), "aria-label": "Select all" })),
|
|
83
|
-
cell: ({ row }) => ((
|
|
47
|
+
cell: ({ row }) => (_jsx(_Fragment, { children: _jsx(Checkbox, { checked: row.getIsSelected(), onCheckedChange: (value) => row.toggleSelected(!!value), "aria-label": "Select row" }) })),
|
|
84
48
|
enableSorting: false,
|
|
85
49
|
enableHiding: false,
|
|
86
50
|
});
|
|
87
51
|
}
|
|
88
|
-
if (extraParams
|
|
52
|
+
if ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.actionMenu) || (extraParams === null || extraParams === void 0 ? void 0 : extraParams.groupActionMenu)) {
|
|
89
53
|
columns.push({
|
|
90
54
|
id: "DTActions",
|
|
91
55
|
accessorKey: "Actions",
|
|
92
|
-
header: () => (
|
|
56
|
+
header: () => _jsx("div", { className: "text-center", children: "Action" }),
|
|
93
57
|
size: 20,
|
|
94
58
|
headerClassName: "text-center",
|
|
95
59
|
cell: ({ row }) => {
|
|
96
60
|
if (row.getIsGrouped()) {
|
|
97
|
-
return extraParams
|
|
61
|
+
return (extraParams === null || extraParams === void 0 ? void 0 : extraParams.groupActionMenu) ? (_jsx("div", { className: "text-end", children: _jsx(ActionMenu, { actionMenus: extraParams.groupActionMenu.items, extraActionParams: {
|
|
98
62
|
arguments: [
|
|
99
63
|
row.original,
|
|
100
64
|
...(extraParams.groupActionMenu.extraArguments || []),
|
|
101
65
|
],
|
|
102
66
|
} }) })) : null;
|
|
103
67
|
}
|
|
104
|
-
else if (extraParams
|
|
105
|
-
return ((
|
|
68
|
+
else if (extraParams === null || extraParams === void 0 ? void 0 : extraParams.actionMenu) {
|
|
69
|
+
return (_jsx("div", { className: "text-center", children: _jsx(ActionMenu, { actionMenus: extraParams.actionMenu.items, extraActionParams: {
|
|
106
70
|
arguments: [
|
|
107
71
|
row.original,
|
|
108
72
|
...(extraParams.actionMenu.extraArguments || []),
|
|
@@ -122,10 +86,11 @@ exports.DataTable = (({ columns, data, extraParams, onTableReady }, ref) => {
|
|
|
122
86
|
// setPagination(state);
|
|
123
87
|
// extraParams?.onPaginationChange?.(state);
|
|
124
88
|
// }
|
|
125
|
-
|
|
126
|
-
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
var _a;
|
|
91
|
+
(_a = extraParams === null || extraParams === void 0 ? void 0 : extraParams.onPaginationChange) === null || _a === void 0 ? void 0 : _a.call(extraParams, pagination);
|
|
127
92
|
}, [pagination]);
|
|
128
|
-
const table =
|
|
93
|
+
const table = useReactTable({
|
|
129
94
|
data,
|
|
130
95
|
columns,
|
|
131
96
|
state: {
|
|
@@ -146,24 +111,24 @@ exports.DataTable = (({ columns, data, extraParams, onTableReady }, ref) => {
|
|
|
146
111
|
onGroupingChange: setGrouping,
|
|
147
112
|
onGlobalFilterChange: setGlobalFilter,
|
|
148
113
|
onRowSelectionChange: setRowSelection,
|
|
149
|
-
getCoreRowModel:
|
|
150
|
-
getPaginationRowModel:
|
|
151
|
-
getSortedRowModel:
|
|
152
|
-
getFilteredRowModel:
|
|
153
|
-
getGroupedRowModel:
|
|
154
|
-
getExpandedRowModel:
|
|
155
|
-
getFacetedRowModel:
|
|
156
|
-
getFacetedUniqueValues:
|
|
157
|
-
getFacetedMinMaxValues:
|
|
158
|
-
manualPagination: (extraParams
|
|
114
|
+
getCoreRowModel: getCoreRowModel(),
|
|
115
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
116
|
+
getSortedRowModel: getSortedRowModel(),
|
|
117
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
118
|
+
getGroupedRowModel: getGroupedRowModel(),
|
|
119
|
+
getExpandedRowModel: getExpandedRowModel(),
|
|
120
|
+
getFacetedRowModel: getFacetedRowModel(),
|
|
121
|
+
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
122
|
+
getFacetedMinMaxValues: getFacetedMinMaxValues(),
|
|
123
|
+
manualPagination: ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.pagination) == undefined || (extraParams === null || extraParams === void 0 ? void 0 : extraParams.pagination) == true) ? undefined : true
|
|
159
124
|
});
|
|
160
|
-
|
|
161
|
-
const [droppedHeaders, setDroppedHeaders] =
|
|
125
|
+
useImperativeHandle(ref, () => table);
|
|
126
|
+
const [droppedHeaders, setDroppedHeaders] = useState([]);
|
|
162
127
|
// Drag Event Handlers
|
|
163
128
|
const handleDragStart = (e, header) => {
|
|
164
129
|
const headerObj = {
|
|
165
130
|
id: header.id,
|
|
166
|
-
title:
|
|
131
|
+
title: getDataTableColumnTitle(header.column),
|
|
167
132
|
};
|
|
168
133
|
e.dataTransfer.setData("headerObj", JSON.stringify(headerObj));
|
|
169
134
|
e.dataTransfer.effectAllowed = "move";
|
|
@@ -190,69 +155,69 @@ exports.DataTable = (({ columns, data, extraParams, onTableReady }, ref) => {
|
|
|
190
155
|
column.getToggleGroupingHandler()();
|
|
191
156
|
}
|
|
192
157
|
};
|
|
193
|
-
const [isMount, setIsMount] =
|
|
194
|
-
|
|
158
|
+
const [isMount, setIsMount] = useState(false);
|
|
159
|
+
useEffect(() => {
|
|
195
160
|
if (!isMount) {
|
|
196
161
|
setIsMount(true);
|
|
197
162
|
}
|
|
198
|
-
if (extraParams
|
|
199
|
-
table.setGrouping(extraParams
|
|
163
|
+
if (extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultGroups) {
|
|
164
|
+
table.setGrouping(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultGroups);
|
|
200
165
|
}
|
|
201
166
|
}, []);
|
|
202
|
-
|
|
167
|
+
useEffect(() => {
|
|
203
168
|
if (onTableReady) {
|
|
204
169
|
onTableReady(table);
|
|
205
170
|
}
|
|
206
171
|
}, [onTableReady, table]);
|
|
207
|
-
return (isMount && ((
|
|
172
|
+
return (isMount && (_jsxs("div", { className: "w-full h-full flex flex-col gap-3 justify-between", children: [_jsxs("div", { className: "flex-grow flex flex-col gap-3 overflow-hidden", children: [((extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == undefined ||
|
|
208
173
|
extraParams.defaultTools ||
|
|
209
|
-
extraParams.extraTools) && ((
|
|
174
|
+
extraParams.extraTools) && (_jsx(DataTableToolbar, { table: table, extraParams: extraParams })), _jsxs("div", { className: "flex-grow flex flex-col overflow-hidden", children: [((extraParams === null || extraParams === void 0 ? void 0 : extraParams.grouping) == undefined || extraParams.grouping) && (_jsx("div", { className: "w-full border-t min-h-10 px-2 py-1 flex gap-3 items-center text-sm bg-card-new", onDrop: handleDrop, onDragOver: handleDragOver, children: droppedHeaders.length === 0
|
|
210
175
|
? "Drag a column header here to group its column"
|
|
211
|
-
: droppedHeaders.map((header, index) => ((
|
|
176
|
+
: droppedHeaders.map((header, index) => (_jsxs("div", { className: "rounded-md px-2 py-1 bg-muted text-muted-foreground flex gap-3 items-center", children: [header.title, _jsx("span", { onClick: () => handleRemoveGrouping(header.id), children: _jsx(X, { size: 15 }) })] }, header.id))) })), _jsx("div", { className: "flex-grow overflow-hidden", children: _jsxs(Table, { className: "border-t whitespace-nowrap bg-card-new", children: [((extraParams === null || extraParams === void 0 ? void 0 : extraParams.header) == undefined || extraParams.header) && (_jsx(TableHeader, { className: "sticky top-0 z-10 border-t bg-card-new", children: table.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { className: cx(""), children: headerGroup.headers.map((header) => {
|
|
212
177
|
if (header.column.getIsGrouped()) {
|
|
213
178
|
if (header.column.getGroupedIndex() <
|
|
214
179
|
droppedHeaders.length - 1) {
|
|
215
180
|
return null;
|
|
216
181
|
}
|
|
217
|
-
return ((
|
|
182
|
+
return (_jsx(TableHead, { colSpan: droppedHeaders.length, className: cx("w-36 ", "text-left") }, header.id));
|
|
218
183
|
}
|
|
219
184
|
else {
|
|
220
|
-
return ((
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
185
|
+
return (_jsx(TableHead, Object.assign({}, ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.grouping) == undefined ||
|
|
186
|
+
extraParams.grouping
|
|
187
|
+
? {
|
|
188
|
+
onDragStart: (e) => handleDragStart(e, header),
|
|
189
|
+
draggable: true,
|
|
190
|
+
}
|
|
191
|
+
: {}), { className: cx("text-left"), children: header.isPlaceholder ? null : ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.sorting) ==
|
|
227
192
|
undefined ||
|
|
228
193
|
extraParams.sorting) &&
|
|
229
|
-
header.column.getCanSort() ? ((
|
|
194
|
+
header.column.getCanSort() ? (_jsxs("div", { onClick: header.column.getToggleSortingHandler(), className: cx("-mx-2 inline-flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1 hover:bg-muted"), children: [_jsx("div", { children: flexRender(header.column.columnDef.header, header.getContext()) }), header.column.getCanSort() ? (_jsxs("div", { className: "-space-y-2", children: [_jsx(ChevronUp, { className: cx("size-3.5 text-foreground", header.column.getIsSorted() ===
|
|
230
195
|
"desc"
|
|
231
196
|
? "opacity-30"
|
|
232
|
-
: ""), "aria-hidden": "true" }), (
|
|
197
|
+
: ""), "aria-hidden": "true" }), _jsx(ChevronDown, { className: cx("size-3.5 text-foreground", header.column.getIsSorted() ===
|
|
233
198
|
"asc"
|
|
234
199
|
? "opacity-30"
|
|
235
|
-
: ""), "aria-hidden": "true" })] })) : null] })) : (
|
|
200
|
+
: ""), "aria-hidden": "true" })] })) : null] })) : (flexRender(header.column.columnDef.header, header.getContext())) }), header.id));
|
|
236
201
|
}
|
|
237
|
-
}) }, headerGroup.id))) })), (
|
|
202
|
+
}) }, headerGroup.id))) })), _jsx(TableBody, { children: table.getRowModel().rows.length ? (table.getRowModel().rows.map((row) => row.getIsGrouped() ? (_jsx(TableRow, { children: row.getVisibleCells().map((cell) => {
|
|
203
|
+
var _a;
|
|
238
204
|
if (cell.column.getIndex() < row.depth) {
|
|
239
205
|
return null;
|
|
240
206
|
}
|
|
241
207
|
return (
|
|
242
208
|
// colSpan={cell.column.getIndex() == row.depth ? row.depth + 1 : undefined}
|
|
243
|
-
(
|
|
209
|
+
_jsx(TableCell, { colSpan: cell.column.getIndex() == row.depth
|
|
244
210
|
? row.depth + 1
|
|
245
211
|
: undefined, className: cell.column.getIndex() == row.depth
|
|
246
212
|
? "w-36"
|
|
247
|
-
: "", children: cell.getIsGrouped() ? ((
|
|
213
|
+
: "", children: cell.getIsGrouped() ? (_jsxs(Button, { variant: "link", onClick: row.getToggleExpandedHandler(), className: `text-right text-foreground`, style: {
|
|
248
214
|
marginLeft: row.depth + "rem",
|
|
249
|
-
}, children: [row.getIsExpanded() ? ((
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
extraParams?.groupActionMenu) && "py-2"), children: [index === 0 && row.getIsSelected() && ((0, jsx_runtime_1.jsx)("div", { className: "absolute inset-y-0 left-0 w-0.5 bg-primary" })), cell.getIsPlaceholder()
|
|
215
|
+
}, children: [row.getIsExpanded() ? (_jsx(ChevronDown, {})) : (_jsx(ChevronRight, {})), " ", flexRender(cell.column.columnDef.cell, cell.getContext()), " ", "(", row.subRows.length, ")"] })) : cell.column.id == "DTActions" ? (flexRender(cell.column.columnDef.cell, cell.getContext())) : cell.getIsAggregated() ? (flexRender((_a = cell.column.columnDef.aggregatedCell) !== null && _a !== void 0 ? _a : cell.column.columnDef.cell, cell.getContext())) : cell.getIsPlaceholder() ? null : (flexRender(cell.column.columnDef.cell, cell.getContext())) }, cell.id));
|
|
216
|
+
}) }, row.id)) : (_jsx(TableRow, Object.assign({ className: cx(row.getIsSelected() ? "bg-accent/10" : "") }, ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.checkBoxColumn) && {
|
|
217
|
+
onClick: () => row.toggleSelected(!row.getIsSelected()),
|
|
218
|
+
}), { children: row.getVisibleCells().map((cell, index) => (_jsxs(TableCell, { className: cx(row.getIsSelected() ? "relative" : "", !((extraParams === null || extraParams === void 0 ? void 0 : extraParams.actionMenu) ||
|
|
219
|
+
(extraParams === null || extraParams === void 0 ? void 0 : extraParams.groupActionMenu)) && "py-2"), children: [index === 0 && row.getIsSelected() && (_jsx("div", { className: "absolute inset-y-0 left-0 w-0.5 bg-primary" })), cell.getIsPlaceholder()
|
|
255
220
|
? null
|
|
256
|
-
:
|
|
257
|
-
extraParams.paginationBar) && ((
|
|
221
|
+
: flexRender(cell.column.columnDef.cell, cell.getContext())] }, cell.id))) }), row.id)))) : (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) })) }), (extraParams === null || extraParams === void 0 ? void 0 : extraParams.footer) && (_jsx(TableFooter, { className: "sticky bottom-0 bg-background text-foreground", children: table.getFooterGroups().map((group) => (_jsx(TableRow, { children: group.headers.map((header) => (_jsx(TableCell, { children: header.isPlaceholder ? null : (_jsx("div", { className: "flex items-center", children: flexRender(header.column.columnDef.footer, header.getContext()) })) }))) }))) }))] }) })] })] }), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.paginationBar) == undefined ||
|
|
222
|
+
extraParams.paginationBar) && (_jsx(DataTablePagination, { table: table, extraParams: extraParams }))] })));
|
|
258
223
|
});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const echarts_1 = require("echarts");
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
4
|
+
import { getInstanceByDom, init } from 'echarts';
|
|
8
5
|
function validateOption(option) {
|
|
9
6
|
if (option === undefined || option === null || typeof option !== 'object') {
|
|
10
7
|
option = {};
|
|
11
8
|
}
|
|
12
|
-
const validatedOption = {
|
|
9
|
+
const validatedOption = Object.assign({}, option);
|
|
13
10
|
if (validatedOption.toolbox === undefined ||
|
|
14
11
|
validatedOption.toolbox === null ||
|
|
15
12
|
typeof validatedOption.toolbox !== 'object') {
|
|
@@ -22,71 +19,68 @@ function validateOption(option) {
|
|
|
22
19
|
}
|
|
23
20
|
return validatedOption;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
const chartRef =
|
|
27
|
-
const chartInstanceRef =
|
|
22
|
+
export const EChart = forwardRef(({ parentDivProps = {}, option = {}, style = {}, settings = {}, loading = true, theme, isConfigurable = false, resizeKey, onClick = () => { }, onConfigure = () => { } }, ref) => {
|
|
23
|
+
const chartRef = useRef(null);
|
|
24
|
+
const chartInstanceRef = useRef(null);
|
|
28
25
|
const validatedOption = validateOption(option);
|
|
29
26
|
if (isConfigurable) {
|
|
30
|
-
validatedOption.toolbox.feature = {
|
|
31
|
-
...validatedOption.toolbox.feature,
|
|
32
|
-
myConfigureChartTool: {
|
|
27
|
+
validatedOption.toolbox.feature = Object.assign(Object.assign({}, validatedOption.toolbox.feature), { myConfigureChartTool: {
|
|
33
28
|
show: true,
|
|
34
29
|
title: 'Configure Chart',
|
|
35
30
|
icon: 'image://data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXNldHRpbmdzLTIiPjxwYXRoIGQ9Ik0yMCA3aC05Ii8+PHBhdGggZD0iTTE0IDE3SDUiLz48Y2lyY2xlIGN4PSIxNyIgY3k9IjE3IiByPSIzIi8+PGNpcmNsZSBjeD0iNyIgY3k9IjciIHI9IjMiLz48L3N2Zz4=',
|
|
36
|
-
onclick: () => onConfigure
|
|
37
|
-
}
|
|
38
|
-
};
|
|
31
|
+
onclick: () => onConfigure === null || onConfigure === void 0 ? void 0 : onConfigure()
|
|
32
|
+
} });
|
|
39
33
|
}
|
|
40
|
-
|
|
34
|
+
useImperativeHandle(ref, () => {
|
|
41
35
|
return {
|
|
42
36
|
getChartObject: () => {
|
|
43
|
-
return chartRef.current ?
|
|
37
|
+
return chartRef.current ? getInstanceByDom(chartRef.current) : null;
|
|
44
38
|
},
|
|
45
39
|
setOption: (validatedOption, settings) => {
|
|
46
40
|
if (!chartRef.current) {
|
|
47
41
|
return;
|
|
48
42
|
}
|
|
49
|
-
const chart =
|
|
50
|
-
chart
|
|
43
|
+
const chart = getInstanceByDom(chartRef.current);
|
|
44
|
+
chart === null || chart === void 0 ? void 0 : chart.setOption(validatedOption, settings);
|
|
51
45
|
},
|
|
52
46
|
resize: (secondResizeDelay = 0) => {
|
|
53
47
|
if (!chartRef.current) {
|
|
54
48
|
return;
|
|
55
49
|
}
|
|
56
|
-
const chart =
|
|
57
|
-
chart
|
|
50
|
+
const chart = getInstanceByDom(chartRef.current);
|
|
51
|
+
chart === null || chart === void 0 ? void 0 : chart.resize();
|
|
58
52
|
if (secondResizeDelay) {
|
|
59
|
-
setTimeout(() => chart
|
|
53
|
+
setTimeout(() => chart === null || chart === void 0 ? void 0 : chart.resize(), secondResizeDelay);
|
|
60
54
|
}
|
|
61
55
|
},
|
|
62
56
|
loadingVisible: (visibility) => {
|
|
63
57
|
if (!chartRef.current) {
|
|
64
58
|
return;
|
|
65
59
|
}
|
|
66
|
-
const chart =
|
|
67
|
-
visibility ? chart
|
|
60
|
+
const chart = getInstanceByDom(chartRef.current);
|
|
61
|
+
visibility ? chart === null || chart === void 0 ? void 0 : chart.showLoading() : chart === null || chart === void 0 ? void 0 : chart.hideLoading();
|
|
68
62
|
},
|
|
69
63
|
dispose: () => {
|
|
70
64
|
if (!chartRef.current) {
|
|
71
65
|
return;
|
|
72
66
|
}
|
|
73
|
-
const chart =
|
|
74
|
-
chart
|
|
67
|
+
const chart = getInstanceByDom(chartRef.current);
|
|
68
|
+
chart === null || chart === void 0 ? void 0 : chart.dispose();
|
|
75
69
|
},
|
|
76
70
|
on: (eventName, callback) => {
|
|
77
71
|
if (!chartRef.current) {
|
|
78
72
|
return;
|
|
79
73
|
}
|
|
80
|
-
const chart =
|
|
81
|
-
chart
|
|
74
|
+
const chart = getInstanceByDom(chartRef.current);
|
|
75
|
+
chart === null || chart === void 0 ? void 0 : chart.on(eventName, callback);
|
|
82
76
|
}
|
|
83
77
|
};
|
|
84
78
|
});
|
|
85
|
-
|
|
79
|
+
useEffect(() => {
|
|
86
80
|
if (chartRef.current) {
|
|
87
|
-
chartInstanceRef.current =
|
|
81
|
+
chartInstanceRef.current = init(chartRef.current, theme);
|
|
88
82
|
}
|
|
89
|
-
const resizeCallback = () => chartInstanceRef.current
|
|
83
|
+
const resizeCallback = () => { var _a, _b; return (_b = (_a = chartInstanceRef.current) === null || _a === void 0 ? void 0 : _a.resize) === null || _b === void 0 ? void 0 : _b.call(_a); };
|
|
90
84
|
window.addEventListener('resize', resizeCallback);
|
|
91
85
|
return () => {
|
|
92
86
|
if (chartInstanceRef.current) {
|
|
@@ -96,7 +90,7 @@ exports.EChart = (0, react_1.forwardRef)(({ parentDivProps = {}, option = {}, st
|
|
|
96
90
|
window.removeEventListener('resize', resizeCallback);
|
|
97
91
|
};
|
|
98
92
|
}, [theme]);
|
|
99
|
-
|
|
93
|
+
useEffect(() => {
|
|
100
94
|
if (chartInstanceRef.current) {
|
|
101
95
|
chartInstanceRef.current.setOption(validatedOption, settings);
|
|
102
96
|
}
|
|
@@ -104,17 +98,18 @@ exports.EChart = (0, react_1.forwardRef)(({ parentDivProps = {}, option = {}, st
|
|
|
104
98
|
chartInstanceRef.current.on('click', onClick);
|
|
105
99
|
}
|
|
106
100
|
}, [option, settings, theme]);
|
|
107
|
-
|
|
101
|
+
useEffect(() => {
|
|
108
102
|
if (chartInstanceRef.current) {
|
|
109
103
|
chartInstanceRef.current.resize();
|
|
110
104
|
}
|
|
111
105
|
}, [resizeKey]);
|
|
112
|
-
|
|
106
|
+
useEffect(() => {
|
|
113
107
|
if (chartInstanceRef.current) {
|
|
114
108
|
setTimeout(() => {
|
|
115
|
-
|
|
109
|
+
var _a;
|
|
110
|
+
(_a = chartInstanceRef.current) === null || _a === void 0 ? void 0 : _a.resize();
|
|
116
111
|
}, 500);
|
|
117
112
|
}
|
|
118
113
|
}, []);
|
|
119
|
-
return ((
|
|
114
|
+
return (_jsx("div", Object.assign({ ref: chartRef }, parentDivProps, { style: Object.assign({ width: '100%', height: '100%' }, style) })));
|
|
120
115
|
});
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import { useRef } from 'react';
|
|
14
|
+
import { Upload } from 'lucide-react';
|
|
15
|
+
import { Input } from '../../shadcn/input';
|
|
16
|
+
import { IconButtonWithTooltip } from '../buttons';
|
|
17
|
+
export function FileInput(_a) {
|
|
18
|
+
var { tooltipContent, fileNamePlaceholder, fileName, onFileNameChange } = _a, props = __rest(_a, ["tooltipContent", "fileNamePlaceholder", "fileName", "onFileNameChange"]);
|
|
19
|
+
const inputRef = useRef(null);
|
|
20
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: 'flex', children: [_jsx(Input, Object.assign({ ref: inputRef, type: "file", className: "hidden" }, props)), _jsx("div", { className: 'mx-1' }), _jsx(Input, { className: 'rounded-e-none', placeholder: fileNamePlaceholder, onChange: (...args) => onFileNameChange === null || onFileNameChange === void 0 ? void 0 : onFileNameChange(...args), value: fileName }), _jsx(IconButtonWithTooltip, { tooltipContent: tooltipContent || "Browse File", onClick: () => { var _a; return (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, className: 'border-s-0 rounded-s-none', children: _jsx(Upload, {}) })] }) }));
|
|
12
21
|
}
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const animationFrameRef = (0, react_1.useRef)(0);
|
|
13
|
-
const handleMove = (0, react_1.useCallback)((e) => {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
4
|
+
import { animate } from "motion/react";
|
|
5
|
+
import { cn } from "../../utils/cn";
|
|
6
|
+
export const GlowingEffect = (({ blur = 0, inactiveZone = 0.7, proximity = 0, spread = 20, variant = "default", glow = false, className, movementDuration = 2, borderWidth = 1, disabled = true, }) => {
|
|
7
|
+
const containerRef = useRef(null);
|
|
8
|
+
const lastPosition = useRef({ x: 0, y: 0 });
|
|
9
|
+
const animationFrameRef = useRef(0);
|
|
10
|
+
const handleMove = useCallback((e) => {
|
|
14
11
|
if (!containerRef.current)
|
|
15
12
|
return;
|
|
16
13
|
if (animationFrameRef.current) {
|
|
17
14
|
cancelAnimationFrame(animationFrameRef.current);
|
|
18
15
|
}
|
|
19
16
|
animationFrameRef.current = requestAnimationFrame(() => {
|
|
17
|
+
var _a, _b;
|
|
20
18
|
const element = containerRef.current;
|
|
21
19
|
if (!element)
|
|
22
20
|
return;
|
|
23
21
|
const { left, top, width, height } = element.getBoundingClientRect();
|
|
24
|
-
const mouseX = e
|
|
25
|
-
const mouseY = e
|
|
22
|
+
const mouseX = (_a = e === null || e === void 0 ? void 0 : e.x) !== null && _a !== void 0 ? _a : lastPosition.current.x;
|
|
23
|
+
const mouseY = (_b = e === null || e === void 0 ? void 0 : e.y) !== null && _b !== void 0 ? _b : lastPosition.current.y;
|
|
26
24
|
if (e) {
|
|
27
25
|
lastPosition.current = { x: mouseX, y: mouseY };
|
|
28
26
|
}
|
|
@@ -46,7 +44,7 @@ exports.GlowingEffect = (({ blur = 0, inactiveZone = 0.7, proximity = 0, spread
|
|
|
46
44
|
90;
|
|
47
45
|
const angleDiff = ((targetAngle - currentAngle + 180) % 360) - 180;
|
|
48
46
|
const newAngle = currentAngle + angleDiff;
|
|
49
|
-
|
|
47
|
+
animate(currentAngle, newAngle, {
|
|
50
48
|
duration: movementDuration,
|
|
51
49
|
ease: [0.16, 1, 0.3, 1],
|
|
52
50
|
onUpdate: (value) => {
|
|
@@ -55,7 +53,7 @@ exports.GlowingEffect = (({ blur = 0, inactiveZone = 0.7, proximity = 0, spread
|
|
|
55
53
|
});
|
|
56
54
|
});
|
|
57
55
|
}, [inactiveZone, proximity, movementDuration]);
|
|
58
|
-
|
|
56
|
+
useEffect(() => {
|
|
59
57
|
if (disabled)
|
|
60
58
|
return;
|
|
61
59
|
const handleScroll = () => handleMove();
|
|
@@ -72,7 +70,7 @@ exports.GlowingEffect = (({ blur = 0, inactiveZone = 0.7, proximity = 0, spread
|
|
|
72
70
|
document.body.removeEventListener("pointermove", handlePointerMove);
|
|
73
71
|
};
|
|
74
72
|
}, [handleMove, disabled]);
|
|
75
|
-
return ((
|
|
73
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn("pointer-events-none absolute -inset-px hidden rounded-[inherit] border opacity-0 transition-opacity", glow && "opacity-100", variant === "white" && "border-white", disabled && "!block") }), _jsx("div", { ref: containerRef, style: {
|
|
76
74
|
"--blur": `${blur}px`,
|
|
77
75
|
"--spread": spread,
|
|
78
76
|
"--start": "0",
|
|
@@ -82,5 +80,5 @@ exports.GlowingEffect = (({ blur = 0, inactiveZone = 0.7, proximity = 0, spread
|
|
|
82
80
|
"--gradient": variant === "white"
|
|
83
81
|
? `repeating-conic-gradient(from 236.84deg at 50% 50%,var(--black),var(--black) calc(25% / var(--repeating-conic-gradient-times)))`
|
|
84
82
|
: `linear-gradient(54.29deg, #00A5E9 22.93%, #A020F0 32.97%, #55C8FF 52.28%, #A020F0 73.13%, #071182 88.57%)`,
|
|
85
|
-
}, className:
|
|
83
|
+
}, className: cn("pointer-events-none absolute inset-0 rounded-[inherit] opacity-100 transition-opacity", glow && "opacity-100", blur > 0 && "blur-[var(--blur)] ", className, disabled && "!hidden"), children: _jsx("div", { className: cn("glow", "rounded-[inherit]", 'after:content-[""] after:rounded-[inherit] after:absolute after:inset-[calc(-1*var(--glowingeffect-border-width))]', "after:[border:var(--glowingeffect-border-width)_solid_transparent]", "after:[background:var(--gradient)] after:[background-attachment:fixed]", "after:opacity-[var(--active)] after:transition-opacity after:duration-300", "after:[mask-clip:padding-box,border-box]", "after:[mask-composite:intersect]", "after:[mask-image:linear-gradient(#0000,#0000),conic-gradient(from_calc((var(--start)-var(--spread))*1deg),#00000000_0deg,#fff,#00000000_calc(var(--spread)*2deg))]") }) })] }));
|
|
86
84
|
});
|