@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.
@@ -731,7 +731,7 @@ var i18n_i18n;
731
731
  }
732
732
  else if (['D', 'F', 'C'].indexOf(type) >= 0) {
733
733
  var locale = getCurrentLocale();
734
- return number.toLocaleString(locale, getNumberFromatOptions(format));
734
+ return number.toLocaleString(locale, getNumberFormatOptions(format));
735
735
  }
736
736
  else {
737
737
  return convertWithMask(Math.trunc(number), format);
@@ -807,7 +807,7 @@ var i18n_i18n;
807
807
  }
808
808
  return result.split('').reverse().join('');
809
809
  }
810
- function getNumberFromatOptions(format) {
810
+ function getNumberFormatOptions(format) {
811
811
  var localeSettings = getLocaleSettings();
812
812
  var type = format[0].toUpperCase();
813
813
  var digits = (format.length > 1)
@@ -829,7 +829,8 @@ var i18n_i18n;
829
829
  default:
830
830
  return {
831
831
  style: 'decimal',
832
- minimumFractionDigits: digits
832
+ minimumFractionDigits: digits,
833
+ maximumFractionDigits: digits
833
834
  };
834
835
  }
835
836
  }
@@ -2818,12 +2819,6 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2818
2819
  this.onUpdate(this);
2819
2820
  }
2820
2821
  };
2821
- EasyDataTable.prototype.deleteCachedRow = function (rowIndex, count) {
2822
- if (count === void 0) { count = 1; }
2823
- if (rowIndex < 0 || rowIndex >= this.cachedRows.length)
2824
- return;
2825
- this.cachedRows.splice(rowIndex, count);
2826
- };
2827
2822
  return EasyDataTable;
2828
2823
  }());
2829
2824
 
@@ -4187,7 +4182,7 @@ var CellRendererType;
4187
4182
  })(CellRendererType || (CellRendererType = {}));
4188
4183
  var StringCellRendererDefault = function (value, column, cellValueElement, rowElement) {
4189
4184
  var text = value ? value.toString().replace(/\n/g, '\u21B5 ') : '';
4190
- cellValueElement.innerHTML = text;
4185
+ cellValueElement.innerText = text;
4191
4186
  cellValueElement.title = text;
4192
4187
  if (column.align == GridColumnAlign.NONE) {
4193
4188
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-left");
@@ -4206,7 +4201,7 @@ var NumberCellRendererDefault = function (value, column, cellValueElement, rowEl
4206
4201
  strValue = value.toLocaleString();
4207
4202
  }
4208
4203
  }
4209
- cellValueElement.innerHTML = strValue;
4204
+ cellValueElement.innerText = strValue;
4210
4205
  cellValueElement.title = strValue;
4211
4206
  if (column.align == GridColumnAlign.NONE) {
4212
4207
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -4238,7 +4233,7 @@ var DateTimeCellRendererDefault = function (value, column, cellValueElement, row
4238
4233
  }
4239
4234
  }
4240
4235
  }
4241
- cellValueElement.innerHTML = strValue;
4236
+ cellValueElement.innerText = strValue;
4242
4237
  cellValueElement.title = strValue;
4243
4238
  if (column.align == GridColumnAlign.NONE) {
4244
4239
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -7127,7 +7122,7 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
7127
7122
  };
7128
7123
  TextFilterWidget.prototype.inputKeydownHandler = function (ev) {
7129
7124
  if (ev.keyCode == 13) {
7130
- this.applyFilter();
7125
+ this.applyFilter(true);
7131
7126
  }
7132
7127
  };
7133
7128
  TextFilterWidget.prototype.inputKeyupHandler = function () {
@@ -7136,29 +7131,31 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
7136
7131
  clearTimeout(this.applyFilterTimeout);
7137
7132
  }
7138
7133
  this.applyFilterTimeout = setTimeout(function () {
7139
- _this.applyFilter();
7134
+ _this.applyFilter(true);
7140
7135
  }, this.options.instantTimeout);
7141
7136
  };
7142
7137
  TextFilterWidget.prototype.clearButtonClickHander = function () {
7143
7138
  this.filterInput.value = '';
7144
7139
  this.filterInput.focus();
7145
- this.applyFilter();
7140
+ this.applyFilter(true);
7146
7141
  };
7147
7142
  TextFilterWidget.prototype.searchButtonClickHandler = function () {
7148
- this.applyFilter();
7143
+ this.applyFilter(true);
7149
7144
  };
