@simpleangularcontrols/sac-common 10.0.0-rc.14 → 10.0.0-rc.16

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.
@@ -9262,12 +9262,21 @@
9262
9262
  SacTreeviewCommon.prototype.onActionClicked = function (action) {
9263
9263
  this.actionclicked.emit(action);
9264
9264
  };
9265
+ /**
9266
+ * Method is called when Node in Tree is clicked
9267
+ * @param node Selected Node
9268
+ */
9265
9269
  SacTreeviewCommon.prototype.onNodeClicked = function (node) {
9266
9270
  if (this.isDisabledState(node) || this.isSelectedState(node)) {
9267
9271
  this.invertExpandedState(node);
9268
9272
  }
9269
9273
  this.setSelectedState(node);
9270
9274
  };
9275
+ /**
9276
+ * Sets the hover state on a node
9277
+ * @param node Node on which the status is set
9278
+ * @param state Activate or deactivate HoverState
9279
+ */
9271
9280
  SacTreeviewCommon.prototype.setHoverState = function (node, state) {
9272
9281
  if (!node || !this.attrhoverstate) {
9273
9282
  return;
@@ -9281,6 +9290,10 @@
9281
9290
  }
9282
9291
  delete node[this.attrhoverstate];
9283
9292
  };
9293
+ /**
9294
+ * Sets the selected state on a node
9295
+ * @param node Node which is marked as Selected
9296
+ */
9284
9297
  SacTreeviewCommon.prototype.setSelectedState = function (node) {
9285
9298
  var _this = this;
9286
9299
  if (!node || !this.attrselected) {
@@ -9290,8 +9303,10 @@
9290
9303
  this.data.forEach(function (rootNode) { return _this.resetSelectedState(rootNode); });
9291
9304
  // set selected node as selected
9292
9305
  node[this.attrselected] = true;
9306
+ // Extract ID from Node
9307
+ var idValue = node[this.attrid];
9293
9308
  // Update ngModel
9294
- this.setValue(node);
9309
+ this.setValue(idValue);
9295
9310
  // Raise Selected Events
9296
9311
  this.selectednode.emit(node);
9297
9312
  if (!this.attrid) {
@@ -9300,6 +9315,11 @@
9300
9315
  var id = this.getStringField(node, this.attrid);
9301
9316
  this.selected.emit(id);
9302
9317
  };
9318
+ /**
9319
+ * Validates the model state of the control
9320
+ * @param c Control instance
9321
+ * @returns Returns a validation error, if present. Otherwise, as Result is NULL
9322
+ */
9303
9323
  SacTreeviewCommon.prototype.validateData = function (c) {
9304
9324
  var error = null;
9305
9325
  if (this.isrequired) {
@@ -9307,8 +9327,59 @@
9307
9327
  }
9308
9328
  return error;
9309
9329
  };
9330
+ /**
9331
+ * Saves the data from the model binding
9332
+ * @param value Id of the selected node
9333
+ */
9334
+ SacTreeviewCommon.prototype.writeValue = function (value) {
9335
+ var _this = this;
9336
+ _super.prototype.writeValue.call(this, value);
9337
+ // Do not preselct item when tree is empty
9338
+ if (!this.data) {
9339
+ return;
9340
+ }
9341
+ this.data.forEach(function (root) {
9342
+ var result = _this.findNodeById(root, value);
9343
+ if (result !== null) {
9344
+ _this.setSelectedState(result);
9345
+ }
9346
+ });
9347
+ };
9310
9348
  // #endregion Public Methods
9311
9349
  // #region Private Methods
9350
+ /**
9351
+ * Searches for a node based on the value in the ID attribute
9352
+ * @param node Node
9353
+ * @param value Value of the Id attribute
9354
+ * @returns Returns the node if it is found. If not, NULL is returned.
9355
+ */
9356
+ SacTreeviewCommon.prototype.findNodeById = function (node, value) {
9357
+ var e_1, _a;
9358
+ if (!this.attrid || !node) {
9359
+ return null;
9360
+ }
9361
+ if (node[this.attrid] === value) {
9362
+ return node;
9363
+ }
9364
+ var children = this.getChildren(node);
9365
+ try {
9366
+ for (var children_1 = __values(children), children_1_1 = children_1.next(); !children_1_1.done; children_1_1 = children_1.next()) {
9367
+ var child = children_1_1.value;
9368
+ var result = this.findNodeById(child, value);
9369
+ if (result !== null) {
9370
+ return result;
9371
+ }
9372
+ }
9373
+ }
9374
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
9375
+ finally {
9376
+ try {
9377
+ if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
9378
+ }
9379
+ finally { if (e_1) throw e_1.error; }
9380
+ }
9381
+ return null;
9382
+ };
9312
9383
  SacTreeviewCommon.prototype.invertExpandedState = function (node) {
9313
9384
  if (!node || !this.attrexanded) {
9314
9385
  return;
@@ -9368,6 +9439,7 @@
9368
9439
  selectednode: [{ type: i0.Output }],
9369
9440
  showactionalways: [{ type: i0.Input }],
9370
9441
  templateaction: [{ type: i0.Input }],
9442
+ templateicon: [{ type: i0.Input }],
9371
9443
  templatelabel: [{ type: i0.Input }],
9372
9444
  validationmessagerequired: [{ type: i0.Input }],
9373
9445
  validationmessagesummaryrequired: [{ type: i0.Input }]
@@ -9626,7 +9698,7 @@
9626
9698
  tooltip: [{ type: i0.ViewChild, args: ['tooltip', { static: false },] }]
9627
9699
  };
9628
9700
 
9629
- // #region Classes
9701
+ // #region Exported Classes
9630
9702
  /**
9631
9703
  * Base Klasse für Uploader Control
9632
9704
  */
@@ -9645,6 +9717,7 @@
9645
9717
  var _this = _super.call(this, formlayout, injector) || this;
9646
9718
  _this.renderer = renderer;
9647
9719
  _this.ngZone = ngZone;
9720
+ // #region Properties
9648
9721
  /**
9649
9722
  * Erlaubte Dateitypen
9650
9723
  */
@@ -9661,10 +9734,22 @@
9661
9734
  * API Endpoint
9662
9735
  */
9663
9736
  _this._endpoint = null;
9737
+ /**
9738
+ * Token for Bearer Authentication
9739
+ */
9740
+ _this._token = null;
9664
9741
  /**
9665
9742
  * Upload Settings
9666
9743
  */
9667
9744
  _this.options = {};
9745
+ /**
9746
+ * Handling von neuen Files im Input Control
9747
+ */
9748
+ _this.fileListener = function () {
9749
+ if (_this.uploadInput.nativeElement.files) {
9750
+ _this.uploadService.handleFileList(_this.uploadInput.nativeElement.files);
9751
+ }
9752
+ };
9668
9753
  /**
9669
9754
  * Definiert das Control als Required
9670
9755
  */
@@ -9674,25 +9759,21 @@
9674
9759
  */
9675
9760
  _this.maxfilesize = 0;
9676
9761
  /**
9677
- * Resource Key für Validation Message Required bei Control
9762
+ * Event when an error is triggered in the component.
9678
9763
  */
9679
- _this.validationmessagerequired = _this.validationKeyService.ValidationErrorRequired;
9764
+ _this.onfileerror = new i0.EventEmitter();
9680
9765
  /**
9681
- * Resource Key für Validation Message Required in Validation Summary
9766
+ * Event when a file has been uploaded. The event is triggered for multiple uploads per file.
9682
9767
  */
9683
- _this.validationmessagesummaryrequired = _this.validationKeyService.ValidationErrorSummaryRequired;
9768
+ _this.onuploadcomplete = new i0.EventEmitter();
9684
9769
  /**
9685
- * Event wenn ein Error in der Komponente ausgelöst wird.
9770
+ * Resource Key für Validation Message Required bei Control
9686
9771
  */
9687
- _this.onfileerror = new i0.EventEmitter();
9772
+ _this.validationmessagerequired = _this.validationKeyService.ValidationErrorRequired;
9688
9773
  /**
9689
- * Handling von neuen Files im Input Control
9774
+ * Resource Key für Validation Message Required in Validation Summary
9690
9775
  */
9691
- _this.fileListener = function () {
9692
- if (_this.uploadInput.nativeElement.files) {
9693
- _this.uploadService.handleFileList(_this.uploadInput.nativeElement.files);
9694
- }
9695
- };
9776
+ _this.validationmessagesummaryrequired = _this.validationKeyService.ValidationErrorSummaryRequired;
9696
9777
  _this.validationKeyService = injector.get(SACVALIDATIONKEY_SERVICE, new SacDefaultValidationKeyService());
9697
9778
  _this.lngResourceService = injector.get(SACLOCALISATION_SERVICE, new SacDefaultLocalisationService(_this.validationKeyService));
9698
9779
  _this.uploads = [];
@@ -9712,12 +9793,62 @@
9712
9793
  _this.uploadService.events.subscribe(function (ufile) { return _this.onUpload(ufile); });
9713
9794
  return _this;
9714
9795
  }
9796
+ Object.defineProperty(SacUploadBase.prototype, "IconBrowse", {
9797
+ // #endregion Constructors
9798
+ // #region Public Getters And Setters
9799
+ /**
9800
+ * Icon for browse button
9801
+ */
9802
+ get: function () {
9803
+ return this.iconService.UploadComponentBrowseIcon;
9804
+ },
9805
+ enumerable: false,
9806
+ configurable: true
9807
+ });
9808
+ Object.defineProperty(SacUploadBase.prototype, "IconContinue", {
9809
+ /**
9810
+ * icon for continous buttons
9811
+ */
9812
+ get: function () {
9813
+ return this.iconService.UploadComponentContinueIcon;
9814
+ },
9815
+ enumerable: false,
9816
+ configurable: true
9817
+ });
9818
+ Object.defineProperty(SacUploadBase.prototype, "IconDelete", {
9819
+ /**
9820
+ * icon for delete buttons
9821
+ */
9822
+ get: function () {
9823
+ return this.iconService.UploadComponentDeleteIcon;
9824
+ },
9825
+ enumerable: false,
9826
+ configurable: true
9827
+ });
9828
+ Object.defineProperty(SacUploadBase.prototype, "IconPause", {
9829
+ /**
9830
+ * icon for pause buttons
9831
+ */
9832
+ get: function () {
9833
+ return this.iconService.UploadComponentPauseIcon;
9834
+ },
9835
+ enumerable: false,
9836
+ configurable: true
9837
+ });
9838
+ Object.defineProperty(SacUploadBase.prototype, "IconUpload", {
9839
+ /**
9840
+ * icon for upload button
9841
+ */
9842
+ get: function () {
9843
+ return this.iconService.UploadComponentUploadIcon;
9844
+ },
9845
+ enumerable: false,
9846
+ configurable: true
9847
+ });
9715
9848
  Object.defineProperty(SacUploadBase.prototype, "allowedtypes", {
9716
9849
  get: function () {
9717
9850
  return this._allowedtypes;
9718
9851
  },
9719
- // #endregion Constructors
9720
- // #region Public Getters And Setters
9721
9852
  /**
9722
9853
  * Erlaubte Dateitypen für den Upload. Format: ".xxx,.yyy,.zzz"
9723
9854
  */
@@ -9770,58 +9901,23 @@
9770
9901
  enumerable: false,
9771
9902
  configurable: true
9772
9903
  });
9773
- Object.defineProperty(SacUploadBase.prototype, "IconBrowse", {
9774
- /**
9775
- * Icon for browse button
9776
- */
9777
- get: function () {
9778
- return this.iconService.UploadComponentBrowseIcon;
9779
- },
9780
- enumerable: false,
9781
- configurable: true
9782
- });
9783
- Object.defineProperty(SacUploadBase.prototype, "IconContinue", {
9784
- /**
9785
- * icon for continous buttons
9786
- */
9787
- get: function () {
9788
- return this.iconService.UploadComponentContinueIcon;
9789
- },
9790
- enumerable: false,
9791
- configurable: true
9792
- });
9793
- Object.defineProperty(SacUploadBase.prototype, "IconDelete", {
9904
+ Object.defineProperty(SacUploadBase.prototype, "token", {
9794
9905
  /**
9795
- * icon for delete buttons
9906
+ * Token for Bearer Authentication
9796
9907
  */
9797
9908
  get: function () {
9798
- return this.iconService.UploadComponentDeleteIcon;
9909
+ return this._token;
9799
9910
  },
9800
- enumerable: false,
9801
- configurable: true
9802
- });
9803
- Object.defineProperty(SacUploadBase.prototype, "IconPause", {
9804
9911
  /**
9805
- * icon for pause buttons
9912
+ * Token for Bearer Authentication
9806
9913
  */
9807
- get: function () {
9808
- return this.iconService.UploadComponentPauseIcon;
9809
- },
9810
- enumerable: false,
9811
- configurable: true
9812
- });
9813
- Object.defineProperty(SacUploadBase.prototype, "IconUpload", {
9814
- /**
9815
- * icon for upload button
9816
- */
9817
- get: function () {
9818
- return this.iconService.UploadComponentUploadIcon;
9914
+ set: function (v) {
9915
+ this._token = v;
9916
+ this.setToken(v);
9819
9917
  },
9820
9918
  enumerable: false,
9821
9919
  configurable: true
9822
9920
  });
9823
- // #endregion Public Getters And Setters
9824
- // #region Public Methods
9825
9921
  /**
9826
9922
  * Name der Datei die Hochgeladen wird
9827
9923
  * @returns Observable des Dateinamens.
@@ -9847,7 +9943,7 @@
9847
9943
  */
9848
9944
  SacUploadBase.prototype.HasSuccessUpload = function () {
9849
9945
  if (this.uploads.length > 0) {
9850
- return (this.uploads.filter(function (itm) { return itm.status !== 'complete'; }).length === 0);
9946
+ return this.uploads.filter(function (itm) { return itm.status !== 'complete'; }).length === 0;
9851
9947
  }
9852
9948
  else {
9853
9949
  return false;
@@ -9865,7 +9961,7 @@
9865
9961
  * @returns Elemente für Upload vorhanden
9866
9962
  */
9867
9963
  SacUploadBase.prototype.IsStateToUpload = function () {
9868
- return (this.uploads.filter(function (itm) { return itm.status === 'added' || itm.status === 'paused'; }).length > 0);
9964
+ return this.uploads.filter(function (itm) { return itm.status === 'added' || itm.status === 'paused'; }).length > 0;
9869
9965
  };
9870
9966
  /**
9871
9967
  * Prüft ob ein Upload eines Files am laufen ist
@@ -9910,7 +10006,7 @@
9910
10006
  }
9911
10007
  };
9912
10008
  /**
9913
- * Initialisiert das Control
10009
+ * Initializes the control
9914
10010
  */
9915
10011
  SacUploadBase.prototype.ngOnInit = function () {
9916
10012
  _super.prototype.ngOnInit.call(this);
@@ -9918,6 +10014,7 @@
9918
10014
  this.listenerFn = this.renderer.listen(this.uploadInput.nativeElement, 'change', this.fileListener);
9919
10015
  this.setAllowedTypes(this._allowedtypes);
9920
10016
  this.setEndpoint(this._endpoint);
10017
+ this.setToken(this._token);
9921
10018
  if (this._endpoint === null) {
9922
10019
  throw new Error('endpoint is not defined!');
9923
10020
  }
@@ -9956,6 +10053,12 @@
9956
10053
  this.uploads[index].progress = ufile.progress;
9957
10054
  this.uploads[index].status = ufile.status;
9958
10055
  this.SetUploadValue(ufile);
10056
+ var uploadState = {
10057
+ name: ufile.name,
10058
+ size: ufile.size,
10059
+ uploadid: this.uploads[index].uploadId,
10060
+ };
10061
+ this.onuploadcomplete.emit(uploadState);
9959
10062
  }
9960
10063
  else {
9961
10064
  if (index >= 0) {
@@ -9980,6 +10083,12 @@
9980
10083
  this.uploadService.control({ action: 'pause' });
9981
10084
  }
9982
10085
  };
10086
+ /**
10087
+ * Sets the bearer token in the upload service
10088
+ */
10089
+ SacUploadBase.prototype.setToken = function (value) {
10090
+ this.options.token = value;
10091
+ };
9983
10092
  /**
9984
10093
  * Upload Single File
9985
10094
  *
@@ -10007,13 +10116,12 @@
10007
10116
  }
10008
10117
  return error;
10009
10118
  };
10010
- // #endregion Public Abstract Methods
10119
+ // #endregion Public Methods
10011
10120
  // #region Private Methods
10012
10121
  SacUploadBase.prototype.UpdateFileCount = function () {
10013
10122
  // HACK: Add addition property to FormControl. Can be fixed if solution for ticket: https://github.com/angular/angular/issues/19686
10014
10123
  if (this.ngControl) {
10015
- this.ngControl.uploadedfilecount =
10016
- this.UploadedFileCount();
10124
+ this.ngControl.uploadedfilecount = this.UploadedFileCount();
10017
10125
  }
10018
10126
  };
10019
10127
  /**
@@ -10085,13 +10193,15 @@
10085
10193
  uploadInput: [{ type: i0.ViewChild, args: ['files', { static: true },] }],
10086
10194
  isrequired: [{ type: i0.Input }],
10087
10195
  maxfilesize: [{ type: i0.Input }],
10196
+ onfileerror: [{ type: i0.Output }],
10197
+ onuploadcomplete: [{ type: i0.Output }],
10088
10198
  validationmessagerequired: [{ type: i0.Input }],
10089
10199
  validationmessagesummaryrequired: [{ type: i0.Input }],
10090
- onfileerror: [{ type: i0.Output }],
10091
10200
  allowedtypes: [{ type: i0.Input }],
10092
10201
  autoupload: [{ type: i0.Input }],
10093
10202
  enablepause: [{ type: i0.Input }],
10094
- endpoint: [{ type: i0.Input }]
10203
+ endpoint: [{ type: i0.Input }],
10204
+ token: [{ type: i0.Input }]
10095
10205
  };
10096
10206
  /**
10097
10207
  * Klasse für den Upload einer Datei in der Upload Component
@@ -10112,7 +10222,7 @@
10112
10222
  }
10113
10223
  return SacUploadFile;
10114
10224
  }());
10115
- // #endregion Classes
10225
+ // #endregion Exported Classes
10116
10226
 
10117
10227
  /**
10118
10228
  * Upload Komponente für ein einzelnes File