@ardimedia/angular-portal-azure 0.2.285 → 0.2.287

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 +14 -1
  2. package/apn.js +17 -3
  3. package/package.json +1 -1
package/apn.d.ts CHANGED
@@ -376,8 +376,21 @@ declare namespace angularportalazure {
376
376
  constructor($scope: angular.IScope, portalService: angularportalazure.PortalService, path: string, title: string, subtitle?: string, width?: number);
377
377
  item: T;
378
378
  loadItem(func: () => Promise<any>): void;
379
- saveItem(func: () => any): (Promise<object> & angular.IHttpPromise<object>);
379
+ /**
380
+ * Default behavior for saving an entity.
381
+ * - call this.setStatusBarSaveData();
382
+ * - call this.onSaveItem()
383
+ * - validates this.formblade and returns without saving if not valid
384
+ * - disables the save command button during save and re enables if after the call
385
+ * - call this.clearStatusBar()
386
+ * - set this.item to the saved data
387
+ * - call this.onSavedItem()
388
+ * @return {T} return the saved data
389
+ */
390
+ saveItem(func: () => (Promise<T> | angular.IHttpPromise<T>)): (Promise<void | T> | angular.IHttpPromise<void | T>);
391
+ /** Extension point */
380
392
  onSaveItem(): void;
393
+ /** Extension point */
381
394
  onSavedItem(): void;
382
395
  onCommandCancel(): void;
383
396
  }
package/apn.js CHANGED
@@ -1176,8 +1176,20 @@ var angularportalazure;
1176
1176
  _this.setStatusBarException(exception);
1177
1177
  });
1178
1178
  };
1179
+ /**
1180
+ * Default behavior for saving an entity.
1181
+ * - call this.setStatusBarSaveData();
1182
+ * - call this.onSaveItem()
1183
+ * - validates this.formblade and returns without saving if not valid
1184
+ * - disables the save command button during save and re enables if after the call
1185
+ * - call this.clearStatusBar()
1186
+ * - set this.item to the saved data
1187
+ * - call this.onSavedItem()
1188
+ * @return {T} return the saved data
1189
+ */
1179
1190
  BladeDetail.prototype.saveItem = function (func) {
1180
1191
  var _this = this;
1192
+ this.setStatusBarSaveData();
1181
1193
  this.onSaveItem();
1182
1194
  // Is form valid
1183
1195
  if (!this.formblade.$valid) {
@@ -1188,19 +1200,21 @@ var angularportalazure;
1188
1200
  }
1189
1201
  this.isCommandSaveEnabled = false;
1190
1202
  return func().then(function (data) {
1191
- _this.item = data;
1203
+ _this.clearStatusBar();
1192
1204
  _this.isCommandSaveEnabled = true;
1205
+ _this.item = data;
1193
1206
  _this.onSavedItem();
1207
+ return data;
1194
1208
  }).catch(function (exception) {
1195
1209
  _this.isCommandSaveEnabled = true;
1196
1210
  _this.setStatusBarException(exception);
1197
1211
  });
1198
1212
  };
1213
+ /** Extension point */
1199
1214
  BladeDetail.prototype.onSaveItem = function () {
1200
- this.setStatusBarSaveData();
1201
1215
  };
1216
+ /** Extension point */
1202
1217
  BladeDetail.prototype.onSavedItem = function () {
1203
- this.clearStatusBar();
1204
1218
  };
1205
1219
  BladeDetail.prototype.onCommandCancel = function () {
1206
1220
  this.close();
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.285",
5
+ "version": "0.2.287",
6
6
  "main": "index.js",
7
7
  "typings": "apn.d.ts",
8
8
  "dependencies": {