@elliemae/ds-data-table 3.2.1-rc.4 → 3.2.1-rc.7
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 -15
- package/dist/cjs/DataTable.js.map +1 -1
- package/dist/cjs/addons/Columns/ColumnExpand/ColumnExpand.js +5 -17
- package/dist/cjs/addons/Columns/ColumnExpand/ColumnExpand.js.map +1 -1
- package/dist/cjs/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js +1 -18
- package/dist/cjs/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js.map +1 -1
- package/dist/cjs/addons/Filters/Components/CurrencyRangeFilter/index.js +6 -21
- package/dist/cjs/addons/Filters/Components/CurrencyRangeFilter/index.js.map +1 -1
- package/dist/cjs/addons/Filters/Components/NumberRangeFilter/index.js +6 -21
- package/dist/cjs/addons/Filters/Components/NumberRangeFilter/index.js.map +1 -1
- package/dist/cjs/addons/Pagination/Pagination.js +3 -19
- package/dist/cjs/addons/Pagination/Pagination.js.map +1 -1
- package/dist/cjs/configs/useDatatableConfig.js +4 -17
- package/dist/cjs/configs/useDatatableConfig.js.map +1 -1
- package/dist/cjs/configs/useInternalStateConfig.js +2 -16
- package/dist/cjs/configs/useInternalStateConfig.js.map +1 -1
- package/dist/cjs/configs/useTableColsWithAddons.js +4 -21
- package/dist/cjs/configs/useTableColsWithAddons.js.map +1 -1
- package/dist/cjs/exported-related/FilterPopover.js +3 -19
- package/dist/cjs/exported-related/FilterPopover.js.map +1 -1
- package/dist/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js +4 -21
- package/dist/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js.map +1 -1
- package/dist/cjs/exported-related/RowRenderer/index.js +11 -24
- package/dist/cjs/exported-related/RowRenderer/index.js.map +1 -1
- package/dist/cjs/exported-related/RowRenderer/useRowRendererProperties.js +4 -17
- package/dist/cjs/exported-related/RowRenderer/useRowRendererProperties.js.map +1 -1
- package/dist/cjs/exported-related/Toolbar/Toolbar.js +8 -16
- package/dist/cjs/exported-related/Toolbar/Toolbar.js.map +2 -2
- package/dist/cjs/parts/Cells/Cell.js +21 -26
- package/dist/cjs/parts/Cells/Cell.js.map +2 -2
- package/dist/cjs/parts/DnDHandle.js +7 -21
- package/dist/cjs/parts/DnDHandle.js.map +1 -1
- package/dist/cjs/parts/Filters/index.js +9 -21
- package/dist/cjs/parts/Filters/index.js.map +1 -1
- package/dist/cjs/parts/Headers/HeaderCell.js +4 -21
- package/dist/cjs/parts/Headers/HeaderCell.js.map +1 -1
- package/dist/cjs/parts/Headers/HeaderResizer.js +1 -15
- package/dist/cjs/parts/Headers/HeaderResizer.js.map +1 -1
- package/dist/cjs/parts/Headers/useHeaderCellHandlers.js +3 -20
- package/dist/cjs/parts/Headers/useHeaderCellHandlers.js.map +1 -1
- package/dist/cjs/parts/HoC/withConditionalDnDColumnContext.js +9 -17
- package/dist/cjs/parts/HoC/withConditionalDnDColumnContext.js.map +1 -1
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +11 -17
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +1 -1
- package/dist/cjs/parts/HoC/withConditionalDnDSortableContext.js +6 -16
- package/dist/cjs/parts/HoC/withConditionalDnDSortableContext.js.map +1 -1
- package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js +6 -20
- package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js.map +1 -1
- package/dist/cjs/parts/HoC/withDnDSortableRowContext.js +6 -20
- package/dist/cjs/parts/HoC/withDnDSortableRowContext.js.map +1 -1
- package/dist/cjs/parts/RowVariants/RowVariantSkeleton.js +3 -19
- package/dist/cjs/parts/RowVariants/RowVariantSkeleton.js.map +1 -1
- package/dist/cjs/parts/RowVariants/index.js +11 -21
- package/dist/cjs/parts/RowVariants/index.js.map +1 -1
- package/dist/cjs/parts/Rows.js +3 -15
- package/dist/cjs/parts/Rows.js.map +1 -1
- package/dist/cjs/parts/SortableHeaderCell.js +12 -46
- package/dist/cjs/parts/SortableHeaderCell.js.map +1 -1
- package/dist/cjs/parts/TableContent.js +3 -19
- package/dist/cjs/parts/TableContent.js.map +1 -1
- package/dist/cjs/parts/VirtualRowsList.js +1 -1
- package/dist/cjs/parts/VirtualRowsList.js.map +2 -2
- package/dist/cjs/styled.js +1 -1
- package/dist/cjs/styled.js.map +1 -1
- package/dist/esm/DataTable.js +1 -17
- package/dist/esm/DataTable.js.map +1 -1
- package/dist/esm/addons/Columns/ColumnExpand/ColumnExpand.js +5 -19
- package/dist/esm/addons/Columns/ColumnExpand/ColumnExpand.js.map +1 -1
- package/dist/esm/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js +1 -20
- package/dist/esm/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js.map +1 -1
- package/dist/esm/addons/Filters/Components/CurrencyRangeFilter/index.js +6 -23
- package/dist/esm/addons/Filters/Components/CurrencyRangeFilter/index.js.map +1 -1
- package/dist/esm/addons/Filters/Components/NumberRangeFilter/index.js +6 -23
- package/dist/esm/addons/Filters/Components/NumberRangeFilter/index.js.map +1 -1
- package/dist/esm/addons/Pagination/Pagination.js +3 -21
- package/dist/esm/addons/Pagination/Pagination.js.map +1 -1
- package/dist/esm/configs/useDatatableConfig.js +4 -19
- package/dist/esm/configs/useDatatableConfig.js.map +1 -1
- package/dist/esm/configs/useInternalStateConfig.js +2 -18
- package/dist/esm/configs/useInternalStateConfig.js.map +1 -1
- package/dist/esm/configs/useTableColsWithAddons.js +4 -23
- package/dist/esm/configs/useTableColsWithAddons.js.map +1 -1
- package/dist/esm/exported-related/FilterPopover.js +3 -21
- package/dist/esm/exported-related/FilterPopover.js.map +1 -1
- package/dist/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js +4 -23
- package/dist/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js.map +1 -1
- package/dist/esm/exported-related/RowRenderer/index.js +11 -26
- package/dist/esm/exported-related/RowRenderer/index.js.map +1 -1
- package/dist/esm/exported-related/RowRenderer/useRowRendererProperties.js +4 -19
- package/dist/esm/exported-related/RowRenderer/useRowRendererProperties.js.map +1 -1
- package/dist/esm/exported-related/Toolbar/Toolbar.js +8 -16
- package/dist/esm/exported-related/Toolbar/Toolbar.js.map +2 -2
- package/dist/esm/parts/Cells/Cell.js +21 -28
- package/dist/esm/parts/Cells/Cell.js.map +2 -2
- package/dist/esm/parts/DnDHandle.js +7 -23
- package/dist/esm/parts/DnDHandle.js.map +1 -1
- package/dist/esm/parts/Filters/index.js +9 -23
- package/dist/esm/parts/Filters/index.js.map +1 -1
- package/dist/esm/parts/Headers/HeaderCell.js +4 -23
- package/dist/esm/parts/Headers/HeaderCell.js.map +1 -1
- package/dist/esm/parts/Headers/HeaderResizer.js +1 -17
- package/dist/esm/parts/Headers/HeaderResizer.js.map +1 -1
- package/dist/esm/parts/Headers/useHeaderCellHandlers.js +3 -22
- package/dist/esm/parts/Headers/useHeaderCellHandlers.js.map +1 -1
- package/dist/esm/parts/HoC/withConditionalDnDColumnContext.js +9 -19
- package/dist/esm/parts/HoC/withConditionalDnDColumnContext.js.map +1 -1
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +11 -19
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +1 -1
- package/dist/esm/parts/HoC/withConditionalDnDSortableContext.js +6 -18
- package/dist/esm/parts/HoC/withConditionalDnDSortableContext.js.map +1 -1
- package/dist/esm/parts/HoC/withDnDSortableColumnContext.js +6 -22
- package/dist/esm/parts/HoC/withDnDSortableColumnContext.js.map +1 -1
- package/dist/esm/parts/HoC/withDnDSortableRowContext.js +6 -22
- package/dist/esm/parts/HoC/withDnDSortableRowContext.js.map +1 -1
- package/dist/esm/parts/RowVariants/RowVariantSkeleton.js +3 -21
- package/dist/esm/parts/RowVariants/RowVariantSkeleton.js.map +1 -1
- package/dist/esm/parts/RowVariants/index.js +11 -23
- package/dist/esm/parts/RowVariants/index.js.map +1 -1
- package/dist/esm/parts/Rows.js +3 -17
- package/dist/esm/parts/Rows.js.map +1 -1
- package/dist/esm/parts/SortableHeaderCell.js +12 -48
- package/dist/esm/parts/SortableHeaderCell.js.map +1 -1
- package/dist/esm/parts/TableContent.js +3 -21
- package/dist/esm/parts/TableContent.js.map +1 -1
- package/dist/esm/parts/VirtualRowsList.js +1 -1
- package/dist/esm/parts/VirtualRowsList.js.map +2 -2
- package/dist/esm/styled.js +1 -1
- package/dist/esm/styled.js.map +1 -1
- package/package.json +18 -18
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Headers/useHeaderCellHandlers.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\nimport { useCallback } from 'react';\nimport { TypescriptColumn } from '../../types/props';\n\ntype useHeaderCellHandlersType = (args: {\n hasFilter: boolean;\n patchHeader: (headerId: string, newHeader: Record<string, unknown>) => void;\n column: TypescriptColumn;\n reduxHeader: Record<string, unknown>;\n hasDnD: boolean;\n onColumnSortChange: (newSort: { column: string; direction: 'ASC' | 'DESC' }) => void;\n dragHandleRef: React.MutableRefObject<HTMLDivElement>;\n filterIconRef: React.MutableRefObject<HTMLDivElement>;\n headerRef: React.MutableRefObject<HTMLTableColElement>;\n}) => {\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n onClick: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n onFocus: React.FocusEventHandler;\n onBlur: React.FocusEventHandler;\n};\n\nconst buildNextHeader = (\n reduxHeader: Record<string, unknown>,\n value: boolean,\n hasFilter: boolean,\n hasDnD: 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 withTabStops,\n});\n\nexport const useHeaderCellHandlers: useHeaderCellHandlersType = ({\n hasFilter,\n patchHeader,\n column,\n reduxHeader,\n hasDnD,\n onColumnSortChange,\n dragHandleRef,\n filterIconRef,\n headerRef,\n}) => {\n const onMouseEnter: React.MouseEventHandler = useCallback(() => {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD));\n }, [column.id, hasDnD, hasFilter, patchHeader, reduxHeader]);\n\n const onMouseLeave: React.MouseEventHandler = useCallback(() => {\n if (!headerRef?.current?.contains(document.activeElement)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD));\n }\n }, [column.id, hasDnD, hasFilter, headerRef, patchHeader, reduxHeader]);\n\n const onClick: React.MouseEventHandler = useCallback(() => {\n if (column.canSort) {\n onColumnSortChange({\n column: column.id,\n direction: column.isSortedDesc ? 'ASC' : 'DESC',\n });\n }\n }, [column.canSort, column.id, column.isSortedDesc, onColumnSortChange]);\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (e.code === 'ArrowDown' && column.canSort) {\n e.preventDefault();\n onColumnSortChange({\n column: column.id,\n direction: 'DESC',\n });\n } else if (e.code === 'ArrowUp' && column.canSort) {\n e.preventDefault();\n onColumnSortChange({\n column: column.id,\n direction: 'ASC',\n });\n } else if (['Enter', 'Space'].includes(e.code)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, 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 });\n }\n },\n [\n column.canSort,\n column.id,\n onColumnSortChange,\n patchHeader,\n reduxHeader,\n hasFilter,\n hasDnD,\n dragHandleRef,\n filterIconRef,\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 if (e.target === headerRef?.current) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD));\n }\n },\n [column.id, hasDnD, hasFilter, headerRef, patchHeader, reduxHeader],\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 patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD));\n },\n [dragHandleRef, filterIconRef, patchHeader, column.id, reduxHeader, hasFilter, hasDnD],\n );\n\n return { onMouseEnter, onMouseLeave, onClick, onKeyDown, onBlur, onFocus };\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AAsBA,MAAM,kBAAkB,CACtB,aACA,OACA,WACA,QACA,eAAe,UACX;AAAA,EACJ,gBAAgB;AAAA,EAChB,GAAG;AAAA,EACH,kBAAkB,CAAE,cAAa;AAAA,EACjC,eAAe,UAAU;AAAA,EACzB;AACF;AAEO,MAAM,wBAAmD,CAAC;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACI;AACJ,QAAM,eAAwC,YAAY,MAAM;AAC9D,gBAAY,OAAO,IAAI,gBAAgB,aAAa,MAAM,WAAW,MAAM,CAAC;AAAA,EAC9E,GAAG,CAAC,OAAO,IAAI,QAAQ,WAAW,aAAa,WAAW,CAAC;AAE3D,QAAM,eAAwC,YAAY,MAAM;AAC9D,QAAI,CAAC,WAAW,SAAS,SAAS,SAAS,aAAa,GAAG;AACzD,kBAAY,OAAO,IAAI,gBAAgB,aAAa,OAAO,WAAW,MAAM,CAAC;AAAA,IAC/E;AAAA,EACF,GAAG,CAAC,OAAO,IAAI,QAAQ,WAAW,WAAW,aAAa,WAAW,CAAC;AAEtE,QAAM,UAAmC,YAAY,MAAM;AACzD,QAAI,OAAO,SAAS;AAClB,yBAAmB;AAAA,QACjB,QAAQ,OAAO;AAAA,QACf,WAAW,OAAO,eAAe,QAAQ;AAAA,MAC3C,CAAC;AAAA,IACH;AAAA,EACF,GAAG,CAAC,OAAO,SAAS,OAAO,IAAI,OAAO,cAAc,kBAAkB,CAAC;AAEvE,QAAM,YAAwC,YAC5C,CAAC,MAAM;AACL,QAAI,EAAE,SAAS,eAAe,OAAO,SAAS;AAC5C,QAAE,eAAe;AACjB,yBAAmB;AAAA,QACjB,QAAQ,OAAO;AAAA,QACf,WAAW;AAAA,MACb,CAAC;AAAA,IACH,WAAW,EAAE,SAAS,aAAa,OAAO,SAAS;AACjD,QAAE,eAAe;AACjB,yBAAmB;AAAA,QACjB,QAAQ,OAAO;AAAA,QACf,WAAW;AAAA,MACb,CAAC;AAAA,IACH,WAAW,CAAC,SAAS,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG;AAC9C,kBAAY,OAAO,IAAI,gBAAgB,aAAa,MAAM,WAAW,QAAQ,IAAI,CAAC;AAElF,iBAAW,MAAM;AACf,YAAI,cAAc;AAAS,wBAAc,QAAQ,MAAM;AAAA,iBAC9C,cAAc;AAAS,wBAAc,QAAQ,MAAM;AAAA,MAC9D,CAAC;AAAA,IACH;AAAA,EACF,GACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CACF;AAEA,QAAM,UAAmC,YACvC,CAAC,MAAM;AAEL,QAAI,EAAE,WAAW,WAAW,SAAS;AACnC,kBAAY,OAAO,IAAI,gBAAgB,aAAa,MAAM,WAAW,MAAM,CAAC;AAAA,IAC9E;AAAA,EACF,GACA,CAAC,OAAO,IAAI,QAAQ,WAAW,WAAW,aAAa,WAAW,CACpE;AAEA,QAAM,SAAkC,YACtC,CAAC,MAAM;AAEL,QAAI,EAAE,kBAAkB,cAAc;AAAS;AAC/C,QAAI,EAAE,kBAAkB,cAAc;AAAS;AAC/C,gBAAY,OAAO,IAAI,gBAAgB,aAAa,OAAO,WAAW,MAAM,CAAC;AAAA,EAC/E,GACA,CAAC,eAAe,eAAe,aAAa,OAAO,IAAI,aAAa,WAAW,MAAM,CACvF;AAEA,SAAO,EAAE,cAAc,cAAc,SAAS,WAAW,QAAQ,QAAQ;AAC3E;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
2
|
import * as React from "react";
|
|
19
3
|
import React2, { createContext, useCallback, useMemo } from "react";
|
|
20
4
|
import { DndContext, DragOverlay } from "@dnd-kit/core";
|
|
@@ -90,13 +74,19 @@ const withConditionalDnDColumnContext = (Component) => (props) => {
|
|
|
90
74
|
onPreviewDragStart
|
|
91
75
|
});
|
|
92
76
|
if (dragAndDropColumns)
|
|
93
|
-
return /* @__PURE__ */ React2.createElement(DndContext,
|
|
77
|
+
return /* @__PURE__ */ React2.createElement(DndContext, {
|
|
78
|
+
...dndContextProps
|
|
79
|
+
}, /* @__PURE__ */ React2.createElement(DnDGroupContext.Provider, {
|
|
94
80
|
value: { activeIndex }
|
|
95
|
-
}, /* @__PURE__ */ React2.createElement(Component,
|
|
81
|
+
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
82
|
+
...props
|
|
83
|
+
})), /* @__PURE__ */ React2.createElement(DragOverlay, null, activeId ? /* @__PURE__ */ React2.createElement(HeaderCellGroup, {
|
|
96
84
|
header: flattenedItems.find(([item]) => item.id === activeId)[1],
|
|
97
85
|
isDragOverlay: true
|
|
98
86
|
}) : null));
|
|
99
|
-
return /* @__PURE__ */ React2.createElement(Component,
|
|
87
|
+
return /* @__PURE__ */ React2.createElement(Component, {
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
100
90
|
};
|
|
101
91
|
export {
|
|
102
92
|
DnDGroupContext,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDColumnContext.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-underscore-dangle */\n/* eslint-disable max-params */\nimport React, { createContext, useCallback, useMemo } from 'react';\nimport { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { useHierarchyDndkitConfig } from '@elliemae/ds-drag-and-drop';\nimport { arrayMove } from '@dnd-kit/sortable';\nimport { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { DataTableContext } from '../../DataTableContext';\nimport { Item } from '../../helpers/dndkit/hierarchy/types';\nimport { TypescriptColumn } from '../../types/props';\nimport { HeaderCellGroup } from '../internal';\nimport { DATA_TESTID } from '../../configs/constants';\nimport { INTERNAL_COLUMNS } from '../../addons/Columns';\n\ntype DnDGroupContextType = {\n activeIndex: number;\n};\n\nexport const DnDGroupContext = createContext<DnDGroupContextType>({\n activeIndex: undefined,\n});\n\nconst flattenColumns = (cols: TypescriptColumn[]) => {\n const flattened = [];\n const flatten = (col: TypescriptColumn, index, parentId = null) => {\n const { id } = col;\n flattened.push([{ id, parentId, index }, col]);\n if (col.columns)\n col.columns.forEach((subColumn: TypescriptColumn, childIndex: number) => flatten(subColumn, childIndex, id));\n };\n cols.forEach((col, index) => flatten(col, index));\n return flattened;\n};\n\n// only wraps in \"DnDContext\" and \"DnDGroupContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDColumnContext: FunctionalHOC = (Component) => (props) => {\n const {\n tableProps: { dragAndDropColumns, onColumnsReorder },\n visibleColumns,\n } = React.useContext(DataTableContext);\n\n const flattenedItems = useMemo(() => flattenColumns(visibleColumns), [visibleColumns]);\n\n const onReorder = useCallback(\n (movedItem: Item, indexes: { targetIndex: number; fromIndex: number }) => {\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 = {};\n newFlattenedData.forEach(([dndData, colData]) => {\n delete colData.columns;\n nodes[dndData.id] = colData;\n });\n const newData = [];\n newFlattenedData.forEach(([dndData, colData]) => {\n // Don't send internal columns to the user\n if (INTERNAL_COLUMNS.includes(dndData.id)) {\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 onPreviewResetState = useCallback(() => {\n const el: HTMLDivElement | null = document.body.querySelector(\n `[data-testid=\"${DATA_TESTID.DATA_TABLE_SCROLLABLE_CONTAINER}\"]`,\n );\n if (el) el.onscroll = () => null;\n }, []);\n\n const onPreviewDragStart = useCallback(() => {\n const el: HTMLDivElement | null = document.body.querySelector(\n `[data-testid=\"${DATA_TESTID.DATA_TABLE_SCROLLABLE_CONTAINER}\"]`,\n );\n if (el) {\n const y = el.scrollTop;\n el.onscroll = () => {\n el.scrollTo({ top: y });\n };\n }\n }, []);\n\n const { dndContextProps, activeId, activeIndex } = useHierarchyDndkitConfig({\n flattenedItems,\n dragOverlayDataTestid: DATA_TESTID.DATA_TABLE_COLUMN_DRAG_OVERLAY,\n isHorizontalDnD: true,\n onReorder,\n onPreviewResetState,\n onPreviewDragStart,\n });\n\n if (dragAndDropColumns)\n return (\n <DndContext {...dndContextProps}>\n <DnDGroupContext.Provider value={{ activeIndex }}>\n <Component {...props} />\n </DnDGroupContext.Provider>\n <DragOverlay>\n {activeId ? (\n <HeaderCellGroup header={flattenedItems.find(([item]) => item.id === activeId)[1]} isDragOverlay />\n ) : null}\n </DragOverlay>\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACEA;AACA;AACA;AACA;AAEA;AAGA;AACA;AACA;AAMO,MAAM,kBAAkB,cAAmC;AAAA,EAChE,aAAa;AACf,CAAC;AAED,MAAM,iBAAiB,CAAC,SAA6B;AACnD,QAAM,YAAY,CAAC;AACnB,QAAM,UAAU,CAAC,KAAuB,OAAO,WAAW,SAAS;AACjE,UAAM,EAAE,OAAO;AACf,cAAU,KAAK,CAAC,EAAE,IAAI,UAAU,MAAM,GAAG,GAAG,CAAC;AAC7C,QAAI,IAAI;AACN,UAAI,QAAQ,QAAQ,CAAC,WAA6B,eAAuB,QAAQ,WAAW,YAAY,EAAE,CAAC;AAAA,EAC/G;AACA,OAAK,QAAQ,CAAC,KAAK,UAAU,QAAQ,KAAK,KAAK,CAAC;AAChD,SAAO;AACT;AAGO,MAAM,kCAAiD,CAAC,cAAc,CAAC,UAAU;AACtF,QAAM;AAAA,IACJ,YAAY,EAAE,oBAAoB;AAAA,IAClC;AAAA,MACE,OAAM,WAAW,gBAAgB;AAErC,QAAM,iBAAiB,QAAQ,MAAM,eAAe,cAAc,GAAG,CAAC,cAAc,CAAC;AAErF,QAAM,YAAY,YAChB,CAAC,WAAiB,YAAwD;AAExE,UAAM,mBAAmB,UAAU,gBAAgB,QAAQ,WAAW,QAAQ,WAAW;AAEzF,UAAM,QAAQ,CAAC;AACf,qBAAiB,QAAQ,CAAC,CAAC,SAAS,aAAa;AAC/C,aAAO,QAAQ;AACf,YAAM,QAAQ,MAAM;AAAA,IACtB,CAAC;AACD,UAAM,UAAU,CAAC;AACjB,qBAAiB,QAAQ,CAAC,CAAC,SAAS,aAAa;AAE/C,UAAI,iBAAiB,SAAS,QAAQ,EAAE,GAAG;AACzC;AAAA,MACF;AAGA,UAAI,QAAQ,UAAU;AACpB,cAAM,aAAa,MAAM,QAAQ;AACjC,YAAI,WAAW;AAAS,qBAAW,QAAQ,KAAK,OAAO;AAAA;AAClD,qBAAW,UAAU,CAAC,OAAO;AAAA,MACpC;AAAO,gBAAQ,KAAK,OAAO;AAAA,IAC7B,CAAC;AACD,qBAAiB,SAAS,OAAO;AAAA,EACnC,GACA,CAAC,gBAAgB,gBAAgB,CACnC;AAEA,QAAM,sBAAsB,YAAY,MAAM;AAC5C,UAAM,KAA4B,SAAS,KAAK,cAC9C,iBAAiB,YAAY,mCAC/B;AACA,QAAI;AAAI,SAAG,WAAW,MAAM;AAAA,EAC9B,GAAG,CAAC,CAAC;AAEL,QAAM,qBAAqB,YAAY,MAAM;AAC3C,UAAM,KAA4B,SAAS,KAAK,cAC9C,iBAAiB,YAAY,mCAC/B;AACA,QAAI,IAAI;AACN,YAAM,IAAI,GAAG;AACb,SAAG,WAAW,MAAM;AAClB,WAAG,SAAS,EAAE,KAAK,EAAE,CAAC;AAAA,MACxB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,EAAE,iBAAiB,UAAU,gBAAgB,yBAAyB;AAAA,IAC1E;AAAA,IACA,uBAAuB,YAAY;AAAA,IACnC,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI;AACF,WACE,qCAAC;AAAA,MAAY,GAAG;AAAA,OACd,qCAAC,gBAAgB,UAAhB;AAAA,MAAyB,OAAO,EAAE,YAAY;AAAA,OAC7C,qCAAC;AAAA,MAAW,GAAG;AAAA,KAAO,CACxB,GACA,qCAAC,mBACE,WACC,qCAAC;AAAA,MAAgB,QAAQ,eAAe,KAAK,CAAC,CAAC,UAAU,KAAK,OAAO,QAAQ,EAAE;AAAA,MAAI,eAAa;AAAA,KAAC,IAC/F,IACN,CACF;AAEJ,SAAO,qCAAC;AAAA,IAAW,GAAG;AAAA,GAAO;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
2
|
import * as React from "react";
|
|
19
3
|
import React2, { createContext, useCallback } from "react";
|
|
20
4
|
import { DndContext, DragOverlay } from "@dnd-kit/core";
|
|
@@ -69,7 +53,11 @@ const withConditionalDnDRowContext = (Component) => (props) => {
|
|
|
69
53
|
if (lastActiveId !== activeId && activeId)
|
|
70
54
|
setLastActiveId(activeId);
|
|
71
55
|
if (dragAndDropRows)
|
|
72
|
-
return /* @__PURE__ */ React2.createElement(DndContext,
|
|
56
|
+
return /* @__PURE__ */ React2.createElement(DndContext, {
|
|
57
|
+
...dndContextProps
|
|
58
|
+
}, /* @__PURE__ */ React2.createElement(SortableContext, {
|
|
59
|
+
...sortableContextProps
|
|
60
|
+
}, /* @__PURE__ */ React2.createElement(DnDTreeContext.Provider, {
|
|
73
61
|
value: {
|
|
74
62
|
activeIndex,
|
|
75
63
|
depth,
|
|
@@ -78,13 +66,17 @@ const withConditionalDnDRowContext = (Component) => (props) => {
|
|
|
78
66
|
lastActiveId,
|
|
79
67
|
setLastActiveId
|
|
80
68
|
}
|
|
81
|
-
}, /* @__PURE__ */ React2.createElement(Component,
|
|
69
|
+
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
70
|
+
...props
|
|
71
|
+
}))), createPortal(/* @__PURE__ */ React2.createElement(DragOverlay, {
|
|
82
72
|
style: { width: "auto" }
|
|
83
73
|
}, activeId ? /* @__PURE__ */ React2.createElement(Row, {
|
|
84
74
|
row: flattenedData.find((row) => row.uid === activeId),
|
|
85
75
|
isDragOverlay: true
|
|
86
76
|
}) : null), document.body));
|
|
87
|
-
return /* @__PURE__ */ React2.createElement(Component,
|
|
77
|
+
return /* @__PURE__ */ React2.createElement(Component, {
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
88
80
|
};
|
|
89
81
|
export {
|
|
90
82
|
DnDTreeContext,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDRowContext.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { createContext, useCallback } from 'react';\nimport { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { SortableContext } from '@dnd-kit/sortable';\nimport { DataTableContext } from '../../DataTableContext';\nimport { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { useTreeDndkitConfig } from '@elliemae/ds-drag-and-drop';\nimport { Item } from '../../helpers/dndkit/tree/types';\nimport { DropIndicatorPosition } from './SortableItemContext';\nimport { Row } from '../Row';\nimport { createPortal } from 'react-dom';\n\ntype DnDTreeContextType = {\n depth: number;\n activeIndex: number;\n visibleItems: unknown[];\n dropIndicatorPosition: DropIndicatorPosition;\n lastActiveId: string;\n setLastActiveId: React.Dispatch<React.SetStateAction<string>>;\n};\n\nexport const DnDTreeContext = createContext<DnDTreeContextType>({\n depth: undefined,\n activeIndex: undefined,\n visibleItems: undefined,\n dropIndicatorPosition: DropIndicatorPosition.None,\n lastActiveId: undefined,\n setLastActiveId: undefined,\n});\n\n// only wraps in \"DnDContext\" and \"DnDTreeContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDRowContext: FunctionalHOC = (Component) => (props) => {\n const {\n tableProps: { dragAndDropRows, isExpandable, onRowsReorder, maxDragAndDropLevel },\n flattenedData,\n allDataFlattened,\n } = React.useContext(DataTableContext);\n\n const [lastActiveId, setLastActiveId] = React.useState<string>(null);\n\n const onReorder = useCallback(\n (newData: Item[], indexes: { targetIndex: number; fromIndex: number }, considerExpanding: string) => {\n // Pull the row's original data into an object\n const nodes = {};\n newData.forEach((row) => {\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [];\n newData.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, indexes, considerExpanding);\n },\n [onRowsReorder],\n );\n\n const { dndContextProps, sortableContextProps, activeId, activeIndex, depth, dropIndicatorPosition, visibleItems } =\n useTreeDndkitConfig({\n flattenedItems: allDataFlattened,\n visibleItems: flattenedData,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n });\n\n if (lastActiveId !== activeId && activeId) setLastActiveId(activeId);\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider\n value={{\n activeIndex,\n depth,\n visibleItems,\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n }}\n >\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }}>\n {activeId ? <Row row={flattenedData.find((row) => row.uid === activeId)} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAWO,MAAM,iBAAiB,cAAkC;AAAA,EAC9D,OAAO;AAAA,EACP,aAAa;AAAA,EACb,cAAc;AAAA,EACd,uBAAuB,sBAAsB;AAAA,EAC7C,cAAc;AAAA,EACd,iBAAiB;AACnB,CAAC;AAGM,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM;AAAA,IACJ,YAAY,EAAE,iBAAiB,cAAc,eAAe;AAAA,IAC5D;AAAA,IACA;AAAA,MACE,OAAM,WAAW,gBAAgB;AAErC,QAAM,CAAC,cAAc,mBAAmB,OAAM,SAAiB,IAAI;AAEnE,QAAM,YAAY,YAChB,CAAC,SAAiB,SAAqD,sBAA8B;AAEnG,UAAM,QAAQ,CAAC;AACf,YAAQ,QAAQ,CAAC,QAAQ;AACvB,aAAO,IAAI,SAAS;AACpB,YAAM,IAAI,OAAO,IAAI;AAAA,IACvB,CAAC;AACD,UAAM,cAAc,CAAC;AACrB,YAAQ,QAAQ,CAAC,QAAQ;AAGvB,UAAI,IAAI,UAAU;AAChB,cAAM,aAAa,MAAM,IAAI;AAC7B,YAAI,YAAY;AAAS,qBAAW,QAAQ,KAAK,IAAI,QAAQ;AAAA;AACxD,qBAAW,UAAU,CAAC,IAAI,QAAQ;AAAA,MACzC;AAAO,oBAAY,KAAK,IAAI,QAAQ;AAAA,IACtC,CAAC;AAED,kBAAc,aAAa,SAAS,iBAAiB;AAAA,EACvD,GACA,CAAC,aAAa,CAChB;AAEA,QAAM,EAAE,iBAAiB,sBAAsB,UAAU,aAAa,OAAO,uBAAuB,iBAClG,oBAAoB;AAAA,IAClB,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAEH,MAAI,iBAAiB,YAAY;AAAU,oBAAgB,QAAQ;AAEnE,MAAI;AACF,WACE,qCAAC;AAAA,MAAY,GAAG;AAAA,OACd,qCAAC;AAAA,MAAiB,GAAG;AAAA,OACnB,qCAAC,eAAe,UAAf;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,OAEA,qCAAC;AAAA,MAAW,GAAG;AAAA,KAAO,CACxB,CACF,GACC,aACC,qCAAC;AAAA,MAAY,OAAO,EAAE,OAAO,OAAO;AAAA,OACjC,WAAW,qCAAC;AAAA,MAAI,KAAK,cAAc,KAAK,CAAC,QAAQ,IAAI,QAAQ,QAAQ;AAAA,MAAG,eAAa;AAAA,KAAC,IAAK,IAC9F,GACA,SAAS,IACX,CACF;AAEJ,SAAO,qCAAC;AAAA,IAAW,GAAG;AAAA,GAAO;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
2
|
import * as React from "react";
|
|
19
3
|
import { horizontalListSortingStrategy, SortableContext } from "@dnd-kit/sortable";
|
|
20
4
|
import React2, { useContext } from "react";
|
|
@@ -27,8 +11,12 @@ const withConditionalDnDSortableContext = (items, isDragOverlay = false) => (Com
|
|
|
27
11
|
return /* @__PURE__ */ React2.createElement(SortableContext, {
|
|
28
12
|
items: items.map((item) => item.id),
|
|
29
13
|
strategy: horizontalListSortingStrategy
|
|
30
|
-
}, /* @__PURE__ */ React2.createElement(Component,
|
|
31
|
-
|
|
14
|
+
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
15
|
+
...props
|
|
16
|
+
}));
|
|
17
|
+
return /* @__PURE__ */ React2.createElement(Component, {
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
32
20
|
};
|
|
33
21
|
export {
|
|
34
22
|
withConditionalDnDSortableContext
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDSortableContext.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortable';\nimport React, { useContext } from 'react';\nimport { DataTableContext } from '../../DataTableContext';\nimport { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { TypescriptColumn } from '../../types/props';\n\nexport const withConditionalDnDSortableContext =\n (items: TypescriptColumn[], isDragOverlay = false): FunctionalHOC =>\n (Component) =>\n (props) => {\n const {\n tableProps: { dragAndDropColumns },\n } = useContext(DataTableContext);\n\n // Only add the context if it's not a dragOverlay and dnd for cols was requested\n // It's important that drag overlays DO NOT have any sortable functionality!\n if (!isDragOverlay && dragAndDropColumns)\n return (\n <SortableContext items={items.map((item) => item.id)} strategy={horizontalListSortingStrategy}>\n <Component {...props} />\n </SortableContext>\n );\n\n return <Component {...props} />;\n };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AAIO,MAAM,oCACX,CAAC,OAA2B,gBAAgB,UAC5C,CAAC,cACD,CAAC,UAAU;AACT,QAAM;AAAA,IACJ,YAAY,EAAE;AAAA,MACZ,WAAW,gBAAgB;AAI/B,MAAI,CAAC,iBAAiB;AACpB,WACE,qCAAC;AAAA,MAAgB,OAAO,MAAM,IAAI,CAAC,SAAS,KAAK,EAAE;AAAA,MAAG,UAAU;AAAA,OAC9D,qCAAC;AAAA,MAAW,GAAG;AAAA,KAAO,CACxB;AAGJ,SAAO,qCAAC;AAAA,IAAW,GAAG;AAAA,GAAO;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import React2, { useContext, useMemo } from "react";
|
|
23
4
|
import { useSortable } from "@dnd-kit/sortable";
|
|
@@ -37,17 +18,20 @@ const withDnDSortableColumnContext = (Component) => (props) => {
|
|
|
37
18
|
if (!dragAndDropColumns)
|
|
38
19
|
return false;
|
|
39
20
|
const { index, overIndex } = useSortableHelpers;
|
|
40
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
...useSortableHelpers,
|
|
41
23
|
shouldShowDropIndicatorPosition: overIndex === index && overIndex !== -1,
|
|
42
24
|
dropIndicatorPosition: index > activeIndex ? DropIndicatorPosition.After : DropIndicatorPosition.Before
|
|
43
|
-
}
|
|
25
|
+
};
|
|
44
26
|
}, [useSortableHelpers, dragAndDropColumns, activeIndex]);
|
|
45
27
|
const ctx = useMemo(() => ({
|
|
46
28
|
draggableProps
|
|
47
29
|
}), [draggableProps]);
|
|
48
30
|
return /* @__PURE__ */ React2.createElement(SortableItemContext.Provider, {
|
|
49
31
|
value: ctx
|
|
50
|
-
}, /* @__PURE__ */ React2.createElement(Component,
|
|
32
|
+
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
33
|
+
...props
|
|
34
|
+
}));
|
|
51
35
|
};
|
|
52
36
|
export {
|
|
53
37
|
withDnDSortableColumnContext
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withDnDSortableColumnContext.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { DataTableContext } from '../../DataTableContext';\nimport { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { DnDGroupContext } from './withConditionalDnDColumnContext';\nimport { SortableItemContext, DropIndicatorPosition, SortableItemContextType } from './SortableItemContext';\n\nexport const withDnDSortableColumnContext: FunctionalHOC = (Component) => (props: any) => {\n const {\n tableProps: { dragAndDropColumns },\n } = useContext(DataTableContext);\n const { activeIndex } = useContext(DnDGroupContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.header.id,\n }),\n [props.header.id],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!dragAndDropColumns) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index && overIndex !== -1,\n dropIndicatorPosition: index > activeIndex ? DropIndicatorPosition.After : DropIndicatorPosition.Before,\n };\n }, [useSortableHelpers, dragAndDropColumns, activeIndex]);\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AAEA;AACA;AAEO,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAe;AACxF,QAAM;AAAA,IACJ,YAAY,EAAE;AAAA,MACZ,WAAW,gBAAgB;AAC/B,QAAM,EAAE,gBAAgB,WAAW,eAAe;AAGlD,QAAM,mBAAmB,QACvB,MAAO;AAAA,IACL,IAAI,MAAM,OAAO;AAAA,EACnB,IACA,CAAC,MAAM,OAAO,EAAE,CAClB;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,CAAC;AAAoB,aAAO;AAEhC,UAAM,EAAE,OAAO,cAAc;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc,SAAS,cAAc;AAAA,MACtE,uBAAuB,QAAQ,cAAc,sBAAsB,QAAQ,sBAAsB;AAAA,IACnG;AAAA,EACF,GAAG,CAAC,oBAAoB,oBAAoB,WAAW,CAAC;AAIxD,QAAM,MAA+B,QACnC,MAAO;AAAA,IACL;AAAA,EACF,IACA,CAAC,cAAc,CACjB;AAEA,SACE,qCAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,KACnC,qCAAC;AAAA,IAAW,GAAG;AAAA,GAAO,CACxB;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import React2, { useContext, useMemo } from "react";
|
|
23
4
|
import { useSortable } from "@dnd-kit/sortable";
|
|
@@ -37,19 +18,22 @@ const withDnDSortableRowContext = (Component) => (props) => {
|
|
|
37
18
|
if (!dragAndDropRows)
|
|
38
19
|
return false;
|
|
39
20
|
const { index, overIndex } = useSortableHelpers;
|
|
40
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
...useSortableHelpers,
|
|
41
23
|
shouldShowDropIndicatorPosition: overIndex === index,
|
|
42
24
|
dropIndicatorPosition,
|
|
43
25
|
lastActiveId,
|
|
44
26
|
setLastActiveId
|
|
45
|
-
}
|
|
27
|
+
};
|
|
46
28
|
}, [dragAndDropRows, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId]);
|
|
47
29
|
const ctx = useMemo(() => ({
|
|
48
30
|
draggableProps
|
|
49
31
|
}), [draggableProps]);
|
|
50
32
|
return /* @__PURE__ */ React2.createElement(SortableItemContext.Provider, {
|
|
51
33
|
value: ctx
|
|
52
|
-
}, /* @__PURE__ */ React2.createElement(Component,
|
|
34
|
+
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
35
|
+
...props
|
|
36
|
+
}));
|
|
53
37
|
};
|
|
54
38
|
export {
|
|
55
39
|
withDnDSortableRowContext
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withDnDSortableRowContext.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { cloneElement, useContext, useEffect, useMemo } from 'react';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { DataTableContext } from '../../DataTableContext';\nimport { DnDTreeContext } from './withConditionalDnDRowContext';\nimport { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { SortableItemContext, SortableItemContextType } from './SortableItemContext';\n\nexport const withDnDSortableRowContext: FunctionalHOC = (Component) => (props: any) => {\n const {\n tableProps: { dragAndDropRows },\n } = useContext(DataTableContext);\n const { dropIndicatorPosition, lastActiveId, setLastActiveId } = useContext(DnDTreeContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.row.uid,\n }),\n [props.row],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!dragAndDropRows) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n };\n }, [dragAndDropRows, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId]);\n\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AACA;AAEA;AAEO,MAAM,4BAA2C,CAAC,cAAc,CAAC,UAAe;AACrF,QAAM;AAAA,IACJ,YAAY,EAAE;AAAA,MACZ,WAAW,gBAAgB;AAC/B,QAAM,EAAE,uBAAuB,cAAc,oBAAoB,WAAW,cAAc;AAG1F,QAAM,mBAAmB,QACvB,MAAO;AAAA,IACL,IAAI,MAAM,IAAI;AAAA,EAChB,IACA,CAAC,MAAM,GAAG,CACZ;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,CAAC;AAAiB,aAAO;AAE7B,UAAM,EAAE,OAAO,cAAc;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,oBAAoB,uBAAuB,cAAc,eAAe,CAAC;AAK9F,QAAM,MAA+B,QACnC,MAAO;AAAA,IACL;AAAA,EACF,IACA,CAAC,cAAc,CACjB;AAEA,SACE,qCAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,KACnC,qCAAC;AAAA,IAAW,GAAG;AAAA,GAAO,CACxB;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import React2, { useMemo } from "react";
|
|
23
4
|
import { DSSkeleton } from "@elliemae/ds-skeleton";
|
|
@@ -36,11 +17,12 @@ const RowVariantSkeleton = ({
|
|
|
36
17
|
focusedRowId,
|
|
37
18
|
drilldownRowId
|
|
38
19
|
}) => {
|
|
39
|
-
const newCells = row.cells.map((cell) =>
|
|
20
|
+
const newCells = row.cells.map((cell) => ({
|
|
21
|
+
...cell,
|
|
40
22
|
render: RandomSkeleton
|
|
41
23
|
}));
|
|
42
24
|
return /* @__PURE__ */ React2.createElement(RowRenderer, {
|
|
43
|
-
row:
|
|
25
|
+
row: { ...row, cells: newCells },
|
|
44
26
|
itemIndex,
|
|
45
27
|
isDragOverlay,
|
|
46
28
|
minHeight: "0px",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/RowVariants/RowVariantSkeleton.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { DSSkeleton } from '@elliemae/ds-skeleton';\nimport { RowRenderer } from '../../exported-related/RowRenderer';\nimport { RowVariantProps } from './types';\n\nconst RandomSkeleton = () => {\n const randomPercentage = useMemo(() => Math.floor(Math.random() * 70 + 30), []);\n return <DSSkeleton w={`${randomPercentage}%`} h=\"90%\" />;\n};\n\nexport const RowVariantSkeleton: React.ComponentType<RowVariantProps> = ({\n row,\n itemIndex,\n isDragOverlay,\n focusedRowId,\n drilldownRowId,\n}) => {\n const newCells = row.cells.map((cell) => ({\n ...cell,\n render: RandomSkeleton,\n }));\n\n return (\n <RowRenderer\n row={{ ...row, cells: newCells }}\n itemIndex={itemIndex}\n isDragOverlay={isDragOverlay}\n minHeight=\"0px\"\n height=\"36px\"\n focusedRowId={focusedRowId}\n drilldownRowId={drilldownRowId}\n />\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AAGA,MAAM,iBAAiB,MAAM;AAC3B,QAAM,mBAAmB,QAAQ,MAAM,KAAK,MAAM,KAAK,OAAO,IAAI,KAAK,EAAE,GAAG,CAAC,CAAC;AAC9E,SAAO,qCAAC;AAAA,IAAW,GAAG,GAAG;AAAA,IAAqB,GAAE;AAAA,GAAM;AACxD;AAEO,MAAM,qBAA2D,CAAC;AAAA,EACvE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACI;AACJ,QAAM,WAAW,IAAI,MAAM,IAAI,CAAC,SAAU;AAAA,IACxC,GAAG;AAAA,IACH,QAAQ;AAAA,EACV,EAAE;AAEF,SACE,qCAAC;AAAA,IACC,KAAK,EAAE,GAAG,KAAK,OAAO,SAAS;AAAA,IAC/B;AAAA,IACA;AAAA,IACA,WAAU;AAAA,IACV,QAAO;AAAA,IACP;AAAA,IACA;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
2
|
import * as React from "react";
|
|
19
3
|
import React2 from "react";
|
|
20
4
|
import { ROW_VARIANTS } from "../../exported-related";
|
|
@@ -27,12 +11,14 @@ const RowVariantMapper = {
|
|
|
27
11
|
[ROW_VARIANTS.HEADER_GROUP]: RowVariantHeader,
|
|
28
12
|
[ROW_VARIANTS.PRIMARY]: RowVariantPrimary,
|
|
29
13
|
[ROW_VARIANTS.SECONDARY]: RowVariantSecondary,
|
|
30
|
-
[ROW_VARIANTS.COMPACT_PRIMARY]: (props) => /* @__PURE__ */ React2.createElement(RowVariantPrimary,
|
|
31
|
-
compact: true
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
14
|
+
[ROW_VARIANTS.COMPACT_PRIMARY]: (props) => /* @__PURE__ */ React2.createElement(RowVariantPrimary, {
|
|
15
|
+
compact: true,
|
|
16
|
+
...props
|
|
17
|
+
}),
|
|
18
|
+
[ROW_VARIANTS.COMPACT_SECONDARY]: (props) => /* @__PURE__ */ React2.createElement(RowVariantSecondary, {
|
|
19
|
+
compact: true,
|
|
20
|
+
...props
|
|
21
|
+
}),
|
|
36
22
|
[ROW_VARIANTS.SKELETON]: RowVariantSkeleton
|
|
37
23
|
};
|
|
38
24
|
const RowVariantMapItem = (props) => {
|
|
@@ -52,7 +38,9 @@ const RowVariantMapItem = (props) => {
|
|
|
52
38
|
} else {
|
|
53
39
|
Component = variant;
|
|
54
40
|
}
|
|
55
|
-
return /* @__PURE__ */ React2.createElement(Component,
|
|
41
|
+
return /* @__PURE__ */ React2.createElement(Component, {
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
56
44
|
};
|
|
57
45
|
export {
|
|
58
46
|
RowVariantMapItem
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/RowVariants/index.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { ROW_VARIANTS } from '../../exported-related';\nimport { TypescriptContext, TypescriptRow } from '../../types/props';\nimport { Cells } from '../Cells';\nimport { RowVariantHeader } from './RowVariantHeader';\nimport { RowVariantPrimary } from './RowVariantPrimary';\nimport { RowVariantSecondary } from './RowVariantSecondary';\nimport { RowVariantSkeleton } from './RowVariantSkeleton';\nimport { RowVariantProps } from './types';\n\nconst RowVariantMapper: Record<string, React.ComponentType<RowVariantProps>> = {\n [ROW_VARIANTS.HEADER_GROUP]: RowVariantHeader,\n [ROW_VARIANTS.PRIMARY]: RowVariantPrimary,\n [ROW_VARIANTS.SECONDARY]: RowVariantSecondary,\n [ROW_VARIANTS.COMPACT_PRIMARY]: (props) => <RowVariantPrimary compact {...props} />,\n [ROW_VARIANTS.COMPACT_SECONDARY]: (props) => <RowVariantSecondary compact {...props} />,\n [ROW_VARIANTS.SKELETON]: RowVariantSkeleton,\n};\n\ninterface RowVariantMapItemProps {\n row: TypescriptRow;\n itemIndex: number;\n isDragOverlay: boolean;\n ctx: TypescriptContext;\n focusedRowId: string | null;\n drilldownRowId: string | null;\n}\n\nexport const RowVariantMapItem: React.ComponentType<RowVariantMapItemProps> = (props) => {\n const {\n row,\n ctx: {\n tableProps: { getRowVariant },\n },\n } = props;\n\n const variant = getRowVariant(row, Cells);\n\n let Component: React.ComponentType<any>;\n\n if (typeof variant === 'string') {\n if (!(variant in RowVariantMapper)) {\n throw new Error(`${variant} is not an out-of-the-box row variant`);\n }\n Component = RowVariantMapper[variant];\n } else {\n Component = variant;\n }\n\n return <Component {...props} />;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAGA,MAAM,mBAAyE;AAAA,EAC7E,CAAC,aAAa,eAAe;AAAA,EAC7B,CAAC,aAAa,UAAU;AAAA,EACxB,CAAC,aAAa,YAAY;AAAA,EAC1B,CAAC,aAAa,kBAAkB,CAAC,UAAU,qCAAC;AAAA,IAAkB,SAAO;AAAA,IAAE,GAAG;AAAA,GAAO;AAAA,EACjF,CAAC,aAAa,oBAAoB,CAAC,UAAU,qCAAC;AAAA,IAAoB,SAAO;AAAA,IAAE,GAAG;AAAA,GAAO;AAAA,EACrF,CAAC,aAAa,WAAW;AAC3B;AAWO,MAAM,oBAAiE,CAAC,UAAU;AACvF,QAAM;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,MACH,YAAY,EAAE;AAAA;AAAA,MAEd;AAEJ,QAAM,UAAU,cAAc,KAAK,KAAK;AAExC,MAAI;AAEJ,MAAI,OAAO,YAAY,UAAU;AAC/B,QAAI,CAAE,YAAW,mBAAmB;AAClC,YAAM,IAAI,MAAM,GAAG,8CAA8C;AAAA,IACnE;AACA,gBAAY,iBAAiB;AAAA,EAC/B,OAAO;AACL,gBAAY;AAAA,EACd;AAEA,SAAO,qCAAC;AAAA,IAAW,GAAG;AAAA,GAAO;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/parts/Rows.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
2
|
import * as React from "react";
|
|
19
3
|
import React2, { useContext, useMemo } from "react";
|
|
20
4
|
import { RowWithContext as Row } from "./Row";
|
|
@@ -50,7 +34,9 @@ const Rows = () => {
|
|
|
50
34
|
itemIndex: index,
|
|
51
35
|
itemWrapperStyle: style
|
|
52
36
|
};
|
|
53
|
-
return /* @__PURE__ */ React2.createElement(Row,
|
|
37
|
+
return /* @__PURE__ */ React2.createElement(Row, {
|
|
38
|
+
...rowProps
|
|
39
|
+
});
|
|
54
40
|
})), [virtualItems, items, visibleColumns, totalColumnsWidth]);
|
|
55
41
|
return PureVirtualizedRows;
|
|
56
42
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Rows.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-underscore-dangle */\nimport React, { useContext, useMemo } from 'react';\n\nimport { RowWithContext as Row } from './Row';\nimport { DataTableContext } from '../DataTableContext';\nimport { DnDTreeContext, withConditionalDnDRowContext } from './HoC/withConditionalDnDRowContext';\nimport { addCellData } from '../helpers';\n\nconst Rows = (): JSX.Element => {\n const {\n virtualListHelpers: { virtualItems },\n layoutHelpers: { totalColumnsWidth },\n flattenedData,\n visibleColumns,\n } = useContext(DataTableContext);\n\n const { visibleItems } = useContext(DnDTreeContext);\n\n const items = visibleItems || flattenedData;\n\n const PureVirtualizedRows = useMemo(\n () => (\n <>\n {virtualItems.map((virtualItem) => {\n const { index, measureRef, start } = virtualItem;\n const row = items[index];\n if (!row) return null;\n addCellData(row, visibleColumns);\n const style = {\n position: 'absolute',\n top: `${start}px`,\n left: 0,\n width: totalColumnsWidth,\n };\n const rowProps = {\n key: `ds-table-row-${row.uid}`,\n row,\n measureRef,\n index, // this is consumed by the DnD HOC\n itemIndex: index,\n itemWrapperStyle: style,\n };\n return <Row {...rowProps} />;\n })}\n </>\n ),\n [virtualItems, items, visibleColumns, totalColumnsWidth],\n );\n\n return PureVirtualizedRows;\n};\n\nRows.propTypes = {};\n\nexport const RowsWithContext = withConditionalDnDRowContext(Rows);\nexport default RowsWithContext;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AAEA;AACA;AACA;AACA;AAEA,MAAM,OAAO,MAAmB;AAC9B,QAAM;AAAA,IACJ,oBAAoB,EAAE;AAAA,IACtB,eAAe,EAAE;AAAA,IACjB;AAAA,IACA;AAAA,MACE,WAAW,gBAAgB;AAE/B,QAAM,EAAE,iBAAiB,WAAW,cAAc;AAElD,QAAM,QAAQ,gBAAgB;AAE9B,QAAM,sBAAsB,QAC1B,MACE,4DACG,aAAa,IAAI,CAAC,gBAAgB;AACjC,UAAM,EAAE,OAAO,YAAY,UAAU;AACrC,UAAM,MAAM,MAAM;AAClB,QAAI,CAAC;AAAK,aAAO;AACjB,gBAAY,KAAK,cAAc;AAC/B,UAAM,QAAQ;AAAA,MACZ,UAAU;AAAA,MACV,KAAK,GAAG;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AACA,UAAM,WAAW;AAAA,MACf,KAAK,gBAAgB,IAAI;AAAA,MACzB;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,kBAAkB;AAAA,IACpB;AACA,WAAO,qCAAC;AAAA,MAAK,GAAG;AAAA,KAAU;AAAA,EAC5B,CAAC,CACH,GAEF,CAAC,cAAc,OAAO,gBAAgB,iBAAiB,CACzD;AAEA,SAAO;AACT;AAEA,KAAK,YAAY,CAAC;AAEX,MAAM,kBAAkB,6BAA6B,IAAI;AAChE,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,56 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import { Grid } from "@elliemae/ds-grid";
|
|
35
4
|
import { withConditionalDnDSortableContext } from "./HoC/withConditionalDnDSortableContext";
|
|
36
5
|
import { sizeToCss } from "../helpers";
|
|
37
|
-
const SortableHeaderCell = (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
style: isGroup ? {
|
|
50
|
-
gridAutoFlow: "column"
|
|
51
|
-
} : { display: "flex" }
|
|
52
|
-
}));
|
|
53
|
-
};
|
|
6
|
+
const SortableHeaderCell = ({
|
|
7
|
+
items,
|
|
8
|
+
isDragOverlay = false,
|
|
9
|
+
isGroup = false,
|
|
10
|
+
...rest
|
|
11
|
+
}) => withConditionalDnDSortableContext(items, isDragOverlay)(Grid)({
|
|
12
|
+
...rest,
|
|
13
|
+
cols: isGroup ? items.map((col) => sizeToCss(col.width ?? 150)) : void 0,
|
|
14
|
+
style: isGroup ? {
|
|
15
|
+
gridAutoFlow: "column"
|
|
16
|
+
} : { display: "flex" }
|
|
17
|
+
});
|
|
54
18
|
export {
|
|
55
19
|
SortableHeaderCell
|
|
56
20
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/SortableHeaderCell.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Grid } from '@elliemae/ds-grid';\nimport { TypescriptColumn } from '../types/props';\nimport { withConditionalDnDSortableContext } from './HoC/withConditionalDnDSortableContext';\nimport { sizeToCss } from '../helpers';\n\nexport const SortableHeaderCell = ({\n items,\n isDragOverlay = false,\n isGroup = false,\n ...rest\n}: {\n items: TypescriptColumn[];\n isDragOverlay?: boolean;\n isGroup: boolean;\n children: JSX.Element | JSX.Element[];\n}): JSX.Element =>\n withConditionalDnDSortableContext(items, isDragOverlay)(Grid)({\n ...rest,\n cols: isGroup ? items.map((col) => sizeToCss(col.width ?? 150)) : undefined,\n style: isGroup\n ? {\n gridAutoFlow: 'column',\n }\n : { display: 'flex' },\n });\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AAEA;AACA;AAEO,MAAM,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA,gBAAgB;AAAA,EAChB,UAAU;AAAA,KACP;AAAA,MAOH,kCAAkC,OAAO,aAAa,EAAE,IAAI,EAAE;AAAA,EAC5D,GAAG;AAAA,EACH,MAAM,UAAU,MAAM,IAAI,CAAC,QAAQ,UAAU,IAAI,SAAS,GAAG,CAAC,IAAI;AAAA,EAClE,OAAO,UACH;AAAA,IACE,cAAc;AAAA,EAChB,IACA,EAAE,SAAS,OAAO;AACxB,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|