@elliemae/ds-data-table 3.51.0-next.2 → 3.51.0-next.4
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/addons/Columns/ColumnExpand/ColumnExpand.js +15 -15
- package/dist/cjs/addons/Columns/ColumnExpand/ColumnExpand.js.map +2 -2
- package/dist/cjs/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js +21 -22
- package/dist/cjs/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js.map +2 -2
- package/dist/cjs/addons/Columns/ColumnSelectSingle/ColumnSelectSingle.js +5 -5
- package/dist/cjs/addons/Columns/ColumnSelectSingle/ColumnSelectSingle.js.map +2 -2
- package/dist/cjs/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +3 -3
- package/dist/cjs/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js.map +2 -2
- package/dist/cjs/addons/Editables/DateEditableCell/DateEditableCell.js +2 -2
- package/dist/cjs/addons/Editables/DateEditableCell/DateEditableCell.js.map +2 -2
- package/dist/cjs/addons/Editables/TextEditableCell/TextEditableCell.js +3 -3
- package/dist/cjs/addons/Editables/TextEditableCell/TextEditableCell.js.map +2 -2
- package/dist/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +2 -2
- package/dist/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilter.js.map +2 -2
- package/dist/cjs/addons/Pagination/Pagination.js +5 -5
- package/dist/cjs/addons/Pagination/Pagination.js.map +2 -2
- package/dist/cjs/configs/useStore/createInternalAndPropsContext.js +40 -0
- package/dist/cjs/configs/useStore/createInternalAndPropsContext.js.map +7 -0
- package/dist/cjs/configs/useStore/index.js +5 -4
- package/dist/cjs/configs/useStore/index.js.map +2 -2
- package/dist/cjs/configs/useStore/useStore.js +7 -12
- package/dist/cjs/configs/useStore/useStore.js.map +2 -2
- package/dist/cjs/exported-related/EditableCell.js +4 -4
- package/dist/cjs/exported-related/EditableCell.js.map +2 -2
- package/dist/cjs/exported-related/FilterBar/FilterBarDropdownMenu.js +2 -2
- package/dist/cjs/exported-related/FilterBar/FilterBarDropdownMenu.js.map +2 -2
- package/dist/cjs/exported-related/FilterPopover/index.js +7 -7
- package/dist/cjs/exported-related/FilterPopover/index.js.map +2 -2
- package/dist/cjs/exported-related/FilterPopover/useGetFilterHandlers.js +4 -4
- package/dist/cjs/exported-related/FilterPopover/useGetFilterHandlers.js.map +2 -2
- package/dist/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js +11 -10
- package/dist/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js.map +2 -2
- package/dist/cjs/exported-related/RowRenderer/index.js +6 -6
- package/dist/cjs/exported-related/RowRenderer/index.js.map +2 -2
- package/dist/cjs/exported-related/RowRenderer/useRowRendererHandlers.js +12 -12
- package/dist/cjs/exported-related/RowRenderer/useRowRendererHandlers.js.map +2 -2
- package/dist/cjs/exported-related/RowRenderer/useRowRendererProperties.js +2 -2
- package/dist/cjs/exported-related/RowRenderer/useRowRendererProperties.js.map +2 -2
- package/dist/cjs/exported-related/RowRenderer/useRowStyle.js +2 -2
- package/dist/cjs/exported-related/RowRenderer/useRowStyle.js.map +2 -2
- package/dist/cjs/exported-related/Toolbar/Toolbar.js +6 -6
- package/dist/cjs/exported-related/Toolbar/Toolbar.js.map +2 -2
- package/dist/cjs/parts/Cells/Cell.js +17 -11
- package/dist/cjs/parts/Cells/Cell.js.map +2 -2
- package/dist/cjs/parts/Cells/CellFactory.js +11 -11
- package/dist/cjs/parts/Cells/CellFactory.js.map +2 -2
- package/dist/cjs/parts/Cells/index.js +2 -2
- package/dist/cjs/parts/Cells/index.js.map +2 -2
- package/dist/cjs/parts/Cells/useCellStyle.js +3 -3
- package/dist/cjs/parts/Cells/useCellStyle.js.map +2 -2
- package/dist/cjs/parts/DnDHandle.js +5 -5
- package/dist/cjs/parts/DnDHandle.js.map +2 -2
- package/dist/cjs/parts/DropIndicator.js +4 -4
- package/dist/cjs/parts/DropIndicator.js.map +2 -2
- package/dist/cjs/parts/EmptyContent.js +10 -10
- package/dist/cjs/parts/EmptyContent.js.map +2 -2
- package/dist/cjs/parts/FilterBar/FiltersBar.js +7 -7
- package/dist/cjs/parts/FilterBar/FiltersBar.js.map +2 -2
- package/dist/cjs/parts/Filters/index.js +5 -5
- package/dist/cjs/parts/Filters/index.js.map +2 -2
- package/dist/cjs/parts/Headers/EmptyChildrenGroup.js +2 -2
- package/dist/cjs/parts/Headers/EmptyChildrenGroup.js.map +2 -2
- package/dist/cjs/parts/Headers/HeaderCell.js +13 -13
- package/dist/cjs/parts/Headers/HeaderCell.js.map +2 -2
- package/dist/cjs/parts/Headers/HeaderCellGroup.js +10 -10
- package/dist/cjs/parts/Headers/HeaderCellGroup.js.map +2 -2
- package/dist/cjs/parts/Headers/HeaderResizer.js +2 -2
- package/dist/cjs/parts/Headers/HeaderResizer.js.map +2 -2
- package/dist/cjs/parts/Headers/index.js +8 -8
- package/dist/cjs/parts/Headers/index.js.map +2 -2
- package/dist/cjs/parts/Headers/useHeaderCellConfig.js +4 -4
- package/dist/cjs/parts/Headers/useHeaderCellConfig.js.map +2 -2
- package/dist/cjs/parts/Headers/useHeaderCellHandlers.js +7 -7
- package/dist/cjs/parts/Headers/useHeaderCellHandlers.js.map +2 -2
- package/dist/cjs/parts/Headers/useHeaderResizer.js +8 -8
- package/dist/cjs/parts/Headers/useHeaderResizer.js.map +2 -2
- package/dist/cjs/parts/HoC/DnDGroupContext.js +39 -0
- package/dist/cjs/parts/HoC/DnDGroupContext.js.map +7 -0
- package/dist/cjs/parts/HoC/withConditionalDnDColumnContext.js +10 -12
- package/dist/cjs/parts/HoC/withConditionalDnDColumnContext.js.map +2 -2
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +10 -10
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
- package/dist/cjs/parts/HoC/withConditionalDnDSortableContext.js +2 -2
- package/dist/cjs/parts/HoC/withConditionalDnDSortableContext.js.map +2 -2
- package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js +6 -6
- package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js.map +2 -2
- package/dist/cjs/parts/HoC/withDnDSortableRowContext.js +3 -3
- package/dist/cjs/parts/HoC/withDnDSortableRowContext.js.map +2 -2
- package/dist/cjs/parts/Loader.js +4 -4
- package/dist/cjs/parts/Loader.js.map +2 -2
- package/dist/cjs/parts/MainContent.js +5 -5
- package/dist/cjs/parts/MainContent.js.map +2 -2
- package/dist/cjs/parts/Row.js +7 -7
- package/dist/cjs/parts/Row.js.map +2 -2
- package/dist/cjs/parts/RowVariants/RowVariantHeader.js +8 -7
- package/dist/cjs/parts/RowVariants/RowVariantHeader.js.map +2 -2
- package/dist/cjs/parts/RowVariants/index.js +2 -2
- package/dist/cjs/parts/RowVariants/index.js.map +2 -2
- package/dist/cjs/parts/Rows.js +7 -7
- package/dist/cjs/parts/Rows.js.map +2 -2
- package/dist/cjs/parts/TableContent.js +13 -13
- package/dist/cjs/parts/TableContent.js.map +2 -2
- package/dist/cjs/parts/VirtualRowsList.js +12 -12
- package/dist/cjs/parts/VirtualRowsList.js.map +2 -2
- package/dist/cjs/types/FunctionalHoC.js.map +1 -1
- package/dist/esm/addons/Columns/ColumnExpand/ColumnExpand.js +1 -1
- package/dist/esm/addons/Columns/ColumnExpand/ColumnExpand.js.map +1 -1
- package/dist/esm/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js +2 -3
- package/dist/esm/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js.map +2 -2
- package/dist/esm/addons/Columns/ColumnSelectSingle/ColumnSelectSingle.js +1 -1
- package/dist/esm/addons/Columns/ColumnSelectSingle/ColumnSelectSingle.js.map +1 -1
- package/dist/esm/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +1 -1
- package/dist/esm/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js.map +1 -1
- package/dist/esm/addons/Editables/DateEditableCell/DateEditableCell.js +1 -1
- package/dist/esm/addons/Editables/DateEditableCell/DateEditableCell.js.map +1 -1
- package/dist/esm/addons/Editables/TextEditableCell/TextEditableCell.js +1 -1
- package/dist/esm/addons/Editables/TextEditableCell/TextEditableCell.js.map +1 -1
- package/dist/esm/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +1 -1
- package/dist/esm/addons/Filters/Components/SelectFilter/BaseSelectFilter.js.map +1 -1
- package/dist/esm/addons/Pagination/Pagination.js +1 -1
- package/dist/esm/addons/Pagination/Pagination.js.map +1 -1
- package/dist/esm/configs/useStore/createInternalAndPropsContext.js +10 -0
- package/dist/esm/configs/useStore/createInternalAndPropsContext.js.map +7 -0
- package/dist/esm/configs/useStore/index.js +2 -1
- package/dist/esm/configs/useStore/index.js.map +2 -2
- package/dist/esm/configs/useStore/useStore.js +1 -6
- package/dist/esm/configs/useStore/useStore.js.map +2 -2
- package/dist/esm/exported-related/EditableCell.js +3 -3
- package/dist/esm/exported-related/EditableCell.js.map +2 -2
- package/dist/esm/exported-related/FilterBar/FilterBarDropdownMenu.js +1 -1
- package/dist/esm/exported-related/FilterBar/FilterBarDropdownMenu.js.map +1 -1
- package/dist/esm/exported-related/FilterPopover/index.js +5 -5
- package/dist/esm/exported-related/FilterPopover/index.js.map +2 -2
- package/dist/esm/exported-related/FilterPopover/useGetFilterHandlers.js +1 -1
- package/dist/esm/exported-related/FilterPopover/useGetFilterHandlers.js.map +2 -2
- package/dist/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js +4 -3
- package/dist/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js.map +2 -2
- package/dist/esm/exported-related/RowRenderer/index.js +4 -4
- package/dist/esm/exported-related/RowRenderer/index.js.map +2 -2
- package/dist/esm/exported-related/RowRenderer/useRowRendererHandlers.js +1 -1
- package/dist/esm/exported-related/RowRenderer/useRowRendererHandlers.js.map +2 -2
- package/dist/esm/exported-related/RowRenderer/useRowRendererProperties.js +1 -1
- package/dist/esm/exported-related/RowRenderer/useRowRendererProperties.js.map +2 -2
- package/dist/esm/exported-related/RowRenderer/useRowStyle.js +1 -1
- package/dist/esm/exported-related/RowRenderer/useRowStyle.js.map +2 -2
- package/dist/esm/exported-related/Toolbar/Toolbar.js +5 -5
- package/dist/esm/exported-related/Toolbar/Toolbar.js.map +2 -2
- package/dist/esm/parts/Cells/Cell.js +14 -8
- package/dist/esm/parts/Cells/Cell.js.map +2 -2
- package/dist/esm/parts/Cells/CellFactory.js +6 -6
- package/dist/esm/parts/Cells/CellFactory.js.map +2 -2
- package/dist/esm/parts/Cells/index.js +1 -1
- package/dist/esm/parts/Cells/index.js.map +2 -2
- package/dist/esm/parts/Cells/useCellStyle.js +2 -2
- package/dist/esm/parts/Cells/useCellStyle.js.map +2 -2
- package/dist/esm/parts/DnDHandle.js +5 -5
- package/dist/esm/parts/DnDHandle.js.map +2 -2
- package/dist/esm/parts/DropIndicator.js +3 -3
- package/dist/esm/parts/DropIndicator.js.map +2 -2
- package/dist/esm/parts/EmptyContent.js +4 -4
- package/dist/esm/parts/EmptyContent.js.map +2 -2
- package/dist/esm/parts/FilterBar/FiltersBar.js +1 -1
- package/dist/esm/parts/FilterBar/FiltersBar.js.map +1 -1
- package/dist/esm/parts/Filters/index.js +6 -6
- package/dist/esm/parts/Filters/index.js.map +2 -2
- package/dist/esm/parts/Headers/EmptyChildrenGroup.js +1 -1
- package/dist/esm/parts/Headers/EmptyChildrenGroup.js.map +2 -2
- package/dist/esm/parts/Headers/HeaderCell.js +1 -1
- package/dist/esm/parts/Headers/HeaderCell.js.map +1 -1
- package/dist/esm/parts/Headers/HeaderCellGroup.js +7 -7
- package/dist/esm/parts/Headers/HeaderCellGroup.js.map +2 -2
- package/dist/esm/parts/Headers/HeaderResizer.js +1 -1
- package/dist/esm/parts/Headers/HeaderResizer.js.map +1 -1
- package/dist/esm/parts/Headers/index.js +1 -1
- package/dist/esm/parts/Headers/index.js.map +1 -1
- package/dist/esm/parts/Headers/useHeaderCellConfig.js +1 -1
- package/dist/esm/parts/Headers/useHeaderCellConfig.js.map +1 -1
- package/dist/esm/parts/Headers/useHeaderCellHandlers.js +1 -1
- package/dist/esm/parts/Headers/useHeaderCellHandlers.js.map +1 -1
- package/dist/esm/parts/Headers/useHeaderResizer.js +5 -5
- package/dist/esm/parts/Headers/useHeaderResizer.js.map +2 -2
- package/dist/esm/parts/HoC/DnDGroupContext.js +9 -0
- package/dist/esm/parts/HoC/DnDGroupContext.js.map +7 -0
- package/dist/esm/parts/HoC/withConditionalDnDColumnContext.js +7 -9
- package/dist/esm/parts/HoC/withConditionalDnDColumnContext.js.map +2 -2
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +4 -4
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
- package/dist/esm/parts/HoC/withConditionalDnDSortableContext.js +1 -1
- package/dist/esm/parts/HoC/withConditionalDnDSortableContext.js.map +2 -2
- package/dist/esm/parts/HoC/withDnDSortableColumnContext.js +4 -4
- package/dist/esm/parts/HoC/withDnDSortableColumnContext.js.map +2 -2
- package/dist/esm/parts/HoC/withDnDSortableRowContext.js +2 -2
- package/dist/esm/parts/HoC/withDnDSortableRowContext.js.map +2 -2
- package/dist/esm/parts/Loader.js +3 -3
- package/dist/esm/parts/Loader.js.map +2 -2
- package/dist/esm/parts/MainContent.js +1 -1
- package/dist/esm/parts/MainContent.js.map +1 -1
- package/dist/esm/parts/Row.js +3 -3
- package/dist/esm/parts/Row.js.map +2 -2
- package/dist/esm/parts/RowVariants/RowVariantHeader.js +5 -4
- package/dist/esm/parts/RowVariants/RowVariantHeader.js.map +2 -2
- package/dist/esm/parts/RowVariants/index.js +1 -1
- package/dist/esm/parts/RowVariants/index.js.map +2 -2
- package/dist/esm/parts/Rows.js +4 -4
- package/dist/esm/parts/Rows.js.map +2 -2
- package/dist/esm/parts/TableContent.js +3 -3
- package/dist/esm/parts/TableContent.js.map +2 -2
- package/dist/esm/parts/VirtualRowsList.js +5 -5
- package/dist/esm/parts/VirtualRowsList.js.map +2 -2
- package/dist/types/configs/useStore/createInternalAndPropsContext.d.ts +15 -0
- package/dist/types/configs/useStore/index.d.ts +2 -1
- package/dist/types/configs/useStore/useStore.d.ts +0 -13
- package/dist/types/exported-related/RowRenderer/index.d.ts +1 -1
- package/dist/types/parts/Cells/useCellStyle.d.ts +1 -1
- package/dist/types/parts/Headers/index.d.ts +1 -1
- package/dist/types/parts/HoC/DnDGroupContext.d.ts +3 -0
- package/dist/types/parts/HoC/withConditionalDnDColumnContext.d.ts +1 -4
- package/dist/types/parts/HoC/withConditionalDnDSortableContext.d.ts +1 -1
- package/dist/types/parts/Loader.d.ts +2 -2
- package/dist/types/parts/Rows.d.ts +1 -1
- package/dist/types/types/FunctionalHoC.d.ts +1 -1
- package/package.json +28 -28
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { useCallback, useMemo, useState } from "react";
|
|
3
2
|
import { cloneDeep } from "lodash";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
|
|
4
5
|
import {
|
|
5
|
-
getGridLayout,
|
|
6
6
|
changeGridLayout,
|
|
7
|
+
getGridLayout,
|
|
7
8
|
removeGridLayout,
|
|
8
9
|
setSubColumnsGridLayout
|
|
9
10
|
} from "../../helpers/gridLayoutHelpers.js";
|
|
10
|
-
import { usePropsStore } from "../../configs/useStore/useStore.js";
|
|
11
11
|
const narrow = (value, min, max) => Math.min(Math.max(value, min ?? 30), max ?? Infinity);
|
|
12
12
|
const getCorrectDelta = (e) => {
|
|
13
13
|
let multiplier = 1;
|
|
@@ -63,7 +63,7 @@ const useHeaderResizer = ({
|
|
|
63
63
|
}, [pushColumnSizeChange, virtualListRef, realColumnIndex]);
|
|
64
64
|
const onResizeHandler = useCallback(
|
|
65
65
|
(e) => {
|
|
66
|
-
if (realColumnIndex
|
|
66
|
+
if (realColumnIndex === -1) return;
|
|
67
67
|
const delta = ("clientX" in e ? e.clientX : e.touches[0].clientX) - (innerRef.current?.getBoundingClientRect().x ?? 0);
|
|
68
68
|
const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];
|
|
69
69
|
const widthWithDelta = narrow(
|
|
@@ -80,7 +80,7 @@ const useHeaderResizer = ({
|
|
|
80
80
|
);
|
|
81
81
|
const handleKeyboardResize = useCallback(
|
|
82
82
|
(e) => {
|
|
83
|
-
if (realColumnIndex
|
|
83
|
+
if (realColumnIndex === -1) return;
|
|
84
84
|
if (e.key === "Enter") {
|
|
85
85
|
e.stopPropagation();
|
|
86
86
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Headers/useHeaderResizer.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,SAAS,gBAAgB;AAC/C,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { cloneDeep } from 'lodash';\nimport { 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 ?? 30), max ?? Infinity);\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\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 // 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 === visibleColumnsCopy[realColumnIndex].width) return;\n onColumnResize?.(columnId, nextWidth);\n // this next line is updating also the visibleColumnsCopy\n visibleColumnsOnGridLayout[realColumnIndex].width = nextWidth;\n onColumnSizeChange(visibleColumnsCopy, columnId, nextWidth);\n },\n [columnId, onColumnResize, onColumnSizeChange, realColumnIndex, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n const onResizeStart = useCallback(() => {\n setIsResizing(true);\n }, []);\n\n const onResizeEnd = useCallback(() => {\n setIsResizing(false);\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex]);\n removeGridLayout(virtualListRef.current);\n }, [pushColumnSizeChange, virtualListRef, realColumnIndex]);\n\n // Mouse resize\n const onResizeHandler = useCallback(\n (e: MouseEvent | TouchEvent) => {\n if (realColumnIndex === -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)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\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 [realColumnIndex, innerRef, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n // Keyboard resize\n const handleKeyboardResize = useCallback(\n (e: React.KeyboardEvent) => {\n if (realColumnIndex === -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)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex] + delta);\n removeGridLayout(virtualListRef.current);\n },\n [pushColumnSizeChange, realColumnIndex, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n return {\n isResizing,\n onResizeStart,\n onResizeEnd,\n onResizeHandler,\n handleKeyboardResize,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS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ACpB;AAEA,UAAI,EAAE,SAAS,eAAe,EAAE,SAAS,cAAc;AACrD,UAAE,eAAe;AAAA,MACnB;AAEA,YAAM,QAAQ,gBAAgB,CAAC;AAE/B,UAAI,UAAU,EAAG;AAEjB,YAAM,gBAAgB,cAAc,eAAe,OAAO,EAAE,eAAe;AAE3E,YAAM,iBAAiB;AAAA,QACrB,gBAAgB;AAAA,QAChB,2BAA2B,eAAe,EAAE;AAAA,QAC5C,2BAA2B,eAAe,EAAE;AAAA,MAC9C;AAEA,uBAAiB,eAAe,SAAS,iBAAiB,cAAc;AACxE,8BAAwB,eAAe,SAAS,kBAAkB;AAElE,2BAAqB,cAAc,eAAe,OAAO,EAAE,eAAe,IAAI,KAAK;AACnF,uBAAiB,eAAe,OAAO;AAAA,IACzC;AAAA,IACA,CAAC,sBAAsB,iBAAiB,gBAAgB,oBAAoB,0BAA0B;AAAA,EACxG;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/DnDGroupContext.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport type { DnDGroupContextType } from './withConditionalDnDColumnContext.js';\n\nexport const DnDGroupContext = createContext<DnDGroupContextType>({\n activeIndex: null,\n});\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB;AAGvB,MAAM,kBAAkB,cAAmC;AAAA,EAChE,aAAa;AACf,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useCallback, useMemo } from "react";
|
|
4
3
|
import {
|
|
5
|
-
restrictToFirstScrollableAncestor,
|
|
6
4
|
DndContext,
|
|
7
5
|
DragOverlay,
|
|
8
6
|
arrayMove,
|
|
7
|
+
restrictToFirstScrollableAncestor,
|
|
9
8
|
useHierarchyDndkitConfig
|
|
10
9
|
} from "@elliemae/ds-drag-and-drop";
|
|
11
|
-
import {
|
|
10
|
+
import { useCallback, useMemo } from "react";
|
|
12
11
|
import { INTERNAL_COLUMNS } from "../../addons/Columns/index.js";
|
|
13
|
-
import { usePropsStore } from "../../configs/useStore/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
12
|
+
import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
|
|
13
|
+
import { HeaderCellGroup } from "../Headers/HeaderCellGroup.js";
|
|
14
|
+
import { DnDGroupContext } from "./DnDGroupContext.js";
|
|
17
15
|
const flattenColumns = (cols) => {
|
|
18
16
|
const augmentedColumns = [];
|
|
19
17
|
const flatten = (col, index, parentId = null) => {
|
|
@@ -64,15 +62,15 @@ const withConditionalDnDColumnContext = (Component) => function(props) {
|
|
|
64
62
|
() => activeId ? flattenedItems.find((item) => item.uid === activeId)?.original : null,
|
|
65
63
|
[activeId, flattenedItems]
|
|
66
64
|
);
|
|
65
|
+
const DnDGroupContextVal = useMemo(() => ({ activeIndex }), [activeIndex]);
|
|
67
66
|
if (dragAndDropColumns)
|
|
68
67
|
return /* @__PURE__ */ jsxs(DndContext, { ...dndContextProps, children: [
|
|
69
|
-
/* @__PURE__ */ jsx(DnDGroupContext.Provider, { value:
|
|
68
|
+
/* @__PURE__ */ jsx(DnDGroupContext.Provider, { value: DnDGroupContextVal, children: /* @__PURE__ */ jsx(Component, { ...props }) }),
|
|
70
69
|
/* @__PURE__ */ jsx(DragOverlay, { modifiers: [restrictToFirstScrollableAncestor], children: activeId ? /* @__PURE__ */ jsx(HeaderCellGroup, { header: dragOverlayCol, isDragOverlay: true }) : null })
|
|
71
70
|
] });
|
|
72
71
|
return /* @__PURE__ */ jsx(Component, { ...props });
|
|
73
72
|
};
|
|
74
73
|
export {
|
|
75
|
-
DnDGroupContext,
|
|
76
74
|
withConditionalDnDColumnContext
|
|
77
75
|
};
|
|
78
76
|
//# sourceMappingURL=withConditionalDnDColumnContext.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDColumnContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-underscore-dangle */\n/* eslint-disable max-params */\nimport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-underscore-dangle */\n/* eslint-disable max-params */\nimport {\n DndContext,\n DragOverlay,\n arrayMove,\n restrictToFirstScrollableAncestor,\n useHierarchyDndkitConfig,\n type DnDKitHierarchy,\n} from '@elliemae/ds-drag-and-drop';\nimport { useCallback, useMemo } from 'react';\nimport { INTERNAL_COLUMNS } from '../../addons/Columns/index.js';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC.js';\nimport { HeaderCellGroup } from '../Headers/HeaderCellGroup.js';\nimport { DnDGroupContext } from './DnDGroupContext.js';\n\nexport type DnDGroupContextType = {\n activeIndex: number | null;\n};\n\nconst flattenColumns = (cols: DSDataTableT.InternalColumn[]): DnDKitHierarchy.Item<DSDataTableT.InternalColumn>[] => {\n const augmentedColumns = [] as DnDKitHierarchy.Item<DSDataTableT.InternalColumn>[];\n const flatten = (col: DSDataTableT.InternalColumn, index: number, parentId: string | null = null) => {\n const { id } = col;\n augmentedColumns.push({ uid: id, parentId, realIndex: index, original: col });\n if (col.columns)\n col.columns.forEach((subColumn: DSDataTableT.InternalColumn, childIndex: number) =>\n flatten(subColumn, childIndex, id),\n );\n };\n cols.forEach((col, index) => flatten(col, index));\n return augmentedColumns;\n};\n\n// only wraps in \"DnDContext\" and \"DnDGroupContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDColumnContext: FunctionalHOC = (Component) =>\n function (props) {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const onColumnsReorder = usePropsStore((state) => state.onColumnsReorder);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n\n const flattenedItems = useMemo(() => flattenColumns(visibleColumns), [visibleColumns]);\n\n const onReorder: DnDKitHierarchy.OnReorder<DSDataTableT.InternalColumn> = useCallback(\n (movedItem, indexes) => {\n // Send from index to target index\n const newFlattenedData = arrayMove(flattenedItems, indexes.fromIndex, indexes.targetIndex);\n // Pull the cols's data into an object\n const nodes: Record<string, DSDataTableT.InternalColumn> = {};\n newFlattenedData.forEach(({ original: colData, ...dndData }) => {\n delete colData.columns;\n nodes[dndData.uid] = colData;\n });\n const newData = [] as DSDataTableT.Column[];\n newFlattenedData.forEach(({ original: colData, ...dndData }) => {\n // Don't send internal columns to the user\n if (INTERNAL_COLUMNS.includes(dndData.uid as string)) {\n return;\n }\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (dndData.parentId) {\n const parentNode = nodes[dndData.parentId];\n if (parentNode.columns) parentNode.columns.push(colData);\n else parentNode.columns = [colData];\n } else newData.push(colData);\n });\n onColumnsReorder(newData, indexes);\n },\n [flattenedItems, onColumnsReorder],\n );\n\n const { dndContextProps, activeId, activeIndex } = useHierarchyDndkitConfig({\n flattenedItems,\n isHorizontalDnD: true,\n onReorder,\n });\n\n const dragOverlayCol = useMemo(\n () => (activeId ? flattenedItems.find((item) => item.uid === activeId)?.original : null),\n [activeId, flattenedItems],\n );\n const DnDGroupContextVal = useMemo(() => ({ activeIndex }), [activeIndex]);\n\n if (dragAndDropColumns)\n return (\n <DndContext {...dndContextProps}>\n <DnDGroupContext.Provider value={DnDGroupContextVal}>\n <Component {...props} />\n </DnDGroupContext.Provider>\n <DragOverlay modifiers={[restrictToFirstScrollableAncestor]}>\n {activeId ? <HeaderCellGroup header={dragOverlayCol as DSDataTableT.InternalColumn} isDragOverlay /> : null}\n </DragOverlay>\n </DndContext>\n );\n return <Component {...props} />;\n };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACwFf,SAEI,KAFJ;AAtFR;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,aAAa,eAAe;AACrC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAG9B,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAMhC,MAAM,iBAAiB,CAAC,SAA6F;AACnH,QAAM,mBAAmB,CAAC;AAC1B,QAAM,UAAU,CAAC,KAAkC,OAAe,WAA0B,SAAS;AACnG,UAAM,EAAE,GAAG,IAAI;AACf,qBAAiB,KAAK,EAAE,KAAK,IAAI,UAAU,WAAW,OAAO,UAAU,IAAI,CAAC;AAC5E,QAAI,IAAI;AACN,UAAI,QAAQ;AAAA,QAAQ,CAAC,WAAwC,eAC3D,QAAQ,WAAW,YAAY,EAAE;AAAA,MACnC;AAAA,EACJ;AACA,OAAK,QAAQ,CAAC,KAAK,UAAU,QAAQ,KAAK,KAAK,CAAC;AAChD,SAAO;AACT;AAGO,MAAM,kCAAiD,CAAC,cAC7D,SAAU,OAAO;AACf,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,mBAAmB,cAAc,CAAC,UAAU,MAAM,gBAAgB;AACxE,QAAM,iBAAiB,cAAc,CAAC,UAAU,MAAM,cAAc;AAEpE,QAAM,iBAAiB,QAAQ,MAAM,eAAe,cAAc,GAAG,CAAC,cAAc,CAAC;AAErF,QAAM,YAAoE;AAAA,IACxE,CAAC,WAAW,YAAY;AAEtB,YAAM,mBAAmB,UAAU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oBAAC,aAAW,GAAG,OAAO;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useMemo } from "react";
|
|
4
3
|
import {
|
|
5
4
|
DndContext,
|
|
6
5
|
DragOverlay,
|
|
7
6
|
SortableContext,
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
restrictToFirstScrollableAncestor,
|
|
8
|
+
useTreeDndkitConfig
|
|
10
9
|
} from "@elliemae/ds-drag-and-drop";
|
|
10
|
+
import { useCallback, useMemo } from "react";
|
|
11
11
|
import { createPortal } from "react-dom";
|
|
12
|
+
import { useInternalStore, usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
|
|
12
13
|
import { Row } from "../Row.js";
|
|
13
14
|
import { DnDTreeContext } from "./DnDTreeContext.js";
|
|
14
|
-
import { usePropsStore, useInternalStore } from "../../configs/useStore/useStore.js";
|
|
15
15
|
const withConditionalDnDRowContext = (Component) => (props) => {
|
|
16
16
|
const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);
|
|
17
17
|
const isExpandable = usePropsStore((state) => state.isExpandable);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDRowContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;AC2GjB,SAGM,KAHN;AA1GN
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport {\n DndContext,\n DragOverlay,\n SortableContext,\n restrictToFirstScrollableAncestor,\n useTreeDndkitConfig,\n type DnDKitTree,\n} from '@elliemae/ds-drag-and-drop';\nimport { useCallback, useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC.js';\nimport { Row } from '../Row.js';\nimport { DnDTreeContext } from './DnDTreeContext.js';\n\n// only wraps in \"DnDContext\" and \"DnDTreeContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDRowContext: FunctionalHOC = (Component) => (props) => {\n const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);\n const isExpandable = usePropsStore((state) => state.isExpandable);\n const onRowsReorder = usePropsStore((state) => state.onRowsReorder);\n const maxDragAndDropLevel = usePropsStore((state) => state.maxDragAndDropLevel);\n const getIsDropValid = usePropsStore((state) => state.getIsDropValid);\n const flattenedData = usePropsStore((state) => state.flattenedData);\n const allDataFlattened = usePropsStore((state) => state.allDataFlattened);\n const setDrilldownRowId = useInternalStore((state) => state.setDrilldownRowId);\n\n const onReorder: DnDKitTree.OnReorder<DSDataTableT.Row> = useCallback(\n (_active, targetIndex, { movedData, fromIndex, considerExpanding }) => {\n const rootMovedData = movedData.root;\n // Pull the row's original data into an object\n const nodes: Record<string, DSDataTableT.Row> = {};\n rootMovedData.forEach((row) => {\n if (row.original.subRows) delete row.original.subRows;\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [] as DSDataTableT.Row[];\n rootMovedData.forEach((row) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (row.parentId) {\n const parentNode = nodes[row.parentId];\n if (parentNode?.subRows) parentNode.subRows.push(row.original);\n else parentNode.subRows = [row.original];\n } else newUserData.push(row.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onRowsReorder(newUserData, { targetIndex, fromIndex }, considerExpanding as string | null, {\n flattenedData,\n allDataFlattened,\n });\n setDrilldownRowId(_active.uid.toString()); // we restore the drilldown row id which was set null during the blur event on dragging\n },\n [allDataFlattened, flattenedData, onRowsReorder, setDrilldownRowId],\n );\n\n const theFlattenedItems = useMemo(\n () => allDataFlattened.map((datum) => ({ ...datum, collapsed: !datum.isExpanded, subitems: [] })),\n [allDataFlattened],\n );\n\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } = useTreeDndkitConfig({\n flattenedItems: theFlattenedItems,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid,\n });\n\n const containerSortableContextProps = sortableContextProps.root;\n\n const visibleItems = useMemo(() => {\n // active in this case is the row that is being dragged\n // if no drag is happening, return the flattened data as is\n if (!active) return flattenedData;\n // if a drag is happening, exclude the children of the dragged row\n // this is a design choice, this way the user can't drag a parent row into one of it's children.\n const excludeParentIds = [active.id];\n return flattenedData.filter((datum) => {\n const isParentExcluded = datum.parentId !== null && excludeParentIds.includes(datum.parentId);\n if (isParentExcluded) {\n excludeParentIds.push(datum.uid);\n return false;\n }\n return true;\n });\n }, [active, flattenedData]);\n\n const ctx = useMemo(\n () => ({\n visibleItems,\n dropIndicatorPosition,\n isDropValid,\n }),\n [visibleItems, dropIndicatorPosition, isDropValid],\n );\n\n const dragOverlayRow = useMemo(\n () => (active ? flattenedData.find((row) => row.uid === active.id) : null),\n [active, flattenedData],\n );\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...containerSortableContextProps}>\n <DnDTreeContext.Provider value={ctx}>\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }} modifiers={[restrictToFirstScrollableAncestor]}>\n {active ? <Row row={dragOverlayRow as DSDataTableT.InternalRow} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC2GjB,SAGM,KAHN;AA1GN;AAAA,EACE;AAAA,EACA;AAAA,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+BACnB,8BAAC,eAAe,UAAf,EAAwB,OAAO,KAC9B,8BAAC,aAAW,GAAG,OAAO,GACxB,GACF;AAAA,MACC;AAAA,QACC,oBAAC,eAAY,OAAO,EAAE,OAAO,OAAO,GAAG,WAAW,CAAC,iCAAiC,GACjF,mBAAS,oBAAC,OAAI,KAAK,gBAA4C,eAAa,MAAC,IAAK,MACrF;AAAA,QACA,SAAS;AAAA,MACX;AAAA,OACF;AAEJ,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { horizontalListSortingStrategy, SortableContext } from "@elliemae/ds-drag-and-drop";
|
|
4
|
-
import { usePropsStore } from "../../configs/useStore/
|
|
4
|
+
import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
|
|
5
5
|
const withConditionalDnDSortableContext = (Component) => (props) => {
|
|
6
6
|
const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);
|
|
7
7
|
const { isDragOverlay, items } = props;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDSortableContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport { horizontalListSortingStrategy, SortableContext } from '@elliemae/ds-drag-and-drop';\nimport React from 'react';\nimport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACuBb;AAtBV,SAAS,+BAA+B,uBAAuB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport { horizontalListSortingStrategy, SortableContext } from '@elliemae/ds-drag-and-drop';\nimport React from 'react';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\n\ninterface Props {\n items: DSDataTableT.InternalColumn[];\n isDragOverlay: boolean;\n}\n\nexport const withConditionalDnDSortableContext =\n <T,>(Component: React.ComponentType<T>) =>\n (props: T & React.JSX.IntrinsicAttributes & Props) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n\n const { isDragOverlay, items } = props;\n\n // Only add the context if it's not a dragOverlay and dnd for cols was requested\n // It's important that drag overlays DO NOT have any sortable functionality!\n if (!isDragOverlay && dragAndDropColumns)\n return (\n <SortableContext items={items.map((item) => item.id)} strategy={horizontalListSortingStrategy}>\n <Component {...props} />\n </SortableContext>\n );\n\n return <Component {...props} />;\n };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACuBb;AAtBV,SAAS,+BAA+B,uBAAuB;AAE/D,SAAS,qBAAqB;AAQvB,MAAM,oCACX,CAAK,cACL,CAAC,UAAqD;AACpD,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAE5E,QAAM,EAAE,eAAe,MAAM,IAAI;AAIjC,MAAI,CAAC,iBAAiB;AACpB,WACE,oBAAC,mBAAgB,OAAO,MAAM,IAAI,CAAC,SAAS,KAAK,EAAE,GAAG,UAAU,+BAC9D,8BAAC,aAAW,GAAG,OAAO,GACxB;AAGJ,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext, useMemo } from "react";
|
|
4
3
|
import { useSortable } from "@elliemae/ds-drag-and-drop";
|
|
5
|
-
import {
|
|
6
|
-
import { SortableItemContext } from "./SortableItemContext.js";
|
|
4
|
+
import { useContext, useMemo } from "react";
|
|
7
5
|
import { DropIndicatorPosition } from "../../configs/constants.js";
|
|
8
|
-
import { usePropsStore } from "../../configs/useStore/
|
|
6
|
+
import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
|
|
7
|
+
import { SortableItemContext } from "./SortableItemContext.js";
|
|
8
|
+
import { DnDGroupContext } from "./DnDGroupContext.js";
|
|
9
9
|
const withDnDSortableColumnContext = (Component) => (props) => {
|
|
10
10
|
const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);
|
|
11
11
|
const { activeIndex } = useContext(DnDGroupContext);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withDnDSortableColumnContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACoDf;AAnDR,SAAgB,YAAY,eAAe;AAC3C,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport React, { useContext, useMemo } from 'react';\nimport { DropIndicatorPosition } from '../../configs/constants.js';\nimport { 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 { 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 // 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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoDf;AAnDR,SAAS,mBAAmB;AAC5B,SAAgB,YAAY,eAAe;AAC3C,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAG9B,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAEzB,MAAM,+BACX,CAAoD,cACpD,CAAC,UAAa;AACZ,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,EAAE,YAAY,IAAI,WAAW,eAAe;AAGlD,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,MAAM,OAAO;AAAA,IACnB;AAAA,IACA,CAAC,MAAM,OAAO,EAAE;AAAA,EAClB;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAA+C,QAAQ,MAAM;AACjE,QAAI,CAAC,mBAAoB,QAAO;AAEhC,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc,SAAS,cAAc;AAAA,MACtE,uBACE,eAAe,QAAQ,cAAc,sBAAsB,QAAQ,sBAAsB;AAAA,MAC3F,aAAa;AAAA,IACf;AAAA,EACF,GAAG,CAAC,oBAAoB,oBAAoB,WAAW,CAAC;AAIxD,QAAM,MAA+B;AAAA,IACnC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SACE,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,KACnC,8BAAC,aAAW,GAAG,OAAO,GACxB;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext, useMemo } from "react";
|
|
4
3
|
import { useSortable } from "@elliemae/ds-drag-and-drop";
|
|
4
|
+
import { useContext, useMemo } from "react";
|
|
5
|
+
import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
|
|
5
6
|
import { DnDTreeContext } from "./DnDTreeContext.js";
|
|
6
7
|
import { SortableItemContext } from "./SortableItemContext.js";
|
|
7
|
-
import { usePropsStore } from "../../configs/useStore/useStore.js";
|
|
8
8
|
const withDnDSortableRowContext = (Component) => function(props) {
|
|
9
9
|
const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);
|
|
10
10
|
const { dropIndicatorPosition, isDropValid } = useContext(DnDTreeContext);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withDnDSortableRowContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable func-names */\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport React, { useContext, useMemo } from 'react';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { DnDTreeContext } from './DnDTreeContext.js';\nimport type { SortableItemContextType } from './SortableItemContext.js';\nimport { SortableItemContext } from './SortableItemContext.js';\n\nexport const withDnDSortableRowContext = <T extends { row: DSDataTableT.InternalRow }>(\n Component: React.ComponentType<T>,\n) =>\n function (props: T) {\n const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);\n const { dropIndicatorPosition, isDropValid } = useContext(DnDTreeContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.row.uid,\n }),\n [props.row],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!dragAndDropRows) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition,\n isDropValid,\n };\n }, [dragAndDropRows, useSortableHelpers, dropIndicatorPosition, isDropValid]);\n\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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoDf;AAnDR,SAAS,mBAAmB;AAC5B,SAAgB,YAAY,eAAe;AAC3C,SAAS,qBAAqB;AAE9B,SAAS,sBAAsB;AAE/B,SAAS,2BAA2B;AAE7B,MAAM,4BAA4B,CACvC,cAEA,SAAU,OAAU;AAClB,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,EAAE,uBAAuB,YAAY,IAAI,WAAW,cAAc;AAGxE,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,MAAM,IAAI;AAAA,IAChB;AAAA,IACA,CAAC,MAAM,GAAG;AAAA,EACZ;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,CAAC,gBAAiB,QAAO;AAE7B,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,oBAAoB,uBAAuB,WAAW,CAAC;AAK5E,QAAM,MAA+B;AAAA,IACnC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SACE,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,KACnC,8BAAC,aAAW,GAAG,OAAO,GACxB;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/parts/Loader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { memo } from "react";
|
|
4
|
-
import { Grid } from "@elliemae/ds-grid";
|
|
5
3
|
import { DSCircularProgressIndicator } from "@elliemae/ds-circular-progress-indicator";
|
|
4
|
+
import { Grid } from "@elliemae/ds-grid";
|
|
6
5
|
import { styled } from "@elliemae/ds-system";
|
|
6
|
+
import { memo } from "react";
|
|
7
7
|
import { DSDataTableName, DSDataTableSlots } from "../DSDataTableDefinitions.js";
|
|
8
|
-
import { usePropsStore } from "../configs/useStore/
|
|
8
|
+
import { usePropsStore } from "../configs/useStore/createInternalAndPropsContext.js";
|
|
9
9
|
const StyledLoaderWrapper = styled(Grid, { name: DSDataTableName, slot: DSDataTableSlots.LOADER_WRAPPER })`
|
|
10
10
|
place-items: center;
|
|
11
11
|
z-index: 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Loader.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACsBf;AAtBR,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSCircularProgressIndicator } from '@elliemae/ds-circular-progress-indicator';\nimport { Grid } from '@elliemae/ds-grid';\nimport { styled } from '@elliemae/ds-system';\nimport { memo } from 'react';\nimport { DSDataTableName, DSDataTableSlots } from '../DSDataTableDefinitions.js';\nimport { usePropsStore } from '../configs/useStore/createInternalAndPropsContext.js';\n\nconst StyledLoaderWrapper = styled(Grid, { name: DSDataTableName, slot: DSDataTableSlots.LOADER_WRAPPER })`\n place-items: center;\n z-index: 0;\n background-color: white;\n`;\n\n/**\n * we need to keep the semantic table structure\n * @returns Loader\n */\nconst Loader = () => {\n const getOwnerProps = usePropsStore((store) => store.get);\n return (\n <StyledLoaderWrapper role=\"row\" aria-live=\"polite\" getOwnerProps={getOwnerProps}>\n <div role=\"cell\">\n <DSCircularProgressIndicator size=\"xl\" loading showLabel waiting={false} showTooltip={false} />\n </div>\n </StyledLoaderWrapper>\n );\n};\nexport const MemoizedLoader = memo(Loader);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACsBf;AAtBR,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,iBAAiB,wBAAwB;AAClD,SAAS,qBAAqB;AAE9B,MAAM,sBAAsB,OAAO,MAAM,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,eAAe,CAAC;AAAA;AAAA;AAAA;AAAA;AAUzG,MAAM,SAAS,MAAM;AACnB,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,GAAG;AACxD,SACE,oBAAC,uBAAoB,MAAK,OAAM,aAAU,UAAS,eACjD,8BAAC,SAAI,MAAK,QACR,8BAAC,+BAA4B,MAAK,MAAK,SAAO,MAAC,WAAS,MAAC,SAAS,OAAO,aAAa,OAAO,GAC/F,GACF;AAEJ;AACO,MAAM,iBAAiB,KAAK,MAAM;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ import { TableContent } from "./TableContent.js";
|
|
|
4
4
|
import { DATA_TESTID } from "../configs/constants.js";
|
|
5
5
|
import { FiltersBar } from "./FilterBar/FiltersBar.js";
|
|
6
6
|
import { StyledDataTableWrapper } from "../styled.js";
|
|
7
|
-
import { usePropsStore } from "../configs/useStore/
|
|
7
|
+
import { usePropsStore } from "../configs/useStore/createInternalAndPropsContext.js";
|
|
8
8
|
const MainContent = () => {
|
|
9
9
|
const height = usePropsStore((state) => state.height);
|
|
10
10
|
const width = usePropsStore((state) => state.width);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/MainContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { TableContent } from './TableContent.js';\nimport { DATA_TESTID } from '../configs/constants.js';\nimport { FiltersBar } from './FilterBar/FiltersBar.js';\nimport { StyledDataTableWrapper } from '../styled.js';\nimport { usePropsStore } from '../configs/useStore/
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { TableContent } from './TableContent.js';\nimport { DATA_TESTID } from '../configs/constants.js';\nimport { FiltersBar } from './FilterBar/FiltersBar.js';\nimport { StyledDataTableWrapper } from '../styled.js';\nimport { usePropsStore } from '../configs/useStore/createInternalAndPropsContext.js';\n\nexport const MainContent = (): JSX.Element => {\n const height = usePropsStore((state) => state.height);\n const width = usePropsStore((state) => state.width);\n const withFilterBar = usePropsStore((state) => state.withFilterBar);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n return (\n <StyledDataTableWrapper\n data-testid={DATA_TESTID.DATA_TABLE_WRAPPER}\n height={height}\n width={width}\n cols={['100%']}\n rows={withFilterBar ? ['auto', '1fr'] : ['1fr']}\n getOwnerProps={getOwnerProps}\n >\n {withFilterBar ? <FiltersBar /> : null}\n <TableContent />\n </StyledDataTableWrapper>\n );\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACcnB,SAQmB,KARnB;AAbJ,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAEvB,MAAM,cAAc,MAAmB;AAC5C,QAAM,SAAS,cAAc,CAAC,UAAU,MAAM,MAAM;AACpD,QAAM,QAAQ,cAAc,CAAC,UAAU,MAAM,KAAK;AAClD,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,aAAa;AAClE,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,GAAG;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,YAAY;AAAA,MACzB;AAAA,MACA;AAAA,MACA,MAAM,CAAC,MAAM;AAAA,MACb,MAAM,gBAAgB,CAAC,QAAQ,KAAK,IAAI,CAAC,KAAK;AAAA,MAC9C;AAAA,MAEC;AAAA,wBAAgB,oBAAC,cAAW,IAAK;AAAA,QAClC,oBAAC,gBAAa;AAAA;AAAA;AAAA,EAChB;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/parts/Row.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { mergeRefs, styled } from "@elliemae/ds-system";
|
|
3
4
|
import { useCallback, useContext } from "react";
|
|
4
|
-
import {
|
|
5
|
+
import { useInternalStore, usePropsStore } from "../configs/useStore/createInternalAndPropsContext.js";
|
|
6
|
+
import { DSDataTableName, DSDataTableSlots } from "../DSDataTableDefinitions.js";
|
|
5
7
|
import { SortableItemContext } from "./HoC/SortableItemContext.js";
|
|
6
8
|
import { withDnDSortableRowContext } from "./HoC/withDnDSortableRowContext.js";
|
|
7
9
|
import { RowVariantMapItem } from "./RowVariants/index.js";
|
|
8
|
-
import { useInternalStore, usePropsStore } from "../configs/useStore/useStore.js";
|
|
9
|
-
import { DSDataTableName, DSDataTableSlots } from "../DSDataTableDefinitions.js";
|
|
10
10
|
const StyledRow = styled("div", { name: DSDataTableName, slot: DSDataTableSlots.ROW })`
|
|
11
11
|
cursor: ${({ isDisabled }) => isDisabled ? "not-allowed" : "normal"};
|
|
12
12
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Row.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACoCjB;AApCN,SAAgB,aAAa,kBAAkB;AAC/C,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { mergeRefs, styled } from '@elliemae/ds-system';\nimport React, { useCallback, useContext } from 'react';\nimport { useInternalStore, usePropsStore } from '../configs/useStore/createInternalAndPropsContext.js';\nimport { DSDataTableName, DSDataTableSlots } from '../DSDataTableDefinitions.js';\nimport type { DSDataTableT } from '../react-desc-prop-types.js';\nimport { SortableItemContext } from './HoC/SortableItemContext.js';\nimport { withDnDSortableRowContext } from './HoC/withDnDSortableRowContext.js';\nimport { RowVariantMapItem } from './RowVariants/index.js';\n\nconst StyledRow = styled('div', { name: DSDataTableName, slot: DSDataTableSlots.ROW })<{ isDisabled: boolean }>`\n cursor: ${({ isDisabled }) => (isDisabled ? 'not-allowed' : 'normal')};\n`;\n\nexport const Row: React.ComponentType<{\n row: DSDataTableT.InternalRow;\n measureRef?: (el: HTMLElement | null) => void;\n itemWrapperStyle?: React.CSSProperties;\n isDragOverlay: boolean;\n}> = (props) => {\n const { row, measureRef, itemWrapperStyle, isDragOverlay } = props;\n const disabledRows = usePropsStore((state) => state.disabledRows);\n const getOwnerProps = usePropsStore((store) => store.get);\n const getOwnerPropsArguments = useCallback(() => row, [row]);\n const focusedRowId = useInternalStore((state) => state.focusedRowId);\n const drilldownRowId = useInternalStore((state) => state.drilldownRowId);\n\n const { draggableProps } = useContext(SortableItemContext);\n const draggableRef = draggableProps && draggableProps.setNodeRef;\n return (\n <StyledRow\n isDisabled={disabledRows[row.uid]}\n style={!isDragOverlay ? itemWrapperStyle : {}}\n innerRef={mergeRefs(measureRef, draggableRef)}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <RowVariantMapItem\n row={row}\n itemIndex={row.realIndex}\n isDragOverlay={isDragOverlay}\n focusedRowId={focusedRowId}\n drilldownRowId={drilldownRowId}\n />\n </StyledRow>\n );\n};\n\nconst RowWithContext = withDnDSortableRowContext(Row);\nexport { RowWithContext };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoCjB;AApCN,SAAS,WAAW,cAAc;AAClC,SAAgB,aAAa,kBAAkB;AAC/C,SAAS,kBAAkB,qBAAqB;AAChD,SAAS,iBAAiB,wBAAwB;AAElD,SAAS,2BAA2B;AACpC,SAAS,iCAAiC;AAC1C,SAAS,yBAAyB;AAElC,MAAM,YAAY,OAAO,OAAO,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,IAAI,CAAC;AAAA,YACzE,CAAC,EAAE,WAAW,MAAO,aAAa,gBAAgB,QAAS;AAAA;AAGhE,MAAM,MAKR,CAAC,UAAU;AACd,QAAM,EAAE,KAAK,YAAY,kBAAkB,cAAc,IAAI;AAC7D,QAAM,eAAe,cAAc,CAAC,UAAU,MAAM,YAAY;AAChE,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,GAAG;AACxD,QAAM,yBAAyB,YAAY,MAAM,KAAK,CAAC,GAAG,CAAC;AAC3D,QAAM,eAAe,iBAAiB,CAAC,UAAU,MAAM,YAAY;AACnE,QAAM,iBAAiB,iBAAiB,CAAC,UAAU,MAAM,cAAc;AAEvE,QAAM,EAAE,eAAe,IAAI,WAAW,mBAAmB;AACzD,QAAM,eAAe,kBAAkB,eAAe;AACtD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,YAAY,aAAa,IAAI,GAAG;AAAA,MAChC,OAAO,CAAC,gBAAgB,mBAAmB,CAAC;AAAA,MAC5C,UAAU,UAAU,YAAY,YAAY;AAAA,MAC5C;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,WAAW,IAAI;AAAA,UACf;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,MAAM,iBAAiB,0BAA0B,GAAG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useLayoutEffect, useMemo, useRef } from "react";
|
|
4
|
-
import { RowRenderer } from "../../exported-related/RowRenderer/index.js";
|
|
5
|
-
import { GroupHeaderContainer, GroupHeaderTitle, StyledCellContainer } from "../../styled.js";
|
|
6
4
|
import { expandRowColumn } from "../../addons/Columns/index.js";
|
|
7
5
|
import { DATA_TESTID } from "../../configs/constants.js";
|
|
8
|
-
import { usePropsStore } from "../../configs/useStore/
|
|
6
|
+
import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
|
|
7
|
+
import { RowRenderer } from "../../exported-related/RowRenderer/index.js";
|
|
8
|
+
import { GroupHeaderContainer, GroupHeaderTitle, StyledCellContainer } from "../../styled.js";
|
|
9
9
|
const RowContent = (props) => {
|
|
10
10
|
const { row, backgroundColor = "neutral-000", focusedRowId, drilldownRowId } = props;
|
|
11
11
|
const groupedRowsRenderHeader = usePropsStore((state) => state.groupedRowsRenderHeader);
|
|
@@ -50,7 +50,8 @@ const RowContent = (props) => {
|
|
|
50
50
|
role: "cell",
|
|
51
51
|
getOwnerProps,
|
|
52
52
|
children: [
|
|
53
|
-
hasExpandCell && expandRowColumn.Cell &&
|
|
53
|
+
hasExpandCell && expandRowColumn.Cell && // @ts-expect-error - typescript for data-table is basically broken
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
54
55
|
expandRowColumn.Cell,
|
|
55
56
|
{
|
|
56
57
|
row,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/RowVariants/RowVariantHeader.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useLayoutEffect, useMemo, useRef } from 'react';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACkDjB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useLayoutEffect, useMemo, useRef } from 'react';\nimport { expandRowColumn } from '../../addons/Columns/index.js';\nimport { DATA_TESTID } from '../../configs/constants.js';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport { RowRenderer } from '../../exported-related/RowRenderer/index.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { GroupHeaderContainer, GroupHeaderTitle, StyledCellContainer } from '../../styled.js';\nimport type { RowVariantProps } from './types.js';\n\nconst RowContent: React.ComponentType<RowVariantProps> = (props) => {\n const { row, backgroundColor = 'neutral-000', focusedRowId, drilldownRowId } = props;\n\n const groupedRowsRenderHeader = usePropsStore((state) => state.groupedRowsRenderHeader);\n const disabledRows = usePropsStore((state) => state.disabledRows);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n const rowRef = useRef<HTMLDivElement>(null);\n\n const hasExpandCell = useMemo(\n () => row.original.subRows && row.cells.find((cell) => cell.column.accessor === 'expandRowColumn'),\n [row],\n );\n\n const titleContent = useMemo(() => {\n if (typeof groupedRowsRenderHeader === 'function') {\n return groupedRowsRenderHeader(row.original.dimsumHeaderValue, row.original.subRows);\n }\n return row.original.dimsumHeaderValue;\n }, [groupedRowsRenderHeader, row]);\n\n useLayoutEffect(() => {\n if (row.uid === focusedRowId) {\n rowRef.current?.focus();\n }\n }, [focusedRowId, row.uid]);\n\n const isDisabled = useMemo(() => disabledRows[row.uid] !== undefined, [disabledRows, row]);\n return (\n <StyledCellContainer\n innerRef={rowRef}\n minHeight=\"0px\"\n tabIndex={0}\n role=\"row\"\n backgroundColor={backgroundColor}\n aria-disabled={isDisabled ? 'true' : 'false'}\n isDisabled={isDisabled}\n data-testid={DATA_TESTID.DATA_TABLE_ROW_HEADER_CONTENT}\n gridTemplateColumns=\"auto\"\n getOwnerProps={getOwnerProps}\n >\n <GroupHeaderContainer\n data-testid={DATA_TESTID.DATA_TABLE_ROW_GROUP_HEADER}\n cols={hasExpandCell ? ['min-content', 'auto'] : ['auto']}\n paddingLeft={hasExpandCell ? '2px' : '8px'}\n role=\"cell\"\n getOwnerProps={getOwnerProps}\n >\n {hasExpandCell && expandRowColumn.Cell && (\n // @ts-expect-error - typescript for data-table is basically broken\n <expandRowColumn.Cell\n row={row}\n cell={row.cells[0]}\n column={row.cells[0].column}\n isRowSelected={drilldownRowId === row.uid}\n />\n )}\n <GroupHeaderTitle getOwnerProps={getOwnerProps}>{titleContent}</GroupHeaderTitle>\n </GroupHeaderContainer>\n </StyledCellContainer>\n );\n};\n\nexport const RowVariantHeader: React.ComponentType<DSDataTableT.RowVariantProps> = ({\n row,\n itemIndex,\n isDragOverlay,\n focusedRowId,\n drilldownRowId,\n}) => (\n <RowRenderer\n row={row}\n itemIndex={itemIndex}\n isDragOverlay={isDragOverlay}\n minHeight=\"0px\"\n height=\"24px\"\n CustomRowContentRenderer={RowContent}\n focusedRowId={focusedRowId}\n drilldownRowId={drilldownRowId}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ACA,eAAa,YAAY;AAAA,MACzB,qBAAoB;AAAA,MACpB;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,eAAa,YAAY;AAAA,UACzB,MAAM,gBAAgB,CAAC,eAAe,MAAM,IAAI,CAAC,MAAM;AAAA,UACvD,aAAa,gBAAgB,QAAQ;AAAA,UACrC,MAAK;AAAA,UACL;AAAA,UAEC;AAAA,6BAAiB,gBAAgB;AAAA,YAEhC;AAAA,cAAC,gBAAgB;AAAA,cAAhB;AAAA,gBACC;AAAA,gBACA,MAAM,IAAI,MAAM,CAAC;AAAA,gBACjB,QAAQ,IAAI,MAAM,CAAC,EAAE;AAAA,gBACrB,eAAe,mBAAmB,IAAI;AAAA;AAAA,YACxC;AAAA,YAEF,oBAAC,oBAAiB,eAA+B,wBAAa;AAAA;AAAA;AAAA,MAChE;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,mBAAsE,CAAC;AAAA,EAClF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAU;AAAA,IACV,QAAO;AAAA,IACP,0BAA0B;AAAA,IAC1B;AAAA,IACA;AAAA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
|
|
3
4
|
import { ROW_VARIANTS } from "../../exported-related/index.js";
|
|
4
5
|
import { Cells } from "../Cells/index.js";
|
|
5
6
|
import { RowVariantHeader } from "./RowVariantHeader.js";
|
|
6
7
|
import { RowVariantPrimary } from "./RowVariantPrimary.js";
|
|
7
8
|
import { RowVariantSecondary } from "./RowVariantSecondary.js";
|
|
8
9
|
import { RowVariantSkeleton } from "./RowVariantSkeleton.js";
|
|
9
|
-
import { usePropsStore } from "../../configs/useStore/useStore.js";
|
|
10
10
|
const RowVariantMapper = {
|
|
11
11
|
[ROW_VARIANTS.HEADER_GROUP]: RowVariantHeader,
|
|
12
12
|
[ROW_VARIANTS.PRIMARY]: RowVariantPrimary,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/RowVariants/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { ROW_VARIANTS } from '../../exported-related/index.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { Cells } from '../Cells/index.js';\nimport { RowVariantHeader } from './RowVariantHeader.js';\nimport { RowVariantPrimary } from './RowVariantPrimary.js';\nimport { RowVariantSecondary } from './RowVariantSecondary.js';\nimport { RowVariantSkeleton } from './RowVariantSkeleton.js';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACcsB;AAb7C,SAAS,oBAAoB;AAE7B,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport { ROW_VARIANTS } from '../../exported-related/index.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { Cells } from '../Cells/index.js';\nimport { RowVariantHeader } from './RowVariantHeader.js';\nimport { RowVariantPrimary } from './RowVariantPrimary.js';\nimport { RowVariantSecondary } from './RowVariantSecondary.js';\nimport { RowVariantSkeleton } from './RowVariantSkeleton.js';\n\nconst RowVariantMapper: Record<string, React.ComponentType<DSDataTableT.RowVariantProps>> = {\n [ROW_VARIANTS.HEADER_GROUP]: RowVariantHeader,\n [ROW_VARIANTS.PRIMARY]: RowVariantPrimary,\n [ROW_VARIANTS.SECONDARY]: RowVariantSecondary,\n [ROW_VARIANTS.COMPACT_PRIMARY]: (props) => <RowVariantPrimary compact {...props} />,\n [ROW_VARIANTS.COMPACT_SECONDARY]: (props) => <RowVariantSecondary compact {...props} />,\n [ROW_VARIANTS.SKELETON]: RowVariantSkeleton,\n};\n\nexport const RowVariantMapItem: React.ComponentType<DSDataTableT.RowVariantProps> = (props) => {\n const { row } = props;\n\n const getRowVariant = usePropsStore((state) => state.getRowVariant);\n const variant = getRowVariant(row, Cells);\n\n let Component: React.ComponentType<DSDataTableT.RowVariantProps>;\n\n if (typeof variant === 'string') {\n if (!(variant in RowVariantMapper)) {\n throw new Error(`${variant} is not an out-of-the-box row variant`);\n }\n Component = RowVariantMapper[variant];\n } else {\n Component = variant;\n }\n\n return <Component {...props} />;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACcsB;AAb7C,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAE7B,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AAEnC,MAAM,mBAAsF;AAAA,EAC1F,CAAC,aAAa,YAAY,GAAG;AAAA,EAC7B,CAAC,aAAa,OAAO,GAAG;AAAA,EACxB,CAAC,aAAa,SAAS,GAAG;AAAA,EAC1B,CAAC,aAAa,eAAe,GAAG,CAAC,UAAU,oBAAC,qBAAkB,SAAO,MAAE,GAAG,OAAO;AAAA,EACjF,CAAC,aAAa,iBAAiB,GAAG,CAAC,UAAU,oBAAC,uBAAoB,SAAO,MAAE,GAAG,OAAO;AAAA,EACrF,CAAC,aAAa,QAAQ,GAAG;AAC3B;AAEO,MAAM,oBAAuE,CAAC,UAAU;AAC7F,QAAM,EAAE,IAAI,IAAI;AAEhB,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,aAAa;AAClE,QAAM,UAAU,cAAc,KAAK,KAAK;AAExC,MAAI;AAEJ,MAAI,OAAO,YAAY,UAAU;AAC/B,QAAI,EAAE,WAAW,mBAAmB;AAClC,YAAM,IAAI,MAAM,GAAG,OAAO,uCAAuC;AAAA,IACnE;AACA,gBAAY,iBAAiB,OAAO;AAAA,EACtC,OAAO;AACL,gBAAY;AAAA,EACd;AAEA,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/parts/Rows.js
CHANGED
|
@@ -2,11 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createElement } from "react";
|
|
4
4
|
import { useContext } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import { withConditionalDnDRowContext } from "./HoC/withConditionalDnDRowContext.js";
|
|
7
|
-
import { DnDTreeContext } from "./HoC/DnDTreeContext.js";
|
|
5
|
+
import { usePropsStore } from "../configs/useStore/createInternalAndPropsContext.js";
|
|
8
6
|
import { addCellData } from "../helpers/index.js";
|
|
9
|
-
import {
|
|
7
|
+
import { DnDTreeContext } from "./HoC/DnDTreeContext.js";
|
|
8
|
+
import { withConditionalDnDRowContext } from "./HoC/withConditionalDnDRowContext.js";
|
|
9
|
+
import { RowWithContext as Row } from "./Row.js";
|
|
10
10
|
const Rows = () => {
|
|
11
11
|
const { virtualItems } = usePropsStore((state) => state.virtualListHelpers);
|
|
12
12
|
const flattenedData = usePropsStore((state) => state.flattenedData);
|