ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
1 lines • 3.02 kB
Source Map (JSON)
{"version":3,"file":"ng-zorro-antd-core-pipe.mjs","sources":["../../components/core/pipe/time-range.pipe.ts","../../components/core/pipe/nz-pipe.module.ts","../../components/core/pipe/public-api.ts","../../components/core/pipe/ng-zorro-antd-core-pipe.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { Pipe, PipeTransform } from '@angular/core';\n\nimport { timeUnits } from 'ng-zorro-antd/core/time';\nimport { padStart } from 'ng-zorro-antd/core/util';\n\n@Pipe({\n name: 'nzTimeRange',\n pure: true\n})\nexport class NzTimeRangePipe implements PipeTransform {\n transform(value: string | number, format: string = 'HH:mm:ss'): string {\n let duration = Number(value || 0);\n\n return timeUnits.reduce((current, [name, unit]) => {\n if (current.indexOf(name) !== -1) {\n const v = Math.floor(duration / unit);\n duration -= v * unit;\n return current.replace(new RegExp(`${name}+`, 'g'), (match: string) =>\n padStart(v.toString(), match.length, '0')\n );\n }\n return current;\n }, format);\n }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { NzTimeRangePipe } from './time-range.pipe';\n\n@NgModule({\n imports: [CommonModule],\n exports: [NzTimeRangePipe],\n declarations: [NzTimeRangePipe]\n})\nexport class NzPipesModule {}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nexport * from './nz-pipe.module';\nexport * from './time-range.pipe';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;MAca,eAAe;IAC1B,SAAS,CAAC,KAAsB,EAAE,SAAiB,UAAU;QAC3D,IAAI,QAAQ,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;QAElC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;YAC5C,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;gBAChC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;gBACtC,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC;gBACrB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,KAAa,KAChE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAC1C,CAAC;aACH;YACD,OAAO,OAAO,CAAC;SAChB,EAAE,MAAM,CAAC,CAAC;KACZ;;4GAdU,eAAe;0GAAf,eAAe;2FAAf,eAAe;kBAJ3B,IAAI;mBAAC;oBACJ,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,IAAI;iBACX;;;ACbD;;;;MAea,aAAa;;0GAAb,aAAa;2GAAb,aAAa,iBAFT,eAAe,aAFpB,YAAY,aACZ,eAAe;2GAGd,aAAa,YAJf,CAAC,YAAY,CAAC;2FAIZ,aAAa;kBALzB,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,eAAe,CAAC;oBAC1B,YAAY,EAAE,CAAC,eAAe,CAAC;iBAChC;;;ACdD;;;;;ACAA;;;;;;"}