UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

895 lines (894 loc) • 25.2 kB
import { DecimalPipe } from "@angular/common"; import * as i0 from "@angular/core"; import { Component, NgModule, ViewEncapsulation, computed, inject, input, linkedSignal, output, signal } from "@angular/core"; import { toSignal } from "@angular/core/rxjs-interop"; import { map } from "rxjs/operators"; import * as i3 from "ng-zorro-antd/core/outlet"; import { NzOutletModule } from "ng-zorro-antd/core/outlet"; import { NzI18nService } from "ng-zorro-antd/i18n"; import * as i1$1 from "ng-zorro-antd/icon"; import { NzIconModule } from "ng-zorro-antd/icon"; import * as i1 from "ng-zorro-antd/popover"; import { NzPopoverModule } from "ng-zorro-antd/popover"; import * as i8 from "@angular/forms"; import { FormsModule } from "@angular/forms"; import * as i5 from "ng-zorro-antd/button"; import { NzButtonModule } from "ng-zorro-antd/button"; import * as i4 from "ng-zorro-antd/checkbox"; import { NzCheckboxModule } from "ng-zorro-antd/checkbox"; import * as i2 from "ng-zorro-antd/progress"; import { NzProgressModule } from "ng-zorro-antd/progress"; import * as i6 from "ng-zorro-antd/core/transition-patch"; import * as i7 from "ng-zorro-antd/core/wave"; var NzCheckListButtonComponent = class NzCheckListButtonComponent { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.2.2", type: NzCheckListButtonComponent, isStandalone: true, selector: "nz-check-list-button", host: { classAttribute: "ant-btn ant-btn-primary ant-check-list-button" }, ngImport: i0, template: `<ng-content />`, isInline: true, encapsulation: i0.ViewEncapsulation.None }); }; i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListButtonComponent, decorators: [{ type: Component, args: [{ selector: "nz-check-list-button", encapsulation: ViewEncapsulation.None, template: `<ng-content />`, host: { class: "ant-btn ant-btn-primary ant-check-list-button" } }] }] }); var NzCheckListContentComponent = class NzCheckListContentComponent { locale = input.required(...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []); items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []); index = input(0, ...ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []); progress = input(true, ...ngDevMode ? [{ debugName: "progress" }] : /* istanbul ignore next */ []); title = input(null, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []); footer = input(null, ...ngDevMode ? [{ debugName: "footer" }] : /* istanbul ignore next */ []); closePopover = output(); hide = output(); checked = false; visible = signal(true, ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []); progressPercent = computed(() => { return Math.min(Math.max(this.index() - 1, 0), this.items().length) / this.items().length * 100; }, ...ngDevMode ? [{ debugName: "progressPercent" }] : /* istanbul ignore next */ []); static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.2", type: NzCheckListContentComponent, isStandalone: true, selector: "nz-check-list-content", inputs: { locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: true, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, progress: { classPropertyName: "progress", publicName: "progress", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, footer: { classPropertyName: "footer", publicName: "footer", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closePopover: "closePopover", hide: "hide" }, host: { classAttribute: "ant-check-list-content" }, ngImport: i0, template: ` @let i18n = locale(); @if (visible()) { @if (progressPercent() === 100) { <div class="ant-check-list-header-finish"> <nz-icon nzType="check-circle" nzTheme="outline" class="ant-check-list-header-finish-icon" /> <h3 class="ant-check-list-header-finish-title">{{ i18n.checkListFinish }}</h3> <button nz-button nzType="primary" [style.margin.px]="24" (click)="closePopover.emit(false)"> {{ i18n.checkListClose }} </button> </div> } @else { <div class="ant-check-list-header"> <div class="ant-check-list-header-title"> @if (!!title()) { <ng-container *nzStringTemplateOutlet="title()">{{ title() }}</ng-container> } @else { {{ i18n.checkList }} } </div> <div class="ant-check-list-header-extra"> <nz-icon nzType="down" nzTheme="outline" (click)="closePopover.emit(false)" /> </div> </div> @if (progress()) { <div class="ant-check-list-progressBar"> <div class="ant-check-list-progressBar-progress"> <nz-progress [nzPercent]="progressPercent() | number: '1.0-0'" /> </div> </div> } } <div class="ant-check-list-steps-content"> @for (item of items(); track item.key || item.description) { @let itemHighlight = index() === $index + 1; <div class="ant-check-list-steps" [class.ant-check-list-highlight]="itemHighlight" [class.ant-check-list-checked]="item?.checked" > <div class="ant-check-list-steps-item"> <div class="ant-check-list-steps-item-circle"> @if (item?.checked) { <nz-icon nzType="check" nzTheme="outline" class="ant-check-list-steps-checkoutlined" /> } @else { <div class="ant-check-list-steps-number">{{ $index + 1 }}</div> } </div> <div class="ant-check-list-steps-item-description">{{ item.description }}</div> </div> @if (itemHighlight && !!item?.onClick) { <nz-icon nzType="arrow-right" nzTheme="outline" class="ant-check-list-steps-item-arrows" (click)="item.onClick?.(item)" /> } </div> } </div> <div class="ant-check-list-footer" (click)="visible.set(false)"> @if (!!footer()) { <ng-container *nzStringTemplateOutlet="footer()">{{ footer() }}</ng-container> } @else { {{ i18n.checkListFooter }} } </div> } @else { <div class="ant-check-list-close-check"> <div class="ant-check-list-close-check-title">{{ i18n.checkListCheck }}</div> <div class="ant-check-list-close-check-action"> <button nz-button nzType="primary" (click)="visible.set(false); hide.emit(checked)">{{ i18n.ok }}</button> <button nz-button (click)="visible.set(true)">{{ i18n.cancel }}</button> </div> <div class="ant-check-list-close-check-other"> <label nz-checkbox [(ngModel)]="checked" [ngModelOptions]="{ standalone: true }">{{ i18n.checkListCheckOther }}</label> </div> </div> } `, isInline: true, dependencies: [ { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1$1.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: [ "nzType", "nzTheme", "nzTwotoneColor", "nzSpin", "nzRotate", "nzIconfont", "aria-label" ], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzProgressModule }, { kind: "component", type: i2.NzProgressComponent, selector: "nz-progress", inputs: [ "nzShowInfo", "nzWidth", "nzStrokeColor", "nzSize", "nzFormat", "nzSuccessPercent", "nzPercent", "nzStrokeWidth", "nzGapDegree", "nzStatus", "nzType", "nzGapPosition", "nzStrokeLinecap", "nzSteps" ], exportAs: ["nzProgress"] }, { kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i3.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }, { kind: "ngmodule", type: NzCheckboxModule }, { kind: "component", type: i4.NzCheckboxComponent, selector: "[nz-checkbox]", inputs: [ "nzValue", "nzAutoFocus", "nzDisabled", "nzIndeterminate", "nzChecked", "nzId", "nzName" ], outputs: ["nzCheckedChange"], exportAs: ["nzCheckbox"] }, { kind: "ngmodule", type: NzButtonModule }, { kind: "component", type: i5.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: [ "nzBlock", "nzGhost", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize" ], exportAs: ["nzButton"] }, { kind: "directive", type: i6.ɵNzTransitionPatchDirective, selector: "[nz-button], [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "directive", type: i7.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: [ "name", "disabled", "ngModel", "ngModelOptions" ], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: DecimalPipe, name: "number" } ], encapsulation: i0.ViewEncapsulation.None }); }; i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListContentComponent, decorators: [{ type: Component, args: [{ selector: "nz-check-list-content", encapsulation: ViewEncapsulation.None, imports: [ NzIconModule, NzProgressModule, NzOutletModule, NzCheckboxModule, NzButtonModule, FormsModule, DecimalPipe ], template: ` @let i18n = locale(); @if (visible()) { @if (progressPercent() === 100) { <div class="ant-check-list-header-finish"> <nz-icon nzType="check-circle" nzTheme="outline" class="ant-check-list-header-finish-icon" /> <h3 class="ant-check-list-header-finish-title">{{ i18n.checkListFinish }}</h3> <button nz-button nzType="primary" [style.margin.px]="24" (click)="closePopover.emit(false)"> {{ i18n.checkListClose }} </button> </div> } @else { <div class="ant-check-list-header"> <div class="ant-check-list-header-title"> @if (!!title()) { <ng-container *nzStringTemplateOutlet="title()">{{ title() }}</ng-container> } @else { {{ i18n.checkList }} } </div> <div class="ant-check-list-header-extra"> <nz-icon nzType="down" nzTheme="outline" (click)="closePopover.emit(false)" /> </div> </div> @if (progress()) { <div class="ant-check-list-progressBar"> <div class="ant-check-list-progressBar-progress"> <nz-progress [nzPercent]="progressPercent() | number: '1.0-0'" /> </div> </div> } } <div class="ant-check-list-steps-content"> @for (item of items(); track item.key || item.description) { @let itemHighlight = index() === $index + 1; <div class="ant-check-list-steps" [class.ant-check-list-highlight]="itemHighlight" [class.ant-check-list-checked]="item?.checked" > <div class="ant-check-list-steps-item"> <div class="ant-check-list-steps-item-circle"> @if (item?.checked) { <nz-icon nzType="check" nzTheme="outline" class="ant-check-list-steps-checkoutlined" /> } @else { <div class="ant-check-list-steps-number">{{ $index + 1 }}</div> } </div> <div class="ant-check-list-steps-item-description">{{ item.description }}</div> </div> @if (itemHighlight && !!item?.onClick) { <nz-icon nzType="arrow-right" nzTheme="outline" class="ant-check-list-steps-item-arrows" (click)="item.onClick?.(item)" /> } </div> } </div> <div class="ant-check-list-footer" (click)="visible.set(false)"> @if (!!footer()) { <ng-container *nzStringTemplateOutlet="footer()">{{ footer() }}</ng-container> } @else { {{ i18n.checkListFooter }} } </div> } @else { <div class="ant-check-list-close-check"> <div class="ant-check-list-close-check-title">{{ i18n.checkListCheck }}</div> <div class="ant-check-list-close-check-action"> <button nz-button nzType="primary" (click)="visible.set(false); hide.emit(checked)">{{ i18n.ok }}</button> <button nz-button (click)="visible.set(true)">{{ i18n.cancel }}</button> </div> <div class="ant-check-list-close-check-other"> <label nz-checkbox [(ngModel)]="checked" [ngModelOptions]="{ standalone: true }">{{ i18n.checkListCheckOther }}</label> </div> </div> } `, host: { class: "ant-check-list-content" } }] }], propDecorators: { locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: true }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: false }] }], progress: [{ type: i0.Input, args: [{ isSignal: true, alias: "progress", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], footer: [{ type: i0.Input, args: [{ isSignal: true, alias: "footer", required: false }] }], closePopover: [{ type: i0.Output, args: ["closePopover"] }], hide: [{ type: i0.Output, args: ["hide"] }] } }); var NzCheckListComponent = class NzCheckListComponent { nzItems = input([], ...ngDevMode ? [{ debugName: "nzItems" }] : /* istanbul ignore next */ []); nzVisible = input(false, ...ngDevMode ? [{ debugName: "nzVisible" }] : /* istanbul ignore next */ []); nzIndex = input(1, ...ngDevMode ? [{ debugName: "nzIndex" }] : /* istanbul ignore next */ []); nzProgress = input(true, ...ngDevMode ? [{ debugName: "nzProgress" }] : /* istanbul ignore next */ []); nzTriggerRender = input(null, ...ngDevMode ? [{ debugName: "nzTriggerRender" }] : /* istanbul ignore next */ []); nzTitle = input(null, ...ngDevMode ? [{ debugName: "nzTitle" }] : /* istanbul ignore next */ []); nzFooter = input(null, ...ngDevMode ? [{ debugName: "nzFooter" }] : /* istanbul ignore next */ []); nzHide = output(); unfinished = computed(() => { this.visible(); return this.nzItems().filter((item) => !item?.checked).length; }, ...ngDevMode ? [{ debugName: "unfinished" }] : /* istanbul ignore next */ []); visible = linkedSignal(this.nzVisible, ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []); i18n = inject(NzI18nService); locale = toSignal(this.i18n.localeChange.pipe(map(() => this.i18n.getLocaleData("CheckList"))), { requireSync: true }); static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.2", type: NzCheckListComponent, isStandalone: true, selector: "nz-check-list", inputs: { nzItems: { classPropertyName: "nzItems", publicName: "nzItems", isSignal: true, isRequired: false, transformFunction: null }, nzVisible: { classPropertyName: "nzVisible", publicName: "nzVisible", isSignal: true, isRequired: false, transformFunction: null }, nzIndex: { classPropertyName: "nzIndex", publicName: "nzIndex", isSignal: true, isRequired: false, transformFunction: null }, nzProgress: { classPropertyName: "nzProgress", publicName: "nzProgress", isSignal: true, isRequired: false, transformFunction: null }, nzTriggerRender: { classPropertyName: "nzTriggerRender", publicName: "nzTriggerRender", isSignal: true, isRequired: false, transformFunction: null }, nzTitle: { classPropertyName: "nzTitle", publicName: "nzTitle", isSignal: true, isRequired: false, transformFunction: null }, nzFooter: { classPropertyName: "nzFooter", publicName: "nzFooter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nzHide: "nzHide" }, host: { classAttribute: "ant-check-list" }, ngImport: i0, template: ` <nz-check-list-button nz-popover [nzPopoverContent]="checklistTemplate" nzPopoverTrigger="click" nzPopoverPlacement="topRight" [nzPopoverOverlayClickable]="false" [nzPopoverVisible]="visible()" (nzPopoverVisibleChange)="visible.set($event)" > @if (!!nzTriggerRender()) { <ng-container *nzStringTemplateOutlet="nzTriggerRender()">{{ nzTriggerRender() }}</ng-container> } @else { <nz-icon nzType="check-circle" nzTheme="outline" class="ant-check-list-icon" /> <div class="ant-check-list-description">{{ locale().checkList }}</div> } @if (!visible() && !!unfinished()) { <div class="ant-check-list-trigger-dot"> <div class="ant-check-list-trigger-dot-text">{{ unfinished() | number: '1.0-0' }}</div> </div> } </nz-check-list-button> <ng-template #checklistTemplate> <nz-check-list-content [locale]="locale()" [items]="nzItems()" [index]="nzIndex()" [title]="nzTitle()" [progress]="nzProgress()" [footer]="nzFooter()" (closePopover)="visible.set($event)" (hide)="visible.set($event); nzHide.emit($event)" /> </ng-template> `, isInline: true, dependencies: [ { kind: "ngmodule", type: NzPopoverModule }, { kind: "directive", type: i1.NzPopoverDirective, selector: "[nz-popover]", inputs: [ "nzPopoverArrowPointAtCenter", "nzPopoverTitle", "nzPopoverTitleContext", "nzPopoverContent", "nzPopoverContentContext", "nz-popover", "nzPopoverTrigger", "nzPopoverPlacement", "nzPopoverOrigin", "nzPopoverVisible", "nzPopoverMouseEnterDelay", "nzPopoverMouseLeaveDelay", "nzPopoverOverlayClassName", "nzPopoverOverlayStyle", "nzPopoverOverlayClickable", "nzPopoverBackdrop" ], outputs: ["nzPopoverVisibleChange"], exportAs: ["nzPopover"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1$1.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: [ "nzType", "nzTheme", "nzTwotoneColor", "nzSpin", "nzRotate", "nzIconfont", "aria-label" ], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i3.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }, { kind: "component", type: NzCheckListButtonComponent, selector: "nz-check-list-button" }, { kind: "component", type: NzCheckListContentComponent, selector: "nz-check-list-content", inputs: [ "locale", "items", "index", "progress", "title", "footer" ], outputs: ["closePopover", "hide"] }, { kind: "pipe", type: DecimalPipe, name: "number" } ], encapsulation: i0.ViewEncapsulation.None }); }; i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListComponent, decorators: [{ type: Component, args: [{ selector: "nz-check-list", encapsulation: ViewEncapsulation.None, imports: [ NzPopoverModule, NzIconModule, NzOutletModule, NzCheckListButtonComponent, NzCheckListContentComponent, DecimalPipe ], template: ` <nz-check-list-button nz-popover [nzPopoverContent]="checklistTemplate" nzPopoverTrigger="click" nzPopoverPlacement="topRight" [nzPopoverOverlayClickable]="false" [nzPopoverVisible]="visible()" (nzPopoverVisibleChange)="visible.set($event)" > @if (!!nzTriggerRender()) { <ng-container *nzStringTemplateOutlet="nzTriggerRender()">{{ nzTriggerRender() }}</ng-container> } @else { <nz-icon nzType="check-circle" nzTheme="outline" class="ant-check-list-icon" /> <div class="ant-check-list-description">{{ locale().checkList }}</div> } @if (!visible() && !!unfinished()) { <div class="ant-check-list-trigger-dot"> <div class="ant-check-list-trigger-dot-text">{{ unfinished() | number: '1.0-0' }}</div> </div> } </nz-check-list-button> <ng-template #checklistTemplate> <nz-check-list-content [locale]="locale()" [items]="nzItems()" [index]="nzIndex()" [title]="nzTitle()" [progress]="nzProgress()" [footer]="nzFooter()" (closePopover)="visible.set($event)" (hide)="visible.set($event); nzHide.emit($event)" /> </ng-template> `, host: { class: "ant-check-list" } }] }], propDecorators: { nzItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "nzItems", required: false }] }], nzVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "nzVisible", required: false }] }], nzIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "nzIndex", required: false }] }], nzProgress: [{ type: i0.Input, args: [{ isSignal: true, alias: "nzProgress", required: false }] }], nzTriggerRender: [{ type: i0.Input, args: [{ isSignal: true, alias: "nzTriggerRender", required: false }] }], nzTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "nzTitle", required: false }] }], nzFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "nzFooter", required: false }] }], nzHide: [{ type: i0.Output, args: ["nzHide"] }] } }); var NzCheckListModule = class NzCheckListModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListModule, imports: [NzCheckListComponent], exports: [NzCheckListComponent] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListModule, imports: [NzCheckListComponent] }); }; i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.2", ngImport: i0, type: NzCheckListModule, decorators: [{ type: NgModule, args: [{ imports: [NzCheckListComponent], exports: [NzCheckListComponent] }] }] }); export { NzCheckListComponent, NzCheckListModule }; //# sourceMappingURL=ng-zorro-antd-check-list.mjs.map