@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,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RowData } from '../../types';
|
|
2
|
+
import { ColumnData, RowData } from '../../types';
|
|
3
3
|
type BasicProps = {
|
|
4
4
|
rowData: RowData;
|
|
5
5
|
};
|
|
6
6
|
type PropsWithDnd = BasicProps & {
|
|
7
7
|
isDraggable: true;
|
|
8
|
-
|
|
8
|
+
columnsData: ColumnData[];
|
|
9
9
|
};
|
|
10
10
|
type PropsWithoutDnd = BasicProps & {
|
|
11
11
|
isDraggable?: false;
|
|
12
|
-
|
|
12
|
+
columnsData?: ColumnData[];
|
|
13
13
|
};
|
|
14
14
|
type Props = PropsWithDnd | PropsWithoutDnd;
|
|
15
|
-
export declare const TableHeadCell: ({ rowData,
|
|
15
|
+
export declare const TableHeadCell: ({ rowData, columnsData, isDraggable }: Props) => React.JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -10,15 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
|
14
13
|
import { DefaultHeadCellRenderer } from '../../helpers';
|
|
15
14
|
import { useStyles } from './styles';
|
|
15
|
+
import { RowDragIndicator } from './RowDragIndicator';
|
|
16
16
|
export var TableHeadCell = function (_a) {
|
|
17
|
-
var rowData = _a.rowData,
|
|
17
|
+
var rowData = _a.rowData, columnsData = _a.columnsData, isDraggable = _a.isDraggable;
|
|
18
18
|
var styles = useStyles();
|
|
19
19
|
var HeadCellRenderer = rowData.headCellRenderer || DefaultHeadCellRenderer;
|
|
20
20
|
return (React.createElement("th", { className: styles.tableHead },
|
|
21
|
-
isDraggable &&
|
|
22
|
-
React.createElement(DragIndicatorIcon, { className: styles.dragIndicatorIcon }))),
|
|
21
|
+
isDraggable && React.createElement(RowDragIndicator, { id: rowData.id, rowData: rowData, columnsData: columnsData }),
|
|
23
22
|
React.createElement(HeadCellRenderer, __assign({}, rowData))));
|
|
24
23
|
};
|
|
@@ -1,45 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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';
|
|
5
13
|
import { TableHeadCell } from './TableHeadCell';
|
|
14
|
+
import { render, screen } from '@testing-library/react';
|
|
15
|
+
import { getMuiIconByName } from '../../../test-utils';
|
|
16
|
+
var defaultProps = {
|
|
17
|
+
rowData: {
|
|
18
|
+
id: 'attributes.FirstName',
|
|
19
|
+
label: 'FirstName'
|
|
20
|
+
},
|
|
21
|
+
columnsData: [
|
|
22
|
+
{
|
|
23
|
+
id: 'column1',
|
|
24
|
+
isDraggable: true
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
};
|
|
28
|
+
var setUp = function (props) {
|
|
29
|
+
if (props === void 0) { props = defaultProps; }
|
|
30
|
+
return render(React.createElement(TableHeadCell, __assign({}, props)));
|
|
31
|
+
};
|
|
6
32
|
describe('TableHeadCell tests', function () {
|
|
7
33
|
it('should render drag indicator correctly if isDraggable prop is true', function () {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
label: 'FirstName'
|
|
11
|
-
};
|
|
12
|
-
var dragRef = createRef();
|
|
13
|
-
var component = shallow(React.createElement(TableHeadCell, { rowData: rowData, isDraggable: true, dragRef: dragRef }));
|
|
14
|
-
var dragIndicator = component.find('.dragIndicator');
|
|
15
|
-
expect(dragIndicator).toHaveLength(1);
|
|
16
|
-
expect(dragIndicator.getElement().ref).toBe(dragRef);
|
|
17
|
-
expect(dragIndicator.find(DragIndicatorIcon)).toHaveLength(1);
|
|
34
|
+
setUp(__assign(__assign({}, defaultProps), { isDraggable: true }));
|
|
35
|
+
expect(getMuiIconByName('DragIndicator')).toBeInTheDocument();
|
|
18
36
|
});
|
|
19
37
|
it('should not render dragIndicator if isDraggable prop is false', function () {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
label: 'FirstName'
|
|
23
|
-
};
|
|
24
|
-
var component = shallow(React.createElement(TableHeadCell, { rowData: rowData, isDraggable: false }));
|
|
25
|
-
expect(component.find('.dragIndicator')).toHaveLength(0);
|
|
38
|
+
setUp();
|
|
39
|
+
expect(getMuiIconByName('DragIndicator')).not.toBeInTheDocument();
|
|
26
40
|
});
|
|
27
41
|
it('should render headCellRenderer from rowData correctly', function () {
|
|
28
|
-
var HeadCellRenderer = function () {
|
|
42
|
+
var HeadCellRenderer = function (_a) {
|
|
43
|
+
var label = _a.label;
|
|
44
|
+
return React.createElement("div", null,
|
|
45
|
+
"headCell-",
|
|
46
|
+
label);
|
|
47
|
+
};
|
|
29
48
|
var rowData = {
|
|
30
49
|
id: 'attributes.FirstName',
|
|
31
50
|
label: 'FirstName',
|
|
32
51
|
headCellRenderer: HeadCellRenderer
|
|
33
52
|
};
|
|
34
|
-
|
|
35
|
-
expect(
|
|
53
|
+
setUp(__assign(__assign({}, defaultProps), { rowData: rowData }));
|
|
54
|
+
expect(screen.getByText("headCell-".concat(rowData.label))).toBeInTheDocument();
|
|
36
55
|
});
|
|
37
56
|
it('should render DefaultHeadCellRenderer if headCellRenderer is missing in rowData', function () {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
label: 'FirstName'
|
|
41
|
-
};
|
|
42
|
-
var component = shallow(React.createElement(TableHeadCell, { rowData: rowData, isDraggable: false }));
|
|
43
|
-
expect(component.find(DefaultHeadCellRenderer).props()).toEqual(rowData);
|
|
57
|
+
setUp();
|
|
58
|
+
expect(screen.getByText(defaultProps.rowData.label)).toBeInTheDocument();
|
|
44
59
|
});
|
|
45
60
|
});
|
|
@@ -4,10 +4,9 @@ type Props = {
|
|
|
4
4
|
rowData: RowData;
|
|
5
5
|
columnsData: ColumnData[];
|
|
6
6
|
index: number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
resetHoveredColumn: () => void;
|
|
7
|
+
isMoveColumnEnabled?: boolean;
|
|
8
|
+
setHoveredColumn?: (columnValue: ColumnData) => void;
|
|
9
|
+
resetHoveredColumn?: () => void;
|
|
11
10
|
};
|
|
12
|
-
export declare const TableRow: ({ rowData, columnsData, index,
|
|
11
|
+
export declare const TableRow: ({ rowData, columnsData, index, isMoveColumnEnabled, setHoveredColumn, resetHoveredColumn }: Props) => React.JSX.Element;
|
|
13
12
|
export {};
|
|
@@ -3,13 +3,13 @@ import { TableCell } from '../TableCell';
|
|
|
3
3
|
import { TableCellWithDnd } from '../TableCellWithDnd';
|
|
4
4
|
import { TableHeadCell } from '../TableHeadCell';
|
|
5
5
|
export var TableRow = function (_a) {
|
|
6
|
-
var rowData = _a.rowData, columnsData = _a.columnsData, index = _a.index,
|
|
6
|
+
var rowData = _a.rowData, columnsData = _a.columnsData, index = _a.index, isMoveColumnEnabled = _a.isMoveColumnEnabled, setHoveredColumn = _a.setHoveredColumn, resetHoveredColumn = _a.resetHoveredColumn;
|
|
7
7
|
var isFirstRow = index === 0;
|
|
8
8
|
return (React.createElement("tr", { className: rowData.rowClassName },
|
|
9
|
-
React.createElement(TableHeadCell, { rowData: rowData, isDraggable: false }),
|
|
9
|
+
React.createElement(TableHeadCell, { rowData: rowData, isDraggable: false, columnsData: columnsData }),
|
|
10
10
|
columnsData.map(function (columnValue, index) {
|
|
11
11
|
var isDraggableColumn = columnValue.isDraggable;
|
|
12
12
|
var shouldRenderDragIndicator = isFirstRow && isDraggableColumn;
|
|
13
|
-
return
|
|
13
|
+
return isMoveColumnEnabled ? (React.createElement(TableCellWithDnd, { key: columnValue.id || index, columnValue: columnValue, rowData: rowData, index: index, shouldRenderDragIndicator: shouldRenderDragIndicator, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn })) : (React.createElement(TableCell, { key: columnValue.id || index, rowData: rowData, columnValue: columnValue, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
|
|
14
14
|
})));
|
|
15
15
|
};
|
|
@@ -10,73 +10,51 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import { shallow } from 'enzyme';
|
|
14
|
-
import { TableCell } from '../TableCell';
|
|
15
|
-
import { TableCellWithDnd } from '../TableCellWithDnd';
|
|
16
|
-
import { TableHeadCell } from '../TableHeadCell';
|
|
17
13
|
import { TableRow } from './TableRow';
|
|
14
|
+
import { render, screen } from '@testing-library/react';
|
|
15
|
+
import { DndContext } from '@dnd-kit/core';
|
|
16
|
+
import { getMuiIconByName } from '../../../test-utils';
|
|
18
17
|
var columnsData = [
|
|
19
|
-
{ 'attributes.FirstName':
|
|
20
|
-
{ 'attributes.FirstName':
|
|
18
|
+
{ 'attributes.FirstName': 'FirstNameValue1', isDraggable: false, id: 'entities/123' },
|
|
19
|
+
{ 'attributes.FirstName': 'FirstNameValue2', isDraggable: true, id: 'entities/234' }
|
|
21
20
|
];
|
|
22
21
|
var rowData = { id: 'attributes.FirstName', label: 'FirstName' };
|
|
23
|
-
var
|
|
24
|
-
|
|
22
|
+
var defaultProps = {
|
|
23
|
+
rowData: rowData,
|
|
24
|
+
columnsData: columnsData,
|
|
25
|
+
index: 0
|
|
26
|
+
};
|
|
27
|
+
var setUp = function (props) {
|
|
28
|
+
if (props === void 0) { props = defaultProps; }
|
|
29
|
+
var Providers = function (_a) {
|
|
30
|
+
var children = _a.children;
|
|
31
|
+
return (React.createElement(DndContext, null,
|
|
32
|
+
React.createElement("table", null,
|
|
33
|
+
React.createElement("tbody", null, children))));
|
|
34
|
+
};
|
|
35
|
+
return render(React.createElement(TableRow, __assign({}, props)), { wrapper: Providers });
|
|
36
|
+
};
|
|
25
37
|
describe('TableRow tests', function () {
|
|
26
38
|
it('should render TableHeadCell correctly', function () {
|
|
27
|
-
|
|
28
|
-
expect(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
it('should render "TableCellWithDnd" cells correctly if "onMoveColumn" exist in props', function () {
|
|
34
|
-
var onMoveColumn = jest.fn();
|
|
35
|
-
var onDropColumn = jest.fn();
|
|
36
|
-
var component = shallow(React.createElement(TableRow, { rowData: rowData, columnsData: columnsData, index: 1, onMoveColumn: onMoveColumn, onDropColumn: onDropColumn, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
|
|
37
|
-
expect(component.find(TableCellWithDnd)).toHaveLength(2);
|
|
38
|
-
component.find(TableCellWithDnd).forEach(function (node, index) {
|
|
39
|
-
expect(node.props()).toMatchObject({
|
|
40
|
-
rowData: rowData,
|
|
41
|
-
columnValue: columnsData[index],
|
|
42
|
-
index: index,
|
|
43
|
-
onMoveColumn: onMoveColumn,
|
|
44
|
-
onDropColumn: onDropColumn
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
it('should pass "shouldRenderDragIndicator" prop correctly to "TableCellWithDnd" cells if index === 0', function () {
|
|
49
|
-
var onMoveColumn = jest.fn();
|
|
50
|
-
var component = shallow(React.createElement(TableRow, { rowData: rowData, columnsData: columnsData, index: 0, onMoveColumn: onMoveColumn, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
|
|
51
|
-
expect(component.find(TableCellWithDnd)).toHaveLength(2);
|
|
52
|
-
component.find(TableCellWithDnd).forEach(function (node, index) {
|
|
53
|
-
expect(node.prop('shouldRenderDragIndicator')).toBe(columnsData[index].isDraggable);
|
|
54
|
-
});
|
|
39
|
+
setUp();
|
|
40
|
+
expect(screen.getByText(rowData.label)).toBeInTheDocument();
|
|
41
|
+
expect(screen.getByText(columnsData[0]['attributes.FirstName'])).toBeInTheDocument();
|
|
42
|
+
expect(screen.getByText(columnsData[1]['attributes.FirstName'])).toBeInTheDocument();
|
|
55
43
|
});
|
|
56
|
-
it('should
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
expect(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
44
|
+
it('should render "TableCellWithDnd" cells correctly if "isMoveColumnEnabled" is true in props', function () {
|
|
45
|
+
setUp(__assign(__assign({}, defaultProps), { isMoveColumnEnabled: true }));
|
|
46
|
+
expect(screen.getByText(rowData.label)).toBeInTheDocument();
|
|
47
|
+
expect(screen.getByText(columnsData[0]['attributes.FirstName'])).toBeInTheDocument();
|
|
48
|
+
expect(screen.getByText(columnsData[1]['attributes.FirstName'])).toBeInTheDocument();
|
|
49
|
+
expect(getMuiIconByName('DragIndicator')).toBeInTheDocument();
|
|
63
50
|
});
|
|
64
|
-
it('should
|
|
65
|
-
|
|
66
|
-
expect(
|
|
67
|
-
component.find(TableCell).forEach(function (node, index) {
|
|
68
|
-
expect(node.props()).toEqual({
|
|
69
|
-
rowData: rowData,
|
|
70
|
-
columnValue: columnsData[index],
|
|
71
|
-
setHoveredColumn: setHoveredColumn,
|
|
72
|
-
resetHoveredColumn: resetHoveredColumn
|
|
73
|
-
});
|
|
74
|
-
});
|
|
51
|
+
it('should pass "shouldRenderDragIndicator" prop correctly to "TableCellWithDnd" cells if index not 0', function () {
|
|
52
|
+
setUp(__assign(__assign({}, defaultProps), { isMoveColumnEnabled: true, index: 1 }));
|
|
53
|
+
expect(getMuiIconByName('DragIndicator')).not.toBeInTheDocument();
|
|
75
54
|
});
|
|
76
55
|
it('should add rowClassName to tr element', function () {
|
|
77
56
|
var rowClassName = 'class1';
|
|
78
|
-
|
|
79
|
-
expect(
|
|
80
|
-
expect(component.find('tr').hasClass(rowClassName)).toBe(true);
|
|
57
|
+
setUp(__assign(__assign({}, defaultProps), { rowData: __assign(__assign({}, rowData), { rowClassName: rowClassName }) }));
|
|
58
|
+
expect(screen.getByRole('row')).toHaveClass(rowClassName);
|
|
81
59
|
});
|
|
82
60
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColumnData, RowData } from '../../types';
|
|
3
|
+
type Props = {
|
|
4
|
+
tableClassName: string;
|
|
5
|
+
tableWidth: number;
|
|
6
|
+
draggingRow: {
|
|
7
|
+
columnsData: ColumnData[];
|
|
8
|
+
rowData: RowData;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const TableRowDragPreview: React.MemoExoticComponent<({ draggingRow, tableClassName, tableWidth }: Props) => React.JSX.Element>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { TableRow } from '../TableRow/TableRow';
|
|
3
|
+
import { useStyles } from './styles';
|
|
4
|
+
export var TableRowDragPreview = memo(function (_a) {
|
|
5
|
+
var draggingRow = _a.draggingRow, tableClassName = _a.tableClassName, tableWidth = _a.tableWidth;
|
|
6
|
+
var styles = useStyles();
|
|
7
|
+
if (!draggingRow) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
var columnsData = draggingRow.columnsData, rowData = draggingRow.rowData;
|
|
11
|
+
return (React.createElement("div", { style: { width: tableWidth }, className: styles.root },
|
|
12
|
+
React.createElement("table", { className: tableClassName },
|
|
13
|
+
React.createElement("tbody", null,
|
|
14
|
+
React.createElement(TableRow, { index: 1, key: rowData.id, rowData: rowData, columnsData: columnsData })))));
|
|
15
|
+
});
|
|
16
|
+
TableRowDragPreview.displayName = 'TableRowDragPreview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TableRowDragPreview } from './TableRowDragPreview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TableRowDragPreview } from './TableRowDragPreview';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"root">;
|
|
@@ -2,16 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { RowData, ColumnData } from '../../types';
|
|
3
3
|
type Props = {
|
|
4
4
|
rowData: RowData;
|
|
5
|
-
index: number;
|
|
6
5
|
columnsData: ColumnData[];
|
|
7
|
-
|
|
8
|
-
onDropRow?: () => void;
|
|
9
|
-
onMoveColumn?: (dragId: string, hoverId: string) => void;
|
|
10
|
-
onDropColumn?: () => void;
|
|
6
|
+
isMoveColumnEnabled?: boolean;
|
|
11
7
|
setHoveredColumn: (columnValue: ColumnData) => void;
|
|
12
8
|
resetHoveredColumn: () => void;
|
|
13
|
-
someRowIsDragging: boolean;
|
|
14
|
-
setSomeRowIsDragging: (isDragging: boolean) => void;
|
|
15
9
|
};
|
|
16
|
-
export declare const TableRowWithDnd: ({ rowData,
|
|
10
|
+
export declare const TableRowWithDnd: ({ rowData, columnsData, isMoveColumnEnabled, setHoveredColumn, resetHoveredColumn }: Props) => React.JSX.Element;
|
|
17
11
|
export {};
|
|
@@ -1,63 +1,32 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { useDrag, useDrop } from 'react-dnd';
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
3
2
|
import { TableHeadCell } from '../TableHeadCell';
|
|
4
3
|
import { TableCell } from '../TableCell';
|
|
5
4
|
import { TableCellWithDnd } from '../TableCellWithDnd';
|
|
6
5
|
import { DndItemTypes } from '../../types';
|
|
6
|
+
import { useDndMonitor, useDroppable } from '@dnd-kit/core';
|
|
7
7
|
export var TableRowWithDnd = function (_a) {
|
|
8
|
-
var rowData = _a.rowData,
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
var rowData = _a.rowData, columnsData = _a.columnsData, isMoveColumnEnabled = _a.isMoveColumnEnabled, setHoveredColumn = _a.setHoveredColumn, resetHoveredColumn = _a.resetHoveredColumn;
|
|
9
|
+
var setDroppableNodeRef = useDroppable({
|
|
10
|
+
id: rowData.id
|
|
11
|
+
}).setNodeRef;
|
|
12
|
+
var _b = useState(false), enableDropForRow = _b[0], setEnableDropForRow = _b[1];
|
|
13
|
+
var _c = useState(false), rowIsDragging = _c[0], setRowIsDragging = _c[1];
|
|
14
|
+
useDndMonitor({
|
|
15
|
+
onDragStart: function (event) {
|
|
16
|
+
if (event.active.data.current.type === DndItemTypes.Row) {
|
|
17
|
+
setEnableDropForRow(true);
|
|
18
|
+
setRowIsDragging(event.active.id === rowData.id);
|
|
16
19
|
}
|
|
17
|
-
var dragIndex = item.index;
|
|
18
|
-
var hoverIndex = index;
|
|
19
|
-
if (dragIndex === hoverIndex) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
var hoverBoundingRect = dropRef.current.getBoundingClientRect();
|
|
23
|
-
var hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
|
24
|
-
var clientOffset = monitor.getClientOffset();
|
|
25
|
-
var hoverClientY = clientOffset.y - hoverBoundingRect.top;
|
|
26
|
-
if (dragIndex < hoverIndex && hoverClientY < hoverMiddleY) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (dragIndex > hoverIndex && hoverClientY > hoverMiddleY) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
onMoveRow(item.id, rowData.id);
|
|
33
|
-
item.index = hoverIndex;
|
|
34
|
-
},
|
|
35
|
-
drop: function () {
|
|
36
|
-
if (onDropRow)
|
|
37
|
-
onDropRow();
|
|
38
20
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
isDragging: monitor.isDragging()
|
|
48
|
-
}); }
|
|
49
|
-
}), _d = _c[0], isDragging = _d.isDragging, sourceId = _d.sourceId, drag = _c[1], preview = _c[2];
|
|
50
|
-
useEffect(function () {
|
|
51
|
-
preview(drop(dropRef));
|
|
52
|
-
drag(dragRef);
|
|
53
|
-
}, []);
|
|
54
|
-
useEffect(function () {
|
|
55
|
-
setSomeRowIsDragging(isDragging);
|
|
56
|
-
}, [isDragging, setSomeRowIsDragging]);
|
|
57
|
-
var opacity = isDragging ? 0 : 1;
|
|
58
|
-
return (React.createElement("tr", { className: rowData.rowClassName, style: { opacity: opacity }, ref: dropRef, "data-target-id": targetId, "data-source-id": sourceId },
|
|
59
|
-
React.createElement(TableHeadCell, { rowData: rowData, isDraggable: true, dragRef: dragRef }),
|
|
21
|
+
onDragEnd: function () {
|
|
22
|
+
setRowIsDragging(false);
|
|
23
|
+
setEnableDropForRow(false);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var rowStyle = useMemo(function () { return ({ opacity: rowIsDragging ? 0 : 1 }); }, [rowIsDragging]);
|
|
27
|
+
return (React.createElement("tr", { className: rowData.rowClassName, style: rowStyle, ref: enableDropForRow ? setDroppableNodeRef : undefined },
|
|
28
|
+
React.createElement(TableHeadCell, { rowData: rowData, isDraggable: true, columnsData: columnsData }),
|
|
60
29
|
columnsData.map(function (columnValue, index) {
|
|
61
|
-
return
|
|
30
|
+
return isMoveColumnEnabled ? (React.createElement(TableCellWithDnd, { key: columnValue.id || index, columnValue: columnValue, rowData: rowData, index: index, shouldRenderDragIndicator: false, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn, rowIsDragging: rowIsDragging })) : (React.createElement(TableCell, { key: columnValue.id || index, columnValue: columnValue, rowData: rowData, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn, rowIsDragging: rowIsDragging }));
|
|
62
31
|
})));
|
|
63
32
|
};
|
|
@@ -10,106 +10,76 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import {
|
|
14
|
-
import { act } from '
|
|
15
|
-
import {
|
|
16
|
-
import TestBackend from 'react-dnd-test-backend';
|
|
17
|
-
import { TableCell } from '../TableCell';
|
|
18
|
-
import { TableCellWithDnd } from '../TableCellWithDnd';
|
|
19
|
-
import { TableHeadCell } from '../TableHeadCell';
|
|
13
|
+
import { DndContext, useDndMonitor, useDroppable } from '@dnd-kit/core';
|
|
14
|
+
import { act, render, screen } from '@testing-library/react';
|
|
15
|
+
import { DndItemTypes } from '../../types';
|
|
20
16
|
import { TableRowWithDnd } from './TableRowWithDnd';
|
|
17
|
+
jest.mock('@dnd-kit/core', function () { return (__assign(__assign({}, jest.requireActual('@dnd-kit/core')), { useDndMonitor: jest.fn(), useDroppable: jest.fn().mockReturnValue({ setNodeRef: jest.fn() }) })); });
|
|
21
18
|
var defaultColumnsData = [
|
|
22
19
|
{ 'attributes.FirstName': 'FirstName1', isDraggable: false, id: 'entities/123' },
|
|
23
20
|
{ 'attributes.FirstName': 'FirstName2', isDraggable: true, id: 'entities/234' }
|
|
24
21
|
];
|
|
25
22
|
var defaultRowData = { id: 'attributes.FirstName', label: 'FirstName' };
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
var rowName = "".concat(defaultRowData.label, " ").concat(defaultColumnsData[0]['attributes.FirstName'], " ").concat(defaultColumnsData[1]['attributes.FirstName']);
|
|
24
|
+
var defaultProps = {
|
|
25
|
+
columnsData: defaultColumnsData,
|
|
26
|
+
rowData: defaultRowData,
|
|
27
|
+
isMoveColumnEnabled: false,
|
|
28
|
+
setHoveredColumn: jest.fn(),
|
|
29
|
+
resetHoveredColumn: jest.fn()
|
|
30
|
+
};
|
|
31
|
+
var setUp = function (props) {
|
|
32
|
+
if (props === void 0) { props = defaultProps; }
|
|
33
|
+
var Providers = function (_a) {
|
|
34
|
+
var children = _a.children;
|
|
35
|
+
return (React.createElement(DndContext, null,
|
|
36
|
+
React.createElement("table", null,
|
|
37
|
+
React.createElement("tbody", null, children))));
|
|
38
|
+
};
|
|
39
|
+
return render(React.createElement(TableRowWithDnd, __assign({}, props)), { wrapper: Providers });
|
|
38
40
|
};
|
|
39
41
|
describe('TableRow tests', function () {
|
|
40
42
|
it('should render TableHeadCell correctly', function () {
|
|
41
|
-
|
|
42
|
-
expect(
|
|
43
|
-
|
|
44
|
-
isDraggable: true
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
it('should render "TableCellWithDnd" cells correctly if "onMoveColumn" exist in props', function () {
|
|
48
|
-
var onMoveColumn = jest.fn();
|
|
49
|
-
var onDropColumn = jest.fn();
|
|
50
|
-
var props = { onMoveColumn: onMoveColumn, onDropColumn: onDropColumn, someRowIsDragging: true };
|
|
51
|
-
var component = setUp(props)[0];
|
|
52
|
-
expect(component.find(TableCellWithDnd)).toHaveLength(2);
|
|
53
|
-
component.find(TableCellWithDnd).forEach(function (node, index) {
|
|
54
|
-
expect(node.props()).toMatchObject({
|
|
55
|
-
rowData: defaultRowData,
|
|
56
|
-
columnValue: defaultColumnsData[index],
|
|
57
|
-
index: index,
|
|
58
|
-
onMoveColumn: onMoveColumn,
|
|
59
|
-
onDropColumn: onDropColumn,
|
|
60
|
-
shouldRenderDragIndicator: false,
|
|
61
|
-
someRowIsDragging: true
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
it('should render "TableCell" cells correctly if "onMoveColumn" is missing in props', function () {
|
|
66
|
-
var setHoveredColumn = jest.fn();
|
|
67
|
-
var resetHoveredColumn = jest.fn();
|
|
68
|
-
var props = {
|
|
69
|
-
onMoveColumn: null,
|
|
70
|
-
setHoveredColumn: setHoveredColumn,
|
|
71
|
-
resetHoveredColumn: resetHoveredColumn,
|
|
72
|
-
someRowIsDragging: false
|
|
73
|
-
};
|
|
74
|
-
var component = setUp(props)[0];
|
|
75
|
-
expect(component.find(TableCell)).toHaveLength(2);
|
|
76
|
-
component.find(TableCell).forEach(function (node, index) {
|
|
77
|
-
expect(node.props()).toEqual({
|
|
78
|
-
rowData: defaultRowData,
|
|
79
|
-
columnValue: defaultColumnsData[index],
|
|
80
|
-
setHoveredColumn: setHoveredColumn,
|
|
81
|
-
resetHoveredColumn: resetHoveredColumn,
|
|
82
|
-
someRowIsDragging: false
|
|
83
|
-
});
|
|
84
|
-
});
|
|
43
|
+
setUp();
|
|
44
|
+
expect(screen.getByText('FirstName1')).toBeInTheDocument();
|
|
45
|
+
expect(screen.getByText('FirstName2')).toBeInTheDocument();
|
|
85
46
|
});
|
|
86
47
|
it('should add rowClassName to tr element', function () {
|
|
87
48
|
var rowClassName = 'class1';
|
|
88
|
-
|
|
89
|
-
expect(
|
|
90
|
-
expect(component.find('tr').hasClass(rowClassName)).toBe(true);
|
|
49
|
+
setUp(__assign(__assign({}, defaultProps), { rowData: __assign(__assign({}, defaultRowData), { rowClassName: rowClassName }) }));
|
|
50
|
+
expect(screen.getByRole('row', { name: rowName })).toHaveClass(rowClassName);
|
|
91
51
|
});
|
|
92
|
-
it('should set
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
52
|
+
it('should set opacity correctly when dragging was start and dragging was end', function () {
|
|
53
|
+
var onDragStart, onDragEnd;
|
|
54
|
+
useDndMonitor.mockImplementation(function (listeners) {
|
|
55
|
+
onDragStart = listeners.onDragStart;
|
|
56
|
+
onDragEnd = listeners.onDragEnd;
|
|
57
|
+
});
|
|
58
|
+
setUp();
|
|
59
|
+
var row = screen.getByRole('row', { name: rowName });
|
|
60
|
+
expect(row).toHaveStyle({ opacity: 1 });
|
|
98
61
|
act(function () {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
62
|
+
onDragStart({
|
|
63
|
+
active: {
|
|
64
|
+
id: defaultProps.rowData.id,
|
|
65
|
+
data: {
|
|
66
|
+
current: {
|
|
67
|
+
type: DndItemTypes.Row
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
102
71
|
});
|
|
103
72
|
});
|
|
104
|
-
|
|
105
|
-
expect(setSomeRowIsDragging).toHaveBeenCalledWith(true);
|
|
106
|
-
var targetId = component.find('tr').prop('data-target-id');
|
|
73
|
+
expect(row).toHaveStyle({ opacity: 0 });
|
|
107
74
|
act(function () {
|
|
108
|
-
|
|
109
|
-
backend.simulateDrop();
|
|
110
|
-
backend.simulateEndDrag();
|
|
75
|
+
onDragEnd();
|
|
111
76
|
});
|
|
112
|
-
|
|
113
|
-
|
|
77
|
+
expect(row).toHaveStyle({ opacity: 1 });
|
|
78
|
+
});
|
|
79
|
+
it('should should use TableCellWithDnd if isMoveColumnEnabled is true', function () {
|
|
80
|
+
useDroppable.mockClear();
|
|
81
|
+
setUp(__assign(__assign({}, defaultProps), { isMoveColumnEnabled: true }));
|
|
82
|
+
expect(useDroppable).toHaveBeenCalledWith({ id: defaultColumnsData[0].id });
|
|
83
|
+
expect(useDroppable).toHaveBeenCalledWith({ id: defaultColumnsData[1].id });
|
|
114
84
|
});
|
|
115
85
|
});
|
|
@@ -4,8 +4,8 @@ import { BarChartOptions } from '@reltio/mdm-sdk';
|
|
|
4
4
|
type BarChartSettings = {
|
|
5
5
|
barChart: React.ComponentProps<typeof BarChart>;
|
|
6
6
|
bar: Omit<BarProps, 'ref'>;
|
|
7
|
-
xAxis: XAxisProps
|
|
8
|
-
yAxis: YAxisProps
|
|
7
|
+
xAxis: Omit<XAxisProps, 'ref'>;
|
|
8
|
+
yAxis: Omit<YAxisProps, 'ref'>;
|
|
9
9
|
cartesianGrid: Omit<CartesianGridProps, 'ref'>;
|
|
10
10
|
tooltip: TooltipProps<number, string>;
|
|
11
11
|
};
|