@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.
@@ -1646,6 +1646,7 @@ var meta_entity_MetaEntityAttr = /** @class */ (function () {
1646
1646
  this.lookupEntity = dto.lent;
1647
1647
  this.dataAttr = dto.dattr;
1648
1648
  this.lookupDataAttr = dto.ldattr;
1649
+ this.defaultValue = dto.defVal;
1649
1650
  this.isNullable = utils_utils.getIfDefined(dto.nul, this.isNullable);
1650
1651
  this.isEditable = utils_utils.getIfDefined(dto.ied, this.isEditable);
1651
1652
  this.showOnView = utils_utils.getIfDefined(dto.ivis || dto.sov, this.showOnView);
@@ -3116,7 +3117,7 @@ var text_data_filter_TextDataFilter = /** @class */ (function () {
3116
3117
  }
3117
3118
  var words = _this.filterValue.split('||').map(function (w) { return w.trim().toLowerCase(); });
3118
3119
  var suitableColumns = _this.sourceTable.columns.getItems()
3119
- .filter(function (col) { return utils_utils.isIntType(col.type)
3120
+ .filter(function (col) { return utils_utils.isNumericType(col.type)
3120
3121
  || utils_utils.getStringDataTypes().indexOf(col.type) >= 0; });
3121
3122
  var hasEnterance = function (row) {
3122
3123
  for (var _i = 0, suitableColumns_1 = suitableColumns; _i < suitableColumns_1.length; _i++) {
@@ -3748,6 +3749,10 @@ var DomSelectElementBuilder = /** @class */ (function (_super) {
3748
3749
  this.element.appendChild(option);
3749
3750
  return this;
3750
3751
  };
3752
+ DomSelectElementBuilder.prototype.value = function (value) {
3753
+ this.element.value = value;
3754
+ return this;
3755
+ };
3751
3756
  return DomSelectElementBuilder;
3752
3757
  }(DomElementBuilder));
3753
3758
 
@@ -6845,7 +6850,7 @@ var getEditDateTimeFormat = function (dtype) {
6845
6850
  };
6846
6851
  var setLocation = function (path) {
6847
6852
  var state = window.history.state;
6848
- history.replaceState(state, document.title, path);
6853
+ history.pushState(state, document.title, path);
6849
6854
  window.dispatchEvent(new Event('ed_set_location'));
6850
6855
  };
6851
6856
 
@@ -7147,7 +7152,7 @@ var text_filter_widget_TextFilterWidget = /** @class */ (function () {
7147
7152
  }
7148
7153
  };
7149
7154
  TextFilterWidget.prototype.highlightCellRenderer = function (defaultRenderer, value, column, cellElement, rowElement) {
7150
- if (utils_utils.isIntType(column.type)
7155
+ if (utils_utils.isNumericType(column.type)
7151
7156
  || utils_utils.getStringDataTypes().indexOf(column.type) >= 0) {
7152
7157
  if (value) {
7153
7158
  if (column.dataColumn && column.dataColumn.displayFormat
@@ -7277,7 +7282,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7277
7282
  var lookupEntity = this.context.getMetaData().getRootEntity()
7278
7283
  .subEntities.filter(function (ent) { return ent.id == attr.lookupEntity; })[0];
7279
7284
  var dataAttr = this.context.getMetaData().getAttributeById(attr.dataAttr);
7280
- readOnly = readOnly && dataAttr.isEditable;
7285
+ if (!dataAttr)
7286
+ return;
7287
+ readOnly = readOnly || !dataAttr.isEditable;
7281
7288
  value = this.params.values
7282
7289
  ? this.params.values.getValue(dataAttr.id)
7283
7290
  : undefined;
@@ -7523,6 +7530,7 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7523
7530
  });
7524
7531
  }
7525
7532
  }
7533
+ b.value(value);
7526
7534
  }); });
7527
7535
  };
7528
7536
  EntityEditFormBuilder.prototype.setupFileField = function (parent, attr, readOnly, accept) {
@@ -7572,9 +7580,11 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7572
7580
  });
7573
7581
  };
7574
7582
  EntityEditFormBuilder.prototype.addFormField = function (parent, attr) {
7575
- var value = this.params.values && attr.kind !== EntityAttrKind.Lookup
7583
+ var value = (this.params.values && attr.kind !== EntityAttrKind.Lookup)
7576
7584
  ? this.params.values.getValue(attr.id)
7577
- : undefined;
7585
+ : !this.params.isEditForm
7586
+ ? attr.defaultValue
7587
+ : undefined;
7578
7588
  var editor = this.resolveEditor(attr);
7579
7589
  var readOnly = this.params.isEditForm && (attr.isPrimaryKey || !attr.isEditable);
7580
7590
  var required = !attr.isNullable;
@@ -7668,15 +7678,10 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
7668
7678
  this.form['setHtmlInt'](formHtml);
7669
7679
  for (var _i = 0, _a = this.context.getActiveEntity().attributes; _i < _a.length; _i++) {
7670
7680
  var attr = _a[_i];
7671
- if (!attr.isPrimaryKey) {
7672
- if (this.params.isEditForm) {
7673
- if (!attr.showOnEdit)
7674
- continue;
7675
- }
7676
- else {
7677
- if (!attr.showOnCreate)
7678
- continue;
7679
- }
7681
+ if (!this.params.isEditForm && !attr.showOnCreate)
7682
+ continue;
7683
+ if (!attr.isPrimaryKey && this.params.isEditForm && !attr.showOnEdit) {
7684
+ continue;
7680
7685
  }
7681
7686
  this.addFormField(fb.toDOM(), attr);
7682
7687
  }
@@ -8282,6 +8287,10 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
8282
8287
  this.onSetLocation = function () {
8283
8288
  _this.setActiveView();
8284
8289
  };
8290
+ this.attach = function () {
8291
+ window.addEventListener('ed_set_location', _this.onSetLocation);
8292
+ window.addEventListener('popstate', _this.onSetLocation);
8293
+ };
8285
8294
  this.options = utils_utils.assign(this.options, options || {});
8286
8295
  if (this.options.rootEntity) {
8287
8296
  this.options.showBackToEntities = false;
@@ -8347,7 +8356,7 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
8347
8356
  };
8348
8357
  EasyDataViewDispatcher.prototype.run = function () {
8349
8358
  var _this = this;
8350
- window.addEventListener('ed_set_location', this.onSetLocation);
8359
+ this.attach();
8351
8360
  return this.context.loadMetaData()
8352
8361
  .then(function () {
8353
8362
  _this.setActiveView();
@@ -8371,6 +8380,7 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
8371
8380
  };
8372
8381
  EasyDataViewDispatcher.prototype.detach = function () {
8373
8382
  window.removeEventListener('ed_set_location', this.onSetLocation);
8383
+ window.removeEventListener('popstate', this.onSetLocation);
8374
8384
  };
8375
8385
  return EasyDataViewDispatcher;
8376
8386
  }());