ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
83 lines (82 loc) • 2.05 kB
JavaScript
import * as i0 from "@angular/core";
import { NgModule, Pipe } from "@angular/core";
import { timeUnits } from "ng-zorro-antd/core/time";
import { padStart } from "ng-zorro-antd/core/util";
var NzTimeRangePipe = class NzTimeRangePipe {
transform(value, format = "HH:mm:ss") {
let duration = Number(value || 0);
return timeUnits.reduce((current, [name, unit]) => {
if (current.indexOf(name) !== -1) {
const v = Math.floor(duration / unit);
duration -= v * unit;
return current.replace(new RegExp(`${name}+`, "g"), (match) => padStart(v.toString(), match.length, "0"));
}
return current;
}, format);
}
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzTimeRangePipe,
deps: [],
target: i0.ɵɵFactoryTarget.Pipe
});
static ɵpipe = i0.ɵɵngDeclarePipe({
minVersion: "14.0.0",
version: "22.2.2",
ngImport: i0,
type: NzTimeRangePipe,
isStandalone: true,
name: "nzTimeRange"
});
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzTimeRangePipe,
decorators: [{
type: Pipe,
args: [{ name: "nzTimeRange" }]
}]
});
var NzPipesModule = class NzPipesModule {
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzPipesModule,
deps: [],
target: i0.ɵɵFactoryTarget.NgModule
});
static ɵmod = i0.ɵɵngDeclareNgModule({
minVersion: "14.0.0",
version: "22.2.2",
ngImport: i0,
type: NzPipesModule,
imports: [NzTimeRangePipe],
exports: [NzTimeRangePipe]
});
static ɵinj = i0.ɵɵngDeclareInjector({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzPipesModule
});
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzPipesModule,
decorators: [{
type: NgModule,
args: [{
imports: [NzTimeRangePipe],
exports: [NzTimeRangePipe]
}]
}]
});
export { NzPipesModule, NzTimeRangePipe };
//# sourceMappingURL=ng-zorro-antd-core-pipe.mjs.map