@easydata/crud 1.4.5-rc01 → 1.4.6-rc01

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.
@@ -3335,7 +3335,7 @@ var i18n;
3335
3335
  }
3336
3336
  else if (['D', 'F', 'C'].indexOf(type) >= 0) {
3337
3337
  var locale = getCurrentLocale();
3338
- return number.toLocaleString(locale, getNumberFromatOptions(format));
3338
+ return number.toLocaleString(locale, getNumberFormatOptions(format));
3339
3339
  }
3340
3340
  else {
3341
3341
  return convertWithMask(Math.trunc(number), format);
@@ -3411,7 +3411,7 @@ var i18n;
3411
3411
  }
3412
3412
  return result.split('').reverse().join('');
3413
3413
  }
3414
- function getNumberFromatOptions(format) {
3414
+ function getNumberFormatOptions(format) {
3415
3415
  var localeSettings = getLocaleSettings();
3416
3416
  var type = format[0].toUpperCase();
3417
3417
  var digits = (format.length > 1)
@@ -3433,7 +3433,8 @@ var i18n;
3433
3433
  default:
3434
3434
  return {
3435
3435
  style: 'decimal',
3436
- minimumFractionDigits: digits
3436
+ minimumFractionDigits: digits,
3437
+ maximumFractionDigits: digits
3437
3438
  };
3438
3439
  }
3439
3440
  }
@@ -4340,7 +4341,7 @@ var CellRendererType;
4340
4341
  })(CellRendererType || (CellRendererType = {}));
4341
4342
  var StringCellRendererDefault = function (value, column, cellValueElement, rowElement) {
4342
4343
  var text = value ? value.toString().replace(/\n/g, '\u21B5 ') : '';
4343
- cellValueElement.innerHTML = text;
4344
+ cellValueElement.innerText = text;
4344
4345
  cellValueElement.title = text;
4345
4346
  if (column.align == _easy_grid_columns__WEBPACK_IMPORTED_MODULE_1__[/* GridColumnAlign */ "b"].NONE) {
4346
4347
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-left");
@@ -4359,7 +4360,7 @@ var NumberCellRendererDefault = function (value, column, cellValueElement, rowEl
4359
4360
  strValue = value.toLocaleString();
4360
4361
  }
4361
4362
  }
4362
- cellValueElement.innerHTML = strValue;
4363
+ cellValueElement.innerText = strValue;
4363
4364
  cellValueElement.title = strValue;
4364
4365
  if (column.align == _easy_grid_columns__WEBPACK_IMPORTED_MODULE_1__[/* GridColumnAlign */ "b"].NONE) {
4365
4366
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -4391,7 +4392,7 @@ var DateTimeCellRendererDefault = function (value, column, cellValueElement, row
4391
4392
  }
4392
4393
  }
4393
4394
  }
4394
- cellValueElement.innerHTML = strValue;
4395
+ cellValueElement.innerText = strValue;
4395
4396
  cellValueElement.title = strValue;
4396
4397
  if (column.align == _easy_grid_columns__WEBPACK_IMPORTED_MODULE_1__[/* GridColumnAlign */ "b"].NONE) {
4397
4398
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -7543,12 +7544,6 @@ var EasyDataTable = /** @class */ (function () {
7543
7544
  this.onUpdate(this);
7544
7545
  }
7545
7546
  };
7546
- EasyDataTable.prototype.deleteCachedRow = function (rowIndex, count) {
7547
- if (count === void 0) { count = 1; }
7548
- if (rowIndex < 0 || rowIndex >= this.cachedRows.length)
7549
- return;
7550
- this.cachedRows.splice(rowIndex, count);
7551
- };
7552
7547
  return EasyDataTable;
7553
7548
  }());
7554
7549
 
@@ -11555,7 +11550,7 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
11555
11550
  };
11556
11551
  TextFilterWidget.prototype.inputKeydownHandler = function (ev) {
11557
11552
  if (ev.keyCode == 13) {
11558
- this.applyFilter();
11553
+ this.applyFilter(true);
11559
11554
  }
11560
11555
  };
11561
11556
  TextFilterWidget.prototype.inputKeyupHandler = function () {
@@ -11564,29 +11559,31 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
11564
11559
  clearTimeout(this.applyFilterTimeout);
11565
11560
  }
11566
11561
  this.applyFilterTimeout = setTimeout(function () {
11567
- _this.applyFilter();
11562
+ _this.applyFilter(true);
11568
11563
  }, this.options.instantTimeout);
11569
11564
  };
11570
11565
  TextFilterWidget.prototype.clearButtonClickHander = function () {
11571
11566
  this.filterInput.value = '';
11572
11567
  this.filterInput.focus();
11573
- this.applyFilter();
11568
+ this.applyFilter(true);
11574
11569
  };
11575
11570
  TextFilterWidget.prototype.searchButtonClickHandler = function () {
11576
- this.applyFilter();
11571
+ this.applyFilter(true);
11577
11572
  };
