ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
632 lines • 46.1 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { DOWN_ARROW, ENTER, ESCAPE, TAB, UP_ARROW } from '@angular/cdk/keycodes';
import { ConnectionPositionPair, Overlay, OverlayConfig } from '@angular/cdk/overlay';
import { TemplatePortal } from '@angular/cdk/portal';
import { DOCUMENT } from '@angular/common';
import { forwardRef, Directive, ElementRef, Inject, Input, Optional, ViewContainerRef } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { fromEvent, merge } from 'rxjs';
import { delay, distinct, map } from 'rxjs/operators';
import { NzAutocompleteComponent } from './nz-autocomplete.component';
/** @type {?} */
export var NZ_AUTOCOMPLETE_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef((/**
* @return {?}
*/
function () { return NzAutocompleteTriggerDirective; })),
multi: true
};
/**
* @return {?}
*/
export function getNzAutocompleteMissingPanelError() {
return Error('Attempting to open an undefined instance of `nz-autocomplete`. ' +
'Make sure that the id passed to the `nzAutocomplete` is correct and that ' +
"you're attempting to open it after the ngAfterContentInit hook.");
}
var NzAutocompleteTriggerDirective = /** @class */ (function () {
function NzAutocompleteTriggerDirective(elementRef, _overlay, viewContainerRef, document) {
this.elementRef = elementRef;
this._overlay = _overlay;
this.viewContainerRef = viewContainerRef;
this.document = document;
// tslint:disable-next-line:no-any
this._onChange = (/**
* @return {?}
*/
function () { });
this._onTouched = (/**
* @return {?}
*/
function () { });
this.panelOpen = false;
}
Object.defineProperty(NzAutocompleteTriggerDirective.prototype, "activeOption", {
/** Current active option */
get: /**
* Current active option
* @return {?}
*/
function () {
if (this.nzAutocomplete && this.nzAutocomplete.options.length) {
return this.nzAutocomplete.activeItem;
}
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.destroyPanel();
};
// tslint:disable-next-line:no-any
// tslint:disable-next-line:no-any
/**
* @param {?} value
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.writeValue =
// tslint:disable-next-line:no-any
/**
* @param {?} value
* @return {?}
*/
function (value) {
this.setTriggerValue(value);
};
/**
* @param {?} fn
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this._onChange = fn;
};
/**
* @param {?} fn
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this._onTouched = fn;
};
/**
* @param {?} isDisabled
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
/** @type {?} */
var element = this.elementRef.nativeElement;
element.disabled = isDisabled;
this.closePanel();
};
/**
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.openPanel = /**
* @return {?}
*/
function () {
this.attachOverlay();
};
/**
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.closePanel = /**
* @return {?}
*/
function () {
if (this.panelOpen) {
this.nzAutocomplete.isOpen = this.panelOpen = false;
if (this.overlayRef && this.overlayRef.hasAttached()) {
this.selectionChangeSubscription.unsubscribe();
this.overlayBackdropClickSubscription.unsubscribe();
this.overlayPositionChangeSubscription.unsubscribe();
this.optionsChangeSubscription.unsubscribe();
this.overlayRef.detach();
this.overlayRef = null;
this.portal = null;
}
}
};
/**
* @param {?} event
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.handleKeydown = /**
* @param {?} event
* @return {?}
*/
function (event) {
/** @type {?} */
var keyCode = event.keyCode;
/** @type {?} */
var isArrowKey = keyCode === UP_ARROW || keyCode === DOWN_ARROW;
if (keyCode === ESCAPE) {
event.preventDefault();
}
if (this.panelOpen && (keyCode === ESCAPE || keyCode === TAB)) {
// Reset value when tab / ESC close
if (this.activeOption && this.activeOption.getLabel() !== this.previousValue) {
this.setTriggerValue(this.previousValue);
}
this.closePanel();
}
else if (this.panelOpen && keyCode === ENTER) {
event.preventDefault();
if (this.nzAutocomplete.showPanel && this.activeOption) {
this.activeOption.selectViaInteraction();
}
}
else if (this.panelOpen && isArrowKey && this.nzAutocomplete.showPanel) {
event.stopPropagation();
if (keyCode === UP_ARROW) {
this.nzAutocomplete.setPreviousItemActive();
}
else {
this.nzAutocomplete.setNextItemActive();
}
if (this.activeOption) {
this.activeOption.scrollIntoViewIfNeeded();
}
this.doBackfill();
}
};
/**
* @param {?} event
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.handleInput = /**
* @param {?} event
* @return {?}
*/
function (event) {
/** @type {?} */
var target = (/** @type {?} */ (event.target));
/** @type {?} */
var value = target.value;
if (target.type === 'number') {
value = value === '' ? null : parseFloat(value);
}
if (this.canOpen() && document.activeElement === event.target && this.previousValue !== value) {
this.previousValue = value;
this._onChange(value);
this.openPanel();
}
};
/**
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.handleFocus = /**
* @return {?}
*/
function () {
if (this.canOpen()) {
this.previousValue = this.elementRef.nativeElement.value;
this.openPanel();
}
};
/**
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.handleBlur = /**
* @return {?}
*/
function () {
this.closePanel();
this._onTouched();
};
/**
* Subscription data source changes event
*/
/**
* Subscription data source changes event
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.subscribeOptionsChange = /**
* Subscription data source changes event
* @private
* @return {?}
*/
function () {
var _this = this;
return this.nzAutocomplete.options.changes.pipe(delay(0)).subscribe((/**
* @return {?}
*/
function () {
_this.resetActiveItem();
}));
};
/**
* Subscription option changes event and set the value
*/
/**
* Subscription option changes event and set the value
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.subscribeSelectionChange = /**
* Subscription option changes event and set the value
* @private
* @return {?}
*/
function () {
var _this = this;
return this.nzAutocomplete.selectionChange.subscribe((/**
* @param {?} option
* @return {?}
*/
function (option) {
_this.setValueAndClose(option);
}));
};
/**
* Subscription external click and close panel
*/
/**
* Subscription external click and close panel
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.subscribeOverlayBackdropClick = /**
* Subscription external click and close panel
* @private
* @return {?}
*/
function () {
var _this = this;
return merge(fromEvent(this.document, 'click'), fromEvent(this.document, 'touchend')).subscribe((/**
* @param {?} event
* @return {?}
*/
function (event) {
/** @type {?} */
var clickTarget = (/** @type {?} */ (event.target));
// Make sure is not self
if (clickTarget !== _this.elementRef.nativeElement &&
!(/** @type {?} */ (_this.overlayRef)).overlayElement.contains(clickTarget) &&
_this.panelOpen) {
_this.closePanel();
}
}));
};
/**
* Subscription overlay position changes and reset dropdown position
*/
/**
* Subscription overlay position changes and reset dropdown position
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.subscribeOverlayPositionChange = /**
* Subscription overlay position changes and reset dropdown position
* @private
* @return {?}
*/
function () {
var _this = this;
return this.positionStrategy.positionChanges
.pipe(map((/**
* @param {?} position
* @return {?}
*/
function (position) { return position.connectionPair.originY; })), distinct())
.subscribe((/**
* @param {?} position
* @return {?}
*/
function (position) {
_this.nzAutocomplete.dropDownPosition = position;
}));
};
/**
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.attachOverlay = /**
* @private
* @return {?}
*/
function () {
var _this = this;
if (!this.nzAutocomplete) {
throw getNzAutocompleteMissingPanelError();
}
if (!this.portal) {
this.portal = new TemplatePortal(this.nzAutocomplete.template, this.viewContainerRef);
}
if (!this.overlayRef) {
this.overlayRef = this._overlay.create(this.getOverlayConfig());
}
if (this.overlayRef && !this.overlayRef.hasAttached()) {
this.overlayRef.attach(this.portal);
this.overlayPositionChangeSubscription = this.subscribeOverlayPositionChange();
this.selectionChangeSubscription = this.subscribeSelectionChange();
this.overlayBackdropClickSubscription = this.subscribeOverlayBackdropClick();
this.optionsChangeSubscription = this.subscribeOptionsChange();
}
this.nzAutocomplete.isOpen = this.panelOpen = true;
this.nzAutocomplete.setVisibility();
this.overlayRef.updateSize({ width: this.nzAutocomplete.nzWidth || this.getHostWidth() });
setTimeout((/**
* @return {?}
*/
function () {
if (_this.overlayRef) {
_this.overlayRef.updatePosition();
}
}), 150);
this.resetActiveItem();
if (this.activeOption) {
this.activeOption.scrollIntoViewIfNeeded();
}
};
/**
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.destroyPanel = /**
* @private
* @return {?}
*/
function () {
if (this.overlayRef) {
this.closePanel();
}
};
/**
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.getOverlayConfig = /**
* @private
* @return {?}
*/
function () {
return new OverlayConfig({
positionStrategy: this.getOverlayPosition(),
scrollStrategy: this._overlay.scrollStrategies.reposition(),
// default host element width
width: this.nzAutocomplete.nzWidth || this.getHostWidth()
});
};
/**
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.getConnectedElement = /**
* @private
* @return {?}
*/
function () {
return this.elementRef;
};
/**
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.getHostWidth = /**
* @private
* @return {?}
*/
function () {
return this.getConnectedElement().nativeElement.getBoundingClientRect().width;
};
/**
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.getOverlayPosition = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var positions = [
new ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'start', overlayY: 'top' }),
new ConnectionPositionPair({ originX: 'start', originY: 'top' }, { overlayX: 'start', overlayY: 'bottom' })
];
this.positionStrategy = this._overlay
.position()
.flexibleConnectedTo(this.getConnectedElement())
.withPositions(positions)
.withFlexibleDimensions(false)
.withPush(false);
return this.positionStrategy;
};
/**
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.resetActiveItem = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var index = this.nzAutocomplete.getOptionIndex(this.nzAutocomplete.activeItem);
if (this.nzAutocomplete.activeItem && index !== -1) {
this.nzAutocomplete.setActiveItem(index);
}
else {
this.nzAutocomplete.setActiveItem(this.nzAutocomplete.nzDefaultActiveFirstOption ? 0 : -1);
}
};
/**
* @private
* @param {?} option
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.setValueAndClose = /**
* @private
* @param {?} option
* @return {?}
*/
function (option) {
/** @type {?} */
var value = option.nzValue;
this.setTriggerValue(option.getLabel());
this._onChange(value);
this.elementRef.nativeElement.focus();
this.closePanel();
};
/**
* @private
* @param {?} value
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.setTriggerValue = /**
* @private
* @param {?} value
* @return {?}
*/
function (value) {
this.elementRef.nativeElement.value = value || '';
};
/**
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.doBackfill = /**
* @private
* @return {?}
*/
function () {
if (this.nzAutocomplete.nzBackfill && this.nzAutocomplete.activeItem) {
this.setTriggerValue(this.nzAutocomplete.activeItem.getLabel());
}
};
/**
* @private
* @return {?}
*/
NzAutocompleteTriggerDirective.prototype.canOpen = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var element = this.elementRef.nativeElement;
return !element.readOnly && !element.disabled;
};
NzAutocompleteTriggerDirective.decorators = [
{ type: Directive, args: [{
selector: "input[nzAutocomplete], textarea[nzAutocomplete]",
providers: [NZ_AUTOCOMPLETE_VALUE_ACCESSOR],
host: {
autocomplete: 'off',
'aria-autocomplete': 'list',
'(focusin)': 'handleFocus()',
'(blur)': 'handleBlur()',
'(input)': 'handleInput($event)',
'(keydown)': 'handleKeydown($event)'
}
},] }
];
/** @nocollapse */
NzAutocompleteTriggerDirective.ctorParameters = function () { return [
{ type: ElementRef },
{ type: Overlay },
{ type: ViewContainerRef },
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] }
]; };
NzAutocompleteTriggerDirective.propDecorators = {
nzAutocomplete: [{ type: Input }]
};
return NzAutocompleteTriggerDirective;
}());
export { NzAutocompleteTriggerDirective };
if (false) {
/**
* Bind nzAutocomplete component
* @type {?}
*/
NzAutocompleteTriggerDirective.prototype.nzAutocomplete;
/** @type {?} */
NzAutocompleteTriggerDirective.prototype._onChange;
/** @type {?} */
NzAutocompleteTriggerDirective.prototype._onTouched;
/** @type {?} */
NzAutocompleteTriggerDirective.prototype.panelOpen;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.overlayRef;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.portal;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.positionStrategy;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.previousValue;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.selectionChangeSubscription;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.optionsChangeSubscription;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.overlayBackdropClickSubscription;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.overlayPositionChangeSubscription;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.elementRef;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype._overlay;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.viewContainerRef;
/**
* @type {?}
* @private
*/
NzAutocompleteTriggerDirective.prototype.document;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotYXV0b2NvbXBsZXRlLXRyaWdnZXIuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImF1dG8tY29tcGxldGUvbnotYXV0b2NvbXBsZXRlLXRyaWdnZXIuZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLEtBQUssRUFBRSxNQUFNLE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