@ardimedia/angular-portal-azure 0.2.317 → 0.2.319

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.
Files changed (3) hide show
  1. package/apn.d.ts +30 -4
  2. package/apn.js +117 -73
  3. package/package.json +1 -1
package/apn.d.ts CHANGED
@@ -206,11 +206,22 @@ declare namespace angularportalazure {
206
206
  onNewItem(): void;
207
207
  /** Extension point */
208
208
  onNewedItem(): void;
209
+ /** Extension point */
210
+ onNewItemException(ex: angularportalazure.Exception): void;
209
211
  loadItem(func: () => Promise<any | angularportalazure.Exception>): void;
212
+ /** Extension point */
210
213
  onLoadItem(): void;
214
+ /** Extension point */
211
215
  onLoadedItem(): void;
216
+ /** Extension point */
217
+ onLoadItemException(ex: angularportalazure.Exception): void;
218
+ loadItems(func: () => Promise<any | angularportalazure.Exception>): void;
219
+ /** Extension point */
212
220
  onLoadItems(): void;
221
+ /** Extension point */
213
222
  onLoadedItems(): void;
223
+ /** Extension point */
224
+ onLoadItemsException(ex: angularportalazure.Exception): void;
214
225
  /**
215
226
  * Default behavior for saving an entity.
216
227
  * - call this.setStatusBarSaveData();
@@ -233,6 +244,8 @@ declare namespace angularportalazure {
233
244
  onSaveItem(): void;
234
245
  /** Extension point */
235
246
  onSavedItem(): void;
247
+ /** Extension point */
248
+ onSaveItemException(ex: angularportalazure.Exception): void;
236
249
  /**
237
250
  * Default behavior for saving any object.
238
251
  * - call this.setStatusBarSaveData();
@@ -247,17 +260,31 @@ declare namespace angularportalazure {
247
260
  * - call this.setStatusBarException
248
261
  */
249
262
  saveObject(func: () => Promise<any | angularportalazure.Exception> | angular.IPromise<any | angularportalazure.Exception>, ngForm?: any): (Promise<any | void> | angular.IPromise<any | void>);
263
+ /** Extension point */
264
+ onSaveObject(): void;
265
+ /** Extension point */
266
+ onSavedObject(): void;
267
+ /** Extension point */
268
+ onSaveObjectException(ex: angularportalazure.Exception): void;
250
269
  deleteItem(func: () => Promise<T | angularportalazure.Exception> | angular.IPromise<T | angularportalazure.Exception>, ngForm?: any): (Promise<T | void> | angular.IPromise<T | void>);
251
270
  /** Extension point */
252
271
  onDeleteItem(): void;
253
272
  /** Extension point */
254
- onDeletedItem(): void;
273
+ onDeletedItem(): boolean;
274
+ /** Extension point */
275
+ onDeletedObjectException(ex: angularportalazure.Exception): void;
276
+ isFormValid(ngForm?: any): boolean;
277
+ /** Extension point */
278
+ onSaveItemFormValidation(): boolean;
279
+ /** Extension point */
280
+ onSaveObjectFormValidation(): boolean;
281
+ /** Extension point */
282
+ onDeleteItemFormValidation(): boolean;
255
283
  }
256
284
  }
257
285
  declare namespace angularportalazure {
258
- class BladeNav extends angularportalazure.BladeData<any> {
286
+ class BladeNav extends angularportalazure.BladeData<BladeNavItem> {
259
287
  constructor($scope: angular.IScope, portalService: angularportalazure.PortalService, path: string, title?: string, subtitle?: string, width?: number);
260
- items: Array<angularportalazure.BladeNavItem>;
261
288
  isNav: boolean;
262
289
  onNavigateTo(path: string): void;
263
290
  }
@@ -415,7 +442,6 @@ declare namespace angularportalazure {
415
442
  declare namespace angularportalazure {
416
443
  class BladeGrid extends angularportalazure.BladeData<any> {
417
444
  constructor($scope: angular.IScope, portalService: angularportalazure.PortalService, path: string, title: string, subtitle?: string, width?: number);
418
- loadItems(func: () => any | angular.IPromise<any> | Promise<any>): void;
419
445
  onFilter(actual: Object, expected: string): boolean;
420
446
  }
421
447
  }
package/apn.js CHANGED
@@ -704,6 +704,7 @@ var angularportalazure;
704
704
  _this.onNewedItem();
705
705
  }).catch(function (ex) {
706
706
  _this.setStatusBarException(ex);
707
+ _this.onNewItemException(ex);
707
708
  });
708
709
  };
