ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
1 lines • 8.11 kB
Source Map (JSON)
{"version":3,"file":"ng-zorro-antd-space.mjs","sources":["../../components/space/space-item.directive.ts","../../components/space/space.component.ts","../../components/space/space.module.ts","../../components/space/public-api.ts","../../components/space/ng-zorro-antd-space.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 { Directive } from '@angular/core';\n\n@Directive({\n selector: '[nzSpaceItem]'\n})\nexport class NzSpaceItemDirective {\n constructor() {}\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 {\n AfterContentInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n Input,\n OnChanges,\n OnDestroy,\n QueryList,\n TemplateRef\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';\nimport { BooleanInput, NzSafeAny } from 'ng-zorro-antd/core/types';\nimport { InputBoolean } from 'ng-zorro-antd/core/util';\n\nimport { NzSpaceItemDirective } from './space-item.directive';\nimport { NzSpaceAlign, NzSpaceDirection, NzSpaceSize, NzSpaceType } from './types';\n\nconst NZ_CONFIG_MODULE_NAME: NzConfigKey = 'space';\nconst SPACE_SIZE: {\n [sizeKey in NzSpaceType]: number;\n} = {\n small: 8,\n middle: 16,\n large: 24\n};\n\n@Component({\n selector: 'nz-space, [nz-space]',\n exportAs: 'NzSpace',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <ng-content></ng-content>\n <ng-template ngFor let-item let-last=\"last\" let-index=\"index\" [ngForOf]=\"items\">\n <div\n class=\"ant-space-item\"\n [style.margin-bottom.px]=\"nzDirection === 'vertical' ? (last ? null : spaceSize) : null\"\n [style.margin-right.px]=\"nzDirection === 'horizontal' ? (last ? null : spaceSize) : null\"\n >\n <ng-container [ngTemplateOutlet]=\"item\"></ng-container>\n </div>\n <span\n *ngIf=\"nzSplit && !last\"\n class=\"ant-space-split\"\n [style.margin-bottom.px]=\"nzDirection === 'vertical' ? (last ? null : spaceSize) : null\"\n [style.margin-right.px]=\"nzDirection === 'horizontal' ? (last ? null : spaceSize) : null\"\n >\n <ng-template [ngTemplateOutlet]=\"nzSplit\" [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-template>\n </span>\n </ng-template>\n `,\n host: {\n class: 'ant-space',\n '[class.ant-space-horizontal]': 'nzDirection === \"horizontal\"',\n '[class.ant-space-vertical]': 'nzDirection === \"vertical\"',\n '[class.ant-space-align-start]': 'mergedAlign === \"start\"',\n '[class.ant-space-align-end]': 'mergedAlign === \"end\"',\n '[class.ant-space-align-center]': 'mergedAlign === \"center\"',\n '[class.ant-space-align-baseline]': 'mergedAlign === \"baseline\"',\n '[style.flex-wrap]': 'nzWrap ? \"wrap\" : null'\n }\n})\nexport class NzSpaceComponent implements OnChanges, OnDestroy, AfterContentInit {\n static ngAcceptInputType_nzWrap: BooleanInput;\n\n readonly _nzModuleName: NzConfigKey = NZ_CONFIG_MODULE_NAME;\n\n @Input() nzDirection: NzSpaceDirection = 'horizontal';\n @Input() nzAlign?: NzSpaceAlign;\n @Input() nzSplit: TemplateRef<{ $implicit: number }> | null = null;\n @Input() @InputBoolean() nzWrap: boolean = false;\n @Input() @WithConfig() nzSize: NzSpaceSize = 'small';\n\n @ContentChildren(NzSpaceItemDirective, { read: TemplateRef }) items!: QueryList<TemplateRef<NzSafeAny>>;\n\n mergedAlign?: NzSpaceAlign;\n spaceSize: number = SPACE_SIZE.small;\n private destroy$ = new Subject();\n\n constructor(public nzConfigService: NzConfigService, private cdr: ChangeDetectorRef) {}\n\n private updateSpaceItems(): void {\n const numberSize = typeof this.nzSize === 'string' ? SPACE_SIZE[this.nzSize] : this.nzSize;\n this.spaceSize = numberSize / (this.nzSplit ? 2 : 1);\n this.cdr.markForCheck();\n }\n\n ngOnChanges(): void {\n this.updateSpaceItems();\n this.mergedAlign = this.nzAlign === undefined && this.nzDirection === 'horizontal' ? 'center' : this.nzAlign;\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n ngAfterContentInit(): void {\n this.updateSpaceItems();\n this.items.changes.pipe(takeUntil(this.destroy$)).subscribe(() => {\n this.cdr.markForCheck();\n });\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 { BidiModule } from '@angular/cdk/bidi';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { NzSpaceItemDirective } from './space-item.directive';\nimport { NzSpaceComponent } from './space.component';\n\n@NgModule({\n declarations: [NzSpaceComponent, NzSpaceItemDirective],\n exports: [NzSpaceComponent, NzSpaceItemDirective],\n imports: [BidiModule, CommonModule]\n})\nexport class NzSpaceModule {}\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 './space.module';\nexport * from './space.component';\nexport * from './space-item.directive';\nexport * from './types';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;MAUa,oBAAoB;IAC/B,iBAAgB;;iHADL,oBAAoB;qGAApB,oBAAoB;2FAApB,oBAAoB;kBAHhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,eAAe;iBAC1B;;;ACkBD,MAAM,qBAAqB,GAAgB,OAAO,CAAC;AACnD,MAAM,UAAU,GAEZ;IACF,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACV,CAAC;MAqCW,gBAAgB;IAiB3B,YAAmB,e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