@codezee/sixtify-brahma 0.2.193 → 0.2.194
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/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/index.d.ts +0 -1
- package/packages/shared-components/dist/SmartGrid/index.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/index.js +0 -1
- 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/SmartSelectField.d.ts +0 -7
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartSelectField.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartSelectField.js +0 -58
- 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/EditableFields/SmartTooltip.d.ts +0 -9
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTooltip.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTooltip.js +0 -113
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.d.ts +0 -4
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.js +0 -19
- 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/Components/index.d.ts +0 -2
- package/packages/shared-components/dist/SmartGrid/Components/index.d.ts.map +0 -1
- package/packages/shared-components/dist/SmartGrid/Components/index.js +0 -17
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codezee/sixtify-brahma",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.194",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"@types/luxon": "^3.4.2",
|
|
32
32
|
"@types/node": "^22.10.0",
|
|
33
33
|
"@types/react-date-range": "^1.4.9",
|
|
34
|
-
"@types/react-image-gallery": "^1.2.4",
|
|
35
34
|
"@types/uuid": "^10.0.0",
|
|
36
35
|
"eslint-config-prettier": "^9.1.0",
|
|
37
36
|
"eslint-import-resolver-typescript": "^4.3.4",
|
|
@@ -62,60 +61,13 @@
|
|
|
62
61
|
"@mui/material": "^5.15.20",
|
|
63
62
|
"@mui/styled-engine-sc": "6.0.0-alpha.18",
|
|
64
63
|
"@mui/x-charts": "^8.12.0",
|
|
65
|
-
"@mui/x-data-grid": "^7.6.2",
|
|
66
64
|
"@mui/x-date-pickers": "^7.8.0",
|
|
67
|
-
"@tanstack/react-query": "^5.48.0",
|
|
68
|
-
"@tanstack/react-query-devtools": "^5.48.0",
|
|
69
65
|
"@tanstack/react-table": "^8.21.3",
|
|
70
66
|
"@tanstack/react-virtual": "^3.13.12",
|
|
71
|
-
"@tiptap/core": "^3.4.4",
|
|
72
|
-
"@tiptap/extension-blockquote": "^3.4.4",
|
|
73
|
-
"@tiptap/extension-bold": "^3.4.4",
|
|
74
|
-
"@tiptap/extension-bubble-menu": "^3.4.4",
|
|
75
|
-
"@tiptap/extension-bullet-list": "^3.4.4",
|
|
76
|
-
"@tiptap/extension-code": "^3.4.4",
|
|
77
|
-
"@tiptap/extension-code-block": "^3.4.4",
|
|
78
|
-
"@tiptap/extension-color": "^3.4.4",
|
|
79
|
-
"@tiptap/extension-document": "^3.4.4",
|
|
80
|
-
"@tiptap/extension-dropcursor": "^3.4.4",
|
|
81
|
-
"@tiptap/extension-floating-menu": "^3.4.4",
|
|
82
|
-
"@tiptap/extension-font-family": "^3.4.4",
|
|
83
|
-
"@tiptap/extension-gapcursor": "^3.4.4",
|
|
84
|
-
"@tiptap/extension-hard-break": "^3.4.4",
|
|
85
|
-
"@tiptap/extension-heading": "^3.4.4",
|
|
86
|
-
"@tiptap/extension-highlight": "^3.4.4",
|
|
87
|
-
"@tiptap/extension-history": "^3.4.4",
|
|
88
|
-
"@tiptap/extension-horizontal-rule": "^3.4.4",
|
|
89
|
-
"@tiptap/extension-image": "^3.4.4",
|
|
90
|
-
"@tiptap/extension-italic": "^3.4.4",
|
|
91
|
-
"@tiptap/extension-link": "^3.4.4",
|
|
92
|
-
"@tiptap/extension-list-item": "^3.4.4",
|
|
93
|
-
"@tiptap/extension-mention": "^3.4.4",
|
|
94
|
-
"@tiptap/extension-ordered-list": "^3.4.4",
|
|
95
|
-
"@tiptap/extension-paragraph": "^3.4.4",
|
|
96
|
-
"@tiptap/extension-placeholder": "^3.4.4",
|
|
97
|
-
"@tiptap/extension-strike": "^3.4.4",
|
|
98
|
-
"@tiptap/extension-subscript": "^3.4.4",
|
|
99
|
-
"@tiptap/extension-superscript": "^3.4.4",
|
|
100
|
-
"@tiptap/extension-table": "^3.4.4",
|
|
101
|
-
"@tiptap/extension-table-cell": "^3.4.4",
|
|
102
|
-
"@tiptap/extension-table-header": "^3.4.4",
|
|
103
|
-
"@tiptap/extension-table-row": "^3.4.4",
|
|
104
|
-
"@tiptap/extension-task-item": "^3.4.4",
|
|
105
|
-
"@tiptap/extension-task-list": "^3.4.4",
|
|
106
|
-
"@tiptap/extension-text": "^3.4.4",
|
|
107
|
-
"@tiptap/extension-text-align": "^3.4.4",
|
|
108
|
-
"@tiptap/extension-text-style": "^3.4.4",
|
|
109
|
-
"@tiptap/extension-underline": "^3.4.4",
|
|
110
|
-
"@tiptap/pm": "^3.4.4",
|
|
111
|
-
"@tiptap/react": "^3.4.4",
|
|
112
|
-
"@tiptap/starter-kit": "^3.4.4",
|
|
113
|
-
"@tiptap/suggestion": "^3.4.4",
|
|
114
67
|
"@types/file-saver": "^2.0.7",
|
|
115
68
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
116
69
|
"ag-grid-community": "^34.3.1",
|
|
117
70
|
"ag-grid-react": "^34.3.1",
|
|
118
|
-
"axios": "^1.7.2",
|
|
119
71
|
"date-fns": "^4.1.0",
|
|
120
72
|
"eslint-plugin-sonarjs": "1.0.4-alpha.1",
|
|
121
73
|
"exceljs": "^4.4.0",
|
|
@@ -123,24 +75,18 @@
|
|
|
123
75
|
"file64": "1.0.1",
|
|
124
76
|
"gh-pages": "^6.3.0",
|
|
125
77
|
"html2canvas": "^1.4.1",
|
|
126
|
-
"i18next": "^23.12.1",
|
|
127
78
|
"iconoir-react": "^7.11.0",
|
|
128
|
-
"jszip": "^3.10.1",
|
|
129
79
|
"lodash": "^4.17.21",
|
|
130
80
|
"luxon": "^3.4.4",
|
|
131
|
-
"mui-tiptap": "^1.26.0",
|
|
132
81
|
"next": "^14.2.5",
|
|
133
|
-
"next-auth": "^4.24.7",
|
|
134
82
|
"react-date-range": "^2.0.1",
|
|
135
83
|
"react-i18next": "^14.1.2",
|
|
136
|
-
"react-multi-carousel": "^2.8.5",
|
|
137
84
|
"react-number-format": "^5.4.4",
|
|
138
85
|
"react-phone-input-2": "^2.15.1",
|
|
139
86
|
"react-syntax-highlighter": "^16.1.0",
|
|
140
87
|
"react-toastify": "^10.0.5",
|
|
141
88
|
"react-webcam": "7.2.0",
|
|
142
89
|
"styled-components": "^6.1.11",
|
|
143
|
-
"tippy.js": "^6.3.7",
|
|
144
90
|
"usehooks-ts": "^3.1.0",
|
|
145
91
|
"uuid": "^10.0.0",
|
|
146
92
|
"zod": "^3.23.8"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgGridSelection.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridSelection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAgGridSelection.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridSelection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,sBAAsB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI;IACtD,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,gBAAgB,EAAE,CAAC,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC;QAC5C,IAAI,EAAE,CAAC,EAAE,CAAC;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC,CAAC;IACH,cAAc,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC;CACpD,CAAC;AAEF,KAAK,wBAAwB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI;IACxD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;IACzB,kBAAkB,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACrD,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,aAAa,EAAE;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;IACF,OAAO,EAAE;QACP,IAAI,EAAE,OAAO,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,IAAI,CAAC;KAC3B,GAAG,IAAI,CAAC;CACV,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,2GAQ1D,sBAAsB,CAAC,CAAC,CAAC,KAAG,wBAAwB,CAAC,CAAC,CAucxD,CAAC"}
|
|
@@ -8,6 +8,24 @@ const useAgGridSelection = ({ gridRef, currentPageItems, totalRecords, selectedE
|
|
|
8
8
|
const originalSelectableCountRef = (0, react_1.useRef)(null);
|
|
9
9
|
const lastQueryParamsRef = (0, react_1.useRef)(null);
|
|
10
10
|
const previousTotalRecordsRef = (0, react_1.useRef)(totalRecords);
|
|
11
|
+
const previousExtraParamsRef = (0, react_1.useRef)("");
|
|
12
|
+
const currentExtraParams = (0, react_1.useMemo)(() => {
|
|
13
|
+
try {
|
|
14
|
+
return JSON.stringify(getExtraParams());
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
}, [getExtraParams]);
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
const previousExtraParams = previousExtraParamsRef.current;
|
|
22
|
+
if (previousExtraParams !== "" &&
|
|
23
|
+
currentExtraParams !== previousExtraParams) {
|
|
24
|
+
setAllDataCache(null);
|
|
25
|
+
originalSelectableCountRef.current = null;
|
|
26
|
+
}
|
|
27
|
+
previousExtraParamsRef.current = currentExtraParams;
|
|
28
|
+
}, [currentExtraParams]);
|
|
11
29
|
(0, react_1.useEffect)(() => {
|
|
12
30
|
if ((originalSelectableCountRef.current === null && totalRecords > 0) ||
|
|
13
31
|
(originalSelectableCountRef.current !== null &&
|
|
@@ -69,9 +87,12 @@ const useAgGridSelection = ({ gridRef, currentPageItems, totalRecords, selectedE
|
|
|
69
87
|
});
|
|
70
88
|
}, [currentPageItems, isRowSelectable]);
|
|
71
89
|
const deselectCurrentPage = (0, react_1.useCallback)(() => {
|
|
72
|
-
const
|
|
90
|
+
const selectableItems = isRowSelectable
|
|
91
|
+
? currentPageItems.filter((item) => isRowSelectable({ data: item }))
|
|
92
|
+
: currentPageItems;
|
|
93
|
+
const currentPageIds = new Set(selectableItems.map(({ id }) => id));
|
|
73
94
|
setSelectedIds((prev) => prev.filter((id) => !currentPageIds.has(id)));
|
|
74
|
-
}, [currentPageItems]);
|
|
95
|
+
}, [currentPageItems, isRowSelectable]);
|
|
75
96
|
const selectAll = (0, react_1.useCallback)(async (params) => {
|
|
76
97
|
const extraParams = getExtraParams();
|
|
77
98
|
const base = params ??
|
|
@@ -173,18 +194,87 @@ const useAgGridSelection = ({ gridRef, currentPageItems, totalRecords, selectedE
|
|
|
173
194
|
onButtonClick: () => void selectAll(),
|
|
174
195
|
};
|
|
175
196
|
}, [selectedRecords, displayRecordsCount, clearSelection, selectAll]);
|
|
197
|
+
const isDialogOnTop = (0, react_1.useCallback)(() => {
|
|
198
|
+
const backdrop = document.querySelector('.MuiBackdrop-root:not([style*="display: none"])');
|
|
199
|
+
if (backdrop) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
const dialogs = document.querySelectorAll('[role="dialog"], .MuiDialog-root, .MuiModal-root');
|
|
203
|
+
if (dialogs.length === 0) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
for (const dialog of Array.from(dialogs)) {
|
|
207
|
+
const dialogElement = dialog;
|
|
208
|
+
const style = window.getComputedStyle(dialogElement);
|
|
209
|
+
const isVisible = style.display !== "none" &&
|
|
210
|
+
style.visibility !== "hidden" &&
|
|
211
|
+
parseFloat(style.opacity) > 0;
|
|
212
|
+
if (isVisible) {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return false;
|
|
217
|
+
}, []);
|
|
176
218
|
const isInputFieldActive = (0, react_1.useCallback)(() => {
|
|
177
219
|
const activeElement = document.activeElement;
|
|
178
220
|
return (activeElement?.tagName === "INPUT" ||
|
|
179
221
|
activeElement?.tagName === "TEXTAREA" ||
|
|
180
222
|
activeElement?.contentEditable === "true");
|
|
181
223
|
}, []);
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
224
|
+
const isFilterFieldActive = (0, react_1.useCallback)((target) => {
|
|
225
|
+
if (!target) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
return (target.classList.contains("ag-floating-filter") ||
|
|
229
|
+
target.classList.contains("ag-text-field-input") ||
|
|
230
|
+
target.closest(".ag-floating-filter") !== null ||
|
|
231
|
+
target.closest(".ag-text-field-input") !== null);
|
|
187
232
|
}, []);
|
|
233
|
+
const isHeaderCheckboxActive = (0, react_1.useCallback)((target) => {
|
|
234
|
+
const element = target || document.activeElement;
|
|
235
|
+
return (element?.closest(".ag-header-cell") !== null ||
|
|
236
|
+
element?.closest(".ag-selection-checkbox") !== null ||
|
|
237
|
+
element?.getAttribute("role") === "columnheader");
|
|
238
|
+
}, []);
|
|
239
|
+
const handleCtrlA = (0, react_1.useCallback)((event) => {
|
|
240
|
+
if (isDialogOnTop()) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
event.preventDefault();
|
|
244
|
+
selectCurrentPage();
|
|
245
|
+
}, [selectCurrentPage, isDialogOnTop]);
|
|
246
|
+
const handleAltA = (0, react_1.useCallback)((event) => {
|
|
247
|
+
if (isDialogOnTop()) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const activeElement = document.activeElement;
|
|
251
|
+
const isInputField = activeElement?.tagName === "INPUT" ||
|
|
252
|
+
activeElement?.tagName === "TEXTAREA" ||
|
|
253
|
+
activeElement?.contentEditable === "true";
|
|
254
|
+
if (isInputField) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
event.preventDefault();
|
|
258
|
+
deselectCurrentPage();
|
|
259
|
+
}, [deselectCurrentPage, isFilterFieldActive, isDialogOnTop]);
|
|
260
|
+
const handleSpaceKey = (0, react_1.useCallback)((event) => {
|
|
261
|
+
const target = event.target;
|
|
262
|
+
if (isFilterFieldActive(target)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
event.preventDefault();
|
|
266
|
+
if (currentPageState.checked) {
|
|
267
|
+
deselectCurrentPage();
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
selectCurrentPage();
|
|
271
|
+
}
|
|
272
|
+
}, [
|
|
273
|
+
currentPageState.checked,
|
|
274
|
+
deselectCurrentPage,
|
|
275
|
+
selectCurrentPage,
|
|
276
|
+
isFilterFieldActive,
|
|
277
|
+
]);
|
|
188
278
|
(0, react_1.useEffect)(() => {
|
|
189
279
|
const handleKeyDown = (event) => {
|
|
190
280
|
if (isInputFieldActive() || !currentPageItems.length) {
|
|
@@ -192,24 +282,17 @@ const useAgGridSelection = ({ gridRef, currentPageItems, totalRecords, selectedE
|
|
|
192
282
|
}
|
|
193
283
|
const key = event.key.toLowerCase();
|
|
194
284
|
if (key === "a" && (event.ctrlKey || event.metaKey)) {
|
|
195
|
-
event
|
|
196
|
-
selectCurrentPage();
|
|
285
|
+
handleCtrlA(event);
|
|
197
286
|
return;
|
|
198
287
|
}
|
|
199
|
-
if (
|
|
200
|
-
event
|
|
201
|
-
deselectCurrentPage();
|
|
288
|
+
if (event.code === "KeyA" && event.altKey) {
|
|
289
|
+
handleAltA(event);
|
|
202
290
|
return;
|
|
203
291
|
}
|
|
204
|
-
if ((event.code === "Space" || event.key === " ") &&
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (currentPageState.checked) {
|
|
209
|
-
deselectCurrentPage();
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
selectCurrentPage();
|
|
292
|
+
if ((event.code === "Space" || event.key === " ") && gridRef.current) {
|
|
293
|
+
const target = event.target;
|
|
294
|
+
if (isHeaderCheckboxActive(target) && !isFilterFieldActive(target)) {
|
|
295
|
+
handleSpaceKey(event);
|
|
213
296
|
}
|
|
214
297
|
}
|
|
215
298
|
};
|
|
@@ -217,11 +300,12 @@ const useAgGridSelection = ({ gridRef, currentPageItems, totalRecords, selectedE
|
|
|
217
300
|
return () => document.removeEventListener("keydown", handleKeyDown, true);
|
|
218
301
|
}, [
|
|
219
302
|
currentPageItems.length,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
303
|
+
handleCtrlA,
|
|
304
|
+
handleAltA,
|
|
305
|
+
handleSpaceKey,
|
|
223
306
|
isInputFieldActive,
|
|
224
307
|
isHeaderCheckboxActive,
|
|
308
|
+
gridRef,
|
|
225
309
|
]);
|
|
226
310
|
return {
|
|
227
311
|
selectedIds,
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArranger.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Control, type UseFieldArrayReturn, type UseFormSetValue } from "react-hook-form";
|
|
2
|
+
import type { AppColumnDef } from "../../types";
|
|
3
|
+
type ColumnArrangerProps<T> = {
|
|
4
|
+
lockedColumns: AppColumnDef<T>[];
|
|
5
|
+
fields: UseFieldArrayReturn<{
|
|
6
|
+
columns: AppColumnDef<T>[];
|
|
7
|
+
}, "columns">["fields"];
|
|
8
|
+
control: Control<{
|
|
9
|
+
columns: AppColumnDef<T>[];
|
|
10
|
+
}>;
|
|
11
|
+
setValue: UseFormSetValue<{
|
|
12
|
+
columns: AppColumnDef<T>[];
|
|
13
|
+
}>;
|
|
14
|
+
filterVisibleOnly?: boolean;
|
|
15
|
+
searchTerm?: string;
|
|
16
|
+
grouping?: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare const ColumnArranger: <T>({ lockedColumns, fields, control, setValue, filterVisibleOnly, searchTerm, grouping, }: Readonly<ColumnArrangerProps<T>>) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=ColumnArranger.d.ts.map
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArranger.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnArranger.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/ColumnChooser/ColumnArranger.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAErB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,KAAK,mBAAmB,CAAC,CAAC,IAAI;IAC5B,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACjC,MAAM,EAAE,mBAAmB,CACzB;QAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;KAAE,EAC9B,SAAS,CACV,CAAC,QAAQ,CAAC,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;QAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;KAAE,CAAC,CAAC;IACjD,QAAQ,EAAE,eAAe,CAAC;QAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;KAAE,CAAC,CAAC;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,CAAC,EAAG,wFAQhC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,4CAyElC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnArranger = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
+
const LockedColumnItem_1 = require("./LockedColumnItem");
|
|
8
|
+
const ColumnItem_1 = require("./ColumnItem");
|
|
9
|
+
const ColumnArranger = ({ lockedColumns, fields, control, setValue, filterVisibleOnly = false, searchTerm = "", grouping, }) => {
|
|
10
|
+
// Watch all column hide values
|
|
11
|
+
const columnsData = (0, react_hook_form_1.useWatch)({
|
|
12
|
+
control,
|
|
13
|
+
name: "columns",
|
|
14
|
+
defaultValue: [],
|
|
15
|
+
});
|
|
16
|
+
// Filter fields based on filterVisibleOnly and searchTerm
|
|
17
|
+
const filteredFields = (0, react_1.useMemo)(() => {
|
|
18
|
+
let result = fields;
|
|
19
|
+
// Apply visibility filter
|
|
20
|
+
if (filterVisibleOnly) {
|
|
21
|
+
result = result.filter((field, index) => {
|
|
22
|
+
const columnData = columnsData[index];
|
|
23
|
+
return columnData && columnData.hide;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
// Apply search filter by label/header
|
|
27
|
+
if (searchTerm.trim()) {
|
|
28
|
+
const lowerSearchTerm = searchTerm.toLowerCase();
|
|
29
|
+
result = result.filter((field, index) => {
|
|
30
|
+
const columnData = columnsData[index];
|
|
31
|
+
const header = columnData?.header ?? field.header ?? "";
|
|
32
|
+
// Match against header/label (case-insensitive)
|
|
33
|
+
return (typeof header === "string" &&
|
|
34
|
+
header.toLowerCase().includes(lowerSearchTerm));
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}, [fields, filterVisibleOnly, searchTerm, columnsData]);
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [lockedColumns.map((column) => {
|
|
40
|
+
return (0, jsx_runtime_1.jsx)(LockedColumnItem_1.LockedColumnItem, { column: column }, column.accessorKey);
|
|
41
|
+
}), (0, jsx_runtime_1.jsxs)("div", { style: { margin: 0, padding: 0 }, children: [!filteredFields.length && ((0, jsx_runtime_1.jsx)("p", { style: { textAlign: "center", fontSize: "13px", color: "gray" }, children: "No columns to show" })), filteredFields
|
|
42
|
+
.filter((field) => !grouping?.includes(field.accessorKey ?? ""))
|
|
43
|
+
.map((field) => {
|
|
44
|
+
// Find the original index in the fields array
|
|
45
|
+
const actualIndex = fields.findIndex(({ id }) => id === field.id);
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(ColumnItem_1.ColumnItem, { field: field, control: control, index: actualIndex, setValue: setValue }, field.id));
|
|
47
|
+
})] })] }));
|
|
48
|
+
};
|
|
49
|
+
exports.ColumnArranger = ColumnArranger;
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerDialog.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AppColumnDef, SmartColumnAlignmentType } from "../../types";
|
|
2
|
+
import type { OnAction } from "../../../utils/types";
|
|
3
|
+
type ColumnArrangerDialogProps<T> = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: OnAction;
|
|
6
|
+
title?: string;
|
|
7
|
+
columns?: AppColumnDef<T>[];
|
|
8
|
+
grouping?: string[];
|
|
9
|
+
onSave: (args: Record<string, {
|
|
10
|
+
hide: boolean;
|
|
11
|
+
align: SmartColumnAlignmentType;
|
|
12
|
+
header: string;
|
|
13
|
+
}>) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const ColumnArrangerDialog: <T>({ open, onClose, title, columns, grouping, onSave, }: ColumnArrangerDialogProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=ColumnArrangerDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnArrangerDialog.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/ColumnChooser/ColumnArrangerDialog.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,KAAK,yBAAyB,CAAC,CAAC,IAAI;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,QAAQ,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,CACN,IAAI,EAAE,MAAM,CACV,MAAM,EACN;QACE,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EAAE,wBAAwB,CAAC;QAChC,MAAM,EAAE,MAAM,CAAC;KAChB,CACF,KACE,IAAI,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAG,sDAOtC,yBAAyB,CAAC,CAAC,CAAC,4CAkM9B,CAAC"}
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerDialog.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ColumnArrangerDialog = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const iconoir_react_1 = require("iconoir-react");
|
|
10
|
+
const fromPairs_1 = __importDefault(require("lodash/fromPairs"));
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
13
|
+
const ColumnArrangerForm_1 = require("./ColumnArrangerForm");
|
|
14
|
+
const useRefinedColumns_1 = require("./hooks/useRefinedColumns");
|
|
15
|
+
const DebouncedInput_1 = require("../SearchFilterRow/DebouncedInput");
|
|
16
|
+
const SmartButton_1 = require("../SmartButton");
|
|
17
|
+
const SmartDialog_1 = require("../SmartDialog");
|
|
18
|
+
const SmartSwitch_1 = require("../SmartSwitch");
|
|
19
|
+
const ColumnArrangerDialog = ({ open, onClose, title = "Column Chooser", columns = [], grouping = [], onSave, }) => {
|
|
20
|
+
const theme = (0, material_1.useTheme)();
|
|
21
|
+
const reFinedColumn = (0, useRefinedColumns_1.useRefinedColumns)({ columns });
|
|
22
|
+
const { butterflyBlue, iron } = theme.palette.app.color;
|
|
23
|
+
const [searchTerm, setSearchTerm] = (0, react_1.useState)("");
|
|
24
|
+
const { control } = (0, react_hook_form_1.useForm)({
|
|
25
|
+
defaultValues: {
|
|
26
|
+
column_list: false, // OFF = show all
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
// Watch the column_list switch value
|
|
30
|
+
const columnListFilter = (0, react_hook_form_1.useWatch)({
|
|
31
|
+
control,
|
|
32
|
+
name: "column_list",
|
|
33
|
+
defaultValue: false,
|
|
34
|
+
});
|
|
35
|
+
// Clear search term when dialog closes
|
|
36
|
+
(0, react_1.useEffect)(() => {
|
|
37
|
+
if (!open) {
|
|
38
|
+
setSearchTerm("");
|
|
39
|
+
}
|
|
40
|
+
}, [open]);
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(ColumnArrangerForm_1.ColumnArrangerForm, { columns: reFinedColumn, filterVisibleOnly: columnListFilter, searchTerm: searchTerm, grouping: grouping, children: ({ columnList, reset, getValues }) => ((0, jsx_runtime_1.jsx)(SmartDialog_1.SmartDialog, { open: open, onClose: () => {
|
|
42
|
+
setSearchTerm("");
|
|
43
|
+
reset();
|
|
44
|
+
onClose();
|
|
45
|
+
}, width: 450, actions: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
46
|
+
display: "flex",
|
|
47
|
+
justifyContent: "space-between",
|
|
48
|
+
padding: "10px 24px",
|
|
49
|
+
borderTop: `1px solid ${iron[300]}`,
|
|
50
|
+
gap: 2,
|
|
51
|
+
}, children: [(0, jsx_runtime_1.jsx)(SmartButton_1.SmartButton, { onClick: () => {
|
|
52
|
+
reset();
|
|
53
|
+
setSearchTerm("");
|
|
54
|
+
}, onMouseEnter: (e) => {
|
|
55
|
+
e.currentTarget.style.backgroundColor = "#f5f5f5";
|
|
56
|
+
}, onMouseLeave: (e) => {
|
|
57
|
+
e.currentTarget.style.backgroundColor = "white";
|
|
58
|
+
}, children: "Reset" }), (0, jsx_runtime_1.jsx)(SmartButton_1.SmartButton, { onClick: () => {
|
|
59
|
+
const values = getValues();
|
|
60
|
+
setSearchTerm("");
|
|
61
|
+
const result = (0, fromPairs_1.default)(values.columns.map((col) => {
|
|
62
|
+
return [
|
|
63
|
+
col.accessorKey,
|
|
64
|
+
{
|
|
65
|
+
hide: col.hide,
|
|
66
|
+
align: col.align ?? "left",
|
|
67
|
+
header: col.header,
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
}));
|
|
71
|
+
onSave(result);
|
|
72
|
+
onClose();
|
|
73
|
+
}, onMouseEnter: (e) => {
|
|
74
|
+
e.currentTarget.style.opacity = "0.9";
|
|
75
|
+
}, onMouseLeave: (e) => {
|
|
76
|
+
e.currentTarget.style.opacity = "1";
|
|
77
|
+
}, style: {
|
|
78
|
+
backgroundColor: butterflyBlue[900],
|
|
79
|
+
color: "white",
|
|
80
|
+
}, children: "Save" })] }), children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
81
|
+
display: "flex",
|
|
82
|
+
flexDirection: "row",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
justifyContent: "space-between",
|
|
85
|
+
padding: "5px 24px",
|
|
86
|
+
borderBottom: `1px solid ${iron[300]}`,
|
|
87
|
+
}, children: [(0, jsx_runtime_1.jsx)("p", { style: {
|
|
88
|
+
fontWeight: 500,
|
|
89
|
+
fontSize: "18px",
|
|
90
|
+
color: iron[900],
|
|
91
|
+
lineHeight: "1px",
|
|
92
|
+
}, children: title }), (0, jsx_runtime_1.jsx)(iconoir_react_1.Xmark, { width: 20, height: 20, strokeWidth: 2, onClick: () => {
|
|
93
|
+
setSearchTerm("");
|
|
94
|
+
onClose();
|
|
95
|
+
reset();
|
|
96
|
+
}, style: {
|
|
97
|
+
border: `1px solid ${iron[700]}`,
|
|
98
|
+
borderRadius: "5px",
|
|
99
|
+
color: iron[900],
|
|
100
|
+
} })] }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
101
|
+
padding: "8px 24px",
|
|
102
|
+
display: "flex",
|
|
103
|
+
flexDirection: "column",
|
|
104
|
+
gap: "12px",
|
|
105
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
106
|
+
display: "flex",
|
|
107
|
+
flexDirection: "row",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
justifyContent: "space-between",
|
|
110
|
+
}, children: [(0, jsx_runtime_1.jsx)(DebouncedInput_1.DebouncedInput, { value: searchTerm, onChange: (value) => setSearchTerm(value), placeholder: "Search by label...", debounce: 300, inputFontSize: "13px", inputHeight: "14px", style: { width: "80%" } }, open ? "dialog-open" : "dialog-closed"), (0, jsx_runtime_1.jsx)(SmartSwitch_1.SmartSwitch, { name: "column_list", control: control })] }) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
111
|
+
maxHeight: "600px",
|
|
112
|
+
minHeight: "500px",
|
|
113
|
+
overflowY: "auto",
|
|
114
|
+
outline: "none",
|
|
115
|
+
}, children: columnList })] }) })) }));
|
|
116
|
+
};
|
|
117
|
+
exports.ColumnArrangerDialog = ColumnArrangerDialog;
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerForm.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { AppColumnDef } from "../../types";
|
|
3
|
+
export type ColumnArrangerFormProps<T> = {
|
|
4
|
+
columns: AppColumnDef<T>[];
|
|
5
|
+
filterVisibleOnly?: boolean;
|
|
6
|
+
searchTerm?: string;
|
|
7
|
+
grouping?: string[];
|
|
8
|
+
children: (args: {
|
|
9
|
+
columnList: ReactNode;
|
|
10
|
+
reset: (values?: AppColumnDef<T> | Record<string, unknown>) => void;
|
|
11
|
+
getValues: () => {
|
|
12
|
+
columns: AppColumnDef<T>[];
|
|
13
|
+
};
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
export declare const ColumnArrangerForm: <T>({ columns, filterVisibleOnly, searchTerm, children, grouping, }: ColumnArrangerFormProps<T>) => JSX.Element;
|
|
17
|
+
//# sourceMappingURL=ColumnArrangerForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnArrangerForm.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/ColumnChooser/ColumnArrangerForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI;IACvC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE;QACf,UAAU,EAAE,SAAS,CAAC;QACtB,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QACpE,SAAS,EAAE,MAAM;YAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;SAAE,CAAC;KACjD,KAAK,GAAG,CAAC,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAG,iEAMpC,uBAAuB,CAAC,CAAC,CAAC,gBA+D5B,CAAC"}
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnArrangerForm.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnArrangerForm = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
+
const ColumnArranger_1 = require("./ColumnArranger");
|
|
8
|
+
const ColumnArrangerForm = ({ columns, filterVisibleOnly = false, searchTerm = "", children, grouping, }) => {
|
|
9
|
+
const lockedColumns = (0, react_1.useMemo)(() => columns.filter((col) => !("hide" in col)), [columns]);
|
|
10
|
+
const unlockedColumns = (0, react_1.useMemo)(() => columns
|
|
11
|
+
.filter((col) => "hide" in col)
|
|
12
|
+
.map((col) => ({
|
|
13
|
+
...col,
|
|
14
|
+
hide: !col.hide,
|
|
15
|
+
align: col.align ?? "left",
|
|
16
|
+
})), [columns]);
|
|
17
|
+
const { control, reset, getValues, setValue } = (0, react_hook_form_1.useForm)({
|
|
18
|
+
defaultValues: {
|
|
19
|
+
columns: unlockedColumns,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const wrappedReset = (values) => {
|
|
23
|
+
reset({
|
|
24
|
+
columns: values
|
|
25
|
+
? // eslint-disable-next-line sonarjs/no-nested-conditional
|
|
26
|
+
Array.isArray(values)
|
|
27
|
+
? values
|
|
28
|
+
: [values]
|
|
29
|
+
: unlockedColumns,
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const { fields } = (0, react_hook_form_1.useFieldArray)({
|
|
33
|
+
name: "columns",
|
|
34
|
+
control,
|
|
35
|
+
});
|
|
36
|
+
// Update form values when unlockedColumns changes (e.g., when grouping changes)
|
|
37
|
+
// Use reset to fully update the form and trigger field array re-render
|
|
38
|
+
(0, react_1.useEffect)(() => {
|
|
39
|
+
reset({ columns: unlockedColumns }, { keepDefaultValues: false });
|
|
40
|
+
}, [unlockedColumns, reset]);
|
|
41
|
+
return children({
|
|
42
|
+
reset: wrappedReset,
|
|
43
|
+
getValues,
|
|
44
|
+
columnList: ((0, jsx_runtime_1.jsx)(ColumnArranger_1.ColumnArranger, { fields: fields, lockedColumns: lockedColumns, control: control, setValue: setValue, filterVisibleOnly: filterVisibleOnly, searchTerm: searchTerm, grouping: grouping })),
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
exports.ColumnArrangerForm = ColumnArrangerForm;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Control, type FieldArrayWithId, type UseFormSetValue } from "react-hook-form";
|
|
2
|
+
import type { AppColumnDef } from "../../types";
|
|
3
|
+
export type ColumnItemProps<T> = {
|
|
4
|
+
field: FieldArrayWithId<{
|
|
5
|
+
columns: AppColumnDef<T>[];
|
|
6
|
+
}, "columns">;
|
|
7
|
+
control: Control<{
|
|
8
|
+
columns: AppColumnDef<T>[];
|
|
9
|
+
}>;
|
|
10
|
+
index: number;
|
|
11
|
+
setValue: UseFormSetValue<{
|
|
12
|
+
columns: AppColumnDef<T>[];
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
export declare function ColumnItem<T>({ field, control, index, setValue, }: Readonly<ColumnItemProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=ColumnItem.d.ts.map
|
package/packages/shared-components/dist/SmartGrid/Components/ColumnChooser/ColumnItem.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnItem.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/ColumnChooser/ColumnItem.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAErB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAC/B,KAAK,EAAE,gBAAgB,CAAC;QAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;KAAE,EAAE,SAAS,CAAC,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;QAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;KAAE,CAAC,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;QAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;KAAE,CAAC,CAAC;CAC3D,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAC5B,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,GACT,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,2CA4L9B"}
|