Skip to content

Commit e232706

Browse files
committed
fix: restore individual column reorder and reflect in preview, revert null pass
1 parent ab01b65 commit e232706

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

packages/pluggableWidgets/datagrid-web/src/Datagrid.editorPreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function ColumnHeader({ column }: { column: ColumnsPreviewType }): ReactNode {
174174
>
175175
<div className="column-container">
176176
<div className="column-header">
177-
{columnsDraggable && (
177+
{columnsDraggable && columnPreview.canDrag && (
178178
<DragHandle draggable={false} onDragStart={() => {}} onDragEnd={() => {}} />
179179
)}
180180
<span>{caption.length > 0 ? caption : "\u00a0"}</span>

packages/pluggableWidgets/datagrid-web/src/components/ColumnContainer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export const ColumnContainer = observer(function ColumnContainer(props: ColumnCo
3131
title={caption}
3232
ref={ref => column.setHeaderElementRef(ref)}
3333
data-column-id={columnId}
34-
onDrop={vm.handleOnDrop}
35-
onDragEnter={vm.handleDragEnter}
36-
onDragOver={vm.handleDragOver}
34+
onDrop={vm.isDraggable ? vm.handleOnDrop : undefined}
35+
onDragEnter={vm.isDraggable ? vm.handleDragEnter : undefined}
36+
onDragOver={vm.isDraggable ? vm.handleDragOver : undefined}
3737
>
3838
<div className={classNames("column-container")} id={`${gridId}-column${columnId}`}>
3939
<ColumnHeader />

packages/pluggableWidgets/datagrid-web/src/model/containers/Datagrid.container.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export class DatagridContainer extends Container {
102102
this.bind(CORE.columnsStore).toInstance(ColumnGroupStore).inSingletonScope();
103103
// Drag and Drop store
104104
this.bind(DG.headerDragDrop).toInstance(HeaderDragnDropStore).inSingletonScope();
105-
// Drag and Drop view model
106-
this.bind(DG.headerDragnDropVM).toInstance(HeaderDragnDropViewModel).inSingletonScope();
105+
// Drag and Drop view model (per column, not singleton)
106+
this.bind(DG.headerDragnDropVM).toInstance(HeaderDragnDropViewModel).inTransientScope();
107107
// Query service
108108
this.bind(DG.query).toInstance(DatasourceService).inSingletonScope();
109109
// Pagination service

packages/pluggableWidgets/gallery-web/src/helpers/useItemSelectHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export function useItemSelectHelper(
66
selectionHelper: SelectionHelper | undefined
77
): SelectActionHandler {
88
// eslint-disable-next-line react-hooks/exhaustive-deps
9-
return useMemo(() => new SelectActionHandler(selection, selectionHelper ?? null), [selectionHelper]);
9+
return useMemo(() => new SelectActionHandler(selection, selectionHelper), [selectionHelper]);
1010
}

packages/pluggableWidgets/gallery-web/src/utils/test-utils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function createMockGalleryContext(): GalleryRootScope {
8181
refreshInterval: 0
8282
});
8383

84-
const mockSelectHelper = new SelectActionHandler("None", null);
84+
const mockSelectHelper = new SelectActionHandler("None", undefined);
8585

8686
return {
8787
rootStore: mockStore,
@@ -110,7 +110,7 @@ type Mocks = {
110110
export function mockProps(params: Helpers & Mocks = {}): GalleryProps<ObjectItem> {
111111
const {
112112
onClick = undefined,
113-
selectHelper = new SelectActionHandler("None", null),
113+
selectHelper = new SelectActionHandler("None", undefined),
114114
actionHelper = new ClickActionHelper("single", onClick),
115115
focusController = new FocusTargetController(new PositionController(), new VirtualGridLayout(3, 4, 10)),
116116
itemEventsController = new ItemEventsController(

packages/shared/widget-plugin-grid/src/selection/select-action-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { SelectAdjacentFx, SelectAllFx, SelectFx, SelectionType, WidgetSelection
66
export class SelectActionHandler {
77
constructor(
88
private selection: WidgetSelectionProperty,
9-
protected selectionHelper: SelectionHelperService
9+
protected selectionHelper: SelectionHelperService | undefined
1010
) {}
1111

1212
get selectionType(): SelectionType {

0 commit comments

Comments
 (0)