ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
640 lines • 50.4 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { DOWN_ARROW, ENTER, ESCAPE, LEFT_ARROW, RIGHT_ARROW, 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 { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, EventEmitter, Inject, Input, Optional, Output, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core';
import { fromEvent, merge } from 'rxjs';
import { DEFAULT_MENTION_POSITIONS } from '../core/overlay/overlay-position';
import { InputBoolean } from '../core/util';
import { getMentions } from '../core/util/getMentions';
import { getCaretCoordinates } from '../core/util/textarea-caret-position';
import { NzMentionSuggestionDirective } from './nz-mention-suggestions';
import { NzMentionTriggerDirective } from './nz-mention-trigger';
/**
* @record
*/
export function MentionOnSearchTypes() { }
if (false) {
/** @type {?} */
MentionOnSearchTypes.prototype.value;
/** @type {?} */
MentionOnSearchTypes.prototype.prefix;
}
/**
* @record
*/
export function Mention() { }
if (false) {
/** @type {?} */
Mention.prototype.startPos;
/** @type {?} */
Mention.prototype.endPos;
/** @type {?} */
Mention.prototype.mention;
}
var NzMentionComponent = /** @class */ (function () {
function NzMentionComponent(ngDocument, // tslint:disable-line:no-any
changeDetectorRef, overlay, viewContainerRef) {
this.ngDocument = ngDocument;
this.changeDetectorRef = changeDetectorRef;
this.overlay = overlay;
this.viewContainerRef = viewContainerRef;
this.nzValueWith = (/**
* @param {?} value
* @return {?}
*/
function (value) { return value; }); // tslint:disable-line:no-any
// tslint:disable-line:no-any
this.nzPrefix = '@';
this.nzLoading = false;
this.nzNotFoundContent = '无匹配结果,轻敲空格完成输入';
this.nzPlacement = 'bottom';
this.nzSuggestions = [];
this.nzOnSelect = new EventEmitter();
this.nzOnSearchChange = new EventEmitter();
this.isOpen = false;
this.filteredSuggestions = [];
this.suggestionTemplate = null; // tslint:disable-line:no-any
// tslint:disable-line:no-any
this.activeIndex = -1;
this.previousValue = null;
}
Object.defineProperty(NzMentionComponent.prototype, "suggestionChild", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
if (value) {
this.suggestionTemplate = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(NzMentionComponent.prototype, "triggerNativeElement", {
get: /**
* @private
* @return {?}
*/
function () {
return this.trigger.el.nativeElement;
},
enumerable: true,
configurable: true
});
/**
* @param {?} changes
* @return {?}
*/
NzMentionComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (changes.hasOwnProperty('nzSuggestions')) {
if (this.isOpen) {
this.previousValue = null;
this.activeIndex = -1;
this.resetDropdown(false);
}
}
};
/**
* @return {?}
*/
NzMentionComponent.prototype.ngAfterContentInit = /**
* @return {?}
*/
function () {
this.bindTriggerEvents();
};
/**
* @return {?}
*/
NzMentionComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.closeDropdown();
};
/**
* @return {?}
*/
NzMentionComponent.prototype.closeDropdown = /**
* @return {?}
*/
function () {
if (this.overlayRef && this.overlayRef.hasAttached()) {
this.overlayRef.detach();
this.overlayBackdropClickSubscription.unsubscribe();
this.isOpen = false;
this.changeDetectorRef.markForCheck();
}
};
/**
* @return {?}
*/
NzMentionComponent.prototype.openDropdown = /**
* @return {?}
*/
function () {
this.attachOverlay();
this.isOpen = true;
this.changeDetectorRef.markForCheck();
};
/**
* @return {?}
*/
NzMentionComponent.prototype.getMentions = /**
* @return {?}
*/
function () {
return getMentions(this.trigger.value, this.nzPrefix);
};
/**
* @param {?} suggestion
* @return {?}
*/
NzMentionComponent.prototype.selectSuggestion = /**
* @param {?} suggestion
* @return {?}
*/
function (suggestion) {
/** @type {?} */
var value = this.nzValueWith(suggestion);
this.trigger.insertMention({
mention: value,
startPos: this.cursorMentionStart,
endPos: this.cursorMentionEnd
});
this.nzOnSelect.emit(suggestion);
this.closeDropdown();
this.activeIndex = -1;
};
/**
* @private
* @param {?} event
* @return {?}
*/
NzMentionComponent.prototype.handleInput = /**
* @private
* @param {?} event
* @return {?}
*/
function (event) {
/** @type {?} */
var target = (/** @type {?} */ (event.target));
this.trigger.onChange(target.value);
this.trigger.value = target.value;
this.resetDropdown();
};
/**
* @private
* @param {?} event
* @return {?}
*/
NzMentionComponent.prototype.handleKeydown = /**
* @private
* @param {?} event
* @return {?}
*/
function (event) {
/** @type {?} */
var keyCode = event.keyCode;
if (this.isOpen && keyCode === ENTER && this.activeIndex !== -1 && this.filteredSuggestions.length) {
this.selectSuggestion(this.filteredSuggestions[this.activeIndex]);
event.preventDefault();
}
else if (keyCode === LEFT_ARROW || keyCode === RIGHT_ARROW) {
this.resetDropdown();
event.stopPropagation();
}
else {
if (this.isOpen && (keyCode === TAB || keyCode === ESCAPE)) {
this.closeDropdown();
return;
}
if (this.isOpen && keyCode === UP_ARROW) {
this.setPreviousItemActive();
event.preventDefault();
event.stopPropagation();
}
if (this.isOpen && keyCode === DOWN_ARROW) {
this.setNextItemActive();
event.preventDefault();
event.stopPropagation();
}
}
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.handleClick = /**
* @private
* @return {?}
*/
function () {
this.resetDropdown();
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.bindTriggerEvents = /**
* @private
* @return {?}
*/
function () {
var _this = this;
this.trigger.onInput.subscribe((/**
* @param {?} e
* @return {?}
*/
function (e) { return _this.handleInput(e); }));
this.trigger.onKeydown.subscribe((/**
* @param {?} e
* @return {?}
*/
function (e) { return _this.handleKeydown(e); }));
this.trigger.onClick.subscribe((/**
* @return {?}
*/
function () { return _this.handleClick(); }));
};
/**
* @private
* @param {?} value
* @param {?} emit
* @return {?}
*/
NzMentionComponent.prototype.suggestionsFilter = /**
* @private
* @param {?} value
* @param {?} emit
* @return {?}
*/
function (value, emit) {
var _this = this;
/** @type {?} */
var suggestions = value.substring(1);
if (this.previousValue === value) {
return;
}
this.previousValue = value;
if (emit) {
this.nzOnSearchChange.emit({
value: (/** @type {?} */ (this.cursorMention)).substring(1),
prefix: (/** @type {?} */ (this.cursorMention))[0]
});
}
/** @type {?} */
var searchValue = suggestions.toLowerCase();
this.filteredSuggestions = this.nzSuggestions.filter((/**
* @param {?} suggestion
* @return {?}
*/
function (suggestion) {
return _this.nzValueWith(suggestion)
.toLowerCase()
.includes(searchValue);
}));
};
/**
* @private
* @param {?=} emit
* @return {?}
*/
NzMentionComponent.prototype.resetDropdown = /**
* @private
* @param {?=} emit
* @return {?}
*/
function (emit) {
if (emit === void 0) { emit = true; }
this.resetCursorMention();
if (typeof this.cursorMention !== 'string' || !this.canOpen()) {
this.closeDropdown();
return;
}
this.suggestionsFilter(this.cursorMention, emit);
/** @type {?} */
var activeIndex = this.filteredSuggestions.indexOf(this.cursorMention.substring(1));
this.activeIndex = activeIndex >= 0 ? activeIndex : 0;
this.openDropdown();
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.setNextItemActive = /**
* @private
* @return {?}
*/
function () {
this.activeIndex = this.activeIndex + 1 <= this.filteredSuggestions.length - 1 ? this.activeIndex + 1 : 0;
this.changeDetectorRef.markForCheck();
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.setPreviousItemActive = /**
* @private
* @return {?}
*/
function () {
this.activeIndex = this.activeIndex - 1 < 0 ? this.filteredSuggestions.length - 1 : this.activeIndex - 1;
this.changeDetectorRef.markForCheck();
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.canOpen = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var element = this.triggerNativeElement;
return !element.readOnly && !element.disabled;
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.resetCursorMention = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var value = this.triggerNativeElement.value.replace(/[\r\n]/g, ' ') || '';
/** @type {?} */
var selectionStart = (/** @type {?} */ (this.triggerNativeElement.selectionStart));
/** @type {?} */
var prefix = typeof this.nzPrefix === 'string' ? [this.nzPrefix] : this.nzPrefix;
/** @type {?} */
var i = prefix.length;
while (i >= 0) {
/** @type {?} */
var startPos = value.lastIndexOf(prefix[i], selectionStart);
/** @type {?} */
var endPos = value.indexOf(' ', selectionStart) > -1 ? value.indexOf(' ', selectionStart) : value.length;
/** @type {?} */
var mention = value.substring(startPos, endPos);
if ((startPos > 0 && value[startPos - 1] !== ' ') ||
startPos < 0 ||
mention.includes(prefix[i], 1) ||
mention.includes(' ')) {
this.cursorMention = null;
this.cursorMentionStart = -1;
this.cursorMentionEnd = -1;
}
else {
this.cursorMention = mention;
this.cursorMentionStart = startPos;
this.cursorMentionEnd = endPos;
return;
}
i--;
}
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.updatePositions = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var coordinates = getCaretCoordinates(this.triggerNativeElement, this.cursorMentionStart);
/** @type {?} */
var top = coordinates.top -
this.triggerNativeElement.getBoundingClientRect().height -
this.triggerNativeElement.scrollTop +
(this.nzPlacement === 'bottom' ? coordinates.height : 0);
/** @type {?} */
var left = coordinates.left - this.triggerNativeElement.scrollLeft;
this.positionStrategy.withDefaultOffsetX(left).withDefaultOffsetY(top);
if (this.nzPlacement === 'bottom') {
this.positionStrategy.withPositions([DEFAULT_MENTION_POSITIONS[0]]);
}
if (this.nzPlacement === 'top') {
this.positionStrategy.withPositions([DEFAULT_MENTION_POSITIONS[1]]);
}
this.positionStrategy.apply();
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.subscribeOverlayBackdropClick = /**
* @private
* @return {?}
*/
function () {
var _this = this;
return merge(fromEvent(this.ngDocument, 'click'), fromEvent(this.ngDocument, 'touchend')).subscribe((/**
* @param {?} event
* @return {?}
*/
function (event) {
/** @type {?} */
var clickTarget = (/** @type {?} */ (event.target));
if (clickTarget !== _this.trigger.el.nativeElement && _this.isOpen) {
_this.closeDropdown();
}
}));
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.attachOverlay = /**
* @private
* @return {?}
*/
function () {
if (!this.overlayRef) {
this.portal = new TemplatePortal(this.suggestionsTemp, this.viewContainerRef);
this.overlayRef = this.overlay.create(this.getOverlayConfig());
}
if (this.overlayRef && !this.overlayRef.hasAttached()) {
this.overlayRef.attach(this.portal);
this.overlayBackdropClickSubscription = this.subscribeOverlayBackdropClick();
}
this.updatePositions();
};
/**
* @private
* @return {?}
*/
NzMentionComponent.prototype.getOverlayConfig = /**
* @private
* @return {?}
*/
function () {
return new OverlayConfig({
positionStrategy: this.getOverlayPosition(),
scrollStrategy: this.overlay.scrollStrategies.reposition()
});
};
/**
* @private
* @return {?}
*/
NzMentionComponent.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.trigger.el)
.withPositions(positions)
.withFlexibleDimensions(false)
.withPush(false);
return this.positionStrategy;
};
NzMentionComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-mention',
template: "<ng-content></ng-content>\n<ng-template #suggestions>\n <ul class=\"ant-mention-dropdown\">\n <li class=\"ant-mention-dropdown-item\"\n *ngFor=\"let suggestion of filteredSuggestions; let i = index\"\n [class.focus]=\"i === activeIndex\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"selectSuggestion(suggestion)\">\n <ng-container *ngIf=\"suggestionTemplate else defaultSuggestion\">\n <ng-container *ngTemplateOutlet=\"suggestionTemplate; context: {$implicit: suggestion}\"></ng-container>\n </ng-container>\n <ng-template #defaultSuggestion>{{ nzValueWith(suggestion) }}</ng-template>\n </li>\n <li class=\"ant-mention-dropdown-notfound ant-mention-dropdown-item\"\n *ngIf=\"filteredSuggestions.length === 0\">\n <span *ngIf=\"nzLoading\"><i nz-icon type=\"loading\"></i></span>\n <span *ngIf=\"!nzLoading\">{{ nzNotFoundContent }}</span>\n </li>\n </ul>\n</ng-template>\n",
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
styles: ["\n .ant-mention-dropdown {\n top: 100%;\n left: 0;\n position: relative;\n width: 100%;\n margin-top: 4px;\n margin-bottom: 4px;\n }\n "]
}] }
];
/** @nocollapse */
NzMentionComponent.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
{ type: ChangeDetectorRef },
{ type: Overlay },
{ type: ViewContainerRef }
]; };
NzMentionComponent.propDecorators = {
nzValueWith: [{ type: Input }],
nzPrefix: [{ type: Input }],
nzLoading: [{ type: Input }],
nzNotFoundContent: [{ type: Input }],
nzPlacement: [{ type: Input }],
nzSuggestions: [{ type: Input }],
nzOnSelect: [{ type: Output }],
nzOnSearchChange: [{ type: Output }],
trigger: [{ type: ContentChild, args: [NzMentionTriggerDirective,] }],
suggestionsTemp: [{ type: ViewChild, args: [TemplateRef,] }],
suggestionChild: [{ type: ContentChild, args: [NzMentionSuggestionDirective, { read: TemplateRef },] }]
};
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzMentionComponent.prototype, "nzLoading", void 0);
return NzMentionComponent;
}());
export { NzMentionComponent };
if (false) {
/** @type {?} */
NzMentionComponent.prototype.nzValueWith;
/** @type {?} */
NzMentionComponent.prototype.nzPrefix;
/** @type {?} */
NzMentionComponent.prototype.nzLoading;
/** @type {?} */
NzMentionComponent.prototype.nzNotFoundContent;
/** @type {?} */
NzMentionComponent.prototype.nzPlacement;
/** @type {?} */
NzMentionComponent.prototype.nzSuggestions;
/** @type {?} */
NzMentionComponent.prototype.nzOnSelect;
/** @type {?} */
NzMentionComponent.prototype.nzOnSearchChange;
/** @type {?} */
NzMentionComponent.prototype.trigger;
/** @type {?} */
NzMentionComponent.prototype.suggestionsTemp;
/** @type {?} */
NzMentionComponent.prototype.isOpen;
/** @type {?} */
NzMentionComponent.prototype.filteredSuggestions;
/** @type {?} */
NzMentionComponent.prototype.suggestionTemplate;
/** @type {?} */
NzMentionComponent.prototype.activeIndex;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.previousValue;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.cursorMention;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.cursorMentionStart;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.cursorMentionEnd;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.overlayRef;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.portal;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.positionStrategy;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.overlayBackdropClickSubscription;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.ngDocument;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.changeDetectorRef;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.overlay;
/**
* @type {?}
* @private
*/
NzMentionComponent.prototype.viewContainerRef;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotbWVudGlvbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZy16b3Jyby1hbnRkLXlqLyIsInNvdXJjZXMiOlsibWVudGlvbi9uei1tZW50aW9uLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxVQUFVLEVBQUUsV0FBVyxFQUFFLEdBQUcsRUFBRSxRQUFRLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUMxRyxPQUFPLEVBQ0wsc0JBQXNCL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