@elliemae/ds-data-table 3.20.0-next.5 → 3.20.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/helpers/gridLayoutHelpers.js +71 -0
- package/dist/cjs/helpers/gridLayoutHelpers.js.map +7 -0
- package/dist/cjs/parts/Headers/HeaderCellGroup.js +1 -1
- package/dist/cjs/parts/Headers/HeaderCellGroup.js.map +2 -2
- package/dist/cjs/parts/Headers/useHeaderResizer.js +17 -27
- package/dist/cjs/parts/Headers/useHeaderResizer.js.map +2 -2
- package/dist/cjs/parts/SortableHeaderCell.js +20 -2
- package/dist/cjs/parts/SortableHeaderCell.js.map +2 -2
- package/dist/cjs/styled.js +6 -0
- package/dist/cjs/styled.js.map +2 -2
- package/dist/esm/helpers/gridLayoutHelpers.js +41 -0
- package/dist/esm/helpers/gridLayoutHelpers.js.map +7 -0
- package/dist/esm/parts/Headers/HeaderCellGroup.js +1 -1
- package/dist/esm/parts/Headers/HeaderCellGroup.js.map +2 -2
- package/dist/esm/parts/Headers/useHeaderResizer.js +11 -21
- package/dist/esm/parts/Headers/useHeaderResizer.js.map +2 -2
- package/dist/esm/parts/SortableHeaderCell.js +20 -2
- package/dist/esm/parts/SortableHeaderCell.js.map +2 -2
- package/dist/esm/styled.js +6 -0
- package/dist/esm/styled.js.map +2 -2
- package/dist/types/helpers/gridLayoutHelpers.d.ts +4 -0
- package/dist/types/parts/SortableHeaderCell.d.ts +2 -1
- package/package.json +25 -25
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var gridLayoutHelpers_exports = {};
|
|
30
|
+
__export(gridLayoutHelpers_exports, {
|
|
31
|
+
changeGridLayout: () => changeGridLayout,
|
|
32
|
+
getGridLayout: () => getGridLayout,
|
|
33
|
+
setSubColumnsGridLayout: () => setSubColumnsGridLayout
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(gridLayoutHelpers_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
const getGridLayout = (wrapper) => {
|
|
38
|
+
if (!wrapper)
|
|
39
|
+
return [];
|
|
40
|
+
return getComputedStyle(wrapper).getPropertyValue("--grid-layout").split("minmax(0,").slice(1).map((str) => str.replace("px) ", "").replace("px)", "")).map((str) => Number.parseInt(str, 10));
|
|
41
|
+
};
|
|
42
|
+
const changeGridLayout = (wrapper, colIndex, newWidth) => {
|
|
43
|
+
if (!wrapper)
|
|
44
|
+
return;
|
|
45
|
+
const cols = getGridLayout(wrapper);
|
|
46
|
+
cols[colIndex] = newWidth;
|
|
47
|
+
wrapper.style.setProperty("--grid-layout", cols.map((col) => `minmax(0, ${col}px)`).join(" "));
|
|
48
|
+
wrapper.style.setProperty("--total-width", `${cols.reduce((acc, col) => acc + col, 0)}px`);
|
|
49
|
+
};
|
|
50
|
+
const setSubColumnsGridLayout = (wrapper, columns) => {
|
|
51
|
+
if (!wrapper)
|
|
52
|
+
return;
|
|
53
|
+
const cols = getGridLayout(wrapper);
|
|
54
|
+
let prevIndex = 0;
|
|
55
|
+
const variables = columns.reduce((acc, cur) => {
|
|
56
|
+
const count = cur.columns ? cur.columns.length : 1;
|
|
57
|
+
acc.push({
|
|
58
|
+
cols: cols.slice(prevIndex, prevIndex + count),
|
|
59
|
+
id: cur.id
|
|
60
|
+
});
|
|
61
|
+
prevIndex += count;
|
|
62
|
+
return acc;
|
|
63
|
+
}, []);
|
|
64
|
+
variables.forEach((variable) => {
|
|
65
|
+
wrapper.style.setProperty(
|
|
66
|
+
`--grid-layout-${variable.id}`,
|
|
67
|
+
variable.cols.map((col) => `minmax(0, ${col}px)`).join(" ")
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=gridLayoutHelpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/gridLayoutHelpers.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type { DSDataTableT } from '../react-desc-prop-types.js';\n\n// Returns the current grid layout of the table (by reading the CSS variable --grid-layout)\nexport const getGridLayout = (wrapper: HTMLDivElement | null): number[] => {\n if (!wrapper) return [];\n return getComputedStyle(wrapper)\n .getPropertyValue('--grid-layout')\n .split('minmax(0,')\n .slice(1)\n .map((str) => str.replace('px) ', '').replace('px)', ''))\n .map((str) => Number.parseInt(str, 10));\n};\n\n// Changes the grid layout of the table (by changing the CSS variable --grid-layout)\nexport const changeGridLayout = (wrapper: HTMLDivElement | null, colIndex: number, newWidth: number) => {\n if (!wrapper) return;\n const cols = getGridLayout(wrapper);\n cols[colIndex] = newWidth;\n wrapper.style.setProperty('--grid-layout', cols.map((col) => `minmax(0, ${col}px)`).join(' '));\n wrapper.style.setProperty('--total-width', `${cols.reduce((acc, col) => acc + col, 0)}px`);\n};\n\n// TODO: @carusox remove this\n// Since the structure of the column grouping is not ideal (with this I mean that the columns are nested in the HTML DOM),\n// we need to create variables to keep track of the sub-columns layout for each different group\n// When we go ahead and implement the new behavior (also present nowadays on the specs, we should be removing this code)\nexport const setSubColumnsGridLayout = (wrapper: HTMLDivElement | null, columns: DSDataTableT.InternalColumn[]) => {\n if (!wrapper) return;\n\n const cols = getGridLayout(wrapper);\n\n let prevIndex = 0;\n\n const variables = columns.reduce((acc, cur) => {\n const count = cur.columns ? cur.columns.length : 1;\n acc.push({\n cols: cols.slice(prevIndex, prevIndex + count),\n id: cur.id,\n });\n prevIndex += count;\n return acc;\n }, [] as { cols: number[]; id: string }[]);\n\n variables.forEach((variable) => {\n wrapper.style.setProperty(\n `--grid-layout-${variable.id}`,\n variable.cols.map((col) => `minmax(0, ${col}px)`).join(' '),\n );\n });\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGhB,MAAM,gBAAgB,CAAC,YAA6C;AACzE,MAAI,CAAC;AAAS,WAAO,CAAC;AACtB,SAAO,iBAAiB,OAAO,EAC5B,iBAAiB,eAAe,EAChC,MAAM,WAAW,EACjB,MAAM,CAAC,EACP,IAAI,CAAC,QAAQ,IAAI,QAAQ,QAAQ,EAAE,EAAE,QAAQ,OAAO,EAAE,CAAC,EACvD,IAAI,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,CAAC;AAC1C;AAGO,MAAM,mBAAmB,CAAC,SAAgC,UAAkB,aAAqB;AACtG,MAAI,CAAC;AAAS;AACd,QAAM,OAAO,cAAc,OAAO;AAClC,OAAK,QAAQ,IAAI;AACjB,UAAQ,MAAM,YAAY,iBAAiB,KAAK,IAAI,CAAC,QAAQ,aAAa,QAAQ,EAAE,KAAK,GAAG,CAAC;AAC7F,UAAQ,MAAM,YAAY,iBAAiB,GAAG,KAAK,OAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,CAAC,KAAK;AAC3F;AAMO,MAAM,0BAA0B,CAAC,SAAgC,YAA2C;AACjH,MAAI,CAAC;AAAS;AAEd,QAAM,OAAO,cAAc,OAAO;AAElC,MAAI,YAAY;AAEhB,QAAM,YAAY,QAAQ,OAAO,CAAC,KAAK,QAAQ;AAC7C,UAAM,QAAQ,IAAI,UAAU,IAAI,QAAQ,SAAS;AACjD,QAAI,KAAK;AAAA,MACP,MAAM,KAAK,MAAM,WAAW,YAAY,KAAK;AAAA,MAC7C,IAAI,IAAI;AAAA,IACV,CAAC;AACD,iBAAa;AACb,WAAO;AAAA,EACT,GAAG,CAAC,CAAqC;AAEzC,YAAU,QAAQ,CAAC,aAAa;AAC9B,YAAQ,MAAM;AAAA,MACZ,iBAAiB,SAAS;AAAA,MAC1B,SAAS,KAAK,IAAI,CAAC,QAAQ,aAAa,QAAQ,EAAE,KAAK,GAAG;AAAA,IAC5D;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -84,7 +84,7 @@ const HeaderCellGroupComp = ({
|
|
|
84
84
|
shouldDropOneLevel: isMultiLevel && level === 0 && !children,
|
|
85
85
|
children: [
|
|
86
86
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_HeaderCell.HeaderCell, { column: header, isDragOverlay, colSpan }),
|
|
87
|
-
!!children?.length && !isDragOverlay && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SortableHeaderCell.SortableHeaderCell, { isGroup: true, items: children, isDragOverlay, children: children.map((h, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
!!children?.length && !isDragOverlay && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SortableHeaderCell.SortableHeaderCell, { isGroup: true, items: children, isDragOverlay, colId: header.id, children: children.map((h, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
88
|
ChildGroup,
|
|
89
89
|
{
|
|
90
90
|
header: h,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/HeaderCellGroup.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { styled } from '@elliemae/ds-system';\nimport { HeaderCell } from './HeaderCell.js';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport { withDnDSortableColumnContext } from '../internal.js';\nimport { DropIndicator } from '../DropIndicator.js';\nimport { SortableHeaderCell } from '../SortableHeaderCell.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { EmptyChildrenGroup } from './EmptyChildrenGroup.js';\nimport { DATA_TESTID } from '../../configs/index.js';\nimport { DataTableContext } from '../../DataTableContext.js';\n\nconst StyledWrapper = styled(Grid)<{\n shouldDropOneLevel: boolean;\n isDragOverlay?: boolean;\n isDragging?: boolean;\n isFirst?: boolean;\n gridColumn: string;\n}>`\n position: relative;\n ${({ shouldDropOneLevel, isDragOverlay }) => (shouldDropOneLevel && !isDragOverlay ? `top: 50%; height: 50%;` : '')}\n width: ${(props) => (props.isDragOverlay ? 'fit-content' : '100%')};\n grid-column: ${(props) => props.gridColumn};\n background: ${(props) => (props.isDragging ? props.theme.colors.neutral['080'] : 'white')};\n opacity: ${(props) => (props.isDragging ? 0.8 : 1)};\n box-shadow: 0 2px 4px 0 ${(props) => (props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent')};\n border-left: ${({ isFirst }) => (isFirst ? '0px' : '1px')} solid ${(props) => props.theme.colors.neutral['080']};\n`;\n\ninterface HeaderCellGroupCompProps {\n header: DSDataTableT.InternalColumn;\n isDragOverlay?: boolean;\n isDraggingParent?: boolean;\n isLast?: boolean;\n isFirst?: boolean;\n level?: number;\n}\n\nconst HeaderCellGroupComp: React.ComponentType<HeaderCellGroupCompProps> = ({\n header,\n isDragOverlay,\n isDraggingParent,\n isLast,\n isFirst,\n level = 0,\n}) => {\n const { visibleColumns } = useContext(DataTableContext);\n const { draggableProps } = useContext(SortableItemContext);\n\n const isMultiLevel = visibleColumns.some((col) => !!col.columns);\n\n const children = header.columns;\n\n const isDragging = (draggableProps && draggableProps.isDragging) || isDraggingParent;\n const dropIndicatorPosition =\n draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;\n\n const ChildGroup = isDragOverlay ? HeaderCellGroup : HeaderCellGroupSortable;\n\n const colSpan = children?.length ?? 1;\n return (\n <StyledWrapper\n ref={draggableProps ? draggableProps.setNodeRef : null}\n gridColumn={isDragOverlay ? 'auto' : `span ${colSpan}`}\n isDragOverlay={isDragOverlay}\n isDragging={isDragging}\n cols={['auto']}\n data-testid={isDragOverlay ? DATA_TESTID.DATA_TABLE_COLUMN_DRAG_OVERLAY : undefined}\n isFirst={isFirst}\n shouldDropOneLevel={isMultiLevel && level === 0 && !children}\n >\n <HeaderCell column={header} isDragOverlay={isDragOverlay} colSpan={colSpan} />\n {!!children?.length && !isDragOverlay && (\n <SortableHeaderCell isGroup items={children} isDragOverlay={isDragOverlay}>\n {children.map((h, index) => (\n <ChildGroup\n key={h.id}\n header={h}\n isDragOverlay={isDragOverlay}\n isDraggingParent={isDragging}\n isLast={index === children.length - 1}\n isFirst={index === 0}\n level={level + 1}\n />\n ))}\n </SortableHeaderCell>\n )}\n {children?.length && isDragOverlay && <EmptyChildrenGroup />}\n <DropIndicator vertical dropIndicatorPosition={dropIndicatorPosition} isLast={isLast && isDragging} isDropValid />\n </StyledWrapper>\n );\n};\n\n// We need to declare this because we MUST avoid the useSortable call in the recursive calls of the function\n\nexport const HeaderCellGroup = HeaderCellGroupComp;\n\nexport const HeaderCellGroupSortable = withDnDSortableColumnContext(HeaderCellGroupComp);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgEnB;AA9DJ,mBAAkC;AAClC,qBAAqB;AACrB,uBAAuB;AACvB,wBAA2B;AAC3B,iCAAoC;AACpC,sBAA6C;AAC7C,2BAA8B;AAC9B,gCAAmC;AAEnC,gCAAmC;AACnC,qBAA4B;AAC5B,8BAAiC;AAEjC,MAAM,oBAAgB,yBAAO,mBAAI;AAAA;AAAA,IAQ7B,CAAC,EAAE,oBAAoB,cAAc,MAAO,sBAAsB,CAAC,gBAAgB,2BAA2B;AAAA,WACvG,CAAC,UAAW,MAAM,gBAAgB,gBAAgB;AAAA,iBAC5C,CAAC,UAAU,MAAM;AAAA,gBAClB,CAAC,UAAW,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI;AAAA,aACtE,CAAC,UAAW,MAAM,aAAa,MAAM;AAAA,4BACtB,CAAC,UAAW,MAAM,gBAAgB,oBAAoB;AAAA,iBACjE,CAAC,EAAE,QAAQ,MAAO,UAAU,QAAQ,eAAgB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA;AAYhH,MAAM,sBAAqE,CAAC;AAAA,EAC1E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AACV,MAAM;AACJ,QAAM,EAAE,eAAe,QAAI,yBAAW,wCAAgB;AACtD,QAAM,EAAE,eAAe,QAAI,yBAAW,8CAAmB;AAEzD,QAAM,eAAe,eAAe,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,OAAO;AAE/D,QAAM,WAAW,OAAO;AAExB,QAAM,aAAc,kBAAkB,eAAe,cAAe;AACpE,QAAM,wBACJ,kBAAkB,eAAe,mCAAmC,eAAe;AAErF,QAAM,aAAa,gBAAgB,kBAAkB;AAErD,QAAM,UAAU,UAAU,UAAU;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,iBAAiB,eAAe,aAAa;AAAA,MAClD,YAAY,gBAAgB,SAAS,QAAQ;AAAA,MAC7C;AAAA,MACA;AAAA,MACA,MAAM,CAAC,MAAM;AAAA,MACb,eAAa,gBAAgB,2BAAY,iCAAiC;AAAA,MAC1E;AAAA,MACA,oBAAoB,gBAAgB,UAAU,KAAK,CAAC;AAAA,MAEpD;AAAA,oDAAC,gCAAW,QAAQ,QAAQ,eAA8B,SAAkB;AAAA,QAC3E,CAAC,CAAC,UAAU,UAAU,CAAC,iBACtB,4CAAC,gDAAmB,SAAO,MAAC,OAAO,UAAU,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { styled } from '@elliemae/ds-system';\nimport { HeaderCell } from './HeaderCell.js';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport { withDnDSortableColumnContext } from '../internal.js';\nimport { DropIndicator } from '../DropIndicator.js';\nimport { SortableHeaderCell } from '../SortableHeaderCell.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { EmptyChildrenGroup } from './EmptyChildrenGroup.js';\nimport { DATA_TESTID } from '../../configs/index.js';\nimport { DataTableContext } from '../../DataTableContext.js';\n\nconst StyledWrapper = styled(Grid)<{\n shouldDropOneLevel: boolean;\n isDragOverlay?: boolean;\n isDragging?: boolean;\n isFirst?: boolean;\n gridColumn: string;\n}>`\n position: relative;\n ${({ shouldDropOneLevel, isDragOverlay }) => (shouldDropOneLevel && !isDragOverlay ? `top: 50%; height: 50%;` : '')}\n width: ${(props) => (props.isDragOverlay ? 'fit-content' : '100%')};\n grid-column: ${(props) => props.gridColumn};\n background: ${(props) => (props.isDragging ? props.theme.colors.neutral['080'] : 'white')};\n opacity: ${(props) => (props.isDragging ? 0.8 : 1)};\n box-shadow: 0 2px 4px 0 ${(props) => (props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent')};\n border-left: ${({ isFirst }) => (isFirst ? '0px' : '1px')} solid ${(props) => props.theme.colors.neutral['080']};\n`;\n\ninterface HeaderCellGroupCompProps {\n header: DSDataTableT.InternalColumn;\n isDragOverlay?: boolean;\n isDraggingParent?: boolean;\n isLast?: boolean;\n isFirst?: boolean;\n level?: number;\n}\n\nconst HeaderCellGroupComp: React.ComponentType<HeaderCellGroupCompProps> = ({\n header,\n isDragOverlay,\n isDraggingParent,\n isLast,\n isFirst,\n level = 0,\n}) => {\n const { visibleColumns } = useContext(DataTableContext);\n const { draggableProps } = useContext(SortableItemContext);\n\n const isMultiLevel = visibleColumns.some((col) => !!col.columns);\n\n const children = header.columns;\n\n const isDragging = (draggableProps && draggableProps.isDragging) || isDraggingParent;\n const dropIndicatorPosition =\n draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;\n\n const ChildGroup = isDragOverlay ? HeaderCellGroup : HeaderCellGroupSortable;\n\n const colSpan = children?.length ?? 1;\n return (\n <StyledWrapper\n ref={draggableProps ? draggableProps.setNodeRef : null}\n gridColumn={isDragOverlay ? 'auto' : `span ${colSpan}`}\n isDragOverlay={isDragOverlay}\n isDragging={isDragging}\n cols={['auto']}\n data-testid={isDragOverlay ? DATA_TESTID.DATA_TABLE_COLUMN_DRAG_OVERLAY : undefined}\n isFirst={isFirst}\n shouldDropOneLevel={isMultiLevel && level === 0 && !children}\n >\n <HeaderCell column={header} isDragOverlay={isDragOverlay} colSpan={colSpan} />\n {!!children?.length && !isDragOverlay && (\n <SortableHeaderCell isGroup items={children} isDragOverlay={isDragOverlay} colId={header.id}>\n {children.map((h, index) => (\n <ChildGroup\n key={h.id}\n header={h}\n isDragOverlay={isDragOverlay}\n isDraggingParent={isDragging}\n isLast={index === children.length - 1}\n isFirst={index === 0}\n level={level + 1}\n />\n ))}\n </SortableHeaderCell>\n )}\n {children?.length && isDragOverlay && <EmptyChildrenGroup />}\n <DropIndicator vertical dropIndicatorPosition={dropIndicatorPosition} isLast={isLast && isDragging} isDropValid />\n </StyledWrapper>\n );\n};\n\n// We need to declare this because we MUST avoid the useSortable call in the recursive calls of the function\n\nexport const HeaderCellGroup = HeaderCellGroupComp;\n\nexport const HeaderCellGroupSortable = withDnDSortableColumnContext(HeaderCellGroupComp);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgEnB;AA9DJ,mBAAkC;AAClC,qBAAqB;AACrB,uBAAuB;AACvB,wBAA2B;AAC3B,iCAAoC;AACpC,sBAA6C;AAC7C,2BAA8B;AAC9B,gCAAmC;AAEnC,gCAAmC;AACnC,qBAA4B;AAC5B,8BAAiC;AAEjC,MAAM,oBAAgB,yBAAO,mBAAI;AAAA;AAAA,IAQ7B,CAAC,EAAE,oBAAoB,cAAc,MAAO,sBAAsB,CAAC,gBAAgB,2BAA2B;AAAA,WACvG,CAAC,UAAW,MAAM,gBAAgB,gBAAgB;AAAA,iBAC5C,CAAC,UAAU,MAAM;AAAA,gBAClB,CAAC,UAAW,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI;AAAA,aACtE,CAAC,UAAW,MAAM,aAAa,MAAM;AAAA,4BACtB,CAAC,UAAW,MAAM,gBAAgB,oBAAoB;AAAA,iB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,UAAU,iBAAiB,4CAAC,gDAAmB;AAAA,QAC1D,4CAAC,sCAAc,UAAQ,MAAC,uBAA8C,QAAQ,UAAU,YAAY,aAAW,MAAC;AAAA;AAAA;AAAA,EAClH;AAEJ;AAIO,MAAM,kBAAkB;AAExB,MAAM,8BAA0B,8CAA6B,mBAAmB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,20 +35,8 @@ var React = __toESM(require("react"));
|
|
|
35
35
|
var import_react = require("react");
|
|
36
36
|
var import_lodash = require("lodash");
|
|
37
37
|
var import_DataTableContext = require("../../DataTableContext.js");
|
|
38
|
+
var import_gridLayoutHelpers = require("../../helpers/gridLayoutHelpers.js");
|
|
38
39
|
const narrow = (value, min, max) => Math.min(Math.max(value, min ?? 30), max ?? Infinity);
|
|
39
|
-
const getGridLayout = (wrapper) => {
|
|
40
|
-
if (!wrapper)
|
|
41
|
-
return [];
|
|
42
|
-
return getComputedStyle(wrapper).getPropertyValue("--grid-layout").split("minmax(0,").slice(1).map((str) => str.replace("px) ", "").replace("px)", "")).map((str) => Number.parseInt(str, 10));
|
|
43
|
-
};
|
|
44
|
-
const changeGridLayout = (wrapper, colIndex, newWidth) => {
|
|
45
|
-
if (!wrapper)
|
|
46
|
-
return;
|
|
47
|
-
const cols = getGridLayout(wrapper);
|
|
48
|
-
cols[colIndex] = newWidth;
|
|
49
|
-
wrapper.style.setProperty("--grid-layout", cols.map((col) => `minmax(0, ${col}px)`).join(" "));
|
|
50
|
-
wrapper.style.setProperty("--total-width", `${cols.reduce((acc, col) => acc + col, 0)}px`);
|
|
51
|
-
};
|
|
52
40
|
const getCorrectDelta = (e) => {
|
|
53
41
|
let multiplier = 1;
|
|
54
42
|
if (e.shiftKey)
|
|
@@ -90,34 +78,35 @@ const useHeaderResizer = ({
|
|
|
90
78
|
const pushColumnSizeChange = (0, import_react.useCallback)(
|
|
91
79
|
(nextWidth) => {
|
|
92
80
|
onColumnResize?.(columnId, nextWidth);
|
|
93
|
-
|
|
81
|
+
visibleColumnsOnGridLayout[realColumnIndex].width = nextWidth;
|
|
94
82
|
onColumnSizeChange(visibleColumnsCopy, columnId, nextWidth);
|
|
95
83
|
},
|
|
96
|
-
[columnId, onColumnResize, onColumnSizeChange, realColumnIndex, visibleColumnsCopy]
|
|
84
|
+
[columnId, onColumnResize, onColumnSizeChange, realColumnIndex, visibleColumnsCopy, visibleColumnsOnGridLayout]
|
|
97
85
|
);
|
|
98
86
|
const onResizeStart = (0, import_react.useCallback)(() => {
|
|
99
87
|
setIsResizing(true);
|
|
100
88
|
}, []);
|
|
101
89
|
const onResizeEnd = (0, import_react.useCallback)(() => {
|
|
102
90
|
setIsResizing(false);
|
|
103
|
-
pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex]);
|
|
91
|
+
pushColumnSizeChange((0, import_gridLayoutHelpers.getGridLayout)(virtualListRef.current)[realColumnIndex]);
|
|
104
92
|
}, [pushColumnSizeChange, virtualListRef, realColumnIndex]);
|
|
105
93
|
const onResizeHandler = (0, import_react.useCallback)(
|
|
106
94
|
(e) => {
|
|
107
95
|
if (realColumnIndex == -1)
|
|
108
96
|
return;
|
|
109
97
|
const delta = ("clientX" in e ? e.clientX : e.touches[0].clientX) - (innerRef.current?.getBoundingClientRect().x ?? 0);
|
|
110
|
-
const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];
|
|
98
|
+
const originalWidth = (0, import_gridLayoutHelpers.getGridLayout)(virtualListRef.current)[realColumnIndex];
|
|
111
99
|
const widthWithDelta = narrow(
|
|
112
100
|
originalWidth + delta,
|
|
113
|
-
|
|
114
|
-
|
|
101
|
+
visibleColumnsOnGridLayout[realColumnIndex].minWidth,
|
|
102
|
+
visibleColumnsOnGridLayout[realColumnIndex].maxWidth
|
|
115
103
|
);
|
|
116
|
-
changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);
|
|
104
|
+
(0, import_gridLayoutHelpers.changeGridLayout)(virtualListRef.current, realColumnIndex, widthWithDelta);
|
|
105
|
+
(0, import_gridLayoutHelpers.setSubColumnsGridLayout)(virtualListRef.current, visibleColumnsCopy);
|
|
117
106
|
e.preventDefault();
|
|
118
107
|
e.stopPropagation();
|
|
119
108
|
},
|
|
120
|
-
[realColumnIndex,
|
|
109
|
+
[realColumnIndex, innerRef, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout]
|
|
121
110
|
);
|
|
122
111
|
const handleKeyboardResize = (0, import_react.useCallback)(
|
|
123
112
|
(e) => {
|
|
@@ -126,16 +115,17 @@ const useHeaderResizer = ({
|
|
|
126
115
|
const delta = getCorrectDelta(e);
|
|
127
116
|
if (delta === 0)
|
|
128
117
|
return;
|
|
129
|
-
const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];
|
|
118
|
+
const originalWidth = (0, import_gridLayoutHelpers.getGridLayout)(virtualListRef.current)[realColumnIndex];
|
|
130
119
|
const widthWithDelta = narrow(
|
|
131
120
|
originalWidth + delta,
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
visibleColumnsOnGridLayout[realColumnIndex].minWidth,
|
|
122
|
+
visibleColumnsOnGridLayout[realColumnIndex].maxWidth
|
|
134
123
|
);
|
|
135
|
-
changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);
|
|
136
|
-
|
|
124
|
+
(0, import_gridLayoutHelpers.changeGridLayout)(virtualListRef.current, realColumnIndex, widthWithDelta);
|
|
125
|
+
(0, import_gridLayoutHelpers.setSubColumnsGridLayout)(virtualListRef.current, visibleColumnsCopy);
|
|
126
|
+
pushColumnSizeChange((0, import_gridLayoutHelpers.getGridLayout)(virtualListRef.current)[realColumnIndex] + delta);
|
|
137
127
|
},
|
|
138
|
-
[pushColumnSizeChange, realColumnIndex, virtualListRef, visibleColumnsCopy]
|
|
128
|
+
[pushColumnSizeChange, realColumnIndex, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout]
|
|
139
129
|
);
|
|
140
130
|
return {
|
|
141
131
|
isResizing,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/Headers/useHeaderResizer.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useContext, useMemo, useState } from 'react';\nimport { cloneDeep } from 'lodash';\nimport { DataTableContext } from '../../DataTableContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\n\n// if number > max => max\n// if number < min => min\n// else => number\nconst narrow = (value: number, min: number | undefined, max: number | undefined): number =>\n Math.min(Math.max(value, min ?? 30), max ?? Infinity);\n\n// Returns the
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA2D;AAC3D,oBAA0B;AAC1B,8BAAiC;
|
|
4
|
+
"sourcesContent": ["import { useCallback, useContext, useMemo, useState } from 'react';\nimport { cloneDeep } from 'lodash';\nimport { DataTableContext } from '../../DataTableContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { getGridLayout, changeGridLayout, setSubColumnsGridLayout } from '../../helpers/gridLayoutHelpers.js';\n\n// if number > max => max\n// if number < min => min\n// else => number\nconst narrow = (value: number, min: number | undefined, max: number | undefined): number =>\n Math.min(Math.max(value, min ?? 30), max ?? Infinity);\n\n// Returns the delta of the keyboard event\nconst getCorrectDelta = (e: React.KeyboardEvent) => {\n let multiplier = 1;\n\n if (e.shiftKey) multiplier *= 5;\n if (e.altKey) multiplier *= 10;\n\n if (e.code === 'ArrowLeft') {\n return -multiplier;\n }\n if (e.code === 'ArrowRight') {\n return multiplier;\n }\n return 0;\n};\n\nexport const useHeaderResizer = ({\n columnId,\n innerRef,\n}: {\n columnId: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null>;\n}) => {\n const {\n visibleColumns,\n tableProps: { onColumnResize, onColumnSizeChange },\n virtualListRef,\n } = useContext(DataTableContext);\n\n const [isResizing, setIsResizing] = useState(false);\n\n const visibleColumnsCopy = useMemo(() => cloneDeep(visibleColumns), [visibleColumns]);\n\n const visibleColumnsOnGridLayout = useMemo(\n () =>\n visibleColumnsCopy.reduce((acc, cur) => {\n if (cur.columns) {\n return acc.concat(cur.columns);\n }\n return acc.concat(cur);\n }, [] as DSDataTableT.InternalColumn[]),\n [visibleColumnsCopy],\n );\n\n const realColumnIndex = useMemo(\n () => visibleColumnsOnGridLayout.findIndex((col) => col.id === columnId),\n [columnId, visibleColumnsOnGridLayout],\n );\n\n // Notifies the user of the change in the column size\n const pushColumnSizeChange = useCallback(\n (nextWidth: number) => {\n onColumnResize?.(columnId, nextWidth);\n visibleColumnsOnGridLayout[realColumnIndex].width = nextWidth;\n onColumnSizeChange(visibleColumnsCopy, columnId, nextWidth);\n },\n [columnId, onColumnResize, onColumnSizeChange, realColumnIndex, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n const onResizeStart = useCallback(() => {\n setIsResizing(true);\n }, []);\n\n const onResizeEnd = useCallback(() => {\n setIsResizing(false);\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex]);\n }, [pushColumnSizeChange, virtualListRef, realColumnIndex]);\n\n // Mouse resize\n const onResizeHandler = useCallback(\n (e: MouseEvent | TouchEvent) => {\n if (realColumnIndex == -1) return;\n\n const delta =\n ('clientX' in e ? e.clientX : e.touches[0].clientX) - (innerRef.current?.getBoundingClientRect().x ?? 0); // delta in pixels\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n\n // We will notify the user of the change in the column size only when the user releases the mouse button\n\n // To prevent text selection\n e.preventDefault();\n e.stopPropagation();\n },\n [realColumnIndex, innerRef, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n // Keyboard resize\n const handleKeyboardResize = useCallback(\n (e: React.KeyboardEvent) => {\n if (realColumnIndex == -1) return;\n\n const delta = getCorrectDelta(e);\n\n if (delta === 0) return;\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex] + delta);\n },\n [pushColumnSizeChange, realColumnIndex, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n return {\n isResizing,\n onResizeStart,\n onResizeEnd,\n onResizeHandler,\n handleKeyboardResize,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA2D;AAC3D,oBAA0B;AAC1B,8BAAiC;AAEjC,+BAAyE;AAKzE,MAAM,SAAS,CAAC,OAAe,KAAyB,QACtD,KAAK,IAAI,KAAK,IAAI,OAAO,OAAO,EAAE,GAAG,OAAO,QAAQ;AAGtD,MAAM,kBAAkB,CAAC,MAA2B;AAClD,MAAI,aAAa;AAEjB,MAAI,EAAE;AAAU,kBAAc;AAC9B,MAAI,EAAE;AAAQ,kBAAc;AAE5B,MAAI,EAAE,SAAS,aAAa;AAC1B,WAAO,CAAC;AAAA,EACV;AACA,MAAI,EAAE,SAAS,cAAc;AAC3B,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AACF,MAGM;AACJ,QAAM;AAAA,I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KAAK;AAExG,YAAM,oBAAgB,wCAAc,eAAe,OAAO,EAAE,eAAe;AAE3E,YAAM,iBAAiB;AAAA,QACrB,gBAAgB;AAAA,QAChB,2BAA2B,eAAe,EAAE;AAAA,QAC5C,2BAA2B,eAAe,EAAE;AAAA,MAC9C;AAEA,qDAAiB,eAAe,SAAS,iBAAiB,cAAc;AACxE,4DAAwB,eAAe,SAAS,kBAAkB;AAKlE,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,CAAC,iBAAiB,UAAU,gBAAgB,oBAAoB,0BAA0B;AAAA,EAC5F;AAGA,QAAM,2BAAuB;AAAA,IAC3B,CAAC,MAA2B;AAC1B,UAAI,mBAAmB;AAAI;AAE3B,YAAM,QAAQ,gBAAgB,CAAC;AAE/B,UAAI,UAAU;AAAG;AAEjB,YAAM,oBAAgB,wCAAc,eAAe,OAAO,EAAE,eAAe;AAE3E,YAAM,iBAAiB;AAAA,QACrB,gBAAgB;AAAA,QAChB,2BAA2B,eAAe,EAAE;AAAA,QAC5C,2BAA2B,eAAe,EAAE;AAAA,MAC9C;AAEA,qDAAiB,eAAe,SAAS,iBAAiB,cAAc;AACxE,4DAAwB,eAAe,SAAS,kBAAkB;AAElE,+BAAqB,wCAAc,eAAe,OAAO,EAAE,eAAe,IAAI,KAAK;AAAA,IACrF;AAAA,IACA,CAAC,sBAAsB,iBAAiB,gBAAgB,oBAAoB,0BAA0B;AAAA,EACxG;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,14 +36,32 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
38
38
|
var import_withConditionalDnDSortableContext = require("./HoC/withConditionalDnDSortableContext.js");
|
|
39
|
-
|
|
39
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
40
|
+
const GridWithCssVariable = (0, import_ds_system.styled)(import_ds_grid.Grid)`
|
|
41
|
+
${(props) => {
|
|
42
|
+
if (props.colId) {
|
|
43
|
+
return `grid-template-columns: var(--grid-layout-${props.colId});`;
|
|
44
|
+
}
|
|
45
|
+
}}
|
|
46
|
+
`;
|
|
47
|
+
const SortableGrid = (0, import_withConditionalDnDSortableContext.withConditionalDnDSortableContext)(GridWithCssVariable);
|
|
40
48
|
const SortableHeaderCell = ({
|
|
41
49
|
items,
|
|
42
50
|
isDragOverlay = false,
|
|
43
51
|
isGroup = false,
|
|
52
|
+
colId,
|
|
44
53
|
...rest
|
|
45
54
|
}) => {
|
|
46
55
|
const style = (0, import_react.useMemo)(() => isGroup ? { gridAutoFlow: "column" } : { display: "flex" }, [isGroup]);
|
|
47
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
+
SortableGrid,
|
|
58
|
+
{
|
|
59
|
+
...rest,
|
|
60
|
+
style,
|
|
61
|
+
items,
|
|
62
|
+
isDragOverlay,
|
|
63
|
+
colId: isGroup ? colId : void 0
|
|
64
|
+
}
|
|
65
|
+
);
|
|
48
66
|
};
|
|
49
67
|
//# sourceMappingURL=SortableHeaderCell.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/SortableHeaderCell.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { DSDataTableT } from '../react-desc-prop-types.js';\nimport { withConditionalDnDSortableContext } from './HoC/withConditionalDnDSortableContext.js';\n\nconst SortableGrid = withConditionalDnDSortableContext(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useMemo } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { DSDataTableT } from '../react-desc-prop-types.js';\nimport { withConditionalDnDSortableContext } from './HoC/withConditionalDnDSortableContext.js';\nimport { styled } from '@elliemae/ds-system';\n\n// TODO: @carusox remove this\n// This is the other thing that needs to be removed after implementing new structure, read more in\n// gridLayoutHelpers file.\nconst GridWithCssVariable = styled(Grid)<{ colId?: string }>`\n ${(props) => {\n if (props.colId) {\n return `grid-template-columns: var(--grid-layout-${props.colId});`;\n }\n }}\n`;\n\nconst SortableGrid = withConditionalDnDSortableContext(GridWithCssVariable);\n\nexport const SortableHeaderCell = ({\n items,\n isDragOverlay = false,\n isGroup = false,\n colId,\n ...rest\n}: {\n items: DSDataTableT.InternalColumn[];\n isDragOverlay?: boolean;\n isGroup?: boolean;\n colId?: string;\n children: JSX.Element | JSX.Element[];\n}): JSX.Element => {\n const style = useMemo(() => (isGroup ? { gridAutoFlow: 'column' } : { display: 'flex' }), [isGroup]);\n\n return (\n <SortableGrid\n {...rest}\n style={style}\n items={items}\n isDragOverlay={isDragOverlay}\n colId={isGroup ? colId : undefined}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCnB;AAnCJ,mBAA+B;AAC/B,qBAAqB;AAErB,+CAAkD;AAClD,uBAAuB;AAKvB,MAAM,0BAAsB,yBAAO,mBAAI;AAAA,IACnC,CAAC,UAAU;AACX,MAAI,MAAM,OAAO;AACf,WAAO,4CAA4C,MAAM;AAAA,EAC3D;AACF;AAAA;AAGF,MAAM,mBAAe,4EAAkC,mBAAmB;AAEnE,MAAM,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAMmB;AACjB,QAAM,YAAQ,sBAAQ,MAAO,UAAU,EAAE,cAAc,SAAS,IAAI,EAAE,SAAS,OAAO,GAAI,CAAC,OAAO,CAAC;AAEnG,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,UAAU,QAAQ;AAAA;AAAA,EAC3B;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/styled.js
CHANGED
|
@@ -230,6 +230,12 @@ const StyledResizer = (0, import_ds_system.styled)(import_ds_form_input_text.DSI
|
|
|
230
230
|
appearance: none;
|
|
231
231
|
background: transparent;
|
|
232
232
|
}
|
|
233
|
+
|
|
234
|
+
&::-moz-range-thumb {
|
|
235
|
+
appearance: none;
|
|
236
|
+
background: transparent;
|
|
237
|
+
border: none;
|
|
238
|
+
}
|
|
233
239
|
}
|
|
234
240
|
`;
|
|
235
241
|
const StyledActionCell = import_ds_system.styled.div`
|
package/dist/cjs/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styled.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport { type Theme, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { EditPencil } from '@elliemae/ds-icons';\nimport { sizeToCss, cellPadding, columnPadding } from './helpers/index.js';\nimport { ZIndexDataTable } from './configs/zIndexInternalConfig.js';\nimport { ColsLayoutStyle } from './configs/constants.js';\nimport type { DSDataTableT } from './react-desc-prop-types.js';\nimport { DSInputText } from '@elliemae/ds-form-input-text';\n\ninterface WidthAndHeight {\n width?: string | number;\n height?: string | number;\n}\n\nconst styledFocusCss = ({ theme }: { theme: Theme }, color?: string) => `\n&:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ${color ?? theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n}`;\n\nexport const StyledFocusWithin = styled(Grid)<{ hideFocus?: boolean }>`\n :focus-within {\n ${(props) => (props.hideFocus ? '' : styledFocusCss(props))}\n }\n svg {\n fill: ${(props) => props.theme.colors.brand['800']};\n }\n`;\n\nexport const StyledDataTableWrapper = styled(Grid)<WidthAndHeight>`\n width: ${(props) => sizeToCss(props.width ?? ' 100%')};\n height: ${(props) => sizeToCss(props.height ?? ' 100%')};\n`;\n\nexport const StyledDataTableContentWrapper = styled(Grid)<{ noSelectionAllowed: boolean }>`\n user-select: ${({ noSelectionAllowed }) => (noSelectionAllowed ? 'none' : 'auto')};\n width: 100%;\n`;\n\nexport const StyledTableWrapper = styled.div<WidthAndHeight>`\n display: inline-block;\n border-spacing: 0;\n z-index: 0;\n position: relative;\n width: 100%;\n height: 100%;\n`;\nexport const StyledTableContentWrapper = styled(Grid)<{ height?: string | number }>`\n position: relative;\n ${({ height = 'auto' }) => `\n height: ${sizeToCss(height) as string};\n `}\n width: var(--total-width);\n`;\n\nexport const StyledVirtualListWrapper = styled(Grid)<{ gridLayout: string[]; totalColumnsWidth: string | number }>`\n overflow: auto;\n height: 100%;\n --grid-layout: ${(props) => props.gridLayout.map((col) => `minmax(0, ${col})`).join(' ')};\n --total-width: ${(props) => sizeToCss(props.totalColumnsWidth)};\n`;\n\nexport const StyledHeadWrapper = styled(Grid)<{\n colsLayoutStyle: string;\n}>`\n position: sticky;\n top: 0;\n z-index: 4;\n background: white;\n width: 100%;\n`;\n\nexport const StyledHeadTr = styled(Grid)<{\n isExpandable: boolean;\n colsLayoutStyle: DSDataTableT.ColsLayoutStyleValues;\n}>`\n ${(props) => (props.colsLayoutStyle === ColsLayoutStyle.Auto ? 'width:100%' : '')};\n grid-template-columns: var(--grid-layout);\n border-right: 1px solid ${(props) => props.theme.colors.neutral['080']};\n border-bottom: 1px solid ${(props) => props.theme.colors.neutral['080']};\n grid-auto-flow: column;\n`;\n\nexport const StyledHeadTh = styled.div<{\n isDraggingActive?: boolean;\n column: DSDataTableT.InternalColumn;\n shouldShowDnD?: boolean;\n}>`\n min-height: 24px;\n line-height: normal;\n font-weight: 600;\n text-transform: uppercase;\n font-size: 0.923rem;\n text-align: left;\n ${columnPadding}\n color: #353c46;\n min-height: 1.84615rem;\n position: sticky;\n z-index: ${ZIndexDataTable.HEADER_ROW};\n display: flex;\n justify-content: space-between;\n box-sizing: border-box;\n outline: none;\n ${(props) =>\n props.isDraggingActive\n ? ''\n : `:hover {\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-bottom: 1px solid ${props.theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n }\n cursor: pointer;\n }`}\n\n :focus {\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ${(props) => props.theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n }\n }\n`;\n\nexport const StyledHeaderRightIconsWrapper = styled.div`\n height: 100%;\n display: flex;\n align-items: center;\n max-height: 24px;\n`;\n\nexport const StyledResizer = styled(DSInputText)`\n width: 4px;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n z-index: 1;\n\n // prevents from scrolling while dragging on touch devices\n touch-action: none;\n\n border: none;\n outline: none;\n\n &:hover,\n &:focus,\n &:focus-visible {\n border: none;\n outline: none;\n }\n\n input {\n appearance: none;\n cursor: col-resize;\n background-image: transparent;\n padding: 0;\n\n &:focus::-webkit-slider-runnable-track {\n background: transparent;\n }\n\n &:focus-visible {\n :after {\n position: absolute;\n content: ' ';\n z-index: 2;\n top: 0;\n right: 0;\n width: 8px;\n height: 100%;\n border: 2px solid brand-700;\n }\n ::-webkit-slider-runnable-track {\n background: transparent;\n }\n }\n\n &::-webkit-slider-runnable-track {\n background: transparent;\n }\n\n &::-webkit-slider-thumb {\n appearance: none;\n background: transparent;\n }\n }\n`;\n\n// CELL ***********************************************************************/\nexport const StyledActionCell = styled.div`\n position: sticky;\n display: inline-block;\n right: 0;\n /* border-bottom: 1px solid #ebedf0; */\n background: white;\n`;\n\nexport const StyledCell = styled.div`\n ${cellPadding}\n display: flex;\n align-items: center;\n width: 100%;\n position: relative;\n`;\n\nexport const StyledCellContent = styled.div`\n display: grid;\n justify-self: flex-end;\n flex: 1 1 auto;\n width: 100%;\n height: 100%;\n align-items: center;\n`;\n\nexport const StyledPencilIcon = styled(EditPencil)``;\n\nexport const StyledEditableContainer = styled(Grid)<{ shouldDisplayEditIcon?: boolean }>`\n width: 100%;\n height: 100%;\n align-items: center;\n & ${StyledPencilIcon} {\n display: ${({ shouldDisplayEditIcon }) => (shouldDisplayEditIcon ? 'block' : 'none')};\n }\n &:hover {\n ${StyledPencilIcon} {\n display: block;\n }\n }\n &:focus {\n ${styledFocusCss}\n ${StyledPencilIcon} {\n display: block;\n }\n }\n outline: none;\n`;\n\n// ROW ************************************************************************/\nexport const StyledFullsizeGrid = styled(Grid)<{ minHeight: string }>`\n position: relative;\n z-index: ${ZIndexDataTable.ROW};\n\n min-height: ${(props) => props.minHeight || '36px'};\n height: ${(props) => props.height || 'auto'};\n`;\n\nexport const GroupHeaderContainer = styled(Grid)<{ paddingLeft: string }>`\n position: relative;\n background-color: ${({ theme }) => theme.colors.brand[200]};\n align-items: center;\n padding-left: ${(props) => props.paddingLeft};\n border-top: 1px solid ${({ theme }) => theme.colors.brand[300]};\n`;\n\nexport const GroupHeaderTitle = styled.span`\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n font-size: 12px;\n color: ${(props) => props.theme.colors.neutral[700]};\n`;\n\nexport const StyledCellContainer = styled(Grid)<{\n backgroundColor?: string;\n isDragOverlay?: boolean;\n isDragging?: boolean;\n isDisabled?: boolean;\n isDropValid?: boolean;\n shouldDisplayHover?: boolean;\n isDropIndicatorPositionInside?: boolean;\n minHeight?: string;\n gridTemplateColumns?: string;\n}>`\n position: relative;\n z-index: 2;\n\n min-height: ${(props) => props.minHeight || '36px'};\n height: ${(props) => props.height || 'auto'};\n\n width: 100%;\n ${(props) => (props.isDragOverlay ? 'width: fit-content;' : '')};\n\n grid-template-columns: ${(props) =>\n props.isDragOverlay ? `minmax(0, 24px) minmax(0, auto)` : props.gridTemplateColumns ?? `var(--grid-layout)`};\n\n background-color: ${({ backgroundColor, isDragging, theme }) =>\n isDragging ? theme.colors.neutral[100] : backgroundColor || 'white'};\n\n outline: none;\n\n :focus {\n ${(props) => (props.isDragOverlay ? '' : styledFocusCss(props))}\n }\n\n ${({ isDropIndicatorPositionInside, isDropValid, theme }) => {\n if (!isDropIndicatorPositionInside) return '';\n return styledFocusCss({ theme }, isDropValid ? theme.colors.brand[700] : theme.colors.danger[900]);\n }}\n\n ${({ shouldDisplayHover, theme, isDisabled }) =>\n shouldDisplayHover && !isDisabled\n ? `:hover {\n background-color: ${theme.colors.brand[200]};\n }`\n : ''}\n\n box-shadow: 0 2px 4px 0 ${(props) => (props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent')};\n\n opacity: ${(props) => (props.isDragging ? 0.8 : 1)};\n\n ${(props) =>\n !props.selected\n ? ''\n : `\n background-color: ${props.theme.colors.brand[200]};\n border: 1px solid ${props.theme.colors.brand[500]};\n `}\n\n ${GroupHeaderTitle} {\n color: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : props.theme.colors.neutral['700'])};\n }\n color: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : '#333333')};\n\n svg {\n fill: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : props.theme.colors.brand['800'])};\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { EditPencil } from '@elliemae/ds-icons';\nimport { sizeToCss, cellPadding, columnPadding } from './helpers/index.js';\nimport { ZIndexDataTable } from './configs/zIndexInternalConfig.js';\nimport { ColsLayoutStyle } from './configs/constants.js';\nimport type { DSDataTableT } from './react-desc-prop-types.js';\nimport { DSInputText } from '@elliemae/ds-form-input-text';\n\ninterface WidthAndHeight {\n width?: string | number;\n height?: string | number;\n}\n\nconst styledFocusCss = ({ theme }: { theme: Theme }, color?: string) => `\n&:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ${color ?? theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n}`;\n\nexport const StyledFocusWithin = styled(Grid)<{ hideFocus?: boolean }>`\n :focus-within {\n ${(props) => (props.hideFocus ? '' : styledFocusCss(props))}\n }\n svg {\n fill: ${(props) => props.theme.colors.brand['800']};\n }\n`;\n\nexport const StyledDataTableWrapper = styled(Grid)<WidthAndHeight>`\n width: ${(props) => sizeToCss(props.width ?? ' 100%')};\n height: ${(props) => sizeToCss(props.height ?? ' 100%')};\n`;\n\nexport const StyledDataTableContentWrapper = styled(Grid)<{ noSelectionAllowed: boolean }>`\n user-select: ${({ noSelectionAllowed }) => (noSelectionAllowed ? 'none' : 'auto')};\n width: 100%;\n`;\n\nexport const StyledTableWrapper = styled.div<WidthAndHeight>`\n display: inline-block;\n border-spacing: 0;\n z-index: 0;\n position: relative;\n width: 100%;\n height: 100%;\n`;\nexport const StyledTableContentWrapper = styled(Grid)<{ height?: string | number }>`\n position: relative;\n ${({ height = 'auto' }) => `\n height: ${sizeToCss(height) as string};\n `}\n width: var(--total-width);\n`;\n\nexport const StyledVirtualListWrapper = styled(Grid)<{ gridLayout: string[]; totalColumnsWidth: string | number }>`\n overflow: auto;\n height: 100%;\n --grid-layout: ${(props) => props.gridLayout.map((col) => `minmax(0, ${col})`).join(' ')};\n --total-width: ${(props) => sizeToCss(props.totalColumnsWidth)};\n`;\n\nexport const StyledHeadWrapper = styled(Grid)<{\n colsLayoutStyle: string;\n}>`\n position: sticky;\n top: 0;\n z-index: 4;\n background: white;\n width: 100%;\n`;\n\nexport const StyledHeadTr = styled(Grid)<{\n isExpandable: boolean;\n colsLayoutStyle: DSDataTableT.ColsLayoutStyleValues;\n}>`\n ${(props) => (props.colsLayoutStyle === ColsLayoutStyle.Auto ? 'width:100%' : '')};\n grid-template-columns: var(--grid-layout);\n border-right: 1px solid ${(props) => props.theme.colors.neutral['080']};\n border-bottom: 1px solid ${(props) => props.theme.colors.neutral['080']};\n grid-auto-flow: column;\n`;\n\nexport const StyledHeadTh = styled.div<{\n isDraggingActive?: boolean;\n column: DSDataTableT.InternalColumn;\n shouldShowDnD?: boolean;\n}>`\n min-height: 24px;\n line-height: normal;\n font-weight: 600;\n text-transform: uppercase;\n font-size: 0.923rem;\n text-align: left;\n ${columnPadding}\n color: #353c46;\n min-height: 1.84615rem;\n position: sticky;\n z-index: ${ZIndexDataTable.HEADER_ROW};\n display: flex;\n justify-content: space-between;\n box-sizing: border-box;\n outline: none;\n ${(props) =>\n props.isDraggingActive\n ? ''\n : `:hover {\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-bottom: 1px solid ${props.theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n }\n cursor: pointer;\n }`}\n\n :focus {\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ${(props) => props.theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n }\n }\n`;\n\nexport const StyledHeaderRightIconsWrapper = styled.div`\n height: 100%;\n display: flex;\n align-items: center;\n max-height: 24px;\n`;\n\nexport const StyledResizer = styled(DSInputText)`\n width: 4px;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n z-index: 1;\n\n // prevents from scrolling while dragging on touch devices\n touch-action: none;\n\n border: none;\n outline: none;\n\n &:hover,\n &:focus,\n &:focus-visible {\n border: none;\n outline: none;\n }\n\n input {\n appearance: none;\n cursor: col-resize;\n background-image: transparent;\n padding: 0;\n\n &:focus::-webkit-slider-runnable-track {\n background: transparent;\n }\n\n &:focus-visible {\n :after {\n position: absolute;\n content: ' ';\n z-index: 2;\n top: 0;\n right: 0;\n width: 8px;\n height: 100%;\n border: 2px solid brand-700;\n }\n ::-webkit-slider-runnable-track {\n background: transparent;\n }\n }\n\n &::-webkit-slider-runnable-track {\n background: transparent;\n }\n\n &::-webkit-slider-thumb {\n appearance: none;\n background: transparent;\n }\n\n &::-moz-range-thumb {\n appearance: none;\n background: transparent;\n border: none;\n }\n }\n`;\n\n// CELL ***********************************************************************/\nexport const StyledActionCell = styled.div`\n position: sticky;\n display: inline-block;\n right: 0;\n /* border-bottom: 1px solid #ebedf0; */\n background: white;\n`;\n\nexport const StyledCell = styled.div`\n ${cellPadding}\n display: flex;\n align-items: center;\n width: 100%;\n position: relative;\n`;\n\nexport const StyledCellContent = styled.div`\n display: grid;\n justify-self: flex-end;\n flex: 1 1 auto;\n width: 100%;\n height: 100%;\n align-items: center;\n`;\n\nexport const StyledPencilIcon = styled(EditPencil)``;\n\nexport const StyledEditableContainer = styled(Grid)<{ shouldDisplayEditIcon?: boolean }>`\n width: 100%;\n height: 100%;\n align-items: center;\n & ${StyledPencilIcon} {\n display: ${({ shouldDisplayEditIcon }) => (shouldDisplayEditIcon ? 'block' : 'none')};\n }\n &:hover {\n ${StyledPencilIcon} {\n display: block;\n }\n }\n &:focus {\n ${styledFocusCss}\n ${StyledPencilIcon} {\n display: block;\n }\n }\n outline: none;\n`;\n\n// ROW ************************************************************************/\nexport const StyledFullsizeGrid = styled(Grid)<{ minHeight: string }>`\n position: relative;\n z-index: ${ZIndexDataTable.ROW};\n\n min-height: ${(props) => props.minHeight || '36px'};\n height: ${(props) => props.height || 'auto'};\n`;\n\nexport const GroupHeaderContainer = styled(Grid)<{ paddingLeft: string }>`\n position: relative;\n background-color: ${({ theme }) => theme.colors.brand[200]};\n align-items: center;\n padding-left: ${(props) => props.paddingLeft};\n border-top: 1px solid ${({ theme }) => theme.colors.brand[300]};\n`;\n\nexport const GroupHeaderTitle = styled.span`\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n font-size: 12px;\n color: ${(props) => props.theme.colors.neutral[700]};\n`;\n\nexport const StyledCellContainer = styled(Grid)<{\n backgroundColor?: string;\n isDragOverlay?: boolean;\n isDragging?: boolean;\n isDisabled?: boolean;\n isDropValid?: boolean;\n shouldDisplayHover?: boolean;\n isDropIndicatorPositionInside?: boolean;\n minHeight?: string;\n gridTemplateColumns?: string;\n}>`\n position: relative;\n z-index: 2;\n\n min-height: ${(props) => props.minHeight || '36px'};\n height: ${(props) => props.height || 'auto'};\n\n width: 100%;\n ${(props) => (props.isDragOverlay ? 'width: fit-content;' : '')};\n\n grid-template-columns: ${(props) =>\n props.isDragOverlay ? `minmax(0, 24px) minmax(0, auto)` : props.gridTemplateColumns ?? `var(--grid-layout)`};\n\n background-color: ${({ backgroundColor, isDragging, theme }) =>\n isDragging ? theme.colors.neutral[100] : backgroundColor || 'white'};\n\n outline: none;\n\n :focus {\n ${(props) => (props.isDragOverlay ? '' : styledFocusCss(props))}\n }\n\n ${({ isDropIndicatorPositionInside, isDropValid, theme }) => {\n if (!isDropIndicatorPositionInside) return '';\n return styledFocusCss({ theme }, isDropValid ? theme.colors.brand[700] : theme.colors.danger[900]);\n }}\n\n ${({ shouldDisplayHover, theme, isDisabled }) =>\n shouldDisplayHover && !isDisabled\n ? `:hover {\n background-color: ${theme.colors.brand[200]};\n }`\n : ''}\n\n box-shadow: 0 2px 4px 0 ${(props) => (props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent')};\n\n opacity: ${(props) => (props.isDragging ? 0.8 : 1)};\n\n ${(props) =>\n !props.selected\n ? ''\n : `\n background-color: ${props.theme.colors.brand[200]};\n border: 1px solid ${props.theme.colors.brand[500]};\n `}\n\n ${GroupHeaderTitle} {\n color: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : props.theme.colors.neutral['700'])};\n }\n color: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : '#333333')};\n\n svg {\n fill: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : props.theme.colors.brand['800'])};\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAAmC;AACnC,qBAAqB;AACrB,sBAA2B;AAC3B,qBAAsD;AACtD,kCAAgC;AAChC,uBAAgC;AAEhC,gCAA4B;AAO5B,MAAM,iBAAiB,CAAC,EAAE,MAAM,GAAqB,UAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBASlD,SAAS,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA,aAExC,4CAAgB;AAAA;AAGtB,MAAM,wBAAoB,yBAAO,mBAAI;AAAA;AAAA,MAEtC,CAAC,UAAW,MAAM,YAAY,KAAK,eAAe,KAAK;AAAA;AAAA;AAAA,YAGjD,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM,KAAK;AAAA;AAAA;AAI9C,MAAM,6BAAyB,yBAAO,mBAAI;AAAA,WACtC,CAAC,cAAU,0BAAU,MAAM,SAAS,OAAO;AAAA,YAC1C,CAAC,cAAU,0BAAU,MAAM,UAAU,OAAO;AAAA;AAGjD,MAAM,oCAAgC,yBAAO,mBAAI;AAAA,iBACvC,CAAC,EAAE,mBAAmB,M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,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA;AAAA,WAErG,CAAC,UAAW,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI;AAAA;AAAA;AAAA,YAGlE,CAAC,UAAW,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,MAAM,OAAO,MAAM,KAAK;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const getGridLayout = (wrapper) => {
|
|
3
|
+
if (!wrapper)
|
|
4
|
+
return [];
|
|
5
|
+
return getComputedStyle(wrapper).getPropertyValue("--grid-layout").split("minmax(0,").slice(1).map((str) => str.replace("px) ", "").replace("px)", "")).map((str) => Number.parseInt(str, 10));
|
|
6
|
+
};
|
|
7
|
+
const changeGridLayout = (wrapper, colIndex, newWidth) => {
|
|
8
|
+
if (!wrapper)
|
|
9
|
+
return;
|
|
10
|
+
const cols = getGridLayout(wrapper);
|
|
11
|
+
cols[colIndex] = newWidth;
|
|
12
|
+
wrapper.style.setProperty("--grid-layout", cols.map((col) => `minmax(0, ${col}px)`).join(" "));
|
|
13
|
+
wrapper.style.setProperty("--total-width", `${cols.reduce((acc, col) => acc + col, 0)}px`);
|
|
14
|
+
};
|
|
15
|
+
const setSubColumnsGridLayout = (wrapper, columns) => {
|
|
16
|
+
if (!wrapper)
|
|
17
|
+
return;
|
|
18
|
+
const cols = getGridLayout(wrapper);
|
|
19
|
+
let prevIndex = 0;
|
|
20
|
+
const variables = columns.reduce((acc, cur) => {
|
|
21
|
+
const count = cur.columns ? cur.columns.length : 1;
|
|
22
|
+
acc.push({
|
|
23
|
+
cols: cols.slice(prevIndex, prevIndex + count),
|
|
24
|
+
id: cur.id
|
|
25
|
+
});
|
|
26
|
+
prevIndex += count;
|
|
27
|
+
return acc;
|
|
28
|
+
}, []);
|
|
29
|
+
variables.forEach((variable) => {
|
|
30
|
+
wrapper.style.setProperty(
|
|
31
|
+
`--grid-layout-${variable.id}`,
|
|
32
|
+
variable.cols.map((col) => `minmax(0, ${col}px)`).join(" ")
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
changeGridLayout,
|
|
38
|
+
getGridLayout,
|
|
39
|
+
setSubColumnsGridLayout
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=gridLayoutHelpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/helpers/gridLayoutHelpers.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSDataTableT } from '../react-desc-prop-types.js';\n\n// Returns the current grid layout of the table (by reading the CSS variable --grid-layout)\nexport const getGridLayout = (wrapper: HTMLDivElement | null): number[] => {\n if (!wrapper) return [];\n return getComputedStyle(wrapper)\n .getPropertyValue('--grid-layout')\n .split('minmax(0,')\n .slice(1)\n .map((str) => str.replace('px) ', '').replace('px)', ''))\n .map((str) => Number.parseInt(str, 10));\n};\n\n// Changes the grid layout of the table (by changing the CSS variable --grid-layout)\nexport const changeGridLayout = (wrapper: HTMLDivElement | null, colIndex: number, newWidth: number) => {\n if (!wrapper) return;\n const cols = getGridLayout(wrapper);\n cols[colIndex] = newWidth;\n wrapper.style.setProperty('--grid-layout', cols.map((col) => `minmax(0, ${col}px)`).join(' '));\n wrapper.style.setProperty('--total-width', `${cols.reduce((acc, col) => acc + col, 0)}px`);\n};\n\n// TODO: @carusox remove this\n// Since the structure of the column grouping is not ideal (with this I mean that the columns are nested in the HTML DOM),\n// we need to create variables to keep track of the sub-columns layout for each different group\n// When we go ahead and implement the new behavior (also present nowadays on the specs, we should be removing this code)\nexport const setSubColumnsGridLayout = (wrapper: HTMLDivElement | null, columns: DSDataTableT.InternalColumn[]) => {\n if (!wrapper) return;\n\n const cols = getGridLayout(wrapper);\n\n let prevIndex = 0;\n\n const variables = columns.reduce((acc, cur) => {\n const count = cur.columns ? cur.columns.length : 1;\n acc.push({\n cols: cols.slice(prevIndex, prevIndex + count),\n id: cur.id,\n });\n prevIndex += count;\n return acc;\n }, [] as { cols: number[]; id: string }[]);\n\n variables.forEach((variable) => {\n wrapper.style.setProperty(\n `--grid-layout-${variable.id}`,\n variable.cols.map((col) => `minmax(0, ${col}px)`).join(' '),\n );\n });\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGhB,MAAM,gBAAgB,CAAC,YAA6C;AACzE,MAAI,CAAC;AAAS,WAAO,CAAC;AACtB,SAAO,iBAAiB,OAAO,EAC5B,iBAAiB,eAAe,EAChC,MAAM,WAAW,EACjB,MAAM,CAAC,EACP,IAAI,CAAC,QAAQ,IAAI,QAAQ,QAAQ,EAAE,EAAE,QAAQ,OAAO,EAAE,CAAC,EACvD,IAAI,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,CAAC;AAC1C;AAGO,MAAM,mBAAmB,CAAC,SAAgC,UAAkB,aAAqB;AACtG,MAAI,CAAC;AAAS;AACd,QAAM,OAAO,cAAc,OAAO;AAClC,OAAK,QAAQ,IAAI;AACjB,UAAQ,MAAM,YAAY,iBAAiB,KAAK,IAAI,CAAC,QAAQ,aAAa,QAAQ,EAAE,KAAK,GAAG,CAAC;AAC7F,UAAQ,MAAM,YAAY,iBAAiB,GAAG,KAAK,OAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,CAAC,KAAK;AAC3F;AAMO,MAAM,0BAA0B,CAAC,SAAgC,YAA2C;AACjH,MAAI,CAAC;AAAS;AAEd,QAAM,OAAO,cAAc,OAAO;AAElC,MAAI,YAAY;AAEhB,QAAM,YAAY,QAAQ,OAAO,CAAC,KAAK,QAAQ;AAC7C,UAAM,QAAQ,IAAI,UAAU,IAAI,QAAQ,SAAS;AACjD,QAAI,KAAK;AAAA,MACP,MAAM,KAAK,MAAM,WAAW,YAAY,KAAK;AAAA,MAC7C,IAAI,IAAI;AAAA,IACV,CAAC;AACD,iBAAa;AACb,WAAO;AAAA,EACT,GAAG,CAAC,CAAqC;AAEzC,YAAU,QAAQ,CAAC,aAAa;AAC9B,YAAQ,MAAM;AAAA,MACZ,iBAAiB,SAAS;AAAA,MAC1B,SAAS,KAAK,IAAI,CAAC,QAAQ,aAAa,QAAQ,EAAE,KAAK,GAAG;AAAA,IAC5D;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -50,7 +50,7 @@ const HeaderCellGroupComp = ({
|
|
|
50
50
|
shouldDropOneLevel: isMultiLevel && level === 0 && !children,
|
|
51
51
|
children: [
|
|
52
52
|
/* @__PURE__ */ jsx(HeaderCell, { column: header, isDragOverlay, colSpan }),
|
|
53
|
-
!!children?.length && !isDragOverlay && /* @__PURE__ */ jsx(SortableHeaderCell, { isGroup: true, items: children, isDragOverlay, children: children.map((h, index) => /* @__PURE__ */ jsx(
|
|
53
|
+
!!children?.length && !isDragOverlay && /* @__PURE__ */ jsx(SortableHeaderCell, { isGroup: true, items: children, isDragOverlay, colId: header.id, children: children.map((h, index) => /* @__PURE__ */ jsx(
|
|
54
54
|
ChildGroup,
|
|
55
55
|
{
|
|
56
56
|
header: h,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Headers/HeaderCellGroup.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { styled } from '@elliemae/ds-system';\nimport { HeaderCell } from './HeaderCell.js';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport { withDnDSortableColumnContext } from '../internal.js';\nimport { DropIndicator } from '../DropIndicator.js';\nimport { SortableHeaderCell } from '../SortableHeaderCell.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { EmptyChildrenGroup } from './EmptyChildrenGroup.js';\nimport { DATA_TESTID } from '../../configs/index.js';\nimport { DataTableContext } from '../../DataTableContext.js';\n\nconst StyledWrapper = styled(Grid)<{\n shouldDropOneLevel: boolean;\n isDragOverlay?: boolean;\n isDragging?: boolean;\n isFirst?: boolean;\n gridColumn: string;\n}>`\n position: relative;\n ${({ shouldDropOneLevel, isDragOverlay }) => (shouldDropOneLevel && !isDragOverlay ? `top: 50%; height: 50%;` : '')}\n width: ${(props) => (props.isDragOverlay ? 'fit-content' : '100%')};\n grid-column: ${(props) => props.gridColumn};\n background: ${(props) => (props.isDragging ? props.theme.colors.neutral['080'] : 'white')};\n opacity: ${(props) => (props.isDragging ? 0.8 : 1)};\n box-shadow: 0 2px 4px 0 ${(props) => (props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent')};\n border-left: ${({ isFirst }) => (isFirst ? '0px' : '1px')} solid ${(props) => props.theme.colors.neutral['080']};\n`;\n\ninterface HeaderCellGroupCompProps {\n header: DSDataTableT.InternalColumn;\n isDragOverlay?: boolean;\n isDraggingParent?: boolean;\n isLast?: boolean;\n isFirst?: boolean;\n level?: number;\n}\n\nconst HeaderCellGroupComp: React.ComponentType<HeaderCellGroupCompProps> = ({\n header,\n isDragOverlay,\n isDraggingParent,\n isLast,\n isFirst,\n level = 0,\n}) => {\n const { visibleColumns } = useContext(DataTableContext);\n const { draggableProps } = useContext(SortableItemContext);\n\n const isMultiLevel = visibleColumns.some((col) => !!col.columns);\n\n const children = header.columns;\n\n const isDragging = (draggableProps && draggableProps.isDragging) || isDraggingParent;\n const dropIndicatorPosition =\n draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;\n\n const ChildGroup = isDragOverlay ? HeaderCellGroup : HeaderCellGroupSortable;\n\n const colSpan = children?.length ?? 1;\n return (\n <StyledWrapper\n ref={draggableProps ? draggableProps.setNodeRef : null}\n gridColumn={isDragOverlay ? 'auto' : `span ${colSpan}`}\n isDragOverlay={isDragOverlay}\n isDragging={isDragging}\n cols={['auto']}\n data-testid={isDragOverlay ? DATA_TESTID.DATA_TABLE_COLUMN_DRAG_OVERLAY : undefined}\n isFirst={isFirst}\n shouldDropOneLevel={isMultiLevel && level === 0 && !children}\n >\n <HeaderCell column={header} isDragOverlay={isDragOverlay} colSpan={colSpan} />\n {!!children?.length && !isDragOverlay && (\n <SortableHeaderCell isGroup items={children} isDragOverlay={isDragOverlay}>\n {children.map((h, index) => (\n <ChildGroup\n key={h.id}\n header={h}\n isDragOverlay={isDragOverlay}\n isDraggingParent={isDragging}\n isLast={index === children.length - 1}\n isFirst={index === 0}\n level={level + 1}\n />\n ))}\n </SortableHeaderCell>\n )}\n {children?.length && isDragOverlay && <EmptyChildrenGroup />}\n <DropIndicator vertical dropIndicatorPosition={dropIndicatorPosition} isLast={isLast && isDragging} isDropValid />\n </StyledWrapper>\n );\n};\n\n// We need to declare this because we MUST avoid the useSortable call in the recursive calls of the function\n\nexport const HeaderCellGroup = HeaderCellGroupComp;\n\nexport const HeaderCellGroupSortable = withDnDSortableColumnContext(HeaderCellGroupComp);\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACgEnB,SAUE,KAVF;AA9DJ,SAAgB,kBAAkB;AAClC,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,oCAAoC;AAC7C,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAEnC,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AAEjC,MAAM,gBAAgB,OAAO,IAAI;AAAA;AAAA,IAQ7B,CAAC,EAAE,oBAAoB,cAAc,MAAO,sBAAsB,CAAC,gBAAgB,2B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cesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { styled } from '@elliemae/ds-system';\nimport { HeaderCell } from './HeaderCell.js';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport { withDnDSortableColumnContext } from '../internal.js';\nimport { DropIndicator } from '../DropIndicator.js';\nimport { SortableHeaderCell } from '../SortableHeaderCell.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { EmptyChildrenGroup } from './EmptyChildrenGroup.js';\nimport { DATA_TESTID } from '../../configs/index.js';\nimport { DataTableContext } from '../../DataTableContext.js';\n\nconst StyledWrapper = styled(Grid)<{\n shouldDropOneLevel: boolean;\n isDragOverlay?: boolean;\n isDragging?: boolean;\n isFirst?: boolean;\n gridColumn: string;\n}>`\n position: relative;\n ${({ shouldDropOneLevel, isDragOverlay }) => (shouldDropOneLevel && !isDragOverlay ? `top: 50%; height: 50%;` : '')}\n width: ${(props) => (props.isDragOverlay ? 'fit-content' : '100%')};\n grid-column: ${(props) => props.gridColumn};\n background: ${(props) => (props.isDragging ? props.theme.colors.neutral['080'] : 'white')};\n opacity: ${(props) => (props.isDragging ? 0.8 : 1)};\n box-shadow: 0 2px 4px 0 ${(props) => (props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent')};\n border-left: ${({ isFirst }) => (isFirst ? '0px' : '1px')} solid ${(props) => props.theme.colors.neutral['080']};\n`;\n\ninterface HeaderCellGroupCompProps {\n header: DSDataTableT.InternalColumn;\n isDragOverlay?: boolean;\n isDraggingParent?: boolean;\n isLast?: boolean;\n isFirst?: boolean;\n level?: number;\n}\n\nconst HeaderCellGroupComp: React.ComponentType<HeaderCellGroupCompProps> = ({\n header,\n isDragOverlay,\n isDraggingParent,\n isLast,\n isFirst,\n level = 0,\n}) => {\n const { visibleColumns } = useContext(DataTableContext);\n const { draggableProps } = useContext(SortableItemContext);\n\n const isMultiLevel = visibleColumns.some((col) => !!col.columns);\n\n const children = header.columns;\n\n const isDragging = (draggableProps && draggableProps.isDragging) || isDraggingParent;\n const dropIndicatorPosition =\n draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;\n\n const ChildGroup = isDragOverlay ? HeaderCellGroup : HeaderCellGroupSortable;\n\n const colSpan = children?.length ?? 1;\n return (\n <StyledWrapper\n ref={draggableProps ? draggableProps.setNodeRef : null}\n gridColumn={isDragOverlay ? 'auto' : `span ${colSpan}`}\n isDragOverlay={isDragOverlay}\n isDragging={isDragging}\n cols={['auto']}\n data-testid={isDragOverlay ? DATA_TESTID.DATA_TABLE_COLUMN_DRAG_OVERLAY : undefined}\n isFirst={isFirst}\n shouldDropOneLevel={isMultiLevel && level === 0 && !children}\n >\n <HeaderCell column={header} isDragOverlay={isDragOverlay} colSpan={colSpan} />\n {!!children?.length && !isDragOverlay && (\n <SortableHeaderCell isGroup items={children} isDragOverlay={isDragOverlay} colId={header.id}>\n {children.map((h, index) => (\n <ChildGroup\n key={h.id}\n header={h}\n isDragOverlay={isDragOverlay}\n isDraggingParent={isDragging}\n isLast={index === children.length - 1}\n isFirst={index === 0}\n level={level + 1}\n />\n ))}\n </SortableHeaderCell>\n )}\n {children?.length && isDragOverlay && <EmptyChildrenGroup />}\n <DropIndicator vertical dropIndicatorPosition={dropIndicatorPosition} isLast={isLast && isDragging} isDropValid />\n </StyledWrapper>\n );\n};\n\n// We need to declare this because we MUST avoid the useSortable call in the recursive calls of the function\n\nexport const HeaderCellGroup = HeaderCellGroupComp;\n\nexport const HeaderCellGroupSortable = withDnDSortableColumnContext(HeaderCellGroupComp);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACgEnB,SAUE,KAVF;AA9DJ,SAAgB,kBAAkB;AAClC,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,oCA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A,MAC1E;AAAA,MACA,oBAAoB,gBAAgB,UAAU,KAAK,CAAC;AAAA,MAEpD;AAAA,4BAAC,cAAW,QAAQ,QAAQ,eAA8B,SAAkB;AAAA,QAC3E,CAAC,CAAC,UAAU,UAAU,CAAC,iBACtB,oBAAC,sBAAmB,SAAO,MAAC,OAAO,UAAU,eAA8B,OAAO,OAAO,IACtF,mBAAS,IAAI,CAAC,GAAG,UAChB;AAAA,UAAC;AAAA;AAAA,YAEC,QAAQ;AAAA,YACR;AAAA,YACA,kBAAkB;AAAA,YAClB,QAAQ,UAAU,SAAS,SAAS;AAAA,YACpC,SAAS,UAAU;AAAA,YACnB,OAAO,QAAQ;AAAA;AAAA,UANV,EAAE;AAAA,QAOT,CACD,GACH;AAAA,QAED,UAAU,UAAU,iBAAiB,oBAAC,sBAAmB;AAAA,QAC1D,oBAAC,iBAAc,UAAQ,MAAC,uBAA8C,QAAQ,UAAU,YAAY,aAAW,MAAC;AAAA;AAAA;AAAA,EAClH;AAEJ;AAIO,MAAM,kBAAkB;AAExB,MAAM,0BAA0B,6BAA6B,mBAAmB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,20 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import { useCallback, useContext, useMemo, useState } from "react";
|
|
3
3
|
import { cloneDeep } from "lodash";
|
|
4
4
|
import { DataTableContext } from "../../DataTableContext.js";
|
|
5
|
+
import { getGridLayout, changeGridLayout, setSubColumnsGridLayout } from "../../helpers/gridLayoutHelpers.js";
|
|
5
6
|
const narrow = (value, min, max) => Math.min(Math.max(value, min ?? 30), max ?? Infinity);
|
|
6
|
-
const getGridLayout = (wrapper) => {
|
|
7
|
-
if (!wrapper)
|
|
8
|
-
return [];
|
|
9
|
-
return getComputedStyle(wrapper).getPropertyValue("--grid-layout").split("minmax(0,").slice(1).map((str) => str.replace("px) ", "").replace("px)", "")).map((str) => Number.parseInt(str, 10));
|
|
10
|
-
};
|
|
11
|
-
const changeGridLayout = (wrapper, colIndex, newWidth) => {
|
|
12
|
-
if (!wrapper)
|
|
13
|
-
return;
|
|
14
|
-
const cols = getGridLayout(wrapper);
|
|
15
|
-
cols[colIndex] = newWidth;
|
|
16
|
-
wrapper.style.setProperty("--grid-layout", cols.map((col) => `minmax(0, ${col}px)`).join(" "));
|
|
17
|
-
wrapper.style.setProperty("--total-width", `${cols.reduce((acc, col) => acc + col, 0)}px`);
|
|
18
|
-
};
|
|
19
7
|
const getCorrectDelta = (e) => {
|
|
20
8
|
let multiplier = 1;
|
|
21
9
|
if (e.shiftKey)
|
|
@@ -57,10 +45,10 @@ const useHeaderResizer = ({
|
|
|
57
45
|
const pushColumnSizeChange = useCallback(
|
|
58
46
|
(nextWidth) => {
|
|
59
47
|
onColumnResize?.(columnId, nextWidth);
|
|
60
|
-
|
|
48
|
+
visibleColumnsOnGridLayout[realColumnIndex].width = nextWidth;
|
|
61
49
|
onColumnSizeChange(visibleColumnsCopy, columnId, nextWidth);
|
|
62
50
|
},
|
|
63
|
-
[columnId, onColumnResize, onColumnSizeChange, realColumnIndex, visibleColumnsCopy]
|
|
51
|
+
[columnId, onColumnResize, onColumnSizeChange, realColumnIndex, visibleColumnsCopy, visibleColumnsOnGridLayout]
|
|
64
52
|
);
|
|
65
53
|
const onResizeStart = useCallback(() => {
|
|
66
54
|
setIsResizing(true);
|
|
@@ -77,14 +65,15 @@ const useHeaderResizer = ({
|
|
|
77
65
|
const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];
|
|
78
66
|
const widthWithDelta = narrow(
|
|
79
67
|
originalWidth + delta,
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
visibleColumnsOnGridLayout[realColumnIndex].minWidth,
|
|
69
|
+
visibleColumnsOnGridLayout[realColumnIndex].maxWidth
|
|
82
70
|
);
|
|
83
71
|
changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);
|
|
72
|
+
setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);
|
|
84
73
|
e.preventDefault();
|
|
85
74
|
e.stopPropagation();
|
|
86
75
|
},
|
|
87
|
-
[realColumnIndex,
|
|
76
|
+
[realColumnIndex, innerRef, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout]
|
|
88
77
|
);
|
|
89
78
|
const handleKeyboardResize = useCallback(
|
|
90
79
|
(e) => {
|
|
@@ -96,13 +85,14 @@ const useHeaderResizer = ({
|
|
|
96
85
|
const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];
|
|
97
86
|
const widthWithDelta = narrow(
|
|
98
87
|
originalWidth + delta,
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
visibleColumnsOnGridLayout[realColumnIndex].minWidth,
|
|
89
|
+
visibleColumnsOnGridLayout[realColumnIndex].maxWidth
|
|
101
90
|
);
|
|
102
91
|
changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);
|
|
92
|
+
setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);
|
|
103
93
|
pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex] + delta);
|
|
104
94
|
},
|
|
105
|
-
[pushColumnSizeChange, realColumnIndex, virtualListRef, visibleColumnsCopy]
|
|
95
|
+
[pushColumnSizeChange, realColumnIndex, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout]
|
|
106
96
|
);
|
|
107
97
|
return {
|
|
108
98
|
isResizing,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Headers/useHeaderResizer.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useContext, useMemo, useState } from 'react';\nimport { cloneDeep } from 'lodash';\nimport { DataTableContext } from '../../DataTableContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\n\n// if number > max => max\n// if number < min => min\n// else => number\nconst narrow = (value: number, min: number | undefined, max: number | undefined): number =>\n Math.min(Math.max(value, min ?? 30), max ?? Infinity);\n\n// Returns the
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,YAAY,SAAS,gBAAgB;AAC3D,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useContext, useMemo, useState } from 'react';\nimport { cloneDeep } from 'lodash';\nimport { DataTableContext } from '../../DataTableContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { getGridLayout, changeGridLayout, setSubColumnsGridLayout } from '../../helpers/gridLayoutHelpers.js';\n\n// if number > max => max\n// if number < min => min\n// else => number\nconst narrow = (value: number, min: number | undefined, max: number | undefined): number =>\n Math.min(Math.max(value, min ?? 30), max ?? Infinity);\n\n// Returns the delta of the keyboard event\nconst getCorrectDelta = (e: React.KeyboardEvent) => {\n let multiplier = 1;\n\n if (e.shiftKey) multiplier *= 5;\n if (e.altKey) multiplier *= 10;\n\n if (e.code === 'ArrowLeft') {\n return -multiplier;\n }\n if (e.code === 'ArrowRight') {\n return multiplier;\n }\n return 0;\n};\n\nexport const useHeaderResizer = ({\n columnId,\n innerRef,\n}: {\n columnId: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null>;\n}) => {\n const {\n visibleColumns,\n tableProps: { onColumnResize, onColumnSizeChange },\n virtualListRef,\n } = useContext(DataTableContext);\n\n const [isResizing, setIsResizing] = useState(false);\n\n const visibleColumnsCopy = useMemo(() => cloneDeep(visibleColumns), [visibleColumns]);\n\n const visibleColumnsOnGridLayout = useMemo(\n () =>\n visibleColumnsCopy.reduce((acc, cur) => {\n if (cur.columns) {\n return acc.concat(cur.columns);\n }\n return acc.concat(cur);\n }, [] as DSDataTableT.InternalColumn[]),\n [visibleColumnsCopy],\n );\n\n const realColumnIndex = useMemo(\n () => visibleColumnsOnGridLayout.findIndex((col) => col.id === columnId),\n [columnId, visibleColumnsOnGridLayout],\n );\n\n // Notifies the user of the change in the column size\n const pushColumnSizeChange = useCallback(\n (nextWidth: number) => {\n onColumnResize?.(columnId, nextWidth);\n visibleColumnsOnGridLayout[realColumnIndex].width = nextWidth;\n onColumnSizeChange(visibleColumnsCopy, columnId, nextWidth);\n },\n [columnId, onColumnResize, onColumnSizeChange, realColumnIndex, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n const onResizeStart = useCallback(() => {\n setIsResizing(true);\n }, []);\n\n const onResizeEnd = useCallback(() => {\n setIsResizing(false);\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex]);\n }, [pushColumnSizeChange, virtualListRef, realColumnIndex]);\n\n // Mouse resize\n const onResizeHandler = useCallback(\n (e: MouseEvent | TouchEvent) => {\n if (realColumnIndex == -1) return;\n\n const delta =\n ('clientX' in e ? e.clientX : e.touches[0].clientX) - (innerRef.current?.getBoundingClientRect().x ?? 0); // delta in pixels\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n\n // We will notify the user of the change in the column size only when the user releases the mouse button\n\n // To prevent text selection\n e.preventDefault();\n e.stopPropagation();\n },\n [realColumnIndex, innerRef, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n // Keyboard resize\n const handleKeyboardResize = useCallback(\n (e: React.KeyboardEvent) => {\n if (realColumnIndex == -1) return;\n\n const delta = getCorrectDelta(e);\n\n if (delta === 0) return;\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex] + delta);\n },\n [pushColumnSizeChange, realColumnIndex, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n return {\n isResizing,\n onResizeStart,\n onResizeEnd,\n onResizeHandler,\n handleKeyboardResize,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,YAAY,SAAS,gBAAgB;AAC3D,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AAEjC,SAAS,eAAe,kBAAkB,+BAA+B;AAKzE,MAAM,SAAS,CAAC,OAAe,KAAyB,QACtD,KAAK,IAAI,KAAK,IAAI,OAAO,OAAO,EAAE,GAAG,OAAO,QAAQ;AAGtD,MAAM,kBAAkB,CAAC,MAA2B;AAClD,MAAI,aAAa;AAEjB,MAAI,EAAE;AAAU,kBAAc;AAC9B,MAAI,EAAE;AAAQ,kBAAc;AAE5B,MAAI,EAAE,SAAS,aAAa;AAC1B,WAAO,CAAC;AAAA,EACV;AACA,MAAI,EAAE,SAAS,cAAc;AAC3B,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AACF,MAGM;AACJ,QAAM;AAAA,IACJ;AAAA,IACA,YAAY,EAAE,gBAAgB,mBAAmB;AAAA,IACjD;AAAA,EACF,IAAI,WAAW,gBAAgB;AAE/B,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,qBAAqB,QAAQ,MAAM,UAAU,cAAc,GAAG,CAAC,cAAc,CAAC;AAEpF,QAAM,6BAA6B;AAAA,IACjC,MACE,mBAAmB,OAAO,CAAC,KAAK,QAAQ;AACtC,UAAI,IAAI,SAAS;AACf,eAAO,IAAI,OAAO,IAAI,OAAO;AAAA,MAC/B;AACA,aAAO,IAAI,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GA,QAAM,uBAAuB;AAAA,IAC3B,CAAC,MAA2B;AAC1B,UAAI,mBAAmB;AAAI;AAE3B,YAAM,QAAQ,gBAAgB,CAAC;AAE/B,UAAI,UAAU;AAAG;AAEjB,YAAM,gBAAgB,cAAc,eAAe,OAAO,EAAE,eAAe;AAE3E,YAAM,iBAAiB;AAAA,QACrB,gBAAgB;AAAA,QAChB,2BAA2B,eAAe,EAAE;AAAA,QAC5C,2BAA2B,eAAe,EAAE;AAAA,MAC9C;AAEA,uBAAiB,eAAe,SAAS,iBAAiB,cAAc;AACxE,8BAAwB,eAAe,SAAS,kBAAkB;AAElE,2BAAqB,cAAc,eAAe,OAAO,EAAE,eAAe,IAAI,KAAK;AAAA,IACrF;AAAA,IACA,CAAC,sBAAsB,iBAAiB,gBAAgB,oBAAoB,0BAA0B;AAAA,EACxG;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,15 +3,33 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { Grid } from "@elliemae/ds-grid";
|
|
5
5
|
import { withConditionalDnDSortableContext } from "./HoC/withConditionalDnDSortableContext.js";
|
|
6
|
-
|
|
6
|
+
import { styled } from "@elliemae/ds-system";
|
|
7
|
+
const GridWithCssVariable = styled(Grid)`
|
|
8
|
+
${(props) => {
|
|
9
|
+
if (props.colId) {
|
|
10
|
+
return `grid-template-columns: var(--grid-layout-${props.colId});`;
|
|
11
|
+
}
|
|
12
|
+
}}
|
|
13
|
+
`;
|
|
14
|
+
const SortableGrid = withConditionalDnDSortableContext(GridWithCssVariable);
|
|
7
15
|
const SortableHeaderCell = ({
|
|
8
16
|
items,
|
|
9
17
|
isDragOverlay = false,
|
|
10
18
|
isGroup = false,
|
|
19
|
+
colId,
|
|
11
20
|
...rest
|
|
12
21
|
}) => {
|
|
13
22
|
const style = useMemo(() => isGroup ? { gridAutoFlow: "column" } : { display: "flex" }, [isGroup]);
|
|
14
|
-
return /* @__PURE__ */ jsx(
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
SortableGrid,
|
|
25
|
+
{
|
|
26
|
+
...rest,
|
|
27
|
+
style,
|
|
28
|
+
items,
|
|
29
|
+
isDragOverlay,
|
|
30
|
+
colId: isGroup ? colId : void 0
|
|
31
|
+
}
|
|
32
|
+
);
|
|
15
33
|
};
|
|
16
34
|
export {
|
|
17
35
|
SortableHeaderCell
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/SortableHeaderCell.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { DSDataTableT } from '../react-desc-prop-types.js';\nimport { withConditionalDnDSortableContext } from './HoC/withConditionalDnDSortableContext.js';\n\nconst SortableGrid = withConditionalDnDSortableContext(
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { DSDataTableT } from '../react-desc-prop-types.js';\nimport { withConditionalDnDSortableContext } from './HoC/withConditionalDnDSortableContext.js';\nimport { styled } from '@elliemae/ds-system';\n\n// TODO: @carusox remove this\n// This is the other thing that needs to be removed after implementing new structure, read more in\n// gridLayoutHelpers file.\nconst GridWithCssVariable = styled(Grid)<{ colId?: string }>`\n ${(props) => {\n if (props.colId) {\n return `grid-template-columns: var(--grid-layout-${props.colId});`;\n }\n }}\n`;\n\nconst SortableGrid = withConditionalDnDSortableContext(GridWithCssVariable);\n\nexport const SortableHeaderCell = ({\n items,\n isDragOverlay = false,\n isGroup = false,\n colId,\n ...rest\n}: {\n items: DSDataTableT.InternalColumn[];\n isDragOverlay?: boolean;\n isGroup?: boolean;\n colId?: string;\n children: JSX.Element | JSX.Element[];\n}): JSX.Element => {\n const style = useMemo(() => (isGroup ? { gridAutoFlow: 'column' } : { display: 'flex' }), [isGroup]);\n\n return (\n <SortableGrid\n {...rest}\n style={style}\n items={items}\n isDragOverlay={isDragOverlay}\n colId={isGroup ? colId : undefined}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACmCnB;AAnCJ,SAAgB,eAAe;AAC/B,SAAS,YAAY;AAErB,SAAS,yCAAyC;AAClD,SAAS,cAAc;AAKvB,MAAM,sBAAsB,OAAO,IAAI;AAAA,IACnC,CAAC,UAAU;AACX,MAAI,MAAM,OAAO;AACf,WAAO,4CAA4C,MAAM;AAAA,EAC3D;AACF;AAAA;AAGF,MAAM,eAAe,kCAAkC,mBAAmB;AAEnE,MAAM,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAMmB;AACjB,QAAM,QAAQ,QAAQ,MAAO,UAAU,EAAE,cAAc,SAAS,IAAI,EAAE,SAAS,OAAO,GAAI,CAAC,OAAO,CAAC;AAEnG,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,UAAU,QAAQ;AAAA;AAAA,EAC3B;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styled.js
CHANGED
|
@@ -178,6 +178,12 @@ const StyledResizer = styled(DSInputText)`
|
|
|
178
178
|
appearance: none;
|
|
179
179
|
background: transparent;
|
|
180
180
|
}
|
|
181
|
+
|
|
182
|
+
&::-moz-range-thumb {
|
|
183
|
+
appearance: none;
|
|
184
|
+
background: transparent;
|
|
185
|
+
border: none;
|
|
186
|
+
}
|
|
181
187
|
}
|
|
182
188
|
`;
|
|
183
189
|
const StyledActionCell = styled.div`
|
package/dist/esm/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { type Theme, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { EditPencil } from '@elliemae/ds-icons';\nimport { sizeToCss, cellPadding, columnPadding } from './helpers/index.js';\nimport { ZIndexDataTable } from './configs/zIndexInternalConfig.js';\nimport { ColsLayoutStyle } from './configs/constants.js';\nimport type { DSDataTableT } from './react-desc-prop-types.js';\nimport { DSInputText } from '@elliemae/ds-form-input-text';\n\ninterface WidthAndHeight {\n width?: string | number;\n height?: string | number;\n}\n\nconst styledFocusCss = ({ theme }: { theme: Theme }, color?: string) => `\n&:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ${color ?? theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n}`;\n\nexport const StyledFocusWithin = styled(Grid)<{ hideFocus?: boolean }>`\n :focus-within {\n ${(props) => (props.hideFocus ? '' : styledFocusCss(props))}\n }\n svg {\n fill: ${(props) => props.theme.colors.brand['800']};\n }\n`;\n\nexport const StyledDataTableWrapper = styled(Grid)<WidthAndHeight>`\n width: ${(props) => sizeToCss(props.width ?? ' 100%')};\n height: ${(props) => sizeToCss(props.height ?? ' 100%')};\n`;\n\nexport const StyledDataTableContentWrapper = styled(Grid)<{ noSelectionAllowed: boolean }>`\n user-select: ${({ noSelectionAllowed }) => (noSelectionAllowed ? 'none' : 'auto')};\n width: 100%;\n`;\n\nexport const StyledTableWrapper = styled.div<WidthAndHeight>`\n display: inline-block;\n border-spacing: 0;\n z-index: 0;\n position: relative;\n width: 100%;\n height: 100%;\n`;\nexport const StyledTableContentWrapper = styled(Grid)<{ height?: string | number }>`\n position: relative;\n ${({ height = 'auto' }) => `\n height: ${sizeToCss(height) as string};\n `}\n width: var(--total-width);\n`;\n\nexport const StyledVirtualListWrapper = styled(Grid)<{ gridLayout: string[]; totalColumnsWidth: string | number }>`\n overflow: auto;\n height: 100%;\n --grid-layout: ${(props) => props.gridLayout.map((col) => `minmax(0, ${col})`).join(' ')};\n --total-width: ${(props) => sizeToCss(props.totalColumnsWidth)};\n`;\n\nexport const StyledHeadWrapper = styled(Grid)<{\n colsLayoutStyle: string;\n}>`\n position: sticky;\n top: 0;\n z-index: 4;\n background: white;\n width: 100%;\n`;\n\nexport const StyledHeadTr = styled(Grid)<{\n isExpandable: boolean;\n colsLayoutStyle: DSDataTableT.ColsLayoutStyleValues;\n}>`\n ${(props) => (props.colsLayoutStyle === ColsLayoutStyle.Auto ? 'width:100%' : '')};\n grid-template-columns: var(--grid-layout);\n border-right: 1px solid ${(props) => props.theme.colors.neutral['080']};\n border-bottom: 1px solid ${(props) => props.theme.colors.neutral['080']};\n grid-auto-flow: column;\n`;\n\nexport const StyledHeadTh = styled.div<{\n isDraggingActive?: boolean;\n column: DSDataTableT.InternalColumn;\n shouldShowDnD?: boolean;\n}>`\n min-height: 24px;\n line-height: normal;\n font-weight: 600;\n text-transform: uppercase;\n font-size: 0.923rem;\n text-align: left;\n ${columnPadding}\n color: #353c46;\n min-height: 1.84615rem;\n position: sticky;\n z-index: ${ZIndexDataTable.HEADER_ROW};\n display: flex;\n justify-content: space-between;\n box-sizing: border-box;\n outline: none;\n ${(props) =>\n props.isDraggingActive\n ? ''\n : `:hover {\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-bottom: 1px solid ${props.theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n }\n cursor: pointer;\n }`}\n\n :focus {\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ${(props) => props.theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n }\n }\n`;\n\nexport const StyledHeaderRightIconsWrapper = styled.div`\n height: 100%;\n display: flex;\n align-items: center;\n max-height: 24px;\n`;\n\nexport const StyledResizer = styled(DSInputText)`\n width: 4px;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n z-index: 1;\n\n // prevents from scrolling while dragging on touch devices\n touch-action: none;\n\n border: none;\n outline: none;\n\n &:hover,\n &:focus,\n &:focus-visible {\n border: none;\n outline: none;\n }\n\n input {\n appearance: none;\n cursor: col-resize;\n background-image: transparent;\n padding: 0;\n\n &:focus::-webkit-slider-runnable-track {\n background: transparent;\n }\n\n &:focus-visible {\n :after {\n position: absolute;\n content: ' ';\n z-index: 2;\n top: 0;\n right: 0;\n width: 8px;\n height: 100%;\n border: 2px solid brand-700;\n }\n ::-webkit-slider-runnable-track {\n background: transparent;\n }\n }\n\n &::-webkit-slider-runnable-track {\n background: transparent;\n }\n\n &::-webkit-slider-thumb {\n appearance: none;\n background: transparent;\n }\n }\n`;\n\n// CELL ***********************************************************************/\nexport const StyledActionCell = styled.div`\n position: sticky;\n display: inline-block;\n right: 0;\n /* border-bottom: 1px solid #ebedf0; */\n background: white;\n`;\n\nexport const StyledCell = styled.div`\n ${cellPadding}\n display: flex;\n align-items: center;\n width: 100%;\n position: relative;\n`;\n\nexport const StyledCellContent = styled.div`\n display: grid;\n justify-self: flex-end;\n flex: 1 1 auto;\n width: 100%;\n height: 100%;\n align-items: center;\n`;\n\nexport const StyledPencilIcon = styled(EditPencil)``;\n\nexport const StyledEditableContainer = styled(Grid)<{ shouldDisplayEditIcon?: boolean }>`\n width: 100%;\n height: 100%;\n align-items: center;\n & ${StyledPencilIcon} {\n display: ${({ shouldDisplayEditIcon }) => (shouldDisplayEditIcon ? 'block' : 'none')};\n }\n &:hover {\n ${StyledPencilIcon} {\n display: block;\n }\n }\n &:focus {\n ${styledFocusCss}\n ${StyledPencilIcon} {\n display: block;\n }\n }\n outline: none;\n`;\n\n// ROW ************************************************************************/\nexport const StyledFullsizeGrid = styled(Grid)<{ minHeight: string }>`\n position: relative;\n z-index: ${ZIndexDataTable.ROW};\n\n min-height: ${(props) => props.minHeight || '36px'};\n height: ${(props) => props.height || 'auto'};\n`;\n\nexport const GroupHeaderContainer = styled(Grid)<{ paddingLeft: string }>`\n position: relative;\n background-color: ${({ theme }) => theme.colors.brand[200]};\n align-items: center;\n padding-left: ${(props) => props.paddingLeft};\n border-top: 1px solid ${({ theme }) => theme.colors.brand[300]};\n`;\n\nexport const GroupHeaderTitle = styled.span`\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n font-size: 12px;\n color: ${(props) => props.theme.colors.neutral[700]};\n`;\n\nexport const StyledCellContainer = styled(Grid)<{\n backgroundColor?: string;\n isDragOverlay?: boolean;\n isDragging?: boolean;\n isDisabled?: boolean;\n isDropValid?: boolean;\n shouldDisplayHover?: boolean;\n isDropIndicatorPositionInside?: boolean;\n minHeight?: string;\n gridTemplateColumns?: string;\n}>`\n position: relative;\n z-index: 2;\n\n min-height: ${(props) => props.minHeight || '36px'};\n height: ${(props) => props.height || 'auto'};\n\n width: 100%;\n ${(props) => (props.isDragOverlay ? 'width: fit-content;' : '')};\n\n grid-template-columns: ${(props) =>\n props.isDragOverlay ? `minmax(0, 24px) minmax(0, auto)` : props.gridTemplateColumns ?? `var(--grid-layout)`};\n\n background-color: ${({ backgroundColor, isDragging, theme }) =>\n isDragging ? theme.colors.neutral[100] : backgroundColor || 'white'};\n\n outline: none;\n\n :focus {\n ${(props) => (props.isDragOverlay ? '' : styledFocusCss(props))}\n }\n\n ${({ isDropIndicatorPositionInside, isDropValid, theme }) => {\n if (!isDropIndicatorPositionInside) return '';\n return styledFocusCss({ theme }, isDropValid ? theme.colors.brand[700] : theme.colors.danger[900]);\n }}\n\n ${({ shouldDisplayHover, theme, isDisabled }) =>\n shouldDisplayHover && !isDisabled\n ? `:hover {\n background-color: ${theme.colors.brand[200]};\n }`\n : ''}\n\n box-shadow: 0 2px 4px 0 ${(props) => (props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent')};\n\n opacity: ${(props) => (props.isDragging ? 0.8 : 1)};\n\n ${(props) =>\n !props.selected\n ? ''\n : `\n background-color: ${props.theme.colors.brand[200]};\n border: 1px solid ${props.theme.colors.brand[500]};\n `}\n\n ${GroupHeaderTitle} {\n color: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : props.theme.colors.neutral['700'])};\n }\n color: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : '#333333')};\n\n svg {\n fill: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : props.theme.colors.brand['800'])};\n }\n`;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAqB,cAAc;AACnC,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,WAAW,aAAa,qBAAqB;AACtD,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAEhC,SAAS,mBAAmB;AAO5B,MAAM,iBAAiB,CAAC,EAAE,MAAM,GAAqB,UAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBASlD,SAAS,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA,aAExC,gBAAgB;AAAA;AAGtB,MAAM,oBAAoB,OAAO,IAAI;AAAA;AAAA,MAEtC,CAAC,UAAW,MAAM,YAAY,KAAK,eAAe,KAAK;AAAA;AAAA;AAAA,YAGjD,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM,KAAK;AAAA;AAAA;AAI9C,MAAM,yBAAyB,OAAO,IAAI;AAAA,WACtC,CAAC,UAAU,UAAU,MAAM,SAAS,OAAO;AAAA,YAC1C,CAAC,UAAU,UAAU,MAAM,UAAU,OAAO;AAAA;AAGjD,MAAM,gCAAgC,OAAO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B,MAAM,gCAAgC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAO7C,MAAM,gBAAgB,OAAO,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { type Theme, styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { EditPencil } from '@elliemae/ds-icons';\nimport { sizeToCss, cellPadding, columnPadding } from './helpers/index.js';\nimport { ZIndexDataTable } from './configs/zIndexInternalConfig.js';\nimport { ColsLayoutStyle } from './configs/constants.js';\nimport type { DSDataTableT } from './react-desc-prop-types.js';\nimport { DSInputText } from '@elliemae/ds-form-input-text';\n\ninterface WidthAndHeight {\n width?: string | number;\n height?: string | number;\n}\n\nconst styledFocusCss = ({ theme }: { theme: Theme }, color?: string) => `\n&:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ${color ?? theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n}`;\n\nexport const StyledFocusWithin = styled(Grid)<{ hideFocus?: boolean }>`\n :focus-within {\n ${(props) => (props.hideFocus ? '' : styledFocusCss(props))}\n }\n svg {\n fill: ${(props) => props.theme.colors.brand['800']};\n }\n`;\n\nexport const StyledDataTableWrapper = styled(Grid)<WidthAndHeight>`\n width: ${(props) => sizeToCss(props.width ?? ' 100%')};\n height: ${(props) => sizeToCss(props.height ?? ' 100%')};\n`;\n\nexport const StyledDataTableContentWrapper = styled(Grid)<{ noSelectionAllowed: boolean }>`\n user-select: ${({ noSelectionAllowed }) => (noSelectionAllowed ? 'none' : 'auto')};\n width: 100%;\n`;\n\nexport const StyledTableWrapper = styled.div<WidthAndHeight>`\n display: inline-block;\n border-spacing: 0;\n z-index: 0;\n position: relative;\n width: 100%;\n height: 100%;\n`;\nexport const StyledTableContentWrapper = styled(Grid)<{ height?: string | number }>`\n position: relative;\n ${({ height = 'auto' }) => `\n height: ${sizeToCss(height) as string};\n `}\n width: var(--total-width);\n`;\n\nexport const StyledVirtualListWrapper = styled(Grid)<{ gridLayout: string[]; totalColumnsWidth: string | number }>`\n overflow: auto;\n height: 100%;\n --grid-layout: ${(props) => props.gridLayout.map((col) => `minmax(0, ${col})`).join(' ')};\n --total-width: ${(props) => sizeToCss(props.totalColumnsWidth)};\n`;\n\nexport const StyledHeadWrapper = styled(Grid)<{\n colsLayoutStyle: string;\n}>`\n position: sticky;\n top: 0;\n z-index: 4;\n background: white;\n width: 100%;\n`;\n\nexport const StyledHeadTr = styled(Grid)<{\n isExpandable: boolean;\n colsLayoutStyle: DSDataTableT.ColsLayoutStyleValues;\n}>`\n ${(props) => (props.colsLayoutStyle === ColsLayoutStyle.Auto ? 'width:100%' : '')};\n grid-template-columns: var(--grid-layout);\n border-right: 1px solid ${(props) => props.theme.colors.neutral['080']};\n border-bottom: 1px solid ${(props) => props.theme.colors.neutral['080']};\n grid-auto-flow: column;\n`;\n\nexport const StyledHeadTh = styled.div<{\n isDraggingActive?: boolean;\n column: DSDataTableT.InternalColumn;\n shouldShowDnD?: boolean;\n}>`\n min-height: 24px;\n line-height: normal;\n font-weight: 600;\n text-transform: uppercase;\n font-size: 0.923rem;\n text-align: left;\n ${columnPadding}\n color: #353c46;\n min-height: 1.84615rem;\n position: sticky;\n z-index: ${ZIndexDataTable.HEADER_ROW};\n display: flex;\n justify-content: space-between;\n box-sizing: border-box;\n outline: none;\n ${(props) =>\n props.isDraggingActive\n ? ''\n : `:hover {\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-bottom: 1px solid ${props.theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n }\n cursor: pointer;\n }`}\n\n :focus {\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ${(props) => props.theme.colors.brand[700]};\n pointer-events: none;\n z-index: ${ZIndexDataTable.FOCUS_BORDER};\n }\n }\n`;\n\nexport const StyledHeaderRightIconsWrapper = styled.div`\n height: 100%;\n display: flex;\n align-items: center;\n max-height: 24px;\n`;\n\nexport const StyledResizer = styled(DSInputText)`\n width: 4px;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n z-index: 1;\n\n // prevents from scrolling while dragging on touch devices\n touch-action: none;\n\n border: none;\n outline: none;\n\n &:hover,\n &:focus,\n &:focus-visible {\n border: none;\n outline: none;\n }\n\n input {\n appearance: none;\n cursor: col-resize;\n background-image: transparent;\n padding: 0;\n\n &:focus::-webkit-slider-runnable-track {\n background: transparent;\n }\n\n &:focus-visible {\n :after {\n position: absolute;\n content: ' ';\n z-index: 2;\n top: 0;\n right: 0;\n width: 8px;\n height: 100%;\n border: 2px solid brand-700;\n }\n ::-webkit-slider-runnable-track {\n background: transparent;\n }\n }\n\n &::-webkit-slider-runnable-track {\n background: transparent;\n }\n\n &::-webkit-slider-thumb {\n appearance: none;\n background: transparent;\n }\n\n &::-moz-range-thumb {\n appearance: none;\n background: transparent;\n border: none;\n }\n }\n`;\n\n// CELL ***********************************************************************/\nexport const StyledActionCell = styled.div`\n position: sticky;\n display: inline-block;\n right: 0;\n /* border-bottom: 1px solid #ebedf0; */\n background: white;\n`;\n\nexport const StyledCell = styled.div`\n ${cellPadding}\n display: flex;\n align-items: center;\n width: 100%;\n position: relative;\n`;\n\nexport const StyledCellContent = styled.div`\n display: grid;\n justify-self: flex-end;\n flex: 1 1 auto;\n width: 100%;\n height: 100%;\n align-items: center;\n`;\n\nexport const StyledPencilIcon = styled(EditPencil)``;\n\nexport const StyledEditableContainer = styled(Grid)<{ shouldDisplayEditIcon?: boolean }>`\n width: 100%;\n height: 100%;\n align-items: center;\n & ${StyledPencilIcon} {\n display: ${({ shouldDisplayEditIcon }) => (shouldDisplayEditIcon ? 'block' : 'none')};\n }\n &:hover {\n ${StyledPencilIcon} {\n display: block;\n }\n }\n &:focus {\n ${styledFocusCss}\n ${StyledPencilIcon} {\n display: block;\n }\n }\n outline: none;\n`;\n\n// ROW ************************************************************************/\nexport const StyledFullsizeGrid = styled(Grid)<{ minHeight: string }>`\n position: relative;\n z-index: ${ZIndexDataTable.ROW};\n\n min-height: ${(props) => props.minHeight || '36px'};\n height: ${(props) => props.height || 'auto'};\n`;\n\nexport const GroupHeaderContainer = styled(Grid)<{ paddingLeft: string }>`\n position: relative;\n background-color: ${({ theme }) => theme.colors.brand[200]};\n align-items: center;\n padding-left: ${(props) => props.paddingLeft};\n border-top: 1px solid ${({ theme }) => theme.colors.brand[300]};\n`;\n\nexport const GroupHeaderTitle = styled.span`\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n font-size: 12px;\n color: ${(props) => props.theme.colors.neutral[700]};\n`;\n\nexport const StyledCellContainer = styled(Grid)<{\n backgroundColor?: string;\n isDragOverlay?: boolean;\n isDragging?: boolean;\n isDisabled?: boolean;\n isDropValid?: boolean;\n shouldDisplayHover?: boolean;\n isDropIndicatorPositionInside?: boolean;\n minHeight?: string;\n gridTemplateColumns?: string;\n}>`\n position: relative;\n z-index: 2;\n\n min-height: ${(props) => props.minHeight || '36px'};\n height: ${(props) => props.height || 'auto'};\n\n width: 100%;\n ${(props) => (props.isDragOverlay ? 'width: fit-content;' : '')};\n\n grid-template-columns: ${(props) =>\n props.isDragOverlay ? `minmax(0, 24px) minmax(0, auto)` : props.gridTemplateColumns ?? `var(--grid-layout)`};\n\n background-color: ${({ backgroundColor, isDragging, theme }) =>\n isDragging ? theme.colors.neutral[100] : backgroundColor || 'white'};\n\n outline: none;\n\n :focus {\n ${(props) => (props.isDragOverlay ? '' : styledFocusCss(props))}\n }\n\n ${({ isDropIndicatorPositionInside, isDropValid, theme }) => {\n if (!isDropIndicatorPositionInside) return '';\n return styledFocusCss({ theme }, isDropValid ? theme.colors.brand[700] : theme.colors.danger[900]);\n }}\n\n ${({ shouldDisplayHover, theme, isDisabled }) =>\n shouldDisplayHover && !isDisabled\n ? `:hover {\n background-color: ${theme.colors.brand[200]};\n }`\n : ''}\n\n box-shadow: 0 2px 4px 0 ${(props) => (props.isDragOverlay ? 'rgba(0,0,0,0.5)' : 'transparent')};\n\n opacity: ${(props) => (props.isDragging ? 0.8 : 1)};\n\n ${(props) =>\n !props.selected\n ? ''\n : `\n background-color: ${props.theme.colors.brand[200]};\n border: 1px solid ${props.theme.colors.brand[500]};\n `}\n\n ${GroupHeaderTitle} {\n color: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : props.theme.colors.neutral['700'])};\n }\n color: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : '#333333')};\n\n svg {\n fill: ${(props) => (props.isDisabled ? props.theme.colors.neutral['200'] : props.theme.colors.brand['800'])};\n }\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAqB,cAAc;AACnC,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,WAAW,aAAa,qBAAqB;AACtD,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAEhC,SAAS,mBAAmB;AAO5B,MAAM,iBAAiB,CAAC,EAAE,MAAM,GAAqB,UAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBASlD,SAAS,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA,aAExC,gBAAgB;AAAA;AAGtB,MAAM,oBAAoB,OAAO,IAAI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,GAAG;AAAA,eAE9C;AAAA;AAAA,4BAEoB,CAAC,UAAW,MAAM,gBAAgB,oBAAoB;AAAA;AAAA,aAErE,CAAC,UAAW,MAAM,aAAa,MAAM;AAAA;AAAA,IAE9C,CAAC,UACD,CAAC,MAAM,WACH,KACA;AAAA,wBACgB,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA,wBAC5B,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;AAAA,IAGhD;AAAA,aACS,CAAC,UAAW,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA;AAAA,WAErG,CAAC,UAAW,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI;AAAA;AAAA;AAAA,YAGlE,CAAC,UAAW,MAAM,aAAa,MAAM,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,MAAM,OAAO,MAAM,KAAK;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DSDataTableT } from '../react-desc-prop-types.js';
|
|
2
|
+
export declare const getGridLayout: (wrapper: HTMLDivElement | null) => number[];
|
|
3
|
+
export declare const changeGridLayout: (wrapper: HTMLDivElement | null, colIndex: number, newWidth: number) => void;
|
|
4
|
+
export declare const setSubColumnsGridLayout: (wrapper: HTMLDivElement | null, columns: DSDataTableT.InternalColumn[]) => void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { DSDataTableT } from '../react-desc-prop-types.js';
|
|
3
|
-
export declare const SortableHeaderCell: ({ items, isDragOverlay, isGroup, ...rest }: {
|
|
3
|
+
export declare const SortableHeaderCell: ({ items, isDragOverlay, isGroup, colId, ...rest }: {
|
|
4
4
|
items: DSDataTableT.InternalColumn[];
|
|
5
5
|
isDragOverlay?: boolean | undefined;
|
|
6
6
|
isGroup?: boolean | undefined;
|
|
7
|
+
colId?: string | undefined;
|
|
7
8
|
children: JSX.Element | JSX.Element[];
|
|
8
9
|
}) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-data-table",
|
|
3
|
-
"version": "3.20.0-next.
|
|
3
|
+
"version": "3.20.0-next.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Data Table",
|
|
6
6
|
"files": [
|
|
@@ -573,30 +573,30 @@
|
|
|
573
573
|
"dependencies": {
|
|
574
574
|
"react-virtual": "~2.10.4",
|
|
575
575
|
"uid": "~2.0.1",
|
|
576
|
-
"@elliemae/ds-button": "3.20.0-next.
|
|
577
|
-
"@elliemae/ds-
|
|
578
|
-
"@elliemae/ds-
|
|
579
|
-
"@elliemae/ds-
|
|
580
|
-
"@elliemae/ds-form-checkbox": "3.20.0-next.
|
|
581
|
-
"@elliemae/ds-form-
|
|
582
|
-
"@elliemae/ds-
|
|
583
|
-
"@elliemae/ds-form-
|
|
584
|
-
"@elliemae/ds-form-
|
|
585
|
-
"@elliemae/ds-form-
|
|
586
|
-
"@elliemae/ds-form-
|
|
587
|
-
"@elliemae/ds-
|
|
588
|
-
"@elliemae/ds-
|
|
589
|
-
"@elliemae/ds-
|
|
590
|
-
"@elliemae/ds-
|
|
591
|
-
"@elliemae/ds-
|
|
592
|
-
"@elliemae/ds-props-helpers": "3.20.0-next.
|
|
593
|
-
"@elliemae/ds-
|
|
594
|
-
"@elliemae/ds-
|
|
595
|
-
"@elliemae/ds-
|
|
596
|
-
"@elliemae/ds-
|
|
597
|
-
"@elliemae/ds-
|
|
598
|
-
"@elliemae/ds-
|
|
599
|
-
"@elliemae/ds-
|
|
576
|
+
"@elliemae/ds-button": "3.20.0-next.6",
|
|
577
|
+
"@elliemae/ds-dropdownmenu": "3.20.0-next.6",
|
|
578
|
+
"@elliemae/ds-form-combobox": "3.20.0-next.6",
|
|
579
|
+
"@elliemae/ds-button-v2": "3.20.0-next.6",
|
|
580
|
+
"@elliemae/ds-form-checkbox": "3.20.0-next.6",
|
|
581
|
+
"@elliemae/ds-form-date-range-picker": "3.20.0-next.6",
|
|
582
|
+
"@elliemae/ds-form-date-time-picker": "3.20.0-next.6",
|
|
583
|
+
"@elliemae/ds-form-helpers-mask-hooks": "3.20.0-next.6",
|
|
584
|
+
"@elliemae/ds-form-layout-blocks": "3.20.0-next.6",
|
|
585
|
+
"@elliemae/ds-form-input-text": "3.20.0-next.6",
|
|
586
|
+
"@elliemae/ds-form-radio": "3.20.0-next.6",
|
|
587
|
+
"@elliemae/ds-grid": "3.20.0-next.6",
|
|
588
|
+
"@elliemae/ds-icons": "3.20.0-next.6",
|
|
589
|
+
"@elliemae/ds-pills": "3.20.0-next.6",
|
|
590
|
+
"@elliemae/ds-pagination": "3.20.0-next.6",
|
|
591
|
+
"@elliemae/ds-popperjs": "3.20.0-next.6",
|
|
592
|
+
"@elliemae/ds-props-helpers": "3.20.0-next.6",
|
|
593
|
+
"@elliemae/ds-system": "3.20.0-next.6",
|
|
594
|
+
"@elliemae/ds-skeleton": "3.20.0-next.6",
|
|
595
|
+
"@elliemae/ds-toolbar": "3.20.0-next.6",
|
|
596
|
+
"@elliemae/ds-truncated-tooltip-text": "3.20.0-next.6",
|
|
597
|
+
"@elliemae/ds-utilities": "3.20.0-next.6",
|
|
598
|
+
"@elliemae/ds-circular-progress-indicator": "3.20.0-next.6",
|
|
599
|
+
"@elliemae/ds-drag-and-drop": "3.20.0-next.6"
|
|
600
600
|
},
|
|
601
601
|
"devDependencies": {
|
|
602
602
|
"@testing-library/react": "~12.1.3",
|