message: drag drop questions
diff: @@ -122,7 +122,7 @@ export class QuestionRowModel extends Base {
  this.setPropertyValue("isneedrender", val);
  }
  public get visibleElements(): Array<IElement> {
  - return this.elements.filter((e) => e.isVisible);
  + return this.elements.filter(e => e.isVisible);
  }
  public updateVisible() {
  this.visible = this.calcVisible();
  @@ -212,8 +212,7 @@ export class QuestionRowModel extends Base {
  /**
  * A base class for a Panel and Page objects.
  */
  -export class PanelModelBase
  - extends SurveyElement
  +export class PanelModelBase extends SurveyElement
  implements IPanel, IConditionRunner, ILocalizableOwner, ISurveyErrorOwner {
  private static panelCounter = 100;
  private static getPanelId(): string {
  @@ -908,7 +907,7 @@ export class PanelModelBase
  }
  public ensureRowsVisibility() {
  - this.rows.forEach((row) => {
  + this.rows.forEach(row => {
  row.ensureVisibility();
  });
  }
  @@ -1194,6 +1193,16 @@ export class PanelModelBase
  }
  return true;
  }
  +
  + public insertElementAfter(element: IElement, after: IElement) {
  + const index = this.elements.indexOf(after);
  + if (index >= 0) this.addElement(element, index + 1);
  + }
  + public insertElementBefore(element: IElement, before: IElement) {
  + const index = this.elements.indexOf(before);
  + if (index >= 0) this.addElement(element, index);
  + }
  +
  protected canAddElement(element: IElement): boolean {
  return (
  !!element && element.isLayoutTypeSupported(this.getChildrenLayoutType())
  @@ -1501,8 +1510,7 @@ export class PanelModelBase
  * A container element, similar to the Page objects. However, unlike the Page, Panel can't be a root.
  * It may contain questions and other panels.
  */
  -export class PanelModel
  - extends PanelModelBase
  +export class PanelModel extends PanelModelBase
  implements IElement, ITitleOwner {
  public minWidth?: string;
  public maxWidth?: string;
  @@ -1742,7 +1750,7 @@ export class PanelModel
  return indent * css.question.indent + "px";
  }
  public clearOnDeletingContainer() {
  - this.elements.forEach((element) => {
  + this.elements.forEach(element => {
  if (element instanceof Question || element instanceof PanelModel) {
  element.clearOnDeletingContainer();
  }
  