ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
229 lines • 20.1 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { DOCUMENT } from '@angular/common';
import { HttpBackend } from '@angular/common/http';
import { Inject, Injectable, InjectionToken, Optional, RendererFactory2 } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { IconService } from '@ant-design/icons-angular';
import { BarsOutline, CalendarOutline, CaretDownFill, CaretDownOutline, CaretUpFill, CaretUpOutline, CheckCircleFill, CheckCircleOutline, CheckOutline, ClockCircleOutline, CloseCircleFill, CloseCircleOutline, CloseOutline, DoubleLeftOutline, DoubleRightOutline, DownOutline, EllipsisOutline, ExclamationCircleFill, ExclamationCircleOutline, EyeOutline, FileFill, FileOutline, FilterFill, InfoCircleFill, InfoCircleOutline, LeftOutline, LoadingOutline, PaperClipOutline, QuestionCircleOutline, RightOutline, SearchOutline, StarFill, UploadOutline, UpOutline } from '@ant-design/icons-angular/icons';
import * as i0 from "@angular/core";
import * as i1 from "./public-api";
import * as i2 from "@angular/platform-browser";
import * as i3 from "@angular/common/http";
import * as i4 from "@angular/common";
/**
* @record
*/
export function NzIconfontOption() { }
if (false) {
/** @type {?} */
NzIconfontOption.prototype.scriptUrl;
}
/** @type {?} */
export const NZ_ICONS = new InjectionToken('nz_icons');
/** @type {?} */
export const NZ_ICON_DEFAULT_TWOTONE_COLOR = new InjectionToken('nz_icon_default_twotone_color');
/** @type {?} */
export const DEFAULT_TWOTONE_COLOR = '#1890ff';
/** @type {?} */
export const NZ_ICONS_USED_BY_ZORRO = [
BarsOutline,
CalendarOutline,
CaretUpFill,
CaretUpOutline,
CaretDownFill,
CaretDownOutline,
CheckCircleFill,
CheckCircleOutline,
CheckOutline,
ClockCircleOutline,
CloseCircleOutline,
CloseCircleFill,
CloseOutline,
DoubleLeftOutline,
DoubleRightOutline,
DownOutline,
EllipsisOutline,
ExclamationCircleFill,
ExclamationCircleOutline,
EyeOutline,
FileFill,
FileOutline,
FilterFill,
InfoCircleFill,
InfoCircleOutline,
LeftOutline,
LoadingOutline,
PaperClipOutline,
QuestionCircleOutline,
RightOutline,
StarFill,
SearchOutline,
StarFill,
UploadOutline,
UpOutline
];
/**
* It should be a global singleton, otherwise registered icons could not be found.
*/
export class NzIconService extends IconService {
/**
* @param {?} rendererFactory
* @param {?} sanitizer
* @param {?} handler
* @param {?} document
* @param {?} icons
* @param {?} defaultColor
*/
constructor(rendererFactory, sanitizer, handler, document, icons, defaultColor) {
super(rendererFactory, handler, document, sanitizer);
this.rendererFactory = rendererFactory;
this.sanitizer = sanitizer;
this.handler = handler;
this.document = document;
this.icons = icons;
this.defaultColor = defaultColor;
this.iconfontCache = new Set();
this.warnedAboutAPI = false;
this.warnedAboutCross = false;
this.warnedAboutVertical = false;
this.addIcon(...NZ_ICONS_USED_BY_ZORRO, ...(this.icons || []));
/** @type {?} */
let primaryColor = DEFAULT_TWOTONE_COLOR;
if (this.defaultColor) {
if (this.defaultColor.startsWith('#')) {
primaryColor = this.defaultColor;
}
else {
console.warn('[NG-ZORRO]: twotone color must be a hex color!');
}
}
this.twoToneColor = { primaryColor };
}
/**
* @param {?} type
* @return {?}
*/
warnAPI(type) {
if (type === 'old' && !this.warnedAboutAPI) {
console.warn(`<i class="anticon"></i> would be deprecated soon. Please use <i nz-icon type=""></i> API.`);
this.warnedAboutAPI = true;
}
if (type === 'cross' && !this.warnedAboutCross) {
console.warn(`'cross' icon is replaced by 'close' icon.`);
this.warnedAboutCross = true;
}
if (type === 'vertical' && !this.warnedAboutVertical) {
console.warn(`'verticle' is misspelled, would be corrected in the next major version.`);
this.warnedAboutVertical = true;
}
}
/**
* @param {?} svg
* @return {?}
*/
normalizeSvgElement(svg) {
if (!svg.getAttribute('viewBox')) {
this._renderer.setAttribute(svg, 'viewBox', '0 0 1024 1024');
}
if (!svg.getAttribute('width') || !svg.getAttribute('height')) {
this._renderer.setAttribute(svg, 'width', '1em');
this._renderer.setAttribute(svg, 'height', '1em');
}
if (!svg.getAttribute('fill')) {
this._renderer.setAttribute(svg, 'fill', 'currentColor');
}
}
/**
* @param {?} opt
* @return {?}
*/
fetchFromIconfont(opt) {
const { scriptUrl } = opt;
if (this.document && !this.iconfontCache.has(scriptUrl)) {
/** @type {?} */
const script = this._renderer.createElement('script');
this._renderer.setAttribute(script, 'src', scriptUrl);
this._renderer.setAttribute(script, 'data-namespace', scriptUrl.replace(/^(https?|http):/g, ''));
this._renderer.appendChild(this.document.body, script);
this.iconfontCache.add(scriptUrl);
}
}
/**
* @param {?} type
* @return {?}
*/
createIconfontIcon(type) {
return this._createSVGElementFromString(`<svg><use xlink:href="${type}"></svg>`);
}
}
NzIconService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
NzIconService.ctorParameters = () => [
{ type: RendererFactory2 },
{ type: DomSanitizer },
{ type: HttpBackend, decorators: [{ type: Optional }] },
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
{ type: Array, decorators: [{ type: Optional }, { type: Inject, args: [NZ_ICONS,] }] },
{ type: String, decorators: [{ type: Optional }, { type: Inject, args: [NZ_ICON_DEFAULT_TWOTONE_COLOR,] }] }
];
/** @nocollapse */ NzIconService.ngInjectableDef = i0.defineInjectable({ factory: function NzIconService_Factory() { return new i1.NzIconService(i0.inject(i0.RendererFactory2), i0.inject(i2.DomSanitizer), i0.inject(i3.HttpBackend, 8), i0.inject(i4.DOCUMENT, 8), i0.inject(i1.NZ_ICONS, 8), i0.inject(i1.NZ_ICON_DEFAULT_TWOTONE_COLOR, 8)); }, token: i1.NzIconService, providedIn: "root" });
if (false) {
/**
* @type {?}
* @private
*/
NzIconService.prototype.iconfontCache;
/**
* @type {?}
* @private
*/
NzIconService.prototype.warnedAboutAPI;
/**
* @type {?}
* @private
*/
NzIconService.prototype.warnedAboutCross;
/**
* @type {?}
* @private
*/
NzIconService.prototype.warnedAboutVertical;
/**
* @type {?}
* @protected
*/
NzIconService.prototype.rendererFactory;
/**
* @type {?}
* @protected
*/
NzIconService.prototype.sanitizer;
/**
* @type {?}
* @protected
*/
NzIconService.prototype.handler;
/**
* @type {?}
* @protected
*/
NzIconService.prototype.document;
/**
* @type {?}
* @private
*/
NzIconService.prototype.icons;
/**
* @type {?}
* @private
*/
NzIconService.prototype.defaultColor;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotaWNvbi5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImljb24vbnotaWNvbi5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDM0MsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ25ELE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDL0YsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3pELE9BQU8sRUFBa0IsV0FBVyxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDeEUsT0FBTyxFQUNMLFdBQVcsRUFDWCxlQUFlLEVBQ2YsYUFBYSxFQUNiLGdCQUFnQixFQUNoQixXQUFXLEVBQ1gsY0FBYyxFQUNkLGVBQWUsRUFDZixrQkFBa0IsRUFDbEIsWUFBWSxFQUNaLGtCQUFrQixFQUNsQixlQUFlLEVBQ2Ysa0JBQWtCLEVBQ2xCLFlBQVksRUFDWixpQkFBaUIsRUFDakIsa0JBQWtCLEVBQ2xCLFdBQVcsRUFDWCxlQUFlLEVBQ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