export const convertFromBaseStateToData = (
    baseState: BaseState,
    baseProps: {
        comPath: string;
        childData: any;
    },
    offset: IOffset = { x: 0, y: 0 }
): {
        t: string;
        p: IComData
    } => {
    const content: ContentState = baseState.getCurrentContent();
    const sizeState: SizeState = content.getSizeState();
    const positionState: PositionState = content.getPositionState();
    const richChildNode: any = content.getRichChildNode();
    const commentsList: List<ICommentsList> = content.getCommentsList();
    const customState: any = content.getCustomState();

    return {
        t: baseProps.comPath,
        p: {
            id: content.getCid(),
            txt_v: convertFromRichToData(richChildNode, baseProps.comPath),
            w: sizeState.getWidth(),
            h: sizeState.getHeight(),
            l: positionState.getLeft() - offset.x,
            t: positionState.getTop() - offset.y,
            p: baseProps.childData,
            zIndex: content.getZIndex(),
            customState: convertFromCustomStateToData(customState, baseProps.comPath, offset),
            commentsList: commentsList.toArray(),
            comType: content.getComType()
        }
    };
};
Example #2
0
export function immutableListsEqual<T extends Equalable>(listA: List<T>, listB: List<T>): boolean {
  if (listA === listB) return true;
  if (!listA !== !listB) return false;
  return immutableArraysEqual(listA.toArray(), listB.toArray());
}
Example #3
0
 public toJS(): LinkViewConfigJS {
   return {
     title: this.title,
     linkItems: this.linkItems.toArray().map(linkItem => linkItem.toJS())
   };
 }
Example #4
0
export function listsEqual<T>(listA: List<T>, listB: List<T>): boolean {
  if (listA === listB) return true;
  if (!listA || !listB) return false;
  return arraysEqual(listA.toArray(), listB.toArray());
}
 transform(items: List<StoreModel>, ...args: any[]): any {
     var arr = items.toArray();
     return arr;
 }
Example #6
0
 get data(): Score[] {
   return this._data.toArray();
 }
  check() {
    expect(this._issue.key).toEqual(this._key);
    expect(this._issue.projectCode).toEqual(IssueUtil.productCodeFromKey(this._key));
    if (this._assignee) {
      expect(this._issue.assignee).toBe(this._assignee);
    } else {
      expect(this._issue.assignee).not.toEqual(jasmine.anything());
    }

    expect(this._issue.priority).toBe(this._priority);
    expect(this._issue.type).toBe(this._type);

    if (this._components) {
      this.checkMultiSelectStringFieldValues(this._issue.components.toArray(), this._components);
    } else {
      expect(this._issue.components).not.toEqual(jasmine.anything());
    }

    if (this._labels) {
      this.checkMultiSelectStringFieldValues(this._issue.labels.toArray(), this._labels);
    } else {
      expect(this._issue.labels).not.toEqual(jasmine.anything());
    }

    if (this._fixVersions) {
      this.checkMultiSelectStringFieldValues(this._issue.fixVersions.toArray(), this._fixVersions);
    } else {
      expect(this._issue.fixVersions).not.toEqual(jasmine.anything(), this._issue.key);
    }

    if (this._summary) {
      expect(this._issue.summary).toEqual(this._summary);
    }

    expect(this._issue.ownState).toBe(this._ownState);

    if (this._linkedIssues) {
      expect(this._issue.linkedIssues).toBeTruthy();
      expect(this._issue.linkedIssues.size).toEqual(this._linkedIssues.length);
      this._issue.linkedIssues.forEach((issue, index) => {
        this._linkedIssues[index].check(this._issue.linkedIssues.get(index));
      });
    } else {
      expect(this._issue.linkedIssues).toBeTruthy();
      expect(this._issue.linkedIssues.size).toEqual(0);
    }

    if (this._customFields) {
      const issueFieldNames: string[] = this._issue.customFields.keySeq().toArray().sort();
      const expectedFieldNames: string[] = Object.keys(this._customFields);
      expect(expectedFieldNames).toEqual(issueFieldNames);

      for (const fieldName of issueFieldNames) {
        const customField: CustomField = this._issue.customFields.get(fieldName);
        const expectedField: CustomField = this._customFields[fieldName];
        expect(customField).toEqual(jasmine.anything());
        expect(customField.key).toEqual(expectedField.key);
        expect(customField.value).toEqual(expectedField.value);
      }
    } else {
      expect(this._issue.customFields).toEqual(Map<string, CustomField>());
    }

    if (this._parallelTasks) {
      const options: List<number> = this._issue.selectedParallelTasks;
      expect(options.toArray()).toEqual(this._parallelTasks);
    } else {
      expect(this._issue.selectedParallelTasks).not.toEqual(jasmine.anything());
    }
  }
 get popUpConfig(): number[] {
   return this._popUpConfig.toArray();
 }
Example #9
0
 get selectedNodes(): any[] {
   return this._selectedNodes.toArray();
 }