pixelize-design-library 2.2.177 → 2.2.179
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/coverage/clover.xml +638 -0
- package/coverage/coverage-final.json +20 -0
- package/coverage/lcov-report/Table/CompactSelect.tsx.html +379 -0
- package/coverage/lcov-report/Table/Components/ActiveFilters.tsx.html +514 -0
- package/coverage/lcov-report/Table/Components/HeaderActions.tsx.html +373 -0
- package/coverage/lcov-report/Table/Components/Pagination.tsx.html +574 -0
- package/coverage/lcov-report/Table/Components/TableActions.tsx.html +574 -0
- package/coverage/lcov-report/Table/Components/TableBody.tsx.html +1027 -0
- package/coverage/lcov-report/Table/Components/TableFilters.tsx.html +397 -0
- package/coverage/lcov-report/Table/Components/TableHeader.tsx.html +1060 -0
- package/coverage/lcov-report/Table/Components/TableLoading.tsx.html +361 -0
- package/coverage/lcov-report/Table/Components/TableSearch.tsx.html +337 -0
- package/coverage/lcov-report/Table/Components/index.html +266 -0
- package/coverage/lcov-report/Table/Components/useDebounce.ts.html +178 -0
- package/coverage/lcov-report/Table/Components/useTable.ts.html +778 -0
- package/coverage/lcov-report/Table/LeftFilterPane.tsx.html +1810 -0
- package/coverage/lcov-report/Table/SelectOperationControls.tsx.html +178 -0
- package/coverage/lcov-report/Table/Table.tsx.html +1567 -0
- package/coverage/lcov-report/Table/TableProps.tsx.html +658 -0
- package/coverage/lcov-report/Table/TableSettings/ManageColumns.tsx.html +619 -0
- package/coverage/lcov-report/Table/TableSettings/TableFilters.tsx.html +229 -0
- package/coverage/lcov-report/Table/TableSettings/TableSettings.tsx.html +532 -0
- package/coverage/lcov-report/Table/TableSettings/index.html +146 -0
- package/coverage/lcov-report/Table/TableToDo.tsx.html +973 -0
- package/coverage/lcov-report/Table/TextOperationControls.tsx.html +271 -0
- package/coverage/lcov-report/Table/filterTypes.ts.html +97 -0
- package/coverage/lcov-report/Table/index.html +176 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +146 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +1836 -0
- package/debug-storybook.log +72 -0
- package/dist/Assets/defaultLogo.tsx +31 -0
- package/dist/Components/KanbanBoard/KanbanBoard.js +18 -16
- package/dist/Components/Table/Components/TableBody.js +2 -2
- package/dist/Components/Table/Components/useTable.d.ts +1 -1
- package/dist/Components/Table/Components/useTable.js +71 -62
- package/dist/Components/Table/Table.js +14 -12
- package/dist/Hooks/usePreferences.js +18 -3
- package/dist/Theme/Dark/palette.d.ts +370 -0
- package/dist/Theme/Dark/palette.js +372 -0
- package/dist/Utils/table.d.ts +2 -1
- package/dist/Utils/table.js +1 -3
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[14:50:38.093] [INFO] storybook v10.2.16
|
|
2
|
+
[14:50:40.124] [DEBUG] Getting package.json info for /Users/mahesh/Applications/Pixelize/CRM/Micro-Components/package.json...
|
|
3
|
+
[14:50:40.126] [WARN] You are currently using Storybook 10.2.16 but you have packages which are incompatible with it:
|
|
4
|
+
|
|
5
|
+
- @storybook/addon-essentials@8.6.14 which depends on 8.6.14
|
|
6
|
+
Repo: https://github.com/storybookjs/storybook/tree/next/code/addons/essentials
|
|
7
|
+
- @storybook/addon-interactions@8.6.14 which depends on 8.6.14
|
|
8
|
+
Repo: https://github.com/storybookjs/storybook/tree/next/code/addons/interactions
|
|
9
|
+
- @storybook/test@8.6.15 which depends on 8.6.15
|
|
10
|
+
Repo: https://github.com/storybookjs/storybook/tree/next/code/lib/test
|
|
11
|
+
|
|
12
|
+
Please consider updating your packages or contacting the maintainers for compatibility details.
|
|
13
|
+
|
|
14
|
+
For more details on compatibility guidance, see:
|
|
15
|
+
https://github.com/storybookjs/storybook/issues/32836
|
|
16
|
+
[14:50:40.147] [ERROR] [38;2;241;97;97mSB_CORE-SERVER_0002 (CriticalPresetLoadError): Storybook failed to load the following preset: @storybook/react-vite/preset.
|
|
17
|
+
|
|
18
|
+
Please check whether your setup is correct, the Storybook dependencies (and their peer dependencies) are installed correctly and there are no package version clashes.
|
|
19
|
+
|
|
20
|
+
If you believe this is a bug, please open an issue on Github.
|
|
21
|
+
|
|
22
|
+
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@storybook/react-vite' imported from /Users/mahesh/.npm/_npx/6fe9a9991b157df1/node_modules/storybook/dist/_node-chunks/chunk-EBZ4DOUR.js
|
|
23
|
+
at packageResolve (node:internal/modules/esm/resolve:873:9)
|
|
24
|
+
at moduleResolve (node:internal/modules/esm/resolve:946:18)
|
|
25
|
+
at defaultResolve (node:internal/modules/esm/resolve:1188:11)
|
|
26
|
+
at nextResolve (node:internal/modules/esm/hooks:864:28)
|
|
27
|
+
at Hooks.resolve (node:internal/modules/esm/hooks:306:30)
|
|
28
|
+
at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
|
|
29
|
+
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:831:20)
|
|
30
|
+
at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
|
|
31
|
+
|
|
32
|
+
More info:
|
|
33
|
+
[39m
|
|
34
|
+
at loadPreset (file:///Users/mahesh/.npm/_npx/6fe9a9991b157df1/node_modules/storybook/dist/_node-chunks/chunk-UXMBIWPQ.js:10081:13)
|
|
35
|
+
at async Promise.all (index 0)
|
|
36
|
+
at async loadPresets (file:///Users/mahesh/.npm/_npx/6fe9a9991b157df1/node_modules/storybook/dist/_node-chunks/chunk-UXMBIWPQ.js:10090:73)
|
|
37
|
+
at async getPresets (file:///Users/mahesh/.npm/_npx/6fe9a9991b157df1/node_modules/storybook/dist/_node-chunks/chunk-UXMBIWPQ.js:10121:23)
|
|
38
|
+
at async buildDevStandalone (file:///Users/mahesh/.npm/_npx/6fe9a9991b157df1/node_modules/storybook/dist/core-server/index.js:7661:17)
|
|
39
|
+
at async withTelemetry (file:///Users/mahesh/.npm/_npx/6fe9a9991b157df1/node_modules/storybook/dist/_node-chunks/chunk-CSGMAQQ4.js:218:12)
|
|
40
|
+
at async dev (file:///Users/mahesh/.npm/_npx/6fe9a9991b157df1/node_modules/storybook/dist/bin/core.js:2734:3)
|
|
41
|
+
at async _Command.<anonymous> (file:///Users/mahesh/.npm/_npx/6fe9a9991b157df1/node_modules/storybook/dist/bin/core.js:2804:92)
|
|
42
|
+
[14:50:40.152] [WARN] Broken build, fix the error above.
|
|
43
|
+
You may need to refresh the browser.
|
|
44
|
+
[14:50:40.159] [WARN] Failed to load preset: {"name":"/Users/mahesh/Applications/Pixelize/CRM/Micro-Components/node_modules/@storybook/addon-essentials/dist/preset.js"} on level 2
|
|
45
|
+
[14:50:40.159] [ERROR] [38;2;241;97;97mError: Cannot find module 'storybook/internal/common'
|
|
46
|
+
Require stack:
|
|
47
|
+
- ./node_modules/@storybook/addon-essentials/dist/preset.js[39m
|
|
48
|
+
at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
|
|
49
|
+
at Module._load (node:internal/modules/cjs/loader:1043:27)
|
|
50
|
+
at Module.require (node:internal/modules/cjs/loader:1298:19)
|
|
51
|
+
at require (node:internal/modules/helpers:182:18)
|
|
52
|
+
at Object.<anonymous> (./node_modules/@storybook/addon-essentials/dist/preset.js:4:14)
|
|
53
|
+
at Module._compile (node:internal/modules/cjs/loader:1529:14)
|
|
54
|
+
at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
|
|
55
|
+
at Module.load (node:internal/modules/cjs/loader:1275:32)
|
|
56
|
+
at Module._load (node:internal/modules/cjs/loader:1096:12)
|
|
57
|
+
at cjsLoader (node:internal/modules/esm/translators:298:15)
|
|
58
|
+
[14:50:40.161] [WARN] Failed to load preset: {"name":"/Users/mahesh/Applications/Pixelize/CRM/Micro-Components/node_modules/@storybook/addon-interactions/dist/preset.js"} on level 2
|
|
59
|
+
[14:50:40.161] [ERROR] [38;2;241;97;97mError: Cannot find module 'storybook/internal/common'
|
|
60
|
+
Require stack:
|
|
61
|
+
- ./node_modules/@storybook/addon-interactions/dist/preset.js[39m
|
|
62
|
+
at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
|
|
63
|
+
at Module._load (node:internal/modules/cjs/loader:1043:27)
|
|
64
|
+
at Module.require (node:internal/modules/cjs/loader:1298:19)
|
|
65
|
+
at require (node:internal/modules/helpers:182:18)
|
|
66
|
+
at Object.<anonymous> (./node_modules/@storybook/addon-interactions/dist/preset.js:4:14)
|
|
67
|
+
at Module._compile (node:internal/modules/cjs/loader:1529:14)
|
|
68
|
+
at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
|
|
69
|
+
at Module.load (node:internal/modules/cjs/loader:1275:32)
|
|
70
|
+
at Module._load (node:internal/modules/cjs/loader:1096:12)
|
|
71
|
+
at cjsLoader (node:internal/modules/esm/translators:298:15)
|
|
72
|
+
[14:50:40.164] [INFO] Storybook collects completely anonymous usage telemetry. We use it to shape Storybook's roadmap and prioritize features. You can learn more, including how to opt out, at https://storybook.js.org/telemetry
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useCustomTheme } from "../Theme/useCustomTheme";
|
|
3
|
+
|
|
4
|
+
const DefaultLogo = () => {
|
|
5
|
+
const theme = useCustomTheme();
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
width="12.09"
|
|
9
|
+
height="15.95"
|
|
10
|
+
viewBox="0 0 31 29"
|
|
11
|
+
fill="none"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
>
|
|
14
|
+
<path
|
|
15
|
+
d="M30.4999 6.26137V7.81058H15.9761H14.8787V22.8508V28.8862H12.5226C9.6824 28.8862 7.32632 26.4656 7.06812 23.3995C7.06812 23.2381 7.06812 23.0444 7.06812 22.8508V18.3323C7.06812 18.2677 7.06812 18.2032 7.06812 18.1063V15.5889V6.2291C7.06812 2.80793 9.84378 -5.72205e-06 13.2972 -5.72205e-06H24.8517C28.0147 0.355021 30.4676 3.00158 30.4676 6.2291L30.4999 6.26137Z"
|
|
16
|
+
fill={theme.colors.black}
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M7.10053 23.3672H7.03598C5.16402 23.2381 3.48571 22.4635 2.25926 21.3338C0.871428 20.0428 0 18.2677 0 16.3312V15.6211H7.06825V18.1386C7.06825 18.2032 7.06825 18.2677 7.06825 18.3645V22.883C7.06825 23.0767 7.06825 23.2381 7.06825 23.4317L7.10053 23.3672Z"
|
|
20
|
+
fill={theme.colors.black}
|
|
21
|
+
/>
|
|
22
|
+
<path
|
|
23
|
+
d="M30.4678 12.0063V15.6211V17.1703C30.4678 20.6238 26.272 23.3994 21.0757 23.3994H14.8789V22.8508V15.6211H22.6572V7.81056C22.6895 7.81056 30.5001 7.81056 30.5001 7.81056V11.5868C30.5001 11.7159 30.5001 11.8772 30.5001 12.0063H30.4678Z"
|
|
24
|
+
fill={theme.colors.black}
|
|
25
|
+
/>
|
|
26
|
+
</svg>
|
|
27
|
+
|
|
28
|
+
)
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default DefaultLogo;
|
|
@@ -324,7 +324,7 @@ var KanbanBoard = function (_a) {
|
|
|
324
324
|
return toggleExpand(item.id, colId, rubric.source.index);
|
|
325
325
|
}, isDeletable: canDelete }))));
|
|
326
326
|
} }, function (provided, snapshot) {
|
|
327
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
327
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
328
328
|
return (react_1.default.createElement(react_2.Box, __assign({ ref: provided.innerRef }, provided.droppableProps, { width: isColCollapsed ? COLLAPSED_KANBAN_COLUMN_WIDTH : columnWidth, borderRadius: "0.5rem", borderWidth: "0.063rem", background: snapshot.isDraggingOver
|
|
329
329
|
? (_a = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _a === void 0 ? void 0 : _a[50]
|
|
330
330
|
: (_b = colors === null || colors === void 0 ? void 0 : colors.background) === null || _b === void 0 ? void 0 : _b[100], border: "".concat(snapshot.isDraggingOver
|
|
@@ -344,21 +344,23 @@ var KanbanBoard = function (_a) {
|
|
|
344
344
|
column.customNode ? (react_1.default.createElement(react_2.Box, { flexShrink: 0, minH: COLLAPSED_CUSTOM_NODE_TOP_RESERVE, w: "100%", bg: (_q = colors === null || colors === void 0 ? void 0 : colors.background) === null || _q === void 0 ? void 0 : _q[100], "aria-hidden": true })) : null,
|
|
345
345
|
column.customNode ? (react_1.default.createElement(react_2.Box, { as: "section", "aria-label": "Column summary", flex: "1", minH: 0, w: "100%", overflow: "visible", py: 2, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "flex-start", bg: (_r = colors === null || colors === void 0 ? void 0 : colors.background) === null || _r === void 0 ? void 0 : _r[100], position: "relative", zIndex: 2 },
|
|
346
346
|
react_1.default.createElement(react_2.Box, { position: "relative", transform: "rotate(90deg)", transformOrigin: "center center", marginTop: '1rem' },
|
|
347
|
-
react_1.default.createElement(react_2.VStack, { align: "stretch", spacing: 1, minW: "max-content", fontSize: "xs", color: (_s = colors === null || colors === void 0 ? void 0 : colors.text) === null || _s === void 0 ? void 0 : _s[600] }, column.customNode())))) : (react_1.default.createElement(react_2.Box, { flex: "1", minH: 0 })))) : (react_1.default.createElement(react_2.Flex, { width: "95%", h: !isColCollapsed && column.customNode ? "auto" : "2.75rem", borderRadius: "0.25rem", borderLeft: "0.188rem solid", borderLeftColor: (
|
|
348
|
-
|
|
349
|
-
react_1.default.createElement(react_2.
|
|
350
|
-
|
|
351
|
-
react_1.default.createElement(react_2.
|
|
352
|
-
react_1.default.createElement(
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
347
|
+
react_1.default.createElement(react_2.VStack, { align: "stretch", spacing: 1, minW: "max-content", fontSize: "xs", color: (_s = colors === null || colors === void 0 ? void 0 : colors.text) === null || _s === void 0 ? void 0 : _s[600] }, column.customNode())))) : (react_1.default.createElement(react_2.Box, { flex: "1", minH: 0 })))) : (react_1.default.createElement(react_2.Flex, { width: "95%", h: !isColCollapsed && !!((_t = column.customNode) === null || _t === void 0 ? void 0 : _t.call(column)) ? "auto" : "2.75rem", borderRadius: "0.25rem", borderLeft: "0.188rem solid", borderLeftColor: (_u = column.color) !== null && _u !== void 0 ? _u : (_v = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _v === void 0 ? void 0 : _v[500], background: (_w = colors === null || colors === void 0 ? void 0 : colors.background) === null || _w === void 0 ? void 0 : _w[300], align: "center", px: 2, m: 2, flexShrink: 0, justifyContent: "space-between", position: "relative", gap: 2 },
|
|
348
|
+
react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: 2 },
|
|
349
|
+
enableColumnReorder && columnDragHandleProps ? (react_1.default.createElement(react_2.Flex, __assign({ align: "center", justify: "center", flexShrink: 0, cursor: "grab" }, columnDragHandleProps),
|
|
350
|
+
react_1.default.createElement(react_2.Box, { as: lucide_react_1.GripVertical, size: 14, color: (_x = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _x === void 0 ? void 0 : _x[400] }))) : null,
|
|
351
|
+
react_1.default.createElement(react_2.Flex, { direction: "column", gap: 1, mt: !isColCollapsed && !!((_y = column.customNode) === null || _y === void 0 ? void 0 : _y.call(column)) ? "1" : "0" },
|
|
352
|
+
react_1.default.createElement(react_2.Text, { as: "span", fontWeight: "600", fontSize: "0.875rem", color: (_z = colors === null || colors === void 0 ? void 0 : colors.text) === null || _z === void 0 ? void 0 : _z[700], noOfLines: 1, flex: "1", minW: 0 },
|
|
353
|
+
react_1.default.createElement(OverflowTooltipText_1.default, { placement: "top" }, column.title)),
|
|
354
|
+
!!((_0 = column.customNode) === null || _0 === void 0 ? void 0 : _0.call(column)) ? (react_1.default.createElement(react_2.Box, { as: "section", "aria-label": "Column summary", width: "95%", flexShrink: 0, fontSize: "xs", mb: 1, color: (_1 = colors === null || colors === void 0 ? void 0 : colors.text) === null || _1 === void 0 ? void 0 : _1[600] }, column.customNode())) : null)),
|
|
355
|
+
react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: 2 },
|
|
356
|
+
react_1.default.createElement(react_2.Badge, { minW: { base: "20px", sm: "22px", md: "24px" }, h: { base: "20px", sm: "22px", md: "24px" }, borderRadius: "999px", border: "1px solid", backgroundColor: (_2 = colors === null || colors === void 0 ? void 0 : colors.background) === null || _2 === void 0 ? void 0 : _2[100], borderColor: (_3 = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _3 === void 0 ? void 0 : _3[300], display: "flex", alignItems: "center", justifyContent: "center", color: (_4 = colors === null || colors === void 0 ? void 0 : colors.text) === null || _4 === void 0 ? void 0 : _4[900], fontWeight: 600, fontSize: { base: "10px", sm: "11px", md: "12px" } }, (_5 = column === null || column === void 0 ? void 0 : column.items) === null || _5 === void 0 ? void 0 : _5.length),
|
|
357
|
+
enableColumnCollapse && (react_1.default.createElement(react_2.IconButton, { "aria-label": "Collapse column", icon: react_1.default.createElement(lucide_react_1.ChevronLeft, { size: 14 }), variant: "ghost", size: "xs", minW: "1.5rem", h: "1.75rem", flexShrink: 0, onClick: function () { return toggleColumnCollapsed(colId); } })),
|
|
358
|
+
canDelete &&
|
|
359
|
+
hoveredColumn === colId &&
|
|
360
|
+
column.items.length > 0 && (react_1.default.createElement(react_2.Box, { as: lucide_react_1.Trash2, size: 16, cursor: "pointer", color: (_6 = colors === null || colors === void 0 ? void 0 : colors.text) === null || _6 === void 0 ? void 0 : _6[600], _hover: { color: (_7 = colors === null || colors === void 0 ? void 0 : colors.red) === null || _7 === void 0 ? void 0 : _7[600] }, onClick: function () { return handleColumnDelete(colId); }, transition: "color 0.2s ease", flexShrink: 0 })),
|
|
361
|
+
!(canDelete &&
|
|
362
|
+
hoveredColumn === colId &&
|
|
363
|
+
column.items.length > 0) && react_1.default.createElement(react_2.Box, { width: "16px", height: "16px", flexShrink: 0 })))),
|
|
362
364
|
!isColCollapsed && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
363
365
|
react_1.default.createElement(react_2.Box, { px: 2, flex: "1", overflowY: "auto", width: "100%", sx: {
|
|
364
366
|
overflowY: "auto",
|
|
@@ -94,7 +94,6 @@ var TableBody = function (_a) {
|
|
|
94
94
|
react_2.default.createElement("p", null, "No data found")))));
|
|
95
95
|
}
|
|
96
96
|
return (react_2.default.createElement(react_2.default.Fragment, null, data.map(function (row, index) {
|
|
97
|
-
var _a;
|
|
98
97
|
var rowIndex = startRow + index;
|
|
99
98
|
var isExpanded = expandedRows.has(rowIndex);
|
|
100
99
|
var isChecked = selections.includes(row.id);
|
|
@@ -106,7 +105,7 @@ var TableBody = function (_a) {
|
|
|
106
105
|
},
|
|
107
106
|
}
|
|
108
107
|
: {} },
|
|
109
|
-
isContent && (react_2.default.createElement(RenderContent, { rowIndex: rowIndex, isExpanded: isExpanded, isContent: !!(
|
|
108
|
+
isContent && (react_2.default.createElement(RenderContent, { rowIndex: rowIndex, isExpanded: isExpanded, isContent: !!(row === null || row === void 0 ? void 0 : row.content) })),
|
|
110
109
|
isCheckbox && react_2.default.createElement(RenderCheckbox, { row: row, isChecked: isChecked }),
|
|
111
110
|
columns.map(function (header, headerIndex) {
|
|
112
111
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -122,6 +121,7 @@ var TableBody = function (_a) {
|
|
|
122
121
|
row: row,
|
|
123
122
|
freezedBgColor: freezedBgColor,
|
|
124
123
|
index: index,
|
|
124
|
+
theme: theme,
|
|
125
125
|
}).leftOffset;
|
|
126
126
|
return (react_2.default.createElement(react_1.Td, { maxWidth: 500, minWidth: 120, height: 45, key: headerIndex + 1, onClick: function () {
|
|
127
127
|
return !header.node
|
|
@@ -40,7 +40,7 @@ declare const useTable: ({ tableBorderColor, data, isPagination, selections, onS
|
|
|
40
40
|
rowsPerPage: number;
|
|
41
41
|
setCurrentPage: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
42
42
|
columnsList: TableHeaderProps[];
|
|
43
|
-
handleColumnPreferences: (
|
|
43
|
+
handleColumnPreferences: (cols: any) => void;
|
|
44
44
|
handleGlobalSearch: (query: string) => void;
|
|
45
45
|
};
|
|
46
46
|
export default useTable;
|
|
@@ -46,11 +46,18 @@ var useTable = function (_a) {
|
|
|
46
46
|
var _d = (0, react_1.useState)([]), columnsSort = _d[0], setColumnsSort = _d[1];
|
|
47
47
|
var _e = (0, react_1.useState)(0), currentPage = _e[0], setCurrentPage = _e[1];
|
|
48
48
|
var _f = (0, react_1.useState)(noOfRowsPerPage !== null && noOfRowsPerPage !== void 0 ? noOfRowsPerPage : defaultPageSize), rowsPerPage = _f[0], setRowsPerPage = _f[1];
|
|
49
|
-
var
|
|
50
|
-
var _g = (0, react_1.useState)(tableData), filteredData = _g[0], setFilteredData = _g[1];
|
|
51
|
-
var _h = (0, react_1.useState)(function () {
|
|
49
|
+
var _g = (0, react_1.useState)(function () {
|
|
52
50
|
return columns.map(function (col) { return (__assign({}, col)); });
|
|
53
|
-
}), columnsList =
|
|
51
|
+
}), columnsList = _g[0], setColumnsList = _g[1];
|
|
52
|
+
// Stable refs for callbacks that shouldn't appear in deps
|
|
53
|
+
var onSelectionRef = (0, react_1.useRef)(onSelection);
|
|
54
|
+
onSelectionRef.current = onSelection;
|
|
55
|
+
var dataRef = (0, react_1.useRef)(data);
|
|
56
|
+
dataRef.current = data;
|
|
57
|
+
var tablePreferencesRef = (0, react_1.useRef)(tablePreferences);
|
|
58
|
+
tablePreferencesRef.current = tablePreferences;
|
|
59
|
+
var savePreferencesRef = (0, react_1.useRef)(savePreferences);
|
|
60
|
+
savePreferencesRef.current = savePreferences;
|
|
54
61
|
(0, react_1.useEffect)(function () {
|
|
55
62
|
var _a;
|
|
56
63
|
var columnPreference = (_a = tablePreferences === null || tablePreferences === void 0 ? void 0 : tablePreferences.columns) !== null && _a !== void 0 ? _a : [];
|
|
@@ -67,9 +74,6 @@ var useTable = function (_a) {
|
|
|
67
74
|
setColumnsList(columns.map(function (col) { return (__assign({}, col)); }));
|
|
68
75
|
}
|
|
69
76
|
}, [tablePreferences, columns]);
|
|
70
|
-
(0, react_1.useEffect)(function () {
|
|
71
|
-
setFilteredData(tableData);
|
|
72
|
-
}, [tableData]);
|
|
73
77
|
var tableContainerStyles = (0, react_1.useMemo)(function () {
|
|
74
78
|
var _a;
|
|
75
79
|
return ({
|
|
@@ -81,8 +85,8 @@ var useTable = function (_a) {
|
|
|
81
85
|
overflowY: "auto",
|
|
82
86
|
});
|
|
83
87
|
}, [tableBorderColor, theme]);
|
|
84
|
-
var isContent = (0, react_1.useMemo)(function () { return
|
|
85
|
-
var isLink = (0, react_1.useMemo)(function () { return
|
|
88
|
+
var isContent = (0, react_1.useMemo)(function () { return data.some(function (o) { return o.content; }); }, [data]);
|
|
89
|
+
var isLink = (0, react_1.useMemo)(function () { return data.some(function (o) { return o.onLink || o.onDelete || o.onEdit; }); }, [data]);
|
|
86
90
|
(0, react_1.useEffect)(function () {
|
|
87
91
|
var widths = headerRefs.current.map(function (ref) { return (ref === null || ref === void 0 ? void 0 : ref.offsetWidth) || 0; });
|
|
88
92
|
setColumnWidths(widths);
|
|
@@ -91,84 +95,89 @@ var useTable = function (_a) {
|
|
|
91
95
|
if (isServerPagination) {
|
|
92
96
|
return Math.ceil(totalRecords / (noOfRowsPerPage !== null && noOfRowsPerPage !== void 0 ? noOfRowsPerPage : 1));
|
|
93
97
|
}
|
|
94
|
-
return isPagination ? Math.ceil(
|
|
98
|
+
return isPagination ? Math.ceil(data.length / rowsPerPage) : 0;
|
|
95
99
|
}, [
|
|
96
100
|
isPagination,
|
|
97
101
|
rowsPerPage,
|
|
98
|
-
|
|
102
|
+
data.length,
|
|
99
103
|
totalRecords,
|
|
100
104
|
isServerPagination,
|
|
101
105
|
noOfRowsPerPage,
|
|
102
106
|
]);
|
|
103
107
|
var startRow = (0, react_1.useMemo)(function () { return (!isPagination ? 0 : currentPage * rowsPerPage); }, [currentPage, isPagination, rowsPerPage]);
|
|
104
|
-
var endRow = (0, react_1.useMemo)(function () { return (!isPagination ?
|
|
105
|
-
(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
var endRow = (0, react_1.useMemo)(function () { return (!isPagination ? data.length : startRow + rowsPerPage); }, [isPagination, rowsPerPage, startRow, data.length]);
|
|
109
|
+
// Sort once (only re-runs when data or sort config changes, not on page change)
|
|
110
|
+
var sortedData = (0, react_1.useMemo)(function () {
|
|
111
|
+
if (isServerPagination)
|
|
112
|
+
return data;
|
|
113
|
+
return (0, table_1.SortMultiColumnData)(data, columnsSort);
|
|
114
|
+
}, [data, columnsSort, isServerPagination]);
|
|
115
|
+
// Paginate from the already-sorted data
|
|
116
|
+
var filteredData = (0, react_1.useMemo)(function () {
|
|
117
|
+
if (isServerPagination)
|
|
118
|
+
return sortedData;
|
|
119
|
+
return sortedData.slice(startRow, endRow);
|
|
120
|
+
}, [sortedData, startRow, endRow, isServerPagination]);
|
|
121
|
+
var handlePageSizeChange = (0, react_1.useCallback)(function (event) {
|
|
114
122
|
var value = Number(event.target.value);
|
|
115
123
|
setRowsPerPage(value !== 0 ? value : defaultPageSize);
|
|
116
124
|
if (onNoOfRowsPerPageChange) {
|
|
117
125
|
onNoOfRowsPerPageChange(value !== 0 ? value : defaultPageSize);
|
|
118
126
|
}
|
|
119
127
|
setCurrentPage(0);
|
|
120
|
-
};
|
|
128
|
+
}, [onNoOfRowsPerPageChange]);
|
|
129
|
+
// Stable: uses functional updater so columnsSort is not a dependency
|
|
121
130
|
var handleSort = (0, react_1.useCallback)(function (field, sort) {
|
|
122
131
|
if (!sort)
|
|
123
132
|
return;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
column: field,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
setColumnsSort(newSortState);
|
|
137
|
-
}, [columnsSort]);
|
|
133
|
+
setColumnsSort(function (prev) {
|
|
134
|
+
var next = __spreadArray([], prev, true);
|
|
135
|
+
var existingIndex = next.findIndex(function (s) { return s.column === field; });
|
|
136
|
+
if (existingIndex === -1) {
|
|
137
|
+
next.push({ column: field, direction: "asc" });
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
next[existingIndex] = __assign(__assign({}, next[existingIndex]), { direction: sort });
|
|
141
|
+
}
|
|
142
|
+
return next;
|
|
143
|
+
});
|
|
144
|
+
}, []);
|
|
138
145
|
(0, react_1.useEffect)(function () {
|
|
139
146
|
setSelection(selections !== null && selections !== void 0 ? selections : []);
|
|
140
147
|
}, [selections]);
|
|
148
|
+
// Stable: uses functional updater + refs so selection/data are not dependencies
|
|
141
149
|
var handleCheckbox = (0, react_1.useCallback)(function (id) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
setSelection(function (prev) {
|
|
151
|
+
var _a;
|
|
152
|
+
var currentData = dataRef.current;
|
|
153
|
+
var selectedItems;
|
|
154
|
+
if (id === 0) {
|
|
155
|
+
selectedItems =
|
|
156
|
+
prev.length === currentData.length
|
|
157
|
+
? []
|
|
158
|
+
: currentData.map(function (item) { return item.id; });
|
|
159
|
+
}
|
|
160
|
+
else if (prev.includes(id)) {
|
|
161
|
+
selectedItems = prev.filter(function (item) { return item !== id; });
|
|
146
162
|
}
|
|
147
163
|
else {
|
|
148
|
-
selectedItems =
|
|
164
|
+
selectedItems = __spreadArray(__spreadArray([], prev, true), [id], false);
|
|
149
165
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
savePreferences(__assign(__assign({}, tablePreferences), { columns: columns }));
|
|
164
|
-
};
|
|
165
|
-
var handleGlobalSearch = function (query) {
|
|
166
|
-
if (!query)
|
|
167
|
-
setFilteredData(tableData);
|
|
168
|
-
setFilteredData((0, table_1.globalSearchFilter)(tableData, query));
|
|
169
|
-
};
|
|
166
|
+
(_a = onSelectionRef.current) === null || _a === void 0 ? void 0 : _a.call(onSelectionRef, selectedItems);
|
|
167
|
+
return selectedItems;
|
|
168
|
+
});
|
|
169
|
+
}, []);
|
|
170
|
+
var handleColumnPreferences = (0, react_1.useCallback)(function (cols) {
|
|
171
|
+
var _a;
|
|
172
|
+
setColumnsList(cols);
|
|
173
|
+
(_a = savePreferencesRef.current) === null || _a === void 0 ? void 0 : _a.call(savePreferencesRef, __assign(__assign({}, tablePreferencesRef.current), { columns: cols }));
|
|
174
|
+
}, []);
|
|
175
|
+
var handleGlobalSearch = (0, react_1.useCallback)(function (query) {
|
|
176
|
+
// Not used inside Table.tsx render path (Table uses its own _filteredData memo),
|
|
177
|
+
// but kept for API compatibility.
|
|
178
|
+
}, []);
|
|
170
179
|
return {
|
|
171
|
-
tableData:
|
|
180
|
+
tableData: data,
|
|
172
181
|
tableContainerStyles: tableContainerStyles,
|
|
173
182
|
isContent: isContent,
|
|
174
183
|
isLink: isLink,
|
|
@@ -56,16 +56,17 @@ var TableSearch_1 = __importDefault(require("./Components/TableSearch"));
|
|
|
56
56
|
var ActiveFilters_1 = __importDefault(require("./Components/ActiveFilters"));
|
|
57
57
|
var lucide_react_1 = require("lucide-react");
|
|
58
58
|
var MotionBox = (0, framer_motion_1.motion)(react_2.Box);
|
|
59
|
+
var DEFAULT_PREFERENCES = {
|
|
60
|
+
url: "",
|
|
61
|
+
token: "",
|
|
62
|
+
key: "",
|
|
63
|
+
name: "",
|
|
64
|
+
page: "",
|
|
65
|
+
orgId: "",
|
|
66
|
+
};
|
|
59
67
|
function Table(_a) {
|
|
60
68
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
61
|
-
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _0 = _a.isCheckbox, isCheckbox = _0 === void 0 ? false : _0, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _1 = _a.noBorders, noBorders = _1 === void 0 ? false : _1, _2 = _a.isPagination, isPagination = _2 === void 0 ? true : _2, onRowClick = _a.onRowClick, selections = _a.selections, _3 = _a.isActionFreeze, isActionFreeze = _3 === void 0 ? true : _3, _4 = _a.preferences, preferences = _4 === void 0 ?
|
|
62
|
-
url: "",
|
|
63
|
-
token: "",
|
|
64
|
-
key: "",
|
|
65
|
-
name: "",
|
|
66
|
-
page: "",
|
|
67
|
-
orgId: "",
|
|
68
|
-
} : _4, _5 = _a.paginationMode, paginationMode = _5 === void 0 ? "client" : _5, _6 = _a.noOfRowsPerPage, noOfRowsPerPage = _6 === void 0 ? 50 : _6, _7 = _a.totalRecords, totalRecords = _7 === void 0 ? 0 : _7, onPagination = _a.onPagination, _8 = _a.isTableSettings, isTableSettings = _8 === void 0 ? false : _8, headerActions = _a.headerActions, onGlobalSearch = _a.onGlobalSearch, onNoOfRowsPerPageChange = _a.onNoOfRowsPerPageChange, paginationSelectOptions = _a.paginationSelectOptions, tableMaxHeight = _a.tableMaxHeight, minVisibleRows = _a.minVisibleRows, maxVisibleRows = _a.maxVisibleRows, autoFitViewport = _a.autoFitViewport, tableSettings = _a.tableSettings, filterSidebar = _a.filterSidebar, loadingSkeletonRows = _a.loadingSkeletonRows
|
|
69
|
+
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _0 = _a.isCheckbox, isCheckbox = _0 === void 0 ? false : _0, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _1 = _a.noBorders, noBorders = _1 === void 0 ? false : _1, _2 = _a.isPagination, isPagination = _2 === void 0 ? true : _2, onRowClick = _a.onRowClick, selections = _a.selections, _3 = _a.isActionFreeze, isActionFreeze = _3 === void 0 ? true : _3, _4 = _a.preferences, preferences = _4 === void 0 ? DEFAULT_PREFERENCES : _4, _5 = _a.paginationMode, paginationMode = _5 === void 0 ? "client" : _5, _6 = _a.noOfRowsPerPage, noOfRowsPerPage = _6 === void 0 ? 50 : _6, _7 = _a.totalRecords, totalRecords = _7 === void 0 ? 0 : _7, onPagination = _a.onPagination, _8 = _a.isTableSettings, isTableSettings = _8 === void 0 ? false : _8, headerActions = _a.headerActions, onGlobalSearch = _a.onGlobalSearch, onNoOfRowsPerPageChange = _a.onNoOfRowsPerPageChange, paginationSelectOptions = _a.paginationSelectOptions, tableMaxHeight = _a.tableMaxHeight, minVisibleRows = _a.minVisibleRows, maxVisibleRows = _a.maxVisibleRows, autoFitViewport = _a.autoFitViewport, tableSettings = _a.tableSettings, filterSidebar = _a.filterSidebar, loadingSkeletonRows = _a.loadingSkeletonRows
|
|
69
70
|
// onColumnFilter
|
|
70
71
|
;
|
|
71
72
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
@@ -117,11 +118,12 @@ function Table(_a) {
|
|
|
117
118
|
var _filteredData = (0, react_1.useMemo)(function () {
|
|
118
119
|
return (0, table_1.searchAndSortData)(filteredData, columnsSearch);
|
|
119
120
|
}, [columnsSearch, filteredData]);
|
|
121
|
+
var onPaginationRef = (0, react_1.useRef)(onPagination);
|
|
122
|
+
onPaginationRef.current = onPagination;
|
|
120
123
|
(0, react_1.useEffect)(function () {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}, [currentPage, onPagination, noOfRowsPerPage]);
|
|
124
|
+
var _a;
|
|
125
|
+
(_a = onPaginationRef.current) === null || _a === void 0 ? void 0 : _a.call(onPaginationRef, currentPage + 1, noOfRowsPerPage);
|
|
126
|
+
}, [currentPage, noOfRowsPerPage]);
|
|
125
127
|
var tablePaginationText = "".concat(startRow + 1, " - ").concat(endRow > tableData.length ? tableData.length : endRow, " of ").concat(isServerPagination ? totalRecords : tableData.length);
|
|
126
128
|
var controlsHeight = 45;
|
|
127
129
|
var estimatedRowHeight = 45;
|
|
@@ -28,17 +28,32 @@ var useGetPreferences = function (_a) {
|
|
|
28
28
|
if (!baseUrl) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
+
var controller = new AbortController();
|
|
31
32
|
setLoading(true);
|
|
32
33
|
var url = constructUrl({ baseUrl: baseUrl, key: key, page: page, name: name, orgId: orgId });
|
|
33
34
|
fetch(url, {
|
|
34
35
|
headers: {
|
|
35
36
|
Authorization: authToken,
|
|
36
37
|
},
|
|
38
|
+
signal: controller.signal,
|
|
37
39
|
})
|
|
38
40
|
.then(function (response) { return response.json(); })
|
|
39
|
-
.then(function (data) {
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
.then(function (data) {
|
|
42
|
+
if (!controller.signal.aborted) {
|
|
43
|
+
setPreferences(data);
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
.catch(function (error) {
|
|
47
|
+
if (!controller.signal.aborted) {
|
|
48
|
+
console.error(error);
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
.finally(function () {
|
|
52
|
+
if (!controller.signal.aborted) {
|
|
53
|
+
setLoading(false);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return function () { return controller.abort(); };
|
|
42
57
|
/* eslint-disable */
|
|
43
58
|
}, [baseUrl]);
|
|
44
59
|
return { preferences: preferences, loading: loading };
|