@codezee/sixtify-brahma 0.2.193 → 0.2.195
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 +1 -55
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSelection.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSelection.js +108 -24
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArranger.d.ts +20 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArranger.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArranger.js +49 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerDialog.d.ts +17 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerDialog.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerDialog.js +117 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerForm.d.ts +17 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerForm.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerForm.js +47 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnItem.d.ts +16 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnItem.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnItem.js +122 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/LockedColumnItem.d.ts +6 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/LockedColumnItem.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/LockedColumnItem.js +17 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/hooks/useRefinedColumns.d.ts +13 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/hooks/useRefinedColumns.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/hooks/useRefinedColumns.js +24 -0
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.d.ts +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.js +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.js +11 -5
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupAreaOverlay.d.ts +3 -1
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupAreaOverlay.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupAreaOverlay.js +25 -6
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupedPanel.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/Grouped/GroupedPanel.js +14 -5
- package/packages/shared-components/dist/SmartGrid/Components/HeaderCells/HeaderCell.js +2 -2
- package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/SearchFilterRow.js +2 -2
- package/packages/shared-components/dist/SmartGrid/Components/SmartAlignments.d.ts +9 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartAlignments.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartAlignments.js +63 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartButton.d.ts +7 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartButton.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartButton.js +21 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartDialog.d.ts +12 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartDialog.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartDialog.js +42 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartSwitch.d.ts +7 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartSwitch.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/SmartSwitch.js +53 -0
- package/packages/shared-components/dist/SmartGrid/Components/Svgs/HideIcon.d.ts +3 -0
- package/packages/shared-components/dist/SmartGrid/Components/Svgs/HideIcon.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/Svgs/HideIcon.js +6 -0
- package/packages/shared-components/dist/SmartGrid/Components/TableRowComponent.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/TableRowComponent.js +48 -3
- package/packages/shared-components/dist/SmartGrid/SmartGrid.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/SmartGrid.js +221 -70
- package/packages/shared-components/dist/SmartGrid/hooks/useGetColumnWidth.d.ts +2 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useGetColumnWidth.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useGetGroupedColumn.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useGetGroupedColumn.js +4 -0
- package/packages/shared-components/dist/SmartGrid/hooks/useTableState.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useTableState.js +1 -7
- package/packages/shared-components/dist/SmartGrid/types/index.d.ts +9 -0
- package/packages/shared-components/dist/SmartGrid/types/index.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/utils/summaryCalculations.d.ts.map +1 -1
- package/packages/shared-components/dist/Svgs/BookMarkSvg.d.ts +3 -0
- package/packages/shared-components/dist/Svgs/BookMarkSvg.d.ts.map +1 -0
- package/packages/shared-components/dist/Svgs/BookMarkSvg.js +6 -0
- package/packages/shared-components/dist/Svgs/index.d.ts +1 -0
- package/packages/shared-components/dist/Svgs/index.d.ts.map +1 -1
- package/packages/shared-components/dist/Svgs/index.js +1 -0
- package/packages/shared-components/dist/index.d.ts +0 -1
- package/packages/shared-components/dist/index.d.ts.map +1 -1
- package/packages/shared-components/dist/index.js +0 -1
- package/packages/shared-components/dist/RichTextEditor/EditorMenuControls.d.ts +0 -2
- package/packages/shared-components/dist/RichTextEditor/EditorMenuControls.d.ts.map +0 -1
- package/packages/shared-components/dist/RichTextEditor/EditorMenuControls.js +0 -12
- package/packages/shared-components/dist/RichTextEditor/RichTextEditor.d.ts +0 -19
- package/packages/shared-components/dist/RichTextEditor/RichTextEditor.d.ts.map +0 -1
- package/packages/shared-components/dist/RichTextEditor/RichTextEditor.js +0 -88
- package/packages/shared-components/dist/RichTextEditor/index.d.ts +0 -2
- package/packages/shared-components/dist/RichTextEditor/index.d.ts.map +0 -1
- package/packages/shared-components/dist/RichTextEditor/index.js +0 -17
- package/packages/shared-components/dist/RichTextEditor/useExtensions.d.ts +0 -13
- package/packages/shared-components/dist/RichTextEditor/useExtensions.d.ts.map +0 -1
- package/packages/shared-components/dist/RichTextEditor/useExtensions.js +0 -169
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.d.ts +0 -5
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.js +0 -59
- package/packages/shared-components/dist/SmartGrid/Components/HeaderCells/GroupingIcons.d.ts +0 -8
- package/packages/shared-components/dist/SmartGrid/Components/HeaderCells/GroupingIcons.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/HeaderCells/GroupingIcons.js +0 -41
- package/packages/shared-components/dist/SmartGrid/hooks/useProcessColumnsForGroupDisplay.d.ts +0 -11
- package/packages/shared-components/dist/SmartGrid/hooks/useProcessColumnsForGroupDisplay.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/hooks/useProcessColumnsForGroupDisplay.js +0 -30
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartSwitch = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
6
|
+
const SmartSwitch = ({ name, control, defaultValue, rules, label, }) => {
|
|
7
|
+
const { field: { value = false, onChange }, } = (0, react_hook_form_1.useController)({ name, control, defaultValue, rules });
|
|
8
|
+
const handleToggle = () => {
|
|
9
|
+
onChange(!value);
|
|
10
|
+
};
|
|
11
|
+
const containerStyle = {
|
|
12
|
+
display: "flex",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
gap: "12px",
|
|
15
|
+
};
|
|
16
|
+
const labelStyle = {
|
|
17
|
+
color: "#374151",
|
|
18
|
+
fontWeight: "500",
|
|
19
|
+
};
|
|
20
|
+
const buttonStyle = {
|
|
21
|
+
position: "relative",
|
|
22
|
+
width: "42px",
|
|
23
|
+
height: "20px",
|
|
24
|
+
background: "transparent",
|
|
25
|
+
border: "none",
|
|
26
|
+
cursor: "pointer",
|
|
27
|
+
outline: "none",
|
|
28
|
+
padding: "0",
|
|
29
|
+
};
|
|
30
|
+
const trackStyle = {
|
|
31
|
+
position: "absolute",
|
|
32
|
+
top: "0",
|
|
33
|
+
left: "0",
|
|
34
|
+
width: "100%",
|
|
35
|
+
height: "100%",
|
|
36
|
+
borderRadius: "11px",
|
|
37
|
+
backgroundColor: value ? "#38bdf8" : "#e5e7eb",
|
|
38
|
+
transition: "background-color 0.25s ease",
|
|
39
|
+
};
|
|
40
|
+
const circleStyle = {
|
|
41
|
+
position: "absolute",
|
|
42
|
+
top: "2px",
|
|
43
|
+
left: value ? "23px" : "3px",
|
|
44
|
+
width: "18px",
|
|
45
|
+
height: "16px",
|
|
46
|
+
borderRadius: "50%",
|
|
47
|
+
backgroundColor: "#ffffff",
|
|
48
|
+
transition: "left 0.25s ease",
|
|
49
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.2)",
|
|
50
|
+
};
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: containerStyle, children: [label && (0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: label }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleToggle, style: buttonStyle, role: "switch", "aria-checked": value, type: "button", children: [(0, jsx_runtime_1.jsx)("span", { style: trackStyle }), (0, jsx_runtime_1.jsx)("span", { style: circleStyle })] })] }));
|
|
52
|
+
};
|
|
53
|
+
exports.SmartSwitch = SmartSwitch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HideIcon.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/Svgs/HideIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,eAAO,MAAM,QAAQ,GAAI,OAAO,QAAQ,CAAC,aAAa,CAAC,4CA0BtD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HideIcon = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const HideIcon = (props) => ((0, jsx_runtime_1.jsxs)("svg", { fill: "#000000", width: "800px", height: "800px", viewBox: "0 0 36 36", preserveAspectRatio: "xMidYMid meet", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", ...props, children: [(0, jsx_runtime_1.jsx)("title", { children: "eye-hide-line" }), (0, jsx_runtime_1.jsx)("path", { d: "M25.19,20.4A6.78,6.78,0,0,0,25.62,18a6.86,6.86,0,0,0-6.86-6.86,6.79,6.79,0,0,0-2.37.43L18,13.23a4.78,4.78,0,0,1,.74-.06A4.87,4.87,0,0,1,23.62,18a4.79,4.79,0,0,1-.06.74Z", className: "clr-i-outline clr-i-outline-path-1" }), (0, jsx_runtime_1.jsx)("path", { d: "M34.29,17.53c-3.37-6.23-9.28-10-15.82-10a16.82,16.82,0,0,0-5.24.85L14.84,10a14.78,14.78,0,0,1,3.63-.47c5.63,0,10.75,3.14,13.8,8.43a17.75,17.75,0,0,1-4.37,5.1l1.42,1.42a19.93,19.93,0,0,0,5-6l.26-.48Z", className: "clr-i-outline clr-i-outline-path-2" }), (0, jsx_runtime_1.jsx)("path", { d: "M4.87,5.78l4.46,4.46a19.52,19.52,0,0,0-6.69,7.29L2.38,18l.26.48c3.37,6.23,9.28,10,15.82,10a16.93,16.93,0,0,0,7.37-1.69l5,5,1.75-1.5-26-26Zm9.75,9.75,6.65,6.65a4.81,4.81,0,0,1-2.5.72A4.87,4.87,0,0,1,13.9,18,4.81,4.81,0,0,1,14.62,15.53Zm-1.45-1.45a6.85,6.85,0,0,0,9.55,9.55l1.6,1.6a14.91,14.91,0,0,1-5.86,1.2c-5.63,0-10.75-3.14-13.8-8.43a17.29,17.29,0,0,1,6.12-6.3Z", className: "clr-i-outline clr-i-outline-path-3" }), (0, jsx_runtime_1.jsx)("rect", { x: 0, y: 0, width: 36, height: 36, fillOpacity: 0 })] }));
|
|
6
|
+
exports.HideIcon = HideIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRowComponent.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/Components/TableRowComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableRowComponent.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/Components/TableRowComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAO3D,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,UAAU,CAAC;AAG5D,KAAK,sBAAsB,CAAC,CAAC,IAAI;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC/B,UAAU,EAAE,WAAW,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAG,sHAWnC,sBAAsB,CAAC,CAAC,CAAC,4CAmV3B,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TableRowComponent = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/* eslint-disable sonarjs/function-return-type */
|
|
5
6
|
const material_1 = require("@mui/material");
|
|
6
7
|
const react_1 = require("react");
|
|
7
8
|
const Button_1 = require("../../Button");
|
|
@@ -91,14 +92,43 @@ const TableRowComponent = ({ columnWidths, exportActions, exportData, grouping =
|
|
|
91
92
|
if (cell.column.id === "grouped_by") {
|
|
92
93
|
return true;
|
|
93
94
|
}
|
|
95
|
+
// Keep the grouped cell for grouped rows (this shows the expand/collapse and group label)
|
|
96
|
+
if (cell.getIsGrouped()) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
94
99
|
// Filter out grouping columns - check both if cell is grouped AND if column ID is in grouping array
|
|
95
100
|
const columnId = cell.column.id;
|
|
96
101
|
const accessorKey = cell.column.columnDef?.accessorKey;
|
|
97
102
|
const isGroupingColumn = grouping.includes(columnId) ||
|
|
98
103
|
(accessorKey && grouping.includes(accessorKey));
|
|
99
|
-
return !isGroupingColumn
|
|
104
|
+
return !isGroupingColumn;
|
|
100
105
|
})
|
|
101
106
|
: visibleCells;
|
|
107
|
+
// Check if this is a grouped row (has grouping header)
|
|
108
|
+
const isGroupedRow = row.getIsGrouped();
|
|
109
|
+
// For grouped rows, render a single cell that spans all columns
|
|
110
|
+
if (isGroupedRow && cellsToRender.length > 0) {
|
|
111
|
+
const groupedCell = cellsToRender.find((c) => c.getIsGrouped());
|
|
112
|
+
if (groupedCell) {
|
|
113
|
+
return ((0, jsx_runtime_1.jsx)("td", { colSpan: cellsToRender.length, style: {
|
|
114
|
+
boxSizing: "border-box",
|
|
115
|
+
lineHeight: "21px",
|
|
116
|
+
overflow: "hidden",
|
|
117
|
+
padding: "0px 8px",
|
|
118
|
+
position: "relative",
|
|
119
|
+
textAlign: "left",
|
|
120
|
+
width: "100%",
|
|
121
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
color: iron[400],
|
|
124
|
+
display: "flex",
|
|
125
|
+
fontFamily: "Poppins",
|
|
126
|
+
fontSize: "13px",
|
|
127
|
+
height: rowHeight,
|
|
128
|
+
justifyContent: "flex-start",
|
|
129
|
+
}, children: (0, jsx_runtime_1.jsx)(CellRenderer_1.CellRenderer, { cell: groupedCell, row: row, isSummaryRow: isSummaryRow, summaryData: summaryData, isGroupColumn: false }) }) }, groupedCell.id));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
102
132
|
return cellsToRender.map((cell, cellIndex, allCells) => {
|
|
103
133
|
const width = columnWidths[cellIndex] ?? cell.column.getSize();
|
|
104
134
|
const pinStyle = getPinStyle(cell, cellIndex, allCells);
|
|
@@ -127,6 +157,19 @@ const TableRowComponent = ({ columnWidths, exportActions, exportData, grouping =
|
|
|
127
157
|
? butterflyBlue[600]
|
|
128
158
|
: getRowBackgroundColor()
|
|
129
159
|
: cellBackgroundColor;
|
|
160
|
+
// Get alignment from column definition
|
|
161
|
+
const columnDef = cell.column.columnDef;
|
|
162
|
+
const textAlign = columnDef.align ?? "left";
|
|
163
|
+
let justifyContent;
|
|
164
|
+
if (textAlign === "right") {
|
|
165
|
+
justifyContent = "flex-end";
|
|
166
|
+
}
|
|
167
|
+
else if (textAlign === "center") {
|
|
168
|
+
justifyContent = "center";
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
justifyContent = "flex-start";
|
|
172
|
+
}
|
|
130
173
|
return ((0, jsx_runtime_1.jsx)("td", { onMouseDown: handleMouseDown, onMouseEnter: handleMouseEnter, style: {
|
|
131
174
|
animation: cellAnimation,
|
|
132
175
|
backgroundColor: finalBackgroundColor,
|
|
@@ -138,6 +181,7 @@ const TableRowComponent = ({ columnWidths, exportActions, exportData, grouping =
|
|
|
138
181
|
overflow: "hidden",
|
|
139
182
|
padding: "0px 8px",
|
|
140
183
|
position: "relative",
|
|
184
|
+
textAlign,
|
|
141
185
|
textOverflow: "ellipsis",
|
|
142
186
|
textWrap: "nowrap",
|
|
143
187
|
userSelect: cellSelectionEnabled ? "none" : "auto",
|
|
@@ -148,9 +192,10 @@ const TableRowComponent = ({ columnWidths, exportActions, exportData, grouping =
|
|
|
148
192
|
color: iron[400],
|
|
149
193
|
display: "flex",
|
|
150
194
|
fontFamily: "Poppins",
|
|
151
|
-
fontSize: "
|
|
195
|
+
fontSize: "13px",
|
|
152
196
|
fontWeight: isSummaryRow ? "500" : 400,
|
|
153
197
|
height: rowHeight,
|
|
198
|
+
justifyContent,
|
|
154
199
|
overflow: "hidden",
|
|
155
200
|
textOverflow: "ellipsis",
|
|
156
201
|
}, children: (0, jsx_runtime_1.jsx)(CellRenderer_1.CellRenderer, { cell: cell, row: row, isSummaryRow: isSummaryRow, summaryData: summaryData, isGroupColumn: cell.column.id === "grouped_by" }) }) }, cell.id));
|
|
@@ -171,7 +216,7 @@ const TableRowComponent = ({ columnWidths, exportActions, exportData, grouping =
|
|
|
171
216
|
}, children: exportActions?.map((item) => {
|
|
172
217
|
return ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: item.onClick, variant: "text", style: {
|
|
173
218
|
borderBottom: `1px solid ${iron[700]}`,
|
|
174
|
-
fontSize: "
|
|
219
|
+
fontSize: "13px",
|
|
175
220
|
padding: 0,
|
|
176
221
|
}, disableRipple: true, children: item.label }, item.label));
|
|
177
222
|
}) }))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartGrid.d.ts","sourceRoot":"","sources":["../../src/SmartGrid/SmartGrid.tsx"],"names":[],"mappings":"AAKA,OAAO,KAQN,MAAM,OAAO,CAAC;AAiBf,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"SmartGrid.d.ts","sourceRoot":"","sources":["../../src/SmartGrid/SmartGrid.tsx"],"names":[],"mappings":"AAKA,OAAO,KAQN,MAAM,OAAO,CAAC;AAiBf,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,SAAS,CAAC;AAoCjB,KAAK,aAAa,GAAG,KAAK,CAAC,yBAAyB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GAC3E,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAErE,eAAO,MAAM,SAAS,EA6uBjB,aAAa,CAAC"}
|
|
@@ -27,6 +27,8 @@ const GroupedPanel_1 = require("./Components/Grouped/GroupedPanel");
|
|
|
27
27
|
const DraggableHeaderCell_1 = require("./Components/HeaderCells/DraggableHeaderCell");
|
|
28
28
|
const GroupAreaOverlay_1 = require("./Components/Grouped/GroupAreaOverlay");
|
|
29
29
|
const sortable_1 = require("@dnd-kit/sortable");
|
|
30
|
+
const iconoir_react_1 = require("iconoir-react");
|
|
31
|
+
const ColumnArrangerDialog_1 = require("./Components/ColumnChooser/ColumnArrangerDialog");
|
|
30
32
|
const calculateGroupSummary = (groupRow, globalSummary, dynamicSummaryConfig) => {
|
|
31
33
|
const { subRows } = groupRow;
|
|
32
34
|
if (dynamicSummaryConfig && subRows) {
|
|
@@ -35,17 +37,51 @@ const calculateGroupSummary = (groupRow, globalSummary, dynamicSummaryConfig) =>
|
|
|
35
37
|
}
|
|
36
38
|
return globalSummary ? globalSummary : {};
|
|
37
39
|
};
|
|
38
|
-
exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], dynamicRowSelection = () => true, emptyMessage = "No data found", enableCellSelection = false, exportActions = [], exportData = false, height = "calc(100vh - 130px)", loading = false, rowHeight = 38, rowSelection = false, swipeableColumns = false, totalCount = 0, ...props }, ref) => {
|
|
40
|
+
exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], dynamicRowSelection = () => true, emptyMessage = "No data found", enableCellSelection = false, exportActions = [], exportData = false, height = "calc(100vh - 130px)", loading = false, rowHeight = 38, rowSelection = false, swipeableColumns = false, columnArranger = false, totalCount = 0, onApplyColumnArranger, ...props }, ref) => {
|
|
39
41
|
const theme = (0, material_1.useTheme)();
|
|
40
42
|
const { butterflyBlue } = theme.palette.app.color;
|
|
41
43
|
const [resetAllFilters, setResetAllFilters] = (0, react_1.useState)(false);
|
|
42
44
|
const [activeDragId, setActiveDragId] = (0, react_1.useState)(null);
|
|
43
45
|
const [activeDragOver, setActiveDragOver] = (0, react_1.useState)(null);
|
|
46
|
+
const [isOutsideGrid, setIsOutsideGrid] = (0, react_1.useState)(false);
|
|
47
|
+
const gridContainerRef = (0, react_1.useRef)(null);
|
|
48
|
+
const [showColumnChooser, setShowColumnChooser] = (0, react_1.useState)(false);
|
|
44
49
|
const containerRef = (0, react_1.useRef)(null);
|
|
45
50
|
const headerRef = (0, react_1.useRef)(null);
|
|
46
51
|
const { columns: propsColumns, data, dynamicSummaryConfig, summary, } = props;
|
|
52
|
+
// Internal state to track hidden columns (by columnId or accessorKey)
|
|
53
|
+
const [hiddenColumnIds, setHiddenColumnIds] = (0, react_1.useState)(new Set());
|
|
54
|
+
// Filter out columns where hide is true (default hide is false) or internally hidden
|
|
55
|
+
const visibleColumns = (0, react_1.useMemo)(() => {
|
|
56
|
+
return propsColumns.filter((col) => {
|
|
57
|
+
const appCol = col;
|
|
58
|
+
const colId = appCol.id ?? appCol.accessorKey;
|
|
59
|
+
// Check if column is hidden via prop or internal state
|
|
60
|
+
return appCol.hide !== true && !hiddenColumnIds.has(colId);
|
|
61
|
+
});
|
|
62
|
+
}, [propsColumns, hiddenColumnIds]);
|
|
63
|
+
// Internal handler to hide column when dragged outside grid
|
|
64
|
+
const handleInternalColumnHide = (columnId) => {
|
|
65
|
+
setHiddenColumnIds((prev) => {
|
|
66
|
+
const newSet = new Set(prev);
|
|
67
|
+
newSet.add(columnId);
|
|
68
|
+
return newSet;
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
// Columns with internal hidden state applied (for ColumnArrangerDialog)
|
|
72
|
+
const columnsWithHiddenState = (0, react_1.useMemo)(() => {
|
|
73
|
+
return propsColumns.map((col) => {
|
|
74
|
+
const appCol = col;
|
|
75
|
+
const colId = appCol.id ?? appCol.accessorKey;
|
|
76
|
+
// If column is internally hidden, mark it as hide: true
|
|
77
|
+
if (hiddenColumnIds.has(colId)) {
|
|
78
|
+
return { ...appCol, hide: true };
|
|
79
|
+
}
|
|
80
|
+
return appCol;
|
|
81
|
+
});
|
|
82
|
+
}, [propsColumns, hiddenColumnIds]);
|
|
47
83
|
const { columns } = (0, useGetRowSelection_1.useGetRowSelection)({
|
|
48
|
-
defaultColumn:
|
|
84
|
+
defaultColumn: visibleColumns,
|
|
49
85
|
dynamicRowSelection,
|
|
50
86
|
rowSelection,
|
|
51
87
|
});
|
|
@@ -111,7 +147,7 @@ exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], dynamicRowS
|
|
|
111
147
|
overscan: 20,
|
|
112
148
|
});
|
|
113
149
|
const { columnWidths } = (0, useGetColumnWidth_1.useGetColumnWidth)({
|
|
114
|
-
columns:
|
|
150
|
+
columns: visibleColumns,
|
|
115
151
|
headerRef,
|
|
116
152
|
table,
|
|
117
153
|
});
|
|
@@ -130,6 +166,51 @@ exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], dynamicRowS
|
|
|
130
166
|
notifyParentRef.current();
|
|
131
167
|
}
|
|
132
168
|
}, [table.getSelectedRowModel().rows]);
|
|
169
|
+
// Prevent scrolling during drag
|
|
170
|
+
(0, react_1.useEffect)(() => {
|
|
171
|
+
if (!activeDragId || !containerRef.current) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const container = containerRef.current;
|
|
175
|
+
// Store current scroll position when drag starts
|
|
176
|
+
const scrollTop = container.scrollTop;
|
|
177
|
+
const scrollLeft = container.scrollLeft;
|
|
178
|
+
// Prevent scroll events during drag
|
|
179
|
+
const preventScroll = (e) => {
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
e.stopPropagation();
|
|
182
|
+
// Lock scroll position
|
|
183
|
+
container.scrollTop = scrollTop;
|
|
184
|
+
container.scrollLeft = scrollLeft;
|
|
185
|
+
};
|
|
186
|
+
// Prevent wheel events (mouse wheel scrolling)
|
|
187
|
+
const preventWheel = (e) => {
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
e.stopPropagation();
|
|
190
|
+
};
|
|
191
|
+
// Use capture phase to catch events early
|
|
192
|
+
container.addEventListener("scroll", preventScroll, {
|
|
193
|
+
passive: false,
|
|
194
|
+
capture: true,
|
|
195
|
+
});
|
|
196
|
+
container.addEventListener("wheel", preventWheel, {
|
|
197
|
+
passive: false,
|
|
198
|
+
capture: true,
|
|
199
|
+
});
|
|
200
|
+
container.addEventListener("touchmove", preventScroll, {
|
|
201
|
+
passive: false,
|
|
202
|
+
capture: true,
|
|
203
|
+
});
|
|
204
|
+
return () => {
|
|
205
|
+
container.removeEventListener("scroll", preventScroll, {
|
|
206
|
+
capture: true,
|
|
207
|
+
});
|
|
208
|
+
container.removeEventListener("wheel", preventWheel, { capture: true });
|
|
209
|
+
container.removeEventListener("touchmove", preventScroll, {
|
|
210
|
+
capture: true,
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
}, [activeDragId]);
|
|
133
214
|
const enableSecondRowFilter = (0, react_1.useMemo)(() => {
|
|
134
215
|
return getHeaderGroups().some((headerGroup) => headerGroup.headers.some((header) => {
|
|
135
216
|
const columnDef = header.column.columnDef;
|
|
@@ -181,10 +262,10 @@ exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], dynamicRowS
|
|
|
181
262
|
propsColumns,
|
|
182
263
|
defaultGrouping,
|
|
183
264
|
});
|
|
184
|
-
return ((0, jsx_runtime_1.jsxs)(CellSelectionContext_1.CellSelectionProvider, { value: {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
265
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(CellSelectionContext_1.CellSelectionProvider, { value: {
|
|
266
|
+
...cellSelection,
|
|
267
|
+
enabled: enableCellSelection,
|
|
268
|
+
}, children: [(0, jsx_runtime_1.jsx)("style", { children: `
|
|
188
269
|
@keyframes copyFlash {
|
|
189
270
|
0% {
|
|
190
271
|
background-color: ${butterflyBlue[700]};
|
|
@@ -196,69 +277,139 @@ exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], dynamicRowS
|
|
|
196
277
|
background-color: ${butterflyBlue[700]};
|
|
197
278
|
}
|
|
198
279
|
}
|
|
199
|
-
` }), (0, jsx_runtime_1.jsxs)(core_1.DndContext, { sensors: sensors, collisionDetection: customCollisionDetection, onDragStart:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
280
|
+
` }), (0, jsx_runtime_1.jsxs)(core_1.DndContext, { sensors: sensors, collisionDetection: customCollisionDetection, onDragStart: (event) => {
|
|
281
|
+
handleDragStart(event);
|
|
282
|
+
setIsOutsideGrid(false);
|
|
283
|
+
}, onDragEnd: (event) => {
|
|
284
|
+
// Check if dropped outside grid and should hide the column
|
|
285
|
+
if (isOutsideGrid && activeDragId) {
|
|
286
|
+
const groupingArray = currentGrouping;
|
|
287
|
+
const isGroupedChip = groupingArray.includes(activeDragId);
|
|
288
|
+
// Only hide column headers, not grouped chips
|
|
289
|
+
if (!isGroupedChip) {
|
|
290
|
+
handleInternalColumnHide(activeDragId);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
handleDragEnd(event);
|
|
294
|
+
setIsOutsideGrid(false);
|
|
295
|
+
}, onDragMove: (event) => {
|
|
296
|
+
// Check if drag is outside the grid container
|
|
297
|
+
if (gridContainerRef.current && event.active) {
|
|
298
|
+
const gridRect = gridContainerRef.current.getBoundingClientRect();
|
|
299
|
+
const pointerX = event.activatorEvent.clientX +
|
|
300
|
+
(event.delta?.x ?? 0);
|
|
301
|
+
const pointerY = event.activatorEvent.clientY +
|
|
302
|
+
(event.delta?.y ?? 0);
|
|
303
|
+
const isOutside = pointerX < gridRect.left ||
|
|
304
|
+
pointerX > gridRect.right ||
|
|
305
|
+
pointerY < gridRect.top ||
|
|
306
|
+
pointerY > gridRect.bottom;
|
|
307
|
+
// Don't show hide icon when over grouping panel
|
|
308
|
+
const isOverGroupPanel = event.over?.id === "grouping-panel";
|
|
309
|
+
setIsOutsideGrid(isOutside && !isOverGroupPanel);
|
|
310
|
+
}
|
|
311
|
+
}, onDragOver: (event) => {
|
|
312
|
+
setActiveDragOver(event.over ? String(event.over.id) : null);
|
|
313
|
+
}, onDragCancel: () => {
|
|
314
|
+
setActiveDragOver(null);
|
|
315
|
+
setActiveDragId(null);
|
|
316
|
+
setIsOutsideGrid(false);
|
|
317
|
+
}, children: [(0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: allDraggableIds, children: (0, jsx_runtime_1.jsxs)("div", { ref: gridContainerRef, style: {
|
|
318
|
+
display: "flex",
|
|
319
|
+
flexDirection: "column",
|
|
320
|
+
height: height || "calc(100vh - 100px)",
|
|
214
321
|
position: "relative",
|
|
215
|
-
}, children: (0, jsx_runtime_1.jsxs)("
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
322
|
+
}, onMouseUp: endCellSelection, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
323
|
+
display: "flex",
|
|
324
|
+
gap: 10,
|
|
325
|
+
justifyContent: "center",
|
|
326
|
+
alignItems: "center",
|
|
327
|
+
backgroundColor: "white",
|
|
328
|
+
}, children: [hasGroupableColumns && ((0, jsx_runtime_1.jsx)(GroupedPanel_1.GroupedPanel, { groupedColumns: currentGrouping, onRemoveGroup: handleRemoveGroup, table: table, defaultGrouping: defaultGrouping })), columnArranger && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
329
|
+
cursor: "pointer",
|
|
330
|
+
display: "flex",
|
|
331
|
+
alignItems: "center",
|
|
332
|
+
justifyContent: "center",
|
|
333
|
+
borderRadius: "5px",
|
|
334
|
+
border: "1px solid",
|
|
335
|
+
width: "25px",
|
|
336
|
+
height: "25px",
|
|
337
|
+
marginRight: "10px",
|
|
338
|
+
}, children: (0, jsx_runtime_1.jsx)(iconoir_react_1.ReportColumns, { width: 20, height: 20, onClick: () => {
|
|
339
|
+
setShowColumnChooser(true);
|
|
340
|
+
} }) }))] }), (0, jsx_runtime_1.jsx)("div", { ref: containerRef, style: {
|
|
341
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
342
|
+
flexGrow: 1,
|
|
343
|
+
height: "100%",
|
|
344
|
+
overflow: activeDragId ? "hidden" : "auto",
|
|
345
|
+
position: "relative",
|
|
346
|
+
pointerEvents: activeDragId ? "none" : "auto",
|
|
347
|
+
touchAction: activeDragId ? "none" : "auto",
|
|
348
|
+
}, children: (0, jsx_runtime_1.jsxs)("table", { style: {
|
|
349
|
+
borderCollapse: "separate",
|
|
350
|
+
borderSpacing: 0,
|
|
351
|
+
fontFamily: "arial, sans-serif",
|
|
352
|
+
minHeight: "100%",
|
|
353
|
+
tableLayout: "fixed",
|
|
354
|
+
width: "100%",
|
|
355
|
+
}, children: [(0, jsx_runtime_1.jsx)("thead", { ref: headerRef, style: {
|
|
356
|
+
position: "sticky",
|
|
357
|
+
top: 0,
|
|
358
|
+
zIndex: 10,
|
|
359
|
+
}, children: swipeableColumns ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: headerGroups.map((headerGroup) => {
|
|
360
|
+
const filteredHeaderGroup = {
|
|
361
|
+
...headerGroup,
|
|
362
|
+
headers: filterHeaders(headerGroup.headers, currentGrouping),
|
|
363
|
+
};
|
|
364
|
+
return ((0, jsx_runtime_1.jsx)(DraggableHeaderGroupRows_1.DraggableHeaderGroupRows, { defaultGrouping: defaultGrouping, enableSecondRowFilter: enableSecondRowFilter, headerGroup: filteredHeaderGroup, isHeaderReorderable: isHeaderReorderable, loading: loading, resetAllFilters: resetAllFilters, swipeableColumns: swipeableColumns }, headerGroup.id));
|
|
365
|
+
}) })) : (headerGroups.map((headerGroup) => {
|
|
366
|
+
const allHeaders = filterHeaders(headerGroup.headers, currentGrouping);
|
|
367
|
+
const leftPinnedHeaders = allHeaders.filter((h) => h.column.getIsPinned() === "left");
|
|
368
|
+
const centerHeaders = allHeaders.filter((h) => !h.column.getIsPinned());
|
|
369
|
+
const rightPinnedHeaders = allHeaders.filter((h) => h.column.getIsPinned() === "right");
|
|
370
|
+
// Helper to check if header can be grouped and should be draggable
|
|
371
|
+
// Only columns with enableGrouping: true should be draggable to group area
|
|
372
|
+
const isGroupable = (header) => {
|
|
373
|
+
const columnDef = header.column
|
|
374
|
+
.columnDef;
|
|
375
|
+
return columnDef.enableGrouping === true;
|
|
376
|
+
};
|
|
377
|
+
const headerRow = ((0, jsx_runtime_1.jsxs)("tr", { children: [leftPinnedHeaders.map((header) => ((0, jsx_runtime_1.jsx)(HeaderCell_1.HeaderCell, { defaultGrouping: defaultGrouping, header: header, loading: loading, resetAllFilters: resetAllFilters }, header.id))), centerHeaders.map((header) => {
|
|
378
|
+
// Make groupable headers draggable so they can be dragged to grouping panel
|
|
379
|
+
const canGroup = isGroupable(header);
|
|
380
|
+
return canGroup ? ((0, jsx_runtime_1.jsx)(DraggableHeaderCell_1.DraggableHeaderCell, { defaultGrouping: defaultGrouping, header: header, loading: loading, resetAllFilters: resetAllFilters }, header.id)) : ((0, jsx_runtime_1.jsx)(HeaderCell_1.HeaderCell, { defaultGrouping: defaultGrouping, header: header, loading: loading, resetAllFilters: resetAllFilters }, header.id));
|
|
381
|
+
}), rightPinnedHeaders.map((header) => ((0, jsx_runtime_1.jsx)(HeaderCell_1.HeaderCell, { defaultGrouping: defaultGrouping, header: header, loading: loading, resetAllFilters: resetAllFilters }, header.id)))] }, `${headerGroup.id}-row`));
|
|
382
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [headerRow, enableSecondRowFilter && !loading && ((0, jsx_runtime_1.jsx)("tr", { children: allHeaders.map((header) => ((0, jsx_runtime_1.jsx)(SearchFilterRow_1.SearchFilterRow, { header: header, resetAllFilters: resetAllFilters }, header.id))) }))] }, headerGroup.id));
|
|
383
|
+
})) }), (0, jsx_runtime_1.jsx)("tbody", { style: {
|
|
384
|
+
filter: loading ? "blur(2px)" : "none",
|
|
385
|
+
height: `${rowVirtualizer.getTotalSize()}px`,
|
|
386
|
+
position: "relative",
|
|
387
|
+
transition: "filter 0.2s ease-in-out",
|
|
388
|
+
}, children: rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
389
|
+
const enhancedRow = enhancedRows[virtualRow.index];
|
|
390
|
+
if (!enhancedRow) {
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
const { groupId, isSummary, row, summaryData } = enhancedRow;
|
|
394
|
+
return ((0, jsx_runtime_1.jsx)(TableRowComponent_1.TableRowComponent, { columnWidths: columnWidths, row: row, index: virtualRow.index, virtualRow: virtualRow, rowHeight: rowHeight, isSummaryRow: isSummary, summaryData: summaryData, exportData: exportData, exportActions: exportActions, grouping: currentGrouping }, `table-row-${virtualRow.index}-${isSummary ? "summary" : "normal"}-${groupId}`));
|
|
395
|
+
}) }), !loading && summary && ((0, jsx_runtime_1.jsx)(TableFooterComponent_1.TableFooterComponent, { table: table, summary: summary }))] }) }), rowSelection && getSelectedRowModel().rows.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { style: { fontSize: "14px" }, children: ["Selected Rows: ", getSelectedRowModel().rows.length] })), (0, jsx_runtime_1.jsx)(FilterStatusPanel_1.FilterStatusPanel, { table: table, clearAllFilters: clearAllFilters }), loading && (0, jsx_runtime_1.jsx)(CircularLoader_1.CircularLoader, {}), !rows.length && !loading && ((0, jsx_runtime_1.jsx)(DataNotFound_1.DataNotFound, { message: emptyMessage }))] }) }), (0, jsx_runtime_1.jsx)(GroupAreaOverlay_1.GroupAreaOverlay, { activeDragId: activeDragId, activeDragOver: activeDragOver, table: table, defaultGrouping: defaultGrouping, isOutsideGrid: isOutsideGrid, currentGrouping: currentGrouping })] })] }), columnArranger && ((0, jsx_runtime_1.jsx)(ColumnArrangerDialog_1.ColumnArrangerDialog, { open: showColumnChooser, onClose: () => {
|
|
396
|
+
setShowColumnChooser(false);
|
|
397
|
+
}, columns: columnsWithHiddenState, grouping: currentGrouping, onSave: (savedColumns) => {
|
|
398
|
+
// Sync internal hidden state with saved columns
|
|
399
|
+
// Note: In the form, hide is inverted (hide: true means visible, hide: false means hidden)
|
|
400
|
+
// So we need to add columns where hide is FALSE (meaning they should be hidden)
|
|
401
|
+
setHiddenColumnIds(() => {
|
|
402
|
+
const newHiddenIds = new Set();
|
|
403
|
+
Object.entries(savedColumns).forEach(([colId, colConfig]) => {
|
|
404
|
+
// hide: false in saved result means column should be hidden
|
|
405
|
+
if (!colConfig.hide) {
|
|
406
|
+
newHiddenIds.add(colId);
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
return newHiddenIds;
|
|
410
|
+
});
|
|
411
|
+
onApplyColumnArranger?.(savedColumns);
|
|
412
|
+
setShowColumnChooser(false);
|
|
413
|
+
} }))] }));
|
|
263
414
|
});
|
|
264
415
|
exports.SmartGrid.displayName = "SmartGrid";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Table } from "@tanstack/react-table";
|
|
2
|
+
import { type RefObject } from "react";
|
|
2
3
|
import type { AppColumnDef } from "../types";
|
|
3
4
|
type UseGetColumnWidthProps<T> = {
|
|
4
5
|
columns: AppColumnDef<T>[];
|
|
5
|
-
headerRef:
|
|
6
|
+
headerRef: RefObject<HTMLTableSectionElement>;
|
|
6
7
|
table: Table<T>;
|
|
7
8
|
};
|
|
8
9
|
export declare const useGetColumnWidth: <T>({ columns, headerRef, table, }: UseGetColumnWidthProps<T>) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetColumnWidth.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetColumnWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useGetColumnWidth.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetColumnWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,sBAAsB,CAAC,CAAC,IAAI;IAC/B,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAC9C,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,gCAIlC,sBAAsB,CAAC,CAAC,CAAC;;CA4E3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetGroupedColumn.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetGroupedColumn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,YAAY,EACb,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAItE,KAAK,wBAAwB,CAAC,CAAC,IAAI;IACjC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,mBAAmB,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD,aAAa,EAAE,CACb,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAC7B,QAAQ,EAAE,MAAM,EAAE,KACf,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;IAC1B,mBAAmB,EAAE,CACnB,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,EAC1B,gBAAgB,EAAE,OAAO,KACtB,OAAO,CAAC;IACb,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAE,wJAUpC,wBAAwB,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"useGetGroupedColumn.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetGroupedColumn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,YAAY,EACb,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAItE,KAAK,wBAAwB,CAAC,CAAC,IAAI;IACjC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,mBAAmB,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD,aAAa,EAAE,CACb,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAC7B,QAAQ,EAAE,MAAM,EAAE,KACf,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;IAC1B,mBAAmB,EAAE,CACnB,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,EAC1B,gBAAgB,EAAE,OAAO,KACtB,OAAO,CAAC;IACb,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAE,wJAUpC,wBAAwB,CAAC,CAAC,CAAC;2BAmFlB,YAAY;6BANsB,cAAc;kCAtE7C,MAAM;;;;CAiPpB,CAAC"}
|
|
@@ -40,6 +40,10 @@ const useGetGroupedColumn = ({ table, swipeableColumns, setActiveDragId, current
|
|
|
40
40
|
if (isAlreadyGrouped) {
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
|
+
const MAX_GROUPING_COLUMNS = 4;
|
|
44
|
+
if (groupingArray.length >= MAX_GROUPING_COLUMNS) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
43
47
|
const groupingId = accessorKey ?? activeId;
|
|
44
48
|
setGrouping([...groupingArray, groupingId]);
|
|
45
49
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableState.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useTableState.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"useTableState.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useTableState.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,OAAO,cAAc,CAAC,CAAC,CAAC;;CAmJxD,CAAC"}
|
|
@@ -5,18 +5,12 @@ const react_table_1 = require("@tanstack/react-table");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const useGetFacetedFilter_1 = require("./useGetFacetedFilter");
|
|
7
7
|
const useGetPinningColumns_1 = require("./useGetPinningColumns");
|
|
8
|
-
const useProcessColumnsForGroupDisplay_1 = require("./useProcessColumnsForGroupDisplay");
|
|
9
8
|
const useTableState = (props) => {
|
|
10
9
|
const { columns, data } = props;
|
|
11
10
|
const [sorting, setSorting] = (0, react_1.useState)([]);
|
|
12
11
|
const [grouping, setGrouping] = (0, react_1.useState)(props.defaultGrouping ?? []);
|
|
13
|
-
// Process columns for single group column display when grouping is enabled
|
|
14
|
-
const { processedColumns: groupProcessedColumns } = (0, useProcessColumnsForGroupDisplay_1.useProcessColumnsForGroupDisplay)({
|
|
15
|
-
columns,
|
|
16
|
-
grouping: grouping,
|
|
17
|
-
});
|
|
18
12
|
const { combinedFilter, dateRangeFilter, includesSome, processedColumns } = (0, useGetFacetedFilter_1.useGetFacetedFilter)({
|
|
19
|
-
columns
|
|
13
|
+
columns,
|
|
20
14
|
});
|
|
21
15
|
const [expanded, setExpanded] = (0, react_1.useState)(true);
|
|
22
16
|
const [rowSelection, setRowSelection] = (0, react_1.useState)({});
|