Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
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;
}
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;
}
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 || '';
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;
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;
}
}
}
private _getValue(file: UploadFile) {
return deepGet(file.response, this.i.resReName, file.response);
}
const res = fileList.map(item =>
deepGet(item.response, this.i.resReName, item.response),
);