Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: LIBRARY: Change onDragDropAllow options #7370

Merged
merged 3 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/drag-drop-page-helper-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ export class DragDropPageHelperV1 {
allow: true,
target: this.dragDropInfo.target,
source: this.dragDropInfo.source,
toElement: this.dragDropInfo.target,
draggedElement: this.dragDropInfo.source,
parent: parent,
fromElement: this.dragDropInfo.source ? this.dragDropInfo.source.parent : null,
insertAfter: insertAfter,
insertBefore: insertBefore,
};
Expand Down
24 changes: 18 additions & 6 deletions src/survey-events-api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IAction } from "./actions/action";
import { Base } from "./base";
import { IElement, ISurveyElement, IValueItemCustomPropValues } from "./base-interfaces";
import { IElement, IPanel, ISurveyElement, IValueItemCustomPropValues } from "./base-interfaces";
import { ItemValue } from "./itemvalue";
import { PageModel } from "./page";
import { PanelModel, PanelModelBase } from "./panel";
Expand Down Expand Up @@ -841,27 +841,39 @@ export interface DragDropAllowEvent {
/**
* A survey element being dragged.
*/
target: IElement;
draggedElement: IElement;
/**
* A survey element from which `target` is being dragged. This parameter is `null` if `target` is being dragged from the [Toolbox](https://surveyjs.io/survey-creator/documentation/toolbox).
* A survey element from which `draggedElement` is being dragged. This parameter is `null` if `draggedElement` is being dragged from the [Toolbox](https://surveyjs.io/survey-creator/documentation/toolbox).
*/
source: IElement;
fromElement: IPanel;
/**
* A survey element to which `draggedElement` is being dragged.
*/
toElement: IElement;
/**
* A survey element before which the target element will be placed. This parameter is `null` if the parent container (page or panel) has no elements or if the target element will be placed below all other elements within the container.
*/
insertBefore: IElement;
/**
* A survey element after which `target` will be placed. This parameter is `null` if the parent container (page or panel) has no elements or if `target` will be placed above all other elements within the container.
* A survey element after which `draggedElement` will be placed. This parameter is `null` if the parent container (page or panel) has no elements or if `draggedElement` will be placed above all other elements within the container.
*/
insertAfter: IElement;
/**
* A parent container (page or panel) within which `target` will be placed.
* A parent container (page or panel) within which `draggedElement` will be placed.
*/
parent: ISurveyElement;
/**
* A Boolean property that you can set to `false` if you want to cancel the drag and drop operation.
*/
allow: boolean;
/**
* Obsolete. Use `options.draggedElement` instead.
*/
target: IElement;
/**
* Obsolete. Use `options.toElement` instead.
*/
source: IElement;
}
export interface ScrollingElementToTopEvent {
/**
Expand Down