709
710
  /** Extension point */
@@ -712,35 +713,60 @@ var angularportalazure;
712
713
  /** Extension point */
713
714
  BladeData.prototype.onNewedItem = function () {
714
715
  };
716
+ /** Extension point */
717
+ BladeData.prototype.onNewItemException = function (ex) {
718
+ };
715
719
  // #endregion
716
720
  // #region loadItem
717
721
  BladeData.prototype.loadItem = function (func) {
718
722
  var _this = this;
723
+ this.visibility = 'collapse';
724
+ this.setStatusBarLoadData();
719
725
  this.onLoadItem();
720
726
  func().then(function (data) {
727
+ _this.visibility = 'visible';
728
+ _this.clearStatusBar();
721
729
  _this.item = data;
722
730
  _this.onLoadedItem();
723
731
  }).catch(function (ex) {
724
732
  _this.setStatusBarException(ex);
733
+ _this.onLoadItemException(ex);
725
734
  });
726
735
  };
736
+ /** Extension point */
727
737
  BladeData.prototype.onLoadItem = function () {
728
- this.visibility = 'collapse';
729
- this.setStatusBarLoadData();
730
738
  };
739
+ /** Extension point */
731
740
  BladeData.prototype.onLoadedItem = function () {
732
- this.visibility = 'visible';
733
- this.clearStatusBar();
741
+ };
742
+ /** Extension point */
743
+ BladeData.prototype.onLoadItemException = function (ex) {
734
744
  };
735
745
  // #endregion
736
746
  // #region loadItems
