@elliemae/ds-data-table 3.16.0-next.4 → 3.16.0-next.6
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/configs/usePaginationConfig.js +1 -1
- package/dist/cjs/configs/usePaginationConfig.js.map +2 -2
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +1 -1
- package/dist/esm/configs/usePaginationConfig.js +1 -1
- package/dist/esm/configs/usePaginationConfig.js.map +2 -2
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +1 -1
- package/package.json +19 -19
- package/dist/cjs/package.json +0 -7
- package/dist/esm/package.json +0 -7
|
@@ -63,7 +63,7 @@ const usePaginationConfig = (props, flattenedData) => {
|
|
|
63
63
|
}, [hasPagination, dataIsPage, flattenedData, pageIndex, pageSize]);
|
|
64
64
|
const paginationHelpers = (0, import_react.useMemo)(
|
|
65
65
|
() => ({
|
|
66
|
-
pageIndex
|
|
66
|
+
pageIndex,
|
|
67
67
|
canPreviousPage,
|
|
68
68
|
canNextPage,
|
|
69
69
|
pageSize,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/configs/usePaginationConfig.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemo } from 'react';\nimport type { TypescriptPagination, TypescriptProps, TypescriptRow } from '../types/props';\n\nconst noPagination: Record<string, never> = {};\n\nconst emptyFunc = () => null;\n\nexport const usePaginationConfig = (\n props: TypescriptProps,\n flattenedData: TypescriptRow[],\n): [TypescriptRow[] | null, TypescriptPagination] => {\n const { pagination } = props;\n\n const hasPagination = !!pagination;\n\n // Set default values\n const {\n pageIndex = 1,\n canPreviousPage = true,\n canNextPage = true,\n pageSize = 10,\n perPageOptions = [10],\n onPageSizeChange = emptyFunc,\n onPreviousPage = emptyFunc,\n onNextPage = emptyFunc,\n onPageChange = emptyFunc,\n pageCount = Math.ceil(flattenedData.length / pageSize),\n isLoadingPageCount = false,\n dataIsPage = false,\n perPageStep = 5,\n minPerPage = 0,\n maxPerPage = 100,\n showPerPageSelector = true,\n pageDetails = [],\n pageDetailsTitle = '',\n } = pagination || noPagination; // pagination can be false\n\n // Get the needed page\n const page = useMemo(() => {\n if (!hasPagination) return null;\n if (dataIsPage) return flattenedData;\n return flattenedData.slice((pageIndex - 1) * pageSize, pageIndex * pageSize);\n }, [hasPagination, dataIsPage, flattenedData, pageIndex, pageSize]);\n\n const paginationHelpers = useMemo(\n () => ({\n pageIndex
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AAGxB,MAAM,eAAsC,CAAC;AAE7C,MAAM,YAAY,MAAM;AAEjB,MAAM,sBAAsB,CACjC,OACA,kBACmD;AACnD,QAAM,EAAE,WAAW,IAAI;AAEvB,QAAM,gBAAgB,CAAC,CAAC;AAGxB,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,WAAW;AAAA,IACX,iBAAiB,CAAC,EAAE;AAAA,IACpB,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,YAAY,KAAK,KAAK,cAAc,SAAS,QAAQ;AAAA,IACrD,qBAAqB;AAAA,IACrB,aAAa;AAAA,IACb,cAAc;AAAA,IACd,aAAa;AAAA,IACb,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,cAAc,CAAC;AAAA,IACf,mBAAmB;AAAA,EACrB,IAAI,cAAc;AAGlB,QAAM,WAAO,sBAAQ,MAAM;AACzB,QAAI,CAAC;AAAe,aAAO;AAC3B,QAAI;AAAY,aAAO;AACvB,WAAO,cAAc,OAAO,YAAY,KAAK,UAAU,YAAY,QAAQ;AAAA,EAC7E,GAAG,CAAC,eAAe,YAAY,eAAe,WAAW,QAAQ,CAAC;AAElE,QAAM,wBAAoB;AAAA,IACxB,OAAO;AAAA,MACL
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react';\nimport type { TypescriptPagination, TypescriptProps, TypescriptRow } from '../types/props';\n\nconst noPagination: Record<string, never> = {};\n\nconst emptyFunc = () => null;\n\nexport const usePaginationConfig = (\n props: TypescriptProps,\n flattenedData: TypescriptRow[],\n): [TypescriptRow[] | null, TypescriptPagination] => {\n const { pagination } = props;\n\n const hasPagination = !!pagination;\n\n // Set default values\n const {\n pageIndex = 1,\n canPreviousPage = true,\n canNextPage = true,\n pageSize = 10,\n perPageOptions = [10],\n onPageSizeChange = emptyFunc,\n onPreviousPage = emptyFunc,\n onNextPage = emptyFunc,\n onPageChange = emptyFunc,\n pageCount = Math.ceil(flattenedData.length / pageSize),\n isLoadingPageCount = false,\n dataIsPage = false,\n perPageStep = 5,\n minPerPage = 0,\n maxPerPage = 100,\n showPerPageSelector = true,\n pageDetails = [],\n pageDetailsTitle = '',\n } = pagination || noPagination; // pagination can be false\n\n // Get the needed page\n const page = useMemo(() => {\n if (!hasPagination) return null;\n if (dataIsPage) return flattenedData;\n return flattenedData.slice((pageIndex - 1) * pageSize, pageIndex * pageSize);\n }, [hasPagination, dataIsPage, flattenedData, pageIndex, pageSize]);\n\n const paginationHelpers = useMemo(\n () => ({\n pageIndex,\n canPreviousPage,\n canNextPage,\n pageSize,\n perPageOptions,\n onPageSizeChange,\n onPreviousPage,\n onNextPage,\n onPageChange,\n pageCount,\n isLoadingPageCount: isLoadingPageCount,\n perPageStep,\n minPerPage,\n maxPerPage,\n showPerPageSelector,\n pageDetails,\n pageDetailsTitle,\n }),\n [\n pageIndex,\n canPreviousPage,\n canNextPage,\n pageSize,\n perPageOptions,\n onPageSizeChange,\n onPreviousPage,\n onNextPage,\n onPageChange,\n pageCount,\n isLoadingPageCount,\n perPageStep,\n minPerPage,\n maxPerPage,\n showPerPageSelector,\n pageDetails,\n pageDetailsTitle,\n ],\n );\n return [page, paginationHelpers];\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AAGxB,MAAM,eAAsC,CAAC;AAE7C,MAAM,YAAY,MAAM;AAEjB,MAAM,sBAAsB,CACjC,OACA,kBACmD;AACnD,QAAM,EAAE,WAAW,IAAI;AAEvB,QAAM,gBAAgB,CAAC,CAAC;AAGxB,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,WAAW;AAAA,IACX,iBAAiB,CAAC,EAAE;AAAA,IACpB,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,YAAY,KAAK,KAAK,cAAc,SAAS,QAAQ;AAAA,IACrD,qBAAqB;AAAA,IACrB,aAAa;AAAA,IACb,cAAc;AAAA,IACd,aAAa;AAAA,IACb,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,cAAc,CAAC;AAAA,IACf,mBAAmB;AAAA,EACrB,IAAI,cAAc;AAGlB,QAAM,WAAO,sBAAQ,MAAM;AACzB,QAAI,CAAC;AAAe,aAAO;AAC3B,QAAI;AAAY,aAAO;AACvB,WAAO,cAAc,OAAO,YAAY,KAAK,UAAU,YAAY,QAAQ;AAAA,EAC7E,GAAG,CAAC,eAAe,YAAY,eAAe,WAAW,QAAQ,CAAC;AAElE,QAAM,wBAAoB;AAAA,IACxB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO,CAAC,MAAM,iBAAiB;AACjC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/HoC/withConditionalDnDRowContext.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react/function-component-definition */\nimport React, { useCallback, useMemo } from 'react';\nimport {\n DndContext,\n DragOverlay,\n SortableContext,\n useTreeDndkitConfig,\n removeChildrenOf,\n restrictToFirstScrollableAncestor,\n type DnDKitTree,\n} from '@elliemae/ds-drag-and-drop';\nimport { createPortal } from 'react-dom';\nimport { DataTableContext } from '../../DataTableContext';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { Row } from '../Row';\nimport { DnDTreeContext } from './DnDTreeContext';\nimport type { TypescriptRow } from 'types/props';\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, getIsDropValid },\n flattenedData,\n allDataFlattened,\n } = React.useContext(DataTableContext);\n\n const onReorder: DnDKitTree.OnReorder<TypescriptRow> = useCallback(\n (_active, targetIndex, { movedData, fromIndex, considerExpanding }) => {\n // Pull the row's original data into an object\n const nodes: Record<string, TypescriptRow> = {};\n movedData.forEach((row) => {\n if (row.original.subRows) delete row.original.subRows;\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [] as TypescriptRow[];\n movedData.forEach((row) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (row.parentId) {\n const parentNode = nodes[row.parentId];\n if (parentNode?.subRows) parentNode.subRows.push(row.original);\n else parentNode.subRows = [row.original];\n } else newUserData.push(row.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onRowsReorder(newUserData, { targetIndex, fromIndex }, considerExpanding as string | null, {\n flattenedData,\n allDataFlattened,\n });\n },\n [allDataFlattened, flattenedData, onRowsReorder],\n );\n\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } = useTreeDndkitConfig({\n flattenedItems: allDataFlattened,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid: getIsDropValid,\n });\n\n const visibleItems = useMemo(() => {\n if (!active) return flattenedData;\n return removeChildrenOf(flattenedData, active.id);\n }, [active, flattenedData]);\n\n const ctx = useMemo(\n () => ({\n visibleItems,\n dropIndicatorPosition,\n isDropValid,\n }),\n [visibleItems, dropIndicatorPosition, isDropValid],\n );\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider value={ctx}>\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }} modifiers={[restrictToFirstScrollableAncestor]}>\n {active ? <Row row={flattenedData.find((row) => row.uid === active.id)} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/function-component-definition */\nimport React, { useCallback, useMemo } from 'react';\nimport {\n DndContext,\n DragOverlay,\n SortableContext,\n useTreeDndkitConfig,\n removeChildrenOf,\n restrictToFirstScrollableAncestor,\n type DnDKitTree,\n} from '@elliemae/ds-drag-and-drop';\nimport { createPortal } from 'react-dom';\nimport { DataTableContext } from '../../DataTableContext';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { Row } from '../Row';\nimport { DnDTreeContext } from './DnDTreeContext';\nimport type { TypescriptRow } from '../../types/props';\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, getIsDropValid },\n flattenedData,\n allDataFlattened,\n } = React.useContext(DataTableContext);\n\n const onReorder: DnDKitTree.OnReorder<TypescriptRow> = useCallback(\n (_active, targetIndex, { movedData, fromIndex, considerExpanding }) => {\n // Pull the row's original data into an object\n const nodes: Record<string, TypescriptRow> = {};\n movedData.forEach((row) => {\n if (row.original.subRows) delete row.original.subRows;\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [] as TypescriptRow[];\n movedData.forEach((row) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (row.parentId) {\n const parentNode = nodes[row.parentId];\n if (parentNode?.subRows) parentNode.subRows.push(row.original);\n else parentNode.subRows = [row.original];\n } else newUserData.push(row.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onRowsReorder(newUserData, { targetIndex, fromIndex }, considerExpanding as string | null, {\n flattenedData,\n allDataFlattened,\n });\n },\n [allDataFlattened, flattenedData, onRowsReorder],\n );\n\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } = useTreeDndkitConfig({\n flattenedItems: allDataFlattened,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid: getIsDropValid,\n });\n\n const visibleItems = useMemo(() => {\n if (!active) return flattenedData;\n return removeChildrenOf(flattenedData, active.id);\n }, [active, flattenedData]);\n\n const ctx = useMemo(\n () => ({\n visibleItems,\n dropIndicatorPosition,\n isDropValid,\n }),\n [visibleItems, dropIndicatorPosition, isDropValid],\n );\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider value={ctx}>\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }} modifiers={[restrictToFirstScrollableAncestor]}>\n {active ? <Row row={flattenedData.find((row) => row.uid === active.id)} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+EjB;AA9EN,mBAA4C;AAC5C,8BAQO;AACP,uBAA6B;AAC7B,8BAAiC;AAEjC,iBAAoB;AACpB,4BAA+B;AAIxB,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM;AAAA,IACJ,YAAY,EAAE,iBAAiB,cAAc,eAAe,qBAAqB,eAAe;AAAA,IAChG;AAAA,IACA;AAAA,EACF,IAAI,aAAAA,QAAM,WAAW,wCAAgB;AAErC,QAAM,gBAAiD;AAAA,IACrD,CAAC,SAAS,aAAa,EAAE,WAAW,WAAW,kBAAkB,MAAM;AAErE,YAAM,QAAuC,CAAC;AAC9C,gBAAU,QAAQ,CAAC,QAAQ;AACzB,YAAI,IAAI,SAAS;AAAS,iBAAO,IAAI,SAAS;AAC9C,eAAO,IAAI,SAAS;AACpB,cAAM,IAAI,OAAO,IAAI;AAAA,MACvB,CAAC;AACD,YAAM,cAAc,CAAC;AACrB,gBAAU,QAAQ,CAAC,QAAQ;AAGzB,YAAI,IAAI,UAAU;AAChB,gBAAM,aAAa,MAAM,IAAI;AAC7B,cAAI,YAAY;AAAS,uBAAW,QAAQ,KAAK,IAAI,QAAQ;AAAA;AACxD,uBAAW,UAAU,CAAC,IAAI,QAAQ;AAAA,QACzC;AAAO,sBAAY,KAAK,IAAI,QAAQ;AAAA,MACtC,CAAC;AAED,oBAAc,aAAa,EAAE,aAAa,UAAU,GAAG,mBAAoC;AAAA,QACzF;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,kBAAkB,eAAe,aAAa;AAAA,EACjD;AAEA,QAAM,EAAE,iBAAiB,sBAAsB,QAAQ,uBAAuB,YAAY,QAAI,6CAAoB;AAAA,IAChH,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,mBAAe,sBAAQ,MAAM;AACjC,QAAI,CAAC;AAAQ,aAAO;AACpB,eAAO,0CAAiB,eAAe,OAAO,EAAE;AAAA,EAClD,GAAG,CAAC,QAAQ,aAAa,CAAC;AAE1B,QAAM,UAAM;AAAA,IACV,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,uBAAuB,WAAW;AAAA,EACnD;AAEA,MAAI;AACF,WACE,6CAAC,sCAAY,GAAG,iBACd;AAAA,kDAAC,2CAAiB,GAAG,sBACnB,sDAAC,qCAAe,UAAf,EAAwB,OAAO,KAC9B,sDAAC,aAAW,GAAG,OAAO,GACxB,GACF;AAAA,UACC;AAAA,QACC,4CAAC,uCAAY,OAAO,EAAE,OAAO,OAAO,GAAG,WAAW,CAAC,yDAAiC,GACjF,mBAAS,4CAAC,kBAAI,KAAK,cAAc,KAAK,CAAC,QAAQ,IAAI,QAAQ,OAAO,EAAE,GAAG,eAAa,MAAC,IAAK,MAC7F;AAAA,QACA,SAAS;AAAA,MACX;AAAA,OACF;AAEJ,SAAO,4CAAC,aAAW,GAAG,OAAO;AAC/B;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -34,7 +34,7 @@ const usePaginationConfig = (props, flattenedData) => {
|
|
|
34
34
|
}, [hasPagination, dataIsPage, flattenedData, pageIndex, pageSize]);
|
|
35
35
|
const paginationHelpers = useMemo(
|
|
36
36
|
() => ({
|
|
37
|
-
pageIndex
|
|
37
|
+
pageIndex,
|
|
38
38
|
canPreviousPage,
|
|
39
39
|
canNextPage,
|
|
40
40
|
pageSize,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/configs/usePaginationConfig.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport type { TypescriptPagination, TypescriptProps, TypescriptRow } from '../types/props';\n\nconst noPagination: Record<string, never> = {};\n\nconst emptyFunc = () => null;\n\nexport const usePaginationConfig = (\n props: TypescriptProps,\n flattenedData: TypescriptRow[],\n): [TypescriptRow[] | null, TypescriptPagination] => {\n const { pagination } = props;\n\n const hasPagination = !!pagination;\n\n // Set default values\n const {\n pageIndex = 1,\n canPreviousPage = true,\n canNextPage = true,\n pageSize = 10,\n perPageOptions = [10],\n onPageSizeChange = emptyFunc,\n onPreviousPage = emptyFunc,\n onNextPage = emptyFunc,\n onPageChange = emptyFunc,\n pageCount = Math.ceil(flattenedData.length / pageSize),\n isLoadingPageCount = false,\n dataIsPage = false,\n perPageStep = 5,\n minPerPage = 0,\n maxPerPage = 100,\n showPerPageSelector = true,\n pageDetails = [],\n pageDetailsTitle = '',\n } = pagination || noPagination; // pagination can be false\n\n // Get the needed page\n const page = useMemo(() => {\n if (!hasPagination) return null;\n if (dataIsPage) return flattenedData;\n return flattenedData.slice((pageIndex - 1) * pageSize, pageIndex * pageSize);\n }, [hasPagination, dataIsPage, flattenedData, pageIndex, pageSize]);\n\n const paginationHelpers = useMemo(\n () => ({\n pageIndex
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AAGxB,MAAM,eAAsC,CAAC;AAE7C,MAAM,YAAY,MAAM;AAEjB,MAAM,sBAAsB,CACjC,OACA,kBACmD;AACnD,QAAM,EAAE,WAAW,IAAI;AAEvB,QAAM,gBAAgB,CAAC,CAAC;AAGxB,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,WAAW;AAAA,IACX,iBAAiB,CAAC,EAAE;AAAA,IACpB,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,YAAY,KAAK,KAAK,cAAc,SAAS,QAAQ;AAAA,IACrD,qBAAqB;AAAA,IACrB,aAAa;AAAA,IACb,cAAc;AAAA,IACd,aAAa;AAAA,IACb,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,cAAc,CAAC;AAAA,IACf,mBAAmB;AAAA,EACrB,IAAI,cAAc;AAGlB,QAAM,OAAO,QAAQ,MAAM;AACzB,QAAI,CAAC;AAAe,aAAO;AAC3B,QAAI;AAAY,aAAO;AACvB,WAAO,cAAc,OAAO,YAAY,KAAK,UAAU,YAAY,QAAQ;AAAA,EAC7E,GAAG,CAAC,eAAe,YAAY,eAAe,WAAW,QAAQ,CAAC;AAElE,QAAM,oBAAoB;AAAA,IACxB,OAAO;AAAA,MACL
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport type { TypescriptPagination, TypescriptProps, TypescriptRow } from '../types/props';\n\nconst noPagination: Record<string, never> = {};\n\nconst emptyFunc = () => null;\n\nexport const usePaginationConfig = (\n props: TypescriptProps,\n flattenedData: TypescriptRow[],\n): [TypescriptRow[] | null, TypescriptPagination] => {\n const { pagination } = props;\n\n const hasPagination = !!pagination;\n\n // Set default values\n const {\n pageIndex = 1,\n canPreviousPage = true,\n canNextPage = true,\n pageSize = 10,\n perPageOptions = [10],\n onPageSizeChange = emptyFunc,\n onPreviousPage = emptyFunc,\n onNextPage = emptyFunc,\n onPageChange = emptyFunc,\n pageCount = Math.ceil(flattenedData.length / pageSize),\n isLoadingPageCount = false,\n dataIsPage = false,\n perPageStep = 5,\n minPerPage = 0,\n maxPerPage = 100,\n showPerPageSelector = true,\n pageDetails = [],\n pageDetailsTitle = '',\n } = pagination || noPagination; // pagination can be false\n\n // Get the needed page\n const page = useMemo(() => {\n if (!hasPagination) return null;\n if (dataIsPage) return flattenedData;\n return flattenedData.slice((pageIndex - 1) * pageSize, pageIndex * pageSize);\n }, [hasPagination, dataIsPage, flattenedData, pageIndex, pageSize]);\n\n const paginationHelpers = useMemo(\n () => ({\n pageIndex,\n canPreviousPage,\n canNextPage,\n pageSize,\n perPageOptions,\n onPageSizeChange,\n onPreviousPage,\n onNextPage,\n onPageChange,\n pageCount,\n isLoadingPageCount: isLoadingPageCount,\n perPageStep,\n minPerPage,\n maxPerPage,\n showPerPageSelector,\n pageDetails,\n pageDetailsTitle,\n }),\n [\n pageIndex,\n canPreviousPage,\n canNextPage,\n pageSize,\n perPageOptions,\n onPageSizeChange,\n onPreviousPage,\n onNextPage,\n onPageChange,\n pageCount,\n isLoadingPageCount,\n perPageStep,\n minPerPage,\n maxPerPage,\n showPerPageSelector,\n pageDetails,\n pageDetailsTitle,\n ],\n );\n return [page, paginationHelpers];\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AAGxB,MAAM,eAAsC,CAAC;AAE7C,MAAM,YAAY,MAAM;AAEjB,MAAM,sBAAsB,CACjC,OACA,kBACmD;AACnD,QAAM,EAAE,WAAW,IAAI;AAEvB,QAAM,gBAAgB,CAAC,CAAC;AAGxB,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,WAAW;AAAA,IACX,iBAAiB,CAAC,EAAE;AAAA,IACpB,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,YAAY,KAAK,KAAK,cAAc,SAAS,QAAQ;AAAA,IACrD,qBAAqB;AAAA,IACrB,aAAa;AAAA,IACb,cAAc;AAAA,IACd,aAAa;AAAA,IACb,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,cAAc,CAAC;AAAA,IACf,mBAAmB;AAAA,EACrB,IAAI,cAAc;AAGlB,QAAM,OAAO,QAAQ,MAAM;AACzB,QAAI,CAAC;AAAe,aAAO;AAC3B,QAAI;AAAY,aAAO;AACvB,WAAO,cAAc,OAAO,YAAY,KAAK,UAAU,YAAY,QAAQ;AAAA,EAC7E,GAAG,CAAC,eAAe,YAAY,eAAe,WAAW,QAAQ,CAAC;AAElE,QAAM,oBAAoB;AAAA,IACxB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO,CAAC,MAAM,iBAAiB;AACjC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDRowContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport React, { useCallback, useMemo } from 'react';\nimport {\n DndContext,\n DragOverlay,\n SortableContext,\n useTreeDndkitConfig,\n removeChildrenOf,\n restrictToFirstScrollableAncestor,\n type DnDKitTree,\n} from '@elliemae/ds-drag-and-drop';\nimport { createPortal } from 'react-dom';\nimport { DataTableContext } from '../../DataTableContext';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { Row } from '../Row';\nimport { DnDTreeContext } from './DnDTreeContext';\nimport type { TypescriptRow } from 'types/props';\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, getIsDropValid },\n flattenedData,\n allDataFlattened,\n } = React.useContext(DataTableContext);\n\n const onReorder: DnDKitTree.OnReorder<TypescriptRow> = useCallback(\n (_active, targetIndex, { movedData, fromIndex, considerExpanding }) => {\n // Pull the row's original data into an object\n const nodes: Record<string, TypescriptRow> = {};\n movedData.forEach((row) => {\n if (row.original.subRows) delete row.original.subRows;\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [] as TypescriptRow[];\n movedData.forEach((row) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (row.parentId) {\n const parentNode = nodes[row.parentId];\n if (parentNode?.subRows) parentNode.subRows.push(row.original);\n else parentNode.subRows = [row.original];\n } else newUserData.push(row.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onRowsReorder(newUserData, { targetIndex, fromIndex }, considerExpanding as string | null, {\n flattenedData,\n allDataFlattened,\n });\n },\n [allDataFlattened, flattenedData, onRowsReorder],\n );\n\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } = useTreeDndkitConfig({\n flattenedItems: allDataFlattened,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid: getIsDropValid,\n });\n\n const visibleItems = useMemo(() => {\n if (!active) return flattenedData;\n return removeChildrenOf(flattenedData, active.id);\n }, [active, flattenedData]);\n\n const ctx = useMemo(\n () => ({\n visibleItems,\n dropIndicatorPosition,\n isDropValid,\n }),\n [visibleItems, dropIndicatorPosition, isDropValid],\n );\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider value={ctx}>\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }} modifiers={[restrictToFirstScrollableAncestor]}>\n {active ? <Row row={flattenedData.find((row) => row.uid === active.id)} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport React, { useCallback, useMemo } from 'react';\nimport {\n DndContext,\n DragOverlay,\n SortableContext,\n useTreeDndkitConfig,\n removeChildrenOf,\n restrictToFirstScrollableAncestor,\n type DnDKitTree,\n} from '@elliemae/ds-drag-and-drop';\nimport { createPortal } from 'react-dom';\nimport { DataTableContext } from '../../DataTableContext';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { Row } from '../Row';\nimport { DnDTreeContext } from './DnDTreeContext';\nimport type { TypescriptRow } from '../../types/props';\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, getIsDropValid },\n flattenedData,\n allDataFlattened,\n } = React.useContext(DataTableContext);\n\n const onReorder: DnDKitTree.OnReorder<TypescriptRow> = useCallback(\n (_active, targetIndex, { movedData, fromIndex, considerExpanding }) => {\n // Pull the row's original data into an object\n const nodes: Record<string, TypescriptRow> = {};\n movedData.forEach((row) => {\n if (row.original.subRows) delete row.original.subRows;\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [] as TypescriptRow[];\n movedData.forEach((row) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (row.parentId) {\n const parentNode = nodes[row.parentId];\n if (parentNode?.subRows) parentNode.subRows.push(row.original);\n else parentNode.subRows = [row.original];\n } else newUserData.push(row.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onRowsReorder(newUserData, { targetIndex, fromIndex }, considerExpanding as string | null, {\n flattenedData,\n allDataFlattened,\n });\n },\n [allDataFlattened, flattenedData, onRowsReorder],\n );\n\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } = useTreeDndkitConfig({\n flattenedItems: allDataFlattened,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid: getIsDropValid,\n });\n\n const visibleItems = useMemo(() => {\n if (!active) return flattenedData;\n return removeChildrenOf(flattenedData, active.id);\n }, [active, flattenedData]);\n\n const ctx = useMemo(\n () => ({\n visibleItems,\n dropIndicatorPosition,\n isDropValid,\n }),\n [visibleItems, dropIndicatorPosition, isDropValid],\n );\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider value={ctx}>\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }} modifiers={[restrictToFirstScrollableAncestor]}>\n {active ? <Row row={flattenedData.find((row) => row.uid === active.id)} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;AC+EjB,SAGM,KAHN;AA9EN,OAAOA,UAAS,aAAa,eAAe;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAEjC,SAAS,WAAW;AACpB,SAAS,sBAAsB;AAIxB,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM;AAAA,IACJ,YAAY,EAAE,iBAAiB,cAAc,eAAe,qBAAqB,eAAe;AAAA,IAChG;AAAA,IACA;AAAA,EACF,IAAIA,OAAM,WAAW,gBAAgB;AAErC,QAAM,YAAiD;AAAA,IACrD,CAAC,SAAS,aAAa,EAAE,WAAW,WAAW,kBAAkB,MAAM;AAErE,YAAM,QAAuC,CAAC;AAC9C,gBAAU,QAAQ,CAAC,QAAQ;AACzB,YAAI,IAAI,SAAS;AAAS,iBAAO,IAAI,SAAS;AAC9C,eAAO,IAAI,SAAS;AACpB,cAAM,IAAI,OAAO,IAAI;AAAA,MACvB,CAAC;AACD,YAAM,cAAc,CAAC;AACrB,gBAAU,QAAQ,CAAC,QAAQ;AAGzB,YAAI,IAAI,UAAU;AAChB,gBAAM,aAAa,MAAM,IAAI;AAC7B,cAAI,YAAY;AAAS,uBAAW,QAAQ,KAAK,IAAI,QAAQ;AAAA;AACxD,uBAAW,UAAU,CAAC,IAAI,QAAQ;AAAA,QACzC;AAAO,sBAAY,KAAK,IAAI,QAAQ;AAAA,MACtC,CAAC;AAED,oBAAc,aAAa,EAAE,aAAa,UAAU,GAAG,mBAAoC;AAAA,QACzF;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,kBAAkB,eAAe,aAAa;AAAA,EACjD;AAEA,QAAM,EAAE,iBAAiB,sBAAsB,QAAQ,uBAAuB,YAAY,IAAI,oBAAoB;AAAA,IAChH,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,eAAe,QAAQ,MAAM;AACjC,QAAI,CAAC;AAAQ,aAAO;AACpB,WAAO,iBAAiB,eAAe,OAAO,EAAE;AAAA,EAClD,GAAG,CAAC,QAAQ,aAAa,CAAC;AAE1B,QAAM,MAAM;AAAA,IACV,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,uBAAuB,WAAW;AAAA,EACnD;AAEA,MAAI;AACF,WACE,qBAAC,cAAY,GAAG,iBACd;AAAA,0BAAC,mBAAiB,GAAG,sBACnB,8BAAC,eAAe,UAAf,EAAwB,OAAO,KAC9B,8BAAC,aAAW,GAAG,OAAO,GACxB,GACF;AAAA,MACC;AAAA,QACC,oBAAC,eAAY,OAAO,EAAE,OAAO,OAAO,GAAG,WAAW,CAAC,iCAAiC,GACjF,mBAAS,oBAAC,OAAI,KAAK,cAAc,KAAK,CAAC,QAAQ,IAAI,QAAQ,OAAO,EAAE,GAAG,eAAa,MAAC,IAAK,MAC7F;AAAA,QACA,SAAS;AAAA,MACX;AAAA,OACF;AAEJ,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-data-table",
|
|
3
|
-
"version": "3.16.0-next.
|
|
3
|
+
"version": "3.16.0-next.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Data Table",
|
|
6
6
|
"files": [
|
|
@@ -573,24 +573,24 @@
|
|
|
573
573
|
"dependencies": {
|
|
574
574
|
"react-virtual": "~2.10.4",
|
|
575
575
|
"uid": "~2.0.0",
|
|
576
|
-
"@elliemae/ds-button": "3.16.0-next.
|
|
577
|
-
"@elliemae/ds-
|
|
578
|
-
"@elliemae/ds-form": "3.16.0-next.
|
|
579
|
-
"@elliemae/ds-
|
|
580
|
-
"@elliemae/ds-
|
|
581
|
-
"@elliemae/ds-
|
|
582
|
-
"@elliemae/ds-
|
|
583
|
-
"@elliemae/ds-
|
|
584
|
-
"@elliemae/ds-
|
|
585
|
-
"@elliemae/ds-
|
|
586
|
-
"@elliemae/ds-
|
|
587
|
-
"@elliemae/ds-
|
|
588
|
-
"@elliemae/ds-
|
|
589
|
-
"@elliemae/ds-
|
|
590
|
-
"@elliemae/ds-
|
|
591
|
-
"@elliemae/ds-
|
|
592
|
-
"@elliemae/ds-
|
|
593
|
-
"@elliemae/ds-
|
|
576
|
+
"@elliemae/ds-button": "3.16.0-next.6",
|
|
577
|
+
"@elliemae/ds-circular-progress-indicator": "3.16.0-next.6",
|
|
578
|
+
"@elliemae/ds-controlled-form": "3.16.0-next.6",
|
|
579
|
+
"@elliemae/ds-dropdownmenu": "3.16.0-next.6",
|
|
580
|
+
"@elliemae/ds-form": "3.16.0-next.6",
|
|
581
|
+
"@elliemae/ds-form-layout-blocks": "3.16.0-next.6",
|
|
582
|
+
"@elliemae/ds-grid": "3.16.0-next.6",
|
|
583
|
+
"@elliemae/ds-icons": "3.16.0-next.6",
|
|
584
|
+
"@elliemae/ds-drag-and-drop": "3.16.0-next.6",
|
|
585
|
+
"@elliemae/ds-pagination": "3.16.0-next.6",
|
|
586
|
+
"@elliemae/ds-pills": "3.16.0-next.6",
|
|
587
|
+
"@elliemae/ds-popperjs": "3.16.0-next.6",
|
|
588
|
+
"@elliemae/ds-skeleton": "3.16.0-next.6",
|
|
589
|
+
"@elliemae/ds-system": "3.16.0-next.6",
|
|
590
|
+
"@elliemae/ds-props-helpers": "3.16.0-next.6",
|
|
591
|
+
"@elliemae/ds-truncated-tooltip-text": "3.16.0-next.6",
|
|
592
|
+
"@elliemae/ds-toolbar": "3.16.0-next.6",
|
|
593
|
+
"@elliemae/ds-utilities": "3.16.0-next.6"
|
|
594
594
|
},
|
|
595
595
|
"devDependencies": {
|
|
596
596
|
"@testing-library/react": "~12.1.3",
|
package/dist/cjs/package.json
DELETED