11578
- TextFilterWidget.prototype.applyFilter = function () {
11573
+ TextFilterWidget.prototype.applyFilter = function (checkChange) {
11579
11574
  var _this = this;
11580
11575
  if (this.applyFilterTimeout) {
11581
11576
  clearTimeout(this.applyFilterTimeout);
11582
11577
  }
11583
11578
  var filterValue = this.filter.getValue();
11584
- if (filterValue != this.filterInput.value) {
11579
+ if (!checkChange || filterValue != this.filterInput.value) {
11585
11580
  this.filter.apply(this.filterInput.value)
11586
11581
  .then(function (data) {
11587
11582
  _this.grid.setData(data);
11588
11583
  });
11584
+ return true;
11589
11585
  }
11586
+ return false;
11590
11587
  };
11591
11588
  TextFilterWidget.prototype.highlightCellRenderer = function (defaultRenderer, value, column, cellElement, rowElement) {
11592
11589
  if (public_api["utils"].isNumericType(column.type)
@@ -11601,7 +11598,12 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
11601
11598
  else {
11602
11599
  value = value.toLocaleString();
11603
11600
  }
11604
- value = this.highlightText(value.toString());
11601
+ var result = this.highlightText(value.toString());
11602
+ if (result instanceof HTMLElement) {
11603
+ cellElement.title = value;
11604
+ cellElement.appendChild(result);
11605
+ return;
11606
+ }
11605
11607
  }
11606
11608
  }
11607
11609
  defaultRenderer(value, column, cellElement, rowElement);
@@ -11610,8 +11612,6 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
11610
11612
  var normalizedContent = content.toLowerCase();
11611
11613
  var filterValue = this.filter.getValue().toString();
11612
11614
  if (filterValue && filterValue.length > 0 && content && content.length > 0) {
11613
- var insertValue1 = "<span style='background-color: yellow'>";
11614
- var insertValue2 = "</span>";
11615
11615
  var indexInMas = [];
11616
11616
  var words = filterValue.split('||').map(function (w) { return w.trim().toLowerCase(); });
11617
11617
  for (var i = 0; i < words.length; i++) {
@@ -11620,7 +11620,10 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
11620
11620
  if (!lowerWord.length)
11621
11621
  continue;
11622
11622
  if (lowerWord === normalizedContent) {
11623
- return insertValue1 + content + insertValue2;
11623
+ var highlightSpan = document.createElement('span');
11624
+ highlightSpan.style.backgroundColor = 'yellow';
11625
+ highlightSpan.innerText = content;
11626
+ return highlightSpan;
11624
11627
  }
11625
11628
  while (pos < content.length - 1) {
11626
11629
  var index = normalizedContent.indexOf(lowerWord, pos);
@@ -11660,24 +11663,24 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
11660
11663
  i++;
11661
11664
  }
11662
11665
  }
11663
- var result = '';
11666
+ var div = document.createElement('div');
11664
11667
  for (var i = 0; i < indexInMas.length; i++) {
11665
11668
  if (i === 0) {
11666
- result += content.substring(0, indexInMas[i].index);
11667
- }
11668
- result += insertValue1
11669
- + content.substring(indexInMas[i].index, indexInMas[i].index + indexInMas[i].length)
11670
- + insertValue2;
11671
- if (i < indexInMas.length - 1) {
11672
- result += content.substring(indexInMas[i].index
11673
- + indexInMas[i].length, indexInMas[i + 1].index);
11674
- }
11675
- else {
11676
- result += content.substring(indexInMas[i].index
11677
- + indexInMas[i].length);
11669
+ var text_1 = document.createTextNode(content.substring(0, indexInMas[i].index));
11670
+ div.appendChild(text_1);
11678
11671
  }
11672
+ var highlightSpan = document.createElement('span');
11673
+ highlightSpan.style.backgroundColor = 'yellow';
11674
+ highlightSpan.innerText = content.substring(indexInMas[i].index, indexInMas[i].index + indexInMas[i].length);
11675
+ div.appendChild(highlightSpan);
11676
+ var text = (i < indexInMas.length - 1)
11677
+ ? document.createTextNode(content.substring(indexInMas[i].index
11678
+ + indexInMas[i].length, indexInMas[i + 1].index))
11679
+ : document.createTextNode(content.substring(indexInMas[i].index
11680
+ + indexInMas[i].length));
11681
+ div.appendChild(text);
11679
11682
  }
11680
- content = result;
11683
+ return div;
11681
11684
  }
11682
11685
  }
11683
11686
  return content;
@@ -12523,7 +12526,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
12523
12526
  }).toDOM();
12524
12527
  _this.slot.insertBefore(filterBarDiv, gridSlot);
12525
12528
  var dataFilter = _this.context.createFilter();
12526
- new text_filter_widget_TextFilterWidget(filterWidgetSlot_1, _this.grid, dataFilter);
12529
+ _this.filterWidget = new text_filter_widget_TextFilterWidget(filterWidgetSlot_1, _this.grid, dataFilter);
12527
12530
  }
12528
12531
  });
12529
12532
  };
@@ -12633,8 +12636,6 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
12633
12636
  .map(function (key) { return key + ":" + keys_1[key]; }).join(';')))
12634
12637
  .then(function (result) {
12635
12638
  if (result) {
12636
- _this.grid.getData().deleteCachedRow(rowIndex);
12637
- _this.grid.refresh();
12638
12639
  _this.context.deleteRecord(keys_1)
12639
12640
  .then(function () {
12640
12641
  return _this.refreshData();
@@ -12659,7 +12660,13 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
12659
12660
  var _this = this;
12660
12661
  return this.context.fetchDataset()
12661
12662
  .then(function () {
12662
- _this.grid.refresh();
12663
+ var processed = false;
12664
+ if (_this.filterWidget) {
12665
+ processed = _this.filterWidget.applyFilter(false);
12666
+ }
12667
+ if (!processed) {
12668
+ _this.grid.refresh();
12669
+ }
12663
12670
  });
12664
12671
  };
12665
12672
  return EntityDataView;