ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
385 lines • 29.6 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core';
import { IconDirective } from '@ant-design/icons-angular';
import { InputBoolean } from '../core/util';
import { NzIconService } from './nz-icon.service';
/** @type {?} */
const iconTypeRE = /^anticon\-\w/;
/** @type {?} */
const getIconTypeClass = (/**
* @param {?} className
* @return {?}
*/
(className) => {
if (!className) {
return undefined;
}
else {
/** @type {?} */
const classArr = className.split(/\s/);
/** @type {?} */
const index = classArr.findIndex((/**
* @param {?} cls
* @return {?}
*/
cls => cls !== 'anticon' && cls !== 'anticon-spin' && !!cls.match(iconTypeRE)));
return index === -1 ? undefined : { name: classArr[index], index };
}
});
const ɵ0 = getIconTypeClass;
/** @type {?} */
const normalizeType = (/**
* @param {?} rawType
* @return {?}
*/
(rawType) => {
/** @type {?} */
const ret = { type: rawType, crossError: false, verticalError: false };
ret.type = rawType ? rawType.replace('anticon-', '') : '';
if (ret.type.includes('verticle')) {
ret.type = 'up';
ret.verticalError = true;
}
if (ret.type.startsWith('cross')) {
ret.type = 'close';
ret.crossError = true;
}
return ret;
});
const ɵ1 = normalizeType;
/**
* This directive extends IconDirective to provide:
*
* - IconFont support
* - spinning
* - old API compatibility
*
* \@break-changes
*
* - old API compatibility, icon class names would not be supported.
* - properties that not started with `nz`.
*/
export class NzIconDirective extends IconDirective {
/**
* @param {?} iconService
* @param {?} elementRef
* @param {?} renderer
*/
constructor(iconService, elementRef, renderer) {
super(iconService, elementRef, renderer);
this.iconService = iconService;
this.elementRef = elementRef;
this.renderer = renderer;
this.nzRotate = 0;
/**
* @deprecated 8.0.0 avoid exposing low layer API.
*/
this.spin = false;
this.el = this.elementRef.nativeElement;
}
/**
* Properties with `nz` prefix.
* @param {?} value
* @return {?}
*/
set nzSpin(value) {
this.spin = value;
}
/**
* @param {?} value
* @return {?}
*/
set nzType(value) {
this.type = value;
}
/**
* @param {?} value
* @return {?}
*/
set nzTheme(value) {
this.theme = value;
}
/**
* @param {?} value
* @return {?}
*/
set nzTwotoneColor(value) {
this.twoToneColor = value;
}
/**
* @param {?} value
* @return {?}
*/
set nzIconfont(value) {
this.iconfont = value;
}
/**
* @param {?} value
* @return {?}
*/
set type(value) {
if (value && value.startsWith('anticon')) {
/** @type {?} */
const rawClass = getIconTypeClass(value);
/** @type {?} */
const type = rawClass ? normalizeType(rawClass.name).type : '';
if (type && this.type !== type) {
this._type = type;
}
}
else {
this._type = value;
}
}
/**
* @return {?}
*/
get type() {
return this._type;
}
/**
* Replacement of `changeIcon` for more modifications.
* @private
* @param {?=} oldAPI
* @return {?}
*/
changeIcon2(oldAPI = false) {
if (!oldAPI) {
this.setClassName();
}
this._changeIcon().then((/**
* @param {?} svg
* @return {?}
*/
svg => {
this.setSVGData(svg);
if (!oldAPI && svg) {
this.handleSpin(svg);
this.handleRotate(svg);
}
}));
}
/**
* @private
* @param {?} className
* @return {?}
*/
classChangeHandler(className) {
/** @type {?} */
const ret = getIconTypeClass(className);
if (ret) {
const { type, crossError, verticalError } = normalizeType(ret.name);
if (crossError) {
this.iconService.warnAPI('cross');
}
if (verticalError) {
this.iconService.warnAPI('vertical');
}
if (this.type !== type) {
this._type = type;
this.changeIcon2(true);
}
}
}
/**
* @private
* @param {?} svg
* @return {?}
*/
handleSpin(svg) {
if ((this.spin || this.type === 'loading') && !this.elementRef.nativeElement.classList.contains('anticon-spin')) {
this.renderer.addClass(svg, 'anticon-spin');
}
else {
this.renderer.removeClass(svg, 'anticon-spin');
}
}
/**
* @private
* @param {?} svg
* @return {?}
*/
handleRotate(svg) {
if (this.nzRotate) {
this.renderer.setAttribute(svg, 'style', `transform: rotate(${this.nzRotate}deg)`);
}
else {
this.renderer.removeAttribute(svg, 'style');
}
}
/**
* @private
* @return {?}
*/
setClassName() {
if (typeof this.type === 'string') {
/** @type {?} */
const iconClassNameArr = this.el.className.split(/\s/);
/** @type {?} */
const ret = getIconTypeClass(this.el.className);
if (ret) {
iconClassNameArr.splice(ret.index, 1, `anticon-${this.type}`);
this.renderer.setAttribute(this.el, 'class', iconClassNameArr.join(' '));
}
else {
this.renderer.addClass(this.el, `anticon-${this.type}`);
}
}
}
/**
* @private
* @param {?} svg
* @return {?}
*/
setSVGData(svg) {
if (typeof this.type === 'string' && svg) {
this.renderer.setAttribute(svg, 'data-icon', this.type);
this.renderer.setAttribute(svg, 'aria-hidden', 'true');
}
}
/**
* @param {?} changes
* @return {?}
*/
ngOnChanges(changes) {
const { type, nzType, nzTwotoneColor, twoToneColor, spin, nzSpin, theme, nzTheme, nzRotate } = changes;
if (type || nzType || nzTwotoneColor || twoToneColor || spin || nzSpin || theme || nzTheme) {
this.changeIcon2();
}
else if (nzRotate) {
this.handleRotate(this.el.firstChild);
}
else {
this._setSVGElement(this.iconService.createIconfontIcon(`#${this.iconfont}`));
}
}
/**
* @return {?}
*/
ngOnInit() {
// If `this.type` is not specified and `classList` contains `anticon`, it should be an icon using old API.
if (!this.type && this.el.classList.contains('anticon')) {
this.iconService.warnAPI('old');
// Get `type` from `className`. If not, initial rendering would be missed.
this.classChangeHandler(this.el.className);
// Add `class` mutation observer.
this.classNameObserver = new MutationObserver((/**
* @param {?} mutations
* @return {?}
*/
(mutations) => {
mutations
.filter((/**
* @param {?} mutation
* @return {?}
*/
(mutation) => mutation.attributeName === 'class'))
.forEach((/**
* @param {?} mutation
* @return {?}
*/
(mutation) => this.classChangeHandler(((/** @type {?} */ (mutation.target))).className)));
}));
this.classNameObserver.observe(this.el, { attributes: true });
}
// If `classList` does not contain `anticon`, add it before other class names.
if (!this.el.classList.contains('anticon')) {
this.renderer.setAttribute(this.el, 'class', `anticon ${this.el.className}`.trim());
}
}
/**
* @return {?}
*/
ngOnDestroy() {
if (this.classNameObserver) {
this.classNameObserver.disconnect();
}
}
/**
* If custom content is provided, try to normalize SVG elements.
* @return {?}
*/
ngAfterContentChecked() {
/** @type {?} */
const children = this.el.children;
/** @type {?} */
let length = children.length;
if (!this.type && children.length) {
while (length--) {
/** @type {?} */
const child = children[length];
if (child.tagName.toLowerCase() === 'svg') {
this.iconService.normalizeSvgElement((/** @type {?} */ (child)));
}
}
}
}
}
NzIconDirective.decorators = [
{ type: Directive, args: [{
selector: 'i.anticon, [nz-icon]'
},] }
];
/** @nocollapse */
NzIconDirective.ctorParameters = () => [
{ type: NzIconService },
{ type: ElementRef },
{ type: Renderer2 }
];
NzIconDirective.propDecorators = {
nzSpin: [{ type: Input }],
nzRotate: [{ type: Input }],
nzType: [{ type: Input }],
nzTheme: [{ type: Input }],
nzTwotoneColor: [{ type: Input }],
nzIconfont: [{ type: Input }],
spin: [{ type: Input }],
iconfont: [{ type: Input }],
type: [{ type: Input }]
};
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Boolean),
tslib_1.__metadata("design:paramtypes", [Boolean])
], NzIconDirective.prototype, "nzSpin", null);
if (false) {
/** @type {?} */
NzIconDirective.prototype.nzRotate;
/**
* @deprecated 8.0.0 avoid exposing low layer API.
* @type {?}
*/
NzIconDirective.prototype.spin;
/**
* @deprecated 8.0.0 avoid exposing low layer API.
* @type {?}
*/
NzIconDirective.prototype.iconfont;
/**
* @type {?}
* @private
*/
NzIconDirective.prototype.classNameObserver;
/**
* @type {?}
* @private
*/
NzIconDirective.prototype.el;
/**
* @type {?}
* @private
*/
NzIconDirective.prototype._type;
/** @type {?} */
NzIconDirective.prototype.iconService;
/** @type {?} */
NzIconDirective.prototype.elementRef;
/** @type {?} */
NzIconDirective.prototype.renderer;
}
export { ɵ0, ɵ1 };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotaWNvbi5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZy16b3Jyby1hbnRkLXlqLyIsInNvdXJjZXMiOlsia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