How to use the @delon/util.deepGet function in @delon/util

To help you get started, we’ve selected a few @delon/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ng-alain / delon / packages / form / spec / base.spec.ts View on Github external
checkUI(path: string, propertyName: string, value: any): this {
    path = this.fixPath(path);
    const property = this.comp.rootProperty!.searchProperty(path);
    expect(property != null).toBe(true);
    const item = property!.ui;
    const res = deepGet(item, propertyName.split('.'), undefined);
    expect(res).toBe(value);
    return this;
  }
github ng-alain / delon / packages / form / spec / base.spec.ts View on Github external
checkSchema(path: string, propertyName: string, value: any): this {
    path = this.fixPath(path);
    const property = this.comp.rootProperty!.searchProperty(path);
    expect(property != null).toBe(true);
    const item = property!.schema;
    const res = deepGet(item, propertyName.split('.'), undefined);
    expect(res).toBe(value);
    return this;
  }
github ng-alain / delon / packages / form / spec / base.spec.ts View on Github external
checkCalled(path: string, propertyName: string, result = true): this {
    path = this.fixPath(path);
    const property = this.comp.rootProperty!.searchProperty(path);
    expect(property != null).toBe(true);
    const item = property!.ui;
    const res = deepGet(item, propertyName.split('.'), undefined);
    if (result) {
      expect(res).toHaveBeenCalled();
    } else {
      expect(res).not.toHaveBeenCalled();
    }
    return this;
  }
github ng-alain / delon / packages / abc / table / table-export.ts View on Github external
private _stGet(item: any, col: STColumn, index: number): any {
    const ret: { [key: string]: any } = { t: 's', v: '' };

    if (col.format) {
      ret.v = col.format(item, col, index);
    } else {
      const val = deepGet(item, col.index as string[], '');
      ret.v = val;
      switch (col.type) {
        case 'currency':
          ret.t = 'n';
          break;
        case 'date':
          ret.t = 'd';
          break;
        case 'yn':
          ret.v = ret.v === col.ynTruth ? col.ynYes || '是' : col.ynNo || '否';
          break;
      }
    }

    ret.v = ret.v || '';
github ng-alain / delon / packages / abc / table / table-data-source.ts View on Github external
private get(item: STData, col: STColumn, idx: number): { text: any; org?: any; color?: string } {
    if (col.format) {
      const formatRes = col.format(item, col, idx);
      if (formatRes && ~formatRes.indexOf('` : '';
        break;
      case 'number':
        text = this.numberPipe.transform(value, col.numberDigits);
        break;
      case 'currency':
        text = this.currentyPipe.transform(value);
        break;
github ng-alain / delon / packages / abc / edit / edit.component.ts View on Github external
private bindModel() {
    if (!this.ngControl || this.status$) return;

    this.status$ = this.ngControl.statusChanges!.subscribe(res => this.updateStatus(res === 'INVALID'));

    if (this._autoId) {
      const control = deepGet(this.ngControl.valueAccessor, '_elementRef.nativeElement') as HTMLElement;
      if (control) {
        control.id = this._id;
      }
    }
  }
github ng-alain / delon / packages / form / src / widgets / upload / upload.widget.ts View on Github external
private _getValue(file: UploadFile) {
    return deepGet(file.response, this.i.resReName, file.response);
  }
github vellengs / typerx / packages / client / src / app / shared / json-schema / widgets / image / image.widget.ts View on Github external
const res = fileList.map(item =>
            deepGet(item.response, this.i.resReName, item.response),
        );