@trudb/tru-common-lib 0.0.316 → 0.0.317

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.
@@ -86,11 +86,13 @@ class TruControlComponentConfigBase {
86
86
  class TruEditControlBase {
87
87
  }
88
88
  TruEditControlBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruEditControlBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
89
- TruEditControlBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.1", type: TruEditControlBase, inputs: { config: "config" }, ngImport: i0 });
89
+ TruEditControlBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.1", type: TruEditControlBase, inputs: { config: "config", entity: "entity" }, ngImport: i0 });
90
90
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruEditControlBase, decorators: [{
91
91
  type: Directive
92
92
  }], propDecorators: { config: [{
93
93
  type: Input
94
+ }], entity: [{
95
+ type: Input
94
96
  }] } });
95
97
 
96
98
  class TruEditControlConfigBase {
@@ -1486,24 +1488,28 @@ class TruDataContext {
1486
1488
  });
1487
1489
  return errors;
1488
1490
  });
1489
- return [].concat.apply([], errorsPerEntity);
1491
+ return of(errorsPerEntity);
1490
1492
  };
1491
1493
  this.formatValidationErrors = (entities = null) => {
1492
- var errors = this.getValidationErrors(entities);
1493
- return errors.map((e) => {
1494
- if (e.propertyName) {
1495
- return e.entity.entityType.defaultResourceName + '.' + e.propertyName + ': ' + e.errorMessage;
1496
- }
1497
- var mergeData = JSON.parse(e.entity.Merge_Data);
1498
- if (mergeData &&
1499
- mergeData.constructor === Object &&
1500
- Object.entries(mergeData).length > 0 &&
1501
- mergeData[e.property.name]) {
1502
- return mergeData[e.property.name].modifiedBy + ' changed ' + e.property.name + ' to ' + mergeData[e.property.name].value + '. Accept or Decline the change. ';
1503
- }
1504
- var propertyName = e.property.name ? e.property.name : '[Unknown Property]';
1505
- return e.entity.entityType.defaultResourceName + '.' + propertyName + ': has invalid data.';
1494
+ let errors = this.getValidationErrors(entities);
1495
+ let formattedErrors = new Array();
1496
+ errors.subscribe(errorsArray => {
1497
+ formattedErrors.push(errorsArray.map((e) => {
1498
+ if (e.propertyName) {
1499
+ return e.entity.entityType.defaultResourceName + '.' + e.propertyName + ': ' + e.errorMessage;
1500
+ }
1501
+ var mergeData = JSON.parse(e.entity.Merge_Data);
1502
+ if (mergeData &&
1503
+ mergeData.constructor === Object &&
1504
+ Object.entries(mergeData).length > 0 &&
1505
+ mergeData[e.property.name]) {
1506
+ return mergeData[e.property.name].modifiedBy + ' changed ' + e.property.name + ' to ' + mergeData[e.property.name].value + '. Accept or Decline the change. ';
1507
+ }
1508
+ var propertyName = e.property.name ? e.property.name : '[Unknown Property]';
1509
+ return e.entity.entityType.defaultResourceName + '.' + propertyName + ': has invalid data.';
1510
+ }));
1506
1511
  });
1512
+ return formattedErrors;
1507
1513
  };
1508
1514
  this.findCachedCascadeDeleteDescendants = (entity) => {
1509
1515
  let descendants = [];
@@ -1560,7 +1566,7 @@ class TruDataContext {
1560
1566
  }
1561
1567
  var validationErrorMessages = this.formatValidationErrors(entities);
1562
1568
  if (validationErrorMessages.length > 0) {
1563
- this.uiNotification.error(this.appEnvironment.msgInvalidData, validationErrorMessages);
1569
+ //this.uiNotification.error(this.appEnvironment.msgInvalidData, validationErrorMessages);
1564
1570
  resolve();
1565
1571
  return;
1566
1572
  }
@@ -4823,6 +4829,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
4823
4829
  args: [TRU_AUTH_STRATEGY]
4824
4830
  }] }]; } });
4825
4831
 
