@simpleangularcontrols/sac-common 10.0.0-rc.13 → 10.0.0-rc.15

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
  */
@@ -9673,6 +9758,10 @@
9673
9758
  * Max. Dateigrösse für Files die hochgeladen werden können. 0 deaktiviert den Filter
9674
9759
  */
9675
9760
  _this.maxfilesize = 0;
9761
+ /**
9762
+ * Event wenn ein Error in der Komponente ausgelöst wird.
9763
+ */
9764
+ _this.onfileerror = new i0.EventEmitter();
9676
9765
  /**
9677
9766
  * Resource Key für Validation Message Required bei Control
9678
9767
  */
@@ -9681,18 +9770,6 @@
9681
9770
  * Resource Key für Validation Message Required in Validation Summary
9682
9771
  */
9683
9772
  _this.validationmessagesummaryrequired = _this.validationKeyService.ValidationErrorSummaryRequired;
9684
- /**
9685
- * Event wenn ein Error in der Komponente ausgelöst wird.
9686
- */
9687
- _this.onfileerror = new i0.EventEmitter();
9688
- /**
9689
- * Handling von neuen Files im Input Control
9690
- */
9691
- _this.fileListener = function () {
9692
- if (_this.uploadInput.nativeElement.files) {
9693
- _this.uploadService.handleFileList(_this.uploadInput.nativeElement.files);
9694
- }
9695
- };
9696
9773
  _this.validationKeyService = injector.get(SACVALIDATIONKEY_SERVICE, new SacDefaultValidationKeyService());
9697
9774
  _this.lngResourceService = injector.get(SACLOCALISATION_SERVICE, new SacDefaultLocalisationService(_this.validationKeyService));
9698
9775
  _this.uploads = [];
@@ -9712,12 +9789,62 @@
9712
9789
  _this.uploadService.events.subscribe(function (ufile) { return _this.onUpload(ufile); });
9713
9790
  return _this;
9714
9791
  }
9792
+ Object.defineProperty(SacUploadBase.prototype, "IconBrowse", {
9793
+ // #endregion Constructors
9794
+ // #region Public Getters And Setters
9795
+ /**
9796
+ * Icon for browse button
9797
+ */
9798
+ get: function () {
9799
+ return this.iconService.UploadComponentBrowseIcon;
9800
+ },
9801
+ enumerable: false,
9802
+ configurable: true
9803
+ });
9804
+ Object.defineProperty(SacUploadBase.prototype, "IconContinue", {
9805
+ /**
9806
+ * icon for continous buttons
9807
+ */
9808
+ get: function () {
9809
+ return this.iconService.UploadComponentContinueIcon;
9810
+ },
9811
+ enumerable: false,
9812
+ configurable: true
9813
+ });
9814
+ Object.defineProperty(SacUploadBase.prototype, "IconDelete", {
9815
+ /**
9816
+ * icon for delete buttons
9817
+ */
9818
+ get: function () {
9819
+ return this.iconService.UploadComponentDeleteIcon;
9820
+ },
9821
+ enumerable: false,
9822
+ configurable: true
9823
+ });
9824
+ Object.defineProperty(SacUploadBase.prototype, "IconPause", {
9825
+ /**
9826
+ * icon for pause buttons
9827
+ */
9828
+ get: function () {
9829
+ return this.iconService.UploadComponentPauseIcon;
9830
+ },
9831
+ enumerable: false,
9832
+ configurable: true
9833
+ });
9834
+ Object.defineProperty(SacUploadBase.prototype, "IconUpload", {
9835
+ /**
9836
+ * icon for upload button
9837
+ */
9838
+ get: function () {
9839
+ return this.iconService.UploadComponentUploadIcon;
9840
+ },
9841
+ enumerable: false,
9842
+ configurable: true
9843
+ });
9715
9844
  Object.defineProperty(SacUploadBase.prototype, "allowedtypes", {
9716
9845
  get: function () {
9717
9846
  return this._allowedtypes;
9718
9847
  },
9719
- // #endregion Constructors
9720
- // #region Public Getters And Setters
9721
9848
  /**
9722
9849
  * Erlaubte Dateitypen für den Upload. Format: ".xxx,.yyy,.zzz"
9723
9850
  */
@@ -9770,58 +9897,23 @@
9770
9897
  enumerable: false,
9771
9898
  configurable: true
9772
9899
  });
