@ardimedia/angular-portal-azure 0.2.284 → 0.2.286

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.
package/apn.d.ts CHANGED
@@ -72,9 +72,11 @@ declare namespace angularportalazure {
72
72
  commandCancel: () => void;
73
73
  commandCancelText: string;
74
74
  isCommandCopy: boolean;
75
+ isCommandCopyEnabled: boolean;
75
76
  commandCopy: () => void;
76
77
  commandCopyText: string;
77
78
  isCommandDelete: boolean;
79
+ isCommandDeleteEnabled: boolean;
78
80
  commandDelete: () => void;
79
81
  commandDeleteText: string;
80
82
  isCommandDocument: boolean;
@@ -374,8 +376,21 @@ declare namespace angularportalazure {
374
376
  constructor($scope: angular.IScope, portalService: angularportalazure.PortalService, path: string, title: string, subtitle?: string, width?: number);
375
377
  item: T;
376
378
  loadItem(func: () => Promise<any>): void;
377
- 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 */
378
392
  onSaveItem(): void;
393
+ /** Extension point */
379
394
  onSavedItem(): void;
380
395
  onCommandCancel(): void;
381
396
  }
package/apn.js CHANGED
@@ -184,9 +184,11 @@ var angularportalazure;
184
184
  _this.commandCancel = function () { _this.onCommandCancel(); };
185
185
  _this.commandCancelText = '';
186
186
  _this.isCommandCopy = false;
187
+ _this.isCommandCopyEnabled = true;
187
188
  _this.commandCopy = function () { _this.onCommandCopy(); };
188
189
  _this.commandCopyText = '';
189
190
  _this.isCommandDelete = false;
191
+ _this.isCommandDeleteEnabled = true;
190
192
  _this.commandDelete = function () { _this.onCommandDelete(); };
191
193
  _this.commandDeleteText = '';
192
194
  _this.isCommandDocument = false;
@@ -1174,8 +1176,20 @@ var angularportalazure;
1174
1176
  _this.setStatusBarException(exception);
1175
1177
  });
1176
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
+ */
1177
1190
  BladeDetail.prototype.saveItem = function (func) {
1178
1191
  var _this = this;
1192
+ this.setStatusBarSaveData();
1179
1193
  this.onSaveItem();
1180
1194
  // Is form valid
1181
1195
  if (!this.formblade.$valid) {
@@ -1186,19 +1200,21 @@ var angularportalazure;
1186
1200
  }
1187
1201
  this.isCommandSaveEnabled = false;
1188
1202
  return func().then(function (data) {
1189
- _this.item = data;
1203
+ _this.clearStatusBar();
1190
1204
  _this.isCommandSaveEnabled = true;
1205
+ _this.item = data;
1191
1206
  _this.onSavedItem();
1207
+ return data;
1192
1208
  }).catch(function (exception) {
1193
1209
  _this.isCommandSaveEnabled = true;
1194
1210
  _this.setStatusBarException(exception);
1195
1211
  });
1196
1212
  };
1213
+ /** Extension point */
1197
1214
  BladeDetail.prototype.onSaveItem = function () {
1198
- this.setStatusBarSaveData();
1199
1215
  };
1216
+ /** Extension point */
1200
1217
  BladeDetail.prototype.onSavedItem = function () {
1201
- this.clearStatusBar();
1202
1218
  };
1203
1219
  BladeDetail.prototype.onCommandCancel = function () {
1204
1220
  this.close();
@@ -68,7 +68,7 @@
68
68
  </a>
69
69
  </li>
70
70
  <!-- COPY -->
71
- <li ng-show="$ctrl.vm.isCommandCopy">
71
+ <li ng-show="$ctrl.vm.isCommandCopy" ng-class="{'apa-disable-click': !$ctrl.vm.isCommandCopyEnabled}">
72
72
  <a data-ng-click="$ctrl.vm.commandCopy()" class="fxs-commandBar-item" href="#"
73
73
  data-bind='css: { "fxs-commandBar-itemDisabled": !enabled(), "fxs-commandBar-itemPressed": pressed() }, attr: { href: enabled() ? "#" : null }'>
74
74
  <div class="fxs-commandBar-item-text" data-bind="text: text()">{{$ctrl.vm.commandCopyText || 'kopieren'}}</div>
@@ -95,7 +95,7 @@
95
95
  </a>
96
96
  </li>
97
97
  <!-- DELETE -->
98
- <li ng-show="$ctrl.vm.isCommandDelete">
98
+ <li ng-show="$ctrl.vm.isCommandDelete" ng-class="{'apa-disable-click': !$ctrl.vm.isCommandDeleteEnabled}">
99
99
  <a data-ng-click="$ctrl.vm.commandDelete()" class="fxs-commandBar-item" href="#" data-bind='css: { "fxs-commandBar-itemDisabled": !enabled(), "fxs-commandBar-itemPressed": pressed() }, attr: { href: enabled() ? "#" : null }'>
100
100
  <div class="fxs-commandBar-item-text" data-bind="text: text()">{{$ctrl.vm.commandDeleteText || 'löschen'}}</div>
101
101
  <div class="fxs-commandBar-item-icon" data-bind="image: icon">
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.284",
5
+ "version": "0.2.286",
6
6
  "main": "index.js",
7
7
  "typings": "apn.d.ts",
8
8
  "dependencies": {