message: added "array changes parameter" for undo-redo
diff: @@ -29,6 +29,7 @@ export interface ITextProcessor {
  export interface ISurveyErrorOwner extends ILocalizableOwner {
  getErrorCustomText(text: string, error: SurveyError): string;
  }
  +
  export interface ISurvey extends ITextProcessor, ISurveyErrorOwner {
  currentPage: IPage;
  pages: Array<IPage>;
  @@ -373,10 +374,16 @@ export class Base {
  name: string,
  oldValue: any,
  newValue: any,
  - sender: Base
  + sender: Base,
  + arrayChanges: ArrayChanges
  ) {}
  - protected propertyValueChanged(name: string, oldValue: any, newValue: any) {
  + protected propertyValueChanged(
  + name: string,
  + oldValue: any,
  + newValue: any,
  + arrayChanges?: ArrayChanges
  + ) {
  if (this.isLoadingFromJson) return;
  this.onPropertyChanged.fire(this, {
  name: name,
  @@ -394,10 +401,17 @@ export class Base {
  name,
  oldValue,
  newValue,
  - this
  + this,
  + arrayChanges
  );
  } else {
  - this.onPropertyValueChangedCallback(name, oldValue, newValue, this);
  + this.onPropertyValueChangedCallback(
  + name,
  + oldValue,
  + newValue,
  + this,
  + arrayChanges
  + );
  }
  }
  /**
  @@ -565,7 +579,8 @@ export class Base {
  newArray.push = function(value): number {
  var result = Object.getPrototypeOf(newArray).push.call(newArray, value);
  if (onPush) onPush(value, newArray.length - 1);
  - self.propertyValueChanged(name, newArray, newArray);
  + const arrayChanges = new ArrayChanges(newArray.length - 1, 0, [value]);
  + self.propertyValueChanged(name, newArray, newArray, arrayChanges);
  self.notifyArrayChanged(newArray);
  return result;
  };
  @@ -575,14 +590,16 @@ export class Base {
  value
  );
  if (onPush) onPush(value, newArray.length - 1);
  - self.propertyValueChanged(name, newArray, newArray);
  + const arrayChanges = new ArrayChanges(0, 0, [value]);
  + self.propertyValueChanged(name, newArray, newArray, arrayChanges);
  self.notifyArrayChanged(newArray);
  return result;
  };
  newArray.pop = function(): number {
  var result = Object.getPrototypeOf(newArray).pop.call(newArray);
  if (onRemove) onRemove(result);
  - self.propertyValueChanged(name, newArray, newArray);
  + const arrayChanges = new ArrayChanges(newArray.length - 1, 1, []);
  + self.propertyValueChanged(name, newArray, newArray, arrayChanges);
  self.notifyArrayChanged(newArray);
  return result;
  };
  @@ -610,7 +627,9 @@ export class Base {
  onPush(items[i], start + i);
  }
  }
  - self.propertyValueChanged(name, newArray, newArray);
  +
  + const arrayChanges = new ArrayChanges(start, deleteCount, items);
  + self.propertyValueChanged(name, newArray, newArray, arrayChanges);
  self.notifyArrayChanged(newArray);
  return result;
  };
  @@ -662,6 +681,15 @@ export class Base {
  return val;
  }
  }
  +
  +export class ArrayChanges {
  + constructor(
  + public index: number,
  + public deleteCount: number,
  + public itemsToAdd: any[]
  + ) {}
  +}
  +
  export class SurveyError {
  private locTextValue: LocalizableString;
  public visible: boolean = true;
  