@ardimedia/angular-portal-azure 0.2.341 → 0.2.342

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 +36 -5
  2. package/apn.js +60 -5
  3. package/package.json +1 -1
package/apn.d.ts CHANGED
@@ -226,20 +226,22 @@ declare namespace angularportalazure {
226
226
  onLoadItemsException(ex: angularportalazure.Exception): void;
227
227
  /**
228
228
  * Default behavior for saving an entity.
229
+ * - validates this.ngForm. if not valid, returns without saving
229
230
  * - call this.setStatusBarSaveData();
230
- * - call this.onSaveItem()
231
- * - validates this.formblade. if not valid, returns without saving
232
231
  * - set this.isCommandSaveEnabled = false
232
+ * - call this.onSaveItem()
233
233
  * - call the provided function
234
234
  * THEN
235
235
  * - call this.clearStatusBar()
236
236
  * - set this.isCommandSaveEnabled = true
237
+ * - set this.isCommandDeleteEnabled = true
237
238
  * - set this.item to the saved data
238
239
  * - call this.onSavedItem()
239
240
  * - returns the saved data
240
241
  * CATCH
241
242
  * - set this.isCommandSaveEnabled = true
242
243
  * - call this.setStatusBarException
244
+ * - call this.onLoadItemsException
243
245
  */
244
246
  saveItem(func: () => Promise<T | angularportalazure.Exception> | angular.IPromise<T | angularportalazure.Exception>, ngForm?: any): (Promise<T | void> | angular.IPromise<T | void>);
245
247
  /** Extension point */
@@ -250,16 +252,21 @@ declare namespace angularportalazure {
250
252
  onSaveItemException(ex: angularportalazure.Exception): void;
251
253
  /**
252
254
  * Default behavior for saving any object.
255
+ * - validates this.ngForm. if not valid, returns without saving
253
256
  * - call this.setStatusBarSaveData();
254
- * - call this.onSaveItem()
255
- * - validates this.formblade. if not valid, returns without saving
257
+ * - set this.isCommandSaveEnabled = false
258
+ * - call this.onSaveObject()
256
259
  * - call the provided function
257
260
  * THEN
258
261
  * - call this.clearStatusBar()
259
- * - call this.onSavedItem()
262
+ * - set this.isCommandSaveEnabled = true
263
+ * - set this.isCommandDeleteEnabled = true
264
+ * - call this.onSavedObject()
260
265
  * - returns the saved data
261
266
  * CATCH
267
+ * - set this.isCommandSaveEnabled = true
262
268
  * - call this.setStatusBarException
269
+ * - call this.onLoadItemsException
263
270
  */
264
271
  saveObject(func: () => Promise<any | angularportalazure.Exception> | angular.IPromise<any | angularportalazure.Exception>, ngForm?: any): (Promise<any | void> | angular.IPromise<any | void>);
265
272
  /** Extension point */
@@ -277,6 +284,30 @@ declare namespace angularportalazure {
277
284
  onDeletedItem(): boolean;
278
285
  /** Extension point */
279
286
  onDeletedObjectException(ex: angularportalazure.Exception): void;
287
+ /**
288
+ * Default behavior for executing
289
+ * - validates ngForm. if not valid, returns without executing
290
+ * - call this.setStatusBarInfo();
291
+ * - set this.isCommandStart = false
292
+ * - call this.onExecute()
293
+ * - call the provided function
294
+ * THEN
295
+ * - call this.clearStatusBar()
296
+ * - set this.isCommandStart = true
297
+ * - call this.onExecuted()
298
+ * - returns the data
299
+ * CATCH
300
+ * - set this.isCommandStart = true
301
+ * - call this.setStatusBarException
302
+ * - call this.onExecuteException
303
+ */
304
+ execute(message: string, func: () => Promise<T | angularportalazure.Exception> | angular.IPromise<T | angularportalazure.Exception>, ngForm?: any): (Promise<T | void> | angular.IPromise<T | void>);
305
+ /** Extension point */
306
+ onExecute(): void;
307
+ /** Extension point */
308
+ onExecuted(): void;
309
+ /** Extension point */
310
+ onExecuteException(ex: angularportalazure.Exception): void;
280
311
  isFormValid(ngForm?: any): boolean;
281
312
  /** Extension point */
282
313
  onSaveItemFormValidation(): boolean;
package/apn.js CHANGED
@@ -800,20 +800,22 @@ var angularportalazure;
800
800
  // #region saveItem
801
801
  /**
802
802
  * Default behavior for saving an entity.
803
+ * - validates this.ngForm. if not valid, returns without saving
803
804
  * - call this.setStatusBarSaveData();
804
- * - call this.onSaveItem()
805
- * - validates this.formblade. if not valid, returns without saving
806
805
  * - set this.isCommandSaveEnabled = false
806
+ * - call this.onSaveItem()
807
807
  * - call the provided function
808
808
  * THEN
809
809
  * - call this.clearStatusBar()
810
810
  * - set this.isCommandSaveEnabled = true
811
+ * - set this.isCommandDeleteEnabled = true
811
812
  * - set this.item to the saved data
812
813
  * - call this.onSavedItem()
813
814
  * - returns the saved data
814
815
  * CATCH
815
816
  * - set this.isCommandSaveEnabled = true
816
817
  * - call this.setStatusBarException
818
+ * - call this.onLoadItemsException
817
819
  */
818
820
  BladeData.prototype.saveItem = function (func, ngForm) {
819
821
  var _this = this;
@@ -850,16 +852,21 @@ var angularportalazure;
850
852
  // #region saveObject
851
853
  /**
852
854
  * Default behavior for saving any object.
855
+ * - validates this.ngForm. if not valid, returns without saving
853
856
  * - call this.setStatusBarSaveData();
854
- * - call this.onSaveItem()
855
- * - validates this.formblade. if not valid, returns without saving
857
+ * - set this.isCommandSaveEnabled = false
858
+ * - call this.onSaveObject()
856
859
  * - call the provided function
857
860
  * THEN
858
861
  * - call this.clearStatusBar()
859
- * - call this.onSavedItem()
862
+ * - set this.isCommandSaveEnabled = true
863
+ * - set this.isCommandDeleteEnabled = true
864
+ * - call this.onSavedObject()
860
865
  * - returns the saved data
861
866
  * CATCH
867
+ * - set this.isCommandSaveEnabled = true
862
868
  * - call this.setStatusBarException
869
+ * - call this.onLoadItemsException
863
870
  */
864
871
  BladeData.prototype.saveObject = function (func, ngForm) {
865
872
  var _this = this;
@@ -930,6 +937,54 @@ var angularportalazure;
930
937
  BladeData.prototype.onDeletedObjectException = function (ex) {
931
938
  };
932
939
  // #endregion
940
+ // #region execute WebApi function
941
+ /**
942
+ * Default behavior for executing
943
+ * - validates ngForm. if not valid, returns without executing
944
+ * - call this.setStatusBarInfo();
945
+ * - set this.isCommandStart = false
946
+ * - call this.onExecute()
947
+ * - call the provided function
948
+ * THEN
949
+ * - call this.clearStatusBar()
950
+ * - set this.isCommandStart = true
951
+ * - call this.onExecuted()
952
+ * - returns the data
953
+ * CATCH
954
+ * - set this.isCommandStart = true
955
+ * - call this.setStatusBarException
956
+ * - call this.onExecuteException
957
+ */
958
+ BladeData.prototype.execute = function (message, func, ngForm) {
959
+ var _this = this;
960
+ if (ngForm === void 0) { ngForm = undefined; }
961
+ if (!this.isFormValid(ngForm) && this.onSaveItemFormValidation()) {
962
+ return;
963
+ }
964
+ this.setStatusBarInfo(message);
965
+ this.isCommandStart = false;
966
+ this.onExecute();
967
+ return func().then(function (data) {
968
+ _this.clearStatusBar();
969
+ _this.isCommandStart = true;
970
+ _this.onExecuted();
971
+ return data;
972
+ }).catch(function (ex) {
973
+ _this.isCommandStart = true;
974
+ _this.setStatusBarException(ex);
975
+ _this.onExecuteException(ex);
976
+ });
977
+ };
978
+ /** Extension point */
979
+ BladeData.prototype.onExecute = function () {
980
+ };
981
+ /** Extension point */
982
+ BladeData.prototype.onExecuted = function () {
983
+ };
984
+ /** Extension point */
985
+ BladeData.prototype.onExecuteException = function (ex) {
986
+ };
987
+ // #endregion
933
988
  // #region Form Validation
934
989
  BladeData.prototype.isFormValid = function (ngForm) {
935
990
  if (ngForm === void 0) { ngForm = undefined; }
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.341",
5
+ "version": "0.2.342",
6
6
  "main": "index.js",
7
7
  "typings": "apn.d.ts",
8
8
  "dependencies": {