@lunaeme/circe-core
Version:
Circe :: Angular Core Services and Tools
906 lines (882 loc) • 32 kB
JavaScript
import { __decorate, __values, __spread, __assign } from 'tslib';
import { Injectable, Pipe, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { startCase, kebabCase, camelCase } from 'lodash';
import { v4 } from 'uuid';
import { DomSanitizer } from '@angular/platform-browser';
import { OrderPipe, OrderModule } from 'ngx-order-pipe';
import { Subject } from 'rxjs';
// #############################################
// ###### OPTION CONSTANTS DEFINITION API ######
// #############################################
var ccStringTransform = {
start: 'start',
camel: 'camel',
kebab: 'kebab'
};
var ToolService = /** @class */ (function () {
function ToolService() {
this.months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
}
ToolService.getValueFromMultiLevelObject = function (object, key, separator) {
var _separator = separator || '.';
if (object[key] !== undefined) {
return object[key];
}
try {
return key.split(_separator).reduce(function (obj, index) {
return obj[index];
}, object);
}
catch (e) {
if (e instanceof TypeError) {
return undefined;
}
else {
throw e;
}
}
};
ToolService.setValueInMultiLevelObject = function (object, key, value, separator) {
var _separator = separator || '.';
return key.split(_separator).reduce(function (o, i) {
if (o && typeof o[i] === 'object') {
return o[i];
}
if (o && i in o) {
o[i] = value;
return o;
}
}, object);
};
ToolService.waitFor = function (milliseconds) {
var _now = Date.now();
var _timeOut = false;
do {
_timeOut = (Date.now() - _now >= milliseconds);
} while (!_timeOut);
};
/**
* repeatedValuesInArray
* @description
* This method returns an array of uniques values if parameter "unique" is true; or returns
* an array of ONLY repeated values (unique values are discarded) if unique is false.
* Default value por parameter unique is true.
*/
ToolService.repeatedValuesInArray = function (values, unique) {
var _unique = (unique === undefined) ? true : unique;
return (_unique) ? Array.from(new Set(values)) : values.filter(function (e, i) { return values.indexOf(e) !== i; });
};
ToolService.checkLastChar = function (text, char) {
if (text && text[text.length - 1] !== char) {
return "" + text + char;
}
return text;
};
ToolService.hexToRgb = function (hex) {
var _output = hex
.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) { return '#' + r + r + g + g + b + b; })
.substring(1)
.match(/.{2}/g);
return _output.map(function (e) { return parseInt(e, 16); });
};
ToolService.rgbToHex = function (r, g, b) {
var _output = [r, g, b].map(function (e) {
var _hex = e.toString(16);
return (_hex.length === 1) ? "0" + _hex : _hex;
});
return _output.join('');
};
/**
* generateUuid
* @description
* Generates a new uuid using uuid dependency.
*/
ToolService.generateUuid = function () {
return v4();
};
/**
* checkArray
* @description
* Returns true if parameter given "array" is an array, otherwise returns false;
* If optional parameter "filled" is given, then this method checks the array is not empty.
* Default value for "filled" is true.
*/
ToolService.checkArray = function (array, filled) {
if (filled === void 0) { filled = true; }
var _checkStructure = (!!array && Array.isArray(array));
if (filled) {
return (_checkStructure && !!array.length);
}
return _checkStructure;
};
/**
* @deprecated
*/
ToolService.getValueFromDotedKey = function (object, dotedKey, separator) {
var _separator = separator || '.';
if (object[dotedKey] !== undefined) {
return object[dotedKey];
}
try {
return dotedKey.split(_separator).reduce(function (obj, index) {
return obj[index];
}, object);
}
catch (e) {
if (e instanceof TypeError) {
return undefined;
}
else {
throw e;
}
}
};
/**
* @deprecated
*/
ToolService.formatString = function (text) {
if (isNaN(Number(text))) {
return startCase(text);
}
else {
return text;
}
};
ToolService.prototype.identifier = function (index, item) {
var _output = (typeof item === 'string') ? item : index;
['code', 'id', 'param', 'key'].forEach(function (e) {
if (item.hasOwnProperty(e)) {
_output = item[e];
return;
}
});
return _output;
};
ToolService.prototype.stringTransform = function (text, transformType) {
var _transformType = transformType || ccStringTransform.start;
var _output = text;
if (isNaN(Number(text))) {
switch (_transformType) {
case ccStringTransform.start:
_output = startCase(text);
break;
case ccStringTransform.camel:
_output = camelCase(text);
break;
case ccStringTransform.kebab:
_output = kebabCase(text);
break;
}
}
return _output;
};
ToolService = __decorate([
Injectable()
], ToolService);
return ToolService;
}());
// ###############################################
// ###### POSITION CONSTANTS DEFINITION API ######
// ###############################################
var ccHashTypes = {
class: 'class',
tag: 'tag',
id: 'id'
};
var ccElementFields = {
name: 'name',
type: 'type',
query: 'query',
shadowElement: 'shadowElement'
};
var boxModelTypeConstants = {
HORIZONTAL: 'horizontal',
VERTICAL: 'vertical'
};
var BoxModelService = /** @class */ (function () {
function BoxModelService() {
this._defaultBoxModelType = boxModelTypeConstants.VERTICAL;
this._defaultElementHashType = ccHashTypes.class;
this._defaultComputedStylePropertyProcessed = false;
this._allowCssUnits = ['px', '%'];
this._additionHorizontalInsideClasses = ['padding-left', 'padding-right', 'border-left-width', 'border-right-width'];
this._additionHorizontalOutsideClasses = ['margin-left', 'margin-right'];
this._additionVerticalInsideClasses = ['padding-top', 'padding-bottom', 'border-top-width', 'border-bottom-width'];
this._additionVerticalOutsideClasses = ['margin-top', 'margin-bottom'];
this._fontSizeRule = { applyOnElements: ['i'], boxModelType: boxModelTypeConstants.HORIZONTAL };
}
BoxModelService_1 = BoxModelService;
/**
* _isElementHash
*
* @description
* Checks if element given param is ElementHash type.
*/
BoxModelService._isElementHash = function (element) {
return !!(typeof element === 'object' &&
ccElementFields.type in element &&
ccElementFields.name in element &&
(Object.keys(element).length === 2 || Object.keys(element).length === 3));
};
/**
* _isElementQuery
*
* @description
* Checks if element given param is ElementQuery type.
*/
BoxModelService._isElementQuery = function (element) {
return !!(typeof element === 'object' &&
ccElementFields.query in element &&
(Object.keys(element).length === 1 || Object.keys(element).length === 2));
};
/**
* _isNativeDomElement
*
* @description
* Checks if element given param is a native DOM element.
*/
BoxModelService._isNativeDomElement = function (param) {
var _paramsToCheck = [
'getBoundingClientRect', 'getElementsByClassName', 'getElementsByTagName', 'querySelector'
];
return (!!param) ? (_paramsToCheck.map(function (e) { return e in param; })).every(function (el) { return !!el; }) : false;
};
/**
* _convertToElementIdArray
*
* @description
* Transform elementId type to array of Dom elements.
*/
BoxModelService.prototype._convertToElementIdArray = function (elementId) {
var e_1, _a;
var _auxArgument = [];
var _elementId = (Array.isArray(elementId)) ? elementId : [elementId];
try {
for (var _elementId_1 = __values(_elementId), _elementId_1_1 = _elementId_1.next(); !_elementId_1_1.done; _elementId_1_1 = _elementId_1.next()) {
var element = _elementId_1_1.value;
_auxArgument.push(this.getElement(element));
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_elementId_1_1 && !_elementId_1_1.done && (_a = _elementId_1.return)) _a.call(_elementId_1);
}
finally { if (e_1) throw e_1.error; }
}
return _auxArgument;
};
BoxModelService.prototype._getElementAdditions = function (element, boxModelType) {
var _this = this;
var _type = boxModelType || this._defaultBoxModelType;
var _elementStyle = window.getComputedStyle(element);
var _output = {
boxModelAdditionInside: 0,
boxModelAdditionOutside: 0
};
var _auxOutputInside = [];
var _auxOutputOutside = [];
if (_type === boxModelTypeConstants.HORIZONTAL) {
this._additionHorizontalInsideClasses.forEach(function (e) {
_auxOutputInside.push(_elementStyle.getPropertyValue(e));
});
this._additionHorizontalOutsideClasses.forEach(function (e) {
_auxOutputOutside.push(_elementStyle.getPropertyValue(e));
});
}
else {
this._additionVerticalInsideClasses.forEach(function (e) {
_auxOutputInside.push(_elementStyle.getPropertyValue(e));
});
this._additionVerticalOutsideClasses.forEach(function (e) {
_auxOutputOutside.push(_elementStyle.getPropertyValue(e));
});
}
_auxOutputInside.forEach(function (el) {
if (el !== '0px') {
_output.boxModelAdditionInside += _this.readCssUnits(el).value;
}
});
_auxOutputOutside.forEach(function (el) {
if (el !== '0px') {
_output.boxModelAdditionOutside += _this.readCssUnits(el).value;
}
});
return _output;
};
BoxModelService.prototype.getComputedStyleProperty = function (element, property, processed) {
var _processed = processed || this._defaultComputedStylePropertyProcessed;
var _elementComputedStyles = window.getComputedStyle(element);
var _output = _elementComputedStyles.getPropertyValue(property);
if (_output && _processed) {
return this.readCssUnits(_output);
}
return _output;
};
BoxModelService.prototype.processElementForSpecialRules = function (element) {
if (this._fontSizeRule.applyOnElements.includes(element.tagName.toLowerCase())) {
var _elementBoxModel = this.getBoxModel(element, boxModelTypeConstants.HORIZONTAL);
var _elementFontSize = this.getComputedStyleProperty(element, 'font-size', true);
if (_elementBoxModel.boxModelExtractedInside !== _elementFontSize.value) {
element.style.width = _elementFontSize.value + "px";
return element;
}
}
return element;
};
BoxModelService.prototype.readCssUnits = function (expression) {
var _output = { value: 0, unit: '' };
this._allowCssUnits.forEach(function (e) {
if (expression.includes(e)) {
_output.unit = e;
var _aux = expression.split(e).filter(function (el) { return !!el; });
if (_aux.length === 1) {
_output.value = Number(_aux[0]);
}
return;
}
});
return (_output.value && _output.unit) ? _output : null;
};
BoxModelService.prototype.processSizeString = function (sizeString) {
var _output = { with: null, height: null };
if (sizeString) {
var _auxSize = sizeString.split(' ');
if (_auxSize.length === 1) {
var _cssUnit = this.readCssUnits(_auxSize[0]);
_output.with = _cssUnit;
_output.height = _cssUnit;
}
else if (_auxSize.length === 2) {
_output.height = this.readCssUnits(_auxSize[0]);
_output.with = this.readCssUnits(_auxSize[1]);
}
}
return (_output.with && _output.height) ? _output : null;
};
/**
* getElement
*
* @description
* Returns an element DOM native object from different types of given params.
*/
BoxModelService.prototype.getElement = function (element) {
var _output = element;
var _element = element;
var _shadowElement = document;
if (typeof element === 'string') {
_element = { type: this._defaultElementHashType, name: element };
}
else {
if (ccElementFields.shadowElement in _element) {
_shadowElement = this.getElement(_element.shadowElement);
}
}
if (!BoxModelService_1._isNativeDomElement(_element)) {
if (BoxModelService_1._isElementHash(_element)) {
switch (_element.type) {
case ccHashTypes.class:
_output = _shadowElement.getElementsByClassName(_element.name).item(0);
break;
case ccHashTypes.tag:
_output = _shadowElement.getElementsByTagName(_element.name).item(0);
break;
case ccHashTypes.id:
_output = document.getElementById(_element.name);
break;
}
}
else if (BoxModelService_1._isElementQuery(_element)) {
_output = _shadowElement.querySelector(_element.query);
}
}
if (!BoxModelService_1._isNativeDomElement(_output)) {
throw new Error('BoxModel.getElement: Unrecognizable element.');
}
return _output;
};
BoxModelService.prototype.getBoxModel = function (elementId, boxModelType) {
var _this = this;
var _output = {
type: boxModelType || this._defaultBoxModelType,
boxModel: 0,
boxModelAdditions: 0,
boxModelAggregated: 0,
boxModelExtracted: 0,
boxModelAdditionsInside: 0,
boxModelAdditionsOutside: 0,
boxModelAggregatedInside: 0,
boxModelAggregatedOutside: 0,
boxModelExtractedInside: 0,
boxModelExtractedOutside: 0
};
var _elementId = this._convertToElementIdArray(elementId);
_elementId.forEach(function (e) {
var _elementRect = e.getBoundingClientRect();
var _additions = _this._getElementAdditions(e, _output.type);
_output.boxModel += (_output.type === boxModelTypeConstants.HORIZONTAL) ? _elementRect.width : _elementRect.height;
_output.boxModelAdditions += _additions.boxModelAdditionInside + _additions.boxModelAdditionOutside;
_output.boxModelAdditionsInside += _additions.boxModelAdditionInside;
_output.boxModelAdditionsOutside += _additions.boxModelAdditionOutside;
});
_output.boxModelAggregated = _output.boxModel + _output.boxModelAdditions;
_output.boxModelExtracted = _output.boxModel - _output.boxModelAdditions;
_output.boxModelAggregatedInside = _output.boxModel + _output.boxModelAdditionsInside;
_output.boxModelAggregatedOutside = _output.boxModel + _output.boxModelAdditionsOutside;
_output.boxModelExtractedInside = _output.boxModel - _output.boxModelAdditionsInside;
_output.boxModelExtractedOutside = _output.boxModel - _output.boxModelAdditionsOutside;
return _output;
};
var BoxModelService_1;
BoxModelService = BoxModelService_1 = __decorate([
Injectable()
], BoxModelService);
return BoxModelService;
}());
var EventsService = /** @class */ (function () {
function EventsService(_bm) {
this._bm = _bm;
this._defaultEventImmediatePropagation = true;
this._defaultSelectDomElement = { type: ccHashTypes.tag, name: 'main' };
}
EventsService.prototype.preventNeededEvent = function (event, immediatePropagation) {
var _immediate = immediatePropagation || this._defaultEventImmediatePropagation;
if (_immediate) {
event.stopImmediatePropagation();
}
else {
event.stopPropagation();
}
};
EventsService.prototype.preventNoNeededEvent = function (event, immediatePropagation) {
var _immediate = immediatePropagation || this._defaultEventImmediatePropagation;
this.preventNeededEvent(event, _immediate);
if (event.cancelable) {
event.preventDefault();
}
};
EventsService.prototype.scrollTop = function (element) {
var _element = element || this._defaultSelectDomElement;
var _target = this._bm.getElement(_element);
if (_target) {
_target.scroll(0, 0);
}
};
/**
* @deprecated
*/
EventsService.prototype.preventMouseEvent = function (event, immediatePropagation) {
var _immediate = immediatePropagation || this._defaultEventImmediatePropagation;
if (_immediate) {
event.stopImmediatePropagation();
}
else {
event.stopPropagation();
}
event.preventDefault();
};
/**
* @deprecated
*/
EventsService.prototype.preventKeyEvent = function (event, immediatePropagation) {
var _immediate = immediatePropagation || this._defaultEventImmediatePropagation;
if (_immediate) {
event.stopImmediatePropagation();
}
else {
event.stopPropagation();
}
};
EventsService.ctorParameters = function () { return [
{ type: BoxModelService }
]; };
EventsService = __decorate([
Injectable()
], EventsService);
return EventsService;
}());
var CustomValidationService = /** @class */ (function () {
function CustomValidationService() {
this._customMessages = {
repeated: 'There can not be repeated values'
};
}
CustomValidationService.formArrayRepeatedValues = function (control) {
var _output = null;
var _repeatedValues = ToolService.repeatedValuesInArray(control.value);
if (_repeatedValues && Array.isArray(_repeatedValues) && _repeatedValues.length) {
_output = {
repeated: { repeatedValues: _repeatedValues.join(', ') }
};
}
return _output;
};
CustomValidationService.prototype.getCustomMessages = function (keys) {
var _this = this;
var _keys = (keys && typeof keys === 'string') ? [keys] : keys;
var _output = {};
_keys.forEach(function (e) {
_output[e] = _this._customMessages[e];
});
return _output;
};
CustomValidationService = __decorate([
Injectable()
], CustomValidationService);
return CustomValidationService;
}());
var SanitizeHtmlPipe = /** @class */ (function () {
function SanitizeHtmlPipe(_sanitizer) {
this._sanitizer = _sanitizer;
}
SanitizeHtmlPipe.prototype.transform = function (value) {
return this._sanitizer.bypassSecurityTrustHtml(value);
};
SanitizeHtmlPipe.ctorParameters = function () { return [
{ type: DomSanitizer }
]; };
SanitizeHtmlPipe = __decorate([
Pipe({
name: 'sanitizeHtml'
})
], SanitizeHtmlPipe);
return SanitizeHtmlPipe;
}());
var SanitizeHtmlModule = /** @class */ (function () {
function SanitizeHtmlModule() {
}
SanitizeHtmlModule = __decorate([
NgModule({
exports: [SanitizeHtmlPipe],
declarations: [SanitizeHtmlPipe],
imports: [CommonModule]
})
], SanitizeHtmlModule);
return SanitizeHtmlModule;
}());
var OrderConditionPipe = /** @class */ (function () {
function OrderConditionPipe(_o) {
this._o = _o;
}
OrderConditionPipe.prototype.transform = function (value, orderBy, condition, reverse, caseSensitive) {
var _condition = (condition === undefined) ? true : !!condition;
return (_condition) ? this._o.transform(value, orderBy, !!reverse, !!caseSensitive) : value;
};
OrderConditionPipe.ctorParameters = function () { return [
{ type: OrderPipe }
]; };
OrderConditionPipe = __decorate([
Pipe({
name: 'orderCondition'
})
], OrderConditionPipe);
return OrderConditionPipe;
}());
var OrderConditionModule = /** @class */ (function () {
function OrderConditionModule() {
}
OrderConditionModule = __decorate([
NgModule({
exports: [OrderConditionPipe],
declarations: [OrderConditionPipe],
imports: [
CommonModule,
OrderModule
],
providers: [OrderConditionPipe]
})
], OrderConditionModule);
return OrderConditionModule;
}());
var CoreModule = /** @class */ (function () {
function CoreModule() {
}
CoreModule_1 = CoreModule;
CoreModule.forChild = function () {
return {
ngModule: CoreModule_1,
providers: [
BoxModelService,
EventsService,
CustomValidationService,
ToolService
]
};
};
var CoreModule_1;
CoreModule = CoreModule_1 = __decorate([
NgModule({
exports: [
OrderConditionPipe,
SanitizeHtmlPipe
],
imports: [
CommonModule,
OrderConditionModule,
SanitizeHtmlModule
]
})
], CoreModule);
return CoreModule;
}());
var BoxModelModule = /** @class */ (function () {
function BoxModelModule() {
}
BoxModelModule_1 = BoxModelModule;
BoxModelModule.forChild = function () {
return {
ngModule: BoxModelModule_1,
providers: [BoxModelService]
};
};
var BoxModelModule_1;
BoxModelModule = BoxModelModule_1 = __decorate([
NgModule({
imports: [CommonModule]
})
], BoxModelModule);
return BoxModelModule;
}());
var CustomValidationModule = /** @class */ (function () {
function CustomValidationModule() {
}
CustomValidationModule_1 = CustomValidationModule;
CustomValidationModule.forChild = function () {
return {
ngModule: CustomValidationModule_1,
providers: [CustomValidationService]
};
};
var CustomValidationModule_1;
CustomValidationModule = CustomValidationModule_1 = __decorate([
NgModule({
imports: [CommonModule]
})
], CustomValidationModule);
return CustomValidationModule;
}());
var EventsModule = /** @class */ (function () {
function EventsModule() {
}
EventsModule_1 = EventsModule;
EventsModule.forChild = function () {
return {
ngModule: EventsModule_1,
providers: [EventsService]
};
};
var EventsModule_1;
EventsModule = EventsModule_1 = __decorate([
NgModule({
imports: [
CommonModule,
BoxModelModule.forChild()
]
})
], EventsModule);
return EventsModule;
}());
var ToolModule = /** @class */ (function () {
function ToolModule() {
}
ToolModule_1 = ToolModule;
ToolModule.forChild = function () {
return {
ngModule: ToolModule_1,
providers: [ToolService]
};
};
var ToolModule_1;
ToolModule = ToolModule_1 = __decorate([
NgModule({
imports: [CommonModule]
})
], ToolModule);
return ToolModule;
}());
// #####################################################
// ###### PRIVATE TYPES, INTERFACES AND CONSTANTS ######
// #####################################################
// #############################################
// ###### OPTION CONSTANTS DEFINITION API ######
// #############################################
var ccOptionFields = {
value: 'value',
label: 'label',
color: 'color',
icon: 'icon'
};
// ###############################################
// ###### POSITION CONSTANTS DEFINITION API ######
// ###############################################
var ccPositions = {
topLeft: 'top left',
topCenter: 'top center',
topRight: 'top right',
centerLeft: 'center left',
centerCenter: 'center center',
centerRight: 'center right',
bottomLeft: 'bottom left',
bottomCenter: 'bottom center',
bottomRight: 'bottom right'
};
var ccPositionsVertical = {
top: 'top',
center: 'center',
bottom: 'bottom'
};
var ccPositionsHorizontal = {
left: 'left',
center: 'center',
right: 'right'
};
// #############################################
// ###### STATUS CONSTANTS DEFINITION API ######
// #############################################
var ccStatuses = {
info: 'info',
success: 'success',
warning: 'warning',
critical: 'critical'
};
var ɵ0 = function () { }, ɵ1 = function () { };
var defaultConfig = {
timeShowing: 400,
timeToStop: 400,
callbackShow: ɵ0,
callbackStop: ɵ1
};
var AsynchronousPairVariables = /** @class */ (function () {
function AsynchronousPairVariables(config) {
if (config === void 0) { config = defaultConfig; }
this.trigger$ = new Subject();
this.show$ = new Subject();
this._startArguments = [];
this._stopArguments = [];
this._config = {};
if (!!config) {
this._config.timeShowing = (!!config.timeShowing) ? config.timeShowing : defaultConfig.timeShowing;
this._config.timeToStop = (!!config.timeToStop) ? config.timeToStop : defaultConfig.timeToStop;
this._config.callbackShow = (!!config.callbackShow) ? config.callbackShow : defaultConfig.callbackShow;
this._config.callbackStop = config.callbackStop;
if (!!!this._config.callbackStop) {
this._config.callbackStop = (!!config.callbackShow) ? config.callbackShow : defaultConfig.callbackStop;
}
}
}
Object.defineProperty(AsynchronousPairVariables.prototype, "_trigger", {
set: function (state) {
var _this = this;
this.trigger$.next(state);
if (state) {
setTimeout(function () {
var _a;
(_a = _this._config).callbackShow.apply(_a, __spread(_this._startArguments));
_this._show = true;
_this._timeoutShow = setTimeout(function () {
_this._show = false;
}, _this._config.timeShowing);
});
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(AsynchronousPairVariables.prototype, "_show", {
set: function (state) {
var _this = this;
this.show$.next(state);
if (!state) {
setTimeout(function () {
var _a;
(_a = _this._config).callbackStop.apply(_a, __spread(_this._stopArguments));
_this._trigger = false;
}, this._config.timeToStop);
}
},
enumerable: true,
configurable: true
});
AsynchronousPairVariables.prototype._setStopArguments = function () {
var arg = [];
for (var _i = 0; _i < arguments.length; _i++) {
arg[_i] = arguments[_i];
}
this._stopArguments = arg;
};
AsynchronousPairVariables.prototype.setConfig = function (config) {
if (!!config.timeShowing) {
this._config.timeShowing = config.timeShowing;
}
if (!!config.timeToStop) {
this._config.timeToStop = config.timeToStop;
}
if (!!config.callbackShow) {
this._config.callbackShow = config.callbackShow;
}
if (!!config.callbackStop) {
this._config.callbackStop = config.callbackStop;
}
};
AsynchronousPairVariables.prototype.start = function () {
var arg = [];
for (var _i = 0; _i < arguments.length; _i++) {
arg[_i] = arguments[_i];
}
clearTimeout(this._timeoutShow);
this._startArguments = arg;
this._trigger = true;
return this._setStopArguments.bind(this);
};
AsynchronousPairVariables.prototype.stop = function () {
clearTimeout(this._timeoutShow);
};
AsynchronousPairVariables.prototype.remove = function () {
this.stop();
this._show = false;
};
return AsynchronousPairVariables;
}());
var iconsClassBaseDefault = 'mda-icon';
var Icons = /** @class */ (function () {
function Icons(classBase) {
if (classBase === void 0) { classBase = iconsClassBaseDefault; }
this.classBase = classBase;
this.defaultKeys = __assign(__assign({}, ccStatuses), { close: 'close' });
this._defaults = {
info: 'icon-info',
success: 'icon-circle-check',
warning: 'icon-alert',
critical: 'icon-shield',
close: 'icon-cross'
};
this.ccIconSetFields = { iconLeft: 'iconLeft', iconRight: 'iconRight' };
this.ccIconFields = { classes: 'classes', color: 'color' };
}
Icons.prototype._applyClassBase = function (icon) {
return (!!this.classBase) ? this.classBase + " " + icon : icon;
};
Icons.prototype.get = function (defaultKey) {
var _icon = this._defaults[defaultKey];
if (!!_icon) {
return this._applyClassBase(_icon);
}
return '';
};
Icons.prototype.getCustom = function (icon) {
if (!!icon) {
return this._applyClassBase(icon);
}
return '';
};
return Icons;
}());
/*
* Public API Surface of core
*/
/**
* Generated bundle index. Do not edit.
*/
export { AsynchronousPairVariables, BoxModelModule, BoxModelService, CoreModule, CustomValidationModule, CustomValidationService, EventsModule, EventsService, Icons, OrderConditionModule, OrderConditionPipe, SanitizeHtmlModule, SanitizeHtmlPipe, ToolModule, ToolService, boxModelTypeConstants, ccElementFields, ccHashTypes, ccOptionFields, ccPositions, ccPositionsHorizontal, ccPositionsVertical, ccStatuses, ccStringTransform, ɵ0, ɵ1 };
//# sourceMappingURL=lunaeme-circe-core.js.map