@elliemae/ds-data-table 3.53.1-rc.0 → 3.54.0-next.2
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/DataTable.js +1 -1
- package/dist/cjs/DataTable.js.map +2 -2
- package/dist/cjs/addons/Editables/index.js +1 -1
- package/dist/cjs/addons/Editables/index.js.map +2 -2
- package/dist/cjs/addons/Filters/Components/SelectFilter/SingleSelectFilter.js +2 -2
- package/dist/cjs/addons/Filters/Components/SelectFilter/SingleSelectFilter.js.map +2 -2
- package/dist/cjs/configs/useAutocalculated/index.js +5 -2
- package/dist/cjs/configs/useAutocalculated/index.js.map +2 -2
- package/dist/cjs/configs/useFreezeVirtualScrollOnDrag.js +54 -0
- package/dist/cjs/configs/useFreezeVirtualScrollOnDrag.js.map +7 -0
- package/dist/cjs/configs/useInternalStateConfig.js +7 -2
- package/dist/cjs/configs/useInternalStateConfig.js.map +2 -2
- package/dist/cjs/configs/useNativeResizeObserver.js +1 -1
- package/dist/cjs/configs/useNativeResizeObserver.js.map +2 -2
- package/dist/cjs/configs/useStore/useStore.js +2 -1
- package/dist/cjs/configs/useStore/useStore.js.map +2 -2
- package/dist/cjs/parts/EmptyContent.js +27 -32
- package/dist/cjs/parts/EmptyContent.js.map +2 -2
- package/dist/cjs/parts/Headers/HeaderCellTitle.js +3 -7
- package/dist/cjs/parts/Headers/HeaderCellTitle.js.map +2 -2
- package/dist/cjs/parts/HoC/withConditionalDnDColumnContext.js +6 -2
- package/dist/cjs/parts/HoC/withConditionalDnDColumnContext.js.map +2 -2
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +1 -1
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
- package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js +8 -0
- package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js.map +2 -2
- package/dist/cjs/parts/SkeletonTable.js +4 -1
- package/dist/cjs/parts/SkeletonTable.js.map +2 -2
- package/dist/cjs/parts/SortableHeaderCell.js +3 -7
- package/dist/cjs/parts/SortableHeaderCell.js.map +2 -2
- package/dist/cjs/parts/VirtualRowsList.js +15 -1
- package/dist/cjs/parts/VirtualRowsList.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +1 -1
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/styled.js +5 -5
- package/dist/cjs/styled.js.map +2 -2
- package/dist/esm/DataTable.js +1 -1
- package/dist/esm/DataTable.js.map +2 -2
- package/dist/esm/addons/Editables/index.js +1 -1
- package/dist/esm/addons/Editables/index.js.map +2 -2
- package/dist/esm/addons/Filters/Components/SelectFilter/SingleSelectFilter.js +2 -2
- package/dist/esm/addons/Filters/Components/SelectFilter/SingleSelectFilter.js.map +2 -2
- package/dist/esm/configs/useAutocalculated/index.js +5 -2
- package/dist/esm/configs/useAutocalculated/index.js.map +2 -2
- package/dist/esm/configs/useFreezeVirtualScrollOnDrag.js +24 -0
- package/dist/esm/configs/useFreezeVirtualScrollOnDrag.js.map +7 -0
- package/dist/esm/configs/useInternalStateConfig.js +7 -2
- package/dist/esm/configs/useInternalStateConfig.js.map +2 -2
- package/dist/esm/configs/useNativeResizeObserver.js +1 -1
- package/dist/esm/configs/useNativeResizeObserver.js.map +2 -2
- package/dist/esm/configs/useStore/useStore.js +2 -1
- package/dist/esm/configs/useStore/useStore.js.map +2 -2
- package/dist/esm/parts/EmptyContent.js +28 -33
- package/dist/esm/parts/EmptyContent.js.map +2 -2
- package/dist/esm/parts/Headers/HeaderCellTitle.js +3 -7
- package/dist/esm/parts/Headers/HeaderCellTitle.js.map +2 -2
- package/dist/esm/parts/HoC/withConditionalDnDColumnContext.js +8 -4
- package/dist/esm/parts/HoC/withConditionalDnDColumnContext.js.map +2 -2
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +1 -1
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
- package/dist/esm/parts/HoC/withDnDSortableColumnContext.js +10 -2
- package/dist/esm/parts/HoC/withDnDSortableColumnContext.js.map +2 -2
- package/dist/esm/parts/SkeletonTable.js +4 -1
- package/dist/esm/parts/SkeletonTable.js.map +2 -2
- package/dist/esm/parts/SortableHeaderCell.js +3 -7
- package/dist/esm/parts/SortableHeaderCell.js.map +2 -2
- package/dist/esm/parts/VirtualRowsList.js +15 -1
- package/dist/esm/parts/VirtualRowsList.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +1 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/styled.js +5 -5
- package/dist/esm/styled.js.map +2 -2
- package/dist/types/DataTable.d.ts +0 -1
- package/dist/types/addons/Filters/Components/SelectFilter/SingleSelectFilter.d.ts +1 -1
- package/dist/types/configs/useFreezeVirtualScrollOnDrag.d.ts +2 -0
- package/dist/types/configs/useInternalStateConfig.d.ts +2 -1
- package/dist/types/configs/useStore/createInternalAndPropsContext.d.ts +1 -2
- package/dist/types/configs/useStore/useStore.d.ts +1 -2
- package/dist/types/exported-related/Filters/currencyRangeFilterFn.d.ts +1 -4
- package/dist/types/exported-related/Filters/dateSwitcherFilterFn.d.ts +1 -5
- package/dist/types/exported-related/Filters/multiSelectFilterFn.d.ts +1 -4
- package/dist/types/exported-related/Filters/numberRangeFilterFn.d.ts +1 -4
- package/dist/types/exported-related/Filters/singleDateFilterFn.d.ts +1 -1
- package/dist/types/exported-related/Filters/singleSelectFilterFn.d.ts +1 -4
- package/dist/types/exported-related/RowRenderer/useRowRendererHandlers.d.ts +1 -1
- package/dist/types/helpers/getIdFromUniqueRowAccessor.d.ts +1 -1
- package/dist/types/parts/FilterBar/styled.d.ts +0 -1
- package/dist/types/parts/Headers/useHeaderCellHandlers.d.ts +0 -1
- package/dist/types/parts/HoC/DnDGroupContext.d.ts +0 -1
- package/dist/types/parts/HoC/DnDTreeContext.d.ts +0 -1
- package/dist/types/parts/HoC/SortableItemContext.d.ts +0 -1
- package/dist/types/parts/Loader.d.ts +0 -1
- package/dist/types/parts/MainContent.d.ts +0 -1
- package/dist/types/parts/Row.d.ts +2 -2
- package/dist/types/parts/RowVariants/types.d.ts +0 -1
- package/dist/types/parts/SortableHeaderCell.d.ts +0 -1
- package/dist/types/react-desc-prop-types.d.ts +6 -1
- package/dist/types/styled.d.ts +14 -15
- package/package.json +30 -29
- package/dist/cjs/tests/utils/index.js +0 -131
- package/dist/cjs/tests/utils/index.js.map +0 -7
- package/dist/esm/tests/utils/index.js +0 -101
- package/dist/esm/tests/utils/index.js.map +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { TextEditableCell } from "./TextEditableCell/TextEditableCell.js";
|
|
3
2
|
import { ComboboxEditableCell } from "./ComboboxEditableCell/ComboboxEditableCell.js";
|
|
3
|
+
import { TextEditableCell } from "./TextEditableCell/TextEditableCell.js";
|
|
4
4
|
const outOfTheBoxEditables = {
|
|
5
5
|
"ds-edit-text": { EditableComponent: TextEditableCell },
|
|
6
6
|
"ds-edit-combobox": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/addons/Editables/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport type { DSDataTableT } from 'react-desc-prop-types.js';\nimport { ComboboxEditableCell } from './ComboboxEditableCell/ComboboxEditableCell.js';\nimport { TextEditableCell } from './TextEditableCell/TextEditableCell.js';\n\nexport const outOfTheBoxEditables: Record<\n string,\n { EditableComponent: React.ComponentType<DSDataTableT.EditableCellProps<HTMLDivElement>> }\n> = {\n 'ds-edit-text': { EditableComponent: TextEditableCell },\n 'ds-edit-combobox': {\n EditableComponent: ComboboxEditableCell,\n },\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AAE1B,MAAM,uBAGT;AAAA,EACF,gBAAgB,EAAE,mBAAmB,iBAAiB;AAAA,EACtD,oBAAoB;AAAA,IAClB,mBAAmB;AAAA,EACrB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { BaseSelectFilter } from "./BaseSelectFilter.js";
|
|
4
3
|
import { uid } from "uid";
|
|
5
|
-
import { FILTER_TYPES } from "../../../../exported-related/index.js";
|
|
6
4
|
import { DATA_TESTID } from "../../../../configs/constants.js";
|
|
5
|
+
import { FILTER_TYPES } from "../../../../exported-related/index.js";
|
|
6
|
+
import { BaseSelectFilter } from "./BaseSelectFilter.js";
|
|
7
7
|
const SingleSelectFilter = ({
|
|
8
8
|
column,
|
|
9
9
|
patchHeaderFilterButtonAndMenu,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/addons/Filters/Components/SelectFilter/SingleSelectFilter.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACoBrB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSComboboxT } from '@elliemae/ds-form-combobox';\nimport React from 'react';\nimport { uid } from 'uid';\nimport { DATA_TESTID } from '../../../../configs/constants.js';\nimport { FILTER_TYPES } from '../../../../exported-related/index.js';\nimport type { DSDataTableT } from '../../../../react-desc-prop-types.js';\nimport { BaseSelectFilter } from './BaseSelectFilter.js';\n\ntype SingleSelectFilterValue = DSComboboxT.SelectedOptionsT;\n\nexport const SingleSelectFilter: React.ComponentType<DSDataTableT.FilterProps<SingleSelectFilterValue>> = ({\n column,\n patchHeaderFilterButtonAndMenu,\n patchHeader,\n onValueChange,\n filterValue,\n reduxHeader,\n innerRef,\n domIdAffix = uid(4),\n}) => (\n <BaseSelectFilter\n reduxHeader={reduxHeader}\n data-testid={DATA_TESTID.DATA_TABLE_SINGLESELECT_CONTROLLER}\n column={column}\n filterValue={filterValue}\n type={FILTER_TYPES.SELECT}\n onValueChange={onValueChange}\n patchHeaderFilterButtonAndMenu={patchHeaderFilterButtonAndMenu}\n patchHeader={patchHeader}\n innerRef={innerRef}\n domIdAffix={domIdAffix}\n />\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoBrB;AAlBF,SAAS,WAAW;AACpB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAE7B,SAAS,wBAAwB;AAI1B,MAAM,qBAA6F,CAAC;AAAA,EACzG;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa,IAAI,CAAC;AACpB,MACE;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,eAAa,YAAY;AAAA,IACzB;AAAA,IACA;AAAA,IACA,MAAM,aAAa;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,14 +10,15 @@ import { useTableResizeCb } from "../useTableResizeCb.js";
|
|
|
10
10
|
const estimateSize = () => 36;
|
|
11
11
|
const useAutoCalculated = (propsWithDefaults) => {
|
|
12
12
|
const { actionRef, colsLayoutStyle, hiddenColumns, isLoading } = propsWithDefaults;
|
|
13
|
-
const visibleRangeRef = useRef({ start: 0, end: 0 });
|
|
14
13
|
const virtualListRef = useRef(null);
|
|
14
|
+
const [bodyClientWidth, setBodyClientWidth] = React2.useState("100%");
|
|
15
15
|
const columnHeaderRef = useRef(null);
|
|
16
16
|
const lastSelected = useRef(-1);
|
|
17
17
|
const visibleColumns = useTableColsWithAddons(propsWithDefaults, hiddenColumns);
|
|
18
18
|
const [flattenedData, allDataFlattened] = useRowFlattenization(propsWithDefaults);
|
|
19
19
|
const [paginatedData, paginationHelpers] = usePaginationConfig(propsWithDefaults, flattenedData);
|
|
20
20
|
const dataLength = useMemo(() => (paginatedData || flattenedData).length, [flattenedData, paginatedData]);
|
|
21
|
+
const visibleRangeRef = useRef({ start: 0, end: 0, overscan: 15, size: dataLength });
|
|
21
22
|
const virtualListHelpers = useVirtual({
|
|
22
23
|
size: dataLength,
|
|
23
24
|
parentRef: virtualListRef,
|
|
@@ -70,7 +71,9 @@ const useAutoCalculated = (propsWithDefaults) => {
|
|
|
70
71
|
firstFocuseableColumnHeaderId,
|
|
71
72
|
virtualListRef,
|
|
72
73
|
columnHeaderRef,
|
|
73
|
-
lastSelected
|
|
74
|
+
lastSelected,
|
|
75
|
+
bodyClientWidth,
|
|
76
|
+
setBodyClientWidth
|
|
74
77
|
};
|
|
75
78
|
};
|
|
76
79
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/configs/useAutocalculated/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable import/no-cycle */\n/* eslint-disable no-continue */\n/* eslint-disable consistent-return */\n/* eslint-disable no-plusplus */\n/* eslint-disable max-statements */\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport { useVirtual, defaultRangeExtractor, type Range } from 'react-virtual';\nimport { type DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useTableColsWithAddons } from '../useTableColsWithAddons.js';\nimport { useRowFlattenization } from '../useRowFlattenization.js';\nimport { usePaginationConfig } from '../usePaginationConfig.js';\nimport { columnsToGrid } from '../../helpers/columnsToGrid.js';\nimport { ColsLayoutStyle } from '../constants.js';\nimport { useTableResizeCb } from '../useTableResizeCb.js';\n\nconst estimateSize = () => 36;\n\nexport const useAutoCalculated = (propsWithDefaults: DSDataTableT.InternalProps): DSDataTableT.UseAutoCalculatedT => {\n const { actionRef, colsLayoutStyle, hiddenColumns, isLoading } = propsWithDefaults;\n\n const
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACKvB,OAAOA,UAAS,WAAW,SAAS,cAAc;AAClD,SAAS,YAAY,6BAAyC;AAE9D,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAEjC,MAAM,eAAe,MAAM;AAEpB,MAAM,oBAAoB,CAAC,sBAAmF;AACnH,QAAM,EAAE,WAAW,iBAAiB,eAAe,UAAU,IAAI;AAEjE,QAAM,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable import/no-cycle */\n/* eslint-disable no-continue */\n/* eslint-disable consistent-return */\n/* eslint-disable no-plusplus */\n/* eslint-disable max-statements */\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport { useVirtual, defaultRangeExtractor, type Range } from 'react-virtual';\nimport { type DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useTableColsWithAddons } from '../useTableColsWithAddons.js';\nimport { useRowFlattenization } from '../useRowFlattenization.js';\nimport { usePaginationConfig } from '../usePaginationConfig.js';\nimport { columnsToGrid } from '../../helpers/columnsToGrid.js';\nimport { ColsLayoutStyle } from '../constants.js';\nimport { useTableResizeCb } from '../useTableResizeCb.js';\n\nconst estimateSize = () => 36;\n\nexport const useAutoCalculated = (propsWithDefaults: DSDataTableT.InternalProps): DSDataTableT.UseAutoCalculatedT => {\n const { actionRef, colsLayoutStyle, hiddenColumns, isLoading } = propsWithDefaults;\n\n const virtualListRef = useRef<HTMLDivElement | null>(null);\n const [bodyClientWidth, setBodyClientWidth] = React.useState<number | string>('100%');\n const columnHeaderRef = useRef<HTMLDivElement | null>(null);\n const lastSelected = useRef<number>(-1);\n\n // ===========================================================================\n // Column config\n // ===========================================================================\n const visibleColumns = useTableColsWithAddons(propsWithDefaults, hiddenColumns);\n\n // ===========================================================================\n // Data flattenization and pagination\n // ===========================================================================\n\n const [flattenedData, allDataFlattened] = useRowFlattenization(propsWithDefaults);\n\n const [paginatedData, paginationHelpers] = usePaginationConfig(propsWithDefaults, flattenedData);\n\n const dataLength = useMemo(() => (paginatedData || flattenedData).length, [flattenedData, paginatedData]);\n\n // when rangeExtractor is invoked this will be filled with the current range\n const visibleRangeRef = useRef<Range>({ start: 0, end: 0, overscan: 15, size: dataLength });\n // estimateSize should not be really required given what was stated on\n // https://github.com/tannerlinsley/react-virtual/issues/23\n const virtualListHelpers = useVirtual({\n size: dataLength,\n parentRef: virtualListRef,\n overscan: 15,\n paddingStart: columnHeaderRef.current?.getBoundingClientRect()?.height ?? 24,\n estimateSize,\n rangeExtractor: React.useCallback((range: Range) => {\n visibleRangeRef.current = range;\n\n return defaultRangeExtractor(range);\n }, []),\n });\n\n // ===========================================================================\n // Empty content config\n // ===========================================================================\n\n const isEmptyContent = useMemo(() => !isLoading && flattenedData.length === 0, [isLoading, flattenedData.length]);\n\n const firstFocuseableColumnHeaderId = useMemo(() => {\n for (let i = 0; i < visibleColumns.length; i++) {\n const column = visibleColumns[i];\n if (column.isFocuseable === false && column.id !== 'expander' && column.id !== 'multiSelecter') {\n continue;\n }\n return column.id;\n }\n }, [visibleColumns]);\n\n // ===========================================================================\n // Layout config\n // ===========================================================================\n\n const gridLayout = useMemo(() => columnsToGrid(visibleColumns, colsLayoutStyle), [colsLayoutStyle, visibleColumns]);\n\n // We need to listen and update the state based on this props\n const totalColumnsWidth = useMemo(\n () =>\n colsLayoutStyle === ColsLayoutStyle.Fixed\n ? gridLayout.reduce((acc: number, cur: string) => acc + Number.parseInt(cur, 10), 0)\n : '100%',\n [colsLayoutStyle, gridLayout],\n );\n\n const layoutHelpers = useMemo(\n () => ({\n gridLayout,\n totalColumnsWidth,\n }),\n [gridLayout, totalColumnsWidth],\n );\n\n useTableResizeCb({ virtualListRef, propsWithDefault: propsWithDefaults });\n\n // ===========================================================================\n // Action ref setup\n // ===========================================================================\n useEffect(() => {\n if (actionRef) {\n actionRef.current.scrollToIndex = virtualListHelpers.scrollToIndex;\n actionRef.current.scrollToOffset = virtualListHelpers.scrollToOffset;\n }\n }, [actionRef, virtualListHelpers.scrollToIndex, virtualListHelpers.scrollToOffset]);\n\n return {\n visibleRangeRef,\n layoutHelpers,\n paginationHelpers,\n visibleColumns,\n virtualListHelpers,\n flattenedData: paginatedData || flattenedData,\n allDataFlattened,\n isEmptyContent,\n firstFocuseableColumnHeaderId,\n virtualListRef,\n columnHeaderRef,\n lastSelected,\n bodyClientWidth,\n setBodyClientWidth,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACKvB,OAAOA,UAAS,WAAW,SAAS,cAAc;AAClD,SAAS,YAAY,6BAAyC;AAE9D,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAEjC,MAAM,eAAe,MAAM;AAEpB,MAAM,oBAAoB,CAAC,sBAAmF;AACnH,QAAM,EAAE,WAAW,iBAAiB,eAAe,UAAU,IAAI;AAEjE,QAAM,iBAAiB,OAA8B,IAAI;AACzD,QAAM,CAAC,iBAAiB,kBAAkB,IAAIA,OAAM,SAA0B,MAAM;AACpF,QAAM,kBAAkB,OAA8B,IAAI;AAC1D,QAAM,eAAe,OAAe,EAAE;AAKtC,QAAM,iBAAiB,uBAAuB,mBAAmB,aAAa;AAM9E,QAAM,CAAC,eAAe,gBAAgB,IAAI,qBAAqB,iBAAiB;AAEhF,QAAM,CAAC,eAAe,iBAAiB,IAAI,oBAAoB,mBAAmB,aAAa;AAE/F,QAAM,aAAa,QAAQ,OAAO,iBAAiB,eAAe,Q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,WAAW;AACb,gBAAU,QAAQ,gBAAgB,mBAAmB;AACrD,gBAAU,QAAQ,iBAAiB,mBAAmB;AAAA,IACxD;AAAA,EACF,GAAG,CAAC,WAAW,mBAAmB,eAAe,mBAAmB,cAAc,CAAC;AAEnF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe,iBAAiB;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
function useFreezeVirtualScrollOnDrag(containerRef, isDragging) {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const container = containerRef.current;
|
|
6
|
+
if (!container || !isDragging) return;
|
|
7
|
+
let lastScrollTop = container.scrollTop;
|
|
8
|
+
const lockVerticalScroll = () => {
|
|
9
|
+
if (container.scrollTop !== lastScrollTop) {
|
|
10
|
+
container.scrollTop = lastScrollTop;
|
|
11
|
+
} else {
|
|
12
|
+
lastScrollTop = container.scrollTop;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
container.addEventListener("scroll", lockVerticalScroll);
|
|
16
|
+
return () => {
|
|
17
|
+
container.removeEventListener("scroll", lockVerticalScroll);
|
|
18
|
+
};
|
|
19
|
+
}, [isDragging, containerRef]);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
useFreezeVirtualScrollOnDrag
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=useFreezeVirtualScrollOnDrag.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/configs/useFreezeVirtualScrollOnDrag.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable consistent-return */\nimport type React from 'react';\nimport { useEffect } from 'react';\nexport function useFreezeVirtualScrollOnDrag(containerRef: React.RefObject<HTMLElement>, isDragging: boolean) {\n useEffect(() => {\n const container = containerRef.current;\n if (!container || !isDragging) return;\n\n let lastScrollTop = container.scrollTop;\n\n const lockVerticalScroll = () => {\n if (container.scrollTop !== lastScrollTop) {\n container.scrollTop = lastScrollTop;\n } else {\n lastScrollTop = container.scrollTop;\n }\n };\n\n container.addEventListener('scroll', lockVerticalScroll);\n\n return () => {\n container.removeEventListener('scroll', lockVerticalScroll);\n };\n }, [isDragging, containerRef]);\n}\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,iBAAiB;AACnB,SAAS,6BAA6B,cAA4C,YAAqB;AAC5G,YAAU,MAAM;AACd,UAAM,YAAY,aAAa;AAC/B,QAAI,CAAC,aAAa,CAAC,WAAY;AAE/B,QAAI,gBAAgB,UAAU;AAE9B,UAAM,qBAAqB,MAAM;AAC/B,UAAI,UAAU,cAAc,eAAe;AACzC,kBAAU,YAAY;AAAA,MACxB,OAAO;AACL,wBAAgB,UAAU;AAAA,MAC5B;AAAA,IACF;AAEA,cAAU,iBAAiB,UAAU,kBAAkB;AAEvD,WAAO,MAAM;AACX,gBAAU,oBAAoB,UAAU,kBAAkB;AAAA,IAC5D;AAAA,EACF,GAAG,CAAC,YAAY,YAAY,CAAC;AAC/B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,6 +3,7 @@ import { useCallback, useMemo, useState } from "react";
|
|
|
3
3
|
const useInternalStateConfig = () => {
|
|
4
4
|
const [drilldownRowId, setDrilldownRowId] = useState(null);
|
|
5
5
|
const [focusedRowId, setFocusedRowId] = useState(null);
|
|
6
|
+
const [isHeaderCellDragging, setIsHeaderCellDragging] = useState(false);
|
|
6
7
|
const [reduxHeaders, setReduxHeaders] = useState({});
|
|
7
8
|
const patchHeader = useCallback((headerId, newHeader) => {
|
|
8
9
|
setReduxHeaders((prevReduxHeaders) => {
|
|
@@ -26,7 +27,9 @@ const useInternalStateConfig = () => {
|
|
|
26
27
|
setFocusedRowId,
|
|
27
28
|
reduxHeaders,
|
|
28
29
|
patchHeader,
|
|
29
|
-
patchHeaderFilterButtonAndMenu
|
|
30
|
+
patchHeaderFilterButtonAndMenu,
|
|
31
|
+
isHeaderCellDragging,
|
|
32
|
+
setIsHeaderCellDragging
|
|
30
33
|
}),
|
|
31
34
|
[
|
|
32
35
|
drilldownRowId,
|
|
@@ -35,7 +38,9 @@ const useInternalStateConfig = () => {
|
|
|
35
38
|
setFocusedRowId,
|
|
36
39
|
reduxHeaders,
|
|
37
40
|
patchHeader,
|
|
38
|
-
patchHeaderFilterButtonAndMenu
|
|
41
|
+
patchHeaderFilterButtonAndMenu,
|
|
42
|
+
isHeaderCellDragging,
|
|
43
|
+
setIsHeaderCellDragging
|
|
39
44
|
]
|
|
40
45
|
);
|
|
41
46
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/configs/useInternalStateConfig.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useMemo, useState } from 'react';\nimport type { DSDataTableT } from '../react-desc-prop-types.js';\n\nexport const useInternalStateConfig = () => {\n const [drilldownRowId, setDrilldownRowId] = useState<string | null>(null);\n const [focusedRowId, setFocusedRowId] = useState<string | null>(null);\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,SAAS,gBAAgB;AAGxC,MAAM,yBAAyB,MAAM;AAC1C,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAwB,IAAI;AACxE,QAAM,CAAC,cAAc,eAAe,IAAI,SAAwB,IAAI;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useMemo, useState } from 'react';\nimport type { DSDataTableT } from '../react-desc-prop-types.js';\n\nexport const useInternalStateConfig = () => {\n const [drilldownRowId, setDrilldownRowId] = useState<string | null>(null);\n const [focusedRowId, setFocusedRowId] = useState<string | null>(null);\n const [isHeaderCellDragging, setIsHeaderCellDragging] = useState<boolean>(false);\n // TODO: @uluduena partition this state better\n const [reduxHeaders, setReduxHeaders] = useState<Record<string, DSDataTableT.ReduxHeader>>({});\n\n const patchHeader = useCallback((headerId: string, newHeader: Partial<DSDataTableT.ReduxHeader>) => {\n setReduxHeaders((prevReduxHeaders) => {\n const nextReduxHeaders = { ...prevReduxHeaders };\n nextReduxHeaders[headerId] = { ...(nextReduxHeaders?.[headerId] ?? {}), ...newHeader };\n return nextReduxHeaders;\n });\n }, []);\n\n const patchHeaderFilterButtonAndMenu = useCallback(\n (headerId: string, value: boolean) => {\n const newState = { hideFilterMenu: value, hideFilterButton: value };\n patchHeader(headerId, newState);\n },\n [patchHeader],\n );\n\n return useMemo(\n () => ({\n drilldownRowId,\n setDrilldownRowId,\n focusedRowId,\n setFocusedRowId,\n reduxHeaders,\n patchHeader,\n patchHeaderFilterButtonAndMenu,\n isHeaderCellDragging,\n setIsHeaderCellDragging,\n }),\n [\n drilldownRowId,\n setDrilldownRowId,\n focusedRowId,\n setFocusedRowId,\n reduxHeaders,\n patchHeader,\n patchHeaderFilterButtonAndMenu,\n isHeaderCellDragging,\n setIsHeaderCellDragging,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,SAAS,gBAAgB;AAGxC,MAAM,yBAAyB,MAAM;AAC1C,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAwB,IAAI;AACxE,QAAM,CAAC,cAAc,eAAe,IAAI,SAAwB,IAAI;AACpE,QAAM,CAAC,sBAAsB,uBAAuB,IAAI,SAAkB,KAAK;AAE/E,QAAM,CAAC,cAAc,eAAe,IAAI,SAAmD,CAAC,CAAC;AAE7F,QAAM,cAAc,YAAY,CAAC,UAAkB,cAAiD;AAClG,oBAAgB,CAAC,qBAAqB;AACpC,YAAM,mBAAmB,EAAE,GAAG,iBAAiB;AAC/C,uBAAiB,QAAQ,IAAI,EAAE,GAAI,mBAAmB,QAAQ,KAAK,CAAC,GAAI,GAAG,UAAU;AACrF,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,iCAAiC;AAAA,IACrC,CAAC,UAAkB,UAAmB;AACpC,YAAM,WAAW,EAAE,gBAAgB,OAAO,kBAAkB,MAAM;AAClE,kBAAY,UAAU,QAAQ;AAAA,IAChC;AAAA,IACA,CAAC,WAAW;AAAA,EACd;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ const useNativeResizeObserver = (el, callback) => {
|
|
|
4
4
|
const resizeObserver = useMemo(
|
|
5
5
|
() => new ResizeObserver((entries) => {
|
|
6
6
|
const entry = entries[0];
|
|
7
|
-
const contentRect = entry
|
|
7
|
+
const { contentRect } = entry;
|
|
8
8
|
const target = entry.target;
|
|
9
9
|
callback({ contentRect, target });
|
|
10
10
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/configs/useNativeResizeObserver.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useMemo } from 'react';\n\n// Custom hook to use the resize observer api,\n// to observe changes in the size of an **UNIQUE** element\n// Will trigger the callback with the contentRect,\n// which contains width, height, top, bottom, etc of the element,\n// and the html element itself, so you can query for offsetWidth, etc\nexport const useNativeResizeObserver = <T extends HTMLElement>(\n el: T | null,\n callback: (entry: { contentRect: DOMRectReadOnly; target: T }) => void,\n) => {\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n const entry = entries[0]; // We will only observe one element\n\n const contentRect = entry
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW,eAAe;AAO5B,MAAM,0BAA0B,CACrC,IACA,aACG;AACH,QAAM,iBAAiB;AAAA,IACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,YAAM,QAAQ,QAAQ,CAAC;AAEvB,YAAM,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useMemo } from 'react';\n\n// Custom hook to use the resize observer api,\n// to observe changes in the size of an **UNIQUE** element\n// Will trigger the callback with the contentRect,\n// which contains width, height, top, bottom, etc of the element,\n// and the html element itself, so you can query for offsetWidth, etc\nexport const useNativeResizeObserver = <T extends HTMLElement>(\n el: T | null,\n callback: (entry: { contentRect: DOMRectReadOnly; target: T }) => void,\n) => {\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n const entry = entries[0]; // We will only observe one element\n\n const { contentRect } = entry;\n\n const target = entry.target as T;\n\n callback({ contentRect, target });\n }),\n [callback],\n );\n\n useEffect(() => {\n if (el) resizeObserver.observe(el);\n return () => resizeObserver.disconnect();\n }, [el, resizeObserver]);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW,eAAe;AAO5B,MAAM,0BAA0B,CACrC,IACA,aACG;AACH,QAAM,iBAAiB;AAAA,IACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,YAAM,QAAQ,QAAQ,CAAC;AAEvB,YAAM,EAAE,YAAY,IAAI;AAExB,YAAM,SAAS,MAAM;AAErB,eAAS,EAAE,aAAa,OAAO,CAAC;AAAA,IAClC,CAAC;AAAA,IACH,CAAC,QAAQ;AAAA,EACX;AAEA,YAAU,MAAM;AACd,QAAI,GAAI,gBAAe,QAAQ,EAAE;AACjC,WAAO,MAAM,eAAe,WAAW;AAAA,EACzC,GAAG,CAAC,IAAI,cAAc,CAAC;AACzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/configs/useStore/useStore.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { type ZustandT } from '@elliemae/ds-zustand-helpers';\nimport { defaultProps, type DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useAutoCalculated } from '../useAutocalculated/index.js';\nimport { InternalProvider, PropsProvider, useInternalStore, usePropsStore } from './createInternalAndPropsContext.js';\n\nconst internalAtomDefaultValues: DSDataTableT.InternalAtoms = {\n drilldownRowId: null,\n focusedRowId: null,\n isShiftPressed: false,\n reduxHeaders: {},\n};\n\nconst selectors: ZustandT.SelectorObject<DSDataTableT.ShuttleInternalStore, DSDataTableT.Selectors> = () => ({});\n\nconst reducers: ZustandT.ReducerObject<DSDataTableT.ShuttleInternalStore, DSDataTableT.Reducers> = (get, set) => ({\n patchHeader: (headerId, newHeader) => {\n set((state) => ({\n reduxHeaders: {\n ...state.reduxHeaders,\n [headerId]: { ...(state.reduxHeaders?.[headerId] ?? {}), ...newHeader },\n },\n }));\n },\n patchHeaderFilterButtonAndMenu: (headerId, value) => {\n set((state) => ({\n reduxHeaders: {\n ...state.reduxHeaders,\n [headerId]: { ...(state.reduxHeaders?.[headerId] ?? {}), hideFilterMenu: value, hideFilterButton: value },\n },\n }));\n },\n});\n\nconst subscribers: ZustandT.Subscribers<DSDataTableT.ShuttleInternalStore> = () => {};\n\nexport const useWholeStore = (): DSDataTableT.Context => {\n const {\n columnHeaderRef,\n virtualListRef,\n flattenedData,\n allDataFlattened,\n isEmptyContent,\n firstFocuseableColumnHeaderId,\n visibleColumns,\n virtualListHelpers,\n layoutHelpers,\n paginationHelpers,\n lastSelected,\n ...tableProps\n } = usePropsStore((state) => state);\n\n const internalStore = useInternalStore((state) => state);\n return {\n tableProps,\n columnHeaderRef,\n virtualListRef,\n flattenedData,\n allDataFlattened,\n isEmptyContent,\n firstFocuseableColumnHeaderId,\n visibleColumns,\n virtualListHelpers,\n layoutHelpers,\n paginationHelpers,\n lastSelected,\n ...internalStore,\n };\n};\n\nexport const config = {\n defaultProps: defaultProps as () => DSDataTableT.InternalProps,\n internalAtomDefaultValues,\n useAutoCalculated,\n selectors,\n reducers,\n subscribers,\n PropsProvider,\n usePropsStore,\n InternalProvider,\n useInternalStore,\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,oBAAuC;AAChD,SAAS,yBAAyB;AAClC,SAAS,kBAAkB,eAAe,kBAAkB,qBAAqB;AAEjF,MAAM,4BAAwD;AAAA,EAC5D,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,cAAc,CAAC;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { type ZustandT } from '@elliemae/ds-zustand-helpers';\nimport { defaultProps, type DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useAutoCalculated } from '../useAutocalculated/index.js';\nimport { InternalProvider, PropsProvider, useInternalStore, usePropsStore } from './createInternalAndPropsContext.js';\n\nconst internalAtomDefaultValues: DSDataTableT.InternalAtoms = {\n drilldownRowId: null,\n focusedRowId: null,\n isShiftPressed: false,\n reduxHeaders: {},\n isHeaderCellDragging: false,\n};\n\nconst selectors: ZustandT.SelectorObject<DSDataTableT.ShuttleInternalStore, DSDataTableT.Selectors> = () => ({});\n\nconst reducers: ZustandT.ReducerObject<DSDataTableT.ShuttleInternalStore, DSDataTableT.Reducers> = (get, set) => ({\n patchHeader: (headerId, newHeader) => {\n set((state) => ({\n reduxHeaders: {\n ...state.reduxHeaders,\n [headerId]: { ...(state.reduxHeaders?.[headerId] ?? {}), ...newHeader },\n },\n }));\n },\n patchHeaderFilterButtonAndMenu: (headerId, value) => {\n set((state) => ({\n reduxHeaders: {\n ...state.reduxHeaders,\n [headerId]: { ...(state.reduxHeaders?.[headerId] ?? {}), hideFilterMenu: value, hideFilterButton: value },\n },\n }));\n },\n});\n\nconst subscribers: ZustandT.Subscribers<DSDataTableT.ShuttleInternalStore> = () => {};\n\nexport const useWholeStore = (): DSDataTableT.Context => {\n const {\n columnHeaderRef,\n virtualListRef,\n flattenedData,\n allDataFlattened,\n isEmptyContent,\n firstFocuseableColumnHeaderId,\n visibleColumns,\n virtualListHelpers,\n layoutHelpers,\n paginationHelpers,\n lastSelected,\n ...tableProps\n } = usePropsStore((state) => state);\n\n const internalStore = useInternalStore((state) => state);\n return {\n tableProps,\n columnHeaderRef,\n virtualListRef,\n flattenedData,\n allDataFlattened,\n isEmptyContent,\n firstFocuseableColumnHeaderId,\n visibleColumns,\n virtualListHelpers,\n layoutHelpers,\n paginationHelpers,\n lastSelected,\n ...internalStore,\n };\n};\n\nexport const config = {\n defaultProps: defaultProps as () => DSDataTableT.InternalProps,\n internalAtomDefaultValues,\n useAutoCalculated,\n selectors,\n reducers,\n subscribers,\n PropsProvider,\n usePropsStore,\n InternalProvider,\n useInternalStore,\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,oBAAuC;AAChD,SAAS,yBAAyB;AAClC,SAAS,kBAAkB,eAAe,kBAAkB,qBAAqB;AAEjF,MAAM,4BAAwD;AAAA,EAC5D,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,cAAc,CAAC;AAAA,EACf,sBAAsB;AACxB;AAEA,MAAM,YAAgG,OAAO,CAAC;AAE9G,MAAM,WAA6F,CAAC,KAAK,SAAS;AAAA,EAChH,aAAa,CAAC,UAAU,cAAc;AACpC,QAAI,CAAC,WAAW;AAAA,MACd,cAAc;AAAA,QACZ,GAAG,MAAM;AAAA,QACT,CAAC,QAAQ,GAAG,EAAE,GAAI,MAAM,eAAe,QAAQ,KAAK,CAAC,GAAI,GAAG,UAAU;AAAA,MACxE;AAAA,IACF,EAAE;AAAA,EACJ;AAAA,EACA,gCAAgC,CAAC,UAAU,UAAU;AACnD,QAAI,CAAC,WAAW;AAAA,MACd,cAAc;AAAA,QACZ,GAAG,MAAM;AAAA,QACT,CAAC,QAAQ,GAAG,EAAE,GAAI,MAAM,eAAe,QAAQ,KAAK,CAAC,GAAI,gBAAgB,OAAO,kBAAkB,MAAM;AAAA,MAC1G;AAAA,IACF,EAAE;AAAA,EACJ;AACF;AAEA,MAAM,cAAuE,MAAM;AAAC;AAE7E,MAAM,gBAAgB,MAA4B;AACvD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI,cAAc,CAAC,UAAU,KAAK;AAElC,QAAM,gBAAgB,iBAAiB,CAAC,UAAU,KAAK;AACvD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL;AACF;AAEO,MAAM,SAAS;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { DSButtonV2 } from "@elliemae/ds-button-v2";
|
|
4
4
|
import { Grid } from "@elliemae/ds-grid";
|
|
5
5
|
import { WarningTriangle } from "@elliemae/ds-icons";
|
|
@@ -7,12 +7,6 @@ import { __UNSAFE_SPACE_TO_DIMSUM, styled, toMobile } from "@elliemae/ds-system"
|
|
|
7
7
|
import React2 from "react";
|
|
8
8
|
import { usePropsStore } from "../configs/useStore/createInternalAndPropsContext.js";
|
|
9
9
|
import { DSDataTableName, DSDataTableSlots } from "../DSDataTableDefinitions.js";
|
|
10
|
-
const EmptyStateWrapper = styled(Grid, { name: DSDataTableName, slot: DSDataTableSlots.EMPTY_STATE_WRAPPER })`
|
|
11
|
-
position: sticky;
|
|
12
|
-
height: fit-content;
|
|
13
|
-
top: 0;
|
|
14
|
-
left: 0;
|
|
15
|
-
`;
|
|
16
10
|
const Icon = styled(WarningTriangle, { name: DSDataTableName, slot: DSDataTableSlots.WARNING_ICON })`
|
|
17
11
|
fill: ${(props) => props.theme.colors.neutral[300]};
|
|
18
12
|
color: ${(props) => props.theme.colors.neutral[300]};
|
|
@@ -37,6 +31,23 @@ const Button = styled(DSButtonV2, { name: DSDataTableName, slot: DSDataTableSlot
|
|
|
37
31
|
justify-self: center;
|
|
38
32
|
width: fit-content;
|
|
39
33
|
`;
|
|
34
|
+
const EmptyStateContent = () => {
|
|
35
|
+
const noResultsMessage = usePropsStore((state) => state.noResultsMessage);
|
|
36
|
+
const noResultsSecondaryMessage = usePropsStore((state) => state.noResultsSecondaryMessage);
|
|
37
|
+
const noResultsButtonLabel = usePropsStore((state) => state.noResultsButtonLabel);
|
|
38
|
+
const onNoResultsButtonClick = usePropsStore((state) => state.onNoResultsButtonClick);
|
|
39
|
+
const isSkeleton = usePropsStore((state) => state.isSkeleton);
|
|
40
|
+
const noResultsPlaceholder = usePropsStore((state) => state.noResultsPlaceholder);
|
|
41
|
+
const getOwnerProps = usePropsStore((store) => store.get);
|
|
42
|
+
if (isSkeleton) return null;
|
|
43
|
+
if (React2.isValidElement(noResultsPlaceholder)) return noResultsPlaceholder;
|
|
44
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(Icon, { size: "xxl" }),
|
|
46
|
+
/* @__PURE__ */ jsx(PrimaryMessage, { getOwnerProps, children: noResultsMessage }),
|
|
47
|
+
noResultsSecondaryMessage ? /* @__PURE__ */ jsx(SecondaryMessage, { getOwnerProps, children: noResultsSecondaryMessage }) : null,
|
|
48
|
+
noResultsButtonLabel && onNoResultsButtonClick ? /* @__PURE__ */ jsx(Button, { buttonType: "outline", onClick: onNoResultsButtonClick, children: noResultsButtonLabel }) : null
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
40
51
|
const CenterContentFlexWrapper = styled("div", {
|
|
41
52
|
name: DSDataTableName,
|
|
42
53
|
slot: DSDataTableSlots.CENTER_CONTENT_FLEX_WRAPPER
|
|
@@ -46,40 +57,24 @@ const CenterContentFlexWrapper = styled("div", {
|
|
|
46
57
|
display: flex;
|
|
47
58
|
align-items: center;
|
|
48
59
|
`;
|
|
60
|
+
const EmptyStateWrapper = styled(Grid, { name: DSDataTableName, slot: DSDataTableSlots.EMPTY_STATE_WRAPPER })`
|
|
61
|
+
position: sticky;
|
|
62
|
+
height: fit-content;
|
|
63
|
+
top: 0;
|
|
64
|
+
left: 0;
|
|
65
|
+
`;
|
|
49
66
|
const EmptyContent = () => {
|
|
50
|
-
const noResultsPlaceholder = usePropsStore((state) => state.noResultsPlaceholder);
|
|
51
|
-
const noResultsMessage = usePropsStore((state) => state.noResultsMessage);
|
|
52
|
-
const noResultsSecondaryMessage = usePropsStore((state) => state.noResultsSecondaryMessage);
|
|
53
|
-
const noResultsButtonLabel = usePropsStore((state) => state.noResultsButtonLabel);
|
|
54
|
-
const onNoResultsButtonClick = usePropsStore((state) => state.onNoResultsButtonClick);
|
|
55
|
-
const virtualListRef = usePropsStore((state) => state.virtualListRef);
|
|
56
67
|
const getOwnerProps = usePropsStore((store) => store.get);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
EmptyStateWrapper,
|
|
60
|
-
{
|
|
61
|
-
width: virtualListRef.current?.clientWidth,
|
|
62
|
-
justifyContent: "center",
|
|
63
|
-
role: "cell",
|
|
64
|
-
"aria-live": "assertive",
|
|
65
|
-
getOwnerProps,
|
|
66
|
-
children: noResultsPlaceholder
|
|
67
|
-
}
|
|
68
|
-
) });
|
|
69
|
-
return /* @__PURE__ */ jsx(CenterContentFlexWrapper, { width: "100%", role: "row", getOwnerProps, children: /* @__PURE__ */ jsxs(
|
|
68
|
+
const bodyClientWidth = usePropsStore((state) => state.bodyClientWidth);
|
|
69
|
+
return /* @__PURE__ */ jsx(CenterContentFlexWrapper, { width: "100%", role: "row", getOwnerProps, children: /* @__PURE__ */ jsx(
|
|
70
70
|
EmptyStateWrapper,
|
|
71
71
|
{
|
|
72
|
-
width:
|
|
72
|
+
width: bodyClientWidth,
|
|
73
73
|
justifyContent: "center",
|
|
74
74
|
role: "cell",
|
|
75
75
|
"aria-live": "assertive",
|
|
76
76
|
getOwnerProps,
|
|
77
|
-
children:
|
|
78
|
-
/* @__PURE__ */ jsx(Icon, { size: "xxl" }),
|
|
79
|
-
/* @__PURE__ */ jsx(PrimaryMessage, { getOwnerProps, children: noResultsMessage }),
|
|
80
|
-
noResultsSecondaryMessage ? /* @__PURE__ */ jsx(SecondaryMessage, { getOwnerProps, children: noResultsSecondaryMessage }) : null,
|
|
81
|
-
noResultsButtonLabel && onNoResultsButtonClick ? /* @__PURE__ */ jsx(Button, { buttonType: "outline", onClick: onNoResultsButtonClick, children: noResultsButtonLabel }) : null
|
|
82
|
-
]
|
|
77
|
+
children: /* @__PURE__ */ jsx(EmptyStateContent, {})
|
|
83
78
|
}
|
|
84
79
|
) });
|
|
85
80
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/EmptyContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport { WarningTriangle } from '@elliemae/ds-icons';\nimport { __UNSAFE_SPACE_TO_DIMSUM, styled, toMobile } from '@elliemae/ds-system';\nimport React from 'react';\nimport { usePropsStore } from '../configs/useStore/createInternalAndPropsContext.js';\nimport { DSDataTableName, DSDataTableSlots } from '../DSDataTableDefinitions.js';\n\nconst
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport { WarningTriangle } from '@elliemae/ds-icons';\nimport { __UNSAFE_SPACE_TO_DIMSUM, styled, toMobile } from '@elliemae/ds-system';\nimport React from 'react';\nimport { usePropsStore } from '../configs/useStore/createInternalAndPropsContext.js';\nimport { DSDataTableName, DSDataTableSlots } from '../DSDataTableDefinitions.js';\n\nconst Icon = styled(WarningTriangle, { name: DSDataTableName, slot: DSDataTableSlots.WARNING_ICON })`\n fill: ${(props) => props.theme.colors.neutral[300]};\n color: ${(props) => props.theme.colors.neutral[300]};\n justify-self: center;\n`;\nconst PrimaryMessage = styled('p', { name: DSDataTableName, slot: DSDataTableSlots.EMPTY_PRIMARY_MESSAGE })`\n text-align: center;\n font-weight: bold;\n font-size: ${(props) => toMobile(props.theme.fontSizes.value[400])};\n color: ${(props) => props.theme.colors.neutral[600]};\n margin-top: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.s)};\n margin-bottom: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xs)};\n`;\nconst SecondaryMessage = styled('p', { name: DSDataTableName, slot: DSDataTableSlots.EMPTY_SECONDARY_MESSAGE })`\n text-align: center;\n font-size: ${(props) => toMobile(props.theme.fontSizes.value[400])}; /* 13px */\n color: ${(props) => props.theme.colors.neutral[500]};\n margin: 0;\n`;\nconst Button = styled(DSButtonV2, { name: DSDataTableName, slot: DSDataTableSlots.EMPTY_BUTTON })`\n margin-top: ${(props) => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.m)};\n justify-self: center;\n width: fit-content;\n`;\n\nconst EmptyStateContent = () => {\n const noResultsMessage = usePropsStore((state) => state.noResultsMessage);\n const noResultsSecondaryMessage = usePropsStore((state) => state.noResultsSecondaryMessage);\n const noResultsButtonLabel = usePropsStore((state) => state.noResultsButtonLabel);\n const onNoResultsButtonClick = usePropsStore((state) => state.onNoResultsButtonClick);\n const isSkeleton = usePropsStore((state) => state.isSkeleton);\n const noResultsPlaceholder = usePropsStore((state) => state.noResultsPlaceholder);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n if (isSkeleton) return null;\n\n if (React.isValidElement(noResultsPlaceholder)) return noResultsPlaceholder;\n\n return (\n <>\n <Icon size=\"xxl\" />\n <PrimaryMessage getOwnerProps={getOwnerProps}>{noResultsMessage}</PrimaryMessage>\n {noResultsSecondaryMessage ? (\n <SecondaryMessage getOwnerProps={getOwnerProps}>{noResultsSecondaryMessage}</SecondaryMessage>\n ) : null}\n {noResultsButtonLabel && onNoResultsButtonClick ? (\n <Button buttonType=\"outline\" onClick={onNoResultsButtonClick}>\n {noResultsButtonLabel}\n </Button>\n ) : null}\n </>\n );\n};\n\nconst CenterContentFlexWrapper = styled('div', {\n name: DSDataTableName,\n slot: DSDataTableSlots.CENTER_CONTENT_FLEX_WRAPPER,\n})<{ width: string }>`\n width: ${({ width }) => width};\n height: 100%;\n display: flex;\n align-items: center;\n`;\nconst EmptyStateWrapper = styled(Grid, { name: DSDataTableName, slot: DSDataTableSlots.EMPTY_STATE_WRAPPER })`\n position: sticky;\n height: fit-content;\n top: 0;\n left: 0;\n`;\n\nconst EmptyContent: React.ComponentType = () => {\n const getOwnerProps = usePropsStore((store) => store.get);\n const bodyClientWidth = usePropsStore((state) => state.bodyClientWidth);\n\n return (\n <CenterContentFlexWrapper width=\"100%\" role=\"row\" getOwnerProps={getOwnerProps}>\n <EmptyStateWrapper\n width={bodyClientWidth}\n justifyContent=\"center\"\n role=\"cell\"\n aria-live=\"assertive\"\n getOwnerProps={getOwnerProps}\n >\n <EmptyStateContent />\n </EmptyStateWrapper>\n </CenterContentFlexWrapper>\n );\n};\n\nexport { EmptyContent };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC+CnB,mBACE,KADF;AA/CJ,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,0BAA0B,QAAQ,gBAAgB;AAC3D,OAAOA,YAAW;AAClB,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB,wBAAwB;AAElD,MAAM,OAAO,OAAO,iBAAiB,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,aAAa,CAAC;AAAA,UACzF,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,WACzC,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAGrD,MAAM,iBAAiB,OAAO,KAAK,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,sBAAsB,CAAC;AAAA;AAAA;AAAA,eAG3F,CAAC,UAAU,SAAS,MAAM,MAAM,UAAU,MAAM,GAAG,CAAC,CAAC;AAAA,WACzD,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,gBACrC,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM,CAAC,CAAC;AAAA,mBACrD,CAAC,UAAU,yBAAyB,MAAM,MAAM,MAAM,EAAE,CAAC;AAAA;AAE5E,MAAM,mBAAmB,OAAO,KAAK,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,wBAAwB,CAAC;AAAA;AAAA,eAE/F,CAAC,UAAU,SAAS,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AAAA;AAAA;AAAA;AAO5G,MAAM,eAAoC,MAAM;AAC9C,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,GAAG;AACxD,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,eAAe;AAEtE,SACE,oBAAC,4BAAyB,OAAM,QAAO,MAAK,OAAM,eAChD;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,gBAAe;AAAA,MACf,MAAK;AAAA,MACL,aAAU;AAAA,MACV;AAAA,MAEA,8BAAC,qBAAkB;AAAA;AAAA,EACrB,GACF;AAEJ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
4
4
|
import { RequiredDot } from "./RequiredDot.js";
|
|
5
5
|
import { DATA_TESTID } from "../../configs/constants.js";
|
|
6
|
-
const StringTitle = ({
|
|
7
|
-
// TODO @carusox: remove this cast when we have proper TS for SimpleTruncatedTooltipText
|
|
8
|
-
// TODO or even better, remove this component in favor of the future approved one
|
|
9
|
-
/* @__PURE__ */ jsx(SimpleTruncatedTooltipText, { value: column.Header })
|
|
10
|
-
) : /* @__PURE__ */ jsx(Fragment, { children: column.Header });
|
|
6
|
+
const StringTitle = ({ text, textWrap }) => textWrap === "truncate" ? /* @__PURE__ */ jsx(SimpleTruncatedTooltipText, { value: text }) : text;
|
|
11
7
|
const HeaderCellTitle = ({ column, draggableProps, textWrap }) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center" }, "data-testid": DATA_TESTID.DATA_TABLE_HEADER_CELL_TITLE, children: [
|
|
12
|
-
typeof column.Header === "string" ? /* @__PURE__ */ jsx(StringTitle, { column, textWrap }) : /* @__PURE__ */ jsx(column.Header, { column, draggableProps }),
|
|
8
|
+
typeof column.Header === "string" ? /* @__PURE__ */ jsx(StringTitle, { text: column.Header, textWrap: column.textWrap || textWrap }) : /* @__PURE__ */ jsx(column.Header, { column, draggableProps }),
|
|
13
9
|
column.required && /* @__PURE__ */ jsx(RequiredDot, {})
|
|
14
10
|
] });
|
|
15
11
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Headers/HeaderCellTitle.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport type { SortableItemContextType } from '../HoC/SortableItemContext.js';\nimport { RequiredDot } from './RequiredDot.js';\nimport { DATA_TESTID } from '../../configs/constants.js';\n\ninterface HeaderCellTitleProps {\n column: DSDataTableT.InternalColumn;\n draggableProps: SortableItemContextType['draggableProps'];\n textWrap: 'wrap' | 'wrap-all' | 'truncate';\n}\n\nconst StringTitle = ({
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport type { SortableItemContextType } from '../HoC/SortableItemContext.js';\nimport { RequiredDot } from './RequiredDot.js';\nimport { DATA_TESTID } from '../../configs/constants.js';\n\ninterface HeaderCellTitleProps {\n column: DSDataTableT.InternalColumn;\n draggableProps: SortableItemContextType['draggableProps'];\n textWrap: 'wrap' | 'wrap-all' | 'truncate';\n}\n\nconst StringTitle = ({ text, textWrap }: { textWrap: HeaderCellTitleProps['textWrap']; text: string }) =>\n textWrap === 'truncate' ? <SimpleTruncatedTooltipText value={text} /> : text;\n\nexport const HeaderCellTitle: React.ComponentType<HeaderCellTitleProps> = ({ column, draggableProps, textWrap }) => (\n <div style={{ display: 'flex', alignItems: 'center' }} data-testid={DATA_TESTID.DATA_TABLE_HEADER_CELL_TITLE}>\n {typeof column.Header === 'string' ? (\n <StringTitle text={column.Header} textWrap={column.textWrap || textWrap} />\n ) : (\n <column.Header column={column} draggableProps={draggableProps} />\n )}\n {column.required && <RequiredDot />}\n </div>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACcK,cAG1B,YAH0B;AAb5B,SAAS,kCAAkC;AAG3C,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAQ5B,MAAM,cAAc,CAAC,EAAE,MAAM,SAAS,MACpC,aAAa,aAAa,oBAAC,8BAA2B,OAAO,MAAM,IAAK;AAEnE,MAAM,kBAA6D,CAAC,EAAE,QAAQ,gBAAgB,SAAS,MAC5G,qBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS,GAAG,eAAa,YAAY,8BAC7E;AAAA,SAAO,OAAO,WAAW,WACxB,oBAAC,eAAY,MAAM,OAAO,QAAQ,UAAU,OAAO,YAAY,UAAU,IAEzE,oBAAC,OAAO,QAAP,EAAc,QAAgB,gBAAgC;AAAA,EAEhE,OAAO,YAAY,oBAAC,eAAY;AAAA,GACnC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -64,10 +64,14 @@ const withConditionalDnDColumnContext = (Component) => function(props) {
|
|
|
64
64
|
);
|
|
65
65
|
const DnDGroupContextVal = useMemo(() => ({ activeIndex }), [activeIndex]);
|
|
66
66
|
if (dragAndDropColumns)
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
return (
|
|
68
|
+
// For some reason we need to limit the autoScroll threshold to avoid the row container to scroll when the user
|
|
69
|
+
// drags the column header to the left or right
|
|
70
|
+
/* @__PURE__ */ jsxs(DndContext, { ...dndContextProps, autoScroll: { threshold: { y: 0, x: 0.2 } }, children: [
|
|
71
|
+
/* @__PURE__ */ jsx(DnDGroupContext.Provider, { value: DnDGroupContextVal, children: /* @__PURE__ */ jsx(Component, { ...props }) }),
|
|
72
|
+
/* @__PURE__ */ jsx(DragOverlay, { modifiers: [restrictToFirstScrollableAncestor], children: activeId ? /* @__PURE__ */ jsx(HeaderCellGroup, { header: dragOverlayCol, isDragOverlay: true }) : null })
|
|
73
|
+
] })
|
|
74
|
+
);
|
|
71
75
|
return /* @__PURE__ */ jsx(Component, { ...props });
|
|
72
76
|
};
|
|
73
77
|
export {
|
|
@@ -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 func-names */\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;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable func-names */\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 // For some reason we need to limit the autoScroll threshold to avoid the row container to scroll when the user\n // drags the column header to the left or right\n <DndContext {...dndContextProps} autoScroll={{ threshold: { y: 0, x: 0.2 } }}>\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;AC2Ff,SAEI,KAFJ;AAxFR;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,gBAAgB,QAAQ,WAAW,QAAQ,WAAW;AAEzF,YAAM,QAAqD,CAAC;AAC5D,uBAAiB,QAAQ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AO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -84,7 +84,7 @@ const withConditionalDnDRowContext = (Component) => (props) => {
|
|
|
84
84
|
[active, flattenedData]
|
|
85
85
|
);
|
|
86
86
|
if (dragAndDropRows)
|
|
87
|
-
return /* @__PURE__ */ jsxs(DndContext, { ...dndContextProps, children: [
|
|
87
|
+
return /* @__PURE__ */ jsxs(DndContext, { ...dndContextProps, autoScroll: { layoutShiftCompensation: false }, children: [
|
|
88
88
|
/* @__PURE__ */ jsx(SortableContext, { ...containerSortableContextProps, children: /* @__PURE__ */ jsx(DnDTreeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(Component, { ...props }) }) }),
|
|
89
89
|
createPortal(
|
|
90
90
|
/* @__PURE__ */ jsx(DragOverlay, { style: { width: "auto" }, modifiers: [restrictToFirstScrollableAncestor], children: active ? /* @__PURE__ */ jsx(Row, { row: dragOverlayRow, isDragOverlay: true }) : null }),
|
|
@@ -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 {\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,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,aAAa,eAAe;AACrC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB,qBAAqB;AAGhD,SAAS,WAAW;AACpB,SAAS,sBAAsB;AAGxB,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,eAAe,cAAc,CAAC,UAAU,MAAM,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AAA,IAChG,CAAC,gBAAgB;AAAA,EACnB;AAEA,QAAM,EAAE,iBAAiB,sBAAsB,QAAQ,uBAAuB,YAAY,IAAI,oBAAoB;AAAA,IAChH,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,gCAAgC,qBAAqB;AAE3D,QAAM,eAAe,QAAQ,MAAM;AAGjC,QAAI,CAAC,OAAQ,QAAO;AAGpB,UAAM,mBAAmB,CAAC,OAAO,EAAE;AACnC,WAAO,cAAc,OAAO,CAAC,UAAU;AACrC,YAAM,mBAAmB,MAAM,aAAa,QAAQ,iBAAiB,SAAS,MAAM,QAAQ;AAC5F,UAAI,kBAAkB;AACpB,yBAAiB,KAAK,MAAM,GAAG;AAC/B,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,aAAa,CAAC;AAE1B,QAAM,MAAM;AAAA,IACV,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,uBAAuB,WAAW;AAAA,EACnD;AAEA,QAAM,iBAAiB;AAAA,IACrB,MAAO,SAAS,cAAc,KAAK,CAAC,QAAQ,IAAI,QAAQ,OAAO,EAAE,IAAI;AAAA,IACrE,CAAC,QAAQ,aAAa;AAAA,EACxB;AAEA,MAAI;AACF,WACE,qBAAC,cAAY,GAAG,
|
|
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} autoScroll={{ layoutShiftCompensation: false }}>\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,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,aAAa,eAAe;AACrC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB,qBAAqB;AAGhD,SAAS,W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