@reltio/components 1.4.2017 → 1.4.2019
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/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/SimpleAttribute/IntegrationSimpleAttribute.test.js +21 -5
- 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/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/SimpleAttribute/IntegrationSimpleAttribute.test.js +21 -5
- 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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { memo, useState } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { canAddCrosswalk, getSourceSystemLabel } from '@reltio/mdm-sdk';
|
|
4
|
+
import { useDndMonitor } from '@dnd-kit/core';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import { useMdmMetadata } from '../../../contexts/MdmModuleContext';
|
|
7
|
+
import { useCrosswalkColor } from '../../../contexts/CrosswalksDisplayContext';
|
|
8
|
+
import { SourceIcon } from '../../../SourceIcon';
|
|
9
|
+
import { ColoredBlock } from '../ColoredBlock';
|
|
10
|
+
import { useStyles } from './styles';
|
|
11
|
+
export var CrosswalkDragPreview = memo(function (_a) {
|
|
12
|
+
var _b;
|
|
13
|
+
var crosswalk = _a.crosswalk;
|
|
14
|
+
var styles = useStyles();
|
|
15
|
+
var metadata = useMdmMetadata();
|
|
16
|
+
var color = useCrosswalkColor(crosswalk);
|
|
17
|
+
var sourceSystemLabel = getSourceSystemLabel(metadata, crosswalk.type);
|
|
18
|
+
var _c = useState(false), canDrop = _c[0], setCanDrop = _c[1];
|
|
19
|
+
useDndMonitor({
|
|
20
|
+
onDragOver: function (event) {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
var attributeType = (_c = (_b = (_a = event.over) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.attributeType;
|
|
23
|
+
setCanDrop(!!attributeType && canAddCrosswalk(crosswalk, attributeType));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return (React.createElement(ColoredBlock, { color: color, className: classnames(styles.crosswalkPreview, (_b = {}, _b[styles.noDrop] = !canDrop, _b)) },
|
|
27
|
+
React.createElement(SourceIcon, { className: styles.sourceIcon, sourceType: crosswalk.type }),
|
|
28
|
+
React.createElement(Typography, { className: styles.sourceLabel, variant: 'body2' }, sourceSystemLabel)));
|
|
29
|
+
});
|
|
30
|
+
CrosswalkDragPreview.displayName = 'CrosswalkDragPreview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
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 * as CrosswalksDisplay from '../../../contexts/CrosswalksDisplayContext';
|
|
14
|
+
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
15
|
+
import { CrosswalkDragPreview } from './CrosswalkDragPreview';
|
|
16
|
+
import { act, render, screen } from '@testing-library/react';
|
|
17
|
+
import { DndContext, useDndMonitor } from '@dnd-kit/core';
|
|
18
|
+
jest.mock('@dnd-kit/core', function () { return (__assign(__assign({}, jest.requireActual('@dnd-kit/core')), { useDndMonitor: jest.fn() })); });
|
|
19
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { canAddCrosswalk: jest.fn().mockReturnValue(true) })); });
|
|
20
|
+
var defaultProps = {
|
|
21
|
+
crosswalk: { uri: 'entities/1/crosswalks/1', type: 'configuration/sources/FB', value: '123' }
|
|
22
|
+
};
|
|
23
|
+
var setUp = function (props) {
|
|
24
|
+
if (props === void 0) { props = defaultProps; }
|
|
25
|
+
var metadata = {
|
|
26
|
+
sources: [
|
|
27
|
+
{
|
|
28
|
+
uri: 'configuration/sources/FB',
|
|
29
|
+
label: 'Facebook'
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
var Providers = function (_a) {
|
|
34
|
+
var children = _a.children;
|
|
35
|
+
return (React.createElement(DndContext, null,
|
|
36
|
+
React.createElement(MdmModuleProvider, { values: { metadata: metadata } }, children)));
|
|
37
|
+
};
|
|
38
|
+
return render(React.createElement(CrosswalkDragPreview, __assign({}, props)), { wrapper: Providers });
|
|
39
|
+
};
|
|
40
|
+
describe('CrosswalkDragPreview tests', function () {
|
|
41
|
+
beforeAll(function () {
|
|
42
|
+
jest.spyOn(CrosswalksDisplay, 'useCrosswalkColor').mockImplementation(function (crosswalks) { return crosswalks === null || crosswalks === void 0 ? void 0 : crosswalks.value; });
|
|
43
|
+
});
|
|
44
|
+
it('should render correctly', function () {
|
|
45
|
+
setUp();
|
|
46
|
+
expect(screen.getByText('Facebook')).toBeInTheDocument();
|
|
47
|
+
expect(screen.getByText('F')).toBeInTheDocument();
|
|
48
|
+
expect(screen.getByTestId('cw-colored-block')).toHaveClass('noDrop');
|
|
49
|
+
});
|
|
50
|
+
it('should able for drop', function () {
|
|
51
|
+
var onDragOver;
|
|
52
|
+
useDndMonitor.mockImplementation(function (listeners) {
|
|
53
|
+
onDragOver = listeners.onDragOver;
|
|
54
|
+
});
|
|
55
|
+
setUp();
|
|
56
|
+
act(function () {
|
|
57
|
+
onDragOver({
|
|
58
|
+
over: {
|
|
59
|
+
data: {
|
|
60
|
+
current: {
|
|
61
|
+
attributeType: 'testAttrTypeUri'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
expect(screen.getByTestId('cw-colored-block')).not.toHaveClass('noDrop');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"sourceIcon" | "crosswalkPreview" | "sourceLabel">;
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"sourceIcon" | "crosswalkPreview" | "sourceLabel" | "noDrop">;
|
|
@@ -2,12 +2,14 @@ import { makeStyles } from '@mui/styles';
|
|
|
2
2
|
export var useStyles = makeStyles({
|
|
3
3
|
crosswalkPreview: {
|
|
4
4
|
height: '28px',
|
|
5
|
+
width: 'max-content',
|
|
5
6
|
maxWidth: '394px',
|
|
6
7
|
display: 'flex',
|
|
7
8
|
overflow: 'hidden',
|
|
8
9
|
padding: '6px',
|
|
9
10
|
alignItems: 'center',
|
|
10
|
-
boxSizing: 'border-box'
|
|
11
|
+
boxSizing: 'border-box',
|
|
12
|
+
cursor: 'copy'
|
|
11
13
|
},
|
|
12
14
|
sourceLabel: {
|
|
13
15
|
fontSize: '13px',
|
|
@@ -19,5 +21,8 @@ export var useStyles = makeStyles({
|
|
|
19
21
|
width: '16px',
|
|
20
22
|
height: '16px',
|
|
21
23
|
marginRight: '9px'
|
|
24
|
+
},
|
|
25
|
+
noDrop: {
|
|
26
|
+
cursor: 'no-drop'
|
|
22
27
|
}
|
|
23
28
|
});
|
|
@@ -1,7 +1,17 @@
|
|
|
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
|
+
};
|
|
1
12
|
import React, { useEffect, useRef, useState, memo } from 'react';
|
|
2
13
|
import i18n from 'ui-i18n';
|
|
3
|
-
import {
|
|
4
|
-
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
14
|
+
import { useDraggable } from '@dnd-kit/core';
|
|
5
15
|
import { eqCrosswalks, getLastUriPart, getSourceSystemLabel, isCrosswalkDisabled } from '@reltio/mdm-sdk';
|
|
6
16
|
import Typography from '@mui/material/Typography';
|
|
7
17
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
@@ -34,17 +44,15 @@ export var CrosswalkRow = memo(function (_a) {
|
|
|
34
44
|
var crosswalkId = getLastUriPart(crosswalk.uri);
|
|
35
45
|
var crosswalkDisabled = isCrosswalkDisabled(crosswalk);
|
|
36
46
|
var styles = useStyles({ color: color, isOpaque: !isDimmed, isFocused: isFocused });
|
|
37
|
-
var _j =
|
|
38
|
-
|
|
47
|
+
var _j = useDraggable({
|
|
48
|
+
id: crosswalk.uri,
|
|
49
|
+
data: {
|
|
39
50
|
type: 'Crosswalk',
|
|
40
51
|
crosswalk: crosswalk
|
|
41
52
|
},
|
|
42
|
-
|
|
43
|
-
}),
|
|
53
|
+
disabled: crosswalkDisabled
|
|
54
|
+
}), setNodeRef = _j.setNodeRef, attributes = _j.attributes, listeners = _j.listeners;
|
|
44
55
|
var canDelete = !crosswalkDisabled && crosswalk.ownerType !== 'relation';
|
|
45
|
-
useEffect(function () {
|
|
46
|
-
preview(getEmptyImage(), { captureDraggingState: true });
|
|
47
|
-
}, []);
|
|
48
56
|
useEffect(function () {
|
|
49
57
|
var _a, _b;
|
|
50
58
|
if (focusable &&
|
|
@@ -62,15 +70,16 @@ export var CrosswalkRow = memo(function (_a) {
|
|
|
62
70
|
return (React.createElement("div", { className: styles.root, ref: ref },
|
|
63
71
|
React.createElement(SmallIconButtonWithTooltip, { size: "XXS", className: styles.focusedIcon, icon: focusable && VisibilityIcon, onClick: function () { return toggleCrosswalkFocus(); }, disabled: !focusable, tooltipTitle: focusable && i18n.text('Focus') }),
|
|
64
72
|
React.createElement("div", { className: styles.crosswalkWrapper },
|
|
65
|
-
React.createElement(ColoredBlock, {
|
|
73
|
+
React.createElement(ColoredBlock, { className: styles.header, color: color, variant: crosswalkDisabled ? 'disabled' : 'standart', onMouseEnter: highlightCrosswalk, onMouseLeave: removeHighlight },
|
|
66
74
|
isDependent && React.createElement(DependentIcon, { className: styles.dependentIcon }),
|
|
67
75
|
React.createElement(ArrowExpandButton, { onClick: function () { return setExpanded(function (value) { return !value; }); }, expanded: expanded }),
|
|
68
|
-
React.createElement(
|
|
69
|
-
|
|
70
|
-
React.createElement(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
React.createElement(
|
|
76
|
+
React.createElement("div", __assign({ className: styles.dragWrapper, ref: setNodeRef }, listeners, attributes),
|
|
77
|
+
React.createElement(SourceIcon, { className: styles.sourceIcon, sourceType: crosswalk.type }),
|
|
78
|
+
React.createElement(ExpandedValueTooltip, { value: sourceSystemLabel },
|
|
79
|
+
React.createElement(Typography, { variant: 'body2', noWrap: true }, sourceSystemLabel)),
|
|
80
|
+
React.createElement(Spacer, null),
|
|
81
|
+
React.createElement(ExpandedValueTooltip, { value: crosswalk.value },
|
|
82
|
+
React.createElement(Typography, { variant: 'body2', className: styles.labelValue, noWrap: true }, crosswalk.value)))),
|
|
74
83
|
expanded && (React.createElement("div", { className: styles.attributesWrapper },
|
|
75
84
|
canDelete && (React.createElement("div", { className: styles.deleteCrosswalkButton },
|
|
76
85
|
React.createElement(SmallIconButtonWithTooltip, { icon: DeleteIcon, disabled: disableDelete, onClick: function () { return setDeleteDialogOpen(true); }, size: "XS", tooltipTitle: disableDelete
|
|
@@ -52,14 +52,12 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
|
52
52
|
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
53
53
|
import { ThemeProvider } from '@mui/styles';
|
|
54
54
|
import { createTheme } from '@mui/material/styles';
|
|
55
|
-
import * as reactDnd from 'react-dnd';
|
|
56
|
-
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
57
55
|
import { isCrosswalkDisabled, theme } from '@reltio/mdm-sdk';
|
|
58
56
|
import * as CrosswalksDisplay from '../../../contexts/CrosswalksDisplayContext';
|
|
59
57
|
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
60
58
|
import { CrosswalkRow } from './CrosswalkRow';
|
|
59
|
+
import { DndContext } from '@dnd-kit/core';
|
|
61
60
|
jest.unmock('@mui/styles');
|
|
62
|
-
jest.mock('react-dnd', function () { return (__assign(__assign({}, jest.requireActual('react-dnd')), { useDrag: jest.fn() })); });
|
|
63
61
|
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { isCrosswalkDisabled: jest.fn() })); });
|
|
64
62
|
var metadata = {
|
|
65
63
|
sources: [
|
|
@@ -95,14 +93,16 @@ var defaultProps = {
|
|
|
95
93
|
onDelete: jest.fn(),
|
|
96
94
|
onEdit: jest.fn()
|
|
97
95
|
};
|
|
98
|
-
var setUp = function (props) {
|
|
96
|
+
var setUp = function (props, dndProps) {
|
|
99
97
|
if (props === void 0) { props = defaultProps; }
|
|
98
|
+
if (dndProps === void 0) { dndProps = {}; }
|
|
100
99
|
var user = userEvent.setup({ delay: null });
|
|
101
100
|
var Providers = function (_a) {
|
|
102
101
|
var children = _a.children;
|
|
103
|
-
return (React.createElement(
|
|
104
|
-
React.createElement(
|
|
105
|
-
React.createElement(
|
|
102
|
+
return (React.createElement(DndContext, __assign({}, dndProps),
|
|
103
|
+
React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
|
|
104
|
+
React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment },
|
|
105
|
+
React.createElement(ThemeProvider, { theme: createTheme(theme) }, children)))));
|
|
106
106
|
};
|
|
107
107
|
var renderer = render(React.createElement(CrosswalkRow, __assign({}, props)), { wrapper: Providers });
|
|
108
108
|
return __assign(__assign({}, renderer), { user: user });
|
|
@@ -111,8 +111,6 @@ describe('CrosswalkRow tests', function () {
|
|
|
111
111
|
var highlightCrosswalk = jest.fn();
|
|
112
112
|
var removeHighlight = jest.fn();
|
|
113
113
|
var toggleCrosswalkFocus = jest.fn();
|
|
114
|
-
var preview = jest.fn();
|
|
115
|
-
var useDragMock = jest.spyOn(reactDnd, 'useDrag').mockReturnValue([undefined, function () { return null; }, preview]);
|
|
116
114
|
var useHighlightedCrosswalksMock = jest.spyOn(CrosswalksDisplay, 'useHighlightedCrosswalks').mockReturnValue([]);
|
|
117
115
|
beforeEach(function () {
|
|
118
116
|
isCrosswalkDisabled.mockReturnValue(false);
|
|
@@ -444,28 +442,4 @@ describe('CrosswalkRow tests', function () {
|
|
|
444
442
|
rerender(React.createElement(CrosswalkRow, __assign({}, props, { crosswalk: __assign({}, crosswalk) })));
|
|
445
443
|
expect(node.scrollIntoView).toHaveBeenCalled();
|
|
446
444
|
});
|
|
447
|
-
describe('dnd', function () {
|
|
448
|
-
afterEach(function () {
|
|
449
|
-
useDragMock.mockClear();
|
|
450
|
-
});
|
|
451
|
-
it('should use correct drag item', function () {
|
|
452
|
-
setUp();
|
|
453
|
-
var _a = useDragMock.mock.calls[0][0], item = _a.item, canDrag = _a.canDrag;
|
|
454
|
-
expect(item).toEqual({
|
|
455
|
-
type: 'Crosswalk',
|
|
456
|
-
crosswalk: defaultProps.crosswalk
|
|
457
|
-
});
|
|
458
|
-
expect(canDrag).toBe(true);
|
|
459
|
-
});
|
|
460
|
-
it('should use empty image preview', function () {
|
|
461
|
-
setUp();
|
|
462
|
-
expect(preview).toHaveBeenCalledWith(getEmptyImage(), { captureDraggingState: true });
|
|
463
|
-
});
|
|
464
|
-
it('should not allow drag if crosswalk is disabled', function () {
|
|
465
|
-
isCrosswalkDisabled.mockReturnValue(true);
|
|
466
|
-
setUp();
|
|
467
|
-
var canDrag = useDragMock.mock.calls[0][0].canDrag;
|
|
468
|
-
expect(canDrag).toBe(false);
|
|
469
|
-
});
|
|
470
|
-
});
|
|
471
445
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
};
|
|
48
|
+
import React from 'react';
|
|
49
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
51
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
52
|
+
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
53
|
+
import { ThemeProvider } from '@mui/styles';
|
|
54
|
+
import { createTheme } from '@mui/material/styles';
|
|
55
|
+
import { mockDndKit } from '../../../test-utils/dndKit';
|
|
56
|
+
import { DndContext } from '@dnd-kit/core';
|
|
57
|
+
import { isCrosswalkDisabled, theme } from '@reltio/mdm-sdk';
|
|
58
|
+
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
59
|
+
import { CrosswalkRow } from './CrosswalkRow';
|
|
60
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { isCrosswalkDisabled: jest.fn() })); });
|
|
61
|
+
jest.mock('@dnd-kit/core', function () { return mockDndKit; });
|
|
62
|
+
var metadata = {
|
|
63
|
+
sources: [
|
|
64
|
+
{
|
|
65
|
+
uri: 'configuration/sources/Reltio',
|
|
66
|
+
label: 'Reltio',
|
|
67
|
+
icon: 'images/source/reltio.png',
|
|
68
|
+
abbreviation: 'Reltio'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
uri: 'configuration/sources/AHA',
|
|
72
|
+
label: 'AHA',
|
|
73
|
+
icon: 'images/source/source_s.png',
|
|
74
|
+
abbreviation: 'AHA'
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
var crosswalk = {
|
|
79
|
+
uri: 'entities/j8K1vc9/crosswalks/1kQ5cap2n',
|
|
80
|
+
type: 'configuration/sources/Reltio',
|
|
81
|
+
value: 'some value',
|
|
82
|
+
attributes: [],
|
|
83
|
+
singleAttributeUpdateDates: {},
|
|
84
|
+
createDate: '2021-05-14T05:21:14.532Z'
|
|
85
|
+
};
|
|
86
|
+
var defaultProps = {
|
|
87
|
+
crosswalk: crosswalk,
|
|
88
|
+
focusable: true,
|
|
89
|
+
isDependent: false,
|
|
90
|
+
disableEdit: false,
|
|
91
|
+
disableDelete: false,
|
|
92
|
+
onToggleFocus: jest.fn(),
|
|
93
|
+
onDelete: jest.fn(),
|
|
94
|
+
onEdit: jest.fn()
|
|
95
|
+
};
|
|
96
|
+
var setUp = function (props, dndProps) {
|
|
97
|
+
if (props === void 0) { props = defaultProps; }
|
|
98
|
+
if (dndProps === void 0) { dndProps = {}; }
|
|
99
|
+
var user = userEvent.setup({ delay: null });
|
|
100
|
+
var Providers = function (_a) {
|
|
101
|
+
var children = _a.children;
|
|
102
|
+
return (React.createElement(DndContext, __assign({}, dndProps),
|
|
103
|
+
React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
|
|
104
|
+
React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment },
|
|
105
|
+
React.createElement(ThemeProvider, { theme: createTheme(theme) }, children)))));
|
|
106
|
+
};
|
|
107
|
+
var renderer = render(React.createElement(CrosswalkRow, __assign({}, props)), { wrapper: Providers });
|
|
108
|
+
return __assign(__assign({}, renderer), { user: user });
|
|
109
|
+
};
|
|
110
|
+
describe('CrosswalkRow dnd tests', function () {
|
|
111
|
+
it('should use correct drag item', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
112
|
+
var onDragStart;
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
onDragStart = jest.fn();
|
|
115
|
+
setUp(defaultProps, { onDragStart: onDragStart });
|
|
116
|
+
screen.debug(screen.getByText('Reltio'));
|
|
117
|
+
fireEvent.mouseDown(screen.getByText('Reltio'));
|
|
118
|
+
expect(onDragStart.mock.calls[0][0].active.data.current.crosswalk).toBe(defaultProps.crosswalk);
|
|
119
|
+
return [2 /*return*/];
|
|
120
|
+
});
|
|
121
|
+
}); });
|
|
122
|
+
it('should not allow drag if crosswalk is disabled', function () {
|
|
123
|
+
isCrosswalkDisabled.mockReturnValue(true);
|
|
124
|
+
var onDragStart = jest.fn();
|
|
125
|
+
setUp(defaultProps, { onDragStart: onDragStart });
|
|
126
|
+
fireEvent.mouseDown(screen.getByText('Reltio'));
|
|
127
|
+
expect(onDragStart).not.toHaveBeenCalled();
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -3,5 +3,5 @@ type StylesProps = {
|
|
|
3
3
|
isOpaque?: boolean;
|
|
4
4
|
isFocused?: boolean;
|
|
5
5
|
};
|
|
6
|
-
export declare const useStyles: (props: StylesProps) => import("@mui/styles").ClassNameMap<"header" | "root" | "attributesWrapper" | "sourceIcon" | "focusedIcon" | "crosswalkWrapper" | "deleteCrosswalkButton" | "labelValue" | "dependentIcon">;
|
|
6
|
+
export declare const useStyles: (props: StylesProps) => import("@mui/styles").ClassNameMap<"header" | "root" | "attributesWrapper" | "sourceIcon" | "focusedIcon" | "crosswalkWrapper" | "deleteCrosswalkButton" | "labelValue" | "dependentIcon" | "dragWrapper">;
|
|
7
7
|
export {};
|
|
@@ -12,7 +12,11 @@ export var useStyles = makeStyles({
|
|
|
12
12
|
width: '100%',
|
|
13
13
|
display: 'flex',
|
|
14
14
|
alignItems: 'center',
|
|
15
|
-
height: '28px'
|
|
15
|
+
height: '28px',
|
|
16
|
+
cursor: 'grab',
|
|
17
|
+
'&[aria-disabled="true"]': {
|
|
18
|
+
cursor: 'default'
|
|
19
|
+
}
|
|
16
20
|
},
|
|
17
21
|
focusedIcon: function (_a) {
|
|
18
22
|
var isFocused = _a.isFocused;
|
|
@@ -57,5 +61,10 @@ export var useStyles = makeStyles({
|
|
|
57
61
|
width: '16px',
|
|
58
62
|
height: '16px',
|
|
59
63
|
fillOpacity: 0.38
|
|
64
|
+
},
|
|
65
|
+
dragWrapper: {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexGrow: 1,
|
|
68
|
+
alignItems: 'center'
|
|
60
69
|
}
|
|
61
70
|
});
|
|
@@ -55,7 +55,6 @@ import { SourceCrosswalksRow } from './SourceCrosswalksRow';
|
|
|
55
55
|
import { theme } from '@reltio/mdm-sdk';
|
|
56
56
|
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
57
57
|
jest.unmock('@mui/styles');
|
|
58
|
-
jest.mock('react-dnd', function () { return (__assign(__assign({}, jest.requireActual('react-dnd')), { useDrag: jest.fn().mockReturnValue([undefined, function () { return null; }, jest.fn()]) })); });
|
|
59
58
|
var metadata = {
|
|
60
59
|
sources: [
|
|
61
60
|
{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
export var useDraggingCrosswalk = function () {
|
|
3
|
+
var _a = useState(null), draggingCrosswalk = _a[0], setDraggingCrosswalk = _a[1];
|
|
4
|
+
var onDragStart = useCallback(function (event) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
var draggingData = (_b = (_a = event === null || event === void 0 ? void 0 : event.active) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.current;
|
|
7
|
+
if ((draggingData === null || draggingData === void 0 ? void 0 : draggingData.type) === 'Crosswalk') {
|
|
8
|
+
setDraggingCrosswalk(draggingData.crosswalk);
|
|
9
|
+
}
|
|
10
|
+
}, []);
|
|
11
|
+
var onDragEnd = useCallback(function () {
|
|
12
|
+
setDraggingCrosswalk(null);
|
|
13
|
+
}, []);
|
|
14
|
+
return { draggingCrosswalk: draggingCrosswalk, onDragStart: onDragStart, onDragEnd: onDragEnd };
|
|
15
|
+
};
|
|
@@ -83,6 +83,12 @@ export var useModifiedEntity = function (_a) {
|
|
|
83
83
|
return (__assign(__assign({}, crosswalksMap), (_a = {}, _a[ownerType_1] = __assign(__assign({}, crosswalksMap[ownerType_1]), (_b = {}, _b[uri] = [crosswalk], _b)), _a)));
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
+
if (!temporaryAttributes.current.some(function (tempUri) { return areOneHierarchyUris(uri, tempUri); })) {
|
|
87
|
+
temporaryAttributes.current.push(uri);
|
|
88
|
+
}
|
|
89
|
+
if (!emptyTempAttributeUris.includes(newAttribute.uri)) {
|
|
90
|
+
setEmptyTempAttributeUris(function (emptyTempAttributeUris) { return __spreadArray(__spreadArray([], emptyTempAttributeUris, true), [newAttribute.uri], false); });
|
|
91
|
+
}
|
|
86
92
|
setModifiedEntity(function (entity) {
|
|
87
93
|
var _a;
|
|
88
94
|
if (isNil(index)) {
|
|
@@ -90,12 +96,6 @@ export var useModifiedEntity = function (_a) {
|
|
|
90
96
|
}
|
|
91
97
|
return addNewAttribute({ entity: entity, attributeType: attributeType, newAttribute: newAttribute, index: index });
|
|
92
98
|
});
|
|
93
|
-
if (!temporaryAttributes.current.some(function (tempUri) { return areOneHierarchyUris(uri, tempUri); })) {
|
|
94
|
-
temporaryAttributes.current.push(uri);
|
|
95
|
-
}
|
|
96
|
-
if (!emptyTempAttributeUris.includes(newAttribute.uri)) {
|
|
97
|
-
setEmptyTempAttributeUris(function (emptyTempAttributeUris) { return __spreadArray(__spreadArray([], emptyTempAttributeUris, true), [newAttribute.uri], false); });
|
|
98
|
-
}
|
|
99
99
|
}, []);
|
|
100
100
|
var onDeleteAttribute = useCallback(function (event) {
|
|
101
101
|
var uri = event.attributeValue.uri, attributeType = event.attributeType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AttributesTable } from './AttributesTable';
|
|
2
|
-
export { CrosswalkDragLayer } from './CrosswalkDragLayer';
|
|
3
2
|
export { SourceCrosswalksRow } from './SourceCrosswalksRow';
|
|
4
3
|
export { CrosswalkEditor } from './CrosswalkEditor';
|
|
4
|
+
export { CrosswalkDndComponent } from './CrosswalkDndComponent';
|
|
5
5
|
export { useModifiedEntity } from './hooks/useModifiedEntity';
|
|
6
6
|
export { useCrosswalkActions } from './hooks/useCrosswalkActions';
|
|
7
7
|
export { groupCrosswalksByTypesAndSources } from './utils/legend';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// components
|
|
2
2
|
export { AttributesTable } from './AttributesTable';
|
|
3
|
-
export { CrosswalkDragLayer } from './CrosswalkDragLayer';
|
|
4
3
|
export { SourceCrosswalksRow } from './SourceCrosswalksRow';
|
|
5
4
|
export { CrosswalkEditor } from './CrosswalkEditor';
|
|
5
|
+
export { CrosswalkDndComponent } from './CrosswalkDndComponent';
|
|
6
6
|
// hooks
|
|
7
7
|
export { useModifiedEntity } from './hooks/useModifiedEntity';
|
|
8
8
|
export { useCrosswalkActions } from './hooks/useCrosswalkActions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDndBasicTableScrollModifier } from './useDndBasicTableScrollModifier';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDndBasicTableScrollModifier } from './useDndBasicTableScrollModifier';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BasicTable } from '../../BasicTable';
|
|
3
|
+
type Props = {
|
|
4
|
+
tableRef: React.ElementRef<typeof BasicTable>;
|
|
5
|
+
};
|
|
6
|
+
export declare const useDndBasicTableScrollModifier: ({ tableRef }: Props) => {
|
|
7
|
+
scrollModifier: (data: any) => any;
|
|
8
|
+
stopScroll: () => void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { any, gt } from 'ramda';
|
|
3
|
+
var SCROLL_SPEED = 10;
|
|
4
|
+
var TRIGGER_SCROLL_DISTANCE = 150;
|
|
5
|
+
export var useDndBasicTableScrollModifier = function (_a) {
|
|
6
|
+
var tableRef = _a.tableRef;
|
|
7
|
+
var intervalRef = useRef();
|
|
8
|
+
var stopScroll = useCallback(function () {
|
|
9
|
+
if (intervalRef.current) {
|
|
10
|
+
clearInterval(intervalRef.current);
|
|
11
|
+
}
|
|
12
|
+
}, []);
|
|
13
|
+
var scrollGrid = useCallback(function (x, y) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
var grid = (_b = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.gridOuterRef) === null || _b === void 0 ? void 0 : _b.current;
|
|
16
|
+
if (!grid) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
stopScroll();
|
|
20
|
+
intervalRef.current = setInterval(function () {
|
|
21
|
+
grid.scrollBy(x, y);
|
|
22
|
+
}, 10);
|
|
23
|
+
}, [stopScroll, tableRef]);
|
|
24
|
+
var scrollModifier = useCallback(function (data) {
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
26
|
+
if (data) {
|
|
27
|
+
var gridRect = (_c = (_b = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.gridOuterRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
28
|
+
var diffBottom = (gridRect === null || gridRect === void 0 ? void 0 : gridRect.bottom) - (((_d = data.draggingNodeRect) === null || _d === void 0 ? void 0 : _d.bottom) + ((_e = data.transform) === null || _e === void 0 ? void 0 : _e.y));
|
|
29
|
+
var diffTop = ((_f = data.draggingNodeRect) === null || _f === void 0 ? void 0 : _f.top) + ((_g = data.transform) === null || _g === void 0 ? void 0 : _g.y) - (gridRect === null || gridRect === void 0 ? void 0 : gridRect.top);
|
|
30
|
+
var diffLeft = ((_h = data.draggingNodeRect) === null || _h === void 0 ? void 0 : _h.left) + ((_j = data.transform) === null || _j === void 0 ? void 0 : _j.x) - (gridRect === null || gridRect === void 0 ? void 0 : gridRect.left);
|
|
31
|
+
var diffRight = (gridRect === null || gridRect === void 0 ? void 0 : gridRect.right) - (((_k = data.draggingNodeRect) === null || _k === void 0 ? void 0 : _k.right) + ((_l = data.transform) === null || _l === void 0 ? void 0 : _l.x));
|
|
32
|
+
var scrollYDirection = diffTop < diffBottom ? -1 : 1;
|
|
33
|
+
var scrollY_1 = any(gt(TRIGGER_SCROLL_DISTANCE), [diffTop, diffBottom])
|
|
34
|
+
? SCROLL_SPEED * scrollYDirection
|
|
35
|
+
: 0;
|
|
36
|
+
var scrollXDirection = diffLeft < diffRight ? -1 : 1;
|
|
37
|
+
var scrollX_1 = any(gt(TRIGGER_SCROLL_DISTANCE), [diffLeft, diffRight])
|
|
38
|
+
? SCROLL_SPEED * scrollXDirection
|
|
39
|
+
: 0;
|
|
40
|
+
if (scrollX_1 || scrollY_1) {
|
|
41
|
+
scrollGrid(scrollX_1, scrollY_1);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
stopScroll();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return data.transform;
|
|
48
|
+
}, [scrollGrid, stopScroll, tableRef]);
|
|
49
|
+
return {
|
|
50
|
+
scrollModifier: scrollModifier,
|
|
51
|
+
stopScroll: stopScroll
|
|
52
|
+
};
|
|
53
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -269,6 +269,7 @@ export { useMarkers, resolveMarkers } from './hooks/useMarkers';
|
|
|
269
269
|
export { useSegmentationRequest } from './hooks/useSegmentationRequest';
|
|
270
270
|
export { useFilterAutoFocus } from './hooks/useFilterAutoFocus';
|
|
271
271
|
export { useDynamicYAxisWidth } from './hooks/useDynamicYAxisWidth';
|
|
272
|
+
export { useDndBasicTableScrollModifier } from './hooks/useDndBasicTableScrollModifier';
|
|
272
273
|
export { buildColumnsFilter, buildColumnsSizeById, columnFilterToMdmFilter, defaultGetRowCellHeight, defaultRenderRowCell } from './helpers/basicTable';
|
|
273
274
|
export { enrichDataWithPercents } from './helpers/charts';
|
|
274
275
|
export { showDefaultErrorMessage, showErrorMessage } from './helpers/errors';
|
|
@@ -278,7 +279,7 @@ export { getAttributeSelectorItems } from './helpers/attributesSelector';
|
|
|
278
279
|
export type { AttributeFiltersComponentProps } from './AttributesFiltersBuilder';
|
|
279
280
|
export type { ChartData } from './types/charts';
|
|
280
281
|
export type { AddInlineAttributeEvent, DeleteInlineAttributeEvent, EditInlineAttributeEvent, IgnoreInlineAttributeEvent, PinInlineAttributeEvent } from './types/inlineAttributes';
|
|
281
|
-
export type { ColumnData, ColumnSize, ColumnFilter, Sorting, GroupedColumnsData, GroupedColumns, RenderRowCellProps, RowId, ElementsRowsData, TableRowsData, RowValue } from './types/basicTable';
|
|
282
|
+
export type { ColumnData, ColumnSize, ColumnFilter, Sorting, GroupedColumnsData, GroupedColumns, RenderRowCellProps, RowId, ElementsRowsData, TableRowsData, RowValue, DraggableProps } from './types/basicTable';
|
|
282
283
|
export * from './types/preferences';
|
|
283
284
|
export * from './types';
|
|
284
285
|
export * from './constants';
|
package/index.js
CHANGED
|
@@ -273,6 +273,7 @@ export { useMarkers, resolveMarkers } from './hooks/useMarkers';
|
|
|
273
273
|
export { useSegmentationRequest } from './hooks/useSegmentationRequest';
|
|
274
274
|
export { useFilterAutoFocus } from './hooks/useFilterAutoFocus';
|
|
275
275
|
export { useDynamicYAxisWidth } from './hooks/useDynamicYAxisWidth';
|
|
276
|
+
export { useDndBasicTableScrollModifier } from './hooks/useDndBasicTableScrollModifier';
|
|
276
277
|
// helpers
|
|
277
278
|
export { buildColumnsFilter, buildColumnsSizeById, columnFilterToMdmFilter, defaultGetRowCellHeight, defaultRenderRowCell } from './helpers/basicTable';
|
|
278
279
|
export { enrichDataWithPercents } from './helpers/charts';
|