@easydata/crud 1.4.1-rc01 → 1.4.2

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.
@@ -286,6 +286,7 @@ var meta_entity_MetaEntityAttr = /** @class */ (function () {
286
286
  this.lookupEntity = dto.lent;
287
287
  this.dataAttr = dto.dattr;
288
288
  this.lookupDataAttr = dto.ldattr;
289
+ this.defaultValue = dto.defVal;
289
290
  this.isNullable = utils["a" /* utils */].getIfDefined(dto.nul, this.isNullable);
290
291
  this.isEditable = utils["a" /* utils */].getIfDefined(dto.ied, this.isEditable);
291
292
  this.showOnView = utils["a" /* utils */].getIfDefined(dto.ivis || dto.sov, this.showOnView);
@@ -1563,6 +1564,10 @@ var DomSelectElementBuilder = /** @class */ (function (_super) {
1563
1564
  this.element.appendChild(option);
1564
1565
  return this;
1565
1566
  };
1567
+ DomSelectElementBuilder.prototype.value = function (value) {
1568
+ this.element.value = value;
1569
+ return this;
1570
+ };
1566
1571
  return DomSelectElementBuilder;
1567
1572
  }(DomElementBuilder));
1568
1573
 
@@ -3715,7 +3720,7 @@ var getEditDateTimeFormat = function (dtype) {
3715
3720
  };
3716
3721
  var setLocation = function (path) {
3717
3722
  var state = window.history.state;
3718
- history.replaceState(state, document.title, path);
3723
+ history.pushState(state, document.title, path);
3719
3724
  window.dispatchEvent(new Event('ed_set_location'));
3720
3725
  };
3721
3726
  //# sourceMappingURL=utils.js.map
@@ -5569,7 +5574,7 @@ var TextDataFilter = /** @class */ (function () {
5569
5574
  }
5570
5575
  var words = _this.filterValue.split('||').map(function (w) { return w.trim().toLowerCase(); });
5571
5576
  var suitableColumns = _this.sourceTable.columns.getItems()
5572
- .filter(function (col) { return _easydata_core__WEBPACK_IMPORTED_MODULE_0__["utils"].isIntType(col.type)
5577
+ .filter(function (col) { return _easydata_core__WEBPACK_IMPORTED_MODULE_0__["utils"].isNumericType(col.type)
5573
5578
  || _easydata_core__WEBPACK_IMPORTED_MODULE_0__["utils"].getStringDataTypes().indexOf(col.type) >= 0; });
5574
5579
  var hasEnterance = function (row) {
5575
5580
  for (var _i = 0, suitableColumns_1 = suitableColumns; _i < suitableColumns_1.length; _i++) {
@@ -11576,7 +11581,7 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
11576
11581
  }
11577
11582
  };
11578
11583
  TextFilterWidget.prototype.highlightCellRenderer = function (defaultRenderer, value, column, cellElement, rowElement) {
11579
- if (public_api["utils"].isIntType(column.type)
11584
+ if (public_api["utils"].isNumericType(column.type)
11580
11585
  || public_api["utils"].getStringDataTypes().indexOf(column.type) >= 0) {
11581
11586
  if (value) {
11582
11587
  if (column.dataColumn && column.dataColumn.displayFormat
@@ -11706,7 +11711,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
11706
11711
  var lookupEntity = this.context.getMetaData().getRootEntity()
11707
11712
  .subEntities.filter(function (ent) { return ent.id == attr.lookupEntity; })[0];
11708
11713
  var dataAttr = this.context.getMetaData().getAttributeById(attr.dataAttr);
11709
- readOnly = readOnly && dataAttr.isEditable;
11714
+ if (!dataAttr)
11715
+ return;
11716
+ readOnly = readOnly || !dataAttr.isEditable;
11710
11717
  value = this.params.values
11711
11718
  ? this.params.values.getValue(dataAttr.id)
11712
11719
  : undefined;
@@ -11952,6 +11959,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
11952
11959
  });
11953
11960
  }
11954
11961
  }
11962
+ b.value(value);
11955
11963
  }); });
11956
11964
  };
11957
11965
  EntityEditFormBuilder.prototype.setupFileField = function (parent, attr, readOnly, accept) {
@@ -12001,9 +12009,11 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
12001
12009
  });
12002
12010
  };
12003
12011
  EntityEditFormBuilder.prototype.addFormField = function (parent, attr) {
12004
- var value = this.params.values && attr.kind !== public_api["EntityAttrKind"].Lookup
12012
+ var value = (this.params.values && attr.kind !== public_api["EntityAttrKind"].Lookup)
12005
12013
  ? this.params.values.getValue(attr.id)
12006
- : undefined;
12014
+ : !this.params.isEditForm
12015
+ ? attr.defaultValue
12016
+ : undefined;
12007
12017
  var editor = this.resolveEditor(attr);
12008
12018
  var readOnly = this.params.isEditForm && (attr.isPrimaryKey || !attr.isEditable);
12009
12019
  var required = !attr.isNullable;
@@ -12097,15 +12107,10 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
12097
12107
  this.form['setHtmlInt'](formHtml);
12098
12108
  for (var _i = 0, _a = this.context.getActiveEntity().attributes; _i < _a.length; _i++) {
12099
12109
  var attr = _a[_i];
12100
- if (!attr.isPrimaryKey) {
12101
- if (this.params.isEditForm) {
12102
- if (!attr.showOnEdit)
12103
- continue;
12104
- }
12105
- else {
12106
- if (!attr.showOnCreate)
12107
- continue;
12108
- }
12110
+ if (!this.params.isEditForm && !attr.showOnCreate)
12111
+ continue;
12112
+ if (!attr.isPrimaryKey && this.params.isEditForm && !attr.showOnEdit) {
12113
+ continue;
12109
12114
  }
12110
12115
  this.addFormField(fb.toDOM(), attr);
12111
12116
  }
@@ -12714,6 +12719,10 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
12714
12719
  this.onSetLocation = function () {
12715
12720
  _this.setActiveView();
12716
12721
  };
12722
+ this.attach = function () {
12723
+ window.addEventListener('ed_set_location', _this.onSetLocation);
12724
+ window.addEventListener('popstate', _this.onSetLocation);
12725
+ };
12717
12726
  this.options = public_api["utils"].assign(this.options, options || {});
12718
12727
  if (this.options.rootEntity) {
12719
12728
  this.options.showBackToEntities = false;
@@ -12779,7 +12788,7 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
12779
12788
  };
12780
12789
  EasyDataViewDispatcher.prototype.run = function () {
12781
12790
  var _this = this;
12782
- window.addEventListener('ed_set_location', this.onSetLocation);
12791
+ this.attach();
12783
12792
  return this.context.loadMetaData()
12784
12793
  .then(function () {
12785
12794
  _this.setActiveView();
@@ -12803,6 +12812,7 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
12803
12812
  };
12804
12813
  EasyDataViewDispatcher.prototype.detach = function () {
12805
12814
  window.removeEventListener('ed_set_location', this.onSetLocation);
12815
+ window.removeEventListener('popstate', this.onSetLocation);
12806
12816
  };
12807
12817
  return EasyDataViewDispatcher;
12808
12818
  }());