4832
+ class TruValidationDialog {
4833
+ constructor(host) {
4834
+ this.host = host;
4835
+ this.acceptAll = () => {
4836
+ let entity = this.host.entity;
4837
+ let originalValues = entity.entityAspect.originalValues;
4838
+ Object.keys(this.mergeData).forEach((key) => {
4839
+ entity[key] = this.mergeData[key].value;
4840
+ if (originalValues.hasOwnProperty(key))
4841
+ delete originalValues[key];
4842
+ });
4843
+ if (Object.keys(originalValues).length === 0 && originalValues.constructor === Object)
4844
+ entity.entityAspect.setUnchanged();
4845
+ let propertiesToValidate = Object.getOwnPropertyNames(this.mergeData);
4846
+ entity.Merge_Data = JSON.stringify({});
4847
+ propertiesToValidate.forEach(function (key) {
4848
+ entity.entityAspect.validateProperty(key);
4849
+ });
4850
+ };
4851
+ this.accept = () => {
4852
+ let entity = this.host.entity;
4853
+ let originalValues = entity.entityAspect.originalValues;
4854
+ let propertyName = this.host.config.propertyName;
4855
+ this.mergeData = JSON.parse(entity.Merge_Data);
4856
+ entity[propertyName] = this.mergeData[propertyName].value;
4857
+ delete this.mergeData[propertyName];
4858
+ if (originalValues.hasOwnProperty(propertyName) && (Object.keys(originalValues).length === 0 && originalValues.constructor === Object))
4859
+ delete originalValues[propertyName];
4860
+ if (!Object.keys(this.mergeData).length)
4861
+ entity.entityAspect.setUnchanged();
4862
+ entity.Merge_Data = JSON.stringify(this.mergeData);
4863
+ entity.entityAspect.validateProperty(propertyName);
4864
+ };
4865
+ this.decline = () => {
4866
+ let entity = this.host.entity;
4867
+ let propertyName = this.host.config.propertyName;
4868
+ this.mergeData = JSON.parse(entity.Merge_Data);
4869
+ delete this.mergeData[propertyName];
4870
+ entity.Merge_Data = JSON.stringify(this.mergeData);
4871
+ entity.entityAspect.validateProperty(propertyName);
4872
+ };
4873
+ }
4874
+ ngOnInit() {
4875
+ }
4876
+ }
4877
+ TruValidationDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruValidationDialog, deps: [{ token: TruEditControlBase }], target: i0.ɵɵFactoryTarget.Component });
4878
+ TruValidationDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: TruValidationDialog, selector: "tru-validation-dialog", ngImport: i0, template: "\r\n", styles: [""] });
4879
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruValidationDialog, decorators: [{
4880
+ type: Component,
4881
+ args: [{ selector: 'tru-validation-dialog', template: "\r\n" }]
4882
+ }], ctorParameters: function () { return [{ type: TruEditControlBase }]; } });
4883
+
4884
+ class TruValidationDialogModule {
4885
+ }
4886
+ TruValidationDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruValidationDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4887
+ TruValidationDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.1", ngImport: i0, type: TruValidationDialogModule, declarations: [TruValidationDialog], imports: [CommonModule, FormsModule], exports: [TruValidationDialog] });
4888
+ TruValidationDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruValidationDialogModule, imports: [CommonModule, FormsModule] });
4889
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruValidationDialogModule, decorators: [{
4890
+ type: NgModule,
4891
+ args: [{
4892
+ declarations: [TruValidationDialog],
4893
+ imports: [CommonModule, FormsModule],
4894
+ exports: [TruValidationDialog]
4895
+ }]
4896
+ }] });
4897
+
4826
4898
  class TruSearchPanelPositionManager {
4827
4899
  constructor(el, renderer) {
4828
4900
  this.el = el;
@@ -5370,5 +5442,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
5370
5442
  * Generated bundle index. Do not edit.
5371
5443
  */
5372
5444
 
5373
- export { DetailViewModule, TruAppEnvironment, TruAuthInterceptor, TruBreezeContext, TruBreezeContextFactory, TruBreezeMetadataProvider, TruChoice, TruColumn, TruColumnModule, TruCommonModule, TruComponentConfigBase, TruComponentLookup, TruConfirmDialog, TruConfirmDialogConfig, TruConfirmDialogModule, TruContextFilter, TruContextFilterChoice, TruContextFilters, TruControlComponentConfigBase, TruDataContext, TruDataGrid, TruDataGridModule, TruDataGridTypes, TruDesktop, TruDesktopManager, TruDesktopModule, TruDetailViewBase, TruEditControlBase, TruEditControlConfigBase, TruEntityAccessor, TruEntityBase, TruExportDialog, TruExportDialogConfig, TruExportDialogModule, TruForm, TruFormModule, TruFormulaEval, TruGroupBox, TruGroupBoxModule, TruLogin, TruLoginModule, TruPredicate, TruPredicateMap, TruPropertyConfigBase, TruPropertyConfigCloudFile, TruPropertyConfigDate, TruPropertyConfigDecimal, TruPropertyConfigFile, TruPropertyConfigForeignKey, TruPropertyConfigInteger, TruPropertyConfigPassword, TruPropertyConfigPercentage, TruPropertyConfigScientific, TruPropertyConfigText, TruPropertyConfigTextChoices, TruPropertyConfigUsaAddress, TruPropertyConfigZipCode, TruQueryPredicateManager, TruRow, TruRowModule, TruSearchConfigBase, TruSearchControlBase, TruSearchControlConfigBase, TruSearchControlRangeBase, TruSearchIconModule, TruSearchPanelPositionManager, TruSearchPanelPositionManagerModule, TruSearchViewBase, TruSearchViewBaseModule, TruSearchViewControlEventHandler, TruSearchViewEventHandler, TruSort, TruTableConfigBase, TruTableRegistry, TruTextManager, TruToolbar, TruToolbarButton, TruToolbarButtonModule, TruToolbarContextFilter, TruToolbarContextFilterModule, TruToolbarDropdown, TruToolbarDropdownModule, TruToolbarMenu, TruToolbarMenuModule, TruToolbarModule, TruToolbarSeparator, TruToolbarSeparatorModule, TruToolbarText, TruToolbarTextModule, TruUiNotification, TruUser, TruUtil, TruWindowActionEventHandler, TruWindowAddViewEventArgs, TruWindowEventArgs, TruWindowEventHandler };
5445
+ export { DetailViewModule, TruAppEnvironment, TruAuthInterceptor, TruBreezeContext, TruBreezeContextFactory, TruBreezeMetadataProvider, TruChoice, TruColumn, TruColumnModule, TruCommonModule, TruComponentConfigBase, TruComponentLookup, TruConfirmDialog, TruConfirmDialogConfig, TruConfirmDialogModule, TruContextFilter, TruContextFilterChoice, TruContextFilters, TruControlComponentConfigBase, TruDataContext, TruDataGrid, TruDataGridModule, TruDataGridTypes, TruDesktop, TruDesktopManager, TruDesktopModule, TruDetailViewBase, TruEditControlBase, TruEditControlConfigBase, TruEntityAccessor, TruEntityBase, TruExportDialog, TruExportDialogConfig, TruExportDialogModule, TruForm, TruFormModule, TruFormulaEval, TruGroupBox, TruGroupBoxModule, TruLogin, TruLoginModule, TruPredicate, TruPredicateMap, TruPropertyConfigBase, TruPropertyConfigCloudFile, TruPropertyConfigDate, TruPropertyConfigDecimal, TruPropertyConfigFile, TruPropertyConfigForeignKey, TruPropertyConfigInteger, TruPropertyConfigPassword, TruPropertyConfigPercentage, TruPropertyConfigScientific, TruPropertyConfigText, TruPropertyConfigTextChoices, TruPropertyConfigUsaAddress, TruPropertyConfigZipCode, TruQueryPredicateManager, TruRow, TruRowModule, TruSearchConfigBase, TruSearchControlBase, TruSearchControlConfigBase, TruSearchControlRangeBase, TruSearchIconModule, TruSearchPanelPositionManager, TruSearchPanelPositionManagerModule, TruSearchViewBase, TruSearchViewBaseModule, TruSearchViewControlEventHandler, TruSearchViewEventHandler, TruSort, TruTableConfigBase, TruTableRegistry, TruTextManager, TruToolbar, TruToolbarButton, TruToolbarButtonModule, TruToolbarContextFilter, TruToolbarContextFilterModule, TruToolbarDropdown, TruToolbarDropdownModule, TruToolbarMenu, TruToolbarMenuModule, TruToolbarModule, TruToolbarSeparator, TruToolbarSeparatorModule, TruToolbarText, TruToolbarTextModule, TruUiNotification, TruUser, TruUtil, TruValidationDialog, TruValidationDialogModule, TruWindowActionEventHandler, TruWindowAddViewEventArgs, TruWindowEventArgs, TruWindowEventHandler };
5374
5446
  //# sourceMappingURL=trudb-tru-common-lib.mjs.map