@reltio/components 1.4.2018 → 1.4.2020
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/BarChart/helpers.d.ts +2 -2
- package/BasicTable/IntegrationBasicTable.test.js +6 -18
- package/EditModeAttributesView/IntegrationEditModeAttributesView.test.js +2 -5
- package/HierarchyNodeTitle/useEntityDetails.js +3 -0
- package/HierarchyNodeTitle/useEntityDetails.test.js +28 -0
- package/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +2 -5
- package/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.js +33 -22
- package/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.test.js +120 -112
- package/InlineSimpleAttribute/InlineSimpleAttribute.js +1 -1
- package/LineChart/helpers.d.ts +2 -2
- package/PieChart/PieChart.test.js +4 -0
- package/ProfileBandNavigation/useSearchNavigation.js +11 -3
- package/ProfileBandNavigation/useSearchNavigation.test.js +176 -0
- package/UploadImageDialog/UploadImageDialog.specs.js +1 -4
- package/UploadImageDialog/components/TargetBox/TargetBox.js +31 -20
- package/UploadImageDialog/components/TargetBox/TargetBox.specs.d.ts +1 -1
- package/UploadImageDialog/components/TargetBox/TargetBox.specs.js +57 -16
- package/UploadImageDialog/components/TargetBox/styles.js +2 -1
- package/VerticalHeadingsTable/DndVerticalHeadingsTable.test.js +114 -0
- package/VerticalHeadingsTable/VerticalHeadingsTable.d.ts +2 -1
- package/VerticalHeadingsTable/VerticalHeadingsTable.js +10 -13
- package/VerticalHeadingsTable/VerticalHeadingsTable.test.js +74 -269
- package/VerticalHeadingsTable/components/DndComponent/DndComponent.d.ts +14 -0
- package/VerticalHeadingsTable/components/DndComponent/DndComponent.js +96 -0
- package/VerticalHeadingsTable/components/DndComponent/helpers.d.ts +3 -0
- package/VerticalHeadingsTable/components/DndComponent/helpers.js +35 -0
- package/VerticalHeadingsTable/components/DndComponent/index.d.ts +1 -0
- package/VerticalHeadingsTable/components/DndComponent/index.js +1 -0
- package/VerticalHeadingsTable/components/{TableColumnDragLayer → DndComponent}/styles.d.ts +1 -1
- package/VerticalHeadingsTable/components/DndComponent/styles.js +10 -0
- package/VerticalHeadingsTable/components/DndComponent/types.d.ts +14 -0
- package/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.d.ts +7 -0
- package/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.js +13 -0
- package/VerticalHeadingsTable/components/DndMeasurer/index.d.ts +1 -0
- package/VerticalHeadingsTable/components/DndMeasurer/index.js +1 -0
- package/VerticalHeadingsTable/components/TableCell/TableCell.d.ts +2 -2
- package/VerticalHeadingsTable/components/TableCell/TableCell.js +2 -2
- package/VerticalHeadingsTable/components/TableCell/TableCell.test.js +101 -43
- package/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.d.ts +10 -0
- package/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.js +32 -0
- package/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.d.ts +2 -4
- package/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.js +30 -59
- package/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.test.js +126 -56
- package/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.d.ts +3 -3
- package/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.js +16 -6
- package/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.d.ts +9 -0
- package/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.js +30 -0
- package/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.d.ts +4 -4
- package/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.js +3 -4
- package/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.test.js +44 -29
- package/VerticalHeadingsTable/components/TableRow/TableRow.d.ts +4 -5
- package/VerticalHeadingsTable/components/TableRow/TableRow.js +3 -3
- package/VerticalHeadingsTable/components/TableRow/TableRow.test.js +35 -57
- package/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.d.ts +12 -0
- package/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.js +16 -0
- package/VerticalHeadingsTable/components/TableRowDragPreview/index.d.ts +1 -0
- package/VerticalHeadingsTable/components/TableRowDragPreview/index.js +1 -0
- package/{cjs/VerticalHeadingsTable/components/TableColumnDragLayer → VerticalHeadingsTable/components/TableRowDragPreview}/styles.d.ts +1 -1
- package/VerticalHeadingsTable/components/TableRowDragPreview/styles.js +8 -0
- package/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.d.ts +2 -8
- package/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.js +22 -53
- package/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.test.js +53 -83
- package/cjs/BarChart/helpers.d.ts +2 -2
- package/cjs/BasicTable/IntegrationBasicTable.test.js +6 -18
- package/cjs/EditModeAttributesView/IntegrationEditModeAttributesView.test.js +2 -5
- package/cjs/HierarchyNodeTitle/useEntityDetails.js +3 -0
- package/cjs/HierarchyNodeTitle/useEntityDetails.test.js +28 -0
- package/cjs/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +2 -5
- package/cjs/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.js +55 -21
- package/cjs/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.test.js +120 -135
- package/cjs/InlineSimpleAttribute/InlineSimpleAttribute.js +1 -1
- package/cjs/LineChart/helpers.d.ts +2 -2
- package/cjs/PieChart/PieChart.test.js +4 -0
- package/cjs/ProfileBandNavigation/useSearchNavigation.js +11 -3
- package/cjs/ProfileBandNavigation/useSearchNavigation.test.js +176 -0
- package/cjs/UploadImageDialog/UploadImageDialog.specs.js +1 -4
- package/cjs/UploadImageDialog/components/TargetBox/TargetBox.js +54 -20
- package/cjs/UploadImageDialog/components/TargetBox/TargetBox.specs.d.ts +1 -1
- package/cjs/UploadImageDialog/components/TargetBox/TargetBox.specs.js +57 -16
- package/cjs/UploadImageDialog/components/TargetBox/styles.js +2 -1
- package/cjs/VerticalHeadingsTable/DndVerticalHeadingsTable.test.d.ts +1 -0
- package/cjs/VerticalHeadingsTable/DndVerticalHeadingsTable.test.js +119 -0
- package/cjs/VerticalHeadingsTable/VerticalHeadingsTable.d.ts +2 -1
- package/cjs/VerticalHeadingsTable/VerticalHeadingsTable.js +9 -12
- package/cjs/VerticalHeadingsTable/VerticalHeadingsTable.test.js +74 -269
- package/cjs/VerticalHeadingsTable/components/DndComponent/DndComponent.d.ts +14 -0
- package/cjs/VerticalHeadingsTable/components/DndComponent/DndComponent.js +123 -0
- package/cjs/VerticalHeadingsTable/components/DndComponent/helpers.d.ts +3 -0
- package/cjs/VerticalHeadingsTable/components/DndComponent/helpers.js +40 -0
- package/cjs/VerticalHeadingsTable/components/DndComponent/index.d.ts +1 -0
- package/cjs/VerticalHeadingsTable/components/DndComponent/index.js +5 -0
- package/{features/crosswalks/CrosswalkDragLayer → cjs/VerticalHeadingsTable/components/DndComponent}/styles.d.ts +1 -1
- package/cjs/VerticalHeadingsTable/components/DndComponent/styles.js +13 -0
- package/cjs/VerticalHeadingsTable/components/DndComponent/types.d.ts +14 -0
- package/cjs/VerticalHeadingsTable/components/DndComponent/types.js +2 -0
- package/cjs/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.d.ts +7 -0
- package/cjs/VerticalHeadingsTable/components/DndMeasurer/DndMeasurer.js +40 -0
- package/cjs/VerticalHeadingsTable/components/DndMeasurer/index.d.ts +1 -0
- package/cjs/VerticalHeadingsTable/components/DndMeasurer/index.js +5 -0
- package/cjs/VerticalHeadingsTable/components/TableCell/TableCell.d.ts +2 -2
- package/cjs/VerticalHeadingsTable/components/TableCell/TableCell.js +2 -2
- package/cjs/VerticalHeadingsTable/components/TableCell/TableCell.test.js +101 -43
- package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.d.ts +10 -0
- package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/ColumnDragIndicator.js +39 -0
- package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.d.ts +2 -4
- package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.js +29 -58
- package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.test.js +128 -58
- package/cjs/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.d.ts +3 -3
- package/cjs/VerticalHeadingsTable/components/TableColumnDragPreview/TableColumnDragPreview.js +38 -9
- package/cjs/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.d.ts +9 -0
- package/cjs/VerticalHeadingsTable/components/TableHeadCell/RowDragIndicator.js +37 -0
- package/cjs/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.d.ts +4 -4
- package/cjs/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.js +3 -4
- package/cjs/VerticalHeadingsTable/components/TableHeadCell/TableHeadCell.test.js +43 -51
- package/cjs/VerticalHeadingsTable/components/TableRow/TableRow.d.ts +4 -5
- package/cjs/VerticalHeadingsTable/components/TableRow/TableRow.js +3 -3
- package/cjs/VerticalHeadingsTable/components/TableRow/TableRow.test.js +35 -57
- package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.d.ts +12 -0
- package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/TableRowDragPreview.js +42 -0
- package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/index.d.ts +1 -0
- package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/index.js +5 -0
- package/cjs/{features/crosswalks/CrosswalkDragLayer → VerticalHeadingsTable/components/TableRowDragPreview}/styles.d.ts +1 -1
- package/cjs/VerticalHeadingsTable/components/TableRowDragPreview/styles.js +11 -0
- package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.d.ts +2 -8
- package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.js +21 -52
- package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.test.js +55 -85
- package/cjs/contexts/CrosswalksDisplayContext/index.d.ts +2 -2
- package/cjs/contexts/CrosswalksDisplayContext/index.js +6 -2
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.d.ts +3 -1
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +2 -2
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +17 -10
- package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.d.ts +3 -2
- package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +13 -2
- package/cjs/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.d.ts +8 -0
- package/cjs/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.js +51 -0
- package/cjs/features/crosswalks/CrosswalkDndComponent/index.d.ts +1 -0
- package/cjs/features/crosswalks/CrosswalkDndComponent/index.js +5 -0
- package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/CrosswalkDragPreview.js +16 -5
- package/cjs/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +1 -0
- package/cjs/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.js +97 -0
- package/{features/crosswalks/CrosswalkDragLayer/components → cjs/features/crosswalks}/CrosswalkDragPreview/styles.d.ts +1 -1
- package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/styles.js +6 -1
- package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.js +25 -16
- package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +7 -33
- package/cjs/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.d.ts +1 -0
- package/cjs/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +134 -0
- package/cjs/features/crosswalks/CrosswalkRow/styles.d.ts +1 -1
- package/cjs/features/crosswalks/CrosswalkRow/styles.js +10 -1
- package/cjs/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +0 -1
- package/cjs/features/crosswalks/hooks/useDraggingCrosswalk.d.ts +6 -0
- package/cjs/features/crosswalks/hooks/useDraggingCrosswalk.js +19 -0
- package/cjs/features/crosswalks/hooks/useModifiedEntity.js +6 -6
- package/cjs/features/crosswalks/index.d.ts +1 -1
- package/cjs/features/crosswalks/index.js +3 -3
- package/cjs/hooks/useDndBasicTableScrollModifier/index.d.ts +1 -0
- package/cjs/hooks/useDndBasicTableScrollModifier/index.js +5 -0
- package/cjs/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.d.ts +10 -0
- package/cjs/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.js +57 -0
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/test-utils/dndKit/DndContext.d.ts +12 -0
- package/cjs/test-utils/dndKit/DndContext.js +5 -0
- package/cjs/test-utils/dndKit/DndContextComponent.d.ts +5 -0
- package/cjs/test-utils/dndKit/DndContextComponent.js +97 -0
- package/cjs/test-utils/dndKit/DndMonitorContext.d.ts +2 -0
- package/cjs/test-utils/dndKit/DndMonitorContext.js +5 -0
- package/cjs/test-utils/dndKit/DragOverlay.d.ts +5 -0
- package/cjs/test-utils/dndKit/DragOverlay.js +14 -0
- package/cjs/test-utils/dndKit/index.d.ts +32 -0
- package/cjs/test-utils/dndKit/index.js +22 -0
- package/cjs/test-utils/dndKit/type.d.ts +17 -0
- package/cjs/test-utils/dndKit/type.js +2 -0
- package/cjs/test-utils/dndKit/useDndContext.d.ts +8 -0
- package/cjs/test-utils/dndKit/useDndContext.js +13 -0
- package/cjs/test-utils/dndKit/useDndMonitor.d.ts +2 -0
- package/cjs/test-utils/dndKit/useDndMonitor.js +13 -0
- package/cjs/test-utils/dndKit/useDndMonitorProvider.d.ts +1 -0
- package/cjs/test-utils/dndKit/useDndMonitorProvider.js +17 -0
- package/cjs/test-utils/dndKit/useDraggable.d.ts +12 -0
- package/cjs/test-utils/dndKit/useDraggable.js +43 -0
- package/cjs/test-utils/dndKit/useDroppable.d.ts +4 -0
- package/cjs/test-utils/dndKit/useDroppable.js +45 -0
- package/cjs/types/basicTable.d.ts +4 -0
- package/contexts/CrosswalksDisplayContext/index.d.ts +2 -2
- package/contexts/CrosswalksDisplayContext/index.js +6 -2
- package/features/crosswalks/AttributesTable/AttributesTable.d.ts +3 -1
- package/features/crosswalks/AttributesTable/AttributesTable.js +2 -2
- package/features/crosswalks/AttributesTable/AttributesTable.test.js +17 -10
- package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.d.ts +3 -2
- package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +13 -2
- package/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.d.ts +8 -0
- package/features/crosswalks/CrosswalkDndComponent/CrosswalkDndComponent.js +24 -0
- package/features/crosswalks/CrosswalkDndComponent/index.d.ts +1 -0
- package/features/crosswalks/CrosswalkDndComponent/index.js +1 -0
- package/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.js +30 -0
- package/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +1 -0
- package/features/crosswalks/CrosswalkDragPreview/CrosswalkDragPreview.test.js +69 -0
- package/{cjs/features/crosswalks/CrosswalkDragLayer/components → features/crosswalks}/CrosswalkDragPreview/styles.d.ts +1 -1
- package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/styles.js +6 -1
- package/features/crosswalks/CrosswalkRow/CrosswalkRow.js +25 -16
- package/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +7 -33
- package/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.d.ts +1 -0
- package/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +129 -0
- package/features/crosswalks/CrosswalkRow/styles.d.ts +1 -1
- package/features/crosswalks/CrosswalkRow/styles.js +10 -1
- package/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +0 -1
- package/features/crosswalks/hooks/useDraggingCrosswalk.d.ts +6 -0
- package/features/crosswalks/hooks/useDraggingCrosswalk.js +15 -0
- package/features/crosswalks/hooks/useModifiedEntity.js +6 -6
- package/features/crosswalks/index.d.ts +1 -1
- package/features/crosswalks/index.js +1 -1
- package/hooks/useDndBasicTableScrollModifier/index.d.ts +1 -0
- package/hooks/useDndBasicTableScrollModifier/index.js +1 -0
- package/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.d.ts +10 -0
- package/hooks/useDndBasicTableScrollModifier/useDndBasicTableScrollModifier.js +53 -0
- package/index.d.ts +2 -1
- package/index.js +1 -0
- package/package.json +3 -3
- package/test-utils/dndKit/DndContext.d.ts +12 -0
- package/test-utils/dndKit/DndContext.js +2 -0
- package/test-utils/dndKit/DndContextComponent.d.ts +5 -0
- package/test-utils/dndKit/DndContextComponent.js +70 -0
- package/test-utils/dndKit/DndMonitorContext.d.ts +2 -0
- package/test-utils/dndKit/DndMonitorContext.js +2 -0
- package/test-utils/dndKit/DragOverlay.d.ts +5 -0
- package/test-utils/dndKit/DragOverlay.js +7 -0
- package/test-utils/dndKit/index.d.ts +32 -0
- package/test-utils/dndKit/index.js +19 -0
- package/test-utils/dndKit/type.d.ts +17 -0
- package/test-utils/dndKit/type.js +1 -0
- package/test-utils/dndKit/useDndContext.d.ts +8 -0
- package/test-utils/dndKit/useDndContext.js +9 -0
- package/test-utils/dndKit/useDndMonitor.d.ts +2 -0
- package/test-utils/dndKit/useDndMonitor.js +9 -0
- package/test-utils/dndKit/useDndMonitorProvider.d.ts +1 -0
- package/test-utils/dndKit/useDndMonitorProvider.js +13 -0
- package/test-utils/dndKit/useDraggable.d.ts +12 -0
- package/test-utils/dndKit/useDraggable.js +39 -0
- package/test-utils/dndKit/useDroppable.d.ts +4 -0
- package/test-utils/dndKit/useDroppable.js +41 -0
- package/types/basicTable.d.ts +4 -0
- package/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.d.ts +0 -6
- package/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.js +0 -23
- package/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.d.ts +0 -6
- package/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.js +0 -11
- package/VerticalHeadingsTable/components/TableColumnDragLayer/index.d.ts +0 -1
- package/VerticalHeadingsTable/components/TableColumnDragLayer/index.js +0 -1
- package/VerticalHeadingsTable/components/TableColumnDragLayer/styles.js +0 -13
- package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.d.ts +0 -6
- package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/TableColumnDragLayer.js +0 -50
- package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.d.ts +0 -6
- package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/helpers.js +0 -15
- package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/index.d.ts +0 -1
- package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/index.js +0 -5
- package/cjs/VerticalHeadingsTable/components/TableColumnDragLayer/styles.js +0 -16
- package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.d.ts +0 -2
- package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.js +0 -51
- package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +0 -93
- package/cjs/features/crosswalks/CrosswalkDragLayer/index.d.ts +0 -1
- package/cjs/features/crosswalks/CrosswalkDragLayer/index.js +0 -5
- package/cjs/features/crosswalks/CrosswalkDragLayer/styles.js +0 -17
- package/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.d.ts +0 -2
- package/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.js +0 -25
- package/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +0 -65
- package/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.js +0 -19
- package/features/crosswalks/CrosswalkDragLayer/index.d.ts +0 -1
- package/features/crosswalks/CrosswalkDragLayer/index.js +0 -1
- package/features/crosswalks/CrosswalkDragLayer/styles.js +0 -14
- /package/{cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.d.ts → VerticalHeadingsTable/DndVerticalHeadingsTable.test.d.ts} +0 -0
- /package/{features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.d.ts → VerticalHeadingsTable/components/DndComponent/types.js} +0 -0
- /package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/CrosswalkDragPreview.d.ts +0 -0
- /package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.d.ts +0 -0
- /package/cjs/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.js +0 -0
- /package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/CrosswalkDragPreview.d.ts +0 -0
- /package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.d.ts +0 -0
- /package/features/crosswalks/{CrosswalkDragLayer/components/CrosswalkDragPreview → CrosswalkDragPreview}/index.js +0 -0
|
@@ -1,58 +1,116 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
1
48
|
import React from 'react';
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
4
49
|
import { TableCell } from './TableCell';
|
|
5
|
-
import {
|
|
50
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
6
51
|
var columnValue = {
|
|
7
|
-
'attributes.FirstName':
|
|
52
|
+
'attributes.FirstName': 'Some value',
|
|
8
53
|
id: 'entities/123'
|
|
9
54
|
};
|
|
10
|
-
var
|
|
11
|
-
|
|
55
|
+
var rowData = {
|
|
56
|
+
id: 'attributes.FirstName',
|
|
57
|
+
label: 'FirstName'
|
|
58
|
+
};
|
|
59
|
+
var defaultProps = {
|
|
60
|
+
columnValue: columnValue,
|
|
61
|
+
rowData: rowData,
|
|
62
|
+
setHoveredColumn: jest.fn(),
|
|
63
|
+
resetHoveredColumn: jest.fn()
|
|
64
|
+
};
|
|
65
|
+
var setUp = function (props) {
|
|
66
|
+
if (props === void 0) { props = defaultProps; }
|
|
67
|
+
var Wrapper = function (_a) {
|
|
68
|
+
var children = _a.children;
|
|
69
|
+
return (React.createElement("table", null,
|
|
70
|
+
React.createElement("tbody", null,
|
|
71
|
+
React.createElement("tr", null, children))));
|
|
72
|
+
};
|
|
73
|
+
return render(React.createElement(TableCell, __assign({}, props)), { wrapper: Wrapper });
|
|
74
|
+
};
|
|
12
75
|
describe('TableCell tests', function () {
|
|
13
76
|
it('should render cellRenderer from rowData correctly', function () {
|
|
14
|
-
var CellRenderer = function () {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
label: 'FirstName',
|
|
18
|
-
cellRenderer: CellRenderer
|
|
77
|
+
var CellRenderer = function (_a) {
|
|
78
|
+
var value = _a.value;
|
|
79
|
+
return React.createElement("div", { className: "cellRenderer" }, value);
|
|
19
80
|
};
|
|
20
|
-
|
|
21
|
-
expect(
|
|
81
|
+
setUp(__assign(__assign({}, defaultProps), { rowData: __assign(__assign({}, rowData), { cellRenderer: CellRenderer }) }));
|
|
82
|
+
expect(screen.getByText(columnValue['attributes.FirstName'])).toHaveClass('cellRenderer');
|
|
22
83
|
});
|
|
23
84
|
it('should render DefaultHeadCellRenderer if headCellRenderer is missing in rowData', function () {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
label: 'FirstName'
|
|
27
|
-
};
|
|
28
|
-
var component = shallow(React.createElement(TableCell, { rowData: rowData, columnValue: columnValue, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
|
|
29
|
-
expect(component.find(DefaultCellRenderer).prop('value')).toEqual(columnValue[rowData.id]);
|
|
85
|
+
setUp();
|
|
86
|
+
expect(screen.getByText(columnValue['attributes.FirstName'])).toBeInTheDocument();
|
|
30
87
|
});
|
|
31
|
-
it('setHoveredColumn handler should work correctly', function () {
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
88
|
+
it('setHoveredColumn handler should work correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
+
var setHoveredColumn;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
setHoveredColumn = jest.fn();
|
|
92
|
+
setUp(__assign(__assign({}, defaultProps), { setHoveredColumn: setHoveredColumn }));
|
|
93
|
+
fireEvent.mouseOver(screen.getByRole('cell', { name: columnValue['attributes.FirstName'] }));
|
|
94
|
+
expect(setHoveredColumn).toHaveBeenCalledWith(columnValue);
|
|
95
|
+
return [2 /*return*/];
|
|
39
96
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
97
|
+
}); });
|
|
98
|
+
it('resetHoveredColumn handler should work correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
+
var resetHoveredColumn;
|
|
100
|
+
return __generator(this, function (_a) {
|
|
101
|
+
resetHoveredColumn = jest.fn();
|
|
102
|
+
setUp(__assign(__assign({}, defaultProps), { resetHoveredColumn: resetHoveredColumn }));
|
|
103
|
+
fireEvent.mouseLeave(screen.getByRole('cell', { name: columnValue['attributes.FirstName'] }));
|
|
104
|
+
expect(resetHoveredColumn).toHaveBeenCalled();
|
|
105
|
+
return [2 /*return*/];
|
|
106
|
+
});
|
|
107
|
+
}); });
|
|
108
|
+
it('should pass ".hidden" classname to div wrapper correctly if "rowIsDragging" prop is true', function () {
|
|
109
|
+
setUp(__assign(__assign({}, defaultProps), { rowIsDragging: true }));
|
|
110
|
+
expect(screen.getByText(columnValue['attributes.FirstName'])).toHaveClass('hidden');
|
|
49
111
|
});
|
|
50
|
-
it('should not pass ".hidden" classname to div wrapper if "
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
label: 'FirstName'
|
|
54
|
-
};
|
|
55
|
-
var component = shallow(React.createElement(TableCell, { rowData: rowData, columnValue: columnValue, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn, someRowIsDragging: false }));
|
|
56
|
-
expect(component.find('.hidden')).toHaveLength(0);
|
|
112
|
+
it('should not pass ".hidden" classname to div wrapper if "rowIsDragging" prop is false', function () {
|
|
113
|
+
setUp();
|
|
114
|
+
expect(screen.getByText(columnValue['attributes.FirstName'])).not.toHaveClass('hidden');
|
|
57
115
|
});
|
|
58
116
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColumnData, RowData } from '../../types';
|
|
3
|
+
type Props = {
|
|
4
|
+
columnValue: ColumnData;
|
|
5
|
+
rowData: RowData;
|
|
6
|
+
index: number;
|
|
7
|
+
getColumnWidth: () => number;
|
|
8
|
+
};
|
|
9
|
+
export declare const ColumnDragIndicator: ({ columnValue, rowData, index, getColumnWidth }: Props) => React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
|
14
|
+
import { useDraggable } from '@dnd-kit/core';
|
|
15
|
+
import { DndItemTypes } from '../../types';
|
|
16
|
+
import { useStyles } from './styles';
|
|
17
|
+
export var ColumnDragIndicator = function (_a) {
|
|
18
|
+
var columnValue = _a.columnValue, rowData = _a.rowData, index = _a.index, getColumnWidth = _a.getColumnWidth;
|
|
19
|
+
var styles = useStyles();
|
|
20
|
+
var _b = useDraggable({
|
|
21
|
+
id: columnValue.id,
|
|
22
|
+
data: {
|
|
23
|
+
type: DndItemTypes.Column,
|
|
24
|
+
getColumnWidth: getColumnWidth,
|
|
25
|
+
columnValue: columnValue,
|
|
26
|
+
rowData: rowData,
|
|
27
|
+
index: index
|
|
28
|
+
}
|
|
29
|
+
}), setDraggableNodeRef = _b.setNodeRef, attributes = _b.attributes, listeners = _b.listeners;
|
|
30
|
+
return (React.createElement("div", __assign({ ref: setDraggableNodeRef, className: styles.dragIndicator }, attributes, listeners),
|
|
31
|
+
React.createElement(DragIndicatorIcon, { className: styles.dragIndicatorIcon })));
|
|
32
|
+
};
|
|
@@ -4,12 +4,10 @@ type Props = {
|
|
|
4
4
|
columnValue: ColumnData;
|
|
5
5
|
rowData: RowData;
|
|
6
6
|
index: number;
|
|
7
|
-
onMoveColumn: (dragId: string, hoverId: string) => void;
|
|
8
|
-
onDropColumn?: () => void;
|
|
9
7
|
shouldRenderDragIndicator: boolean;
|
|
10
8
|
setHoveredColumn: (columnValue: ColumnData) => void;
|
|
11
9
|
resetHoveredColumn: () => void;
|
|
12
|
-
|
|
10
|
+
rowIsDragging?: boolean;
|
|
13
11
|
};
|
|
14
|
-
export declare const TableCellWithDnd: ({ columnValue, rowData, index,
|
|
12
|
+
export declare const TableCellWithDnd: ({ columnValue, rowData, index, shouldRenderDragIndicator, setHoveredColumn, resetHoveredColumn, rowIsDragging }: Props) => React.JSX.Element;
|
|
15
13
|
export {};
|
|
@@ -1,71 +1,42 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
-
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
|
4
|
-
import { useDrag, useDrop } from 'react-dnd';
|
|
5
|
-
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
6
3
|
import { DndItemTypes } from '../../types';
|
|
7
4
|
import { DefaultCellRenderer } from '../../helpers';
|
|
8
5
|
import { useStyles } from './styles';
|
|
6
|
+
import { useDndMonitor, useDroppable } from '@dnd-kit/core';
|
|
7
|
+
import { ColumnDragIndicator } from './ColumnDragIndicator';
|
|
9
8
|
export var TableCellWithDnd = function (_a) {
|
|
10
9
|
var _b;
|
|
11
|
-
var columnValue = _a.columnValue, rowData = _a.rowData, index = _a.index,
|
|
10
|
+
var columnValue = _a.columnValue, rowData = _a.rowData, index = _a.index, shouldRenderDragIndicator = _a.shouldRenderDragIndicator, setHoveredColumn = _a.setHoveredColumn, resetHoveredColumn = _a.resetHoveredColumn, rowIsDragging = _a.rowIsDragging;
|
|
12
11
|
var styles = useStyles();
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _a;
|
|
21
|
-
if (!dropRef.current) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
var dragIndex = item.index;
|
|
25
|
-
var hoverIndex = index;
|
|
26
|
-
if (dragIndex === hoverIndex) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
var hoverBoundingRect = (_a = dropRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
30
|
-
var hoverMiddleX = (hoverBoundingRect.right - hoverBoundingRect.left) / 2;
|
|
31
|
-
var clientOffset = monitor.getClientOffset();
|
|
32
|
-
var hoverClientX = clientOffset.x - hoverBoundingRect.left;
|
|
33
|
-
if (dragIndex < hoverIndex && hoverClientX < hoverMiddleX) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if (dragIndex > hoverIndex && hoverClientX > hoverMiddleX) {
|
|
37
|
-
return;
|
|
12
|
+
var _c = useState(false), enableDropForColumn = _c[0], setEnableDropForColumn = _c[1];
|
|
13
|
+
var _d = useState(false), isColumnDragging = _d[0], setIsColumnDragging = _d[1];
|
|
14
|
+
useDndMonitor({
|
|
15
|
+
onDragStart: function (event) {
|
|
16
|
+
if (event.active.data.current.type === DndItemTypes.Column) {
|
|
17
|
+
setEnableDropForColumn(true);
|
|
18
|
+
setIsColumnDragging(event.active.id === columnValue.id);
|
|
38
19
|
}
|
|
39
|
-
onMoveColumn(item.columnValue.id, columnValue.id);
|
|
40
|
-
item.index = hoverIndex;
|
|
41
20
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
sourceId: monitor.getHandlerId()
|
|
58
|
-
}); }
|
|
59
|
-
}), _e = _d[0], opacity = _e.opacity, sourceId = _e.sourceId, drag = _d[1], preview = _d[2];
|
|
60
|
-
useEffect(function () {
|
|
61
|
-
preview(getEmptyImage(), { captureDraggingState: true });
|
|
62
|
-
drop(dropRef);
|
|
63
|
-
drag(dragRef);
|
|
64
|
-
}, []);
|
|
21
|
+
onDragEnd: function () {
|
|
22
|
+
setEnableDropForColumn(false);
|
|
23
|
+
setIsColumnDragging(false);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var setDroppableNodeRef = useDroppable({
|
|
27
|
+
id: columnValue.id
|
|
28
|
+
}).setNodeRef;
|
|
29
|
+
var columnRef = useRef(null);
|
|
30
|
+
var setColumnRef = useCallback(function (elem) {
|
|
31
|
+
setDroppableNodeRef(elem);
|
|
32
|
+
columnRef.current = elem;
|
|
33
|
+
}, [setDroppableNodeRef]);
|
|
34
|
+
var getColumnWidth = function () { var _a; return (_a = columnRef === null || columnRef === void 0 ? void 0 : columnRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth; };
|
|
35
|
+
var CellRenderer = rowData.cellRenderer || DefaultCellRenderer;
|
|
65
36
|
var onMouseOver = setHoveredColumn ? function () { return setHoveredColumn(columnValue); } : undefined;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
37
|
+
var draggingColumnStyle = useMemo(function () { return ({ opacity: isColumnDragging ? 0 : 1 }); }, [isColumnDragging]);
|
|
38
|
+
return (React.createElement("td", { style: draggingColumnStyle, ref: enableDropForColumn ? setColumnRef : undefined, className: styles.tableData, onMouseOver: onMouseOver, onMouseLeave: resetHoveredColumn },
|
|
39
|
+
React.createElement("div", { className: classnames((_b = {}, _b[styles.hidden] = rowIsDragging, _b)) },
|
|
40
|
+
shouldRenderDragIndicator && (React.createElement(ColumnDragIndicator, { columnValue: columnValue, rowData: rowData, index: index, getColumnWidth: getColumnWidth })),
|
|
70
41
|
React.createElement(CellRenderer, { value: columnValue[rowData.id] }))));
|
|
71
42
|
};
|
|
@@ -1,11 +1,62 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
1
48
|
import React from 'react';
|
|
2
|
-
import { mount } from 'enzyme';
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
4
|
-
import TestBackend from 'react-dnd-test-backend';
|
|
5
|
-
import { DndProvider, DndContext } from 'react-dnd';
|
|
6
49
|
import { TableCellWithDnd } from './TableCellWithDnd';
|
|
7
|
-
import {
|
|
8
|
-
|
|
50
|
+
import { DndContext, useDndMonitor } from '@dnd-kit/core';
|
|
51
|
+
import { act, render, screen } from '@testing-library/react';
|
|
52
|
+
import userEvent from '@testing-library/user-event';
|
|
53
|
+
import { getMuiIconByName } from '../../../test-utils';
|
|
54
|
+
import { DndItemTypes } from '../../types';
|
|
55
|
+
jest.mock('@dnd-kit/core', function () { return (__assign(__assign({}, jest.requireActual('@dnd-kit/core')), { useDndMonitor: jest.fn() })); });
|
|
56
|
+
var CellRenderer = function (_a) {
|
|
57
|
+
var value = _a.value;
|
|
58
|
+
return (React.createElement("div", { className: "cellRenderer", "data-reltio-id": "cellRenderer" }, value));
|
|
59
|
+
};
|
|
9
60
|
var defaultColumnValue = {
|
|
10
61
|
'attributes.FirstName': 'Some Value',
|
|
11
62
|
id: 'entities/123'
|
|
@@ -15,77 +66,96 @@ var defaultRowData = {
|
|
|
15
66
|
label: 'FirstName',
|
|
16
67
|
cellRenderer: CellRenderer
|
|
17
68
|
};
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
69
|
+
var defaultProps = {
|
|
70
|
+
columnValue: defaultColumnValue,
|
|
71
|
+
rowData: defaultRowData,
|
|
72
|
+
index: 0,
|
|
73
|
+
shouldRenderDragIndicator: true,
|
|
74
|
+
setHoveredColumn: jest.fn(),
|
|
75
|
+
resetHoveredColumn: jest.fn(),
|
|
76
|
+
rowIsDragging: false
|
|
77
|
+
};
|
|
78
|
+
var setUp = function (props) {
|
|
79
|
+
if (props === void 0) { props = defaultProps; }
|
|
80
|
+
var user = userEvent.setup();
|
|
81
|
+
var Providers = function (_a) {
|
|
82
|
+
var children = _a.children;
|
|
83
|
+
return (React.createElement(DndContext, null,
|
|
84
|
+
React.createElement("table", null,
|
|
26
85
|
React.createElement("tbody", null,
|
|
27
|
-
React.createElement("tr", null,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return [component, manager];
|
|
86
|
+
React.createElement("tr", null, children)))));
|
|
87
|
+
};
|
|
88
|
+
return __assign({ user: user }, render(React.createElement(TableCellWithDnd, __assign({}, props)), { wrapper: Providers }));
|
|
31
89
|
};
|
|
32
90
|
describe('TableCellWithDnd tests', function () {
|
|
33
91
|
it('should render cellRenderer from rowData correctly', function () {
|
|
34
|
-
|
|
35
|
-
expect(
|
|
92
|
+
setUp();
|
|
93
|
+
expect(screen.getByTestId('cellRenderer')).toBeInTheDocument();
|
|
36
94
|
});
|
|
37
95
|
it('should render DefaultCellRenderer if cellRenderer is missing in rowData', function () {
|
|
38
96
|
var rowData = {
|
|
39
97
|
id: 'attributes.FirstName',
|
|
40
98
|
label: 'FirstName'
|
|
41
99
|
};
|
|
42
|
-
|
|
43
|
-
expect(
|
|
100
|
+
setUp(__assign(__assign({}, defaultProps), { rowData: rowData }));
|
|
101
|
+
expect(screen.getByText(defaultColumnValue[rowData.id])).toBeInTheDocument();
|
|
44
102
|
});
|
|
45
103
|
it('should render dragIndicator if "shouldRenderDragIndicator" prop is true', function () {
|
|
46
|
-
|
|
47
|
-
expect(
|
|
104
|
+
setUp(__assign(__assign({}, defaultProps), { shouldRenderDragIndicator: true }));
|
|
105
|
+
expect(getMuiIconByName('DragIndicator')).toBeInTheDocument();
|
|
48
106
|
});
|
|
49
107
|
it('should not render dragIndicator if "shouldRenderDragIndicator" prop is false', function () {
|
|
50
|
-
|
|
51
|
-
expect(
|
|
108
|
+
setUp(__assign(__assign({}, defaultProps), { shouldRenderDragIndicator: false }));
|
|
109
|
+
expect(getMuiIconByName('DragIndicator')).not.toBeInTheDocument();
|
|
52
110
|
});
|
|
53
|
-
it('setHoveredColumn handler should work correctly', function () {
|
|
54
|
-
var setHoveredColumn
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
111
|
+
it('setHoveredColumn handler should work correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
112
|
+
var setHoveredColumn, user;
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
115
|
+
case 0:
|
|
116
|
+
setHoveredColumn = jest.fn();
|
|
117
|
+
user = setUp(__assign(__assign({}, defaultProps), { setHoveredColumn: setHoveredColumn })).user;
|
|
118
|
+
return [4 /*yield*/, user.hover(screen.getByText(defaultColumnValue['attributes.FirstName']))];
|
|
119
|
+
case 1:
|
|
120
|
+
_a.sent();
|
|
121
|
+
expect(setHoveredColumn).toHaveBeenCalledWith(defaultColumnValue);
|
|
122
|
+
return [2 /*return*/];
|
|
123
|
+
}
|
|
60
124
|
});
|
|
61
|
-
|
|
125
|
+
}); });
|
|
126
|
+
it('should pass ".hidden" classname to div wrapper correctly if "rowIsDragging" prop is true', function () {
|
|
127
|
+
setUp(__assign(__assign({}, defaultProps), { rowIsDragging: true }));
|
|
128
|
+
expect(document.getElementsByClassName('hidden')).toHaveLength(1);
|
|
129
|
+
});
|
|
130
|
+
it('should not pass ".hidden" classname to div wrapper if "rowIsDragging" prop is false', function () {
|
|
131
|
+
setUp(__assign(__assign({}, defaultProps), { rowIsDragging: false }));
|
|
132
|
+
expect(document.getElementsByClassName('hidden')).toHaveLength(0);
|
|
62
133
|
});
|
|
63
|
-
it('should
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
134
|
+
it('should set opacity to 0 if column is dragging', function () {
|
|
135
|
+
var onDragStart, onDragEnd;
|
|
136
|
+
useDndMonitor.mockImplementation(function (listeners) {
|
|
137
|
+
onDragStart = listeners.onDragStart;
|
|
138
|
+
onDragEnd = listeners.onDragEnd;
|
|
139
|
+
});
|
|
140
|
+
setUp();
|
|
141
|
+
var cell = screen.getByRole('cell', { name: defaultColumnValue['attributes.FirstName'] });
|
|
142
|
+
expect(cell).toHaveStyle({ opacity: 1 });
|
|
68
143
|
act(function () {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
144
|
+
onDragStart({
|
|
145
|
+
active: {
|
|
146
|
+
id: defaultProps.columnValue.id,
|
|
147
|
+
data: {
|
|
148
|
+
current: {
|
|
149
|
+
type: DndItemTypes.Column
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
72
153
|
});
|
|
73
154
|
});
|
|
74
|
-
|
|
75
|
-
var targetId = component.find('td').prop('data-target-id');
|
|
155
|
+
expect(cell).toHaveStyle({ opacity: 0 });
|
|
76
156
|
act(function () {
|
|
77
|
-
|
|
78
|
-
backend.simulateDrop();
|
|
79
|
-
backend.simulateEndDrag();
|
|
157
|
+
onDragEnd();
|
|
80
158
|
});
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
it('should pass ".hidden" classname to div wrapper correctly if "someRowIsDragging" prop is true', function () {
|
|
84
|
-
var component = setUp({ someRowIsDragging: true })[0];
|
|
85
|
-
expect(component.find('.hidden')).toHaveLength(1);
|
|
86
|
-
});
|
|
87
|
-
it('should not pass ".hidden" classname to div wrapper if "someRowIsDragging" prop is false', function () {
|
|
88
|
-
var component = setUp({ someRowIsDragging: false })[0];
|
|
89
|
-
expect(component.find('.hidden')).toHaveLength(0);
|
|
159
|
+
expect(cell).toHaveStyle({ opacity: 1 });
|
|
90
160
|
});
|
|
91
161
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ColumnData, RowData } from '../../types';
|
|
3
3
|
type Props = {
|
|
4
|
-
columnWidth: number;
|
|
5
4
|
columnHeight: number;
|
|
6
|
-
|
|
5
|
+
draggingColumn: {
|
|
7
6
|
rowData: RowData;
|
|
8
7
|
columnValue: ColumnData;
|
|
8
|
+
getColumnWidth?: () => number;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export declare const TableColumnDragPreview: ({
|
|
11
|
+
export declare const TableColumnDragPreview: React.MemoExoticComponent<({ columnHeight, draggingColumn }: Props) => React.JSX.Element>;
|
|
12
12
|
export {};
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { DefaultCellRenderer } from '../../helpers';
|
|
3
|
-
export var TableColumnDragPreview = function (_a) {
|
|
4
|
-
var
|
|
5
|
-
|
|
3
|
+
export var TableColumnDragPreview = memo(function (_a) {
|
|
4
|
+
var columnHeight = _a.columnHeight, draggingColumn = _a.draggingColumn;
|
|
5
|
+
if (!draggingColumn) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
var rowData = draggingColumn.rowData, columnValue = draggingColumn.columnValue, getColumnWidth = draggingColumn.getColumnWidth;
|
|
6
9
|
var CellRenderer = rowData.cellRenderer || DefaultCellRenderer;
|
|
7
|
-
|
|
10
|
+
var columnWidth = getColumnWidth();
|
|
11
|
+
return (React.createElement("div", { style: {
|
|
12
|
+
width: columnWidth,
|
|
13
|
+
height: columnHeight,
|
|
14
|
+
background: 'rgba(245,245,245, .5)',
|
|
15
|
+
pointerEvents: 'none'
|
|
16
|
+
} },
|
|
8
17
|
React.createElement(CellRenderer, { value: columnValue[rowData.id] })));
|
|
9
|
-
};
|
|
18
|
+
});
|
|
19
|
+
TableColumnDragPreview.displayName = 'TableColumnDragPreview';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColumnData, RowData } from '../../types';
|
|
3
|
+
type Props = {
|
|
4
|
+
id: string;
|
|
5
|
+
columnsData: ColumnData[];
|
|
6
|
+
rowData: RowData;
|
|
7
|
+
};
|
|
8
|
+
export declare const RowDragIndicator: ({ id, rowData, columnsData }: Props) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { useStyles } from './styles';
|
|
14
|
+
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
|
15
|
+
import { useDraggable } from '@dnd-kit/core';
|
|
16
|
+
import { DndItemTypes } from '../../types';
|
|
17
|
+
export var RowDragIndicator = function (_a) {
|
|
18
|
+
var id = _a.id, rowData = _a.rowData, columnsData = _a.columnsData;
|
|
19
|
+
var styles = useStyles();
|
|
20
|
+
var _b = useDraggable({
|
|
21
|
+
id: id,
|
|
22
|
+
data: {
|
|
23
|
+
type: DndItemTypes.Row,
|
|
24
|
+
rowData: rowData,
|
|
25
|
+
columnsData: columnsData
|
|
26
|
+
}
|
|
27
|
+
}), setNodeRef = _b.setNodeRef, attributes = _b.attributes, listeners = _b.listeners;
|
|
28
|
+
return (React.createElement("div", __assign({ ref: setNodeRef, className: styles.dragIndicator }, attributes, listeners),
|
|
29
|
+
React.createElement(DragIndicatorIcon, { className: styles.dragIndicatorIcon })));
|
|
30
|
+
};
|