@elliemae/ds-data-table 3.10.0-next.0 → 3.10.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/DataTableSchema.js +1 -0
  2. package/dist/cjs/DataTableSchema.js.map +2 -2
  3. package/dist/cjs/configs/useRowFlattenization.js +5 -2
  4. package/dist/cjs/configs/useRowFlattenization.js.map +2 -2
  5. package/dist/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js +39 -57
  6. package/dist/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js.map +2 -2
  7. package/dist/cjs/exported-related/RowRenderer/index.js +6 -3
  8. package/dist/cjs/exported-related/RowRenderer/index.js.map +2 -2
  9. package/dist/cjs/exported-related/RowRenderer/useRowRendererProperties.js.map +1 -1
  10. package/dist/cjs/exported-related/RowRenderer/useRowStyle.js +3 -1
  11. package/dist/cjs/exported-related/RowRenderer/useRowStyle.js.map +2 -2
  12. package/dist/cjs/parts/DropIndicator.js +9 -7
  13. package/dist/cjs/parts/DropIndicator.js.map +2 -2
  14. package/dist/cjs/parts/HoC/DnDTreeContext.js +33 -0
  15. package/dist/cjs/parts/HoC/DnDTreeContext.js.map +7 -0
  16. package/dist/cjs/parts/HoC/SortableItemContext.js.map +1 -1
  17. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +34 -26
  18. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
  19. package/dist/cjs/parts/HoC/withDnDSortableRowContext.js +4 -3
  20. package/dist/cjs/parts/HoC/withDnDSortableRowContext.js.map +2 -2
  21. package/dist/cjs/parts/RowVariants/types.js.map +1 -1
  22. package/dist/cjs/parts/Rows.js +3 -2
  23. package/dist/cjs/parts/Rows.js.map +2 -2
  24. package/dist/cjs/styled.js +4 -4
  25. package/dist/cjs/styled.js.map +2 -2
  26. package/dist/cjs/types/props.js.map +2 -2
  27. package/dist/esm/DataTableSchema.js +1 -0
  28. package/dist/esm/DataTableSchema.js.map +2 -2
  29. package/dist/esm/configs/useRowFlattenization.js +5 -2
  30. package/dist/esm/configs/useRowFlattenization.js.map +2 -2
  31. package/dist/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js +39 -57
  32. package/dist/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js.map +2 -2
  33. package/dist/esm/exported-related/RowRenderer/index.js +6 -3
  34. package/dist/esm/exported-related/RowRenderer/index.js.map +2 -2
  35. package/dist/esm/exported-related/RowRenderer/useRowRendererProperties.js.map +1 -1
  36. package/dist/esm/exported-related/RowRenderer/useRowStyle.js +3 -1
  37. package/dist/esm/exported-related/RowRenderer/useRowStyle.js.map +2 -2
  38. package/dist/esm/parts/DropIndicator.js +9 -7
  39. package/dist/esm/parts/DropIndicator.js.map +2 -2
  40. package/dist/esm/parts/HoC/DnDTreeContext.js +7 -0
  41. package/dist/esm/parts/HoC/DnDTreeContext.js.map +7 -0
  42. package/dist/esm/parts/HoC/SortableItemContext.js.map +1 -1
  43. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +34 -26
  44. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
  45. package/dist/esm/parts/HoC/withDnDSortableRowContext.js +4 -3
  46. package/dist/esm/parts/HoC/withDnDSortableRowContext.js.map +2 -2
  47. package/dist/esm/parts/Rows.js +4 -3
  48. package/dist/esm/parts/Rows.js.map +2 -2
  49. package/dist/esm/styled.js +4 -4
  50. package/dist/esm/styled.js.map +2 -2
  51. package/dist/esm/types/props.js.map +2 -2
  52. package/package.json +18 -18
@@ -29,6 +29,7 @@ const DefaultRowContentRenderer = (props) => {
29
29
  isDragOverlay,
30
30
  backgroundColor = "white",
31
31
  dropIndicatorPosition,
32
+ isDropValid,
32
33
  focusedRowId,
33
34
  drilldownRowId,
34
35
  compact
@@ -70,64 +71,45 @@ const DefaultRowContentRenderer = (props) => {
70
71
  },
71
72
  [disabledRows, row.uid]
72
73
  );