737
- BladeData.prototype.onLoadItems = function () {
747
+ BladeData.prototype.loadItems = function (func) {
748
+ var _this = this;
738
749
  this.visibility = 'collapse';
739
750
  this.setStatusBarLoadData();
751
+ this.onLoadItems();
752
+ func().then(function (data) {
753
+ _this.visibility = 'visible';
754
+ _this.clearStatusBar();
755
+ _this.items = data;
756
+ _this.onLoadedItems();
757
+ }).catch(function (ex) {
758
+ _this.setStatusBarException(ex);
759
+ _this.onLoadItemsException(ex);
760
+ });
761
+ };
762
+ /** Extension point */
763
+ BladeData.prototype.onLoadItems = function () {
740
764
  };
765
+ /** Extension point */
741
766
  BladeData.prototype.onLoadedItems = function () {
742
- this.visibility = 'visible';
743
- this.clearStatusBar();
767
+ };
768
+ /** Extension point */
769
+ BladeData.prototype.onLoadItemsException = function (ex) {
744
770
  };
745
771
  // #endregion
746
772
  // #region saveItem
@@ -764,24 +790,12 @@ var angularportalazure;
764
790
  BladeData.prototype.saveItem = function (func, ngForm) {
765
791
  var _this = this;
766
792
  if (ngForm === void 0) { ngForm = undefined; }
767
- this.setStatusBarSaveData();
768
- this.onSaveItem();
769
- // #region form valid?
770
- // angularjs: if form valid
771
- if (!this.formblade.$valid) {
772
- this.statusBar = 'Speichern nicht möglich! [Console] enthält weitere Informationen.';
773
- this.statusBarClass = 'apa-statusbar-error';
774
- //console.log(this.formblade);
793
+ if (!this.isFormValid(ngForm) && this.onSaveItemFormValidation()) {
775
794
  return;
776
795
  }
777
- // angular: if form valid
778
- if (ngForm !== undefined) {
779
- if (!ngForm.valid) {
780
- return;
781
- }
782
- }
783
- // #endregion
796
+ this.setStatusBarSaveData();
784
797
  this.isCommandSaveEnabled = false;
798
+ this.onSaveItem();
785
799
  return func().then(function (data) {
786
800
  _this.clearStatusBar();
787
801
  _this.isCommandSaveEnabled = true;
@@ -789,9 +803,10 @@ var angularportalazure;
789
803
  _this.item = data;
790
804
  _this.onSavedItem();
791
805
  return data;
792
- }).catch(function (exception) {
806
+ }).catch(function (ex) {
793
807
  _this.isCommandSaveEnabled = true;
794
- _this.setStatusBarException(exception);
808
+ _this.setStatusBarException(ex);
809
+ _this.onLoadItemsException(ex);
795
810
  });
796
811
  };
797
812
  /** Extension point */
@@ -800,6 +815,9 @@ var angularportalazure;
800
815
  /** Extension point */
801
816
  BladeData.prototype.onSavedItem = function () {
802
817
  };
818
+ /** Extension point */
819
+ BladeData.prototype.onSaveItemException = function (ex) {
820
+ };
803
821
  // #endregion
804
822
  // #region saveObject
805
823
  /**
@@ -818,64 +836,57 @@ var angularportalazure;
818
836
  BladeData.prototype.saveObject = function (func, ngForm) {
819
837
  var _this = this;
820
838
  if (ngForm === void 0) { ngForm = undefined; }
821
- this.setStatusBarSaveData();
822
- this.onSaveItem();
823
- // #region form valid?
824
- // angularjs: if form valid
825
- if (!this.formblade.$valid) {
826
- this.statusBar = 'Speichern nicht möglich! [Console] enthält weitere Informationen.';
827
- this.statusBarClass = 'apa-statusbar-error';
828
- //console.log(this.formblade);
839
+ if (!this.isFormValid(ngForm) && this.onSaveObjectFormValidation()) {
829
840
  return;
830
841
  }
831
- // angular: if form valid
832
- if (ngForm !== undefined) {
833
- if (!ngForm.valid) {
834
- return;
835
- }
836
- }
837
- // #endregion
842
+ this.setStatusBarSaveData();
843
+ this.isCommandSaveEnabled = false;
844
+ this.onSaveObject();
838
845
  return func().then(function (data) {
839
846
  _this.clearStatusBar();
840
- _this.onSavedItem();
847
+ _this.isCommandSaveEnabled = true;
848
+ _this.isCommandDeleteEnabled = true;
849
+ _this.onSavedObject();
841
850
  return data;
842
- }).catch(function (exception) {
843
- _this.setStatusBarException(exception);
851
+ }).catch(function (ex) {
852
+ _this.isCommandSaveEnabled = true;
853
+ _this.setStatusBarException(ex);
854
+ _this.onLoadItemsException(ex);
844
855
  });
845
856
  };
857
+ /** Extension point */
858
+ BladeData.prototype.onSaveObject = function () {
859
+ };
860
+ /** Extension point */
861
+ BladeData.prototype.onSavedObject = function () {
862
+ };
863
+ /** Extension point */
864
+ BladeData.prototype.onSaveObjectException = function (ex) {
865
+ };
846
866
  // #endregion
847
867
  // #region deleteItem
848
868
  BladeData.prototype.deleteItem = function (func, ngForm) {
849
869
  var _this = this;
850
870
  if (ngForm === void 0) { ngForm = undefined; }
851
- this.setStatusBarDeleteData();
852
- this.onDeleteItem();
853
- // #region form valid?
854
- // angularjs: if form valid
855
- if (!this.formblade.$valid) {
856
- this.statusBar = 'Löschen nicht möglich! [Console] enthält weitere Informationen.';
857
- this.statusBarClass = 'apa-statusbar-error';
858
- //console.log(this.formblade);
871
+ if (!this.isFormValid(ngForm) && this.onDeleteItemFormValidation()) {
859
872
  return;
860
873
  }
861
- // angular: if form valid
862
- if (ngForm !== undefined) {
863
- if (!ngForm.valid) {
864
- return;
865
- }
866
- }
867
- // #endregion
874
+ this.setStatusBarDeleteData();
868
875
  this.isCommandDeleteEnabled = false;
876
+ this.onDeleteItem();
869
877
  return func().then(function (data) {
870
878
  _this.clearStatusBar();
871
879
  _this.isCommandDeleteEnabled = true;
872
880
  _this.item = data;
873
- _this.onDeletedItem();
874
- _this.close();
881
+ if (_this.onDeletedItem()) {
882
+ _this.close();
883
+ }
884
+ ;
875
885
  return data;
876
- }).catch(function (exception) {
886
+ }).catch(function (ex) {
877
887
  _this.isCommandDeleteEnabled = true;
878
- _this.setStatusBarException(exception);
888
+ _this.setStatusBarException(ex);
889
+ _this.onLoadItemsException(ex);
879
890
  });
880
891
  };
881
892
  /** Extension point */
@@ -883,6 +894,40 @@ var angularportalazure;
883
894
  };
884
895
  /** Extension point */
885
896
  BladeData.prototype.onDeletedItem = function () {
897
+ return true; // close the current blade
898
+ };
899
+ /** Extension point */
900
+ BladeData.prototype.onDeletedObjectException = function (ex) {
901
+ };
902
+ // #endregion
903
+ // #region Form Validation
904
+ BladeData.prototype.isFormValid = function (ngForm) {
905
+ if (ngForm === void 0) { ngForm = undefined; }
906
+ // angularjs
907
+ if (!this.formblade.$valid) {
908
+ this.setStatusBarError('Formular nicht gültig.');
909
+ //console.log(this.formblade);
910
+ return false;
911
+ }
912
+ // angular (2+)
913
+ if (ngForm !== undefined) {
914
+ if (!ngForm.valid) {
915
+ return false;
916
+ }
917
+ }
918
+ return true;
919
+ };
920
+ /** Extension point */
921
+ BladeData.prototype.onSaveItemFormValidation = function () {
922
+ return true;
923
+ };
924
+ /** Extension point */
925
+ BladeData.prototype.onSaveObjectFormValidation = function () {
926
+ return true;
927
+ };
928
+ /** Extension point */
929
+ BladeData.prototype.onDeleteItemFormValidation = function () {
930
+ return true;
886
931
  };
887
932
  return BladeData;
888
933
  }(angularportalazure.Blade));
