@reltio/components 1.4.2018 → 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/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/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,11 +1,62 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
1
48
|
import React from 'react';
|
|
2
|
-
import { mount } from 'enzyme';
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
4
|
-
import TestBackend from 'react-dnd-test-backend';
|
|
5
|
-
import { DndProvider, DndContext } from 'react-dnd';
|
|
6
49
|
import { TableCellWithDnd } from './TableCellWithDnd';
|
|
7
|
-
import {
|
|
8
|
-
|
|
50
|
+
import { DndContext, useDndMonitor } from '@dnd-kit/core';
|
|
51
|
+
import { act, render, screen } from '@testing-library/react';
|
|
52
|
+
import userEvent from '@testing-library/user-event';
|
|
53
|
+
import { getMuiIconByName } from '../../../test-utils';
|
|
54
|
+
import { DndItemTypes } from '../../types';
|
|
55
|
+
jest.mock('@dnd-kit/core', function () { return (__assign(__assign({}, jest.requireActual('@dnd-kit/core')), { useDndMonitor: jest.fn() })); });
|
|
56
|
+
var CellRenderer = function (_a) {
|
|
57
|
+
var value = _a.value;
|
|
58
|
+
return (React.createElement("div", { className: "cellRenderer", "data-reltio-id": "cellRenderer" }, value));
|
|
59
|
+
};
|
|
9
60
|
var defaultColumnValue = {
|
|
10
61
|
'attributes.FirstName': 'Some Value',
|
|
11
62
|
id: 'entities/123'
|
|
@@ -15,77 +66,96 @@ var defaultRowData = {
|
|
|
15
66
|
label: 'FirstName',
|
|
16
67
|
cellRenderer: CellRenderer
|
|
17
68
|
};
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
69
|
+
var defaultProps = {
|
|
70
|
+
columnValue: defaultColumnValue,
|
|
71
|
+
rowData: defaultRowData,
|
|
72
|
+
index: 0,
|
|
73
|
+
shouldRenderDragIndicator: true,
|
|
74
|
+
setHoveredColumn: jest.fn(),
|
|
75
|
+
resetHoveredColumn: jest.fn(),
|
|
76
|
+
rowIsDragging: false
|
|
77
|
+
};
|
|
78
|
+
var setUp = function (props) {
|
|
79
|
+
if (props === void 0) { props = defaultProps; }
|
|
80
|
+
var user = userEvent.setup();
|
|
81
|
+
var Providers = function (_a) {
|
|
82
|
+
var children = _a.children;
|
|
83
|
+
return (React.createElement(DndContext, null,
|
|
84
|
+
React.createElement("table", null,
|
|
26
85
|
React.createElement("tbody", null,
|
|
27
|
-
React.createElement("tr", null,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return [component, manager];
|
|
86
|
+
React.createElement("tr", null, children)))));
|
|
87
|
+
};
|
|
88
|
+
return __assign({ user: user }, render(React.createElement(TableCellWithDnd, __assign({}, props)), { wrapper: Providers }));
|
|
31
89
|
};
|
|
32
90
|
describe('TableCellWithDnd tests', function () {
|
|
33
91
|
it('should render cellRenderer from rowData correctly', function () {
|
|
34
|
-
|
|
35
|
-
expect(
|
|
92
|
+
setUp();
|
|
93
|
+
expect(screen.getByTestId('cellRenderer')).toBeInTheDocument();
|
|
36
94
|
});
|
|
37
95
|
it('should render DefaultCellRenderer if cellRenderer is missing in rowData', function () {
|
|
38
96
|
var rowData = {
|
|
39
97
|
id: 'attributes.FirstName',
|
|
40
98
|
label: 'FirstName'
|
|
41
99
|
};
|
|
42
|
-
|
|
43
|
-
expect(
|
|
100
|
+
setUp(__assign(__assign({}, defaultProps), { rowData: rowData }));
|
|
101
|
+
expect(screen.getByText(defaultColumnValue[rowData.id])).toBeInTheDocument();
|
|
44
102
|
});
|
|
45
103
|
it('should render dragIndicator if "shouldRenderDragIndicator" prop is true', function () {
|
|
46
|
-
|
|
47
|
-
expect(
|
|
104
|
+
setUp(__assign(__assign({}, defaultProps), { shouldRenderDragIndicator: true }));
|
|
105
|
+
expect(getMuiIconByName('DragIndicator')).toBeInTheDocument();
|
|
48
106
|
});
|
|
49
107
|
it('should not render dragIndicator if "shouldRenderDragIndicator" prop is false', function () {
|
|
50
|
-
|
|
51
|
-
expect(
|
|
108
|
+
setUp(__assign(__assign({}, defaultProps), { shouldRenderDragIndicator: false }));
|
|
109
|
+
expect(getMuiIconByName('DragIndicator')).not.toBeInTheDocument();
|
|
52
110
|
});
|
|
53
|
-
it('setHoveredColumn handler should work correctly', function () {
|
|
54
|
-
var setHoveredColumn
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
111
|
+
it('setHoveredColumn handler should work correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
112
|
+
var setHoveredColumn, user;
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
115
|
+
case 0:
|
|
116
|
+
setHoveredColumn = jest.fn();
|
|
117
|
+
user = setUp(__assign(__assign({}, defaultProps), { setHoveredColumn: setHoveredColumn })).user;
|
|
118
|
+
return [4 /*yield*/, user.hover(screen.getByText(defaultColumnValue['attributes.FirstName']))];
|
|
119
|
+
case 1:
|
|
120
|
+
_a.sent();
|
|
121
|
+
expect(setHoveredColumn).toHaveBeenCalledWith(defaultColumnValue);
|
|
122
|
+
return [2 /*return*/];
|
|
123
|
+
}
|
|
60
124
|
});
|
|
61
|
-
|
|
125
|
+
}); });
|
|
126
|
+
it('should pass ".hidden" classname to div wrapper correctly if "rowIsDragging" prop is true', function () {
|
|
127
|
+
setUp(__assign(__assign({}, defaultProps), { rowIsDragging: true }));
|
|
128
|
+
expect(document.getElementsByClassName('hidden')).toHaveLength(1);
|
|
129
|
+
});
|
|
130
|
+
it('should not pass ".hidden" classname to div wrapper if "rowIsDragging" prop is false', function () {
|
|
131
|
+
setUp(__assign(__assign({}, defaultProps), { rowIsDragging: false }));
|
|
132
|
+
expect(document.getElementsByClassName('hidden')).toHaveLength(0);
|
|
62
133
|
});
|
|
63
|
-
it('should
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
134
|
+
it('should set opacity to 0 if column is dragging', function () {
|
|
135
|
+
var onDragStart, onDragEnd;
|
|
136
|
+
useDndMonitor.mockImplementation(function (listeners) {
|
|
137
|
+
onDragStart = listeners.onDragStart;
|
|
138
|
+
onDragEnd = listeners.onDragEnd;
|
|
139
|
+
});
|
|
140
|
+
setUp();
|
|
141
|
+
var cell = screen.getByRole('cell', { name: defaultColumnValue['attributes.FirstName'] });
|
|
142
|
+
expect(cell).toHaveStyle({ opacity: 1 });
|
|
68
143
|
act(function () {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
144
|
+
onDragStart({
|
|
145
|
+
active: {
|
|
146
|
+
id: defaultProps.columnValue.id,
|
|
147
|
+
data: {
|
|
148
|
+
current: {
|
|
149
|
+
type: DndItemTypes.Column
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
72
153
|
});
|
|
73
154
|
});
|
|
74
|
-
|
|
75
|
-
var targetId = component.find('td').prop('data-target-id');
|
|
155
|
+
expect(cell).toHaveStyle({ opacity: 0 });
|
|
76
156
|
act(function () {
|
|
77
|
-
|
|
78
|
-
backend.simulateDrop();
|
|
79
|
-
backend.simulateEndDrag();
|
|
157
|
+
onDragEnd();
|
|
80
158
|
});
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
it('should pass ".hidden" classname to div wrapper correctly if "someRowIsDragging" prop is true', function () {
|
|
84
|
-
var component = setUp({ someRowIsDragging: true })[0];
|
|
85
|
-
expect(component.find('.hidden')).toHaveLength(1);
|
|
86
|
-
});
|
|
87
|
-
it('should not pass ".hidden" classname to div wrapper if "someRowIsDragging" prop is false', function () {
|
|
88
|
-
var component = setUp({ someRowIsDragging: false })[0];
|
|
89
|
-
expect(component.find('.hidden')).toHaveLength(0);
|
|
159
|
+
expect(cell).toHaveStyle({ opacity: 1 });
|
|
90
160
|
});
|
|
91
161
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ColumnData, RowData } from '../../types';
|
|
3
3
|
type Props = {
|
|
4
|
-
columnWidth: number;
|
|
5
4
|
columnHeight: number;
|
|
6
|
-
|
|
5
|
+
draggingColumn: {
|
|
7
6
|
rowData: RowData;
|
|
8
7
|
columnValue: ColumnData;
|
|
8
|
+
getColumnWidth?: () => number;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export declare const TableColumnDragPreview: ({
|
|
11
|
+
export declare const TableColumnDragPreview: React.MemoExoticComponent<({ columnHeight, draggingColumn }: Props) => React.JSX.Element>;
|
|
12
12
|
export {};
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { DefaultCellRenderer } from '../../helpers';
|
|
3
|
-
export var TableColumnDragPreview = function (_a) {
|
|
4
|
-
var
|
|
5
|
-
|
|
3
|
+
export var TableColumnDragPreview = memo(function (_a) {
|
|
4
|
+
var columnHeight = _a.columnHeight, draggingColumn = _a.draggingColumn;
|
|
5
|
+
if (!draggingColumn) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
var rowData = draggingColumn.rowData, columnValue = draggingColumn.columnValue, getColumnWidth = draggingColumn.getColumnWidth;
|
|
6
9
|
var CellRenderer = rowData.cellRenderer || DefaultCellRenderer;
|
|
7
|
-
|
|
10
|
+
var columnWidth = getColumnWidth();
|
|
11
|
+
return (React.createElement("div", { style: {
|
|
12
|
+
width: columnWidth,
|
|
13
|
+
height: columnHeight,
|
|
14
|
+
background: 'rgba(245,245,245, .5)',
|
|
15
|
+
pointerEvents: 'none'
|
|
16
|
+
} },
|
|
8
17
|
React.createElement(CellRenderer, { value: columnValue[rowData.id] })));
|
|
9
|
-
};
|
|
18
|
+
});
|
|
19
|
+
TableColumnDragPreview.displayName = 'TableColumnDragPreview';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColumnData, RowData } from '../../types';
|
|
3
|
+
type Props = {
|
|
4
|
+
id: string;
|
|
5
|
+
columnsData: ColumnData[];
|
|
6
|
+
rowData: RowData;
|
|
7
|
+
};
|
|
8
|
+
export declare const RowDragIndicator: ({ id, rowData, columnsData }: Props) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { useStyles } from './styles';
|
|
14
|
+
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
|
15
|
+
import { useDraggable } from '@dnd-kit/core';
|
|
16
|
+
import { DndItemTypes } from '../../types';
|
|
17
|
+
export var RowDragIndicator = function (_a) {
|
|
18
|
+
var id = _a.id, rowData = _a.rowData, columnsData = _a.columnsData;
|
|
19
|
+
var styles = useStyles();
|
|
20
|
+
var _b = useDraggable({
|
|
21
|
+
id: id,
|
|
22
|
+
data: {
|
|
23
|
+
type: DndItemTypes.Row,
|
|
24
|
+
rowData: rowData,
|
|
25
|
+
columnsData: columnsData
|
|
26
|
+
}
|
|
27
|
+
}), setNodeRef = _b.setNodeRef, attributes = _b.attributes, listeners = _b.listeners;
|
|
28
|
+
return (React.createElement("div", __assign({ ref: setNodeRef, className: styles.dragIndicator }, attributes, listeners),
|
|
29
|
+
React.createElement(DragIndicatorIcon, { className: styles.dragIndicatorIcon })));
|
|
30
|
+
};
|
|
@@ -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">;
|