@c-standard/angular-devui-extension
Version:
an extensional components lib for devui
74 lines (68 loc) • 3.2 kB
JavaScript
import * as i0 from '@angular/core';
import { Pipe, NgModule } from '@angular/core';
class ObjToValuePipe {
transform(data, identifyKey) {
if (!data) {
return data;
}
if (Array.isArray(data)) {
return data.map(item => item[identifyKey]);
}
else {
return data[identifyKey];
}
}
}
ObjToValuePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ObjToValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
ObjToValuePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ObjToValuePipe, name: "objToValue" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ObjToValuePipe, decorators: [{
type: Pipe,
args: [{
name: 'objToValue',
}]
}] });
class ValueToObjPipe {
transform(data, identifyKey, options) {
if (data == undefined)
return;
if (Array.isArray(data)) {
return data.map((item) => options.find((op) => op[identifyKey] === item) || { identifyKey: item });
}
else {
return options.find((op) => op[identifyKey] === data) || { identifyKey: data };
}
}
}
ValueToObjPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ValueToObjPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
ValueToObjPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ValueToObjPipe, name: "valueToObj" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ValueToObjPipe, decorators: [{
type: Pipe,
args: [{
name: 'valueToObj',
}]
}] });
class TransformModule {
}
TransformModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: TransformModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
TransformModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: TransformModule, declarations: [ObjToValuePipe,
ValueToObjPipe], exports: [ObjToValuePipe,
ValueToObjPipe] });
TransformModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: TransformModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: TransformModule, decorators: [{
type: NgModule,
args: [{
declarations: [
ObjToValuePipe,
ValueToObjPipe,
],
exports: [
ObjToValuePipe,
ValueToObjPipe,
],
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { ObjToValuePipe, TransformModule, ValueToObjPipe };
//# sourceMappingURL=c-standard-angular-devui-extension-utils.mjs.map