@elliemae/ds-data-table 3.51.0-next.1 → 3.51.0-next.12
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/DSDataTableDefinitions.js +1 -1
- package/dist/cjs/DSDataTableDefinitions.js.map +1 -1
- 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/useAutocalculated/index.js +2 -13
- package/dist/cjs/configs/useAutocalculated/index.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/configs/useTableColsWithAddons.js +24 -3
- package/dist/cjs/configs/useTableColsWithAddons.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 +8 -7
- 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/DeprecatedDropdown.js +6 -1
- package/dist/cjs/parts/FilterBar/DeprecatedDropdown.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/SortByCaret.js +1 -1
- package/dist/cjs/parts/SortByCaret.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/DSDataTableDefinitions.js +1 -1
- package/dist/esm/DSDataTableDefinitions.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/useAutocalculated/index.js +2 -13
- package/dist/esm/configs/useAutocalculated/index.js.map +2 -2
- 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/configs/useTableColsWithAddons.js +24 -3
- package/dist/esm/configs/useTableColsWithAddons.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 +7 -6
- 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/DeprecatedDropdown.js +6 -1
- package/dist/esm/parts/FilterBar/DeprecatedDropdown.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/SortByCaret.js +1 -1
- package/dist/esm/parts/SortByCaret.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/DSDataTableDefinitions.d.ts +1 -1
- 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/configs/useTableColsWithAddons.d.ts +1 -2
- 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 +31 -31
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/HeaderCell.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-nested-ternary */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport React, { useCallback, useContext, useMemo, useRef } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { StyledHeadTh, StyledHeaderRightIconsWrapper, StyledFocusWithin } from '../../styled.js';\nimport { SortByCaret } from '../SortByCaret.js';\nimport { DragHandle } from '../DnDHandle.js';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport { FilterMapItem } from '../Filters/index.js';\nimport { HeaderResizer } from './HeaderResizer.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useHeaderCellHandlers } from './useHeaderCellHandlers.js';\nimport { useHeaderCellConfig } from './useHeaderCellConfig.js';\nimport { DATA_TESTID } from '../../configs/constants.js';\nimport { HeaderCellTitle } from './HeaderCellTitle.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4FjB;AAzFN,mBAAgE;AAChE,qBAAqB;AACrB,oBAA+E;AAC/E,yBAA4B;AAC5B,uBAA2B;AAC3B,iCAAoC;AACpC,qBAA8B;AAC9B,2BAA8B;AAE9B,mCAAsC;AACtC,iCAAoC;AACpC,uBAA4B;AAC5B,6BAAgC;AAChC,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-nested-ternary */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport React, { useCallback, useContext, useMemo, useRef } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { StyledHeadTh, StyledHeaderRightIconsWrapper, StyledFocusWithin } from '../../styled.js';\nimport { SortByCaret } from '../SortByCaret.js';\nimport { DragHandle } from '../DnDHandle.js';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport { FilterMapItem } from '../Filters/index.js';\nimport { HeaderResizer } from './HeaderResizer.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useHeaderCellHandlers } from './useHeaderCellHandlers.js';\nimport { useHeaderCellConfig } from './useHeaderCellConfig.js';\nimport { DATA_TESTID } from '../../configs/constants.js';\nimport { HeaderCellTitle } from './HeaderCellTitle.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\n\nconst buildScreenReaderInstructions = ({\n colSpan,\n draggable,\n filterable,\n sortable,\n}: {\n colSpan: number;\n draggable: boolean;\n filterable: boolean;\n sortable: boolean;\n}) => {\n const preffix = colSpan === 1 ? '' : 'Column Group. ';\n if (!draggable && !filterable && !sortable) return preffix;\n\n let message = sortable\n ? 'You can sort the data ascendingly/descendingly by this column. Use the up / down arrows keys to do so'\n : '';\n if (draggable && filterable) {\n message = `This column is draggable and filterable. To enable these interactions press the enter key. ${message}`;\n } else if (draggable || filterable) {\n message = `This column is ${\n draggable ? 'draggable' : 'filterable'\n }. To enable this interaction press the enter key. ${message}`;\n }\n return `${preffix}${message}`;\n};\n\ninterface HeaderCellCompProps {\n column: DSDataTableT.InternalColumn;\n isDragOverlay?: boolean;\n colSpan: number;\n}\n\nexport const HeaderCell: React.ComponentType<HeaderCellCompProps> = (props) => {\n const { column, isDragOverlay, colSpan } = props;\n const disabledRows = usePropsStore((state) => state.disabledRows);\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const onFiltersChange = usePropsStore((state) => state.onFiltersChange);\n const filters = usePropsStore((state) => state.filters);\n const textWrap = usePropsStore((state) => state.textWrap);\n const noResultsMessage = usePropsStore((state) => state.noResultsMessage);\n const domIdAffix = usePropsStore((state) => state.domIdAffix);\n const noResultsSecondaryMessage = usePropsStore((state) => state.noResultsSecondaryMessage);\n const isEmptyContent = usePropsStore((state) => state.isEmptyContent);\n const firstFocuseableColumnHeaderId = usePropsStore((state) => state.firstFocuseableColumnHeaderId);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n const reduxHeaders = useInternalStore((state) => state.reduxHeaders);\n const reduxHeader = useMemo(() => reduxHeaders[column.id], [reduxHeaders, column]);\n const dragHandleRef = useRef<HTMLDivElement | null>(null);\n const filterIconRef = useRef<HTMLButtonElement | null>(null);\n const resizeHandlerRef = useRef<HTMLInputElement | null>(null);\n const sortRef = useRef<HTMLButtonElement | null>(null);\n const { draggableProps } = useContext(SortableItemContext);\n\n const { hasFilter, hasDnD, hasSortingCaret, hasRightIcons, shouldShowDnD, hCols, isDragging, shouldShowResize } =\n useHeaderCellConfig(props);\n\n const { handleSort, ...handlers } = useHeaderCellHandlers({\n hasFilter,\n column,\n hasDnD,\n dragHandleRef,\n filterIconRef,\n resizeHandlerRef,\n sortRef,\n hasSortingCaret,\n isDragOverlay,\n draggableProps,\n });\n\n const rightIcons = useMemo(() => {\n if (!hasRightIcons) return null;\n return (\n <StyledHeaderRightIconsWrapper getOwnerProps={getOwnerProps}>\n <FilterMapItem\n column={column}\n onFiltersChange={onFiltersChange}\n reduxHeader={reduxHeader}\n filters={filters}\n innerRef={filterIconRef}\n />\n {hasSortingCaret && (\n <SortByCaret\n isSortedDesc={column.isSortedDesc}\n onClick={(e) => {\n e.stopPropagation();\n handleSort(e as React.MouseEvent);\n }}\n isReachable={reduxHeader?.withTabStops ?? false}\n column={column}\n reduxHeader={reduxHeader}\n innerRef={sortRef}\n />\n )}\n </StyledHeaderRightIconsWrapper>\n );\n }, [hasRightIcons, getOwnerProps, handleSort, column, onFiltersChange, reduxHeader, filters, hasSortingCaret]);\n\n const DnDHandleComponent = useMemo(\n () => (\n <Grid mr=\"2px\" alignItems=\"center\" style={{ position: 'relative' }}>\n <StyledFocusWithin hideFocus={isDragging}>\n <DragHandle\n key={column.id}\n innerRef={dragHandleRef}\n isReachable={reduxHeader?.withTabStops ?? false}\n id={`header-dnd-handle-${column.id}-${domIdAffix}`}\n isDragOverlay={isDragOverlay}\n isDisabled={disabledRows[column.id]}\n />\n </StyledFocusWithin>\n </Grid>\n ),\n [column.id, disabledRows, domIdAffix, isDragOverlay, isDragging, reduxHeader?.withTabStops],\n );\n\n const handleRef = useCallback(\n (_ref: HTMLTableColElement | null) => {\n if (!isDragOverlay) {\n column.ref.current = _ref;\n }\n },\n [column.ref, isDragOverlay],\n );\n\n const screenReaderInstructionsId = `sr-${column.id}-instructions-${domIdAffix}`.replace(/ /g, '');\n\n return (\n <StyledHeadTh\n column={column}\n onClick={handleSort}\n {...handlers}\n role=\"columnheader\"\n {...(isEmptyContent && column.id === firstFocuseableColumnHeaderId\n ? { 'aria-label': `${noResultsMessage}. ${noResultsSecondaryMessage ? `${noResultsSecondaryMessage}.` : ''}` }\n : {})}\n aria-describedby={screenReaderInstructionsId}\n aria-sort={hasSortingCaret ? (column.isSortedDesc ? 'descending' : 'ascending') : 'none'}\n data-testid={DATA_TESTID.DATA_TABLE_HEADER}\n tabIndex={column.isFocuseable === false ? -1 : 0}\n isDraggingActive={Boolean(draggableProps && draggableProps.active)}\n shouldShowDnD={shouldShowDnD}\n innerRef={handleRef}\n getOwnerProps={getOwnerProps}\n >\n <Grid width=\"100%\" cols={hCols}>\n {shouldShowDnD && DnDHandleComponent}\n <HeaderCellTitle column={column} draggableProps={draggableProps} textWrap={textWrap} />\n {rightIcons}\n {shouldShowResize && (\n <HeaderResizer column={column} innerRef={resizeHandlerRef} isReachable={reduxHeader?.withTabStops ?? false} />\n )}\n </Grid>\n <span id={screenReaderInstructionsId} style={{ display: 'none' }} aria-hidden=\"false\">\n {buildScreenReaderInstructions({\n colSpan,\n draggable: dragAndDropColumns && column.disableDnD !== true,\n filterable: hasFilter,\n sortable: column.canSort ?? false,\n })}\n </span>\n </StyledHeadTh>\n );\n};\n",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UAClB,4CAAC,0CAAgB,QAAgB,gBAAgC,UAAoB;AAAA,UACpF;AAAA,UACA,oBACC,4CAAC,sCAAc,QAAgB,UAAU,kBAAkB,aAAa,aAAa,gBAAgB,OAAO;AAAA,WAEhH;AAAA,QACA,4CAAC,UAAK,IAAI,4BAA4B,OAAO,EAAE,SAAS,OAAO,GAAG,eAAY,SAC3E,wCAA8B;AAAA,UAC7B;AAAA,UACA,WAAW,sBAAsB,OAAO,eAAe;AAAA,UACvD,YAAY;AAAA,UACZ,UAAU,OAAO,WAAW;AAAA,QAC9B,CAAC,GACH;AAAA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,18 +34,18 @@ __export(HeaderCellGroup_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(HeaderCellGroup_exports);
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var import_react = require("react");
|
|
38
37
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
39
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
39
|
+
var import_react = require("react");
|
|
40
|
+
var import_DSDataTableDefinitions = require("../../DSDataTableDefinitions.js");
|
|
41
|
+
var import_configs = require("../../configs/index.js");
|
|
42
|
+
var import_createInternalAndPropsContext = require("../../configs/useStore/createInternalAndPropsContext.js");
|
|
43
43
|
var import_DropIndicator = require("../DropIndicator.js");
|
|
44
|
+
var import_SortableItemContext = require("../HoC/SortableItemContext.js");
|
|
45
|
+
var import_withDnDSortableColumnContext = require("../HoC/withDnDSortableColumnContext.js");
|
|
44
46
|
var import_SortableHeaderCell = require("../SortableHeaderCell.js");
|
|
45
47
|
var import_EmptyChildrenGroup = require("./EmptyChildrenGroup.js");
|
|
46
|
-
var
|
|
47
|
-
var import_useStore = require("../../configs/useStore/useStore.js");
|
|
48
|
-
var import_DSDataTableDefinitions = require("../../DSDataTableDefinitions.js");
|
|
48
|
+
var import_HeaderCell = require("./HeaderCell.js");
|
|
49
49
|
const StyledWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_DSDataTableDefinitions.DSDataTableName, slot: import_DSDataTableDefinitions.DSDataTableSlots.HEADER_CELL_WRAPPER })`
|
|
50
50
|
position: relative;
|
|
51
51
|
${({ shouldDropOneLevel, isDragOverlay }) => shouldDropOneLevel && !isDragOverlay ? `top: 50%; height: 50%;` : ""}
|
|
@@ -65,8 +65,8 @@ const HeaderCellGroupComp = ({
|
|
|
65
65
|
isFirst,
|
|
66
66
|
level = 0
|
|
67
67
|
}) => {
|
|
68
|
-
const visibleColumns = (0,
|
|
69
|
-
const getOwnerProps = (0,
|
|
68
|
+
const visibleColumns = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.visibleColumns);
|
|
69
|
+
const getOwnerProps = (0, import_createInternalAndPropsContext.usePropsStore)((store) => store.get);
|
|
70
70
|
const { draggableProps } = (0, import_react.useContext)(import_SortableItemContext.SortableItemContext);
|
|
71
71
|
const isMultiLevel = visibleColumns.some((col) => !!col.columns);
|
|
72
72
|
const children = header.columns;
|
|
@@ -108,5 +108,5 @@ const HeaderCellGroupComp = ({
|
|
|
108
108
|
);
|
|
109
109
|
};
|
|
110
110
|
const HeaderCellGroup = HeaderCellGroupComp;
|
|
111
|
-
const HeaderCellGroupSortable = (0,
|
|
111
|
+
const HeaderCellGroupSortable = (0, import_withDnDSortableColumnContext.withDnDSortableColumnContext)(HeaderCellGroupComp);
|
|
112
112
|
//# sourceMappingURL=HeaderCellGroup.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/HeaderCellGroup.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable complexity */\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqEnB;AAnEJ,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable complexity */\nimport { Grid } from '@elliemae/ds-grid';\nimport { styled } from '@elliemae/ds-system';\nimport React, { useContext } from 'react';\nimport { DSDataTableName, DSDataTableSlots } from '../../DSDataTableDefinitions.js';\nimport { DATA_TESTID } from '../../configs/index.js';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { DropIndicator } from '../DropIndicator.js';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport { withDnDSortableColumnContext } from '../HoC/withDnDSortableColumnContext.js';\nimport { SortableHeaderCell } from '../SortableHeaderCell.js';\nimport { EmptyChildrenGroup } from './EmptyChildrenGroup.js';\nimport { HeaderCell } from './HeaderCell.js';\n\nconst StyledWrapper = styled(Grid, { name: DSDataTableName, slot: DSDataTableSlots.HEADER_CELL_WRAPPER })<{\n shouldDropOneLevel: boolean;\n isDragOverlay?: boolean;\n isDragging?: boolean;\n isFirst?: boolean;\n isLast?: boolean;\n gridColumn: string;\n}>`\n position: relative;\n ${({ shouldDropOneLevel, isDragOverlay }) => (shouldDropOneLevel && !isDragOverlay ? `top: 50%; height: 50%;` : '')}\n width: ${(props) => (props.isDragOverlay ? 'fit-content' : '100%')};\n grid-column: ${(props) => props.gridColumn};\n background: ${(props) => (props.isDragging ? props.theme.colors.neutral['080'] : 'white')};\n opacity: ${(props) => (props.isDragging ? 0.8 : 1)};\n box-shadow: 0 2px 4px 0 ${(props) => (props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent')};\n border-left: ${({ isFirst }) => (isFirst ? '0px' : '1px')} solid ${(props) => props.theme.colors.neutral['080']};\n border-right: ${({ isLast }) => (isLast ? '1px' : '0px')} solid ${(props) => props.theme.colors.neutral['080']};\n`;\n\ninterface HeaderCellGroupCompProps {\n header: DSDataTableT.InternalColumn;\n isDragOverlay?: boolean;\n isDraggingParent?: boolean;\n isLast?: boolean;\n isFirst?: boolean;\n level?: number;\n}\n\nconst HeaderCellGroupComp: React.ComponentType<HeaderCellGroupCompProps> = ({\n header,\n isDragOverlay,\n isDraggingParent,\n isLast,\n isFirst,\n level = 0,\n}) => {\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n const { draggableProps } = useContext(SortableItemContext);\n\n const isMultiLevel = visibleColumns.some((col) => !!col.columns);\n\n const children = header.columns;\n\n const isDragging = (draggableProps && draggableProps.isDragging) || isDraggingParent;\n const dropIndicatorPosition =\n draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;\n\n const ChildGroup = isDragOverlay ? HeaderCellGroup : HeaderCellGroupSortable;\n\n const colSpan = children?.length ?? 1;\n return (\n <StyledWrapper\n innerRef={draggableProps ? draggableProps.setNodeRef : undefined}\n gridColumn={isDragOverlay ? 'auto' : `span ${colSpan}`}\n isDragOverlay={isDragOverlay}\n isDragging={isDragging}\n cols={['auto']}\n data-testid={isDragOverlay ? DATA_TESTID.DATA_TABLE_COLUMN_DRAG_OVERLAY : undefined}\n isFirst={isFirst}\n isLast={isLast}\n shouldDropOneLevel={isMultiLevel && level === 0 && !children}\n getOwnerProps={getOwnerProps}\n >\n <HeaderCell column={header} isDragOverlay={isDragOverlay} colSpan={colSpan} />\n {!!children?.length && !isDragOverlay && (\n <SortableHeaderCell isGroup items={children} isDragOverlay={isDragOverlay} colId={header.id}>\n {children.map((h, index) => (\n <ChildGroup\n key={h.id}\n header={h}\n isDragOverlay={isDragOverlay}\n isDraggingParent={isDragging}\n isLast={index === children.length - 1}\n isFirst={index === 0}\n level={level + 1}\n />\n ))}\n </SortableHeaderCell>\n )}\n {children?.length && isDragOverlay && <EmptyChildrenGroup />}\n <DropIndicator vertical dropIndicatorPosition={dropIndicatorPosition} isLast={isLast && isDragging} isDropValid />\n </StyledWrapper>\n );\n};\n\n// We need to declare this because we MUST avoid the useSortable call in the recursive calls of the function\n\nexport const HeaderCellGroup = HeaderCellGroupComp;\n\nexport const HeaderCellGroupSortable = withDnDSortableColumnContext(HeaderCellGroupComp);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqEnB;AAnEJ,qBAAqB;AACrB,uBAAuB;AACvB,mBAAkC;AAClC,oCAAkD;AAClD,qBAA4B;AAC5B,2CAA8B;AAE9B,2BAA8B;AAC9B,iCAAoC;AACpC,0CAA6C;AAC7C,gCAAmC;AACnC,gCAAmC;AACnC,wBAA2B;AAE3B,MAAM,oBAAgB,yBAAO,qBAAM,EAAE,MAAM,+CAAiB,MAAM,+CAAiB,oBAAoB,CAAC;AAAA;AAAA,IASpG,CAAC,EAAE,oBAAoB,cAAc,MAAO,sBAAsB,CAAC,gBAAgB,2BAA2B,EAAG;AAAA,WAC1G,CAAC,UAAW,MAAM,gBAAgB,gBAAgB,MAAO;AAAA,iBACnD,CAAC,UAAU,MAAM,UAAU;AAAA,gBAC5B,CAAC,UAAW,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI,OAAQ;AAAA,aAC9E,CAAC,UAAW,MAAM,aAAa,MAAM,CAAE;AAAA,4BACxB,CAAC,UAAW,MAAM,gBAAgB,oBAAoB,aAAc;AAAA,iBAC/E,CAAC,EAAE,QAAQ,MAAO,UAAU,QAAQ,KAAM,UAAU,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,kBAC/F,CAAC,EAAE,OAAO,MAAO,SAAS,QAAQ,KAAM,UAAU,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAYhH,MAAM,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B;AAAA,QAC1D,4CAAC,sCAAc,UAAQ,MAAC,uBAA8C,QAAQ,UAAU,YAAY,aAAW,MAAC;AAAA;AAAA;AAAA,EAClH;AAEJ;AAIO,MAAM,kBAAkB;AAExB,MAAM,8BAA0B,kEAA6B,mBAAmB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,14 +36,14 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_styled = require("../../styled.js");
|
|
38
38
|
var import_useHeaderResizer = require("./useHeaderResizer.js");
|
|
39
|
-
var
|
|
39
|
+
var import_createInternalAndPropsContext = require("../../configs/useStore/createInternalAndPropsContext.js");
|
|
40
40
|
const stopPropagation = (e) => e.stopPropagation();
|
|
41
41
|
const HeaderResizer = ({ column, innerRef, isReachable }) => {
|
|
42
42
|
const { isResizing, onResizeStart, onResizeEnd, onResizeHandler, handleKeyboardResize } = (0, import_useHeaderResizer.useHeaderResizer)({
|
|
43
43
|
columnId: column.id,
|
|
44
44
|
innerRef
|
|
45
45
|
});
|
|
46
|
-
const getOwnerProps = (0,
|
|
46
|
+
const getOwnerProps = (0, import_createInternalAndPropsContext.usePropsStore)((store) => store.get);
|
|
47
47
|
(0, import_react.useEffect)(() => {
|
|
48
48
|
const addEvents = () => {
|
|
49
49
|
document.addEventListener("mousemove", onResizeHandler);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/HeaderResizer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useEffect } from 'react';\nimport { StyledResizer } from '../../styled.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useHeaderResizer } from './useHeaderResizer.js';\nimport { usePropsStore } from '../../configs/useStore/
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2CnB;AA3CJ,mBAAiC;AACjC,oBAA8B;AAE9B,8BAAiC;AACjC,
|
|
4
|
+
"sourcesContent": ["import React, { useEffect } from 'react';\nimport { StyledResizer } from '../../styled.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useHeaderResizer } from './useHeaderResizer.js';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\n\nconst stopPropagation = (e: React.MouseEvent) => e.stopPropagation();\n\nexport const HeaderResizer: React.ComponentType<{\n column: DSDataTableT.InternalColumn;\n innerRef: React.MutableRefObject<HTMLInputElement | null>;\n isReachable: boolean;\n}> = ({ column, innerRef, isReachable }) => {\n const { isResizing, onResizeStart, onResizeEnd, onResizeHandler, handleKeyboardResize } = useHeaderResizer({\n columnId: column.id,\n innerRef,\n });\n const getOwnerProps = usePropsStore((store) => store.get);\n\n // This setups the event listeners for the resize (only for mouse)\n // It reacts to the isResizing state change\n useEffect(() => {\n const addEvents = () => {\n document.addEventListener('mousemove', onResizeHandler);\n document.addEventListener('touchmove', onResizeHandler);\n document.addEventListener('mouseup', onResizeEnd);\n document.addEventListener('touchend', onResizeEnd);\n };\n const removeEvents = () => {\n document.removeEventListener('mousemove', onResizeHandler);\n document.removeEventListener('touchmove', onResizeHandler);\n document.removeEventListener('mouseup', onResizeEnd);\n document.removeEventListener('touchend', onResizeEnd);\n };\n\n if (isResizing) addEvents();\n else removeEvents();\n\n // just in case the component is unmounted\n return removeEvents;\n }, [isResizing, onResizeHandler, onResizeEnd]);\n\n return (\n <StyledResizer\n type=\"range\"\n aria-label=\"Resize column\"\n tabIndex={isReachable ? 0 : -1}\n innerRef={innerRef}\n draggable={false}\n onMouseDown={onResizeStart}\n onTouchStart={onResizeStart}\n onMouseUp={onResizeEnd}\n onTouchEnd={onResizeEnd}\n onClick={stopPropagation}\n onKeyDown={handleKeyboardResize}\n getOwnerProps={getOwnerProps}\n />\n );\n};\n", "import * as React from 'react';\nexport {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ConditionalDnDColumnContext = require("../HoC/withConditionalDnDC
|
|
|
39
39
|
var import_HeaderCellGroup = require("./HeaderCellGroup.js");
|
|
40
40
|
var import_SortableHeaderCell = require("../SortableHeaderCell.js");
|
|
41
41
|
var import_gridLayoutHelpers = require("../../helpers/gridLayoutHelpers.js");
|
|
42
|
-
var
|
|
42
|
+
var import_createInternalAndPropsContext = require("../../configs/useStore/createInternalAndPropsContext.js");
|
|
43
43
|
const HeadersComp = () => {
|
|
44
|
-
const isExpandable = (0,
|
|
45
|
-
const isSkeleton = (0,
|
|
46
|
-
const colsLayoutStyle = (0,
|
|
47
|
-
const visibleColumns = (0,
|
|
48
|
-
const columnHeaderRef = (0,
|
|
49
|
-
const virtualListRef = (0,
|
|
50
|
-
const getOwnerProps = (0,
|
|
44
|
+
const isExpandable = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.isExpandable);
|
|
45
|
+
const isSkeleton = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.isSkeleton);
|
|
46
|
+
const colsLayoutStyle = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.colsLayoutStyle);
|
|
47
|
+
const visibleColumns = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.visibleColumns);
|
|
48
|
+
const columnHeaderRef = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.columnHeaderRef);
|
|
49
|
+
const virtualListRef = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.virtualListRef);
|
|
50
|
+
const getOwnerProps = (0, import_createInternalAndPropsContext.usePropsStore)((store) => store.get);
|
|
51
51
|
(0, import_react.useEffect)(() => {
|
|
52
52
|
(0, import_gridLayoutHelpers.setSubColumnsGridLayout)(virtualListRef.current, visibleColumns, true);
|
|
53
53
|
}, [virtualListRef, visibleColumns]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/index.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useEffect } from 'react';\nimport { StyledHeadWrapper, StyledHeadTr } from '../../styled.js';\nimport { withConditionalDnDColumnContext } from '../HoC/withConditionalDnDColumnContext.js';\nimport { HeaderCellGroupSortable } from './HeaderCellGroup.js';\nimport { SortableHeaderCell } from '../SortableHeaderCell.js';\nimport { setSubColumnsGridLayout } from '../../helpers/gridLayoutHelpers.js';\nimport { usePropsStore } from '../../configs/useStore/
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCX;AAnCZ,mBAAiC;AACjC,oBAAgD;AAChD,6CAAgD;AAChD,6BAAwC;AACxC,gCAAmC;AACnC,+BAAwC;AACxC,
|
|
4
|
+
"sourcesContent": ["import React, { useEffect } from 'react';\nimport { StyledHeadWrapper, StyledHeadTr } from '../../styled.js';\nimport { withConditionalDnDColumnContext } from '../HoC/withConditionalDnDColumnContext.js';\nimport { HeaderCellGroupSortable } from './HeaderCellGroup.js';\nimport { SortableHeaderCell } from '../SortableHeaderCell.js';\nimport { setSubColumnsGridLayout } from '../../helpers/gridLayoutHelpers.js';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\n\nconst HeadersComp = () => {\n const isExpandable = usePropsStore((state) => state.isExpandable);\n const isSkeleton = usePropsStore((state) => state.isSkeleton);\n const colsLayoutStyle = usePropsStore((state) => state.colsLayoutStyle);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const columnHeaderRef = usePropsStore((state) => state.columnHeaderRef);\n const virtualListRef = usePropsStore((state) => state.virtualListRef);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n useEffect(() => {\n // TODO: remove this, for further info see the comment on setSubColumnsGridLayout\n setSubColumnsGridLayout(virtualListRef.current, visibleColumns, true);\n }, [virtualListRef, visibleColumns]);\n\n if (visibleColumns.length === 0 && isSkeleton) {\n return null;\n }\n return (\n <StyledHeadWrapper colsLayoutStyle={colsLayoutStyle} innerRef={columnHeaderRef} getOwnerProps={getOwnerProps}>\n <SortableHeaderCell items={visibleColumns}>\n <StyledHeadTr\n role=\"row\"\n colsLayoutStyle={colsLayoutStyle}\n isExpandable={isExpandable}\n getOwnerProps={getOwnerProps}\n >\n {visibleColumns.map((h, index) => (\n <HeaderCellGroupSortable header={h} key={h.id} isLast={index === visibleColumns.length - 1} />\n ))}\n </StyledHeadTr>\n </SortableHeaderCell>\n </StyledHeadWrapper>\n );\n};\n\nexport const Headers = withConditionalDnDColumnContext(HeadersComp);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCX;AAnCZ,mBAAiC;AACjC,oBAAgD;AAChD,6CAAgD;AAChD,6BAAwC;AACxC,gCAAmC;AACnC,+BAAwC;AACxC,2CAA8B;AAE9B,MAAM,cAAc,MAAM;AACxB,QAAM,mBAAe,oDAAc,CAAC,UAAU,MAAM,YAAY;AAChE,QAAM,iBAAa,oDAAc,CAAC,UAAU,MAAM,UAAU;AAC5D,QAAM,sBAAkB,oDAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,qBAAiB,oDAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,sBAAkB,oDAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,qBAAiB,oDAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,oBAAgB,oDAAc,CAAC,UAAU,MAAM,GAAG;AAExD,8BAAU,MAAM;AAEd,0DAAwB,eAAe,SAAS,gBAAgB,IAAI;AAAA,EACtE,GAAG,CAAC,gBAAgB,cAAc,CAAC;AAEnC,MAAI,eAAe,WAAW,KAAK,YAAY;AAC7C,WAAO;AAAA,EACT;AACA,SACE,4CAAC,mCAAkB,iBAAkC,UAAU,iBAAiB,eAC9E,sDAAC,gDAAmB,OAAO,gBACzB;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MAEC,yBAAe,IAAI,CAAC,GAAG,UACtB,4CAAC,kDAAwB,QAAQ,GAAc,QAAQ,UAAU,eAAe,SAAS,KAAhD,EAAE,EAAiD,CAC7F;AAAA;AAAA,EACH,GACF,GACF;AAEJ;AAEO,MAAM,cAAU,wEAAgC,WAAW;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,11 +34,11 @@ module.exports = __toCommonJS(useHeaderCellConfig_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = require("react");
|
|
36
36
|
var import_SortableItemContext = require("../HoC/SortableItemContext.js");
|
|
37
|
-
var
|
|
37
|
+
var import_createInternalAndPropsContext = require("../../configs/useStore/createInternalAndPropsContext.js");
|
|
38
38
|
const useHeaderCellConfig = ({ column, isDragOverlay = false }) => {
|
|
39
|
-
const dragAndDropColumns = (0,
|
|
40
|
-
const isResizeable = (0,
|
|
41
|
-
const reduxHeaders = (0,
|
|
39
|
+
const dragAndDropColumns = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.dragAndDropColumns);
|
|
40
|
+
const isResizeable = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.isResizeable);
|
|
41
|
+
const reduxHeaders = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.reduxHeaders);
|
|
42
42
|
const { draggableProps } = (0, import_react.useContext)(import_SortableItemContext.SortableItemContext);
|
|
43
43
|
const reduxHeader = (0, import_react.useMemo)(() => reduxHeaders[column.id], [reduxHeaders, column]);
|
|
44
44
|
const hasFilter = !!(column.filter || column.Filter);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/useHeaderCellConfig.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport { useContext, useMemo } from 'react';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAoC;AACpC,iCAAoC;AAEpC,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport { useContext, useMemo } from 'react';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\n\ntype UseHeaderCellConfigType = (args: { column: DSDataTableT.InternalColumn; isDragOverlay?: boolean }) => {\n hasFilter: boolean;\n hasDnD: boolean;\n hasSortingCaret: boolean;\n hasRightIcons: boolean;\n isDragging: boolean;\n shouldShowDnD: boolean;\n shouldShowResize: boolean;\n hCols: string[];\n};\n\nexport const useHeaderCellConfig: UseHeaderCellConfigType = ({ column, isDragOverlay = false }) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const isResizeable = usePropsStore((state) => state.isResizeable);\n const reduxHeaders = useInternalStore((state) => state.reduxHeaders);\n\n const { draggableProps } = useContext(SortableItemContext);\n\n const reduxHeader = useMemo(() => reduxHeaders[column.id], [reduxHeaders, column]);\n\n const hasFilter = !!(column.filter || column.Filter);\n\n const hasDnD = dragAndDropColumns && !column.disableDnD;\n\n const hasSortingCaret = Boolean(column.canSort);\n\n const hasRightIcons = !isDragOverlay && (hasSortingCaret || hasFilter);\n\n const isDragging = draggableProps && draggableProps.isDragging;\n\n const shouldShowDnD =\n hasDnD &&\n ((reduxHeader?.showDnDHandle && draggableProps && !draggableProps.active) ||\n (draggableProps && draggableProps.isDragging) ||\n isDragOverlay);\n\n const hasResize = isResizeable && column.canResize !== false && !column.columns;\n\n const shouldShowResize = hasResize && !isDragOverlay && !isDragging;\n\n // Column definition\n const hCols = ['auto'];\n if (hasRightIcons) hCols.push('min-content');\n if (shouldShowDnD) hCols.unshift('min-content');\n\n return {\n hasFilter,\n hasDnD,\n hasSortingCaret,\n hasRightIcons,\n isDragging,\n hCols,\n shouldShowDnD,\n shouldShowResize,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAoC;AACpC,iCAAoC;AAEpC,2CAAgD;AAazC,MAAM,sBAA+C,CAAC,EAAE,QAAQ,gBAAgB,MAAM,MAAM;AACjG,QAAM,yBAAqB,oDAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,mBAAe,oDAAc,CAAC,UAAU,MAAM,YAAY;AAChE,QAAM,mBAAe,uDAAiB,CAAC,UAAU,MAAM,YAAY;AAEnE,QAAM,EAAE,eAAe,QAAI,yBAAW,8CAAmB;AAEzD,QAAM,kBAAc,sBAAQ,MAAM,aAAa,OAAO,EAAE,GAAG,CAAC,cAAc,MAAM,CAAC;AAEjF,QAAM,YAAY,CAAC,EAAE,OAAO,UAAU,OAAO;AAE7C,QAAM,SAAS,sBAAsB,CAAC,OAAO;AAE7C,QAAM,kBAAkB,QAAQ,OAAO,OAAO;AAE9C,QAAM,gBAAgB,CAAC,kBAAkB,mBAAmB;AAE5D,QAAM,aAAa,kBAAkB,eAAe;AAEpD,QAAM,gBACJ,WACE,aAAa,iBAAiB,kBAAkB,CAAC,eAAe,UAC/D,kBAAkB,eAAe,cAClC;AAEJ,QAAM,YAAY,gBAAgB,OAAO,cAAc,SAAS,CAAC,OAAO;AAExE,QAAM,mBAAmB,aAAa,CAAC,iBAAiB,CAAC;AAGzD,QAAM,QAAQ,CAAC,MAAM;AACrB,MAAI,cAAe,OAAM,KAAK,aAAa;AAC3C,MAAI,cAAe,OAAM,QAAQ,aAAa;AAE9C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,7 +33,7 @@ __export(useHeaderCellHandlers_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(useHeaderCellHandlers_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = require("react");
|
|
36
|
-
var
|
|
36
|
+
var import_createInternalAndPropsContext = require("../../configs/useStore/createInternalAndPropsContext.js");
|
|
37
37
|
const buildNextHeader = (reduxHeader, value, hasFilter, hasDnD, hasSortingCaret, withTabStops = false) => ({
|
|
38
38
|
hideFilterMenu: true,
|
|
39
39
|
// Do this to overwrite it if it exists
|
|
@@ -69,12 +69,12 @@ const useHeaderCellHandlers = ({
|
|
|
69
69
|
isDragOverlay,
|
|
70
70
|
draggableProps
|
|
71
71
|
}) => {
|
|
72
|
-
const onColumnSortChange = (0,
|
|
73
|
-
const onColumnSort = (0,
|
|
74
|
-
const visibleColumns = (0,
|
|
75
|
-
const setFocusedRowId = (0,
|
|
76
|
-
const patchHeader = (0,
|
|
77
|
-
const reduxHeaders = (0,
|
|
72
|
+
const onColumnSortChange = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.onColumnSortChange);
|
|
73
|
+
const onColumnSort = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.onColumnSort);
|
|
74
|
+
const visibleColumns = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.visibleColumns);
|
|
75
|
+
const setFocusedRowId = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.setFocusedRowId);
|
|
76
|
+
const patchHeader = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.patchHeader);
|
|
77
|
+
const reduxHeaders = (0, import_createInternalAndPropsContext.useInternalStore)((state) => state.reduxHeaders);
|
|
78
78
|
const reduxHeader = (0, import_react.useMemo)(() => reduxHeaders[column.id], [reduxHeaders, column]);
|
|
79
79
|
const headerRef = column.ref;
|
|
80
80
|
const onMouseEnter = (0, import_react.useCallback)(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/useHeaderCellHandlers.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-params */\nimport { useCallback, useMemo } from 'react';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAqC;AAErC,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-params */\nimport { useCallback, useMemo } from 'react';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\ntype UseHeaderCellHandlersType = (args: {\n hasFilter: boolean;\n column: DSDataTableT.InternalColumn;\n hasDnD: boolean;\n dragHandleRef: React.MutableRefObject<HTMLDivElement | null>;\n sortRef: React.MutableRefObject<HTMLButtonElement | null>;\n filterIconRef: React.MutableRefObject<HTMLButtonElement | null>;\n resizeHandlerRef: React.MutableRefObject<HTMLInputElement | null>;\n hasSortingCaret: boolean;\n isDragOverlay?: boolean;\n draggableProps: DSDataTableT.DraggablePropsT;\n}) => {\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n handleSort: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n onFocus: React.FocusEventHandler;\n onBlur: React.FocusEventHandler;\n};\n\n// TODO: reduxHeader was a mistake from the start.\n// Please remove this and make this logic more simple and\n// easy to follow.\nconst buildNextHeader = (\n reduxHeader: DSDataTableT.ReduxHeader,\n value: boolean,\n hasFilter: boolean,\n hasDnD: boolean,\n hasSortingCaret: boolean,\n withTabStops = false,\n) => ({\n hideFilterMenu: true, // Do this to overwrite it if it exists\n ...reduxHeader,\n hideFilterButton: !(hasFilter && value),\n showDnDHandle: hasDnD && value,\n showSortCaret: hasSortingCaret,\n withTabStops,\n});\n\nconst getNextSortedVisibleColumns = (\n visibleColumns: DSDataTableT.InternalColumn[],\n columnId: string,\n isSortedDesc: boolean,\n) => {\n const doit = (columns: DSDataTableT.InternalColumn[]) =>\n columns.map((col) => {\n const newCol = { ...col };\n delete newCol.isSortedDesc;\n if (col.id === columnId) {\n newCol.isSortedDesc = isSortedDesc;\n }\n if (newCol.columns) {\n newCol.columns = doit(newCol.columns);\n }\n return newCol;\n });\n return doit(visibleColumns);\n};\n\nexport const useHeaderCellHandlers: UseHeaderCellHandlersType = ({\n hasFilter,\n column,\n hasDnD,\n dragHandleRef,\n filterIconRef,\n sortRef,\n resizeHandlerRef,\n hasSortingCaret,\n isDragOverlay,\n draggableProps,\n}) => {\n const onColumnSortChange = usePropsStore((state) => state.onColumnSortChange);\n const onColumnSort = usePropsStore((state) => state.onColumnSort);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const setFocusedRowId = useInternalStore((state) => state.setFocusedRowId);\n const patchHeader = useInternalStore((state) => state.patchHeader);\n const reduxHeaders = useInternalStore((state) => state.reduxHeaders);\n\n const reduxHeader = useMemo(() => reduxHeaders[column.id], [reduxHeaders, column]);\n\n const headerRef = column.ref;\n\n const onMouseEnter: React.MouseEventHandler = useCallback(() => {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n }, [column.id, hasDnD, hasFilter, patchHeader, reduxHeader, hasSortingCaret]);\n\n const onMouseLeave: React.MouseEventHandler = useCallback(() => {\n if (!headerRef?.current?.contains(document.activeElement)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n }\n }, [column.id, hasDnD, hasFilter, headerRef, patchHeader, reduxHeader]);\n\n const handleSort: React.MouseEventHandler = useCallback(() => {\n if (column.canSort) {\n onColumnSortChange?.({\n column: column.id,\n direction: column.isSortedDesc ? 'ASC' : 'DESC',\n });\n onColumnSort(\n getNextSortedVisibleColumns(visibleColumns, column.id, !column.isSortedDesc),\n column.id,\n column.isSortedDesc ? 'ASC' : 'DESC',\n );\n }\n }, [column.canSort, column.id, column.isSortedDesc, onColumnSort, onColumnSortChange, visibleColumns]);\n\n const isActive = draggableProps && draggableProps.active;\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n // we do the same as the draggable rows.\n // we stop the event if the overlay is active\n // main reason is the tab key\n if (isDragOverlay || isActive) {\n e.preventDefault();\n }\n\n if (e.currentTarget !== e.target) return;\n if (e.code === 'ArrowDown' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'DESC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, true), column.id, 'DESC');\n } else if (e.code === 'ArrowUp' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'ASC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, false), column.id, 'ASC');\n } else if (['Enter', 'Space'].includes(e.code)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret, true));\n // Elements don't not yet exist\n setTimeout(() => {\n if (dragHandleRef.current) dragHandleRef.current.focus();\n else if (filterIconRef.current) filterIconRef.current.focus();\n else if (resizeHandlerRef.current) resizeHandlerRef.current.focus();\n else if (sortRef?.current) sortRef.current.focus();\n });\n }\n },\n [\n isDragOverlay,\n isActive,\n column.canSort,\n column.id,\n onColumnSortChange,\n onColumnSort,\n visibleColumns,\n patchHeader,\n reduxHeader,\n hasFilter,\n hasDnD,\n hasSortingCaret,\n dragHandleRef,\n filterIconRef,\n resizeHandlerRef,\n sortRef,\n ],\n );\n\n const onFocus: React.FocusEventHandler = useCallback(\n (e) => {\n // Don't do anything if focus wasn't placed in the element (bubling issues)\n const possibleTargets: (HTMLElement | null)[] = [\n dragHandleRef.current,\n filterIconRef.current,\n resizeHandlerRef.current,\n ];\n if (e.target === headerRef?.current) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n setFocusedRowId(null);\n }\n\n if (possibleTargets.includes(e.target as HTMLElement | null)) {\n patchHeader(column.id, {\n hideFilterButton: !hasFilter,\n showDnDHandle: hasDnD,\n withTabStops: true,\n });\n setFocusedRowId(null);\n }\n },\n [\n column.id,\n dragHandleRef,\n filterIconRef,\n hasDnD,\n hasFilter,\n headerRef,\n patchHeader,\n reduxHeader,\n resizeHandlerRef,\n setFocusedRowId,\n hasSortingCaret,\n ],\n );\n\n const onBlur: React.FocusEventHandler = useCallback(\n (e) => {\n // Don't do anything if blur was caused by going to a child\n if (e.relatedTarget === dragHandleRef.current) return;\n if (e.relatedTarget === filterIconRef.current) return;\n if (e.relatedTarget === resizeHandlerRef.current) return;\n if (e.relatedTarget === sortRef?.current) return;\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n },\n [dragHandleRef, filterIconRef, resizeHandlerRef, sortRef, patchHeader, column.id, reduxHeader, hasFilter, hasDnD],\n );\n\n return { onMouseEnter, onMouseLeave, handleSort, onKeyDown, onBlur, onFocus };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAqC;AAErC,2CAAgD;AAwBhD,MAAM,kBAAkB,CACtB,aACA,OACA,WACA,QACA,iBACA,eAAe,WACX;AAAA,EACJ,gBAAgB;AAAA;AAAA,EAChB,GAAG;AAAA,EACH,kBAAkB,EAAE,aAAa;AAAA,EACjC,eAAe,UAAU;AAAA,EACzB,eAAe;AAAA,EACf;AACF;AAEA,MA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D,UAAI,EAAE,kBAAkB,SAAS,QAAS;AAC1C,kBAAY,OAAO,IAAI,gBAAgB,aAAa,OAAO,WAAW,QAAQ,KAAK,CAAC;AAAA,IACtF;AAAA,IACA,CAAC,eAAe,eAAe,kBAAkB,SAAS,aAAa,OAAO,IAAI,aAAa,WAAW,MAAM;AAAA,EAClH;AAEA,SAAO,EAAE,cAAc,cAAc,YAAY,WAAW,QAAQ,QAAQ;AAC9E;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,10 +32,10 @@ __export(useHeaderResizer_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(useHeaderResizer_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
|
-
var import_react = require("react");
|
|
36
35
|
var import_lodash = require("lodash");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_createInternalAndPropsContext = require("../../configs/useStore/createInternalAndPropsContext.js");
|
|
37
38
|
var import_gridLayoutHelpers = require("../../helpers/gridLayoutHelpers.js");
|
|
38
|
-
var import_useStore = require("../../configs/useStore/useStore.js");
|
|
39
39
|
const narrow = (value, min, max) => Math.min(Math.max(value, min ?? 30), max ?? Infinity);
|
|
40
40
|
const getCorrectDelta = (e) => {
|
|
41
41
|
let multiplier = 1;
|
|
@@ -53,10 +53,10 @@ const useHeaderResizer = ({
|
|
|
53
53
|
columnId,
|
|
54
54
|
innerRef
|
|
55
55
|
}) => {
|
|
56
|
-
const visibleColumns = (0,
|
|
57
|
-
const onColumnResize = (0,
|
|
58
|
-
const onColumnSizeChange = (0,
|
|
59
|
-
const virtualListRef = (0,
|
|
56
|
+
const visibleColumns = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.visibleColumns);
|
|
57
|
+
const onColumnResize = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.onColumnResize);
|
|
58
|
+
const onColumnSizeChange = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.onColumnSizeChange);
|
|
59
|
+
const virtualListRef = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.virtualListRef);
|
|
60
60
|
const [isResizing, setIsResizing] = (0, import_react.useState)(false);
|
|
61
61
|
const visibleColumnsCopy = (0, import_react.useMemo)(() => (0, import_lodash.cloneDeep)(visibleColumns), [visibleColumns]);
|
|
62
62
|
const visibleColumnsOnGridLayout = (0, import_react.useMemo)(
|
|
@@ -91,7 +91,7 @@ const useHeaderResizer = ({
|
|
|
91
91
|
}, [pushColumnSizeChange, virtualListRef, realColumnIndex]);
|
|
92
92
|
const onResizeHandler = (0, import_react.useCallback)(
|
|
93
93
|
(e) => {
|
|
94
|
-
if (realColumnIndex
|
|
94
|
+
if (realColumnIndex === -1) return;
|
|
95
95
|
const delta = ("clientX" in e ? e.clientX : e.touches[0].clientX) - (innerRef.current?.getBoundingClientRect().x ?? 0);
|
|
96
96
|
const originalWidth = (0, import_gridLayoutHelpers.getGridLayout)(virtualListRef.current)[realColumnIndex];
|
|
97
97
|
const widthWithDelta = narrow(
|
|
@@ -108,7 +108,7 @@ const useHeaderResizer = ({
|
|
|
108
108
|
);
|
|
109
109
|
const handleKeyboardResize = (0, import_react.useCallback)(
|
|
110
110
|
(e) => {
|
|
111
|
-
if (realColumnIndex
|
|
111
|
+
if (realColumnIndex === -1) return;
|
|
112
112
|
if (e.key === "Enter") {
|
|
113
113
|
e.stopPropagation();
|
|
114
114
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/useHeaderResizer.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+C;AAC/C,
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,oBAA0B;AAC1B,mBAA+C;AAC/C,2CAA8B;AAC9B,+BAKO;AAMP,MAAM,SAAS,CAAC,OAAe,KAAyB,QACtD,KAAK,IAAI,KAAK,IAAI,OAAO,OAAO,EAAE,GAAG,OAAO,QAAQ;AAGtD,MAAM,kBAAkB,CAAC,MAA2B;AAClD,MAAI,aAAa;AAEjB,MAAI,EAAE,SAAU,eAAc;AAC9B,MAAI,EAAE,OAAQ,eAAc;AAE5B,MAAI,EAAE,SAAS,aAAa;AAC1B,WAAO,CAAC;AAAA,EACV;AACA,MAAI,EAAE,SAAS,cAAc;AAC3B,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AACF,MAGM;AACJ,QAAM,qBAAiB,oDAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,qBAAiB,oDAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,yBAAqB,oDAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,qBAAiB,oDAAc,CAAC,UAAU,MAAM,cAAc;AAEpE,QAAM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
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DnDGroupContext_exports = {};
|
|
30
|
+
__export(DnDGroupContext_exports, {
|
|
31
|
+
DnDGroupContext: () => DnDGroupContext
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(DnDGroupContext_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
const DnDGroupContext = (0, import_react.createContext)({
|
|
37
|
+
activeIndex: null
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=DnDGroupContext.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/parts/HoC/DnDGroupContext.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\nimport type { DnDGroupContextType } from './withConditionalDnDColumnContext.js';\n\nexport const DnDGroupContext = createContext<DnDGroupContextType>({\n activeIndex: null,\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAGvB,MAAM,sBAAkB,4BAAmC;AAAA,EAChE,aAAa;AACf,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -28,20 +28,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var withConditionalDnDColumnContext_exports = {};
|
|
30
30
|
__export(withConditionalDnDColumnContext_exports, {
|
|
31
|
-
DnDGroupContext: () => DnDGroupContext,
|
|
32
31
|
withConditionalDnDColumnContext: () => withConditionalDnDColumnContext
|
|
33
32
|
});
|
|
34
33
|
module.exports = __toCommonJS(withConditionalDnDColumnContext_exports);
|
|
35
34
|
var React = __toESM(require("react"));
|
|
36
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var import_react = require("react");
|
|
38
36
|
var import_ds_drag_and_drop = require("@elliemae/ds-drag-and-drop");
|
|
39
|
-
var
|
|
37
|
+
var import_react = require("react");
|
|
40
38
|
var import_Columns = require("../../addons/Columns/index.js");
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
39
|
+
var import_createInternalAndPropsContext = require("../../configs/useStore/createInternalAndPropsContext.js");
|
|
40
|
+
var import_HeaderCellGroup = require("../Headers/HeaderCellGroup.js");
|
|
41
|
+
var import_DnDGroupContext = require("./DnDGroupContext.js");
|
|
45
42
|
const flattenColumns = (cols) => {
|
|
46
43
|
const augmentedColumns = [];
|
|
47
44
|
const flatten = (col, index, parentId = null) => {
|
|
@@ -56,9 +53,9 @@ const flattenColumns = (cols) => {
|
|
|
56
53
|
return augmentedColumns;
|
|
57
54
|
};
|
|
58
55
|
const withConditionalDnDColumnContext = (Component) => function(props) {
|
|
59
|
-
const dragAndDropColumns = (0,
|
|
60
|
-
const onColumnsReorder = (0,
|
|
61
|
-
const visibleColumns = (0,
|
|
56
|
+
const dragAndDropColumns = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.dragAndDropColumns);
|
|
57
|
+
const onColumnsReorder = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.onColumnsReorder);
|
|
58
|
+
const visibleColumns = (0, import_createInternalAndPropsContext.usePropsStore)((state) => state.visibleColumns);
|
|
62
59
|
const flattenedItems = (0, import_react.useMemo)(() => flattenColumns(visibleColumns), [visibleColumns]);
|
|
63
60
|
const onReorder = (0, import_react.useCallback)(
|
|
64
61
|
(movedItem, indexes) => {
|
|
@@ -92,10 +89,11 @@ const withConditionalDnDColumnContext = (Component) => function(props) {
|
|
|
92
89
|
() => activeId ? flattenedItems.find((item) => item.uid === activeId)?.original : null,
|
|
93
90
|
[activeId, flattenedItems]
|
|
94
91
|
);
|
|
92
|
+
const DnDGroupContextVal = (0, import_react.useMemo)(() => ({ activeIndex }), [activeIndex]);
|
|
95
93
|
if (dragAndDropColumns)
|
|
96
94
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_drag_and_drop.DndContext, { ...dndContextProps, children: [
|
|
97
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DnDGroupContext.Provider, { value:
|
|
98
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_drag_and_drop.DragOverlay, { modifiers: [import_ds_drag_and_drop.restrictToFirstScrollableAncestor], children: activeId ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DnDGroupContext.DnDGroupContext.Provider, { value: DnDGroupContextVal, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props }) }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_drag_and_drop.DragOverlay, { modifiers: [import_ds_drag_and_drop.restrictToFirstScrollableAncestor], children: activeId ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_HeaderCellGroup.HeaderCellGroup, { header: dragOverlayCol, isDragOverlay: true }) : null })
|
|
99
97
|
] });
|
|
100
98
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props });
|
|
101
99
|
};
|