ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
234 lines • 22.5 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Host, Input, Optional, Renderer2, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { zoomMotion } from '../core/animation/zoom';
import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive';
import { NzSelectService } from './nz-select.service';
export class NzSelectTopControlComponent {
/**
* @param {?} renderer
* @param {?} nzSelectService
* @param {?} cdr
* @param {?=} noAnimation
*/
constructor(renderer, nzSelectService, cdr, noAnimation) {
this.renderer = renderer;
this.nzSelectService = nzSelectService;
this.cdr = cdr;
this.noAnimation = noAnimation;
this.isComposing = false;
this.destroy$ = new Subject();
this.nzShowSearch = false;
this.nzOpen = false;
this.nzAllowClear = false;
this.nzShowArrow = true;
this.nzLoading = false;
this.nzTokenSeparators = [];
}
/**
* @param {?} e
* @return {?}
*/
onClearSelection(e) {
e.stopPropagation();
this.nzSelectService.updateListOfSelectedValue([], true);
}
/**
* @param {?} value
* @return {?}
*/
setInputValue(value) {
if (this.inputElement) {
this.inputElement.nativeElement.value = value;
}
this.inputValue = value;
this.updateWidth();
this.nzSelectService.updateSearchValue(value);
this.nzSelectService.tokenSeparate(this.inputValue, this.nzTokenSeparators);
}
/**
* @return {?}
*/
get placeHolderDisplay() {
return this.inputValue || this.isComposing || this.nzSelectService.listOfSelectedValue.length ? 'none' : 'block';
}
/**
* @return {?}
*/
get selectedValueStyle() {
/** @type {?} */
let showSelectedValue = false;
/** @type {?} */
let opacity = 1;
if (!this.nzShowSearch) {
showSelectedValue = true;
}
else {
if (this.nzOpen) {
showSelectedValue = !(this.inputValue || this.isComposing);
if (showSelectedValue) {
opacity = 0.4;
}
}
else {
showSelectedValue = true;
}
}
return {
display: showSelectedValue ? 'block' : 'none',
opacity: `${opacity}`
};
}
// tslint:disable-next-line:no-any
/**
* @param {?} _index
* @param {?} option
* @return {?}
*/
trackValue(_index, option) {
return option.nzValue;
}
/**
* @return {?}
*/
updateWidth() {
if (this.nzSelectService.isMultipleOrTags && this.inputElement) {
if (this.inputValue || this.isComposing) {
this.renderer.setStyle(this.inputElement.nativeElement, 'width', `${this.inputElement.nativeElement.scrollWidth}px`);
}
else {
this.renderer.removeStyle(this.inputElement.nativeElement, 'width');
}
}
}
/**
* @param {?} option
* @param {?} e
* @return {?}
*/
removeSelectedValue(option, e) {
this.nzSelectService.removeValueFormSelected(option);
e.stopPropagation();
}
/**
* @return {?}
*/
ngOnInit() {
this.nzSelectService.open$.pipe(takeUntil(this.destroy$)).subscribe((/**
* @param {?} open
* @return {?}
*/
open => {
if (this.inputElement && open) {
this.inputElement.nativeElement.focus();
}
}));
this.nzSelectService.clearInput$.pipe(takeUntil(this.destroy$)).subscribe((/**
* @return {?}
*/
() => {
this.setInputValue('');
}));
this.nzSelectService.check$.pipe(takeUntil(this.destroy$)).subscribe((/**
* @return {?}
*/
() => {
this.cdr.markForCheck();
}));
}
/**
* @return {?}
*/
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
}
}
NzSelectTopControlComponent.decorators = [
{ type: Component, args: [{
selector: '[nz-select-top-control]',
preserveWhitespaces: false,
animations: [zoomMotion],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: "<ng-template #inputTemplate>\n <input #inputElement\n autocomplete=\"something-new\"\n class=\"ant-select-search__field\"\n (compositionstart)=\"isComposing = true\"\n (compositionend)=\"isComposing = false\"\n (input)=\"updateWidth()\"\n [ngModel]=\"inputValue\"\n (ngModelChange)=\"setInputValue($event)\"\n [disabled]=\"nzSelectService.disabled\">\n</ng-template>\n<div class=\"ant-select-selection__rendered\">\n <div *ngIf=\"nzPlaceHolder\"\n nz-select-unselectable\n [style.display]=\"placeHolderDisplay\"\n class=\"ant-select-selection__placeholder\">{{ nzPlaceHolder }}</div>\n <!--single mode-->\n <ng-container *ngIf=\"nzSelectService.isSingleMode\">\n <!--selected label-->\n <div *ngIf=\"nzSelectService.listOfCachedSelectedOption.length && nzSelectService.listOfSelectedValue.length\"\n class=\"ant-select-selection-selected-value\"\n [attr.title]=\"nzSelectService.listOfCachedSelectedOption[0]?.nzLabel\"\n [ngStyle]=\"selectedValueStyle\">\n {{ nzSelectService.listOfCachedSelectedOption[0]?.nzLabel }}\n </div>\n <!--show search-->\n <div *ngIf=\"nzShowSearch\"\n class=\"ant-select-search ant-select-search--inline\">\n <div class=\"ant-select-search__field__wrap\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n <span class=\"ant-select-search__field__mirror\">{{inputValue}} </span>\n </div>\n </div>\n </ng-container>\n <!--multiple or tags mode-->\n <ul *ngIf=\"nzSelectService.isMultipleOrTags\">\n <ng-container *ngFor=\"let option of nzSelectService.listOfCachedSelectedOption | slice: 0 : nzMaxTagCount;trackBy:trackValue;\">\n <li [@zoomMotion]\n [nzNoAnimation]=\"noAnimation?.nzNoAnimation\"\n [attr.title]=\"option.nzLabel\"\n [class.ant-select-selection__choice__disabled]=\"option.nzDisabled\"\n class=\"ant-select-selection__choice\">\n <div class=\"ant-select-selection__choice__content\">{{ option.nzLabel }}</div>\n <span *ngIf=\"!option.nzDisabled\"\n class=\"ant-select-selection__choice__remove\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"removeSelectedValue(option, $event)\">\n <i nz-icon type=\"close\" class=\"ant-select-remove-icon\" *ngIf=\"!nzRemoveIcon; else nzRemoveIcon\"></i>\n </span>\n </li>\n </ng-container>\n <li *ngIf=\"nzSelectService.listOfCachedSelectedOption.length > nzMaxTagCount\"\n [@zoomMotion]\n [nzNoAnimation]=\"noAnimation?.nzNoAnimation\"\n class=\"ant-select-selection__choice\">\n <div class=\"ant-select-selection__choice__content\">\n <ng-container *ngIf=\"nzMaxTagPlaceholder\">\n <ng-template\n [ngTemplateOutlet]=\"nzMaxTagPlaceholder\"\n [ngTemplateOutletContext]=\"{ $implicit: nzSelectService.listOfSelectedValue | slice: nzMaxTagCount}\">\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"!nzMaxTagPlaceholder\">\n + {{ nzSelectService.listOfCachedSelectedOption.length - nzMaxTagCount }} ...\n </ng-container>\n </div>\n </li>\n <li class=\"ant-select-search ant-select-search--inline\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </li>\n </ul>\n</div>\n<span *ngIf=\"nzAllowClear && nzSelectService.listOfSelectedValue.length\"\n class=\"ant-select-selection__clear\"\n nz-select-unselectable\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onClearSelection($event)\">\n <i nz-icon type=\"close-circle\" theme=\"fill\" *ngIf=\"!nzClearIcon; else nzClearIcon\" class=\"ant-select-close-icon\"></i>\n </span>\n<span class=\"ant-select-arrow\" nz-select-unselectable *ngIf=\"nzShowArrow\">\n <i nz-icon type=\"loading\" *ngIf=\"nzLoading; else defaultArrow\"></i>\n <ng-template #defaultArrow>\n <i nz-icon type=\"down\" class=\"ant-select-arrow-icon\" *ngIf=\"!nzSuffixIcon; else nzSuffixIcon\"></i>\n </ng-template>\n</span>"
}] }
];
/** @nocollapse */
NzSelectTopControlComponent.ctorParameters = () => [
{ type: Renderer2 },
{ type: NzSelectService },
{ type: ChangeDetectorRef },
{ type: NzNoAnimationDirective, decorators: [{ type: Host }, { type: Optional }] }
];
NzSelectTopControlComponent.propDecorators = {
inputElement: [{ type: ViewChild, args: ['inputElement',] }],
nzShowSearch: [{ type: Input }],
nzPlaceHolder: [{ type: Input }],
nzOpen: [{ type: Input }],
nzMaxTagCount: [{ type: Input }],
nzAllowClear: [{ type: Input }],
nzShowArrow: [{ type: Input }],
nzLoading: [{ type: Input }],
nzSuffixIcon: [{ type: Input }],
nzClearIcon: [{ type: Input }],
nzRemoveIcon: [{ type: Input }],
nzMaxTagPlaceholder: [{ type: Input }],
nzTokenSeparators: [{ type: Input }]
};
if (false) {
/** @type {?} */
NzSelectTopControlComponent.prototype.inputValue;
/** @type {?} */
NzSelectTopControlComponent.prototype.isComposing;
/**
* @type {?}
* @private
*/
NzSelectTopControlComponent.prototype.destroy$;
/** @type {?} */
NzSelectTopControlComponent.prototype.inputElement;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzShowSearch;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzPlaceHolder;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzOpen;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzMaxTagCount;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzAllowClear;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzShowArrow;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzLoading;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzSuffixIcon;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzClearIcon;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzRemoveIcon;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzMaxTagPlaceholder;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzTokenSeparators;
/**
* @type {?}
* @private
*/
NzSelectTopControlComponent.prototype.renderer;
/** @type {?} */
NzSelectTopControlComponent.prototype.nzSelectService;
/**
* @type {?}
* @private
*/
NzSelectTopControlComponent.prototype.cdr;
/** @type {?} */
NzSelectTopControlComponent.prototype.noAnimation;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotc2VsZWN0LXRvcC1jb250cm9sLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLXpvcnJvLWFudGQteWovIiwic291cmNlcyI6WyJzZWxlY3Qvbnotc2VsZWN0LXRvcC1jb250cm9sLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsT0FBTyxFQ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