73
- const PureRowContent = useMemo(() => {
74
- const DetailsView = row.original.tableRowDetails;
75
- return /* @__PURE__ */ jsxs(Fragment, {
76
- children: [
77
- /* @__PURE__ */ jsx(StyledCellContainer, {
78
- ref: rowRef,
79
- tabIndex: disabledRows[row.uid] ? -1 : 0,
80
- role: "row",
81
- "aria-rowindex": row.realIndex + 1,
82
- "aria-label": ariaLabelMessage(row, selection?.[row.uid] === true),
83
- "aria-selected": selection?.[row.uid] === true,
84
- "aria-expanded": isExpandable ? expandedRows[row.uid] === true : void 0,
85
- "aria-disabled": disabledRows[row.uid],
86
- ...gridTemplateColProps,
87
- backgroundColor,
88
- height: compact ? "24px" : "auto",
89
- minHeight: compact ? "24px" : "36px",
90
- isDropIndicatorPositionInside: dropIndicatorPosition === DropIndicatorPosition.Inside,
91
- shouldDisplayHover: !isDndActive && !isDragging && !isDragOverlay,
92
- isDragOverlay,
93
- isDragging,
94
- selected: noSelectionColumn && selection?.[row.uid] === true,
95
- disabled: disabledRows[row.uid],
96
- "data-testid": DATA_TESTID.DATA_TABLE_ROW_CONTENT,
97
- onMouseDown: handleSelectDisableRow,
98
- children: /* @__PURE__ */ jsx(Cells, {
99
- row,
100
- isRowSelected: drilldownRowId === row.uid,
101
- isDragOverlay
102
- }, row.uid)
103
- }, row.uid),
104
- !isDragOverlay && isExpandable && row.isExpanded && DetailsView && /* @__PURE__ */ jsx(DetailsWrapper, {
105
- children: /* @__PURE__ */ jsx(DetailsView, {
106
- row,
107
- detailsIndent
108
- })
74
+ const DetailsView = row.original.tableRowDetails;
75
+ return /* @__PURE__ */ jsxs(Fragment, {
76
+ children: [
77
+ /* @__PURE__ */ jsx(StyledCellContainer, {
78
+ ref: rowRef,
79
+ tabIndex: disabledRows[row.uid] ? -1 : 0,
80
+ role: "row",
81
+ "aria-rowindex": row.realIndex + 1,
82
+ "aria-label": ariaLabelMessage(row, selection?.[row.uid] === true),
83
+ "aria-selected": selection?.[row.uid] === true,
84
+ "aria-expanded": isExpandable ? expandedRows[row.uid] === true : void 0,
85
+ "aria-disabled": disabledRows[row.uid],
86
+ ...gridTemplateColProps,
87
+ backgroundColor,
88
+ height: compact ? "24px" : "auto",
89
+ minHeight: compact ? "24px" : "36px",
90
+ isDropIndicatorPositionInside: dropIndicatorPosition === DropIndicatorPosition.Inside,
91
+ isDropValid,
92
+ shouldDisplayHover: !isDndActive && !isDragging && !isDragOverlay,
93
+ isDragOverlay,
94
+ isDragging,
95
+ selected: noSelectionColumn && selection?.[row.uid] === true,
96
+ disabled: disabledRows[row.uid],
97
+ "data-testid": DATA_TESTID.DATA_TABLE_ROW_CONTENT,
98
+ onMouseDown: handleSelectDisableRow,
99
+ children: /* @__PURE__ */ jsx(Cells, {
100
+ row,
101
+ isRowSelected: drilldownRowId === row.uid,
102
+ isDragOverlay
103
+ }, row.uid)
104
+ }, row.uid),
105
+ !isDragOverlay && isExpandable && row.isExpanded && DetailsView && /* @__PURE__ */ jsx(DetailsWrapper, {
106
+ children: /* @__PURE__ */ jsx(DetailsView, {
107
+ row,
108
+ detailsIndent
109
109
  })
110
- ]
111
- });
112
- }, [
113
- row,
114
- disabledRows,
115
- selection,
116
- isExpandable,
117
- expandedRows,
118
- gridTemplateColProps,
119
- backgroundColor,
120
- compact,
121
- dropIndicatorPosition,
122
- isDndActive,
123
- isDragging,
124
- isDragOverlay,
125
- noSelectionColumn,
126
- handleSelectDisableRow,
127
- drilldownRowId,
128
- detailsIndent
129
- ]);
130
- return PureRowContent;
110
+ })
111
+ ]
112
+ });
131
113
  };
132
114
  export {
133
115
  DefaultRowContentRenderer
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/exported-related/RowRenderer/DefaultRowContentRenderer.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport React, { useMemo, useCallback, useLayoutEffect, useRef } from 'react';\nimport { INTERNAL_COLUMNS } from '../../addons/Columns';\nimport { DATA_TESTID } from '../../configs/constants';\nimport { Cells } from '../../parts/Cells';\nimport { RowVariantProps } from '../../parts/RowVariants/types';\nimport { StyledCellContainer } from '../../styled';\nimport { DropIndicatorPosition, TypescriptRow } from '../../types/props';\n\nconst DetailsWrapper = (props) => (\n // This can be further customized\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n data-role=\"detail-view\"\n style={{\n borderTop: '1px solid #EBEDF0',\n borderBottom: '1px solid #EBEDF0',\n }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {props.children}\n </div>\n);\n\nconst ariaLabelMessage = (row: TypescriptRow, selected: boolean) =>\n `Row number ${row.realIndex + 1}${row.parentIndex !== null ? `, child of row number ${row.parentIndex + 1}` : ''}. ${\n selected ? 'Selected. ' : ''\n }To interact with the cells press enter`;\n\nexport const DefaultRowContentRenderer: React.ComponentType<RowVariantProps> = (props) => {\n const {\n row,\n ctx: {\n tableProps: { isExpandable, colsLayoutStyle, selection, noSelectionColumn, expandedRows, disabledRows },\n layoutHelpers: { gridLayout },\n visibleColumns,\n },\n draggableProps,\n isDragOverlay,\n backgroundColor = 'white',\n dropIndicatorPosition,\n focusedRowId,\n drilldownRowId,\n compact,\n } = props;\n\n const rowRef = useRef<HTMLDivElement>(null);\n const isDndActive = draggableProps && draggableProps.active;\n const isDragging = draggableProps && draggableProps.isDragging;\n\n useLayoutEffect(() => {\n if (row.uid === focusedRowId) {\n rowRef.current?.focus();\n }\n }, [focusedRowId, row.uid]);\n\n const gridTemplateColProps = useMemo(\n () => ({\n cols: isDragOverlay ? ['24px', 'auto'] : gridLayout,\n isExpandable,\n colLayoutStyle: colsLayoutStyle,\n }),\n [isDragOverlay, gridLayout, colsLayoutStyle, isExpandable],\n );\n\n const detailsIndent = useMemo(() => {\n let padding = 0;\n for (let i = 0; i < visibleColumns.length; i += 1) {\n if (INTERNAL_COLUMNS.includes(visibleColumns[i].id)) {\n padding += visibleColumns[i].width;\n } else {\n padding += row.depth * 32 + 15;\n break;\n }\n }\n return padding;\n }, [row.depth, visibleColumns]);\n\n const handleSelectDisableRow = useCallback(\n (e) => {\n if (disabledRows[row.uid]) {\n e.preventDefault();\n e.stopPropagation();\n }\n },\n [disabledRows, row.uid],\n );\n const PureRowContent = useMemo(() => {\n const DetailsView = row.original.tableRowDetails;\n return (\n <>\n <StyledCellContainer\n ref={rowRef}\n key={row.uid}\n tabIndex={disabledRows[row.uid] ? -1 : 0}\n role=\"row\"\n aria-rowindex={row.realIndex + 1}\n aria-label={ariaLabelMessage(row, selection?.[row.uid] === true)}\n aria-selected={selection?.[row.uid] === true}\n aria-expanded={isExpandable ? expandedRows[row.uid] === true : undefined}\n aria-disabled={disabledRows[row.uid]}\n {...gridTemplateColProps}\n backgroundColor={backgroundColor}\n height={compact ? '24px' : 'auto'}\n minHeight={compact ? '24px' : '36px'}\n isDropIndicatorPositionInside={dropIndicatorPosition === DropIndicatorPosition.Inside}\n shouldDisplayHover={!isDndActive && !isDragging && !isDragOverlay}\n isDragOverlay={isDragOverlay}\n isDragging={isDragging}\n selected={noSelectionColumn && selection?.[row.uid] === true}\n disabled={disabledRows[row.uid]}\n data-testid={DATA_TESTID.DATA_TABLE_ROW_CONTENT}\n onMouseDown={handleSelectDisableRow}\n >\n <Cells row={row} isRowSelected={drilldownRowId === row.uid} isDragOverlay={isDragOverlay} key={row.uid} />\n </StyledCellContainer>\n {!isDragOverlay && isExpandable && row.isExpanded && DetailsView && (\n <DetailsWrapper>\n <DetailsView row={row} detailsIndent={detailsIndent} />\n </DetailsWrapper>\n )}\n </>\n );\n }, [\n row,\n disabledRows,\n selection,\n isExpandable,\n expandedRows,\n gridTemplateColProps,\n backgroundColor,\n compact,\n dropIndicatorPosition,\n isDndActive,\n isDragging,\n isDragOverlay,\n noSelectionColumn,\n handleSelectDisableRow,\n drilldownRowId,\n detailsIndent,\n ]);\n\n return PureRowContent;\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB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AAA,YAAM;AAAA,YAAU,eAAe,mBAAmB,IAAI;AAAA,YAAK;AAAA,aAAmC,IAAI,GAAK;AAAA,WArBnG,IAAI,GAsBX;AAAA,QACC,CAAC,iBAAiB,gBAAgB,IAAI,cAAc,eACnD,oBAAC;AAAA,UACC,8BAAC;AAAA,YAAY;AAAA,YAAU;AAAA,WAA8B;AAAA,SACvD;AAAA;AAAA,KAEJ;AAAA,EAEJ,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport React, { useMemo, useCallback, useLayoutEffect, useRef } from 'react';\nimport { INTERNAL_COLUMNS } from '../../addons/Columns';\nimport { DATA_TESTID } from '../../configs/constants';\nimport { Cells } from '../../parts/Cells';\nimport { RowVariantProps } from '../../parts/RowVariants/types';\nimport { StyledCellContainer } from '../../styled';\nimport { DropIndicatorPosition, TypescriptRow } from '../../types/props';\n\nconst DetailsWrapper = (props) => (\n // This can be further customized\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n data-role=\"detail-view\"\n style={{\n borderTop: '1px solid #EBEDF0',\n borderBottom: '1px solid #EBEDF0',\n }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {props.children}\n </div>\n);\n\nconst ariaLabelMessage = (row: TypescriptRow, selected: boolean) =>\n `Row number ${row.realIndex + 1}${row.parentIndex !== null ? `, child of row number ${row.parentIndex + 1}` : ''}. ${\n selected ? 'Selected. ' : ''\n }To interact with the cells press enter`;\n\nexport const DefaultRowContentRenderer: React.ComponentType<RowVariantProps> = (props) => {\n const {\n row,\n ctx: {\n tableProps: { isExpandable, colsLayoutStyle, selection, noSelectionColumn, expandedRows, disabledRows },\n layoutHelpers: { gridLayout },\n visibleColumns,\n },\n draggableProps,\n isDragOverlay,\n backgroundColor = 'white',\n dropIndicatorPosition,\n isDropValid,\n focusedRowId,\n drilldownRowId,\n compact,\n } = props;\n\n const rowRef = useRef<HTMLDivElement>(null);\n const isDndActive = draggableProps && draggableProps.active;\n const isDragging = draggableProps && draggableProps.isDragging;\n\n useLayoutEffect(() => {\n if (row.uid === focusedRowId) {\n rowRef.current?.focus();\n }\n }, [focusedRowId, row.uid]);\n\n const gridTemplateColProps = useMemo(\n () => ({\n cols: isDragOverlay ? ['24px', 'auto'] : gridLayout,\n isExpandable,\n colLayoutStyle: colsLayoutStyle,\n }),\n [isDragOverlay, gridLayout, colsLayoutStyle, isExpandable],\n );\n\n const detailsIndent = useMemo(() => {\n let padding = 0;\n for (let i = 0; i < visibleColumns.length; i += 1) {\n if (INTERNAL_COLUMNS.includes(visibleColumns[i].id)) {\n padding += visibleColumns[i].width;\n } else {\n padding += row.depth * 32 + 15;\n break;\n }\n }\n return padding;\n }, [row.depth, visibleColumns]);\n\n const handleSelectDisableRow = useCallback(\n (e) => {\n if (disabledRows[row.uid]) {\n e.preventDefault();\n e.stopPropagation();\n }\n },\n [disabledRows, row.uid],\n );\n const DetailsView = row.original.tableRowDetails;\n\n return (\n <>\n <StyledCellContainer\n ref={rowRef}\n key={row.uid}\n tabIndex={disabledRows[row.uid] ? -1 : 0}\n role=\"row\"\n aria-rowindex={row.realIndex + 1}\n aria-label={ariaLabelMessage(row, selection?.[row.uid] === true)}\n aria-selected={selection?.[row.uid] === true}\n aria-expanded={isExpandable ? expandedRows[row.uid] === true : undefined}\n aria-disabled={disabledRows[row.uid]}\n {...gridTemplateColProps}\n backgroundColor={backgroundColor}\n height={compact ? '24px' : 'auto'}\n minHeight={compact ? '24px' : '36px'}\n isDropIndicatorPositionInside={dropIndicatorPosition === DropIndicatorPosition.Inside}\n isDropValid={isDropValid}\n shouldDisplayHover={!isDndActive && !isDragging && !isDragOverlay}\n isDragOverlay={isDragOverlay}\n isDragging={isDragging}\n selected={noSelectionColumn && selection?.[row.uid] === true}\n disabled={disabledRows[row.uid]}\n data-testid={DATA_TESTID.DATA_TABLE_ROW_CONTENT}\n onMouseDown={handleSelectDisableRow}\n >\n <Cells row={row} isRowSelected={drilldownRowId === row.uid} isDragOverlay={isDragOverlay} key={row.uid} />\n </StyledCellContainer>\n {!isDragOverlay && isExpandable && row.isExpanded && DetailsView && (\n <DetailsWrapper>\n <DetailsView row={row} detailsIndent={detailsIndent} />\n </DetailsWrapper>\n )}\n </>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,SAAS,aAAa,iBAAiB,cAAc;AACrE,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AAEtB,SAAS,2BAA2B;AACpC,SAAS,6BAA4C;AAErD,MAAM,iBAAiB,CAAC,UAGtB,oBAAC;AAAA,EACC,aAAU;AAAA,EACV,OAAO;AAAA,IACL,WAAW;AAAA,IACX,cAAc;AAAA,EAChB;AAAA,EACA,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,EAClC,WAAW,CAAC,MAAM,EAAE,gBAAgB;AAAA,EAEnC,gBAAM;AAAA,CACT;AAGF,MAAM,mBAAmB,CAAC,KAAoB,aAC5C,cAAc,IAAI,YAAY,IAAI,IAAI,gBAAgB,OAAO,yBAAyB,IAAI,cAAc,MAAM,OAC5G,WAAW,eAAe;AAGvB,MAAM,4BAAkE,CAAC,UAAU;AACxF,QAAM;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,MACH,YAAY,EAAE,cAAc,iBAAiB,WAAW,mBAAmB,cAAc,aAAa;AAAA,MACtG,eAAe,EAAE,WAAW;AAAA,MAC5B;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,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AAA,QACxC,iBAAe,eAAe,aAAa,IAAI,SAAS,OAAO;AAAA,QAC/D,iBAAe,aAAa,IAAI;AAAA,QAC/B,GAAG;AAAA,QACJ;AAAA,QACA,QAAQ,UAAU,SAAS;AAAA,QAC3B,WAAW,UAAU,SAAS;AAAA,QAC9B,+BAA+B,0BAA0B,sBAAsB;AAAA,QAC/E;AAAA,QACA,oBAAoB,CAAC,eAAe,CAAC,cAAc,CAAC;AAAA,QACpD;AAAA,QACA;AAAA,QACA,UAAU,qBAAqB,YAAY,IAAI,SAAS;AAAA,QACxD,UAAU,aAAa,IAAI;AAAA,QAC3B,eAAa,YAAY;AAAA,QACzB,aAAa;AAAA,QAEb,8BAAC;AAAA,UAAM;AAAA,UAAU,eAAe,mBAAmB,IAAI;AAAA,UAAK;AAAA,WAAmC,IAAI,GAAK;AAAA,SAtBnG,IAAI,GAuBX;AAAA,MACC,CAAC,iBAAiB,gBAAgB,IAAI,cAAc,eACnD,oBAAC;AAAA,QACC,8BAAC;AAAA,UAAY;AAAA,UAAU;AAAA,SAA8B;AAAA,OACvD;AAAA;AAAA,GAEJ;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -46,7 +46,8 @@ const RowRenderer = (props) => {
46
46
  totalColumnsWidth,
47
47
  rowStyle,
48
48
  shouldAppendDottedBorder,
49
- dropIndicatorPosition
49
+ dropIndicatorPosition,
50
+ isDropValid
50
51
  } = useRowRendererProperties({
51
52
  row
52
53
  });
@@ -64,7 +65,8 @@ const RowRenderer = (props) => {
64
65
  focusedRowId,
65
66
  drilldownRowId,
66
67
  draggableProps,
67
- dropIndicatorPosition
68
+ dropIndicatorPosition,
69
+ isDropValid
68
70
  };
69
71
  return /* @__PURE__ */ jsxs(StyledFullsizeGrid, {
70
72
  "data-testid": DATA_TESTID.DATA_TABLE_ROW,
@@ -88,10 +90,11 @@ const RowRenderer = (props) => {
88
90
  ...rowContentProps,
89
91
  key: row.uid
90
92
  }),
91
- shouldAppendDottedBorder && magicDottedBorder,
93
+ shouldAppendDottedBorder && !isDragOverlay && magicDottedBorder,
92
94
  /* @__PURE__ */ jsx(DropIndicator, {
93
95
  vertical: false,
94
96
  dropIndicatorPosition,
97
+ isDropValid,
95
98
  isLast: row.index === flattenedData.length - 1 && draggableProps && draggableProps.isDragging
96
99
  })
97
100
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/exported-related/RowRenderer/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useContext } from 'react';\nimport { DataTableContext } from '../../DataTableContext';\nimport { RowVariantProps } from '../../parts/RowVariants/types';\nimport { StyledFullsizeGrid } from '../../styled';\nimport { TypescriptRow } from '../../types/props';\nimport { DefaultRowContentRenderer } from './DefaultRowContentRenderer';\nimport { useRowRendererHandlers } from './useRowRendererHandlers';\nimport { useRowRendererProperties } from './useRowRendererProperties';\nimport { DropIndicator } from '../../parts/DropIndicator';\nimport { SortableItemContext } from '../../parts/HoC/SortableItemContext';\nimport { DATA_TESTID } from '../../configs/constants';\n\ninterface RowRendererProps {\n row: TypescriptRow;\n compact?: boolean;\n itemIndex: number;\n isDragOverlay: boolean;\n minHeight: string;\n height: string;\n rowsLayout?: (string | number)[];\n colsLayout?: (string | number)[];\n CustomRowContentRenderer?: React.ComponentType<RowVariantProps>;\n focusedRowId: string | null;\n drilldownRowId: string | null;\n backgroundColor?: string;\n}\n\n// CSS don't let us modify the spacing between the dots, so one solution is to use SVG\nconst magicDottedBorder = (\n <svg width=\"100%\" height=\"1px\">\n <line\n x1=\"0\"\n y1=\"0\"\n x2=\"100%\"\n y2=\"0\"\n stroke=\"#B0B9C8FF\"\n strokeWidth=\"1.5\"\n strokeDasharray=\"0, 5\"\n strokeDashoffset=\"0\"\n strokeLinecap=\"round\"\n />\n </svg>\n);\n\nconst RowRenderer: React.ComponentType<RowRendererProps> = (props) => {\n const {\n row,\n itemIndex,\n minHeight = '36px',\n height = 'auto',\n rowsLayout = [1],\n CustomRowContentRenderer,\n focusedRowId,\n drilldownRowId,\n isDragOverlay,\n } = props;\n\n const ctx = useContext(DataTableContext);\n const { draggableProps } = useContext(SortableItemContext);\n const { flattenedData } = ctx;\n\n // ===========================================================================\n // Properties for the row\n // ===========================================================================\n\n const {\n userDataProperties,\n colsLayoutStyle,\n totalColumnsWidth,\n rowStyle,\n shouldAppendDottedBorder,\n dropIndicatorPosition,\n } = useRowRendererProperties({\n row,\n });\n\n // ===========================================================================\n // Handlers\n // ===========================================================================\n\n const { handleItemClick, handleKeyDown, handleOnBlur, handleOnFocus } = useRowRendererHandlers({\n row,\n itemIndex,\n items: flattenedData,\n draggableProps,\n isDragOverlay,\n drilldownRowId,\n });\n\n const rowContentProps: RowVariantProps = {\n ...props,\n ctx,\n focusedRowId,\n drilldownRowId,\n draggableProps,\n dropIndicatorPosition,\n };\n\n return (\n <StyledFullsizeGrid\n data-testid={DATA_TESTID.DATA_TABLE_ROW}\n key={row.uid}\n colsLayoutStyle={colsLayoutStyle}\n {...userDataProperties}\n totalColumnsWidth={totalColumnsWidth}\n style={rowStyle}\n onClick={handleItemClick}\n onKeyDown={handleKeyDown}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n data-expandable={Boolean(row.original.tableRowDetails)}\n data-is-row-expanded={row.isExpanded}\n rows={rowsLayout}\n minHeight={minHeight}\n height={height}\n >\n {CustomRowContentRenderer ? (\n <CustomRowContentRenderer {...rowContentProps} />\n ) : (\n <DefaultRowContentRenderer {...rowContentProps} key={row.uid} />\n )}\n {shouldAppendDottedBorder && magicDottedBorder}\n <DropIndicator\n vertical={false}\n dropIndicatorPosition={dropIndicatorPosition}\n isLast={row.index === flattenedData.length - 1 && draggableProps && draggableProps.isDragging}\n />\n </StyledFullsizeGrid>\n );\n};\n\nexport { RowRenderer };\nexport default RowRenderer;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA;AACA,SA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;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,mBAAiB,QAAQ,IAAI,SAAS,eAAe;AAAA,IACrD,wBAAsB,IAAI;AAAA,IAC1B,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IAEC;AAAA,iCACC,oBAAC;AAAA,QAA0B,GAAG;AAAA,OAAiB,IAE/C,8BAAC;AAAA,QAA2B,GAAG;AAAA,QAAiB,KAAK,IAAI;AAAA,OAAK;AAAA,MAE/D,4BAA4B;AAAA,MAC7B,oBAAC;AAAA,QACC,UAAU;AAAA,QACV;AAAA,QACA,QAAQ,IAAI,UAAU,cAAc,SAAS,KAAK,kBAAkB,eAAe;AAAA,OACrF;AAAA;AAAA,KAzBK,IAAI,GA0BX;AAEJ;AAGA,IAAO,sBAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useContext } from 'react';\nimport { DataTableContext } from '../../DataTableContext';\nimport { RowVariantProps } from '../../parts/RowVariants/types';\nimport { StyledFullsizeGrid } from '../../styled';\nimport { InternalTypescriptRow } from '../../types/props';\nimport { DefaultRowContentRenderer } from './DefaultRowContentRenderer';\nimport { useRowRendererHandlers } from './useRowRendererHandlers';\nimport { useRowRendererProperties } from './useRowRendererProperties';\nimport { DropIndicator } from '../../parts/DropIndicator';\nimport { SortableItemContext } from '../../parts/HoC/SortableItemContext';\nimport { DATA_TESTID } from '../../configs/constants';\n\ninterface RowRendererProps {\n row: InternalTypescriptRow;\n compact?: boolean;\n itemIndex: number;\n isDragOverlay: boolean;\n minHeight: string;\n height: string;\n rowsLayout?: (string | number)[];\n colsLayout?: (string | number)[];\n CustomRowContentRenderer?: React.ComponentType<RowVariantProps>;\n focusedRowId: string | null;\n drilldownRowId: string | null;\n backgroundColor?: string;\n}\n\n// CSS don't let us modify the spacing between the dots, so one solution is to use SVG\nconst magicDottedBorder = (\n <svg width=\"100%\" height=\"1px\">\n <line\n x1=\"0\"\n y1=\"0\"\n x2=\"100%\"\n y2=\"0\"\n stroke=\"#B0B9C8FF\"\n strokeWidth=\"1.5\"\n strokeDasharray=\"0, 5\"\n strokeDashoffset=\"0\"\n strokeLinecap=\"round\"\n />\n </svg>\n);\n\nconst RowRenderer: React.ComponentType<RowRendererProps> = (props) => {\n const {\n row,\n itemIndex,\n minHeight = '36px',\n height = 'auto',\n rowsLayout = [1],\n CustomRowContentRenderer,\n focusedRowId,\n drilldownRowId,\n isDragOverlay,\n } = props;\n\n const ctx = useContext(DataTableContext);\n const { draggableProps } = useContext(SortableItemContext);\n const { flattenedData } = ctx;\n\n // ===========================================================================\n // Properties for the row\n // ===========================================================================\n\n const {\n userDataProperties,\n colsLayoutStyle,\n totalColumnsWidth,\n rowStyle,\n shouldAppendDottedBorder,\n dropIndicatorPosition,\n isDropValid,\n } = useRowRendererProperties({\n row,\n });\n\n // ===========================================================================\n // Handlers\n // ===========================================================================\n\n const { handleItemClick, handleKeyDown, handleOnBlur, handleOnFocus } = useRowRendererHandlers({\n row,\n itemIndex,\n items: flattenedData,\n draggableProps,\n isDragOverlay,\n drilldownRowId,\n });\n\n const rowContentProps: RowVariantProps = {\n ...props,\n ctx,\n focusedRowId,\n drilldownRowId,\n draggableProps,\n dropIndicatorPosition,\n isDropValid,\n };\n\n return (\n <StyledFullsizeGrid\n data-testid={DATA_TESTID.DATA_TABLE_ROW}\n key={row.uid}\n colsLayoutStyle={colsLayoutStyle}\n {...userDataProperties}\n totalColumnsWidth={totalColumnsWidth}\n style={rowStyle}\n onClick={handleItemClick}\n onKeyDown={handleKeyDown}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n data-expandable={Boolean(row.original.tableRowDetails)}\n data-is-row-expanded={row.isExpanded}\n rows={rowsLayout}\n minHeight={minHeight}\n height={height}\n >\n {CustomRowContentRenderer ? (\n <CustomRowContentRenderer {...rowContentProps} />\n ) : (\n <DefaultRowContentRenderer {...rowContentProps} key={row.uid} />\n )}\n {shouldAppendDottedBorder && !isDragOverlay && magicDottedBorder}\n <DropIndicator\n vertical={false}\n dropIndicatorPosition={dropIndicatorPosition}\n isDropValid={isDropValid}\n isLast={row.index === flattenedData.length - 1 && draggableProps && draggableProps.isDragging}\n />\n </StyledFullsizeGrid>\n );\n};\n\nexport { RowRenderer };\nexport default RowRenderer;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA;AACA,SAAgB,kBAAkB;AAClC,SAAS,wBAAwB;AAEjC,SAAS,0BAA0B;AAEnC,SAAS,iCAAiC;AAC1C,SAAS,8BAA8B;AACvC,SAAS,gCAAgC;AACzC,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAkB5B,MAAM,oBACJ,oBAAC;AAAA,EAAI,OAAM;AAAA,EAAO,QAAO;AAAA,EACvB,8BAAC;AAAA,IACC,IAAG;AAAA,IACH,IAAG;AAAA,IACH,IAAG;AAAA,IACH,IAAG;AAAA,IACH,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,iBAAgB;AAAA,IAChB,kBAAiB;AAAA,IACjB,eAAc;AAAA,GAChB;AAAA,CACF;AAGF,MAAM,cAAqD,CAAC,UAAU;AACpE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,aAAa,CAAC,CAAC;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,MAAM,WAAW,gBAAgB;AACvC,QAAM,EAAE,eAAe,IAAI,WAAW,mBAAmB;AACzD,QAAM,EAAE,cAAc,IAAI;AAM1B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,yBAAyB;AAAA,IAC3B;AAAA,EACF,CAAC;AAMD,QAAM,EAAE,iBAAiB,eAAe,cAAc,cAAc,IAAI,uBAAuB;AAAA,IAC7F;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,kBAAmC;AAAA,IACvC,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SACE,qBAAC;AAAA,IACC,eAAa,YAAY;AAAA,IAEzB;AAAA,IACC,GAAG;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,mBAAiB,QAAQ,IAAI,SAAS,eAAe;AAAA,IACrD,wBAAsB,IAAI;AAAA,IAC1B,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IAEC;AAAA,iCACC,oBAAC;AAAA,QAA0B,GAAG;AAAA,OAAiB,IAE/C,8BAAC;AAAA,QAA2B,GAAG;AAAA,QAAiB,KAAK,IAAI;AAAA,OAAK;AAAA,MAE/D,4BAA4B,CAAC,iBAAiB;AAAA,MAC/C,oBAAC;AAAA,QACC,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,QAAQ,IAAI,UAAU,cAAc,SAAS,KAAK,kBAAkB,eAAe;AAAA,OACrF;AAAA;AAAA,KA1BK,IAAI,GA2BX;AAEJ;AAGA,IAAO,sBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/exported-related/RowRenderer/useRowRendererProperties.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useContext, useMemo } from 'react';\nimport { ColsLayoutStyle } from '../../configs/constants';\nimport { DataTableContext } from '../../DataTableContext';\nimport { TypescriptRow } from '../../types/props';\nimport { useRowStyle } from './useRowStyle';\n\nexport const useRowRendererProperties = ({\n row,\n}: {\n row: TypescriptRow;\n}): {\n userDataProperties: Record<string, unknown>;\n colsLayoutStyle: ColsLayoutStyle;\n totalColumnsWidth: string | number;\n} & ReturnType<typeof useRowStyle> => {\n const {\n tableProps: { colsLayoutStyle },\n layoutHelpers: { totalColumnsWidth },\n } = useContext(DataTableContext);\n\n const userDataProperties = useMemo(\n () =>\n Object.keys(row.original).reduce((acc, cur) => {\n if (cur.startsWith('data-')) acc[cur] = row.original[cur];\n return acc;\n }, {}),\n [row],\n );\n\n const styleRelatedProps = useRowStyle(row);\n\n return {\n userDataProperties,\n colsLayoutStyle,\n totalColumnsWidth,\n ...styleRelatedProps,\n };\n};\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useContext, useMemo } from 'react';\nimport { ColsLayoutStyle } from '../../configs/constants';\nimport { DataTableContext } from '../../DataTableContext';\nimport { InternalTypescriptRow } from '../../types/props';\nimport { useRowStyle } from './useRowStyle';\n\nexport const useRowRendererProperties = ({\n row,\n}: {\n row: InternalTypescriptRow;\n}): {\n userDataProperties: Record<string, unknown>;\n colsLayoutStyle: ColsLayoutStyle;\n totalColumnsWidth: string | number | undefined;\n} & ReturnType<typeof useRowStyle> => {\n const {\n tableProps: { colsLayoutStyle },\n layoutHelpers: { totalColumnsWidth },\n } = useContext(DataTableContext);\n\n const userDataProperties = useMemo(\n () =>\n Object.keys(row.original).reduce((acc, cur) => {\n if (cur.startsWith('data-')) acc[cur] = row.original[cur];\n return acc;\n }, {}),\n [row],\n );\n\n const styleRelatedProps = useRowStyle(row);\n\n return {\n userDataProperties,\n colsLayoutStyle,\n totalColumnsWidth,\n ...styleRelatedProps,\n };\n};\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,YAAY,eAAe;AAEpC,SAAS,wBAAwB;AAEjC,SAAS,mBAAmB;AAErB,MAAM,2BAA2B,CAAC;AAAA,EACvC;AACF,MAMsC;AACpC,QAAM;AAAA,IACJ,YAAY,EAAE,gBAAgB;AAAA,IAC9B,eAAe,EAAE,kBAAkB;AAAA,EACrC,IAAI,WAAW,gBAAgB;AAE/B,QAAM,qBAAqB;AAAA,IACzB,MACE,OAAO,KAAK,IAAI,QAAQ,EAAE,OAAO,CAAC,KAAK,QAAQ;AAC7C,UAAI,IAAI,WAAW,OAAO;AAAG,YAAI,OAAO,IAAI,SAAS;AACrD,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACP,CAAC,GAAG;AAAA,EACN;AAEA,QAAM,oBAAoB,YAAY,GAAG;AAEzC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL;AACF;",
6
6
  "names": []
7
7
  }
@@ -22,10 +22,12 @@ const useRowStyle = (row) => {
22
22
  }, [row, flattenedData]);
