@syncfusion/ej2-base
Advanced tools
Comparing version 16.1.30 to 16.1.32
@@ -9,2 +9,14 @@ # Changelog | ||
- Fixed C# number formatting issue. | ||
#### New Feature | ||
- Generating page based unique id for components. | ||
## 16.1.30 (2018-03-20) | ||
### Common | ||
#### Bug fixes | ||
- Fixed content security policy issue. | ||
@@ -11,0 +23,0 @@ |
/*! | ||
* filename: index.d.ts | ||
* version : 16.1.29 | ||
* version : 16.1.30 | ||
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"name": "@syncfusion/ej2-base", | ||
"version": "16.1.30", | ||
"version": "16.1.32", | ||
"description": "Essential JS 2 Base Library", | ||
@@ -5,0 +5,0 @@ "author": "Syncfusion Inc.", |
@@ -1,2 +0,2 @@ | ||
import { isUndefined, getValue, isNullOrUndefined, setValue, getUniqueID, uniqueID } from './util';import { ModuleLoader, ModuleDeclaration } from './module-loader';import { Base } from './base';import { Observer, BoundOptions } from './observer';import { ChildProperty } from './child-property';import { Property, NotifyPropertyChanges } from './notify-property-change';import { onIntlChange, rightToLeft, defaultCulture } from './internationalization'; | ||
import { isUndefined, getValue, isNullOrUndefined, setValue, uniqueID } from './util';import { ModuleLoader, ModuleDeclaration } from './module-loader';import { Base } from './base';import { Observer, BoundOptions } from './observer';import { ChildProperty } from './child-property';import { Property, NotifyPropertyChanges } from './notify-property-change';import { onIntlChange, rightToLeft, defaultCulture } from './internationalization'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -43,4 +43,4 @@ import { ModuleLoader, ModuleDeclaration } from './module-loader'; | ||
/** | ||
* Appends the component within the given HTML element | ||
* @param {string | HTMLElement} selector - Target element where component needs to be appended. | ||
* Appends the control within the given HTML element | ||
* @param {string | HTMLElement} selector - Target element where control needs to be appended | ||
*/ | ||
@@ -95,2 +95,5 @@ appendTo(selector?: string | HTMLElement): void; | ||
protected clearTemplate(templateName?: string[]): void; | ||
private getUniqueID(definedName?); | ||
private pageID(url); | ||
private isHistoryChanged(); | ||
protected addOnPersist(options: string[]): string; | ||
@@ -97,0 +100,0 @@ protected getActualProperties<T>(obj: T): T; |
@@ -20,2 +20,5 @@ var __extends = (this && this.__extends) || (function () { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var componentCount = 0; | ||
var lastPageID; | ||
var lastHistoryLen = 0; | ||
/** | ||
@@ -87,4 +90,4 @@ * Base class for all Essential JavaScript components | ||
/** | ||
* Appends the component within the given HTML element | ||
* @param {string | HTMLElement} selector - Target element where component needs to be appended. | ||
* Appends the control within the given HTML element | ||
* @param {string | HTMLElement} selector - Target element where control needs to be appended | ||
*/ | ||
@@ -101,3 +104,3 @@ Component.prototype.appendTo = function (selector) { | ||
if (this.needsID && !this.element.id) { | ||
this.element.id = util_1.getUniqueID(this.getModuleName()); | ||
this.element.id = this.getUniqueID(this.getModuleName()); | ||
} | ||
@@ -220,2 +223,25 @@ if (this.enablePersistence) { | ||
}; | ||
Component.prototype.getUniqueID = function (definedName) { | ||
if (this.isHistoryChanged()) { | ||
componentCount = 0; | ||
} | ||
lastPageID = this.pageID(location.href); | ||
lastHistoryLen = history.length; | ||
return definedName + '_' + lastPageID + '_' + componentCount++; | ||
}; | ||
Component.prototype.pageID = function (url) { | ||
var hash = 0; | ||
if (url.length === 0) { | ||
return hash; | ||
} | ||
for (var i = 0; i < url.length; i++) { | ||
var char = url.charCodeAt(i); | ||
hash = ((hash << 5) - hash) + char; | ||
hash = hash & hash; // Convert to 32bit integer | ||
} | ||
return Math.abs(hash); | ||
}; | ||
Component.prototype.isHistoryChanged = function () { | ||
return lastPageID !== this.pageID(location.href) || lastHistoryLen !== history.length; | ||
}; | ||
Component.prototype.addOnPersist = function (options) { | ||
@@ -288,2 +314,13 @@ var _this = this; | ||
exports.Component = Component; | ||
//Function handling for page navigation detection | ||
/* istanbul ignore next */ | ||
(function () { | ||
if (typeof window !== 'undefined') { | ||
window.addEventListener('popstate', | ||
/* istanbul ignore next */ | ||
function () { | ||
componentCount = 0; | ||
}); | ||
} | ||
})(); | ||
}); |
@@ -30,3 +30,3 @@ define(["require", "exports", "../util", "./parser-base", "./date-formatter", "./number-formatter"], function (require, exports, util_1, parser_base_1, date_formatter_1, number_formatter_1) { | ||
}; | ||
IntlBase.formatRegex = /(^[ncpa]{1})([0-1]?[0-9]|20)?$/i; | ||
IntlBase.formatRegex = /(^[ncpae]{1})([0-1]?[0-9]|20)?$/i; | ||
var typeMapper = { | ||
@@ -267,2 +267,5 @@ '$': 'isCurrency', | ||
'accounting': '¤#,##0.00;(¤#,##0.00)' | ||
}, | ||
'scientificFormats-numberSystem-latn': { | ||
'standard': '#E0' | ||
} | ||
@@ -290,3 +293,4 @@ } | ||
N: 'decimal', | ||
A: 'currency' | ||
A: 'currency', | ||
E: 'scientific' | ||
}; | ||
@@ -462,4 +466,4 @@ /** | ||
var pattern = format.match(IntlBase.customRegex); | ||
if (util_1.isNullOrUndefined(pattern) || pattern[5] === '') { | ||
util_1.throwError('Given Format is not valid or Cldr data not loaded'); | ||
if (util_1.isNullOrUndefined(pattern) || (pattern[5] === '' && format !== 'N/A')) { | ||
cOptions.type = undefined; | ||
} | ||
@@ -466,0 +470,0 @@ cOptions.nlead = pattern[1]; |
@@ -14,3 +14,3 @@ define(["require", "exports", "../util", "../internationalization", "./intl-base", "./parser-base"], function (require, exports, util_1, internationalization_1, intl_base_1, parser_base_1) { | ||
var spaceRegex = /\s/; | ||
var mapper = ['infinity', 'nan', 'group', 'decimal']; | ||
var mapper = ['infinity', 'nan', 'group', 'decimal', 'exponential']; | ||
var infinity = 'infinity'; | ||
@@ -177,31 +177,45 @@ var nan = 'nan'; | ||
var curData; | ||
if (value < 0) { | ||
value = value * -1; | ||
curData = fOptions.nData; | ||
if (util_1.isUndefined(fOptions.nData.type)) { | ||
return undefined; | ||
} | ||
else if (value === 0) { | ||
curData = fOptions.zeroData || fOptions.pData; | ||
} | ||
else { | ||
curData = fOptions.pData; | ||
} | ||
var fValue = ''; | ||
if (curData.isPercent) { | ||
value = value * 100; | ||
} | ||
if (curData.groupOne) { | ||
fValue = this.processSignificantDigits(value, curData.minimumSignificantDigits, curData.maximumSignificantDigits); | ||
} | ||
else { | ||
fValue = this.processFraction(value, curData.minimumFractionDigits, curData.maximumFractionDigits); | ||
if (curData.minimumIntegerDigits) { | ||
fValue = this.processMinimumIntegers(fValue, curData.minimumIntegerDigits); | ||
if (value < 0) { | ||
value = value * -1; | ||
curData = fOptions.nData; | ||
} | ||
else if (value === 0) { | ||
curData = fOptions.zeroData || fOptions.pData; | ||
} | ||
else { | ||
curData = fOptions.pData; | ||
} | ||
var fValue = ''; | ||
if (curData.isPercent) { | ||
value = value * 100; | ||
} | ||
if (curData.groupOne) { | ||
fValue = this.processSignificantDigits(value, curData.minimumSignificantDigits, curData.maximumSignificantDigits); | ||
} | ||
else { | ||
fValue = this.processFraction(value, curData.minimumFractionDigits, curData.maximumFractionDigits); | ||
if (curData.minimumIntegerDigits) { | ||
fValue = this.processMinimumIntegers(fValue, curData.minimumIntegerDigits); | ||
} | ||
} | ||
if (curData.type === 'scientific') { | ||
fValue = value.toExponential(curData.maximumFractionDigits); | ||
fValue = fValue.replace('e', dOptions.numberMapper.numberSymbols[mapper[4]]); | ||
} | ||
fValue = fValue.replace('.', dOptions.numberMapper.numberSymbols[mapper[3]]); | ||
if (curData.useGrouping) { | ||
fValue = this.groupNumbers(fValue, curData.groupData.primary, curData.groupSeparator || ',', dOptions.numberMapper.numberSymbols[mapper[3]] || '.', curData.groupData.secondary); | ||
} | ||
fValue = parser_base_1.ParserBase.convertValueParts(fValue, intl_base_1.IntlBase.latnParseRegex, dOptions.numberMapper.mapper); | ||
if (curData.nlead === 'N/A') { | ||
return curData.nlead; | ||
} | ||
else { | ||
return curData.nlead + fValue + curData.nend; | ||
} | ||
} | ||
fValue = fValue.replace('.', dOptions.numberMapper.numberSymbols[mapper[3]]); | ||
if (curData.useGrouping) { | ||
fValue = this.groupNumbers(fValue, curData.groupData.primary, curData.groupSeparator || ',', dOptions.numberMapper.numberSymbols[mapper[3]] || '.', curData.groupData.secondary); | ||
} | ||
fValue = parser_base_1.ParserBase.convertValueParts(fValue, intl_base_1.IntlBase.latnParseRegex, dOptions.numberMapper.mapper); | ||
return curData.nlead + fValue + curData.nend; | ||
}; | ||
@@ -208,0 +222,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4140184
31399