9773
- Object.defineProperty(SacUploadBase.prototype, "IconBrowse", {
9900
+ Object.defineProperty(SacUploadBase.prototype, "token", {
9774
9901
  /**
9775
- * Icon for browse button
9902
+ * Token for Bearer Authentication
9776
9903
  */
9777
9904
  get: function () {
9778
- return this.iconService.UploadComponentBrowseIcon;
9905
+ return this._token;
9779
9906
  },
9780
- enumerable: false,
9781
- configurable: true
9782
- });
9783
- Object.defineProperty(SacUploadBase.prototype, "IconContinue", {
9784
9907
  /**
9785
- * icon for continous buttons
9908
+ * Token for Bearer Authentication
9786
9909
  */
9787
- get: function () {
9788
- return this.iconService.UploadComponentContinueIcon;
9789
- },
9790
- enumerable: false,
9791
- configurable: true
9792
- });
9793
- Object.defineProperty(SacUploadBase.prototype, "IconDelete", {
9794
- /**
9795
- * icon for delete buttons
9796
- */
9797
- get: function () {
9798
- return this.iconService.UploadComponentDeleteIcon;
9799
- },
9800
- enumerable: false,
9801
- configurable: true
9802
- });
9803
- Object.defineProperty(SacUploadBase.prototype, "IconPause", {
9804
- /**
9805
- * icon for pause buttons
9806
- */
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;
9910
+ set: function (v) {
9911
+ this._token = v;
9912
+ this.setToken(v);
9819
9913
  },
9820
9914
  enumerable: false,
9821
9915
  configurable: true
9822
9916
  });
9823
- // #endregion Public Getters And Setters
9824
- // #region Public Methods
9825
9917
  /**
9826
9918
  * Name der Datei die Hochgeladen wird
9827
9919
  * @returns Observable des Dateinamens.
@@ -9847,7 +9939,7 @@
9847
9939
  */
9848
9940
  SacUploadBase.prototype.HasSuccessUpload = function () {
9849
9941
  if (this.uploads.length > 0) {
9850
- return (this.uploads.filter(function (itm) { return itm.status !== 'complete'; }).length === 0);
9942
+ return this.uploads.filter(function (itm) { return itm.status !== 'complete'; }).length === 0;
9851
9943
  }
9852
9944
  else {
9853
9945
  return false;
@@ -9865,7 +9957,7 @@
9865
9957
  * @returns Elemente für Upload vorhanden
9866
9958
  */
9867
9959
  SacUploadBase.prototype.IsStateToUpload = function () {
9868
- return (this.uploads.filter(function (itm) { return itm.status === 'added' || itm.status === 'paused'; }).length > 0);
9960
+ return this.uploads.filter(function (itm) { return itm.status === 'added' || itm.status === 'paused'; }).length > 0;
9869
9961
  };
9870
9962
  /**
9871
9963
  * Prüft ob ein Upload eines Files am laufen ist
@@ -9910,7 +10002,7 @@
9910
10002
  }
9911
10003
  };
9912
10004
  /**
9913
- * Initialisiert das Control
10005
+ * Initializes the control
9914
10006
  */
9915
10007
  SacUploadBase.prototype.ngOnInit = function () {
9916
10008
  _super.prototype.ngOnInit.call(this);
@@ -9918,6 +10010,7 @@
9918
10010
  this.listenerFn = this.renderer.listen(this.uploadInput.nativeElement, 'change', this.fileListener);
9919
10011
  this.setAllowedTypes(this._allowedtypes);
9920
10012
  this.setEndpoint(this._endpoint);
10013
+ this.setToken(this._token);
9921
10014
  if (this._endpoint === null) {
9922
10015
  throw new Error('endpoint is not defined!');
9923
10016
  }
@@ -9980,6 +10073,12 @@
9980
10073
  this.uploadService.control({ action: 'pause' });
9981
10074
  }
9982
10075
  };
10076
+ /**
10077
+ * Sets the bearer token in the upload service
10078
+ */
10079
+ SacUploadBase.prototype.setToken = function (value) {
10080
+ this.options.token = value;
10081
+ };
9983
10082
  /**
9984
10083
  * Upload Single File
9985
10084
  *
@@ -10007,13 +10106,12 @@
10007
10106
  }
10008
10107
  return error;
10009
10108
  };
10010
- // #endregion Public Abstract Methods
10109
+ // #endregion Public Methods
10011
10110
  // #region Private Methods
10012
10111
  SacUploadBase.prototype.UpdateFileCount = function () {
10013
10112
  // HACK: Add addition property to FormControl. Can be fixed if solution for ticket: https://github.com/angular/angular/issues/19686
10014
10113
  if (this.ngControl) {
10015
- this.ngControl.uploadedfilecount =
10016
- this.UploadedFileCount();
10114
+ this.ngControl.uploadedfilecount = this.UploadedFileCount();
10017
10115
  }
10018
10116
  };
10019
10117
  /**
@@ -10085,13 +10183,14 @@
10085
10183
  uploadInput: [{ type: i0.ViewChild, args: ['files', { static: true },] }],
10086
10184
  isrequired: [{ type: i0.Input }],
10087
10185
  maxfilesize: [{ type: i0.Input }],
10186
+ onfileerror: [{ type: i0.Output }],
10088
10187
  validationmessagerequired: [{ type: i0.Input }],
10089
10188
  validationmessagesummaryrequired: [{ type: i0.Input }],
10090
- onfileerror: [{ type: i0.Output }],
10091
10189
  allowedtypes: [{ type: i0.Input }],
10092
10190
  autoupload: [{ type: i0.Input }],
10093
10191
  enablepause: [{ type: i0.Input }],
10094
- endpoint: [{ type: i0.Input }]
10192
+ endpoint: [{ type: i0.Input }],
10193
+ token: [{ type: i0.Input }]
10095
10194
  };
10096
10195
  /**
10097
10196
  * Klasse für den Upload einer Datei in der Upload Component
@@ -10112,7 +10211,7 @@
10112
10211
  }
10113
10212
  return SacUploadFile;
10114
10213
  }());
10115
- // #endregion Classes
10214
+ // #endregion Exported Classes
10116
10215
 
10117
10216
  /**
10118
10217
  * Upload Komponente für ein einzelnes File
@@ -11818,7 +11917,7 @@
11818
11917
  container: [{ type: i0.Input }],
11819
11918
  cssclass: [{ type: i0.Input }],
11820
11919
  isopen: [{ type: i0.Input }],
11821
- menuitems: [{ type: i0.ContentChildren, args: [i0.forwardRef(function () { return SacContextmenuItemCommon; }),] }],
11920
+ menuitems: [{ type: i0.ContentChildren, args: [SacContextmenuItemCommon,] }],
11822
11921
  placement: [{ type: i0.Input }],
11823
11922
  onClick: [{ type: i0.HostListener, args: ['document:click', ['$event.target'],] }]
11824
11923
  };