23
23
  const rowStyle = useMemo(() => ({ borderTop, borderBottom }), [borderTop, borderBottom]);
24
24
  const dropIndicatorPosition = draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;
25
+ const isDropValid = draggableProps && draggableProps.isDropValid;
25
26
  return {
26
27
  rowStyle,
27
28
  shouldAppendDottedBorder,
28
- dropIndicatorPosition
29
+ dropIndicatorPosition,
30
+ isDropValid
29
31
  };
30
32
  };
31
33
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/exported-related/RowRenderer/useRowStyle.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useContext, useMemo } from 'react';\nimport DataTableContext from '../../DataTableContext';\nimport { SortableItemContext } from '../../parts/HoC/SortableItemContext';\nimport { TypescriptRow, DropIndicatorPosition } from '../../types/props';\n\nexport const useRowStyle = (\n row: TypescriptRow,\n): {\n rowStyle: Record<string, unknown>;\n shouldAppendDottedBorder: boolean;\n dropIndicatorPosition: DropIndicatorPosition;\n} => {\n const { flattenedData } = useContext(DataTableContext);\n\n const { draggableProps } = useContext(SortableItemContext);\n\n // ---------------------------------------------------------------------------\n // Border calculation\n // ---------------------------------------------------------------------------\n const [borderTop, borderBottom, shouldAppendDottedBorder]: [string, string, boolean] = useMemo(() => {\n if (row.original.dimsumHeaderValue) {\n return ['none', 'none', false];\n }\n if (row.isExpanded && row.original.subRows && row.depth === 0) {\n return ['1px solid #EBEDF0', 'none', true];\n }\n\n if (row.depth >= 1) {\n if (row.realIndex < flattenedData.length - 1 && flattenedData[row.realIndex + 1].depth === 0) {\n return ['none', '2px solid #EBEDF0', false];\n }\n return ['none', 'none', true];\n }\n\n return ['none', '1px solid #EBEDF0', false];\n }, [row, flattenedData]);\n\n const rowStyle = useMemo(() => ({ borderTop, borderBottom }), [borderTop, borderBottom]);\n\n const dropIndicatorPosition =\n draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;\n\n return {\n rowStyle,\n shouldAppendDottedBorder,\n dropIndicatorPosition,\n };\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,YAAY,eAAe;AACpC,OAAO,sBAAsB;AAC7B,SAAS,2BAA2B;AAG7B,MAAM,cAAc,CACzB,QAKG;AACH,QAAM,EAAE,cAAc,IAAI,WAAW,gBAAgB;AAErD,QAAM,EAAE,eAAe,IAAI,WAAW,mBAAmB;AAKzD,QAAM,CAAC,WAAW,cAAc,wBAAwB,IAA+B,QAAQ,MAAM;AACnG,QAAI,IAAI,SAAS,mBAAmB;AAClC,aAAO,CAAC,QAAQ,QAAQ,KAAK;AAAA,IAC/B;AACA,QAAI,IAAI,cAAc,IAAI,SAAS,WAAW,IAAI,UAAU,GAAG;AAC7D,aAAO,CAAC,qBAAqB,QAAQ,IAAI;AAAA,IAC3C;AAEA,QAAI,IAAI,SAAS,GAAG;AAClB,UAAI,IAAI,YAAY,cAAc,SAAS,KAAK,cAAc,IAAI,YAAY,GAAG,UAAU,GAAG;AAC5F,eAAO,CAAC,QAAQ,qBAAqB,KAAK;AAAA,MAC5C;AACA,aAAO,CAAC,QAAQ,QAAQ,IAAI;AAAA,IAC9B;AAEA,WAAO,CAAC,QAAQ,qBAAqB,KAAK;AAAA,EAC5C,GAAG,CAAC,KAAK,aAAa,CAAC;AAEvB,QAAM,WAAW,QAAQ,OAAO,EAAE,WAAW,aAAa,IAAI,CAAC,WAAW,YAAY,CAAC;AAEvF,QAAM,wBACJ,kBAAkB,eAAe,mCAAmC,eAAe;AAErF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useContext, useMemo } from 'react';\nimport DataTableContext from '../../DataTableContext';\nimport { SortableItemContext } from '../../parts/HoC/SortableItemContext';\nimport { InternalTypescriptRow, DropIndicatorPosition } from '../../types/props';\n\nexport const useRowStyle = (\n row: InternalTypescriptRow,\n): {\n rowStyle: Record<string, unknown>;\n shouldAppendDottedBorder: boolean;\n dropIndicatorPosition: false | DropIndicatorPosition;\n isDropValid: boolean;\n} => {\n const { flattenedData } = useContext(DataTableContext);\n\n const { draggableProps } = useContext(SortableItemContext);\n\n // ---------------------------------------------------------------------------\n // Border calculation\n // ---------------------------------------------------------------------------\n const [borderTop, borderBottom, shouldAppendDottedBorder]: [string, string, boolean] = useMemo(() => {\n if (row.original.dimsumHeaderValue) {\n return ['none', 'none', false];\n }\n if (row.isExpanded && row.original.subRows && row.depth === 0) {\n return ['1px solid #EBEDF0', 'none', true];\n }\n\n if (row.depth >= 1) {\n if (row.realIndex < flattenedData.length - 1 && flattenedData[row.realIndex + 1].depth === 0) {\n return ['none', '2px solid #EBEDF0', false];\n }\n return ['none', 'none', true];\n }\n\n return ['none', '1px solid #EBEDF0', false];\n }, [row, flattenedData]);\n\n const rowStyle = useMemo(() => ({ borderTop, borderBottom }), [borderTop, borderBottom]);\n\n const dropIndicatorPosition =\n draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;\n\n const isDropValid = draggableProps && draggableProps.isDropValid;\n\n return {\n rowStyle,\n shouldAppendDottedBorder,\n dropIndicatorPosition,\n isDropValid,\n };\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,YAAY,eAAe;AACpC,OAAO,sBAAsB;AAC7B,SAAS,2BAA2B;AAG7B,MAAM,cAAc,CACzB,QAMG;AACH,QAAM,EAAE,cAAc,IAAI,WAAW,gBAAgB;AAErD,QAAM,EAAE,eAAe,IAAI,WAAW,mBAAmB;AAKzD,QAAM,CAAC,WAAW,cAAc,wBAAwB,IAA+B,QAAQ,MAAM;AACnG,QAAI,IAAI,SAAS,mBAAmB;AAClC,aAAO,CAAC,QAAQ,QAAQ,KAAK;AAAA,IAC/B;AACA,QAAI,IAAI,cAAc,IAAI,SAAS,WAAW,IAAI,UAAU,GAAG;AAC7D,aAAO,CAAC,qBAAqB,QAAQ,IAAI;AAAA,IAC3C;AAEA,QAAI,IAAI,SAAS,GAAG;AAClB,UAAI,IAAI,YAAY,cAAc,SAAS,KAAK,cAAc,IAAI,YAAY,GAAG,UAAU,GAAG;AAC5F,eAAO,CAAC,QAAQ,qBAAqB,KAAK;AAAA,MAC5C;AACA,aAAO,CAAC,QAAQ,QAAQ,IAAI;AAAA,IAC9B;AAEA,WAAO,CAAC,QAAQ,qBAAqB,KAAK;AAAA,EAC5C,GAAG,CAAC,KAAK,aAAa,CAAC;AAEvB,QAAM,WAAW,QAAQ,OAAO,EAAE,WAAW,aAAa,IAAI,CAAC,WAAW,YAAY,CAAC;AAEvF,QAAM,wBACJ,kBAAkB,eAAe,mCAAmC,eAAe;AAErF,QAAM,cAAc,kBAAkB,eAAe;AAErD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -30,10 +30,10 @@ const StyledIndicator = styled.div`
30
30
  box-sizing: border-box;
31
31
  width: ${(props) => props.vertical ? "2px" : "100%"};
32
32
  height: ${(props) => props.vertical ? "100%" : "2px"};
33
- background-color: ${(props) => props.theme.colors.brand[600]};
33
+ background-color: ${({ isDropValid, theme }) => isDropValid ? theme.colors.brand[600] : theme.colors.danger[900]};
34
34
  z-index: ${ZIndexDataTable.DROP_INDICATOR};
35
35
  `;
36
- const CircleIndicator = (style) => /* @__PURE__ */ jsx("svg", {
36
+ const CircleIndicator = (style, isDropValid) => /* @__PURE__ */ jsx("svg", {
37
37
  height: "6",
38
38
  width: "6",
39
39
  style,
@@ -42,19 +42,21 @@ const CircleIndicator = (style) => /* @__PURE__ */ jsx("svg", {
42
42
  cy: "3",
43
43
  r: "3",
44
44
  strokeWidth: "0",
45
- fill: "#1E79C2"
45
+ fill: isDropValid ? "#1E79C2" : "#C64252"
46
46
  })
47
47
  });
48
- const DropIndicator = ({ vertical, dropIndicatorPosition, isLast }) => {
49
- if (![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(dropIndicatorPosition))
48
+ const DropIndicator = (props) => {
49
+ const { vertical, dropIndicatorPosition, isLast, isDropValid } = props;
50
+ if (dropIndicatorPosition === false || ![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(dropIndicatorPosition))
50
51
  return null;
51
52
  const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;
52
53
  return /* @__PURE__ */ jsxs(Fragment, {
53
54
  children: [
54
- CircleIndicator(getCircleStyles({ vertical, dropIndicatorPosition: safeDropIndicatorPosition })),
55
+ CircleIndicator(getCircleStyles({ ...props, dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid),
55
56
  /* @__PURE__ */ jsx(StyledIndicator, {
56
57
  vertical,
57
- dropIndicatorPosition: safeDropIndicatorPosition
58
+ dropIndicatorPosition: safeDropIndicatorPosition,
59
+ isDropValid
58
60
  })
59
61
  ]
60
62
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DropIndicator.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { ZIndexDataTable } from '../configs/zIndexInternalConfig';\nimport { DropIndicatorPosition } from '../types/props';\n\ninterface DropIndicatorProps {\n vertical: boolean;\n dropIndicatorPosition: DropIndicatorPosition;\n isLast?: boolean;\n}\n\nconst getPositionStyles = ({ dropIndicatorPosition, vertical }: DropIndicatorProps) => {\n if (vertical) {\n return `\n left: ${dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset'};\n right: ${dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset'};\n `;\n }\n return `\n top: ${dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset'};\n bottom: ${dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset'};\n `;\n};\n\nconst getCircleStyles = ({ dropIndicatorPosition, vertical }: DropIndicatorProps) => ({\n position: 'absolute',\n zIndex: ZIndexDataTable.DROP_INDICATOR,\n top: vertical || dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',\n bottom: vertical || dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',\n left: !vertical || dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',\n right: !vertical || dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',\n opacity: 1,\n});\n\nconst StyledIndicator = styled.div<DropIndicatorProps>`\n position: absolute;\n ${getPositionStyles}\n box-sizing: border-box;\n width: ${(props) => (props.vertical ? '2px' : '100%')};\n height: ${(props) => (props.vertical ? '100%' : '2px')};\n background-color: ${(props) => props.theme.colors.brand[600]};\n z-index: ${ZIndexDataTable.DROP_INDICATOR};\n`;\n\nconst CircleIndicator = (style: Record<string, unknown>) => (\n <svg height=\"6\" width=\"6\" style={style}>\n <circle cx=\"3\" cy=\"3\" r=\"3\" strokeWidth=\"0\" fill=\"#1E79C2\" />\n </svg>\n);\n\nconst DropIndicator = ({ vertical, dropIndicatorPosition, isLast }: DropIndicatorProps): JSX.Element => {\n if (![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(dropIndicatorPosition)) return null;\n\n const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;\n\n return (\n <>\n {CircleIndicator(getCircleStyles({ vertical, dropIndicatorPosition: safeDropIndicatorPosition }))}\n <StyledIndicator vertical={vertical} dropIndicatorPosition={safeDropIndicatorPosition} />\n </>\n );\n};\n\nexport { DropIndicator };\nexport default DropIndicator;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AAQtC,MAAM,oBAAoB,CAAC,EAAE,uBAAuB,SAAS,MAA0B;AACrF,MAAI,UAAU;AACZ,WAAO;AAAA,cACG,0BAA0B,sBAAsB,SAAS,MAAM;AAAA,eAC9D,0BAA0B,sBAAsB,QAAQ,MAAM;AAAA;AAAA,EAE3E;AACA,SAAO;AAAA,aACI,0BAA0B,sBAAsB,SAAS,MAAM;AAAA,gBAC5D,0BAA0B,sBAAsB,QAAQ,MAAM;AAAA;AAE9E;AAEA,MAAM,kBAAkB,CAAC,EAAE,uBAAuB,SAAS,OAA2B;AAAA,EACpF,UAAU;AAAA,EACV,QAAQ,gBAAgB;AAAA,EACxB,KAAK,YAAY,0BAA0B,sBAAsB,QAAQ,UAAU;AAAA,EACnF,QAAQ,YAAY,0BAA0B,sBAAsB,SAAS,UAAU;AAAA,EACvF,MAAM,CAAC,YAAY,0BAA0B,sBAAsB,QAAQ,UAAU;AAAA,EACrF,OAAO,CAAC,YAAY,0BAA0B,sBAAsB,SAAS,UAAU;AAAA,EACvF,SAAS;AACX;AAEA,MAAM,kBAAkB,OAAO;AAAA;AAAA,IAE3B;AAAA;AAAA,WAEO,CAAC,UAAW,MAAM,WAAW,QAAQ;AAAA,YACpC,CAAC,UAAW,MAAM,WAAW,SAAS;AAAA,sBAC5B,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM;AAAA,aAC7C,gBAAgB;AAAA;AAG7B,MAAM,kBAAkB,CAAC,UACvB,oBAAC;AAAA,EAAI,QAAO;AAAA,EAAI,OAAM;AAAA,EAAI;AAAA,EACxB,8BAAC;AAAA,IAAO,IAAG;AAAA,IAAI,IAAG;AAAA,IAAI,GAAE;AAAA,IAAI,aAAY;AAAA,IAAI,MAAK;AAAA,GAAU;AAAA,CAC7D;AAGF,MAAM,gBAAgB,CAAC,EAAE,UAAU,uBAAuB,OAAO,MAAuC;AACtG,MAAI,CAAC,CAAC,sBAAsB,OAAO,sBAAsB,MAAM,EAAE,SAAS,qBAAqB;AAAG,WAAO;AAEzG,QAAM,4BAA4B,SAAS,sBAAsB,SAAS;AAE1E,SACE;AAAA,IACG;AAAA,sBAAgB,gBAAgB,EAAE,UAAU,uBAAuB,0BAA0B,CAAC,CAAC;AAAA,MAChG,oBAAC;AAAA,QAAgB;AAAA,QAAoB,uBAAuB;AAAA,OAA2B;AAAA;AAAA,GACzF;AAEJ;AAGA,IAAO,wBAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { ZIndexDataTable } from '../configs/zIndexInternalConfig';\nimport { DropIndicatorPosition } from '../types/props';\n\ninterface DropIndicatorProps {\n vertical: boolean;\n dropIndicatorPosition: false | DropIndicatorPosition;\n isDropValid: boolean;\n isLast?: boolean;\n}\n\nconst getPositionStyles = ({ dropIndicatorPosition, vertical }: DropIndicatorProps) => {\n if (vertical) {\n return `\n left: ${dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset'};\n right: ${dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset'};\n `;\n }\n return `\n top: ${dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset'};\n bottom: ${dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset'};\n `;\n};\n\nconst getCircleStyles = ({ dropIndicatorPosition, vertical }: DropIndicatorProps) => ({\n position: 'absolute',\n zIndex: ZIndexDataTable.DROP_INDICATOR,\n top: vertical || dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',\n bottom: vertical || dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',\n left: !vertical || dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',\n right: !vertical || dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',\n opacity: 1,\n});\n\nconst StyledIndicator = styled.div<DropIndicatorProps>`\n position: absolute;\n ${getPositionStyles}\n box-sizing: border-box;\n width: ${(props) => (props.vertical ? '2px' : '100%')};\n height: ${(props) => (props.vertical ? '100%' : '2px')};\n background-color: ${({ isDropValid, theme }) => (isDropValid ? theme.colors.brand[600] : theme.colors.danger[900])};\n z-index: ${ZIndexDataTable.DROP_INDICATOR};\n`;\n\nconst CircleIndicator = (style: Record<string, unknown>, isDropValid: boolean) => (\n <svg height=\"6\" width=\"6\" style={style}>\n <circle cx=\"3\" cy=\"3\" r=\"3\" strokeWidth=\"0\" fill={isDropValid ? '#1E79C2' : '#C64252'} />\n </svg>\n);\n\nconst DropIndicator: React.ComponentType<DropIndicatorProps> = (props) => {\n const { vertical, dropIndicatorPosition, isLast, isDropValid } = props;\n if (\n dropIndicatorPosition === false ||\n ![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(dropIndicatorPosition)\n )\n return null;\n\n const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;\n\n return (\n <>\n {CircleIndicator(getCircleStyles({ ...props, dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid)}\n <StyledIndicator\n vertical={vertical}\n dropIndicatorPosition={safeDropIndicatorPosition}\n isDropValid={isDropValid}\n />\n </>\n );\n};\n\nexport { DropIndicator };\nexport default DropIndicator;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AAStC,MAAM,oBAAoB,CAAC,EAAE,uBAAuB,SAAS,MAA0B;AACrF,MAAI,UAAU;AACZ,WA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B;AAE3F,WAAO;AAET,QAAM,4BAA4B,SAAS,sBAAsB,SAAS;AAE1E,SACE;AAAA,IACG;AAAA,sBAAgB,gBAAgB,EAAE,GAAG,OAAO,uBAAuB,0BAA0B,CAAC,GAAG,WAAW;AAAA,MAC7G,oBAAC;AAAA,QACC;AAAA,QACA,uBAAuB;AAAA,QACvB;AAAA,OACF;AAAA;AAAA,GACF;AAEJ;AAGA,IAAO,wBAAQ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { createContext } from "react";
3
+ const DnDTreeContext = createContext({});
4
+ export {
5
+ DnDTreeContext
6
+ };
7
+ //# sourceMappingURL=DnDTreeContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/DnDTreeContext.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport { DropIndicatorPosition } from '../../types/props';\n\nexport type DnDTreeContextType = {\n depth: number;\n activeIndex: number;\n visibleItems: unknown[];\n dropIndicatorPosition: DropIndicatorPosition;\n lastActiveId: string | null;\n setLastActiveId: React.Dispatch<React.SetStateAction<string | null>>;\n isDropValid: boolean;\n};\n\nexport const DnDTreeContext = createContext<DnDTreeContextType>({} as unknown as DnDTreeContextType);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB;AAavB,MAAM,iBAAiB,cAAkC,CAAC,CAAkC;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/SortableItemContext.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport { DraggablePropsT } from 'types/props';\n\nexport type SortableItemContextType = { draggableProps: DraggablePropsT };\n\n/** Context for cross component communication */\nexport const SortableItemContext = createContext<SortableItemContextType>({\n draggableProps: false,\n});\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport { DraggablePropsT } from '../../types/props';\n\nexport type SortableItemContextType = { draggableProps: DraggablePropsT };\n\n/** Context for cross component communication */\nexport const SortableItemContext = createContext<SortableItemContextType>({\n draggableProps: false,\n});\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB;AAMvB,MAAM,sBAAsB,cAAuC;AAAA,EACxE,gBAAgB;AAClB,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,22 +1,14 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import React2, { createContext, useCallback } from "react";
4
- import { DataTableContext } from "../../DataTableContext";
3
+ import React2, { useCallback, useEffect, useMemo } from "react";
5
4
  import { DndContext, DragOverlay, SortableContext, useTreeDndkitConfig } from "@elliemae/ds-drag-and-drop";
6
- import { Row } from "../Row";
7
5
  import { createPortal } from "react-dom";
8
- import { DropIndicatorPosition } from "../../types/props";
9
- const DnDTreeContext = createContext({
10
- depth: void 0,
11
- activeIndex: void 0,
12
- visibleItems: void 0,
13
- dropIndicatorPosition: DropIndicatorPosition.None,
14
- lastActiveId: void 0,
15
- setLastActiveId: void 0
16
- });
6
+ import { DataTableContext } from "../../DataTableContext";
7
+ import { Row } from "../Row";
8
+ import { DnDTreeContext } from "./DnDTreeContext";
17
9
  const withConditionalDnDRowContext = (Component) => (props) => {
18
10
  const {
19
- tableProps: { dragAndDropRows, isExpandable, onRowsReorder, maxDragAndDropLevel },
11
+ tableProps: { dragAndDropRows, isExpandable, onRowsReorder, maxDragAndDropLevel, getIsDropValid },
20
12
  flattenedData,
21
13
  allDataFlattened
22
14
  } = React2.useContext(DataTableContext);
@@ -43,16 +35,40 @@ const withConditionalDnDRowContext = (Component) => (props) => {
43
35
  },
44
36
  [onRowsReorder]
45
37
  );
46
- const { dndContextProps, sortableContextProps, activeId, activeIndex, depth, dropIndicatorPosition, visibleItems } = useTreeDndkitConfig({
38
+ const {
39
+ dndContextProps,
40
+ sortableContextProps,
41
+ activeId,
42
+ activeIndex,
43
+ depth,
44
+ dropIndicatorPosition,
45
+ visibleItems,
46
+ isDropValid
47
+ } = useTreeDndkitConfig({
47
48
  flattenedItems: allDataFlattened,
48
49
  visibleItems: flattenedData,
49
50
  isHorizontalDnD: false,
50
51
  isExpandable,
51
52
  onReorder,
52
- maxDragAndDropLevel
53
+ maxDragAndDropLevel,
54
+ getIsDropValid
53
55
  });
54
- if (lastActiveId !== activeId && activeId)
55
- setLastActiveId(activeId);
56
+ useEffect(() => {
57
+ if (activeId)
58
+ setLastActiveId(activeId);
59
+ }, [activeId]);
60
+ const ctx = useMemo(
61
+ () => ({
62
+ activeIndex,
63
+ depth,
64
+ visibleItems,
65
+ dropIndicatorPosition,
66
+ lastActiveId,
67
+ setLastActiveId,
68
+ isDropValid
69
+ }),
70
+ [activeIndex, depth, visibleItems, dropIndicatorPosition, lastActiveId, isDropValid]
71
+ );
56
72
  if (dragAndDropRows)
57
73
  return /* @__PURE__ */ jsxs(DndContext, {
58
74
  ...dndContextProps,
@@ -60,14 +76,7 @@ const withConditionalDnDRowContext = (Component) => (props) => {
60
76
  /* @__PURE__ */ jsx(SortableContext, {
61
77
  ...sortableContextProps,
62
78
  children: /* @__PURE__ */ jsx(DnDTreeContext.Provider, {
63
- value: {
64
- activeIndex,
65
- depth,
66
- visibleItems,
67
- dropIndicatorPosition,
68
- lastActiveId,
69
- setLastActiveId
70
- },
79
+ value: ctx,
71
80
  children: /* @__PURE__ */ jsx(Component, {
72
81
  ...props
73
82
  })
@@ -90,7 +99,6 @@ const withConditionalDnDRowContext = (Component) => (props) => {
90
99
  });
91
100
  };
92
101
  export {
93
- DnDTreeContext,
94
102
  withConditionalDnDRowContext
95
103
  };
96
104
  //# sourceMappingURL=withConditionalDnDRowContext.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDRowContext.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { createContext, useCallback } from 'react';\nimport { DataTableContext } from '../../DataTableContext';\nimport { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { DndContext, DragOverlay, SortableContext, useTreeDndkitConfig } from '@elliemae/ds-drag-and-drop';\nimport { Item } from '../../helpers/dndkit/tree/types';\nimport { Row } from '../Row';\nimport { createPortal } from 'react-dom';\nimport { DropIndicatorPosition } from '../../types/props';\n\ntype DnDTreeContextType = {\n depth: number;\n activeIndex: number;\n visibleItems: unknown[];\n dropIndicatorPosition: DropIndicatorPosition;\n lastActiveId: string;\n setLastActiveId: React.Dispatch<React.SetStateAction<string>>;\n};\n\nexport const DnDTreeContext = createContext<DnDTreeContextType>({\n depth: undefined,\n activeIndex: undefined,\n visibleItems: undefined,\n dropIndicatorPosition: DropIndicatorPosition.None,\n lastActiveId: undefined,\n setLastActiveId: undefined,\n});\n\n// only wraps in \"DnDContext\" and \"DnDTreeContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDRowContext: FunctionalHOC = (Component) => (props) => {\n const {\n tableProps: { dragAndDropRows, isExpandable, onRowsReorder, maxDragAndDropLevel },\n flattenedData,\n allDataFlattened,\n } = React.useContext(DataTableContext);\n\n const [lastActiveId, setLastActiveId] = React.useState<string>(null);\n\n const onReorder = useCallback(\n (newData: Item[], indexes: { targetIndex: number; fromIndex: number }, considerExpanding: string) => {\n // Pull the row's original data into an object\n const nodes = {};\n newData.forEach((row) => {\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [];\n newData.forEach((row) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (row.parentId) {\n const parentNode = nodes[row.parentId];\n if (parentNode?.subRows) parentNode.subRows.push(row.original);\n else parentNode.subRows = [row.original];\n } else newUserData.push(row.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onRowsReorder(newUserData, indexes, considerExpanding);\n },\n [onRowsReorder],\n );\n\n const { dndContextProps, sortableContextProps, activeId, activeIndex, depth, dropIndicatorPosition, visibleItems } =\n useTreeDndkitConfig({\n flattenedItems: allDataFlattened,\n visibleItems: flattenedData,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n });\n\n if (lastActiveId !== activeId && activeId) setLastActiveId(activeId);\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider\n value={{\n activeIndex,\n depth,\n visibleItems,\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n }}\n >\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }}>\n {activeId ? <Row row={flattenedData.find((row) => row.uid === activeId)} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,OAAOA,UAAS,eAAe,mBAAmB;AAClD,SAAS,wBAAwB;AAEjC,SAAS,YAAY,aAAa,iBAAiB,2BAA2B;AAE9E,SAAS,WAAW;AACpB,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AAW/B,MAAM,iBAAiB,cAAkC;AAAA,EAC9D,OAAO;AAAA,EACP,aAAa;AAAA,EACb,cAAc;AAAA,EACd,uBAAuB,sBAAsB;AAAA,EAC7C,cAAc;AAAA,EACd,iBAAiB;AACnB,CAAC;AAGM,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM;AAAA,IACJ,YAAY,EAAE,iBAAiB,cAAc,eAAe,oBAAoB;AAAA,IAChF;AAAA,IACA;AAAA,EACF,IAAIA,OAAM,WAAW,gBAAgB;AAErC,QAAM,CAAC,cAAc,eAAe,IAAIA,OAAM,SAAiB,IAAI;AAEnE,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AAG,eAAa;AAAA,aAAC,IAAK;AAAA,WAC9F;AAAA,UACA,SAAS;AAAA,QACX;AAAA;AAAA,KACF;AAEJ,SAAO,oBAAC;AAAA,IAAW,GAAG;AAAA,GAAO;AAC/B;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport { DndContext, DragOverlay, SortableContext, useTreeDndkitConfig } from '@elliemae/ds-drag-and-drop';\nimport { createPortal } from 'react-dom';\nimport { DataTableContext } from '../../DataTableContext';\nimport { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { Row } from '../Row';\nimport { DnDTreeContext } from './DnDTreeContext';\n\n// only wraps in \"DnDContext\" and \"DnDTreeContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDRowContext: FunctionalHOC = (Component) => (props) => {\n const {\n tableProps: { dragAndDropRows, isExpandable, onRowsReorder, maxDragAndDropLevel, getIsDropValid },\n flattenedData,\n allDataFlattened,\n } = React.useContext(DataTableContext);\n\n const [lastActiveId, setLastActiveId] = React.useState<string | null>(null);\n\n const onReorder = useCallback(\n (newData: unknown, indexes: { targetIndex: number; fromIndex: number }, considerExpanding: string) => {\n // Pull the row's original data into an object\n const nodes = {};\n newData.forEach((row) => {\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [];\n newData.forEach((row) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (row.parentId) {\n const parentNode = nodes[row.parentId];\n if (parentNode?.subRows) parentNode.subRows.push(row.original);\n else parentNode.subRows = [row.original];\n } else newUserData.push(row.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onRowsReorder(newUserData, indexes, considerExpanding);\n },\n [onRowsReorder],\n );\n\n const {\n dndContextProps,\n sortableContextProps,\n activeId,\n activeIndex,\n depth,\n dropIndicatorPosition,\n visibleItems,\n isDropValid,\n } = useTreeDndkitConfig({\n flattenedItems: allDataFlattened,\n visibleItems: flattenedData,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid,\n });\n\n useEffect(() => {\n if (activeId) setLastActiveId(activeId);\n }, [activeId]);\n\n const ctx = useMemo(\n () => ({\n activeIndex,\n depth,\n visibleItems,\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n isDropValid,\n }),\n [activeIndex, depth, visibleItems, dropIndicatorPosition, lastActiveId, isDropValid],\n );\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider value={ctx}>\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }}>\n {activeId ? <Row row={flattenedData.find((row) => row.uid === activeId)} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,OAAOA,UAAS,aAAa,WAAW,eAAe;AACvD,SAAS,YAAY,aAAa,iBAAiB,2BAA2B;AAC9E,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAEjC,SAAS,WAAW;AACpB,SAAS,sBAAsB;AAGxB,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM;AAAA,IACJ,YAAY,EAAE,iBAAiB,cAAc,eAAe,qBAAqB,eAAe;AAAA,IAChG;AAAA,IACA;AAAA,EACF,IAAIA,OAAM,WAAW,gBAAgB;AAErC,QAAM,CAAC,cAAc,eAAe,IAAIA,OAAM,SAAwB,IAAI;AAE1E,QAAM,YAAY;AAAA,IAChB,CAAC,SAAkB,SAAqD,sBAA8B;AAEpG,YAAM,QAAQ,CAAC;AACf,cAAQ,QAAQ,CAAC,QAAQ;AACvB,eAAO,IAAI,SAAS;AACpB,cAAM,IAAI,OAAO,IAAI;AAAA,MACvB,CAAC;AACD,YAAM,cAAc,CAAC;AACrB,cAAQ,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AA,aAAC,IAAK;AAAA,WAC9F;AAAA,UACA,SAAS;AAAA,QACX;AAAA;AAAA,KACF;AAEJ,SAAO,oBAAC;AAAA,IAAW,GAAG;AAAA,GAAO;AAC/B;",
6
6
  "names": ["React"]
7
7
  }
@@ -3,13 +3,13 @@ import { jsx } from "react/jsx-runtime";
3
3
  import { useContext, useMemo } from "react";
4
4
  import { useSortable } from "@elliemae/ds-drag-and-drop";
5
5
  import { DataTableContext } from "../../DataTableContext";
6
- import { DnDTreeContext } from "./withConditionalDnDRowContext";
6
+ import { DnDTreeContext } from "./DnDTreeContext";
7
7
  import { SortableItemContext } from "./SortableItemContext";
8
8
  const withDnDSortableRowContext = (Component) => (props) => {
9
9
  const {
10
10
  tableProps: { dragAndDropRows }
11
11
  } = useContext(DataTableContext);
12
- const { dropIndicatorPosition, lastActiveId, setLastActiveId } = useContext(DnDTreeContext);
12
+ const { dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid } = useContext(DnDTreeContext);
13
13
  const draggableOptions = useMemo(
14
14
  () => ({
15
15
  id: props.row.uid
@@ -26,7 +26,8 @@ const withDnDSortableRowContext = (Component) => (props) => {
26
26
  shouldShowDropIndicatorPosition: overIndex === index,
27
27
  dropIndicatorPosition,
28
28
  lastActiveId,
29
- setLastActiveId
29
+ setLastActiveId,
30
+ isDropValid
30
31
  };
31
32
  }, [dragAndDropRows, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId]);
32
33
  const ctx = useMemo(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withDnDSortableRowContext.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { cloneElement, useContext, useEffect, useMemo } from 'react';\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport { DataTableContext } from '../../DataTableContext';\nimport { DnDTreeContext } from './withConditionalDnDRowContext';\nimport { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { SortableItemContext, SortableItemContextType } from './SortableItemContext';\n\nexport const withDnDSortableRowContext: FunctionalHOC = (Component) => (props: any) => {\n const {\n tableProps: { dragAndDropRows },\n } = useContext(DataTableContext);\n const { dropIndicatorPosition, lastActiveId, setLastActiveId } = useContext(DnDTreeContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.row.uid,\n }),\n [props.row],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!dragAndDropRows) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n };\n }, [dragAndDropRows, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId]);\n\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAA8B,YAAuB,eAAe;AACpE,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAE/B,SAAS,2BAAoD;AAEtD,MAAM,4BAA2C,CAAC,cAAc,CAAC,UAAe;AACrF,QAAM;AAAA,IACJ,YAAY,EAAE,gBAAgB;AAAA,EAChC,IAAI,WAAW,gBAAgB;AAC/B,QAAM,EAAE,uBAAuB,cAAc,gBAAgB,IAAI,WAAW,cAAc;AAG1F,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,MAAM,IAAI;AAAA,IAChB;AAAA,IACA,CAAC,MAAM,GAAG;AAAA,EACZ;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,CAAC;AAAiB,aAAO;AAE7B,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,oBAAoB,uBAAuB,cAAc,eAAe,CAAC;AAK9F,QAAM,MAA+B;AAAA,IACnC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SACE,oBAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,IACnC,8BAAC;AAAA,MAAW,GAAG;AAAA,KAAO;AAAA,GACxB;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport { DataTableContext } from '../../DataTableContext';\nimport { DnDTreeContext } from './DnDTreeContext';\nimport { FunctionalHOC } from '../../types/FunctionalHoC';\nimport { SortableItemContext, SortableItemContextType } from './SortableItemContext';\n\nexport const withDnDSortableRowContext: FunctionalHOC = (Component) => (props: any) => {\n const {\n tableProps: { dragAndDropRows },\n } = useContext(DataTableContext);\n const { dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid } = useContext(DnDTreeContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.row.uid,\n }),\n [props.row],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!dragAndDropRows) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n isDropValid,\n };\n }, [dragAndDropRows, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId]);\n\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,eAAe;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAE/B,SAAS,2BAAoD;AAEtD,MAAM,4BAA2C,CAAC,cAAc,CAAC,UAAe;AACrF,QAAM;AAAA,IACJ,YAAY,EAAE,gBAAgB;AAAA,EAChC,IAAI,WAAW,gBAAgB;AAC/B,QAAM,EAAE,uBAAuB,cAAc,iBAAiB,YAAY,IAAI,WAAW,cAAc;AAGvG,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,MAAM,IAAI;AAAA,IAChB;AAAA,IACA,CAAC,MAAM,GAAG;AAAA,EACZ;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,CAAC;AAAiB,aAAO;AAE7B,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,oBAAoB,uBAAuB,cAAc,eAAe,CAAC;AAK9F,QAAM,MAA+B;AAAA,IACnC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SACE,oBAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,IACnC,8BAAC;AAAA,MAAW,GAAG;AAAA,KAAO;AAAA,GACxB;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,8 @@ import { Fragment, jsx } from "react/jsx-runtime";
3
3
  import { useContext, useMemo } from "react";
4
4
  import { RowWithContext as Row } from "./Row";
5
5
  import { DataTableContext } from "../DataTableContext";
6
- import { DnDTreeContext, withConditionalDnDRowContext } from "./HoC/withConditionalDnDRowContext";
6
+ import { withConditionalDnDRowContext } from "./HoC/withConditionalDnDRowContext";
7
+ import { DnDTreeContext } from "./HoC/DnDTreeContext";
7
8
  import { addCellData } from "../helpers";
8
9
  const Rows = () => {
9
10
  const {
@@ -12,8 +13,8 @@ const Rows = () => {
12
13
  flattenedData,
13
14
  visibleColumns
14
15
  } = useContext(DataTableContext);
15
- const { visibleItems } = useContext(DnDTreeContext);
16
- const items = visibleItems || flattenedData;
16
+ const ctx = useContext(DnDTreeContext);
17
+ const items = ctx?.visibleItems || flattenedData;
17
18
  const PureVirtualizedRows = useMemo(
18
19
  () => /* @__PURE__ */ jsx(Fragment, {
19
20
  children: virtualItems.map((virtualItem) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Rows.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-underscore-dangle */\nimport React, { useContext, useMemo } from 'react';\n\nimport { RowWithContext as Row } from './Row';\nimport { DataTableContext } from '../DataTableContext';\nimport { DnDTreeContext, withConditionalDnDRowContext } from './HoC/withConditionalDnDRowContext';\nimport { addCellData } from '../helpers';\n\nconst Rows = (): JSX.Element => {\n const {\n virtualListHelpers: { virtualItems },\n layoutHelpers: { totalColumnsWidth },\n flattenedData,\n visibleColumns,\n } = useContext(DataTableContext);\n\n const { visibleItems } = useContext(DnDTreeContext);\n\n const items = visibleItems || flattenedData;\n\n const PureVirtualizedRows = useMemo(\n () => (\n <>\n {virtualItems.map((virtualItem) => {\n const { index, measureRef, start } = virtualItem;\n const row = items[index];\n if (!row) return null;\n addCellData(row, visibleColumns);\n const style = {\n position: 'absolute',\n top: `${start}px`,\n left: 0,\n width: totalColumnsWidth,\n };\n const rowProps = {\n key: `ds-table-row-${row.uid}`,\n row,\n measureRef,\n index, // this is consumed by the DnD HOC\n itemIndex: index,\n itemWrapperStyle: style,\n };\n return <Row {...rowProps} />;\n })}\n </>\n ),\n [virtualItems, items, visibleColumns, totalColumnsWidth],\n );\n\n return PureVirtualizedRows;\n};\n\nRows.propTypes = {};\n\nexport const RowsWithContext = withConditionalDnDRowContext(Rows);\nexport default RowsWithContext;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,YAAY,eAAe;AAE3C,SAAS,kBAAkB,WAAW;AACtC,SAAS,wBAAwB;AACjC,SAAS,gBAAgB,oCAAoC;AAC7D,SAAS,mBAAmB;AAE5B,MAAM,OAAO,MAAmB;AAC9B,QAAM;AAAA,IACJ,oBAAoB,EAAE,aAAa;AAAA,IACnC,eAAe,EAAE,kBAAkB;AAAA,IACnC;AAAA,IACA;AAAA,EACF,IAAI,WAAW,gBAAgB;AAE/B,QAAM,EAAE,aAAa,IAAI,WAAW,cAAc;AAElD,QAAM,QAAQ,gBAAgB;AAE9B,QAAM,sBAAsB;AAAA,IAC1B,MACE;AAAA,MACG,uBAAa,IAAI,CAAC,gBAAgB;AACjC,cAAM,EAAE,OAAO,YAAY,MAAM,IAAI;AACrC,cAAM,MAAM,MAAM;AAClB,YAAI,CAAC;AAAK,iBAAO;AACjB,oBAAY,KAAK,cAAc;AAC/B,cAAM,QAAQ;AAAA,UACZ,UAAU;AAAA,UACV,KAAK,GAAG;AAAA,UACR,MAAM;AAAA,UACN,OAAO;AAAA,QACT;AACA,cAAM,WAAW;AAAA,UACf,KAAK,gBAAgB,IAAI;AAAA,UACzB;AAAA,UACA;AAAA,UACA;AAAA,UACA,WAAW;AAAA,UACX,kBAAkB;AAAA,QACpB;AACA,eAAO,oBAAC;AAAA,UAAK,GAAG;AAAA,SAAU;AAAA,MAC5B,CAAC;AAAA,KACH;AAAA,IAEF,CAAC,cAAc,OAAO,gBAAgB,iBAAiB;AAAA,EACzD;AAEA,SAAO;AACT;AAEA,KAAK,YAAY,CAAC;AAEX,MAAM,kBAAkB,6BAA6B,IAAI;AAChE,IAAO,eAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-underscore-dangle */\nimport React, { useContext, useMemo } from 'react';\n\nimport { RowWithContext as Row } from './Row';\nimport { DataTableContext } from '../DataTableContext';\nimport { withConditionalDnDRowContext } from './HoC/withConditionalDnDRowContext';\nimport { DnDTreeContext } from './HoC/DnDTreeContext';\nimport { addCellData } from '../helpers';\n\nconst Rows = (): JSX.Element => {\n const {\n virtualListHelpers: { virtualItems },\n layoutHelpers: { totalColumnsWidth },\n flattenedData,\n visibleColumns,\n } = useContext(DataTableContext);\n\n const ctx = useContext(DnDTreeContext);\n\n const items = ctx?.visibleItems || flattenedData;\n\n const PureVirtualizedRows = useMemo(\n () => (\n <>\n {virtualItems.map((virtualItem) => {\n const { index, measureRef, start } = virtualItem;\n const row = items[index];\n if (!row) return null;\n addCellData(row, visibleColumns);\n const style = {\n position: 'absolute',\n top: `${start}px`,\n left: 0,\n width: totalColumnsWidth,\n };\n const rowProps = {\n key: `ds-table-row-${row.uid}`,\n row,\n measureRef,\n index, // this is consumed by the DnD HOC\n itemIndex: index,\n itemWrapperStyle: style,\n };\n return <Row {...rowProps} />;\n })}\n </>\n ),\n [virtualItems, items, visibleColumns, totalColumnsWidth],\n );\n\n return PureVirtualizedRows;\n};\n\nRows.propTypes = {};\n\nexport const RowsWithContext = withConditionalDnDRowContext(Rows);\nexport default RowsWithContext;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,YAAY,eAAe;AAE3C,SAAS,kBAAkB,WAAW;AACtC,SAAS,wBAAwB;AACjC,SAAS,oCAAoC;AAC7C,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAE5B,MAAM,OAAO,MAAmB;AAC9B,QAAM;AAAA,IACJ,oBAAoB,EAAE,aAAa;AAAA,IACnC,eAAe,EAAE,kBAAkB;AAAA,IACnC;AAAA,IACA;AAAA,EACF,IAAI,WAAW,gBAAgB;AAE/B,QAAM,MAAM,WAAW,cAAc;AAErC,QAAM,QAAQ,KAAK,gBAAgB;AAEnC,QAAM,sBAAsB;AAAA,IAC1B,MACE;AAAA,MACG,uBAAa,IAAI,CAAC,gBAAgB;AACjC,cAAM,EAAE,OAAO,YAAY,MAAM,IAAI;AACrC,cAAM,MAAM,MAAM;AAClB,YAAI,CAAC;AAAK,iBAAO;AACjB,oBAAY,KAAK,cAAc;AAC/B,cAAM,QAAQ;AAAA,UACZ,UAAU;AAAA,UACV,KAAK,GAAG;AAAA,UACR,MAAM;AAAA,UACN,OAAO;AAAA,QACT;AACA,cAAM,WAAW;AAAA,UACf,KAAK,gBAAgB,IAAI;AAAA,UACzB;AAAA,UACA;AAAA,UACA;AAAA,UACA,WAAW;AAAA,UACX,kBAAkB;AAAA,QACpB;AACA,eAAO,oBAAC;AAAA,UAAK,GAAG;AAAA,SAAU;AAAA,MAC5B,CAAC;AAAA,KACH;AAAA,IAEF,CAAC,cAAc,OAAO,gBAAgB,iBAAiB;AAAA,EACzD;AAEA,SAAO;AACT;AAEA,KAAK,YAAY,CAAC;AAEX,MAAM,kBAAkB,6BAA6B,IAAI;AAChE,IAAO,eAAQ;",
6
6
  "names": []
7
7
  }