@elliemae/ds-data-table 3.62.1 → 3.70.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/TruncatedTooltipText.js +96 -0
- package/dist/cjs/TruncatedTooltipText.js.map +7 -0
- package/dist/cjs/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js +15 -3
- package/dist/cjs/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js.map +3 -3
- package/dist/cjs/addons/Editables/index.js.map +1 -1
- package/dist/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilter.js.map +2 -2
- package/dist/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilterV2.js.map +2 -2
- package/dist/cjs/configs/constants.js +4 -0
- package/dist/cjs/configs/constants.js.map +2 -2
- package/dist/cjs/configs/useAutocalculated/index.js +15 -1
- package/dist/cjs/configs/useAutocalculated/index.js.map +2 -2
- package/dist/cjs/configs/useStore/useStore.js +46 -0
- package/dist/cjs/configs/useStore/useStore.js.map +2 -2
- package/dist/cjs/constants/index.js +1 -0
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/exported-related/EditableCell.js +1 -1
- package/dist/cjs/exported-related/EditableCell.js.map +2 -2
- package/dist/cjs/exported-related/FilterBar/PillsFromDataTableFilters.js +2 -1
- package/dist/cjs/exported-related/FilterBar/PillsFromDataTableFilters.js.map +2 -2
- package/dist/cjs/exported-related/FilterPopover/FilterPopoverV2.js +14 -8
- package/dist/cjs/exported-related/FilterPopover/FilterPopoverV2.js.map +2 -2
- package/dist/cjs/exported-related/FilterPopover/index.js +57 -32
- package/dist/cjs/exported-related/FilterPopover/index.js.map +3 -3
- package/dist/cjs/parts/Cells/Cell.js +2 -2
- package/dist/cjs/parts/Cells/Cell.js.map +2 -2
- package/dist/cjs/parts/Cells/CellFactory.js +2 -2
- package/dist/cjs/parts/Cells/CellFactory.js.map +2 -2
- package/dist/cjs/parts/FilterBar/FiltersBar.js +2 -1
- package/dist/cjs/parts/FilterBar/FiltersBar.js.map +2 -2
- package/dist/cjs/parts/Headers/HeaderCell.js +13 -24
- package/dist/cjs/parts/Headers/HeaderCell.js.map +2 -2
- package/dist/cjs/parts/Headers/HeaderCellTitle.js +26 -6
- package/dist/cjs/parts/Headers/HeaderCellTitle.js.map +2 -2
- package/dist/cjs/parts/Headers/HeaderResizer.js +40 -18
- package/dist/cjs/parts/Headers/HeaderResizer.js.map +2 -2
- package/dist/cjs/{exported-related/FilterPopover/useOnClickOutside.js → parts/Headers/buildScreenReaderInstructions.js} +33 -30
- package/dist/cjs/parts/Headers/buildScreenReaderInstructions.js.map +7 -0
- package/dist/cjs/parts/Headers/index.js +15 -7
- package/dist/cjs/parts/Headers/index.js.map +2 -2
- package/dist/cjs/parts/Headers/useHeaderCellHandlers.js +44 -8
- package/dist/cjs/parts/Headers/useHeaderCellHandlers.js.map +2 -2
- package/dist/cjs/parts/Headers/useHeaderResizer.js +13 -3
- package/dist/cjs/parts/Headers/useHeaderResizer.js.map +2 -2
- package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js +3 -1
- package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js.map +2 -2
- package/dist/cjs/parts/VirtualRowsList.js +2 -0
- package/dist/cjs/parts/VirtualRowsList.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +12 -5
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/styled.js +55 -52
- package/dist/cjs/styled.js.map +2 -2
- package/dist/esm/TruncatedTooltipText.js +70 -0
- package/dist/esm/TruncatedTooltipText.js.map +7 -0
- package/dist/esm/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js +15 -3
- package/dist/esm/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js.map +2 -2
- package/dist/esm/addons/Editables/index.js.map +1 -1
- package/dist/esm/addons/Filters/Components/SelectFilter/BaseSelectFilter.js.map +2 -2
- package/dist/esm/addons/Filters/Components/SelectFilter/BaseSelectFilterV2.js.map +2 -2
- package/dist/esm/configs/constants.js +4 -0
- package/dist/esm/configs/constants.js.map +2 -2
- package/dist/esm/configs/useAutocalculated/index.js +15 -1
- package/dist/esm/configs/useAutocalculated/index.js.map +2 -2
- package/dist/esm/configs/useStore/useStore.js +46 -0
- package/dist/esm/configs/useStore/useStore.js.map +2 -2
- package/dist/esm/constants/index.js +1 -0
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/exported-related/EditableCell.js +1 -1
- package/dist/esm/exported-related/EditableCell.js.map +2 -2
- package/dist/esm/exported-related/FilterBar/PillsFromDataTableFilters.js +2 -1
- package/dist/esm/exported-related/FilterBar/PillsFromDataTableFilters.js.map +2 -2
- package/dist/esm/exported-related/FilterPopover/FilterPopoverV2.js +15 -9
- package/dist/esm/exported-related/FilterPopover/FilterPopoverV2.js.map +2 -2
- package/dist/esm/exported-related/FilterPopover/index.js +57 -32
- package/dist/esm/exported-related/FilterPopover/index.js.map +2 -2
- package/dist/esm/parts/Cells/Cell.js +2 -2
- package/dist/esm/parts/Cells/Cell.js.map +2 -2
- package/dist/esm/parts/Cells/CellFactory.js +2 -2
- package/dist/esm/parts/Cells/CellFactory.js.map +2 -2
- package/dist/esm/parts/FilterBar/FiltersBar.js +2 -1
- package/dist/esm/parts/FilterBar/FiltersBar.js.map +2 -2
- package/dist/esm/parts/Headers/HeaderCell.js +13 -24
- package/dist/esm/parts/Headers/HeaderCell.js.map +2 -2
- package/dist/esm/parts/Headers/HeaderCellTitle.js +26 -6
- package/dist/esm/parts/Headers/HeaderCellTitle.js.map +2 -2
- package/dist/esm/parts/Headers/HeaderResizer.js +41 -19
- package/dist/esm/parts/Headers/HeaderResizer.js.map +2 -2
- package/dist/esm/parts/Headers/buildScreenReaderInstructions.js +33 -0
- package/dist/esm/parts/Headers/buildScreenReaderInstructions.js.map +7 -0
- package/dist/esm/parts/Headers/index.js +15 -7
- package/dist/esm/parts/Headers/index.js.map +2 -2
- package/dist/esm/parts/Headers/useHeaderCellHandlers.js +44 -8
- package/dist/esm/parts/Headers/useHeaderCellHandlers.js.map +2 -2
- package/dist/esm/parts/Headers/useHeaderResizer.js +14 -4
- package/dist/esm/parts/Headers/useHeaderResizer.js.map +2 -2
- package/dist/esm/parts/HoC/withDnDSortableColumnContext.js +3 -1
- package/dist/esm/parts/HoC/withDnDSortableColumnContext.js.map +2 -2
- package/dist/esm/parts/VirtualRowsList.js +2 -0
- package/dist/esm/parts/VirtualRowsList.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +12 -5
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/styled.js +13 -10
- package/dist/esm/styled.js.map +2 -2
- package/dist/types/TruncatedTooltipText.d.ts +9 -0
- package/dist/types/addons/Editables/index.d.ts +1 -1
- package/dist/types/configs/constants.d.ts +2 -0
- package/dist/types/constants/index.d.ts +4 -0
- package/dist/types/exported-related/Skeleton/SkeletonCell.d.ts +2 -1
- package/dist/types/exported-related/Skeleton/SkeletonHeaderCell.d.ts +2 -1
- package/dist/types/parts/Headers/HeaderCellGroup.d.ts +1 -1
- package/dist/types/parts/Headers/buildScreenReaderInstructions.d.ts +19 -0
- package/dist/types/parts/Headers/useHeaderResizer.d.ts +1 -0
- package/dist/types/parts/HoC/withConditionalDnDSortableContext.d.ts +1 -1
- package/dist/types/parts/HoC/withDnDSortableColumnContext.d.ts +1 -1
- package/dist/types/parts/HoC/withDnDSortableRowContext.d.ts +1 -1
- package/dist/types/parts/Loader.d.ts +1 -1
- package/dist/types/parts/Row.d.ts +1 -1
- package/dist/types/parts/SkeletonTable.d.ts +1 -1
- package/dist/types/parts/TableContent.d.ts +2 -1
- package/dist/types/parts/VirtualRowsList.d.ts +2 -1
- package/dist/types/react-desc-prop-types.d.ts +11 -0
- package/dist/types/styled.d.ts +2 -1
- package/package.json +36 -37
- package/skills/ds-data-table-boundaries/SKILL.md +363 -0
- package/skills/ds-data-table-columns/SKILL.md +273 -0
- package/skills/ds-data-table-expandable/SKILL.md +235 -0
- package/skills/ds-data-table-feedback/SKILL.md +190 -0
- package/skills/ds-data-table-filtering/SKILL.md +322 -0
- package/skills/ds-data-table-health-check/SKILL.md +172 -0
- package/skills/ds-data-table-migration/SKILL.md +201 -0
- package/skills/ds-data-table-pagination/SKILL.md +182 -0
- package/skills/ds-data-table-row-variants/SKILL.md +260 -0
- package/skills/ds-data-table-selection/SKILL.md +449 -0
- package/skills/ds-data-table-setup/SKILL.md +229 -0
- package/skills/ds-data-table-slots/SKILL.md +265 -0
- package/dist/cjs/exported-related/FilterPopover/useOnClickOutside.js.map +0 -7
- package/dist/esm/exported-related/FilterPopover/useOnClickOutside.js +0 -30
- package/dist/esm/exported-related/FilterPopover/useOnClickOutside.js.map +0 -7
- package/dist/types/exported-related/FilterPopover/useOnClickOutside.d.ts +0 -1
- package/dist/types/tests/DSDataTable.exports.test.d.ts +0 -1
- package/dist/types/tests/a11y/aria-label-customization.test.d.ts +0 -1
- package/dist/types/tests/a11y/aria-level.test.d.ts +0 -1
- package/dist/types/tests/a11y/internally-printed-ids.A11y.test.d.ts +0 -1
- package/dist/types/tests/a11y/number-of-cells-and-columnheader.test.d.ts +0 -1
- package/dist/types/tests/a11y/out-of-the-box-filters.A11y.test.d.ts +0 -1
- package/dist/types/tests/callbacks/header.events.test.d.ts +0 -1
- package/dist/types/tests/callbacks/pagination.events.test.d.ts +0 -1
- package/dist/types/tests/callbacks/row.events.test.d.ts +0 -1
- package/dist/types/tests/data-testid/DSDataTable.data-testid.test.d.ts +0 -1
- package/dist/types/tests/data-testid/Renderers.d.ts +0 -36
- package/dist/types/tests/filters/DSDatatable.PUI-17318.test.d.ts +0 -1
- package/dist/types/tests/filters/combobox-filter.test.d.ts +0 -1
- package/dist/types/tests/filters/currency-range-filter-PUI-12735.test.d.ts +0 -1
- package/dist/types/tests/filters/free-text-search-filter.test.d.ts +0 -1
- package/dist/types/tests/keyboard/dragAndDropColumns.test.d.ts +0 -1
- package/dist/types/tests/keyboard/dragAndDropRows.test.d.ts +0 -1
- package/dist/types/tests/keyboard/expandable.test.d.ts +0 -1
- package/dist/types/tests/keyboard/grouped.test.d.ts +0 -1
- package/dist/types/tests/keyboard/masterDetails.test.d.ts +0 -1
- package/dist/types/tests/keyboard/navigation.test.d.ts +0 -1
- package/dist/types/tests/keyboard/selectMultiple.test.d.ts +0 -1
- package/dist/types/tests/keyboard/selectSingle.test.d.ts +0 -1
- package/dist/types/tests/keyboard/sort.test.d.ts +0 -1
- package/dist/types/tests/playwright/DSDataTable.ControlledFilterTestRenderer.d.ts +0 -2
- package/dist/types/tests/playwright/DSDataTable.ControlledHiddenPanelTestRenderer.d.ts +0 -1
- package/dist/types/tests/playwright/DSDataTable.ControlledSortTestRenderer.d.ts +0 -2
- package/dist/types/tests/playwright/DSDataTable.test.playwright.d.ts +0 -1
- package/dist/types/tests/playwright/GenericExampleTable.d.ts +0 -1
- package/dist/types/tests/render/empty-state.test.d.ts +0 -1
- package/dist/types/tests/render/selectMultiple.test.d.ts +0 -1
- package/dist/types/tests/render/toolbar.test.d.ts +0 -1
- package/dist/types/tests/utils/index.d.ts +0 -65
|
@@ -75,18 +75,27 @@ const useHeaderCellHandlers = ({
|
|
|
75
75
|
const visibleColumns = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.visibleColumns);
|
|
76
76
|
const setFocusedRowId = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.setFocusedRowId);
|
|
77
77
|
const patchHeader = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.patchHeader);
|
|
78
|
+
const closeFilterMenuIfOpen = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.closeFilterMenuIfOpen);
|
|
79
|
+
const resetAllHeadersExcept = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.resetAllHeadersExcept);
|
|
80
|
+
const hoveredColumnId = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.hoveredColumnId);
|
|
81
|
+
const setHoveredColumnId = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.setHoveredColumnId);
|
|
78
82
|
const reduxHeaders = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.reduxHeaders);
|
|
79
83
|
const reduxHeader = (0, import_react.useMemo)(() => reduxHeaders[column.id], [reduxHeaders, column]);
|
|
80
84
|
const headerRef = referenceColumn.current;
|
|
81
85
|
const onMouseEnter = (0, import_react.useCallback)(() => {
|
|
86
|
+
setHoveredColumnId(column.id);
|
|
82
87
|
patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));
|
|
83
|
-
}, [column.id, hasDnD, hasFilter, patchHeader, reduxHeader, hasSortingCaret]);
|
|
88
|
+
}, [column.id, hasDnD, hasFilter, patchHeader, reduxHeader, hasSortingCaret, setHoveredColumnId]);
|
|
84
89
|
const onMouseLeave = (0, import_react.useCallback)(() => {
|
|
90
|
+
setHoveredColumnId(
|
|
91
|
+
(currentHoveredColumnId) => currentHoveredColumnId === column.id ? null : currentHoveredColumnId
|
|
92
|
+
);
|
|
85
93
|
if (!headerRef?.contains(document.activeElement)) {
|
|
86
94
|
patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));
|
|
87
95
|
}
|
|
88
|
-
}, [column.id, hasDnD, hasFilter, headerRef, patchHeader, reduxHeader]);
|
|
96
|
+
}, [column.id, hasDnD, hasFilter, headerRef, patchHeader, reduxHeader, setHoveredColumnId]);
|
|
89
97
|
const handleSort = (0, import_react.useCallback)(() => {
|
|
98
|
+
closeFilterMenuIfOpen(column.id);
|
|
90
99
|
if (column.canSort) {
|
|
91
100
|
onColumnSortChange?.({
|
|
92
101
|
column: column.id,
|
|
@@ -98,7 +107,15 @@ const useHeaderCellHandlers = ({
|
|
|
98
107
|
column.isSortedDesc ? "ASC" : "DESC"
|
|
99
108
|
);
|
|
100
109
|
}
|
|
101
|
-
}, [
|
|
110
|
+
}, [
|
|
111
|
+
column.canSort,
|
|
112
|
+
column.id,
|
|
113
|
+
column.isSortedDesc,
|
|
114
|
+
onColumnSort,
|
|
115
|
+
onColumnSortChange,
|
|
116
|
+
visibleColumns,
|
|
117
|
+
closeFilterMenuIfOpen
|
|
118
|
+
]);
|
|
102
119
|
const isActive = draggableProps && draggableProps.active;
|
|
103
120
|
const onKeyDown = (0, import_react.useCallback)(
|
|
104
121
|
(e) => {
|
|
@@ -157,10 +174,12 @@ const useHeaderCellHandlers = ({
|
|
|
157
174
|
resizeHandlerRef.current
|
|
158
175
|
];
|
|
159
176
|
if (e.target === headerRef) {
|
|
177
|
+
resetAllHeadersExcept(column.id);
|
|
160
178
|
patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));
|
|
161
179
|
setFocusedRowId(null);
|
|
162
180
|
}
|
|
163
181
|
if (possibleTargets.includes(e.target)) {
|
|
182
|
+
resetAllHeadersExcept(column.id);
|
|
164
183
|
patchHeader(column.id, {
|
|
165
184
|
hideFilterButton: !hasFilter,
|
|
166
185
|
showDnDHandle: hasDnD,
|
|
@@ -177,6 +196,7 @@ const useHeaderCellHandlers = ({
|
|
|
177
196
|
hasFilter,
|
|
178
197
|
headerRef,
|
|
179
198
|
patchHeader,
|
|
199
|
+
resetAllHeadersExcept,
|
|
180
200
|
reduxHeader,
|
|
181
201
|
resizeHandlerRef,
|
|
182
202
|
setFocusedRowId,
|
|
@@ -185,13 +205,29 @@ const useHeaderCellHandlers = ({
|
|
|
185
205
|
);
|
|
186
206
|
const onBlur = (0, import_react.useCallback)(
|
|
187
207
|
(e) => {
|
|
188
|
-
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
208
|
+
const { relatedTarget } = e;
|
|
209
|
+
if (relatedTarget && relatedTarget === dragHandleRef.current) return;
|
|
210
|
+
if (relatedTarget && relatedTarget === filterIconRef.current) return;
|
|
211
|
+
if (relatedTarget && relatedTarget === resizeHandlerRef.current) return;
|
|
212
|
+
if (relatedTarget && relatedTarget === sortRef?.current) return;
|
|
213
|
+
if (hoveredColumnId === column.id) {
|
|
214
|
+
patchHeader(column.id, { withTabStops: false });
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
192
217
|
patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));
|
|
193
218
|
},
|
|
194
|
-
[
|
|
219
|
+
[
|
|
220
|
+
dragHandleRef,
|
|
221
|
+
filterIconRef,
|
|
222
|
+
resizeHandlerRef,
|
|
223
|
+
sortRef,
|
|
224
|
+
patchHeader,
|
|
225
|
+
column.id,
|
|
226
|
+
reduxHeader,
|
|
227
|
+
hasFilter,
|
|
228
|
+
hasDnD,
|
|
229
|
+
hoveredColumnId
|
|
230
|
+
]
|
|
195
231
|
);
|
|
196
232
|
return { onMouseEnter, onMouseLeave, handleSort, onKeyDown, onBlur, onFocus };
|
|
197
233
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/useHeaderCellHandlers.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-params */\nimport { useCallback, useMemo } from 'react';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\ntype UseHeaderCellHandlersType = (args: {\n hasFilter: boolean;\n column: DSDataTableT.InternalColumn;\n hasDnD: boolean;\n dragHandleRef: React.MutableRefObject<HTMLDivElement | null>;\n sortRef: React.MutableRefObject<HTMLButtonElement | null>;\n filterIconRef: React.MutableRefObject<HTMLButtonElement | null>;\n resizeHandlerRef: React.MutableRefObject<HTMLInputElement | null>;\n hasSortingCaret: boolean;\n isDragOverlay?: boolean;\n draggableProps: DSDataTableT.DraggablePropsT;\n referenceColumn: React.MutableRefObject<HTMLDivElement | null>;\n}) => {\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n handleSort: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n onFocus: React.FocusEventHandler;\n onBlur: React.FocusEventHandler;\n};\n\n// TODO: reduxHeader was a mistake from the start.\n// Please remove this and make this logic more simple and\n// easy to follow.\nconst buildNextHeader = (\n reduxHeader: DSDataTableT.ReduxHeader,\n value: boolean,\n hasFilter: boolean,\n hasDnD: boolean,\n hasSortingCaret: boolean,\n withTabStops = false,\n) => ({\n hideFilterMenu: true, // Do this to overwrite it if it exists\n ...reduxHeader,\n hideFilterButton: !(hasFilter && value),\n showDnDHandle: hasDnD && value,\n showSortCaret: hasSortingCaret,\n withTabStops,\n});\n\nconst getNextSortedVisibleColumns = (\n visibleColumns: DSDataTableT.InternalColumn[],\n columnId: string,\n isSortedDesc: boolean,\n) => {\n const doit = (columns: DSDataTableT.InternalColumn[]) =>\n columns.map((col) => {\n const newCol = { ...col };\n delete newCol.isSortedDesc;\n if (col.id === columnId) {\n newCol.isSortedDesc = isSortedDesc;\n }\n if (newCol.columns) {\n newCol.columns = doit(newCol.columns);\n }\n return newCol;\n });\n return doit(visibleColumns);\n};\n\nexport const useHeaderCellHandlers: UseHeaderCellHandlersType = ({\n hasFilter,\n column,\n hasDnD,\n dragHandleRef,\n filterIconRef,\n sortRef,\n resizeHandlerRef,\n hasSortingCaret,\n isDragOverlay,\n draggableProps,\n referenceColumn,\n}) => {\n const onColumnSortChange = usePropsStore((state) => state.onColumnSortChange);\n const onColumnSort = usePropsStore((state) => state.onColumnSort);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const setFocusedRowId = useInternalStore((state) => state.setFocusedRowId);\n const patchHeader = useInternalStore((state) => state.patchHeader);\n const reduxHeaders = useInternalStore((state) => state.reduxHeaders);\n\n const reduxHeader = useMemo(() => reduxHeaders[column.id], [reduxHeaders, column]);\n\n const headerRef = referenceColumn.current;\n\n const onMouseEnter: React.MouseEventHandler = useCallback(() => {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n }, [column.id, hasDnD, hasFilter, patchHeader, reduxHeader, hasSortingCaret]);\n\n const onMouseLeave: React.MouseEventHandler = useCallback(() => {\n if (!headerRef?.contains(document.activeElement)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n }\n }, [column.id, hasDnD, hasFilter, headerRef, patchHeader, reduxHeader]);\n\n const handleSort: React.MouseEventHandler = useCallback(() => {\n if (column.canSort) {\n onColumnSortChange?.({\n column: column.id,\n direction: column.isSortedDesc ? 'ASC' : 'DESC',\n });\n onColumnSort(\n getNextSortedVisibleColumns(visibleColumns, column.id, !column.isSortedDesc),\n column.id,\n column.isSortedDesc ? 'ASC' : 'DESC',\n );\n }\n }, [column.canSort, column.id, column.isSortedDesc, onColumnSort, onColumnSortChange, visibleColumns]);\n\n const isActive = draggableProps && draggableProps.active;\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n // we do the same as the draggable rows.\n // we stop the event if the overlay is active\n // main reason is the tab key\n if (isDragOverlay || isActive) {\n e.preventDefault();\n }\n\n if (e.currentTarget !== e.target) return;\n if (e.code === 'ArrowDown' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'DESC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, true), column.id, 'DESC');\n } else if (e.code === 'ArrowUp' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'ASC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, false), column.id, 'ASC');\n } else if (['Enter', 'Space'].includes(e.code)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret, true));\n // Elements don't not yet exist\n setTimeout(() => {\n if (dragHandleRef.current) dragHandleRef.current.focus();\n else if (filterIconRef.current) filterIconRef.current.focus();\n else if (resizeHandlerRef.current) resizeHandlerRef.current.focus();\n else if (sortRef?.current) sortRef.current.focus();\n });\n }\n },\n [\n isDragOverlay,\n isActive,\n column.canSort,\n column.id,\n onColumnSortChange,\n onColumnSort,\n visibleColumns,\n patchHeader,\n reduxHeader,\n hasFilter,\n hasDnD,\n hasSortingCaret,\n dragHandleRef,\n filterIconRef,\n resizeHandlerRef,\n sortRef,\n ],\n );\n\n const onFocus: React.FocusEventHandler = useCallback(\n (e) => {\n // Don't do anything if focus wasn't placed in the element (bubling issues)\n const possibleTargets: (HTMLElement | null)[] = [\n dragHandleRef.current,\n filterIconRef.current,\n resizeHandlerRef.current,\n ];\n if (e.target === headerRef) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n setFocusedRowId(null);\n }\n\n if (possibleTargets.includes(e.target as HTMLElement | null)) {\n patchHeader(column.id, {\n hideFilterButton: !hasFilter,\n showDnDHandle: hasDnD,\n withTabStops: true,\n });\n setFocusedRowId(null);\n }\n },\n [\n column.id,\n dragHandleRef,\n filterIconRef,\n hasDnD,\n hasFilter,\n headerRef,\n patchHeader,\n reduxHeader,\n resizeHandlerRef,\n setFocusedRowId,\n hasSortingCaret,\n ],\n );\n\n const onBlur: React.FocusEventHandler = useCallback(\n (e) => {\n // Don't do anything if blur was caused by going to a child\n if (e.relatedTarget === dragHandleRef.current) return;\n if (e.relatedTarget === filterIconRef.current) return;\n if (e.relatedTarget === resizeHandlerRef.current) return;\n if (e.relatedTarget === sortRef?.current) return;\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n },\n [dragHandleRef, filterIconRef, resizeHandlerRef, sortRef, patchHeader, column.id, reduxHeader, hasFilter, hasDnD],\n );\n\n return { onMouseEnter, onMouseLeave, handleSort, onKeyDown, onBlur, onFocus };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAqC;AAErC,2CAAgD;AAyBhD,MAAM,kBAAkB,CACtB,aACA,OACA,WACA,QACA,iBACA,eAAe,WACX;AAAA,EACJ,gBAAgB;AAAA;AAAA,EAChB,GAAG;AAAA,EACH,kBAAkB,EAAE,aAAa;AAAA,EACjC,eAAe,UAAU;AAAA,EACzB,eAAe;AAAA,EACf;AACF;AAEA,MAAM,8BAA8B,CAClC,gBACA,UACA,iBACG;AACH,QAAM,OAAO,CAAC,YACZ,QAAQ,IAAI,CAAC,QAAQ;AACnB,UAAM,SAAS,EAAE,GAAG,IAAI;AACxB,WAAO,OAAO;AACd,QAAI,IAAI,OAAO,UAAU;AACvB,aAAO,eAAe;AAAA,IACxB;AACA,QAAI,OAAO,SAAS;AAClB,aAAO,UAAU,KAAK,OAAO,OAAO;AAAA,IACtC;AACA,WAAO;AAAA,EACT,CAAC;AACH,SAAO,KAAK,cAAc;AAC5B;AAEO,MAAM,wBAAmD,CAAC;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,yBAAqB,oDAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,mBAAe,oDAAc,CAAC,UAAU,MAAM,YAAY;AAChE,QAAM,qBAAiB,oDAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,sBAAkB,uDAAiB,CAAC,UAAU,MAAM,eAAe;AACzE,QAAM,kBAAc,uDAAiB,CAAC,UAAU,MAAM,WAAW;AACjE,QAAM,mBAAe,uDAAiB,CAAC,UAAU,MAAM,YAAY;AAEnE,QAAM,kBAAc,sBAAQ,MAAM,aAAa,OAAO,EAAE,GAAG,CAAC,cAAc,MAAM,CAAC;AAEjF,QAAM,YAAY,gBAAgB;AAElC,QAAM,mBAAwC,0BAAY,MAAM;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-params */\nimport { useCallback, useMemo } from 'react';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\ntype UseHeaderCellHandlersType = (args: {\n hasFilter: boolean;\n column: DSDataTableT.InternalColumn;\n hasDnD: boolean;\n dragHandleRef: React.MutableRefObject<HTMLDivElement | null>;\n sortRef: React.MutableRefObject<HTMLButtonElement | null>;\n filterIconRef: React.MutableRefObject<HTMLButtonElement | null>;\n resizeHandlerRef: React.MutableRefObject<HTMLInputElement | null>;\n hasSortingCaret: boolean;\n isDragOverlay?: boolean;\n draggableProps: DSDataTableT.DraggablePropsT;\n referenceColumn: React.MutableRefObject<HTMLDivElement | null>;\n}) => {\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n handleSort: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n onFocus: React.FocusEventHandler;\n onBlur: React.FocusEventHandler;\n};\n\n// TODO: reduxHeader was a mistake from the start.\n// Please remove this and make this logic more simple and\n// easy to follow.\nconst buildNextHeader = (\n reduxHeader: DSDataTableT.ReduxHeader,\n value: boolean,\n hasFilter: boolean,\n hasDnD: boolean,\n hasSortingCaret: boolean,\n withTabStops = false,\n) => ({\n hideFilterMenu: true, // Do this to overwrite it if it exists\n ...reduxHeader,\n hideFilterButton: !(hasFilter && value),\n showDnDHandle: hasDnD && value,\n showSortCaret: hasSortingCaret,\n withTabStops,\n});\n\nconst getNextSortedVisibleColumns = (\n visibleColumns: DSDataTableT.InternalColumn[],\n columnId: string,\n isSortedDesc: boolean,\n) => {\n const doit = (columns: DSDataTableT.InternalColumn[]) =>\n columns.map((col) => {\n const newCol = { ...col };\n delete newCol.isSortedDesc;\n if (col.id === columnId) {\n newCol.isSortedDesc = isSortedDesc;\n }\n if (newCol.columns) {\n newCol.columns = doit(newCol.columns);\n }\n return newCol;\n });\n return doit(visibleColumns);\n};\n\nexport const useHeaderCellHandlers: UseHeaderCellHandlersType = ({\n hasFilter,\n column,\n hasDnD,\n dragHandleRef,\n filterIconRef,\n sortRef,\n resizeHandlerRef,\n hasSortingCaret,\n isDragOverlay,\n draggableProps,\n referenceColumn,\n}) => {\n const onColumnSortChange = usePropsStore((state) => state.onColumnSortChange);\n const onColumnSort = usePropsStore((state) => state.onColumnSort);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const setFocusedRowId = useInternalStore((state) => state.setFocusedRowId);\n const patchHeader = useInternalStore((state) => state.patchHeader);\n const closeFilterMenuIfOpen = useInternalStore((state) => state.closeFilterMenuIfOpen);\n const resetAllHeadersExcept = useInternalStore((state) => state.resetAllHeadersExcept);\n const hoveredColumnId = useInternalStore((state) => state.hoveredColumnId);\n const setHoveredColumnId = useInternalStore((state) => state.setHoveredColumnId);\n const reduxHeaders = useInternalStore((state) => state.reduxHeaders);\n\n const reduxHeader = useMemo(() => reduxHeaders[column.id], [reduxHeaders, column]);\n\n const headerRef = referenceColumn.current;\n\n const onMouseEnter: React.MouseEventHandler = useCallback(() => {\n // PUI-15154: tracked separately from reduxHeader's own fields \u2014 see resetAllHeadersExcept in\n // useStore.tsx for why hover identity can't be folded into the same per-column booleans focus\n // writes to.\n setHoveredColumnId(column.id);\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n }, [column.id, hasDnD, hasFilter, patchHeader, reduxHeader, hasSortingCaret, setHoveredColumnId]);\n\n const onMouseLeave: React.MouseEventHandler = useCallback(() => {\n setHoveredColumnId((currentHoveredColumnId) =>\n currentHoveredColumnId === column.id ? null : currentHoveredColumnId,\n );\n if (!headerRef?.contains(document.activeElement)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n }\n }, [column.id, hasDnD, hasFilter, headerRef, patchHeader, reduxHeader, setHoveredColumnId]);\n\n const handleSort: React.MouseEventHandler = useCallback(() => {\n /** PUI-18785: this handler runs for every click on the header (title, sort caret, a drag\n * handle click that doesn't turn into an actual drag) \u2014 see closeFilterMenuIfOpen in\n * useStore.tsx for why it needs to force-close the column's own filter menu here.\n */\n closeFilterMenuIfOpen(column.id);\n if (column.canSort) {\n onColumnSortChange?.({\n column: column.id,\n direction: column.isSortedDesc ? 'ASC' : 'DESC',\n });\n onColumnSort(\n getNextSortedVisibleColumns(visibleColumns, column.id, !column.isSortedDesc),\n column.id,\n column.isSortedDesc ? 'ASC' : 'DESC',\n );\n }\n }, [\n column.canSort,\n column.id,\n column.isSortedDesc,\n onColumnSort,\n onColumnSortChange,\n visibleColumns,\n closeFilterMenuIfOpen,\n ]);\n\n const isActive = draggableProps && draggableProps.active;\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n // we do the same as the draggable rows.\n // we stop the event if the overlay is active\n // main reason is the tab key\n if (isDragOverlay || isActive) {\n e.preventDefault();\n }\n\n if (e.currentTarget !== e.target) return;\n if (e.code === 'ArrowDown' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'DESC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, true), column.id, 'DESC');\n } else if (e.code === 'ArrowUp' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'ASC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, false), column.id, 'ASC');\n } else if (['Enter', 'Space'].includes(e.code)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret, true));\n // Elements don't not yet exist\n setTimeout(() => {\n if (dragHandleRef.current) dragHandleRef.current.focus();\n else if (filterIconRef.current) filterIconRef.current.focus();\n else if (resizeHandlerRef.current) resizeHandlerRef.current.focus();\n else if (sortRef?.current) sortRef.current.focus();\n });\n }\n },\n [\n isDragOverlay,\n isActive,\n column.canSort,\n column.id,\n onColumnSortChange,\n onColumnSort,\n visibleColumns,\n patchHeader,\n reduxHeader,\n hasFilter,\n hasDnD,\n hasSortingCaret,\n dragHandleRef,\n filterIconRef,\n resizeHandlerRef,\n sortRef,\n ],\n );\n\n const onFocus: React.FocusEventHandler = useCallback(\n (e) => {\n // Don't do anything if focus wasn't placed in the element (bubling issues)\n const possibleTargets: (HTMLElement | null)[] = [\n dragHandleRef.current,\n filterIconRef.current,\n resizeHandlerRef.current,\n ];\n if (e.target === headerRef) {\n // PUI-15154: proactively clear every other column's stuck DnD handle/sort caret \u2014 see\n // resetAllHeadersExcept in useStore.tsx for why this can't rely solely on the previous\n // column's own onBlur.\n resetAllHeadersExcept(column.id);\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n setFocusedRowId(null);\n }\n\n if (possibleTargets.includes(e.target as HTMLElement | null)) {\n resetAllHeadersExcept(column.id);\n patchHeader(column.id, {\n hideFilterButton: !hasFilter,\n showDnDHandle: hasDnD,\n withTabStops: true,\n });\n setFocusedRowId(null);\n }\n },\n [\n column.id,\n dragHandleRef,\n filterIconRef,\n hasDnD,\n hasFilter,\n headerRef,\n patchHeader,\n resetAllHeadersExcept,\n reduxHeader,\n resizeHandlerRef,\n setFocusedRowId,\n hasSortingCaret,\n ],\n );\n\n const onBlur: React.FocusEventHandler = useCallback(\n (e) => {\n // PUI-15154: don't do anything if blur was caused by going to a child \u2014 but only when\n // relatedTarget is a real element. When focus leaves with nowhere specific to land (a click\n // on a non-focusable area, or Tab past the last focusable element), relatedTarget is null.\n // Any of these refs is null too whenever that control isn't rendered for this column (e.g.\n // filterIconRef when the column has no filter \u2014 FilterMapItem renders null). Comparing with\n // plain === then false-matches null against null and skips the reset, leaving the DnD handle\n // and sort caret visibly stuck even though focus genuinely left the header.\n const { relatedTarget } = e;\n if (relatedTarget && relatedTarget === dragHandleRef.current) return;\n if (relatedTarget && relatedTarget === filterIconRef.current) return;\n if (relatedTarget && relatedTarget === resizeHandlerRef.current) return;\n if (relatedTarget && relatedTarget === sortRef?.current) return;\n // PUI-15154: if the mouse is still hovering this same column, don't hide its hover-driven\n // visibility just because focus left it \u2014 only the focus-derived tab-stop state resets.\n // showDnDHandle/showSortCaret stay as hover set them.\n if (hoveredColumnId === column.id) {\n patchHeader(column.id, { withTabStops: false });\n return;\n }\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n },\n [\n dragHandleRef,\n filterIconRef,\n resizeHandlerRef,\n sortRef,\n patchHeader,\n column.id,\n reduxHeader,\n hasFilter,\n hasDnD,\n hoveredColumnId,\n ],\n );\n\n return { onMouseEnter, onMouseLeave, handleSort, onKeyDown, onBlur, onFocus };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAqC;AAErC,2CAAgD;AAyBhD,MAAM,kBAAkB,CACtB,aACA,OACA,WACA,QACA,iBACA,eAAe,WACX;AAAA,EACJ,gBAAgB;AAAA;AAAA,EAChB,GAAG;AAAA,EACH,kBAAkB,EAAE,aAAa;AAAA,EACjC,eAAe,UAAU;AAAA,EACzB,eAAe;AAAA,EACf;AACF;AAEA,MAAM,8BAA8B,CAClC,gBACA,UACA,iBACG;AACH,QAAM,OAAO,CAAC,YACZ,QAAQ,IAAI,CAAC,QAAQ;AACnB,UAAM,SAAS,EAAE,GAAG,IAAI;AACxB,WAAO,OAAO;AACd,QAAI,IAAI,OAAO,UAAU;AACvB,aAAO,eAAe;AAAA,IACxB;AACA,QAAI,OAAO,SAAS;AAClB,aAAO,UAAU,KAAK,OAAO,OAAO;AAAA,IACtC;AACA,WAAO;AAAA,EACT,CAAC;AACH,SAAO,KAAK,cAAc;AAC5B;AAEO,MAAM,wBAAmD,CAAC;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,yBAAqB,oDAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,mBAAe,oDAA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OAAO,IAAI;AACjC,oBAAY,OAAO,IAAI,EAAE,cAAc,MAAM,CAAC;AAC9C;AAAA,MACF;AACA,kBAAY,OAAO,IAAI,gBAAgB,aAAa,OAAO,WAAW,QAAQ,KAAK,CAAC;AAAA,IACtF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,cAAc,cAAc,YAAY,WAAW,QAAQ,QAAQ;AAC9E;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,8 +35,9 @@ var React = __toESM(require("react"));
|
|
|
35
35
|
var import_lodash_es = require("lodash-es");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_createInternalAndPropsContext = require("../../configs/useStore/createInternalAndPropsContext.js");
|
|
38
|
+
var import_constants = require("../../configs/constants.js");
|
|
38
39
|
var import_gridLayoutHelpers = require("../../helpers/gridLayoutHelpers.js");
|
|
39
|
-
const narrow = (value, min, max) => Math.min(Math.max(value, min ??
|
|
40
|
+
const narrow = (value, min, max) => Math.min(Math.max(value, min ?? import_constants.DEFAULT_MIN_COLUMN_WIDTH), max ?? import_constants.DEFAULT_MAX_COLUMN_WIDTH);
|
|
40
41
|
const getCorrectDelta = (e) => {
|
|
41
42
|
let multiplier = 1;
|
|
42
43
|
if (e.shiftKey) multiplier *= 5;
|
|
@@ -57,6 +58,8 @@ const useHeaderResizer = ({
|
|
|
57
58
|
const onColumnResize = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.onColumnResize);
|
|
58
59
|
const onColumnSizeChange = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.onColumnSizeChange);
|
|
59
60
|
const virtualListRef = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.virtualListRef);
|
|
61
|
+
const colsLayoutStyle = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.colsLayoutStyle);
|
|
62
|
+
const closeFilterMenuIfOpen = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.closeFilterMenuIfOpen);
|
|
60
63
|
const [isResizing, setIsResizing] = (0, import_react.useState)(false);
|
|
61
64
|
const visibleColumnsCopy = (0, import_react.useMemo)(() => (0, import_lodash_es.cloneDeep)(visibleColumns), [visibleColumns]);
|
|
62
65
|
const visibleColumnsOnGridLayout = (0, import_react.useMemo)(
|
|
@@ -74,6 +77,9 @@ const useHeaderResizer = ({
|
|
|
74
77
|
);
|
|
75
78
|
const realColumnIndexRef = import_react.default.useRef(realColumnIndex);
|
|
76
79
|
realColumnIndexRef.current = realColumnIndex;
|
|
80
|
+
const [columnWidth, setColumnWidth] = (0, import_react.useState)(
|
|
81
|
+
visibleColumnsOnGridLayout[realColumnIndex]?.width ?? (colsLayoutStyle === import_constants.ColsLayoutStyle.Auto ? void 0 : 150)
|
|
82
|
+
);
|
|
77
83
|
const pushColumnSizeChange = (0, import_react.useCallback)(
|
|
78
84
|
(nextWidth) => {
|
|
79
85
|
if (nextWidth === visibleColumnsOnGridLayout[realColumnIndexRef.current].width) return;
|
|
@@ -85,7 +91,8 @@ const useHeaderResizer = ({
|
|
|
85
91
|
);
|
|
86
92
|
const onResizeStart = (0, import_react.useCallback)(() => {
|
|
87
93
|
setIsResizing(true);
|
|
88
|
-
|
|
94
|
+
closeFilterMenuIfOpen(columnId);
|
|
95
|
+
}, [closeFilterMenuIfOpen, columnId]);
|
|
89
96
|
const onResizeEnd = (0, import_react.useCallback)(() => {
|
|
90
97
|
setIsResizing(false);
|
|
91
98
|
pushColumnSizeChange((0, import_gridLayoutHelpers.getGridLayout)(virtualListRef.current)[realColumnIndexRef.current]);
|
|
@@ -103,6 +110,7 @@ const useHeaderResizer = ({
|
|
|
103
110
|
);
|
|
104
111
|
(0, import_gridLayoutHelpers.changeGridLayout)(virtualListRef.current, realColumnIndexRef.current, widthWithDelta);
|
|
105
112
|
(0, import_gridLayoutHelpers.setSubColumnsGridLayout)(virtualListRef.current, visibleColumnsCopy);
|
|
113
|
+
setColumnWidth(widthWithDelta);
|
|
106
114
|
e.preventDefault();
|
|
107
115
|
e.stopPropagation();
|
|
108
116
|
},
|
|
@@ -127,13 +135,15 @@ const useHeaderResizer = ({
|
|
|
127
135
|
);
|
|
128
136
|
(0, import_gridLayoutHelpers.changeGridLayout)(virtualListRef.current, realColumnIndexRef.current, widthWithDelta);
|
|
129
137
|
(0, import_gridLayoutHelpers.setSubColumnsGridLayout)(virtualListRef.current, visibleColumnsCopy);
|
|
130
|
-
|
|
138
|
+
setColumnWidth(widthWithDelta);
|
|
139
|
+
pushColumnSizeChange(widthWithDelta);
|
|
131
140
|
(0, import_gridLayoutHelpers.removeGridLayout)(virtualListRef.current);
|
|
132
141
|
},
|
|
133
142
|
[pushColumnSizeChange, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout]
|
|
134
143
|
);
|
|
135
144
|
return {
|
|
136
145
|
isResizing,
|
|
146
|
+
columnWidth,
|
|
137
147
|
onResizeStart,
|
|
138
148
|
onResizeEnd,
|
|
139
149
|
onResizeHandler,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/useHeaderResizer.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { cloneDeep } from 'lodash-es';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport {\n changeGridLayout,\n getGridLayout,\n removeGridLayout,\n setSubColumnsGridLayout,\n} from '../../helpers/gridLayoutHelpers.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\n\n// if number > max => max\n// if number < min => min\n// else => number\nconst narrow = (value: number, min: number | undefined, max: number | undefined): number =>\n Math.min(Math.max(value, min ??
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA0B;AAC1B,mBAAsD;AACtD,
|
|
4
|
+
"sourcesContent": ["import { cloneDeep } from 'lodash-es';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport { ColsLayoutStyle, DEFAULT_MAX_COLUMN_WIDTH, DEFAULT_MIN_COLUMN_WIDTH } from '../../configs/constants.js';\nimport {\n changeGridLayout,\n getGridLayout,\n removeGridLayout,\n setSubColumnsGridLayout,\n} from '../../helpers/gridLayoutHelpers.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\n\n// if number > max => max\n// if number < min => min\n// else => number\nconst narrow = (value: number, min: number | undefined, max: number | undefined): number =>\n Math.min(Math.max(value, min ?? DEFAULT_MIN_COLUMN_WIDTH), max ?? DEFAULT_MAX_COLUMN_WIDTH);\n\n// Returns the delta of the keyboard event\nconst getCorrectDelta = (e: React.KeyboardEvent) => {\n let multiplier = 1;\n\n if (e.shiftKey) multiplier *= 5;\n if (e.altKey) multiplier *= 10;\n\n if (e.code === 'ArrowLeft') {\n return -multiplier;\n }\n if (e.code === 'ArrowRight') {\n return multiplier;\n }\n return 0;\n};\n\nexport const useHeaderResizer = ({\n columnId,\n innerRef,\n}: {\n columnId: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null>;\n}) => {\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const onColumnResize = usePropsStore((state) => state.onColumnResize);\n const onColumnSizeChange = usePropsStore((state) => state.onColumnSizeChange);\n const virtualListRef = usePropsStore((state) => state.virtualListRef);\n const colsLayoutStyle = usePropsStore((state) => state.colsLayoutStyle);\n const closeFilterMenuIfOpen = useInternalStore((state) => state.closeFilterMenuIfOpen);\n\n const [isResizing, setIsResizing] = useState(false);\n\n const visibleColumnsCopy = useMemo(() => cloneDeep(visibleColumns), [visibleColumns]);\n\n const visibleColumnsOnGridLayout = useMemo(\n () =>\n visibleColumnsCopy.reduce((acc, cur) => {\n if (cur.columns) {\n return acc.concat(cur.columns);\n }\n return acc.concat(cur);\n }, [] as DSDataTableT.InternalColumn[]),\n [visibleColumnsCopy],\n );\n\n const realColumnIndex = useMemo(\n () => visibleColumnsOnGridLayout.findIndex((col) => col.id === columnId),\n [columnId, visibleColumnsOnGridLayout],\n );\n\n const realColumnIndexRef = React.useRef(realColumnIndex);\n realColumnIndexRef.current = realColumnIndex;\n\n // PUI-17784: real width in pixels, fed to aria-valuenow/valuetext. Initialized synchronously from\n // props \u2014 no effect needed. Mirrors columnsToGridImpl's own default (helpers/columnsToGrid.tsx,\n // keep both in sync if that default ever changes): an explicit column.width wins; otherwise Fixed\n // layout resolves to a known 150px; Auto layout with no explicit width has no synchronous numeric\n // value (it's a flexible '1fr' the browser resolves at layout time) \u2014 aria-valuenow is legitimately\n // absent until the user's first resize populates it via the handlers below, which already call\n // setColumnWidth on every mouse/keyboard resize using the real applied width.\n const [columnWidth, setColumnWidth] = useState<number | undefined>(\n visibleColumnsOnGridLayout[realColumnIndex]?.width ?? (colsLayoutStyle === ColsLayoutStyle.Auto ? undefined : 150),\n );\n\n // Notifies the user of the change in the column size\n const pushColumnSizeChange = useCallback(\n (nextWidth: number) => {\n // PUI-12695: Avoid unnecessary calls to onColumnResize\n // Avoid calling onColumnResize if the width of the column has not changed\n // unnecessary calls to onColumnResize can cause performance issues (next resizes were not working)\n if (nextWidth === visibleColumnsOnGridLayout[realColumnIndexRef.current].width) return;\n onColumnResize?.(columnId, nextWidth);\n // this next line is updating also the visibleColumnsCopy via mutable changes\n // the mutable changes here works because what we mutate is a cloneDeep of the columns\n visibleColumnsOnGridLayout[realColumnIndexRef.current].width = nextWidth;\n onColumnSizeChange(visibleColumnsCopy, columnId, nextWidth);\n },\n [columnId, onColumnResize, onColumnSizeChange, realColumnIndexRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n const onResizeStart = useCallback(() => {\n setIsResizing(true);\n /**\n * PUI-18785: the resize handle shares the same containment root cause as the header click and\n * drag handle \u2014 see closeFilterMenuIfOpen in useStore.tsx.\n */\n closeFilterMenuIfOpen(columnId);\n }, [closeFilterMenuIfOpen, columnId]);\n\n const onResizeEnd = useCallback(() => {\n setIsResizing(false);\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndexRef.current]);\n removeGridLayout(virtualListRef.current);\n }, [pushColumnSizeChange, virtualListRef, realColumnIndexRef]);\n\n // Mouse resize\n const onResizeHandler = useCallback(\n (e: MouseEvent | TouchEvent) => {\n if (realColumnIndexRef.current === -1) return;\n\n const delta =\n ('clientX' in e ? e.clientX : e.touches[0].clientX) - (innerRef.current?.getBoundingClientRect().x ?? 0); // delta in pixels\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndexRef.current];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndexRef.current].minWidth,\n visibleColumnsOnGridLayout[realColumnIndexRef.current].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndexRef.current, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n setColumnWidth(widthWithDelta);\n\n // We will notify the user of the change in the column size only when the user releases the mouse button\n\n // To prevent text selection\n e.preventDefault();\n e.stopPropagation();\n },\n [innerRef, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n // Keyboard resize\n const handleKeyboardResize = useCallback(\n (e: React.KeyboardEvent) => {\n if (realColumnIndexRef.current === -1) return;\n\n if (e.key === 'Enter') {\n e.stopPropagation();\n }\n\n if (e.code === 'ArrowLeft' || e.code === 'ArrowRight') {\n e.preventDefault();\n }\n\n const delta = getCorrectDelta(e);\n\n if (delta === 0) return;\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndexRef.current];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndexRef.current].minWidth,\n visibleColumnsOnGridLayout[realColumnIndexRef.current].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndexRef.current, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n setColumnWidth(widthWithDelta);\n\n /**\n * Commit the already-clamped width. getGridLayout() here would just re-read what\n * changeGridLayout() set above (widthWithDelta) \u2014 adding delta again double-counted it and\n * committed a width past minWidth/maxWidth (PUI-12696).\n */\n pushColumnSizeChange(widthWithDelta);\n removeGridLayout(virtualListRef.current);\n },\n [pushColumnSizeChange, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n return {\n isResizing,\n columnWidth,\n onResizeStart,\n onResizeEnd,\n onResizeHandler,\n handleKeyboardResize,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA0B;AAC1B,mBAAsD;AACtD,2CAAgD;AAChD,uBAAoF;AACpF,+BAKO;AAMP,MAAM,SAAS,CAAC,OAAe,KAAyB,QACtD,KAAK,IAAI,KAAK,IAAI,OAAO,OAAO,yCAAwB,GAAG,OAAO,yCAAwB;AAG5F,MAAM,kBAAkB,CAAC,MAA2B;AAClD,MAAI,aAAa;AAEjB,MAAI,EAAE,SAAU,eAAc;AAC9B,MAAI,EAAE,OAAQ,eAAc;AAE5B,MAAI,EAAE,SAAS,aAAa;AAC1B,WAAO,CAAC;AAAA,EACV;AACA,MAAI,EAAE,SAAS,cAAc;AAC3B,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AACF,MAGM;AACJ,QAAM,qBAAiB,oDAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,qBAAiB,oDAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,yBAAqB,oDAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5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EAAE;AAAA,QACvD,2BAA2B,mBAAmB,OAAO,EAAE;AAAA,MACzD;AAEA,qDAAiB,eAAe,SAAS,mBAAmB,SAAS,cAAc;AACnF,4DAAwB,eAAe,SAAS,kBAAkB;AAClE,qBAAe,cAAc;AAO7B,2BAAqB,cAAc;AACnC,qDAAiB,eAAe,OAAO;AAAA,IACzC;AAAA,IACA,CAAC,sBAAsB,gBAAgB,oBAAoB,0BAA0B;AAAA,EACvF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -42,6 +42,7 @@ var import_DnDGroupContext = require("./DnDGroupContext.js");
|
|
|
42
42
|
const withDnDSortableColumnContext = (Component) => (props) => {
|
|
43
43
|
const dragAndDropColumns = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.dragAndDropColumns);
|
|
44
44
|
const setIsHeaderCellDragging = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.setIsHeaderCellDragging);
|
|
45
|
+
const closeFilterMenuIfOpen = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.closeFilterMenuIfOpen);
|
|
45
46
|
const { activeIndex } = (0, import_react.useContext)(import_DnDGroupContext.DnDGroupContext);
|
|
46
47
|
const draggableOptions = (0, import_react.useMemo)(
|
|
47
48
|
() => ({
|
|
@@ -53,10 +54,11 @@ const withDnDSortableColumnContext = (Component) => (props) => {
|
|
|
53
54
|
(0, import_react.useEffect)(() => {
|
|
54
55
|
if (useSortableHelpers.isDragging) {
|
|
55
56
|
setIsHeaderCellDragging(true);
|
|
57
|
+
closeFilterMenuIfOpen(props.header.id);
|
|
56
58
|
} else {
|
|
57
59
|
setIsHeaderCellDragging(false);
|
|
58
60
|
}
|
|
59
|
-
}, [useSortableHelpers.isDragging, setIsHeaderCellDragging]);
|
|
61
|
+
}, [useSortableHelpers.isDragging, setIsHeaderCellDragging, closeFilterMenuIfOpen, props.header.id]);
|
|
60
62
|
const draggableProps = (0, import_react.useMemo)(() => {
|
|
61
63
|
if (!dragAndDropColumns) return false;
|
|
62
64
|
const { index, overIndex } = useSortableHelpers;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/HoC/withDnDSortableColumnContext.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react/function-component-definition */\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport React, { useContext, useEffect, useMemo } from 'react';\nimport { DropIndicatorPosition } from '../../configs/constants.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport type { SortableItemContextType } from './SortableItemContext.js';\nimport { SortableItemContext } from './SortableItemContext.js';\nimport { DnDGroupContext } from './DnDGroupContext.js';\n\nexport const withDnDSortableColumnContext =\n <T extends { header: DSDataTableT.InternalColumn }>(Component: React.ComponentType<T>) =>\n (props: T) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const setIsHeaderCellDragging = useInternalStore((state) => state.setIsHeaderCellDragging);\n\n const { activeIndex } = useContext(DnDGroupContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.header.id,\n }),\n [props.header.id],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // Since Header component for some reason is being render inside the virtual scrollable list,\n // we need to bubble this prop up to avoid the row list being scrolled when dragging a header cell.\n useEffect(() => {\n if (useSortableHelpers.isDragging) {\n setIsHeaderCellDragging(true);\n } else {\n setIsHeaderCellDragging(false);\n }\n }, [useSortableHelpers.isDragging, setIsHeaderCellDragging]);\n // calculate all the \"useSortable\" values as per required\n const draggableProps: DSDataTableT.DraggablePropsT = useMemo(() => {\n if (!dragAndDropColumns) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index && overIndex !== -1,\n dropIndicatorPosition:\n activeIndex && index > activeIndex ? DropIndicatorPosition.After : DropIndicatorPosition.Before,\n isDropValid: true,\n };\n }, [useSortableHelpers, dragAndDropColumns, activeIndex]);\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/function-component-definition */\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport React, { useContext, useEffect, useMemo } from 'react';\nimport { DropIndicatorPosition } from '../../configs/constants.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport type { SortableItemContextType } from './SortableItemContext.js';\nimport { SortableItemContext } from './SortableItemContext.js';\nimport { DnDGroupContext } from './DnDGroupContext.js';\n\nexport const withDnDSortableColumnContext =\n <T extends { header: DSDataTableT.InternalColumn }>(Component: React.ComponentType<T>) =>\n (props: T) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const setIsHeaderCellDragging = useInternalStore((state) => state.setIsHeaderCellDragging);\n const closeFilterMenuIfOpen = useInternalStore((state) => state.closeFilterMenuIfOpen);\n\n const { activeIndex } = useContext(DnDGroupContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.header.id,\n }),\n [props.header.id],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // Since Header component for some reason is being render inside the virtual scrollable list,\n // we need to bubble this prop up to avoid the row list being scrolled when dragging a header cell.\n useEffect(() => {\n if (useSortableHelpers.isDragging) {\n setIsHeaderCellDragging(true);\n /**\n * PUI-18785: close this column's own filter menu as soon as its drag actually starts,\n * rather than disabling the drag while the menu is open \u2014 disabling made dnd-kit drop its\n * pointer listeners entirely, so the same press that should close-and-drag only closed the\n * menu, forcing the user into a second press to actually drag. Reacting to isDragging keeps\n * it a single gesture: the PointerSensor has no activation constraint, so this fires on the\n * first pointer move, before the popover (anchored to the header) visibly follows it.\n */\n closeFilterMenuIfOpen(props.header.id);\n } else {\n setIsHeaderCellDragging(false);\n }\n }, [useSortableHelpers.isDragging, setIsHeaderCellDragging, closeFilterMenuIfOpen, props.header.id]);\n // calculate all the \"useSortable\" values as per required\n const draggableProps: DSDataTableT.DraggablePropsT = useMemo(() => {\n if (!dragAndDropColumns) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index && overIndex !== -1,\n dropIndicatorPosition:\n activeIndex && index > activeIndex ? DropIndicatorPosition.After : DropIndicatorPosition.Before,\n isDropValid: true,\n };\n }, [useSortableHelpers, dragAndDropColumns, activeIndex]);\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADyEf;AAxER,8BAA4B;AAC5B,mBA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
|
|
7
7
|
}
|
|
@@ -45,6 +45,7 @@ var import_useFreezeVirtualScrollOnDrag = require("../configs/useFreezeVirtualSc
|
|
|
45
45
|
const VirtualRowsList = () => {
|
|
46
46
|
const isLoading = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.isLoading);
|
|
47
47
|
const virtualListRef = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.virtualListRef);
|
|
48
|
+
const headerHeightPx = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.headerHeightPx);
|
|
48
49
|
const setBodyClientWidth = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.setBodyClientWidth);
|
|
49
50
|
const flattenedData = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.flattenedData);
|
|
50
51
|
const isEmptyContent = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.isEmptyContent);
|
|
@@ -90,6 +91,7 @@ const VirtualRowsList = () => {
|
|
|
90
91
|
role: "rowgroup",
|
|
91
92
|
gridLayout,
|
|
92
93
|
totalColumnsWidth,
|
|
94
|
+
headerHeightPx,
|
|
93
95
|
"aria-busy": isLoading,
|
|
94
96
|
getOwnerProps,
|
|
95
97
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/VirtualRowsList.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable consistent-return */\nimport React, { useCallback, useMemo } from 'react';\nimport { useInternalStore, usePropsStore } from '../configs/useStore/createInternalAndPropsContext.js';\nimport { DATA_TESTID } from '../configs/constants.js';\nimport { StyledTableContentWrapper, StyledVirtualListWrapper } from '../styled.js';\nimport { EmptyContent } from './EmptyContent.js'; // imported this way to avoid circular dependencies\nimport { Headers } from './Headers/index.js'; // imported this way to avoid circular dependencies\nimport { MemoizedLoader as Loader } from './Loader.js';\nimport { RowsWithContext as Rows } from './Rows.js'; // imported this way to avoid circular dependencies\nimport { useFreezeVirtualScrollOnDrag } from '../configs/useFreezeVirtualScrollOnDrag.js';\nexport const VirtualRowsList = () => {\n const isLoading = usePropsStore((state) => state.isLoading);\n\n const virtualListRef = usePropsStore((state) => state.virtualListRef);\n const setBodyClientWidth = usePropsStore((state) => state.setBodyClientWidth);\n const flattenedData = usePropsStore((state) => state.flattenedData);\n const isEmptyContent = usePropsStore((state) => state.isEmptyContent);\n const { totalColumnsWidth, gridLayout } = usePropsStore((state) => state.layoutHelpers);\n const { totalSize, scrollToIndex } = usePropsStore((state) => state.virtualListHelpers);\n const getOwnerProps = usePropsStore((store) => store.get);\n const isHeaderCellDragging = useInternalStore((state) => state.isHeaderCellDragging);\n const setFocusedRowId = useInternalStore((state) => state.setFocusedRowId);\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.ctrlKey && e.code === 'End') {\n scrollToIndex(flattenedData.length - 1);\n setFocusedRowId(flattenedData[flattenedData.length - 1].uid);\n } else if (e.ctrlKey && e.code === 'Home') {\n scrollToIndex(0, { align: 'center' });\n setFocusedRowId(flattenedData[0].uid);\n }\n },\n [scrollToIndex, setFocusedRowId, flattenedData],\n );\n\n const tableContentWrapperHeight = useMemo(\n () => (isEmptyContent || isLoading ? '100%' : totalSize),\n [isEmptyContent, isLoading, totalSize],\n );\n\n useFreezeVirtualScrollOnDrag(virtualListRef, isHeaderCellDragging);\n\n const trackVirtualListRefAndClientWidth = useCallback(\n (node: HTMLDivElement | null) => {\n virtualListRef.current = node;\n if (node) {\n const { clientWidth } = node;\n // if we don't track this with a non-ref, react will not know some component needs to be re-rendered to apply the new width\n setBodyClientWidth(clientWidth);\n }\n },\n [virtualListRef, setBodyClientWidth],\n );\n\n return (\n <StyledVirtualListWrapper\n innerRef={trackVirtualListRefAndClientWidth}\n data-testid={DATA_TESTID.DATA_TABLE_SCROLLABLE_CONTAINER}\n onKeyDown={onKeyDown}\n tabIndex={-1}\n role=\"rowgroup\"\n gridLayout={gridLayout}\n totalColumnsWidth={totalColumnsWidth}\n aria-busy={isLoading}\n getOwnerProps={getOwnerProps}\n >\n <StyledTableContentWrapper\n height={tableContentWrapperHeight}\n rows={['min-content', 'auto']}\n cols={['100%']}\n getOwnerProps={getOwnerProps}\n >\n <Headers />\n {isEmptyContent && <EmptyContent />}\n {isLoading ? <Loader /> : null}\n {!isLoading && !isEmptyContent && <Rows />}\n </StyledTableContentWrapper>\n </StyledVirtualListWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable consistent-return */\nimport React, { useCallback, useMemo } from 'react';\nimport { useInternalStore, usePropsStore } from '../configs/useStore/createInternalAndPropsContext.js';\nimport { DATA_TESTID } from '../configs/constants.js';\nimport { StyledTableContentWrapper, StyledVirtualListWrapper } from '../styled.js';\nimport { EmptyContent } from './EmptyContent.js'; // imported this way to avoid circular dependencies\nimport { Headers } from './Headers/index.js'; // imported this way to avoid circular dependencies\nimport { MemoizedLoader as Loader } from './Loader.js';\nimport { RowsWithContext as Rows } from './Rows.js'; // imported this way to avoid circular dependencies\nimport { useFreezeVirtualScrollOnDrag } from '../configs/useFreezeVirtualScrollOnDrag.js';\nexport const VirtualRowsList = () => {\n const isLoading = usePropsStore((state) => state.isLoading);\n\n const virtualListRef = usePropsStore((state) => state.virtualListRef);\n const headerHeightPx = usePropsStore((state) => state.headerHeightPx);\n const setBodyClientWidth = usePropsStore((state) => state.setBodyClientWidth);\n const flattenedData = usePropsStore((state) => state.flattenedData);\n const isEmptyContent = usePropsStore((state) => state.isEmptyContent);\n const { totalColumnsWidth, gridLayout } = usePropsStore((state) => state.layoutHelpers);\n const { totalSize, scrollToIndex } = usePropsStore((state) => state.virtualListHelpers);\n const getOwnerProps = usePropsStore((store) => store.get);\n const isHeaderCellDragging = useInternalStore((state) => state.isHeaderCellDragging);\n const setFocusedRowId = useInternalStore((state) => state.setFocusedRowId);\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.ctrlKey && e.code === 'End') {\n scrollToIndex(flattenedData.length - 1);\n setFocusedRowId(flattenedData[flattenedData.length - 1].uid);\n } else if (e.ctrlKey && e.code === 'Home') {\n scrollToIndex(0, { align: 'center' });\n setFocusedRowId(flattenedData[0].uid);\n }\n },\n [scrollToIndex, setFocusedRowId, flattenedData],\n );\n\n const tableContentWrapperHeight = useMemo(\n () => (isEmptyContent || isLoading ? '100%' : totalSize),\n [isEmptyContent, isLoading, totalSize],\n );\n\n useFreezeVirtualScrollOnDrag(virtualListRef, isHeaderCellDragging);\n\n const trackVirtualListRefAndClientWidth = useCallback(\n (node: HTMLDivElement | null) => {\n virtualListRef.current = node;\n if (node) {\n const { clientWidth } = node;\n // if we don't track this with a non-ref, react will not know some component needs to be re-rendered to apply the new width\n setBodyClientWidth(clientWidth);\n }\n },\n [virtualListRef, setBodyClientWidth],\n );\n\n return (\n <StyledVirtualListWrapper\n innerRef={trackVirtualListRefAndClientWidth}\n data-testid={DATA_TESTID.DATA_TABLE_SCROLLABLE_CONTAINER}\n onKeyDown={onKeyDown}\n tabIndex={-1}\n role=\"rowgroup\"\n gridLayout={gridLayout}\n totalColumnsWidth={totalColumnsWidth}\n headerHeightPx={headerHeightPx}\n aria-busy={isLoading}\n getOwnerProps={getOwnerProps}\n >\n <StyledTableContentWrapper\n height={tableContentWrapperHeight}\n rows={['min-content', 'auto']}\n cols={['100%']}\n getOwnerProps={getOwnerProps}\n >\n <Headers />\n {isEmptyContent && <EmptyContent />}\n {isLoading ? <Loader /> : null}\n {!isLoading && !isEmptyContent && <Rows />}\n </StyledTableContentWrapper>\n </StyledVirtualListWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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AAO,kBAAkB,YAAY,SAAS;AAAA,IAC9C,CAAC,gBAAgB,WAAW,SAAS;AAAA,EACvC;AAEA,wEAA6B,gBAAgB,oBAAoB;AAEjE,QAAM,wCAAoC;AAAA,IACxC,CAAC,SAAgC;AAC/B,qBAAe,UAAU;AACzB,UAAI,MAAM;AACR,cAAM,EAAE,YAAY,IAAI;AAExB,2BAAmB,WAAW;AAAA,MAChC;AAAA,IACF;AAAA,IACA,CAAC,gBAAgB,kBAAkB;AAAA,EACrC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,eAAa,6BAAY;AAAA,MACzB;AAAA,MACA,UAAU;AAAA,MACV,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAW;AAAA,MACX;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,QAAQ;AAAA,UACR,MAAM,CAAC,eAAe,MAAM;AAAA,UAC5B,MAAM,CAAC,MAAM;AAAA,UACb;AAAA,UAEA;AAAA,wDAAC,0BAAQ;AAAA,YACR,kBAAkB,4CAAC,oCAAa;AAAA,YAChC,YAAY,4CAAC,cAAAA,gBAAA,EAAO,IAAK;AAAA,YACzB,CAAC,aAAa,CAAC,kBAAkB,4CAAC,YAAAC,iBAAA,EAAK;AAAA;AAAA;AAAA,MAC1C;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": ["Loader", "Rows"]
|
|
7
7
|
}
|
|
@@ -76,7 +76,7 @@ const defaultProps = () => ({
|
|
|
76
76
|
onRowExpand: () => null,
|
|
77
77
|
onColumnSort: () => null,
|
|
78
78
|
isSkeleton: false,
|
|
79
|
-
domIdAffix: (0, import_uid.uid)(
|
|
79
|
+
domIdAffix: (0, import_uid.uid)(8)
|
|
80
80
|
});
|
|
81
81
|
const DSDataTablePropTypes = {
|
|
82
82
|
...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants2.DSDataTableName, import_constants2.DSDataTableSlots),
|
|
@@ -98,8 +98,12 @@ const DSDataTablePropTypes = {
|
|
|
98
98
|
disableDnD: import_ds_props_helpers.PropTypes.bool.description("Whereas this column should be draggable"),
|
|
99
99
|
canResize: import_ds_props_helpers.PropTypes.bool.description("Whereas this column should be resizable"),
|
|
100
100
|
width: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.string, import_ds_props_helpers.PropTypes.number]).description("Width of this column"),
|
|
101
|
-
minWidth: import_ds_props_helpers.PropTypes.number.description(
|
|
102
|
-
|
|
101
|
+
minWidth: import_ds_props_helpers.PropTypes.number.description(
|
|
102
|
+
"Minimum width this column can be resized down to. Defaults to 30px, which is NOT guaranteed to fit the header title and icon affordances (drag handle / filter / sort) enabled on this column. When isResizeable is used, pass an explicit minWidth sized to the actual header content \u2014 otherwise the resize handle can overlap the header title."
|
|
103
|
+
),
|
|
104
|
+
maxWidth: import_ds_props_helpers.PropTypes.number.description(
|
|
105
|
+
"Maximum width this column can be resized up to, useful when resizing. Defaults to 600px."
|
|
106
|
+
),
|
|
103
107
|
canSort: import_ds_props_helpers.PropTypes.bool.description("Whereas this column is sortable"),
|
|
104
108
|
disableFirstOptionFocusOnFilter: import_ds_props_helpers.PropTypes.bool.description(
|
|
105
109
|
"Whereas the first option should not be focused on filter"
|
|
@@ -119,7 +123,10 @@ const DSDataTablePropTypes = {
|
|
|
119
123
|
alwaysDisplayEditIcon: import_ds_props_helpers.PropTypes.bool.description(
|
|
120
124
|
"Whereas to always show the edit icon on this column if it is editable"
|
|
121
125
|
),
|
|
122
|
-
textWrap: import_ds_props_helpers.PropTypes.oneOf(["wrap", "wrap-all", "truncate"]).description("How to wrap the text in the column")
|
|
126
|
+
textWrap: import_ds_props_helpers.PropTypes.oneOf(["wrap", "wrap-all", "truncate"]).description("How to wrap the text in the column"),
|
|
127
|
+
pillLabel: import_ds_props_helpers.PropTypes.string.description(
|
|
128
|
+
"Overrides the filter pill label text for this column when non-empty; defaults to the column Header"
|
|
129
|
+
)
|
|
123
130
|
})
|
|
124
131
|
).description("Array of columns").isRequired,
|
|
125
132
|
data: import_ds_props_helpers.PropTypes.arrayOf(
|
|
@@ -255,7 +262,7 @@ const DSDataTablePropTypes = {
|
|
|
255
262
|
onNoResultsButtonClick: import_ds_props_helpers.PropTypes.func.description("Function invoked when the no results button is clicked").defaultValue(() => null),
|
|
256
263
|
isSkeleton: import_ds_props_helpers.PropTypes.bool.description("Whether to show a skeleton loader in the datatable"),
|
|
257
264
|
getAriaLabelForRow: import_ds_props_helpers.PropTypes.func.description("Function invoked to determine a row aria-label"),
|
|
258
|
-
domIdAffix: import_ds_props_helpers.PropTypes.string.description("Affix to avoid duplicate ids").defaultValue("
|
|
265
|
+
domIdAffix: import_ds_props_helpers.PropTypes.string.description("Affix to avoid duplicate ids").defaultValue("8 randomly generated characters"),
|
|
259
266
|
checkboxSelectAllProps: import_ds_props_helpers.PropTypes.object.description("Props for the select all checkbox")
|
|
260
267
|
};
|
|
261
268
|
const DSDataTablePropTypesSchema = DSDataTablePropTypes;
|