@@ -905,7 +950,7 @@ var angularportalazure;
905
950
  var _this = _super.call(this, $scope, portalService, path, title, subtitle, width) || this;
906
951
  // #endregion
907
952
  // #region Properties
908
- _this.items = new Array();
953
+ //items: Array<angularportalazure.BladeNavItem> = new Array<angularportalazure.BladeNavItem>();
909
954
  _this.isNav = true;
910
955
  _this.isInnerHtml = false;
911
956
  return _this;
@@ -1407,16 +1452,15 @@ var angularportalazure;
1407
1452
  //items: T[] = [];
1408
1453
  // #endregion
1409
1454
  // #region Methods
1410
- BladeGrid.prototype.loadItems = function (func) {
1411
- var _this = this;
1412
- this.onLoadItems();
1413
- func().then(function (data) {
1414
- _this.items = data;
1415
- _this.onLoadedItems();
1416
- }).catch(function (exception) {
1417
- _this.setStatusBarException(exception);
1418
- });
1419
- };
1455
+ //loadItems(func: () => any | angular.IPromise<any> | Promise<any>): void {
1456
+ // this.onLoadItems();
1457
+ // func().then((data: any) => {
1458
+ // this.items = data;
1459
+ // this.onLoadedItems();
1460
+ // }).catch((exception: angularportalazure.Exception) => {
1461
+ // this.setStatusBarException(exception);
1462
+ // });
1463
+ //}
1420
1464
  // #region Filter
1421
1465
  BladeGrid.prototype.onFilter = function (actual, expected) {
1422
1466
  // #region Documentation
@@ -1426,7 +1470,7 @@ var angularportalazure;
1426
1470
  // > If the item is an object, the filter will also be called with the object in the parameter 'actual'
1427
1471
  // #endregion
1428
1472
  // #region Helper functions
1429
- // Implemenation detail:
1473
+ // Implementation detail:
1430
1474
  // > We implemented the following functions with in-line-functions, since onFilter is not called within the scope of a class (this. not working).
1431
1475
  // Function to convert 'number' to 'string'
1432
1476
  var convertToString = function (value) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ardimedia/angular-portal-azure",
3
3
  "description": "Angular Portal Azure - GUI Framework.",
4
4
  "author": "Ardimedia Anstalt <info@ardimedia.com> (http://www.ardimedia.com)",
5
- "version": "0.2.317",
5
+ "version": "0.2.319",
6
6
  "main": "index.js",
7
7
  "typings": "apn.d.ts",
8
8
  "dependencies": {