@syncfusion/ej2-base 23.1.40 → 23.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2068,6 +2068,7 @@ class DateParser {
2068
2068
  // eslint-disable-next-line
2069
2069
  matchString = ((prop === 'month') && (!parseOptions.isIslamic) && (parseOptions.culture === 'en' || parseOptions.culture === 'en-GB' || parseOptions.culture === 'en-US'))
2070
2070
  ? matchString[0].toUpperCase() + matchString.substring(1).toLowerCase() : matchString;
2071
+ matchString = ((prop !== 'month') && (prop === 'designator') && parseOptions.culture === 'en-GB') ? matchString.toLowerCase() : matchString;
2071
2072
  // eslint-disable-next-line
2072
2073
  retOptions[prop] = parseOptions[prop][matchString];
2073
2074
  }
@@ -2296,7 +2297,7 @@ class Observer {
2296
2297
  }
2297
2298
  const cntxt = context || this.context;
2298
2299
  if (this.notExist(property)) {
2299
- this.boundedEvents[`${property}`] = [{ handler: handler, context: cntxt }];
2300
+ this.boundedEvents[`${property}`] = [{ handler: handler, context: cntxt, id: id }];
2300
2301
  return;
2301
2302
  }
2302
2303
  if (!isNullOrUndefined(id)) {
@@ -2435,6 +2436,26 @@ class Observer {
2435
2436
  destroy() {
2436
2437
  this.boundedEvents = this.context = undefined;
2437
2438
  }
2439
+ /**
2440
+ * To remove internationalization events
2441
+ *
2442
+ * @returns {void} ?
2443
+ */
2444
+ offIntlEvents() {
2445
+ let eventsArr = this.boundedEvents['notifyExternalChange'];
2446
+ if (eventsArr) {
2447
+ for (let i = 0; i < eventsArr.length; i++) {
2448
+ let curContext = eventsArr[0].context;
2449
+ if (curContext && curContext.detectFunction && curContext.randomId && !curContext.isRendered) {
2450
+ this.off('notifyExternalChange', curContext.detectFunction, curContext.randomId);
2451
+ i--;
2452
+ }
2453
+ }
2454
+ if (!this.boundedEvents['notifyExternalChange'].length) {
2455
+ delete this.boundedEvents['notifyExternalChange'];
2456
+ }
2457
+ }
2458
+ }
2438
2459
  /**
2439
2460
  * Returns if the property exists.
2440
2461
  *
@@ -3563,7 +3584,8 @@ var IntlBase;
3563
3584
  */
3564
3585
  function changeCurrencySymbol(val, sym) {
3565
3586
  if (val) {
3566
- return val.replace(IntlBase.defaultCurrency, sym);
3587
+ val = val.replace(IntlBase.defaultCurrency, sym);
3588
+ return (sym === '') ? val.trim() : val;
3567
3589
  }
3568
3590
  return '';
3569
3591
  }
@@ -4215,7 +4237,7 @@ class Fetch {
4215
4237
  return this.fetchResponse.then((response) => {
4216
4238
  this.triggerEvent(this['onLoad'], response);
4217
4239
  if (!response.ok) {
4218
- throw new Error(response.statusText);
4240
+ throw response;
4219
4241
  }
4220
4242
  let responseType = 'text';
4221
4243
  for (const key of Object.keys(contentTypes)) {
@@ -5412,7 +5434,8 @@ class Base {
5412
5434
  destroy() {
5413
5435
  // eslint-disable-next-line
5414
5436
  this.element.ej2_instances =
5415
- this.element.ej2_instances.filter((i) => { return i !== this; });
5437
+ this.element.ej2_instances ? this.element.ej2_instances.filter((i) => { return i !== this; })
5438
+ : [];
5416
5439
  removeClass([this.element], ['e-' + this.getModuleName()]);
5417
5440
  if (this.element.ej2_instances.length === 0) {
5418
5441
  // Remove module class from the root element
@@ -9474,7 +9497,7 @@ function evalExp(str, nameSpace, helper, ignorePrefix) {
9474
9497
  }
9475
9498
  else {
9476
9499
  // evaluate normal expression
9477
- cnt = cnt !== '' ? '"+' + addNameSpace(cnt.replace(/,/gi, '+' + nameSpace + '.'), (localKeys.indexOf(cnt) === -1), nameSpace, localKeys, ignorePrefix) + '+"' : ' ';
9500
+ cnt = cnt !== '' ? '"+' + addNameSpace(cnt.replace(/,/gi, '+' + nameSpace + '.'), (localKeys.indexOf(cnt) === -1), nameSpace, localKeys, ignorePrefix) + '+"' : '${}';
9478
9501
  }
9479
9502
  }
9480
9503
  return cnt;
@@ -9860,7 +9883,7 @@ class SanitizeHtmlHelper {
9860
9883
  this.removeAttrs = item.selectors.attributes;
9861
9884
  this.removeTags = item.selectors.tags;
9862
9885
  this.wrapElement = document.createElement('div');
9863
- this.wrapElement.innerHTML = this.sanitizeQuotes(value);
9886
+ this.wrapElement.innerHTML = value;
9864
9887
  this.removeXssTags();
9865
9888
  this.removeJsEvents();
9866
9889
  this.removeXssAttrs();
@@ -9868,47 +9891,6 @@ class SanitizeHtmlHelper {
9868
9891
  this.removeElement();
9869
9892
  return tempEleValue.replace(/&amp;/g, '&');
9870
9893
  }
9871
- static sanitizeQuotes(input) {
9872
- const sanityChars = [96, 39, 34];
9873
- const escape = 92;
9874
- let sanitizedValue = '';
9875
- const quoteCounts = {
9876
- 96: 0,
9877
- 39: 0,
9878
- 34: 0
9879
- };
9880
- let isPreviousCharBackslash = false;
9881
- for (let i = 0; i < input.length; i++) {
9882
- const currentChar = input.charCodeAt(i);
9883
- if (sanityChars.indexOf(currentChar) !== -1 && !isPreviousCharBackslash) {
9884
- quoteCounts[currentChar + '']++;
9885
- }
9886
- isPreviousCharBackslash = currentChar === escape;
9887
- }
9888
- try {
9889
- // Replace the quotes which has total count is in odd number
9890
- // Previous char is not backslash, open parenthesis and
9891
- // Next is not close parenthesis
9892
- for (let i = 0; i < input.length; i++) {
9893
- const currentChar = input.charCodeAt(i);
9894
- const previousChar = i > 0 ? input.charCodeAt(i - 1) : null;
9895
- const nextChar = i < input.length - 1 ? input.charCodeAt(i + 1) : null;
9896
- if (sanityChars.indexOf(currentChar) !== -1 && previousChar !== escape) {
9897
- if (quoteCounts[currentChar + ''] % 2 === 1 && previousChar !== 40 && nextChar !== 41) {
9898
- sanitizedValue += String.fromCharCode(escape);
9899
- }
9900
- sanitizedValue += input[i + ''];
9901
- }
9902
- else {
9903
- sanitizedValue += input[i + ''];
9904
- }
9905
- }
9906
- return sanitizedValue;
9907
- }
9908
- catch (error) {
9909
- return input;
9910
- }
9911
- }
9912
9894
  static removeElement() {
9913
9895
  // Removes an element's attibute to avoid html tag validation
9914
9896
  const nodes = this.wrapElement.children;