7150
- TextFilterWidget.prototype.applyFilter = function () {
7145
+ TextFilterWidget.prototype.applyFilter = function (checkChange) {
7151
7146
  var _this = this;
7152
7147
  if (this.applyFilterTimeout) {
7153
7148
  clearTimeout(this.applyFilterTimeout);
7154
7149
  }
7155
7150
  var filterValue = this.filter.getValue();
7156
- if (filterValue != this.filterInput.value) {
7151
+ if (!checkChange || filterValue != this.filterInput.value) {
7157
7152
  this.filter.apply(this.filterInput.value)
7158
7153
  .then(function (data) {
7159
7154
  _this.grid.setData(data);
7160
7155
  });
7156
+ return true;
7161
7157
  }
7158
+ return false;
7162
7159
  };
7163
7160
  TextFilterWidget.prototype.highlightCellRenderer = function (defaultRenderer, value, column, cellElement, rowElement) {
7164
7161
  if (utils_utils.isNumericType(column.type)
@@ -7173,7 +7170,12 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
7173
7170
  else {
7174
7171
  value = value.toLocaleString();
7175
7172
  }
7176
- value = this.highlightText(value.toString());
7173
+ var result = this.highlightText(value.toString());
7174
+ if (result instanceof HTMLElement) {
7175
+ cellElement.title = value;
7176
+ cellElement.appendChild(result);
7177
+ return;
7178
+ }
7177
7179
  }
7178
7180
  }
7179
7181
  defaultRenderer(value, column, cellElement, rowElement);
@@ -7182,8 +7184,6 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
7182
7184
  var normalizedContent = content.toLowerCase();
7183
7185
  var filterValue = this.filter.getValue().toString();
7184
7186
  if (filterValue && filterValue.length > 0 && content && content.length > 0) {
7185
- var insertValue1 = "<span style='background-color: yellow'>";
7186
- var insertValue2 = "</span>";
7187
7187
  var indexInMas = [];
7188
7188
  var words = filterValue.split('||').map(function (w) { return w.trim().toLowerCase(); });
7189
7189
  for (var i = 0; i < words.length; i++) {
@@ -7192,7 +7192,10 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
7192
7192
  if (!lowerWord.length)
7193
7193
  continue;
7194
7194
  if (lowerWord === normalizedContent) {
7195
- return insertValue1 + content + insertValue2;
7195
+ var highlightSpan = document.createElement('span');
7196
+ highlightSpan.style.backgroundColor = 'yellow';
7197
+ highlightSpan.innerText = content;
7198
+ return highlightSpan;
7196
7199
  }
7197
7200
  while (pos < content.length - 1) {
7198
7201
  var index = normalizedContent.indexOf(lowerWord, pos);
@@ -7232,24 +7235,24 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
7232
7235
  i++;
7233
7236
  }
7234
7237
  }
7235
- var result = '';
7238
+ var div = document.createElement('div');
7236
7239
  for (var i = 0; i < indexInMas.length; i++) {
7237
7240
  if (i === 0) {
7238
- result += content.substring(0, indexInMas[i].index);
7239
- }
7240
- result += insertValue1
7241
- + content.substring(indexInMas[i].index, indexInMas[i].index + indexInMas[i].length)
7242
- + insertValue2;
7243
- if (i < indexInMas.length - 1) {
7244
- result += content.substring(indexInMas[i].index
7245
- + indexInMas[i].length, indexInMas[i + 1].index);
7246
- }
7247
- else {
7248
- result += content.substring(indexInMas[i].index
7249
- + indexInMas[i].length);
7241
+ var text_1 = document.createTextNode(content.substring(0, indexInMas[i].index));
7242
+ div.appendChild(text_1);
7250
7243
  }
7244
+ var highlightSpan = document.createElement('span');
7245
+ highlightSpan.style.backgroundColor = 'yellow';
7246
+ highlightSpan.innerText = content.substring(indexInMas[i].index, indexInMas[i].index + indexInMas[i].length);
7247
+ div.appendChild(highlightSpan);
7248
+ var text = (i < indexInMas.length - 1)
7249
+ ? document.createTextNode(content.substring(indexInMas[i].index
7250
+ + indexInMas[i].length, indexInMas[i + 1].index))
7251
+ : document.createTextNode(content.substring(indexInMas[i].index
7252
+ + indexInMas[i].length));
7253
+ div.appendChild(text);
7251
7254
  }
7252
- content = result;
7255
+ return div;
7253
7256
  }
7254
7257
  }
7255
7258
  return content;
@@ -8092,7 +8095,7 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
8092
8095
  }).toDOM();
8093
8096
  _this.slot.insertBefore(filterBarDiv, gridSlot);
8094
8097
  var dataFilter = _this.context.createFilter();
8095
- new text_filter_widget_TextFilterWidget(filterWidgetSlot_1, _this.grid, dataFilter);
8098
+ _this.filterWidget = new text_filter_widget_TextFilterWidget(filterWidgetSlot_1, _this.grid, dataFilter);
8096
8099
  }
8097
8100
  });
8098
8101
  };
@@ -8202,8 +8205,6 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
8202
8205
  .map(function (key) { return key + ":" + keys_1[key]; }).join(';')))
8203
8206
  .then(function (result) {
8204
8207
  if (result) {
8205
- _this.grid.getData().deleteCachedRow(rowIndex);
8206
- _this.grid.refresh();
8207
8208
  _this.context.deleteRecord(keys_1)
8208
8209
  .then(function () {
8209
8210
  return _this.refreshData();
@@ -8228,7 +8229,13 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
8228
8229
  var _this = this;
8229
8230
  return this.context.fetchDataset()
8230
8231
  .then(function () {
8231
- _this.grid.refresh();
8232
+ var processed = false;
8233
+ if (_this.filterWidget) {
8234
+ processed = _this.filterWidget.applyFilter(false);
8235
+ }
8236
+ if (!processed) {
8237
+ _this.grid.refresh();
8238
+ }
8232
8239
  });
8233
8240
  };
8234
8241
  return EntityDataView;