@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.
@@ -2098,6 +2098,7 @@ var DateParser = /** @__PURE__ @class */ (function () {
2098
2098
  // eslint-disable-next-line
2099
2099
  matchString = ((prop === 'month') && (!parseOptions.isIslamic) && (parseOptions.culture === 'en' || parseOptions.culture === 'en-GB' || parseOptions.culture === 'en-US'))
2100
2100
  ? matchString[0].toUpperCase() + matchString.substring(1).toLowerCase() : matchString;
2101
+ matchString = ((prop !== 'month') && (prop === 'designator') && parseOptions.culture === 'en-GB') ? matchString.toLowerCase() : matchString;
2101
2102
  // eslint-disable-next-line
2102
2103
  retOptions[prop] = parseOptions[prop][matchString];
2103
2104
  }
@@ -2331,7 +2332,7 @@ var Observer = /** @__PURE__ @class */ (function () {
2331
2332
  }
2332
2333
  var cntxt = context || this.context;
2333
2334
  if (this.notExist(property)) {
2334
- this.boundedEvents["" + property] = [{ handler: handler, context: cntxt }];
2335
+ this.boundedEvents["" + property] = [{ handler: handler, context: cntxt, id: id }];
2335
2336
  return;
2336
2337
  }
2337
2338
  if (!isNullOrUndefined(id)) {
@@ -2472,6 +2473,26 @@ var Observer = /** @__PURE__ @class */ (function () {
2472
2473
  Observer.prototype.destroy = function () {
2473
2474
  this.boundedEvents = this.context = undefined;
2474
2475
  };
2476
+ /**
2477
+ * To remove internationalization events
2478
+ *
2479
+ * @returns {void} ?
2480
+ */
2481
+ Observer.prototype.offIntlEvents = function () {
2482
+ var eventsArr = this.boundedEvents['notifyExternalChange'];
2483
+ if (eventsArr) {
2484
+ for (var i = 0; i < eventsArr.length; i++) {
2485
+ var curContext = eventsArr[0].context;
2486
+ if (curContext && curContext.detectFunction && curContext.randomId && !curContext.isRendered) {
2487
+ this.off('notifyExternalChange', curContext.detectFunction, curContext.randomId);
2488
+ i--;
2489
+ }
2490
+ }
2491
+ if (!this.boundedEvents['notifyExternalChange'].length) {
2492
+ delete this.boundedEvents['notifyExternalChange'];
2493
+ }
2494
+ }
2495
+ };
2475
2496
  /**
2476
2497
  * Returns if the property exists.
2477
2498
  *
@@ -3609,7 +3630,8 @@ var IntlBase;
3609
3630
  */
3610
3631
  function changeCurrencySymbol(val, sym) {
3611
3632
  if (val) {
3612
- return val.replace(IntlBase.defaultCurrency, sym);
3633
+ val = val.replace(IntlBase.defaultCurrency, sym);
3634
+ return (sym === '') ? val.trim() : val;
3613
3635
  }
3614
3636
  return '';
3615
3637
  }
@@ -4265,7 +4287,7 @@ var Fetch = /** @__PURE__ @class */ (function () {
4265
4287
  return this.fetchResponse.then(function (response) {
4266
4288
  _this.triggerEvent(_this['onLoad'], response);
4267
4289
  if (!response.ok) {
4268
- throw new Error(response.statusText);
4290
+ throw response;
4269
4291
  }
4270
4292
  var responseType = 'text';
4271
4293
  for (var _i = 0, _a = Object.keys(contentTypes); _i < _a.length; _i++) {
@@ -5553,7 +5575,8 @@ var Base = /** @__PURE__ @class */ (function () {
5553
5575
  var _this = this;
5554
5576
  // eslint-disable-next-line
5555
5577
  this.element.ej2_instances =
5556
- this.element.ej2_instances.filter(function (i) { return i !== _this; });
5578
+ this.element.ej2_instances ? this.element.ej2_instances.filter(function (i) { return i !== _this; })
5579
+ : [];
5557
5580
  removeClass([this.element], ['e-' + this.getModuleName()]);
5558
5581
  if (this.element.ej2_instances.length === 0) {
5559
5582
  // Remove module class from the root element
@@ -9594,7 +9617,7 @@ function evalExp(str, nameSpace, helper, ignorePrefix) {
9594
9617
  }
9595
9618
  else {
9596
9619
  // evaluate normal expression
9597
- cnt = cnt !== '' ? '"+' + addNameSpace(cnt.replace(/,/gi, '+' + nameSpace + '.'), (localKeys.indexOf(cnt) === -1), nameSpace, localKeys, ignorePrefix) + '+"' : ' ';
9620
+ cnt = cnt !== '' ? '"+' + addNameSpace(cnt.replace(/,/gi, '+' + nameSpace + '.'), (localKeys.indexOf(cnt) === -1), nameSpace, localKeys, ignorePrefix) + '+"' : '${}';
9598
9621
  }
9599
9622
  }
9600
9623
  return cnt;
@@ -9987,7 +10010,7 @@ var SanitizeHtmlHelper = /** @__PURE__ @class */ (function () {
9987
10010
  this.removeAttrs = item.selectors.attributes;
9988
10011
  this.removeTags = item.selectors.tags;
9989
10012
  this.wrapElement = document.createElement('div');
9990
- this.wrapElement.innerHTML = this.sanitizeQuotes(value);
10013
+ this.wrapElement.innerHTML = value;
9991
10014
  this.removeXssTags();
9992
10015
  this.removeJsEvents();
9993
10016
  this.removeXssAttrs();
@@ -9995,47 +10018,6 @@ var SanitizeHtmlHelper = /** @__PURE__ @class */ (function () {
9995
10018
  this.removeElement();
9996
10019
  return tempEleValue.replace(/&amp;/g, '&');
9997
10020
  };
9998
- SanitizeHtmlHelper.sanitizeQuotes = function (input) {
9999
- var sanityChars = [96, 39, 34];
10000
- var escape = 92;
10001
- var sanitizedValue = '';
10002
- var quoteCounts = {
10003
- 96: 0,
10004
- 39: 0,
10005
- 34: 0
10006
- };
10007
- var isPreviousCharBackslash = false;
10008
- for (var i = 0; i < input.length; i++) {
10009
- var currentChar = input.charCodeAt(i);
10010
- if (sanityChars.indexOf(currentChar) !== -1 && !isPreviousCharBackslash) {
10011
- quoteCounts[currentChar + '']++;
10012
- }
10013
- isPreviousCharBackslash = currentChar === escape;
10014
- }
10015
- try {
10016
- // Replace the quotes which has total count is in odd number
10017
- // Previous char is not backslash, open parenthesis and
10018
- // Next is not close parenthesis
10019
- for (var i = 0; i < input.length; i++) {
10020
- var currentChar = input.charCodeAt(i);
10021
- var previousChar = i > 0 ? input.charCodeAt(i - 1) : null;
10022
- var nextChar = i < input.length - 1 ? input.charCodeAt(i + 1) : null;
10023
- if (sanityChars.indexOf(currentChar) !== -1 && previousChar !== escape) {
10024
- if (quoteCounts[currentChar + ''] % 2 === 1 && previousChar !== 40 && nextChar !== 41) {
10025
- sanitizedValue += String.fromCharCode(escape);
10026
- }
10027
- sanitizedValue += input[i + ''];
10028
- }
10029
- else {
10030
- sanitizedValue += input[i + ''];
10031
- }
10032
- }
10033
- return sanitizedValue;
10034
- }
10035
- catch (error) {
10036
- return input;
10037
- }
10038
- };
10039
10021
  SanitizeHtmlHelper.removeElement = function () {
10040
10022
  // Removes an element's attibute to avoid html tag validation
10041
10023
  var nodes = this.wrapElement.children;