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

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 (86) hide show
  1. package/bundles/simpleangularcontrols-sac-common.umd.js +1425 -1088
  2. package/bundles/simpleangularcontrols-sac-common.umd.js.map +1 -1
  3. package/bundles/simpleangularcontrols-sac-common.umd.min.js +1 -1
  4. package/bundles/simpleangularcontrols-sac-common.umd.min.js.map +1 -1
  5. package/common/basedatetimecontrol.d.ts +99 -13
  6. package/common/basemodelcontrol.d.ts +33 -29
  7. package/controls/checkbox/radiobutton.d.ts +61 -26
  8. package/controls/contextmenu/contextmenu.d.ts +26 -19
  9. package/controls/contextmenu/contextmenu.interface.d.ts +3 -0
  10. package/controls/contextmenu/contextmenuitem.d.ts +5 -0
  11. package/controls/contextmenu/contextmenuitembutton.d.ts +21 -20
  12. package/controls/datetime/date.d.ts +28 -27
  13. package/controls/datetime/datetime.d.ts +27 -27
  14. package/controls/datetime/time.d.ts +26 -26
  15. package/controls/dialog/dialog.d.ts +31 -43
  16. package/controls/layout/formlayout.d.ts +4 -0
  17. package/controls/list/buildvaluestring.d.ts +6 -0
  18. package/controls/list/dropdown.d.ts +9 -51
  19. package/controls/list/dropdownoptions.d.ts +38 -0
  20. package/controls/list/dropdownoptions.ngfactory.d.ts +1 -0
  21. package/controls/static/formcontainer.d.ts +11 -3
  22. package/controls/tooltip/tooltip.d.ts +33 -51
  23. package/controls/treeview/treeview.d.ts +87 -121
  24. package/esm2015/common/basedatetimecontrol.js +178 -30
  25. package/esm2015/common/basemodelcontrol.js +71 -56
  26. package/esm2015/controls/checkbox/radiobutton.js +94 -45
  27. package/esm2015/controls/contextmenu/contextmenu.interface.js +1 -0
  28. package/esm2015/controls/contextmenu/contextmenu.interface.ngfactory.js +7 -0
  29. package/esm2015/controls/contextmenu/contextmenu.js +22 -23
  30. package/esm2015/controls/contextmenu/contextmenuitem.js +13 -2
  31. package/esm2015/controls/contextmenu/contextmenuitembutton.js +34 -25
  32. package/esm2015/controls/datetime/date.js +43 -41
  33. package/esm2015/controls/datetime/datetime.js +42 -41
  34. package/esm2015/controls/datetime/time.js +42 -41
  35. package/esm2015/controls/dialog/dialog.js +41 -83
  36. package/esm2015/controls/layout/formlayout.js +7 -6
  37. package/esm2015/controls/list/buildvaluestring.js +18 -0
  38. package/esm2015/controls/{treeview/ngtreeitemaction.ngfactory.js → list/buildvaluestring.ngfactory.js} +1 -1
  39. package/esm2015/controls/list/dropdown.js +16 -114
  40. package/esm2015/controls/list/dropdownoptions.js +72 -0
  41. package/esm2015/controls/{treeview/treeviewchild.ngfactory.js → list/dropdownoptions.ngfactory.js} +1 -1
  42. package/esm2015/controls/static/formcontainer.js +16 -6
  43. package/esm2015/controls/tooltip/tooltip.js +60 -250
  44. package/esm2015/controls/treeview/treeview.js +232 -247
  45. package/esm2015/interfaces/ISacConfigurationService.js +1 -1
  46. package/esm2015/interfaces/ISacIconService.js +1 -1
  47. package/esm2015/interfaces/treeviewaction.interface.js +1 -0
  48. package/esm2015/interfaces/treeviewaction.interface.ngfactory.js +7 -0
  49. package/esm2015/public_api.js +6 -6
  50. package/esm2015/services/sac-configuration.service.js +7 -5
  51. package/esm2015/services/sac-icon.service.js +25 -1
  52. package/esm2015/utilities/enums.js +5 -1
  53. package/esm2015/utilities/popuphelper.js +343 -0
  54. package/esm2015/utilities/popuphelper.ngfactory.js +7 -0
  55. package/esm2015/validation/equals.validator.js +14 -0
  56. package/esm2015/validation/equals.validator.ngfactory.js +7 -0
  57. package/esm2015/validation/notequals.validator.js +14 -0
  58. package/esm2015/validation/notequals.validator.ngfactory.js +7 -0
  59. package/esm2015/validation/validation.class.js +30 -6
  60. package/fesm2015/simpleangularcontrols-sac-common.js +1398 -1075
  61. package/fesm2015/simpleangularcontrols-sac-common.js.map +1 -1
  62. package/interfaces/ISacConfigurationService.d.ts +4 -0
  63. package/interfaces/ISacIconService.d.ts +16 -0
  64. package/interfaces/treeviewaction.interface.d.ts +4 -0
  65. package/interfaces/treeviewaction.interface.ngfactory.d.ts +1 -0
  66. package/package.json +1 -1
  67. package/public_api.d.ts +5 -5
  68. package/services/sac-configuration.service.d.ts +8 -0
  69. package/services/sac-icon.service.d.ts +33 -1
  70. package/simpleangularcontrols-sac-common-10.0.0-rc.13.tgz +0 -0
  71. package/simpleangularcontrols-sac-common.metadata.json +1 -1
  72. package/utilities/enums.d.ts +3 -1
  73. package/utilities/popuphelper.d.ts +83 -0
  74. package/utilities/popuphelper.ngfactory.d.ts +1 -0
  75. package/validation/equals.validator.d.ts +2 -0
  76. package/validation/equals.validator.ngfactory.d.ts +1 -0
  77. package/validation/notequals.validator.d.ts +2 -0
  78. package/validation/notequals.validator.ngfactory.d.ts +1 -0
  79. package/validation/validation.class.d.ts +19 -0
  80. package/controls/treeview/ngtreeitemaction.d.ts +0 -40
  81. package/controls/treeview/treeviewchild.d.ts +0 -12
  82. package/esm2015/controls/treeview/ngtreeitemaction.js +0 -60
  83. package/esm2015/controls/treeview/treeviewchild.js +0 -18
  84. package/simpleangularcontrols-sac-common-10.0.0-rc.11.tgz +0 -0
  85. /package/controls/{treeview/ngtreeitemaction.ngfactory.d.ts → contextmenu/contextmenu.interface.ngfactory.d.ts} +0 -0
  86. /package/controls/{treeview/treeviewchild.ngfactory.d.ts → list/buildvaluestring.ngfactory.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
- import { EventEmitter, Directive, Input, Output, ɵɵdefineInjectable, Injectable, InjectionToken, ɵɵinject, Inject, Host, Injector, ChangeDetectorRef, ViewChild, HostListener, Renderer2, ElementRef, ViewChildren, ContentChild, TemplateRef, NgZone, NgModule } from '@angular/core';
2
- import { NgControl, FormControlName, FormGroupDirective, Validators, FormGroup, NgForm } from '@angular/forms';
3
- import { Observable, of } from 'rxjs';
1
+ import { EventEmitter, Directive, Input, Output, ɵɵdefineInjectable, Injectable, InjectionToken, ɵɵinject, Inject, Host, Injector, ChangeDetectorRef, ViewChild, HostListener, Renderer2, ElementRef, ViewChildren, ContentChild, TemplateRef, NgZone, ContentChildren, forwardRef, NgModule } from '@angular/core';
4
2
  import { HttpClient } from '@angular/common/http';
3
+ import { Observable, of } from 'rxjs';
4
+ import { NgControl, FormControlName, FormGroupDirective, Validators, FormGroup, NgForm } from '@angular/forms';
5
5
  import moment_, { ISO_8601 } from 'moment';
6
6
  import { MaskedRange } from 'imask';
7
7
  import { UploadxService } from 'ngx-uploadx';
@@ -171,7 +171,6 @@ var ControlHeight;
171
171
  */
172
172
  class SacFormLayoutCommon {
173
173
  constructor() {
174
- // #region Properties
175
174
  /**
176
175
  * Defines the default display for a checkbox. You can choose between a checkbox and a switch. If no style is defined, the global style or the style on the control is used.
177
176
  */
@@ -216,10 +215,11 @@ class SacFormLayoutCommon {
216
215
  * default label size for extra extra large devices
217
216
  */
218
217
  this.labelSizeXxl = null;
219
- // #endregion Public Getters And Setters
218
+ /**
219
+ * Detach label text and tooltip from each other in Label so that label and tooltip can be aligned differently. This is in Bootstrap 3 not supported!
220
+ */
221
+ this.splitlabelandhelptext = null;
220
222
  }
221
- // #endregion Properties
222
- // #region Public Getters And Setters
223
223
  /**
224
224
  * Returns whether the inline error messages for the form are active.
225
225
  */
@@ -242,10 +242,10 @@ SacFormLayoutCommon.propDecorators = {
242
242
  labelSizeSm: [{ type: Input }],
243
243
  labelSizeXl: [{ type: Input }],
244
244
  labelSizeXs: [{ type: Input }],
245
- labelSizeXxl: [{ type: Input }]
245
+ labelSizeXxl: [{ type: Input }],
246
+ splitlabelandhelptext: [{ type: Input }]
246
247
  };
247
248
 
248
- // #region Classes
249
249
  /**
250
250
  * abstract class for configuration settings providing in components
251
251
  */
@@ -259,7 +259,6 @@ SacAbstractConfigurationService.decorators = [
259
259
  * default configuration service for components
260
260
  * */
261
261
  class SacDefaultConfigurationService extends SacAbstractConfigurationService {
262
- // #region Public Getters And Setters
263
262
  /**
264
263
  * @inheritdoc
265
264
  */
@@ -332,13 +331,17 @@ class SacDefaultConfigurationService extends SacAbstractConfigurationService {
332
331
  get LabelSizeXxl() {
333
332
  return null;
334
333
  }
334
+ /**
335
+ * @inheritdoc
336
+ */
337
+ get SplitLabelAndHelptext() {
338
+ return false;
339
+ }
335
340
  }
336
341
  SacDefaultConfigurationService.ɵprov = ɵɵdefineInjectable({ factory: function SacDefaultConfigurationService_Factory() { return new SacDefaultConfigurationService(); }, token: SacDefaultConfigurationService, providedIn: "root" });
337
342
  SacDefaultConfigurationService.decorators = [
338
343
  { type: Injectable, args: [{ providedIn: 'root' },] }
339
344
  ];
340
- // #endregion Classes
341
- // #region Variables
342
345
  /**
343
346
  * injection token for component configuration service
344
347
  */
@@ -750,6 +753,30 @@ class SacDefaultIconService extends SacAbstractIconService {
750
753
  get TimeComponentSelectorIcon() {
751
754
  return 'fa fa-clock';
752
755
  }
756
+ /**
757
+ * @inheritdoc
758
+ */
759
+ get TreeviewNodeActionIcon() {
760
+ return 'fa fa-pen';
761
+ }
762
+ /**
763
+ * @inheritdoc
764
+ */
765
+ get TreeviewNodeClosedIcon() {
766
+ return 'fa fa-folder-plus';
767
+ }
768
+ /**
769
+ * @inheritdoc
770
+ */
771
+ get TreeviewNodeEmptyIcon() {
772
+ return 'fa fa-folder';
773
+ }
774
+ /**
775
+ * @inheritdoc
776
+ */
777
+ get TreeviewNodeOpenIcon() {
778
+ return 'fa fa-folder-open';
779
+ }
753
780
  /**
754
781
  * @inheritdoc
755
782
  */
@@ -1574,6 +1601,9 @@ class SacBaseModelControl {
1574
1601
  * Inline Errors für das Control
1575
1602
  */
1576
1603
  this._inlineerrorenabled = null;
1604
+ /**
1605
+ * Label Text
1606
+ */
1577
1607
  this._label = '';
1578
1608
  /**
1579
1609
  * Boolean Property dirty; default Wert - false
@@ -1595,6 +1625,10 @@ class SacBaseModelControl {
1595
1625
  * Form layout instance if exists
1596
1626
  */
1597
1627
  this.formlayout = null;
1628
+ /**
1629
+ * ControlHeight enum for use in HTML markup
1630
+ */
1631
+ this.ControlHeight = ControlHeight;
1598
1632
  /**
1599
1633
  * Defines the standard height of the components
1600
1634
  */
@@ -1647,10 +1681,6 @@ class SacBaseModelControl {
1647
1681
  * Name des Controls
1648
1682
  */
1649
1683
  this.name = createGuid();
1650
- /**
1651
- * ControlHeight enum for use in HTML markup
1652
- */
1653
- this.ControlHeight = ControlHeight;
1654
1684
  /**
1655
1685
  * Leere Implementation von "propagateChange". Muss gemacht werden, damit kein Fehler entsteht
1656
1686
  */
@@ -1659,6 +1689,10 @@ class SacBaseModelControl {
1659
1689
  * Leere Implementation von "propagateTouch". Muss gemacht werden, damit kein Fehler entsteht
1660
1690
  */
1661
1691
  this.propagateTouch = () => { };
1692
+ /**
1693
+ * Detach label text and tooltip from each other in Label so that label and tooltip can be aligned differently. This is in Bootstrap 3 not supported!
1694
+ */
1695
+ this.splitlabelandhelptext = null;
1662
1696
  this.formlayout = formlayout;
1663
1697
  this.validationKeyService = injector.get(SACVALIDATIONKEY_SERVICE, new SacDefaultValidationKeyService());
1664
1698
  this.lngResourceService = injector.get(SACLOCALISATION_SERVICE, new SacDefaultLocalisationService(this.validationKeyService));
@@ -1667,35 +1701,6 @@ class SacBaseModelControl {
1667
1701
  }
1668
1702
  // #endregion Constructors
1669
1703
  // #region Public Getters And Setters
1670
- /**
1671
- * Aktiviert oder Deaktiviert die Inline Errors für das Control
1672
- */
1673
- set inlineerrorenabled(value) {
1674
- if (value === null || value === undefined) {
1675
- this._inlineerrorenabled = null;
1676
- }
1677
- else {
1678
- this._inlineerrorenabled = convertToBoolean(value);
1679
- }
1680
- }
1681
- /**
1682
- * Definiert den Label Text
1683
- */
1684
- set label(v) {
1685
- this._label = v;
1686
- this.UpdateLabelToControl();
1687
- }
1688
- /**
1689
- * Set Methode für NgModel Binding in Html Markup
1690
- * Input wird benötigt, damit der Wert auch über das Markup gesetzt werden kann.
1691
- */
1692
- set value(v) {
1693
- if (this.disabled) {
1694
- return;
1695
- }
1696
- this._value = this.ConvertInputValue(v);
1697
- this.propagateChange(this._value);
1698
- }
1699
1704
  /**
1700
1705
  * Get Icon for Helptext Tooltip
1701
1706
  */
@@ -1706,7 +1711,7 @@ class SacBaseModelControl {
1706
1711
  * Methode ergibt Boolean Wert für dirty
1707
1712
  */
1708
1713
  get dirty() {
1709
- if (this.ngControl !== null) {
1714
+ if (this.ngControl !== null && this.ngControl !== undefined) {
1710
1715
  this._dirty = this.ngControl.dirty;
1711
1716
  }
1712
1717
  return this._dirty;
@@ -1717,13 +1722,22 @@ class SacBaseModelControl {
1717
1722
  get inlineerrorenabled() {
1718
1723
  return this._inlineerrorenabled;
1719
1724
  }
1725
+ /**
1726
+ * Aktiviert oder Deaktiviert die Inline Errors für das Control
1727
+ */
1728
+ set inlineerrorenabled(value) {
1729
+ if (value === null || value === undefined) {
1730
+ this._inlineerrorenabled = null;
1731
+ }
1732
+ else {
1733
+ this._inlineerrorenabled = convertToBoolean(value);
1734
+ }
1735
+ }
1720
1736
  /**
1721
1737
  * Methode ergibt boolean Wert wenn Form invalid oder nicht invalid ist
1722
1738
  */
1723
1739
  get invalid() {
1724
- return (this.ngControl !== undefined &&
1725
- this.ngControl !== null &&
1726
- this.ngControl.invalid);
1740
+ return this.ngControl !== undefined && this.ngControl !== null && this.ngControl.invalid;
1727
1741
  }
1728
1742
  /**
1729
1743
  * Definiert ob das Control disabled ist
@@ -1739,8 +1753,7 @@ class SacBaseModelControl {
1739
1753
  if (this._inlineerrorenabled !== null) {
1740
1754
  return this._inlineerrorenabled;
1741
1755
  }
1742
- if (this.formlayout !== null &&
1743
- this.formlayout.IsInlineErrorEnabled !== null) {
1756
+ if (this.formlayout !== null && this.formlayout.IsInlineErrorEnabled !== null) {
1744
1757
  return (_a = this.formlayout) === null || _a === void 0 ? void 0 : _a.IsInlineErrorEnabled;
1745
1758
  }
1746
1759
  if (this.configurationService.InlineErrorEnabled !== null) {
@@ -1754,6 +1767,13 @@ class SacBaseModelControl {
1754
1767
  get label() {
1755
1768
  return this._label;
1756
1769
  }
1770
+ /**
1771
+ * Definiert den Label Text
1772
+ */
1773
+ set label(v) {
1774
+ this._label = v;
1775
+ this.UpdateLabelToControl();
1776
+ }
1757
1777
  /**
1758
1778
  * returns an object with all label sizes. These values can then be transferred to corresponding CSS classes using a pipe
1759
1779
  */
@@ -1771,7 +1791,7 @@ class SacBaseModelControl {
1771
1791
  * Methode ergibt Boolean Wert für touched
1772
1792
  */
1773
1793
  get touched() {
1774
- if (this.ngControl !== null) {
1794
+ if (this.ngControl !== null && this.ngControl !== undefined) {
1775
1795
  this._touched = this.ngControl.touched;
1776
1796
  }
1777
1797
  return this._touched;
@@ -1782,6 +1802,17 @@ class SacBaseModelControl {
1782
1802
  get value() {
1783
1803
  return this._value;
1784
1804
  }
1805
+ /**
1806
+ * Set Methode für NgModel Binding in Html Markup
1807
+ * Input wird benötigt, damit der Wert auch über das Markup gesetzt werden kann.
1808
+ */
1809
+ set value(v) {
1810
+ if (this.disabled) {
1811
+ return;
1812
+ }
1813
+ this._value = this.ConvertInputValue(v);
1814
+ this.propagateChange(this._value);
1815
+ }
1785
1816
  // #endregion Public Getters And Setters
1786
1817
  // #region Public Methods
1787
1818
  /**
@@ -1820,24 +1851,21 @@ class SacBaseModelControl {
1820
1851
  return this.lngResourceService.GetString(errorItem.errorMessageKey, parameters);
1821
1852
  }
1822
1853
  /**
1823
- * In Angular 10 the Control Label for Reactive Forms can be set first time here. With Angular 13 is supported by init in OnInit
1854
+ * Init Event
1824
1855
  */
1825
- ngAfterViewInit() {
1856
+ ngOnInit() {
1826
1857
  // receive form via formcontrolname or formcontrol instance
1827
1858
  const formControl = this.injector.get(NgControl, null);
1828
1859
  if (formControl instanceof FormControlName) {
1829
1860
  const form = this.injector.get(FormGroupDirective, null);
1830
1861
  this.ngControl = form.getControl(formControl);
1831
1862
  }
1832
- else if (formControl) {
1833
- this.ngControl = formControl.control;
1863
+ else {
1864
+ if (formControl) {
1865
+ this.ngControl = formControl.control;
1866
+ }
1834
1867
  }
1835
1868
  this.UpdateLabelToControl();
1836
- }
1837
- /**
1838
- * Init Event
1839
- */
1840
- ngOnInit() {
1841
1869
  // set label sizes from formlayout directive
1842
1870
  this.setLabelSizes();
1843
1871
  // set component heigth from fromlayout directive
@@ -1846,6 +1874,8 @@ class SacBaseModelControl {
1846
1874
  this.setIsAdaptiveLabel();
1847
1875
  // set method to display helptext
1848
1876
  this.setHelpTextMode();
1877
+ // set SplitMode for Labels
1878
+ this.setLabelSplitMode();
1849
1879
  this.OnClassInit();
1850
1880
  }
1851
1881
  /**
@@ -1899,7 +1929,7 @@ class SacBaseModelControl {
1899
1929
  writeValue(value) {
1900
1930
  this._value = value;
1901
1931
  }
1902
- // #endregion Public Abstract Methods
1932
+ // #endregion Public Methods
1903
1933
  // #region Protected Methods
1904
1934
  /**
1905
1935
  * Method can Overwriten in Parent Classes
@@ -2038,6 +2068,17 @@ class SacBaseModelControl {
2038
2068
  }
2039
2069
  }
2040
2070
  }
2071
+ setLabelSplitMode() {
2072
+ var _a;
2073
+ if (!this.splitlabelandhelptext) {
2074
+ if ((_a = this.formlayout) === null || _a === void 0 ? void 0 : _a.splitlabelandhelptext) {
2075
+ this.splitlabelandhelptext = this.formlayout.splitlabelandhelptext;
2076
+ }
2077
+ else {
2078
+ this.splitlabelandhelptext = this.configurationService.SplitLabelAndHelptext;
2079
+ }
2080
+ }
2081
+ }
2041
2082
  }
2042
2083
  SacBaseModelControl.decorators = [
2043
2084
  { type: Directive }
@@ -2061,6 +2102,7 @@ SacBaseModelControl.propDecorators = {
2061
2102
  labelSizeXs: [{ type: Input }],
2062
2103
  labelSizeXxl: [{ type: Input }],
2063
2104
  name: [{ type: Input }],
2105
+ splitlabelandhelptext: [{ type: Input }],
2064
2106
  inlineerrorenabled: [{ type: Input }],
2065
2107
  label: [{ type: Input }],
2066
2108
  value: [{ type: Input }]
@@ -2168,6 +2210,19 @@ function emailValidator(validationMessage, validationMessageSummary) {
2168
2210
  };
2169
2211
  }
2170
2212
 
2213
+ function equalsValueValidator(requiredvalue, validationMessage, validationMessageSummary) {
2214
+ return (control) => {
2215
+ if (control.value !== requiredvalue) {
2216
+ const parameters = new Map();
2217
+ parameters.set('EQUALSVALUE', requiredvalue);
2218
+ return CreateValidationError('equals', validationMessage, validationMessageSummary, parameters);
2219
+ }
2220
+ else {
2221
+ return null;
2222
+ }
2223
+ };
2224
+ }
2225
+
2171
2226
  // #region Variables
2172
2227
  /**
2173
2228
  * Moment
@@ -2381,6 +2436,19 @@ function multilanguageRequiredAnyValidator(languages, validationMessage, validat
2381
2436
  };
2382
2437
  }
2383
2438
 
2439
+ function notEqualsValueValidator(invalidValue, validationMessage, validationMessageSummary) {
2440
+ return (control) => {
2441
+ if (control.value === invalidValue) {
2442
+ const parameters = new Map();
2443
+ parameters.set('EQUALSVALUE', invalidValue);
2444
+ return CreateValidationError('notequals', validationMessage, validationMessageSummary, parameters);
2445
+ }
2446
+ else {
2447
+ return null;
2448
+ }
2449
+ };
2450
+ }
2451
+
2384
2452
  function patternValidator(pattern, validationMessage, validationMessageSummary) {
2385
2453
  return (control) => {
2386
2454
  const validator = Validators.pattern(pattern);
@@ -2406,15 +2474,10 @@ function requiredValidator(validationMessage, validationMessageSummary) {
2406
2474
  };
2407
2475
  }
2408
2476
 
2409
- /**
2410
- * Moment
2411
- */
2412
- const moment$1 = moment_;
2413
2477
  /**
2414
2478
  * Klasse mit Standard Validatoren
2415
2479
  */
2416
2480
  class Validation {
2417
- // #region Public Static Methods
2418
2481
  /**
2419
2482
  * Die Methode ist von jedem Validator aufgerufen. Die setzt sowohl den errorType des gerpüfte Item, als auch die ErrorMessage (gemäss von errorType, FieldName und Parameters).
2420
2483
  * @param errorType Typ den Fehler
@@ -2436,6 +2499,18 @@ class Validation {
2436
2499
  static email(validationMessage, validationMessageSummary) {
2437
2500
  return emailValidator(validationMessage, validationMessageSummary);
2438
2501
  }
2502
+ /**
2503
+ * Validator validate if value is the requiredValue
2504
+ * @param requiredValue Value that control should have
2505
+ * @param control Control to be validate
2506
+ * @param fieldName Label of control
2507
+ * @param validationMessage validation message near the control
2508
+ * @param validationMessageSummary validation inside the validation summary
2509
+
2510
+ */
2511
+ static equals(requiredValue, validationMessage, validationMessageSummary) {
2512
+ return equalsValueValidator(requiredValue, validationMessage, validationMessageSummary);
2513
+ }
2439
2514
  /**
2440
2515
  * Validator der prüft ob der Wert ein Datum ist.
2441
2516
  * @param control Control mit IDateTimeControl Interface implementierung
@@ -2556,6 +2631,17 @@ class Validation {
2556
2631
  static multilanguageRequiredAny(languages, validationMessage, validationMessageSummary) {
2557
2632
  return multilanguageRequiredAnyValidator(languages, validationMessage, validationMessageSummary);
2558
2633
  }
2634
+ /**
2635
+ * Validator validate if value is not the invalidValue
2636
+ * @param invalidValue Value that control doesn't should have
2637
+ * @param control Control to be validate
2638
+ * @param fieldName Label of control
2639
+ * @param validationMessage validation message near the control
2640
+ * @param validationMessageSummary validation inside the validation summary
2641
+ */
2642
+ static notequals(invalidValue, validationMessage, validationMessageSummary) {
2643
+ return notEqualsValueValidator(invalidValue, validationMessage, validationMessageSummary);
2644
+ }
2559
2645
  /**
2560
2646
  * Validierung mit einem RegEx Pattern
2561
2647
  * @param control Control das validiert werden soll.
@@ -2577,7 +2663,11 @@ class Validation {
2577
2663
  static required(validationMessage, validationMessageSummary) {
2578
2664
  return requiredValidator(validationMessage, validationMessageSummary);
2579
2665
  }
2580
- }
2666
+ }
2667
+ /**
2668
+ * Moment
2669
+ */
2670
+ const moment$1 = moment_;
2581
2671
 
2582
2672
  /**
2583
2673
  * Basis Komponente für SacRadiobuttonsCommon. Extends SacBaseModelControl
@@ -2692,62 +2782,67 @@ SacRadiobuttonsCommon.propDecorators = {
2692
2782
  * Basis Komponente für SacRadiobutton.
2693
2783
  */
2694
2784
  class SacRadiobuttonCommon {
2785
+ // #endregion Properties
2786
+ // #region Constructors
2695
2787
  /**
2696
2788
  * Konstruktor
2697
2789
  * @param SacRadioButtons
2790
+ * @param formlayout SacFormLayoutCommon to define scoped layout settings
2791
+ * @param injector Injector for injecting services
2698
2792
  */
2699
- constructor(sacRadioButtons) {
2793
+ constructor(sacRadioButtons, formlayout, injector) {
2700
2794
  this.sacRadioButtons = sacRadioButtons;
2795
+ this.injector = injector;
2796
+ // #region Properties
2701
2797
  /**
2702
- * ControlHeight enum for use in HTML markup
2798
+ * Boolean Property zum Ausblenden des Controls; default Wert - false
2703
2799
  */
2704
- this.ControlHeight = ControlHeight;
2800
+ this._hidden = false;
2705
2801
  /**
2706
- * Output Event
2802
+ * Form layout instance if exists
2707
2803
  */
2708
- this.onselectitem = new EventEmitter();
2804
+ this.formlayout = null;
2709
2805
  /**
2710
- * Boolean Property zum Ausblenden des Controls; default Wert - false
2806
+ * public public public public public public public public public public public public public ControlHeight enum for use in HTML markup
2711
2807
  */
2712
- this._hidden = false;
2808
+ this.ControlHeight = ControlHeight;
2713
2809
  /**
2714
2810
  * Unique Index für RadioButton
2715
2811
  */
2716
2812
  this._index = null;
2813
+ /**
2814
+ * Text to support the user during input.
2815
+ */
2816
+ this.helptext = '';
2817
+ /**
2818
+ * Output Event
2819
+ */
2820
+ this.onselectitem = new EventEmitter();
2821
+ this.formlayout = formlayout;
2822
+ this.configurationService = injector.get(SACCONFIGURATION_SERVICE, new SacDefaultConfigurationService());
2823
+ this.iconService = injector.get(SACICON_SERVICE, new SacDefaultIconService());
2717
2824
  // Registration des Controls in SacRadioButtons Container
2718
2825
  this.sacRadioButtons.RegisterRadioButton(this);
2719
2826
  }
2827
+ // #endregion Constructors
2828
+ // #region Public Getters And Setters
2720
2829
  /**
2721
- * Methode ergibt Boolean, ob Control disabled ist
2830
+ * Get Icon for Helptext Tooltip
2722
2831
  */
2723
- get isDisabled() {
2724
- return this.disabled || this.sacRadioButtons.disabled;
2832
+ get HelptextTooltipIcon() {
2833
+ return this.iconService.GenericHelptextIcon;
2725
2834
  }
2726
2835
  /**
2727
- * Setter für hidden Property
2836
+ * define the control height from parent control
2728
2837
  */
2729
- set hidden(v) {
2730
- if (v === null || v === undefined || typeof v === 'boolean') {
2731
- this._hidden = v;
2732
- }
2733
- else {
2734
- this._hidden = v === 'true';
2735
- }
2736
- // Model Reset falls RadioButton selektiert war
2737
- if (this._hidden && this.checked) {
2738
- this.sacRadioButtons.SelectItem(null);
2739
- }
2740
- }
2741
- get hidden() {
2742
- return this._hidden;
2838
+ get componentHeight() {
2839
+ return this.sacRadioButtons.componentHeight;
2743
2840
  }
2744
2841
  /**
2745
2842
  * Getter für Unique Index
2746
2843
  */
2747
2844
  get getIndex() {
2748
- if (this._index === null &&
2749
- this.sacRadioButtons !== null &&
2750
- this.sacRadioButtons !== undefined) {
2845
+ if (this._index === null && this.sacRadioButtons !== null && this.sacRadioButtons !== undefined) {
2751
2846
  this._index = this.sacRadioButtons.GetRadionButtonIndex();
2752
2847
  }
2753
2848
  return this._index;
@@ -2758,22 +2853,32 @@ class SacRadiobuttonCommon {
2758
2853
  get getName() {
2759
2854
  return this.sacRadioButtons.name;
2760
2855
  }
2856
+ get hidden() {
2857
+ return this._hidden;
2858
+ }
2761
2859
  /**
2762
- * define the control height from parent control
2860
+ * Setter für hidden Property
2763
2861
  */
2764
- get componentHeight() {
2765
- return this.sacRadioButtons.componentHeight;
2862
+ set hidden(v) {
2863
+ if (v === null || v === undefined || typeof v === 'boolean') {
2864
+ this._hidden = v;
2865
+ }
2866
+ else {
2867
+ this._hidden = v === 'true';
2868
+ }
2869
+ // Model Reset falls RadioButton selektiert war
2870
+ if (this._hidden && this.checked) {
2871
+ this.sacRadioButtons.SelectItem(null);
2872
+ }
2766
2873
  }
2767
- //#endregion
2768
- //#region Control Events
2769
2874
  /**
2770
- * Event wenn die Komponente zerstört wird
2875
+ * Methode ergibt Boolean, ob Control disabled ist
2771
2876
  */
2772
- ngOnDestroy() {
2773
- // De-Registration des Controls in SacRadioButtons Container
2774
- this.sacRadioButtons.UnregisterRadioButton(this);
2877
+ get isDisabled() {
2878
+ return this.disabled || this.sacRadioButtons.disabled;
2775
2879
  }
2776
- //#endregion
2880
+ // #endregion Public Getters And Setters
2881
+ // #region Public Methods
2777
2882
  /**
2778
2883
  * Event bei Änderungen
2779
2884
  */
@@ -2783,29 +2888,58 @@ class SacRadiobuttonCommon {
2783
2888
  this.onselectitem.emit();
2784
2889
  }
2785
2890
  }
2786
- }
2787
- SacRadiobuttonCommon.decorators = [
2788
- { type: Directive }
2789
- ];
2790
- SacRadiobuttonCommon.ctorParameters = () => [
2791
- { type: SacRadiobuttonsCommon }
2792
- ];
2793
- SacRadiobuttonCommon.propDecorators = {
2794
- value: [{ type: Input }],
2795
- label: [{ type: Input }],
2796
- checked: [{ type: Input }],
2797
- disabled: [{ type: Input }],
2798
- onselectitem: [{ type: Output }],
2799
- hidden: [{ type: Input }],
2800
- labeltemplate: [{ type: Input }]
2801
- };
2802
-
2803
- /**
2804
- * Base Komponente für Dialog
2891
+ /**
2892
+ * Event wenn die Komponente zerstört wird
2893
+ */
2894
+ ngOnDestroy() {
2895
+ // De-Registration des Controls in SacRadioButtons Container
2896
+ this.sacRadioButtons.UnregisterRadioButton(this);
2897
+ }
2898
+ ngOnInit() {
2899
+ // set method to display helptext
2900
+ this.setHelpTextMode();
2901
+ }
2902
+ // #endregion Public Methods
2903
+ // #region Private Methods
2904
+ /**
2905
+ * Set mode for helptext. Can be tooltip or text
2906
+ */
2907
+ setHelpTextMode() {
2908
+ var _a;
2909
+ if (!this.helptextmode) {
2910
+ if ((_a = this.formlayout) === null || _a === void 0 ? void 0 : _a.helptextmode) {
2911
+ this.helptextmode = this.formlayout.helptextmode;
2912
+ }
2913
+ else {
2914
+ this.helptextmode = this.configurationService.HelptextMode;
2915
+ }
2916
+ }
2917
+ }
2918
+ }
2919
+ SacRadiobuttonCommon.decorators = [
2920
+ { type: Directive }
2921
+ ];
2922
+ SacRadiobuttonCommon.ctorParameters = () => [
2923
+ { type: SacRadiobuttonsCommon },
2924
+ { type: SacFormLayoutCommon, decorators: [{ type: Host }] },
2925
+ { type: Injector }
2926
+ ];
2927
+ SacRadiobuttonCommon.propDecorators = {
2928
+ checked: [{ type: Input }],
2929
+ disabled: [{ type: Input }],
2930
+ helptext: [{ type: Input }],
2931
+ helptextmode: [{ type: Input }],
2932
+ label: [{ type: Input }],
2933
+ labeltemplate: [{ type: Input }],
2934
+ onselectitem: [{ type: Output }],
2935
+ value: [{ type: Input }],
2936
+ hidden: [{ type: Input }]
2937
+ };
2938
+
2939
+ /**
2940
+ * Base Komponente für Dialog
2805
2941
  */
2806
2942
  class SacDialogCommon {
2807
- // #endregion
2808
- // #region Constructor
2809
2943
  /**
2810
2944
  * Konstruktor
2811
2945
  * Inject des Formulars
@@ -2822,11 +2956,6 @@ class SacDialogCommon {
2822
2956
  * Die akzeptabel keywordssind: 'small', 'large', 'extralarge', 'medium', ''.
2823
2957
  */
2824
2958
  this._size = '';
2825
- // #region Properties
2826
- /**
2827
- * Input Property. Erhält den Title des Dialog. Default Value: 'Dialog'.
2828
- */
2829
- this.title = 'Dialog';
2830
2959
  /**
2831
2960
  * Das input property akzeptiert boolen Wert. Definiert ob das Dialog darf durch ESC geschlossen werden. Default ist true.
2832
2961
  */
@@ -2835,26 +2964,22 @@ class SacDialogCommon {
2835
2964
  * Das input property akzeptiert boolen Wert. Definiert ob das Dialog darf durch click außerhalb des Dialog-Fenster geschlossen werden. Default ist true.
2836
2965
  */
2837
2966
  this.backdrop = true;
2838
- /**
2839
- * Input Property. Erhält den Namen des Dialog - benutzt für das ID. Default Value: ''
2840
- */
2841
- this.name = '';
2842
2967
  /**
2843
2968
  * Steuert ob im Header des Dialogs ein Button angezeigt wird.
2844
2969
  */
2845
2970
  this.closebutton = true;
2846
2971
  /**
2847
- * Input Property. Erhält die Breite des Dialog
2972
+ * Output Emitter. Wird aufgerufen, wenn das Wert des _show property geändert ist - damait das Dialog geöfnet/geschlossen wird.
2848
2973
  */
2849
- this.width = null;
2974
+ this.isvisibleChange = new EventEmitter();
2850
2975
  /**
2851
- * Definiert eine feste Höhe beim Dialog.
2976
+ * Input Property. Erhält den Namen des Dialog - benutzt für das ID. Default Value: ''
2852
2977
  */
2853
- this.height = null;
2978
+ this.name = '';
2854
2979
  /**
2855
- * Output Emitter. Wird aufgerufen, wenn das Wert des _show property geändert ist - damait das Dialog geöfnet/geschlossen wird.
2980
+ * Input Property. Erhält den Title des Dialog. Default Value: 'Dialog'.
2856
2981
  */
2857
- this.isvisibleChange = new EventEmitter();
2982
+ this.title = 'Dialog';
2858
2983
  }
2859
2984
  /**
2860
2985
  * Implementation als Setter, da mit ngIf das Element bei Unsichtbarkeit UNDEFINED ist.
@@ -2863,14 +2988,10 @@ class SacDialogCommon {
2863
2988
  this.dialogElement = content;
2864
2989
  }
2865
2990
  /**
2866
- * Das Input akzeptiert sowohl default size-css-Klassen als auch custom Klassen.
2867
- * case insensitive.
2868
- * Die akzeptabel default-size-Klassen sind: 'small', 'large', 'extralarge', 'medium', ''.
2869
- * Wenn size ist NICHT gesetzt (oder 'medium' oder ''), default ist in medium size: max-width 500px.
2991
+ * Getter. Ergibt das boolen Wert des _show property
2870
2992
  */
2871
- set size(v) {
2872
- v = v.toLowerCase();
2873
- this._size = v;
2993
+ get isvisible() {
2994
+ return this._show;
2874
2995
  }
2875
2996
  /**
2876
2997
  * Setter. Erhält das boolen Wert des _show property
@@ -2891,77 +3012,40 @@ class SacDialogCommon {
2891
3012
  this._show = v;
2892
3013
  }
2893
3014
  /**
2894
- * Getter. Ergibt das boolen Wert des _show property
3015
+ * Das Input akzeptiert sowohl default size-css-Klassen als auch custom Klassen.
3016
+ * case insensitive.
3017
+ * Die akzeptabel default-size-Klassen sind: 'small', 'large', 'extralarge', 'medium', ''.
3018
+ * Wenn size ist NICHT gesetzt (oder 'medium' oder ''), default ist in medium size: max-width 500px.
2895
3019
  */
2896
- get isvisible() {
2897
- return this._show;
3020
+ set size(v) {
3021
+ this._size = v;
2898
3022
  }
2899
3023
  /**
2900
- * Die Funktion prüft ob es ein default css classe für Size des Dialog durch den size Input gesetzt wurde.
3024
+ * Getter for ChangeDetector.
2901
3025
  */
2902
- issetdefaultsize() {
2903
- let result = false;
2904
- switch (this._size) {
2905
- case 'small':
2906
- result = true;
2907
- break;
2908
- case 'medium':
2909
- result = true;
2910
- break;
2911
- case 'large':
2912
- result = true;
2913
- break;
2914
- case 'extralarge':
2915
- result = true;
2916
- break;
2917
- case '':
2918
- result = true;
2919
- break;
2920
- }
2921
- return result;
3026
+ get ChangeDetector() {
3027
+ return this.cdRef;
2922
3028
  }
2923
- // #endregion
2924
3029
  /**
2925
- * Methode wenn Componente entfernt wird
3030
+ * Die Methode setz den Wert des _show property auf false
2926
3031
  */
2927
- ngOnDestroy() {
3032
+ hide() {
2928
3033
  if (this.hasSetBodyTag && document.body.classList.contains('modal-open')) {
2929
3034
  document.body.classList.remove('modal-open');
2930
3035
  this.hasSetBodyTag = false;
2931
3036
  }
2932
- }
2933
- // #region Methods
2934
- /**
2935
- * Die Methode setz den Wert des _show property auf true
2936
- */
2937
- show() {
2938
- this._show = true;
2939
- if (!this.hasSetBodyTag &&
2940
- !document.body.classList.contains('modal-open')) {
2941
- document.body.classList.add('modal-open');
2942
- this.hasSetBodyTag = true;
2943
- }
3037
+ this._show = false;
2944
3038
  this.isvisibleChange.emit(this._show);
2945
3039
  }
2946
3040
  /**
2947
- * Die Methode setz den Wert des _show property auf false
3041
+ * Methode wenn Componente entfernt wird
2948
3042
  */
2949
- hide() {
3043
+ ngOnDestroy() {
2950
3044
  if (this.hasSetBodyTag && document.body.classList.contains('modal-open')) {
2951
3045
  document.body.classList.remove('modal-open');
2952
3046
  this.hasSetBodyTag = false;
2953
3047
  }
2954
- this._show = false;
2955
- this.isvisibleChange.emit(this._show);
2956
- }
2957
- /**
2958
- * Getter for ChangeDetector.
2959
- */
2960
- get ChangeDetector() {
2961
- return this.cdRef;
2962
3048
  }
2963
- // #endregion
2964
- // #region Host Actions
2965
3049
  /**
2966
3050
  * Allow Close by Click outside Dialog
2967
3051
  */
@@ -2983,6 +3067,18 @@ class SacDialogCommon {
2983
3067
  this.hide();
2984
3068
  }
2985
3069
  }
3070
+ /**
3071
+ * Die Methode setz den Wert des _show property auf true
3072
+ */
3073
+ show() {
3074
+ this._show = true;
3075
+ if (!this.hasSetBodyTag &&
3076
+ !document.body.classList.contains('modal-open')) {
3077
+ document.body.classList.add('modal-open');
3078
+ this.hasSetBodyTag = true;
3079
+ }
3080
+ this.isvisibleChange.emit(this._show);
3081
+ }
2986
3082
  }
2987
3083
  SacDialogCommon.decorators = [
2988
3084
  { type: Directive }
@@ -2991,17 +3087,15 @@ SacDialogCommon.ctorParameters = () => [
2991
3087
  { type: ChangeDetectorRef }
2992
3088
  ];
2993
3089
  SacDialogCommon.propDecorators = {
2994
- dialogElementSetter: [{ type: ViewChild, args: ['dialog', { static: false },] }],
2995
- title: [{ type: Input }],
2996
3090
  allowesc: [{ type: Input }],
2997
3091
  backdrop: [{ type: Input }],
2998
- name: [{ type: Input }],
2999
3092
  closebutton: [{ type: Input }],
3000
- width: [{ type: Input }],
3001
- height: [{ type: Input }],
3002
- size: [{ type: Input }],
3003
3093
  isvisibleChange: [{ type: Output }],
3094
+ name: [{ type: Input }],
3095
+ title: [{ type: Input }],
3096
+ dialogElementSetter: [{ type: ViewChild, args: ['dialog', { static: false },] }],
3004
3097
  isvisible: [{ type: Input }],
3098
+ size: [{ type: Input }],
3005
3099
  onClick: [{ type: HostListener, args: ['click', ['$event'],] }],
3006
3100
  onKeydownHandler: [{ type: HostListener, args: ['document:keydown', ['$event'],] }]
3007
3101
  };
@@ -3191,13 +3285,28 @@ SacBaseSelectControl.propDecorators = {
3191
3285
  groupitems: [{ type: Input }]
3192
3286
  };
3193
3287
 
3194
- // #region Classes
3288
+ /**
3289
+ * Function um ein Key Value Pair für das Dropdown zu erzeugen
3290
+ * @param id ID
3291
+ * @param value Wert der an das Element gebunden werden soll
3292
+ */
3293
+ function _buildValueString(id, value) {
3294
+ // Wenn ID null ist Object zurückgeben
3295
+ if (id == null) {
3296
+ return `${value}`;
3297
+ }
3298
+ // Mapping Objekt zu String
3299
+ if (value && typeof value === 'object') {
3300
+ value = 'Object';
3301
+ }
3302
+ // String als ID
3303
+ return `${id}: ${value}`.slice(0, 50);
3304
+ }
3305
+
3195
3306
  /**
3196
3307
  * Base Dropdown Komponente
3197
3308
  */
3198
3309
  class SacDropdownCommon extends SacBaseSelectControl {
3199
- // #endregion Properties
3200
- // #region Constructors
3201
3310
  /**
3202
3311
  * Constructor
3203
3312
  * @param formlayout SacFormLayoutCommon to define scoped layout settings
@@ -3209,11 +3318,18 @@ class SacDropdownCommon extends SacBaseSelectControl {
3209
3318
  super(formlayout, injector);
3210
3319
  this.renderer = renderer;
3211
3320
  this.elementRef = elementRef;
3212
- // #region Properties
3213
3321
  /**
3214
3322
  * compareWith-Funktion
3215
3323
  */
3216
3324
  this._compareWith = Object.is;
3325
+ /**
3326
+ * Counter vom OptionID; default Wert = 0
3327
+ */
3328
+ this._optionIdCounter = 0;
3329
+ /**
3330
+ * OptionMap
3331
+ */
3332
+ this._optionMap = new Map();
3217
3333
  /**
3218
3334
  * Label Text für Empty Item
3219
3335
  */
@@ -3230,17 +3346,7 @@ class SacDropdownCommon extends SacBaseSelectControl {
3230
3346
  * Resource Key für Validation Message Required in Validation Summary
3231
3347
  */
3232
3348
  this.validationmessagesummaryrequired = this.validationKeyService.ValidationErrorSummaryRequired;
3233
- /**
3234
- * Counter vom OptionID; default Wert = 0
3235
- */
3236
- this._optionIdCounter = 0;
3237
- /**
3238
- * OptionMap
3239
- */
3240
- this._optionMap = new Map();
3241
3349
  }
3242
- // #endregion Constructors
3243
- // #region Public Getters And Setters
3244
3350
  /**
3245
3351
  * compareWith-Funktion
3246
3352
  */
@@ -3250,8 +3356,6 @@ class SacDropdownCommon extends SacBaseSelectControl {
3250
3356
  }
3251
3357
  this._compareWith = fn;
3252
3358
  }
3253
- // #endregion Public Getters And Setters
3254
- // #region Public Methods
3255
3359
  /**
3256
3360
  * Registriert das OptionID-Counter als String
3257
3361
  */
@@ -3286,6 +3390,12 @@ class SacDropdownCommon extends SacBaseSelectControl {
3286
3390
  if (this.isrequired) {
3287
3391
  error = Validation.required(this.validationmessagerequired, this.validationmessagesummaryrequired)(c);
3288
3392
  }
3393
+ if (error) {
3394
+ return error;
3395
+ }
3396
+ if (this.isrequired && this.emptyvalue !== null) {
3397
+ error = Validation.notequals(this.emptyvalue, this.validationmessagerequired, this.validationmessagesummaryrequired)(c);
3398
+ }
3289
3399
  return error;
3290
3400
  }
3291
3401
  /**
@@ -3296,8 +3406,6 @@ class SacDropdownCommon extends SacBaseSelectControl {
3296
3406
  this.setSelectedValue(value);
3297
3407
  super.writeValue(value);
3298
3408
  }
3299
- // #endregion Public Methods
3300
- // #region Private Methods
3301
3409
  /**
3302
3410
  * ID extrahieren
3303
3411
  * @param valueString String bei welchem die ID Extrahiert werden soll
@@ -3360,13 +3468,12 @@ SacDropdownCommon.propDecorators = {
3360
3468
  validationmessagerequired: [{ type: Input }],
3361
3469
  validationmessagesummaryrequired: [{ type: Input }],
3362
3470
  comparewith: [{ type: Input }]
3363
- };
3471
+ };
3472
+
3364
3473
  /**
3365
3474
  * SacDropdownOption-Klasse
3366
3475
  */
3367
3476
  class SacDropdownOptionCommon {
3368
- // #endregion Properties
3369
- // #region Constructors
3370
3477
  /**
3371
3478
  * Konstruktor
3372
3479
  * @param _element Referenz auf HTML Element
@@ -3377,7 +3484,6 @@ class SacDropdownOptionCommon {
3377
3484
  this._element = _element;
3378
3485
  this._renderer = _renderer;
3379
3486
  this._dropdown = _dropdown;
3380
- // #region Properties
3381
3487
  /**
3382
3488
  * ID-String
3383
3489
  */
@@ -3386,8 +3492,6 @@ class SacDropdownOptionCommon {
3386
3492
  this.id = this._dropdown.registerOption();
3387
3493
  }
3388
3494
  }
3389
- // #endregion Constructors
3390
- // #region Public Getters And Setters
3391
3495
  /**
3392
3496
  * Option ngValue
3393
3497
  */
@@ -3406,8 +3510,6 @@ class SacDropdownOptionCommon {
3406
3510
  set value(value) {
3407
3511
  this._setElementValue(value);
3408
3512
  }
3409
- // #endregion Public Getters And Setters
3410
- // #region Public Methods
3411
3513
  /**
3412
3514
  * Den Wert vom Option-Element einstellen
3413
3515
  * @param value Wert
@@ -3435,27 +3537,7 @@ SacDropdownOptionCommon.ctorParameters = () => [
3435
3537
  SacDropdownOptionCommon.propDecorators = {
3436
3538
  ngValue: [{ type: Input }],
3437
3539
  value: [{ type: Input }]
3438
- };
3439
- // #endregion Classes
3440
- // #region Functions
3441
- /**
3442
- * Function um ein Key Value Pair für das Dropdown zu erzeugen
3443
- * @param id ID
3444
- * @param value Wert der an das Element gebunden werden soll
3445
- */
3446
- function _buildValueString(id, value) {
3447
- // Wenn ID null ist Object zurückgeben
3448
- if (id == null) {
3449
- return `${value}`;
3450
- }
3451
- // Mapping Objekt zu String
3452
- if (value && typeof value === 'object') {
3453
- value = 'Object';
3454
- }
3455
- // String als ID
3456
- return `${id}: ${value}`.slice(0, 50);
3457
- }
3458
- // #endregion Functions
3540
+ };
3459
3541
 
3460
3542
  // tsco:ignore
3461
3543
  // #endregion Interfaces
@@ -5272,38 +5354,439 @@ SacPagingCommon.propDecorators = {
5272
5354
  };
5273
5355
 
5274
5356
  /**
5275
- * Moment
5276
- */
5277
- const moment$2 = moment_;
5278
- /**
5279
- * Base Klasse für Date/Time Controls
5357
+ * Enum für Tooltip Positionen
5280
5358
  */
5281
- class SacBaseDateTimeControl extends SacBaseModelControl {
5282
- // #endregion Properties
5283
- // #region Constructors
5284
- /**
5285
- * Constructor
5286
- * @param formlayout SacFormLayoutCommon to define scoped layout settings
5287
- * @param injector Injector for injecting services
5288
- * @param elementRef reference to html element
5289
- */
5290
- constructor(formlayout, injector, elementRef) {
5291
- super(formlayout, injector);
5292
- this.elementRef = elementRef;
5293
- // #region Properties
5294
- /**
5295
- * das property enthielt das Value als string. Default ist ''
5296
- */
5297
- this._valueAsString = '';
5298
- /**
5299
- * Definiert das Control als Required
5300
- */
5301
- this.isrequired = false;
5302
- /**
5303
- * TextBox Placeholder
5304
- */
5305
- this.placeholder = null;
5306
- /**
5359
+ var TooltipPosition;
5360
+ (function (TooltipPosition) {
5361
+ TooltipPosition[TooltipPosition["none"] = 0] = "none";
5362
+ // tslint:disable-next-line:no-bitwise
5363
+ TooltipPosition[TooltipPosition["top"] = 1] = "top";
5364
+ // tslint:disable-next-line:no-bitwise
5365
+ TooltipPosition[TooltipPosition["right"] = 2] = "right";
5366
+ // tslint:disable-next-line:no-bitwise
5367
+ TooltipPosition[TooltipPosition["bottom"] = 4] = "bottom";
5368
+ // tslint:disable-next-line:no-bitwise
5369
+ TooltipPosition[TooltipPosition["left"] = 8] = "left";
5370
+ // tslint:disable-next-line:no-bitwise
5371
+ TooltipPosition[TooltipPosition["topend"] = 16] = "topend";
5372
+ // tslint:disable-next-line:no-bitwise
5373
+ TooltipPosition[TooltipPosition["bottomend"] = 32] = "bottomend";
5374
+ })(TooltipPosition || (TooltipPosition = {}));
5375
+
5376
+ class PopUpHelper {
5377
+ // #region Public Methods
5378
+ getContainerHeight(referenceContainer, referenceIsContainer) {
5379
+ if (referenceContainer) {
5380
+ return referenceIsContainer
5381
+ ? referenceContainer.nativeElement.firstElementChild.clientHeight
5382
+ : referenceContainer.nativeElement.offsetHeight;
5383
+ }
5384
+ else {
5385
+ return 0;
5386
+ }
5387
+ }
5388
+ getContainerWidth(referenceContainer, referenceIsContainer) {
5389
+ if (referenceContainer) {
5390
+ return referenceIsContainer
5391
+ ? referenceContainer.nativeElement.firstElementChild.clientWidth
5392
+ : referenceContainer.nativeElement.offsetWidth;
5393
+ }
5394
+ else {
5395
+ return 0;
5396
+ }
5397
+ }
5398
+ /**
5399
+ * Get Position who the popup would be positioned
5400
+ *
5401
+ * @param referenceContainer Element Reference to HTML Element which is the reference to positioning the popup
5402
+ * @param popupcontentcontainer Element Reference to container of popup
5403
+ * @param popupOffset Offset for popup positioning
5404
+ * @param allowedPositions Allowed Positions for the popup
5405
+ * @returns Returns the position where the popup should be displayed
5406
+ */
5407
+ getDisplayPosition(referenceContainer, popupcontentcontainer, arrowWidth, arrowHeight, allowedPositions, referenceIsContainer) {
5408
+ const validPositions = this.validatePositions(referenceContainer, popupcontentcontainer, arrowWidth, arrowHeight, referenceIsContainer);
5409
+ // tslint:disable-next-line:no-bitwise
5410
+ if (this.hasPosition(allowedPositions, TooltipPosition.right) && validPositions & TooltipPosition.right) {
5411
+ return TooltipPosition.right;
5412
+ }
5413
+ // tslint:disable-next-line:no-bitwise
5414
+ if (this.hasPosition(allowedPositions, TooltipPosition.top) && validPositions & TooltipPosition.top) {
5415
+ return TooltipPosition.top;
5416
+ }
5417
+ // tslint:disable-next-line:no-bitwise
5418
+ if (this.hasPosition(allowedPositions, TooltipPosition.left) && validPositions & TooltipPosition.left) {
5419
+ return TooltipPosition.left;
5420
+ }
5421
+ // tslint:disable-next-line:no-bitwise
5422
+ if (this.hasPosition(allowedPositions, TooltipPosition.bottom) && validPositions & TooltipPosition.bottom) {
5423
+ return TooltipPosition.bottom;
5424
+ }
5425
+ if (this.hasPosition(allowedPositions, TooltipPosition.topend) && validPositions & TooltipPosition.topend) {
5426
+ return TooltipPosition.topend;
5427
+ }
5428
+ if (this.hasPosition(allowedPositions, TooltipPosition.bottomend) &&
5429
+ validPositions & TooltipPosition.bottomend) {
5430
+ return TooltipPosition.bottomend;
5431
+ }
5432
+ // Get Auto Position or Default
5433
+ if (this.isAutoPosition(allowedPositions)) {
5434
+ // tslint:disable-next-line:no-bitwise
5435
+ if (validPositions & TooltipPosition.right) {
5436
+ return TooltipPosition.right;
5437
+ }
5438
+ // tslint:disable-next-line:no-bitwise
5439
+ if (validPositions & TooltipPosition.top) {
5440
+ return TooltipPosition.top;
5441
+ }
5442
+ // tslint:disable-next-line:no-bitwise
5443
+ if (validPositions & TooltipPosition.left) {
5444
+ return TooltipPosition.left;
5445
+ }
5446
+ // tslint:disable-next-line:no-bitwise
5447
+ if (validPositions & TooltipPosition.bottom) {
5448
+ return TooltipPosition.bottom;
5449
+ }
5450
+ return TooltipPosition.right;
5451
+ }
5452
+ else {
5453
+ return this.getPosition(allowedPositions);
5454
+ }
5455
+ }
5456
+ /**
5457
+ * Calculates the height of the popup
5458
+ *
5459
+ * @param container Element Reference to container of popup
5460
+ */
5461
+ getPopupHeight(container) {
5462
+ var _a;
5463
+ if (container) {
5464
+ return (_a = container.nativeElement.firstElementChild.clientHeight) !== null && _a !== void 0 ? _a : 0;
5465
+ }
5466
+ else {
5467
+ return 0;
5468
+ }
5469
+ }
5470
+ /**
5471
+ * Calculates the width of the popup
5472
+ *
5473
+ * @param container Element Reference to container of popup
5474
+ */
5475
+ getPopupWidth(container) {
5476
+ if (container) {
5477
+ return container.nativeElement.firstElementChild.clientWidth;
5478
+ }
5479
+ else {
5480
+ return 0;
5481
+ }
5482
+ }
5483
+ /**
5484
+ * Returns the defined position for the tooltip
5485
+ *
5486
+ * @param allowedPositions Allowed positions defined in markup for popup
5487
+ */
5488
+ getPosition(allowedPositions) {
5489
+ if (this.hasPosition(allowedPositions, TooltipPosition.left)) {
5490
+ return TooltipPosition.left;
5491
+ }
5492
+ if (this.hasPosition(allowedPositions, TooltipPosition.top)) {
5493
+ return TooltipPosition.top;
5494
+ }
5495
+ if (this.hasPosition(allowedPositions, TooltipPosition.right)) {
5496
+ return TooltipPosition.right;
5497
+ }
5498
+ if (this.hasPosition(allowedPositions, TooltipPosition.bottom)) {
5499
+ return TooltipPosition.bottom;
5500
+ }
5501
+ if (this.hasPosition(allowedPositions, TooltipPosition.topend)) {
5502
+ return TooltipPosition.topend;
5503
+ }
5504
+ if (this.hasPosition(allowedPositions, TooltipPosition.bottomend)) {
5505
+ return TooltipPosition.bottomend;
5506
+ }
5507
+ // Default Position if empty
5508
+ return TooltipPosition.right;
5509
+ }
5510
+ /**
5511
+ * Calculates the position of the tooltip from links
5512
+ *
5513
+ * @param controlReference Element Reference to angular component
5514
+ * @param popupContainer Element Reference to container of popup
5515
+ * @param referenceContainer Element Reference to HTML Element which is the reference to positioning the popup
5516
+ * @param popupOffset Offset for popup positioning
5517
+ * @param requestedPosition Requested Position by Control
5518
+ */
5519
+ getPositionLeft(referenceContainer, popupContainer, controlReference, arrowWidth, arrowHeight, requestedPosition, referenceIsContainer) {
5520
+ if (referenceContainer !== null && referenceContainer !== undefined) {
5521
+ const item = referenceContainer.nativeElement;
5522
+ if (item.children.length >= 1) {
5523
+ const childItem = referenceIsContainer ? item.firstElementChild : item;
5524
+ const contentPosition = childItem.getBoundingClientRect();
5525
+ switch (this.getDisplayPosition(referenceContainer, popupContainer, arrowWidth, arrowHeight, requestedPosition, referenceIsContainer)) {
5526
+ case TooltipPosition.top:
5527
+ case TooltipPosition.bottom:
5528
+ return (contentPosition.left + contentPosition.width / 2 - this.getPopupWidth(popupContainer) / 2);
5529
+ case TooltipPosition.topend:
5530
+ case TooltipPosition.bottomend:
5531
+ return contentPosition.left + contentPosition.width - this.getPopupWidth(popupContainer);
5532
+ case TooltipPosition.right:
5533
+ return contentPosition.left + contentPosition.width + arrowWidth / 2;
5534
+ case TooltipPosition.left:
5535
+ return contentPosition.left - this.getPopupWidth(popupContainer) + (arrowWidth / 2) * -1;
5536
+ }
5537
+ return referenceContainer.nativeElement.offsetTop;
5538
+ }
5539
+ else {
5540
+ return referenceContainer.nativeElement.offsetTop;
5541
+ }
5542
+ }
5543
+ else {
5544
+ return controlReference.nativeElement.offsetLeft;
5545
+ }
5546
+ }
5547
+ /**
5548
+ * Calculates the position of the tooltip from the top
5549
+ *
5550
+ * @param controlReference Element Reference to angular component
5551
+ * @param popupContainer Element Reference to container of popup
5552
+ * @param referenceContainer Element Reference to HTML Element which is the reference to positioning the popup
5553
+ * @param popupOffset Offset for popup positioning
5554
+ * @param requestedPosition Requested Position by Control
5555
+ */
5556
+ getPositionTop(referenceContainer, popupContainer, controlReference, arrowWidth, arrowHeight, requestedPosition, referenceIsContainer) {
5557
+ if (referenceContainer !== null && referenceContainer !== undefined) {
5558
+ const item = referenceContainer.nativeElement;
5559
+ if (item.children.length >= 1) {
5560
+ const childItem = referenceIsContainer ? item.firstElementChild : item;
5561
+ const contentPosition = childItem.getBoundingClientRect();
5562
+ // Get Position with Scroll (Scrollbars inside page should be substracted)
5563
+ const contentPositionTop = childItem.offsetTop +
5564
+ this.getOffsetTopParent(childItem.offsetParent) +
5565
+ this.getScrollTopParent(childItem.parentElement);
5566
+ switch (this.getDisplayPosition(referenceContainer, popupContainer, arrowWidth, arrowHeight, requestedPosition, referenceIsContainer)) {
5567
+ case TooltipPosition.top:
5568
+ case TooltipPosition.topend:
5569
+ return contentPositionTop - this.getPopupHeight(popupContainer) + (arrowHeight / 2) * -1;
5570
+ case TooltipPosition.right:
5571
+ case TooltipPosition.left:
5572
+ return (contentPositionTop + contentPosition.height / 2 - this.getPopupHeight(popupContainer) / 2);
5573
+ case TooltipPosition.bottom:
5574
+ case TooltipPosition.bottomend:
5575
+ return contentPositionTop + contentPosition.height + arrowHeight / 2;
5576
+ }
5577
+ return (childItem.clientTop +
5578
+ childItem.offsetTop -
5579
+ (this.getPopupHeight(popupContainer) / 2 - childItem.offsetHeight / 2));
5580
+ }
5581
+ else {
5582
+ return referenceContainer.nativeElement.offsetTop;
5583
+ }
5584
+ }
5585
+ else {
5586
+ return controlReference.nativeElement.offsetTop;
5587
+ }
5588
+ }
5589
+ /**
5590
+ * Returns whether the position has been configured
5591
+ *
5592
+ * @param allowedPositions Positions that allowed by control
5593
+ * @param requestedPosition Position to be checked
5594
+ */
5595
+ hasPosition(allowedPositions, requestedPosition) {
5596
+ const positions = allowedPositions.split('|');
5597
+ if (requestedPosition === TooltipPosition.right && positions.indexOf('right') >= 0) {
5598
+ return true;
5599
+ }
5600
+ if (requestedPosition === TooltipPosition.top && positions.indexOf('top') >= 0) {
5601
+ return true;
5602
+ }
5603
+ if (requestedPosition === TooltipPosition.left && positions.indexOf('left') >= 0) {
5604
+ return true;
5605
+ }
5606
+ if (requestedPosition === TooltipPosition.bottom && positions.indexOf('bottom') >= 0) {
5607
+ return true;
5608
+ }
5609
+ if (requestedPosition === TooltipPosition.topend && positions.indexOf('topend') >= 0) {
5610
+ return true;
5611
+ }
5612
+ if (requestedPosition === TooltipPosition.bottomend && positions.indexOf('bottomend') >= 0) {
5613
+ return true;
5614
+ }
5615
+ return false;
5616
+ }
5617
+ /**
5618
+ * Defines whether AutoPosition is active
5619
+ * @param positionProperty List of allowed positions
5620
+ */
5621
+ isAutoPosition(positionProperty) {
5622
+ const positions = positionProperty.split('|');
5623
+ return positions.indexOf('auto') >= 0;
5624
+ }
5625
+ /**
5626
+ * Checks whether the position is valid or whether the tooltip on the position has space
5627
+ */
5628
+ validatePositions(referenceContainer, popupcontentcontainer, arrowWidth, arrowHeight, referenceIsContainer) {
5629
+ // Check if Container is false
5630
+ if (popupcontentcontainer === undefined) {
5631
+ return TooltipPosition.right;
5632
+ }
5633
+ let allowedPositions = TooltipPosition.none;
5634
+ const basePosition = referenceIsContainer
5635
+ ? referenceContainer.nativeElement.firstElementChild.getBoundingClientRect()
5636
+ : referenceContainer.nativeElement.getBoundingClientRect();
5637
+ const tooltipRect = popupcontentcontainer.nativeElement.firstElementChild.getBoundingClientRect();
5638
+ const leftPosOk = basePosition.left - tooltipRect.width + arrowWidth * -1 > 0;
5639
+ const rightPosOk = basePosition.right + tooltipRect.width + arrowWidth < window.innerWidth;
5640
+ const topPosOk = basePosition.top - tooltipRect.height + arrowHeight > 0;
5641
+ const bottomPosOk = basePosition.bottom + tooltipRect.height + arrowHeight < window.innerHeight;
5642
+ const leftHalfPosOk = basePosition.left - tooltipRect.width / 2 > 0;
5643
+ const rightHalfPosOk = basePosition.right + tooltipRect.width / 2 < window.innerWidth;
5644
+ const topHalfPosOk = basePosition.top - tooltipRect.height / 2 > 0;
5645
+ const bottomHalfPosOk = basePosition.bottom + tooltipRect.height / 2 < window.innerHeight;
5646
+ if (leftPosOk && topPosOk) {
5647
+ // tslint:disable-next-line:no-bitwise
5648
+ allowedPositions = allowedPositions | TooltipPosition.topend;
5649
+ }
5650
+ if (leftPosOk && bottomPosOk) {
5651
+ // tslint:disable-next-line:no-bitwise
5652
+ allowedPositions = allowedPositions | TooltipPosition.bottomend;
5653
+ }
5654
+ if (leftPosOk && topHalfPosOk && bottomHalfPosOk) {
5655
+ // tslint:disable-next-line:no-bitwise
5656
+ allowedPositions = allowedPositions | TooltipPosition.left;
5657
+ }
5658
+ if (rightPosOk && topHalfPosOk && bottomHalfPosOk) {
5659
+ // tslint:disable-next-line:no-bitwise
5660
+ allowedPositions = allowedPositions | TooltipPosition.right;
5661
+ }
5662
+ if (topPosOk && leftHalfPosOk && rightHalfPosOk) {
5663
+ // tslint:disable-next-line:no-bitwise
5664
+ allowedPositions = allowedPositions | TooltipPosition.top;
5665
+ }
5666
+ if (bottomPosOk && leftHalfPosOk && rightHalfPosOk) {
5667
+ // tslint:disable-next-line:no-bitwise
5668
+ allowedPositions = allowedPositions | TooltipPosition.bottom;
5669
+ }
5670
+ return allowedPositions;
5671
+ }
5672
+ // #endregion Public Methods
5673
+ // #region Private Methods
5674
+ /**
5675
+ * Calculates the top of the page inside all elements
5676
+ * @param element HTML Element
5677
+ * @returns summarized top value for absolute position
5678
+ */
5679
+ getOffsetTopParent(element) {
5680
+ if (element === null) {
5681
+ return 0;
5682
+ }
5683
+ if (!element.offsetParent) {
5684
+ return element.offsetTop;
5685
+ }
5686
+ const parentValue = this.getOffsetTopParent(element.offsetParent);
5687
+ let offset = element.offsetTop;
5688
+ return parentValue + offset;
5689
+ }
5690
+ /**
5691
+ * Caclulate Scrollbars inside tree
5692
+ * @param element HTML Element
5693
+ * @param [isFixed=false] Invert Scroll Position value when style is fixed to preserve negative values
5694
+ * @returns Scroll top value of element with all childs
5695
+ */
5696
+ getScrollTopParent(element, isFixed = false) {
5697
+ if (element === null) {
5698
+ return 0;
5699
+ }
5700
+ // Body Scroll should not be calculated
5701
+ if (!element.parentElement) {
5702
+ return isFixed ? element.scrollTop : 0;
5703
+ }
5704
+ let isCurrentFixed = false;
5705
+ if (window.getComputedStyle(element).getPropertyValue('position') === 'fixed') {
5706
+ isCurrentFixed = true;
5707
+ }
5708
+ const parentValue = this.getScrollTopParent(element.parentElement, isFixed || isCurrentFixed);
5709
+ if (isFixed) {
5710
+ return parentValue + element.scrollTop;
5711
+ }
5712
+ else {
5713
+ return parentValue + element.scrollTop * -1;
5714
+ }
5715
+ }
5716
+ }
5717
+
5718
+ /**
5719
+ * Base Klasse für Date/Time Controls
5720
+ */
5721
+ class SacBaseDateTimeControl extends SacBaseModelControl {
5722
+ // #endregion Properties
5723
+ // #region Constructors
5724
+ /**
5725
+ * Constructor
5726
+ * @param formlayout SacFormLayoutCommon to define scoped layout settings
5727
+ * @param injector Injector for injecting services
5728
+ * @param elementRef reference to html element
5729
+ */
5730
+ constructor(formlayout, injector, elementRef, cdRef) {
5731
+ super(formlayout, injector);
5732
+ this.elementRef = elementRef;
5733
+ this.cdRef = cdRef;
5734
+ // #region Properties
5735
+ /**
5736
+ * Helper class to display tooltip on correct position
5737
+ */
5738
+ this.popupHelper = new PopUpHelper();
5739
+ /**
5740
+ * das property enthielt das Value als string. Default ist ''
5741
+ */
5742
+ this._valueAsString = '';
5743
+ /**
5744
+ * Property for enum in Angular HTML template
5745
+ */
5746
+ this.TooltipPosition = TooltipPosition;
5747
+ /**
5748
+ * Definiert ob der Date Selector angezeigt wird
5749
+ */
5750
+ this._showselector = false;
5751
+ /**
5752
+ * Definiert das Control als Required
5753
+ */
5754
+ this.isrequired = false;
5755
+ /**
5756
+ * Moment JS Instance
5757
+ */
5758
+ this.moment = moment_;
5759
+ /**
5760
+ * Arrow Item of Picker Element. Required to set the position of arrow correctly
5761
+ */
5762
+ this.pickerPosition = TooltipPosition;
5763
+ /**
5764
+ * TextBox Placeholder
5765
+ */
5766
+ this.placeholder = null;
5767
+ /**
5768
+ * Position of the picker arrow at the left
5769
+ */
5770
+ this.posArrowLeft = null;
5771
+ /**
5772
+ * Position of the picker arrow at the top
5773
+ */
5774
+ this.posArrowTop = null;
5775
+ /**
5776
+ * Position of the picker at the left
5777
+ */
5778
+ this.posPopupLeft = 0;
5779
+ /**
5780
+ * Position of the picker at the top
5781
+ */
5782
+ this.posPopupTop = 0;
5783
+ /**
5784
+ * Position of the datetime picker. Values: left|top|right|bottom|auto
5785
+ *
5786
+ * Value 'auto' can be combined with another value.
5787
+ */
5788
+ this.position = 'bottomend|topend';
5789
+ /**
5307
5790
  * Resource Key für Validation Message DateTimeFormat bei Control
5308
5791
  */
5309
5792
  this.validationmessagedatetimeformat = this.validationKeyService.ValidationErrorDatetimeFormat;
@@ -5319,15 +5802,56 @@ class SacBaseDateTimeControl extends SacBaseModelControl {
5319
5802
  * Resource Key für Validation Message Required in Validation Summary
5320
5803
  */
5321
5804
  this.validationmessagerequiredsummary = this.validationKeyService.ValidationErrorSummaryRequired;
5805
+ // #endregion Protected Methods
5806
+ // #region Private Methods
5807
+ /**
5808
+ * method if content has changed and proportions need to be reset in the UI.
5809
+ */
5810
+ this.onContentChange = () => {
5811
+ // Do nothing if is not visible
5812
+ if (!this._showselector) {
5813
+ return;
5814
+ }
5815
+ setTimeout(() => {
5816
+ this.getPositionLeft();
5817
+ this.getPositionTop();
5818
+ });
5819
+ };
5820
+ }
5821
+ // #endregion Constructors
5822
+ // #region Public Getters And Setters
5823
+ /**
5824
+ * Setter for the name of the container for the tooltip. Is required as the tooltip can be hidden via ngIf.
5825
+ */
5826
+ set picker(picker) {
5827
+ if (picker !== undefined) {
5828
+ document.body.appendChild(picker.nativeElement);
5829
+ }
5830
+ this.pickercontainer = picker;
5831
+ this.onContentChange();
5832
+ this.cdRef.detectChanges();
5833
+ }
5834
+ get tooltop() {
5835
+ return this.pickercontainer;
5836
+ }
5837
+ /**
5838
+ * getter für valuestring
5839
+ */
5840
+ get valuestring() {
5841
+ if (this.value === null) {
5842
+ return this._valueAsString;
5843
+ }
5844
+ else {
5845
+ const date = this.moment.utc(this.value);
5846
+ return date.local().format(this.GetDateTimeFormatString());
5847
+ }
5322
5848
  }
5323
- // #endregion Constructors
5324
- // #region Public Getters And Setters
5325
5849
  /**
5326
5850
  * Das Input bekommt das value von typ string
5327
5851
  */
5328
5852
  set valuestring(v) {
5329
5853
  this._valueAsString = v;
5330
- let date = moment$2(v, [this.GetDateTimeFormatString()], true);
5854
+ let date = this.moment(v, [this.GetDateTimeFormatString()], true);
5331
5855
  date = this.ModifyParsedDateTimeValue(date).utc();
5332
5856
  if (date.isValid()) {
5333
5857
  this.value = date.toDate();
@@ -5337,19 +5861,11 @@ class SacBaseDateTimeControl extends SacBaseModelControl {
5337
5861
  }
5338
5862
  }
5339
5863
  /**
5340
- * getter für valuestring
5864
+ * Returns the position of the tooltip
5341
5865
  */
5342
- get valuestring() {
5343
- if (this.value === null) {
5344
- return this._valueAsString;
5345
- }
5346
- else {
5347
- const date = moment$2.utc(this.value);
5348
- return date.local().format(this.GetDateTimeFormatString());
5349
- }
5866
+ GetPickerPosition() {
5867
+ return this.popupHelper.getDisplayPosition(this.pickerbutton, this.pickercontainer, this.getArrowWidth(), this.getArrowHeight(), this.position, false);
5350
5868
  }
5351
- // #endregion Public Getters And Setters
5352
- // #region Public Methods
5353
5869
  /**
5354
5870
  * JSON Date String in ein UTC DateTime Object konvertieren, welches vom Control verwendete werden kann
5355
5871
  */
@@ -5361,14 +5877,37 @@ class SacBaseDateTimeControl extends SacBaseModelControl {
5361
5877
  const hours = date.getUTCHours();
5362
5878
  const minutes = date.getUTCMinutes();
5363
5879
  const seconds = date.getUTCSeconds();
5364
- return moment$2(Date.UTC(year, month, day, hours, minutes, seconds));
5880
+ return this.moment(Date.UTC(year, month, day, hours, minutes, seconds));
5881
+ }
5882
+ /**
5883
+ * Calculates the height of the tooltip
5884
+ */
5885
+ getPickerHeight() {
5886
+ return this.popupHelper.getPopupHeight(this.pickercontainer);
5887
+ }
5888
+ /**
5889
+ * Calculates the width of the picker
5890
+ */
5891
+ getPickerWidth() {
5892
+ return this.popupHelper.getPopupWidth(this.pickercontainer);
5893
+ }
5894
+ ngDoCheck() {
5895
+ // this.onContentChange();
5896
+ }
5897
+ ngOnDestroy() {
5898
+ // Unregister Event Listener
5899
+ window.removeEventListener('scroll', this.onContentChange, true);
5900
+ window.removeEventListener('resize', this.onContentChange, true);
5365
5901
  }
5366
5902
  /**
5367
5903
  * Init Event
5368
5904
  */
5369
- ngAfterViewInit() {
5370
- super.ngAfterViewInit();
5371
- this.SetDateTimeFormat();
5905
+ ngOnInit() {
5906
+ super.ngOnInit();
5907
+ this.setDateTimeFormat();
5908
+ // Register Event Listener
5909
+ window.addEventListener('scroll', this.onContentChange, true);
5910
+ window.addEventListener('resize', this.onContentChange, true);
5372
5911
  }
5373
5912
  /**
5374
5913
  * setzt das value von typ string zu property valuestring
@@ -5402,13 +5941,59 @@ class SacBaseDateTimeControl extends SacBaseModelControl {
5402
5941
  }
5403
5942
  super.writeValue(this._value);
5404
5943
  }
5405
- // #endregion Public Abstract Methods
5406
- // #region Private Methods
5407
- SetDateTimeFormat() {
5944
+ // #endregion Public Methods
5945
+ // #region Protected Methods
5946
+ getArrowHeight() {
5947
+ return this.pickerarrow ? this.pickerarrow.nativeElement.offsetHeight : 0;
5948
+ }
5949
+ getArrowWidth() {
5950
+ return this.pickerarrow ? this.pickerarrow.nativeElement.offsetWidth : 0;
5951
+ }
5952
+ /**
5953
+ * Calculates the position of the tooltip from links
5954
+ */
5955
+ getPositionLeft() {
5956
+ const value = this.popupHelper.getPositionLeft(this.pickerbutton, this.pickercontainer, this.elementRef, this.getArrowWidth(), this.getArrowHeight(), this.position, false);
5957
+ this.posPopupLeft = value;
5958
+ switch (this.GetPickerPosition()) {
5959
+ case TooltipPosition.top:
5960
+ case TooltipPosition.bottom:
5961
+ this.posArrowLeft = this.getPickerWidth() / 2 - -this.getArrowWidth();
5962
+ break;
5963
+ case TooltipPosition.topend:
5964
+ case TooltipPosition.bottomend:
5965
+ this.posArrowLeft =
5966
+ this.getPickerWidth() -
5967
+ this.getArrowWidth() / 2 -
5968
+ this.popupHelper.getContainerWidth(this.pickerbutton, false) / 2;
5969
+ break;
5970
+ default:
5971
+ this.posArrowLeft = null;
5972
+ break;
5973
+ }
5974
+ return value;
5975
+ }
5976
+ /**
5977
+ * Calculates the position of the tooltip from the top
5978
+ */
5979
+ getPositionTop() {
5980
+ const value = this.popupHelper.getPositionTop(this.pickerbutton, this.pickercontainer, this.elementRef, this.getArrowWidth(), this.getArrowHeight(), this.position, false);
5981
+ this.posPopupTop = value;
5982
+ switch (this.GetPickerPosition()) {
5983
+ case TooltipPosition.left:
5984
+ case TooltipPosition.right:
5985
+ this.posArrowTop = this.getPickerHeight() / 2 - 6.5;
5986
+ break;
5987
+ default:
5988
+ this.posArrowTop = null;
5989
+ break;
5990
+ }
5991
+ return value;
5992
+ }
5993
+ setDateTimeFormat() {
5408
5994
  // HACK: Add addition property to FormControl. Can be fixed if solution for ticket: https://github.com/angular/angular/issues/19686
5409
5995
  if (this.ngControl) {
5410
- this.ngControl.datetimeformatstring =
5411
- this.GetDateTimeFormatString();
5996
+ this.ngControl.datetimeformatstring = this.GetDateTimeFormatString();
5412
5997
  }
5413
5998
  }
5414
5999
  }
@@ -5418,22 +6003,23 @@ SacBaseDateTimeControl.decorators = [
5418
6003
  SacBaseDateTimeControl.ctorParameters = () => [
5419
6004
  { type: SacFormLayoutCommon },
5420
6005
  { type: Injector },
5421
- { type: ElementRef }
6006
+ { type: ElementRef },
6007
+ { type: ChangeDetectorRef }
5422
6008
  ];
5423
6009
  SacBaseDateTimeControl.propDecorators = {
5424
6010
  isrequired: [{ type: Input }],
6011
+ pickerarrow: [{ type: ViewChild, args: ['pickerarrow', { static: false },] }],
6012
+ pickerbutton: [{ type: ViewChild, args: ['pickerbutton', { static: true },] }],
5425
6013
  placeholder: [{ type: Input }],
6014
+ position: [{ type: Input }],
5426
6015
  validationmessagedatetimeformat: [{ type: Input }],
5427
6016
  validationmessagedatetimeformatsummary: [{ type: Input }],
5428
6017
  validationmessagerequired: [{ type: Input }],
5429
6018
  validationmessagerequiredsummary: [{ type: Input }],
6019
+ picker: [{ type: ViewChild, args: ['picker', { static: false },] }],
5430
6020
  valuestring: [{ type: Input }]
5431
6021
  };
5432
6022
 
5433
- /**
5434
- * Moment
5435
- */
5436
- const moment$3 = moment_;
5437
6023
  /**
5438
6024
  * Komponente für SacDateCommon. Extends SacBaseDateTimeControl
5439
6025
  */
@@ -5445,9 +6031,10 @@ class SacDateCommon extends SacBaseDateTimeControl {
5445
6031
  * @param formlayout SacFormLayoutCommon to define scoped layout settings
5446
6032
  * @param injector Injector for injecting services
5447
6033
  * @param elementRef reference to html element
6034
+ * @param cdRef Change Dectection Servie
5448
6035
  */
5449
- constructor(formlayout, injector, elementRef) {
5450
- super(formlayout, injector, elementRef);
6036
+ constructor(formlayout, injector, elementRef, cdRef) {
6037
+ super(formlayout, injector, elementRef, cdRef);
5451
6038
  this.elementRef = elementRef;
5452
6039
  // #region Properties
5453
6040
  /**
@@ -5483,6 +6070,18 @@ class SacDateCommon extends SacBaseDateTimeControl {
5483
6070
  lazy: false,
5484
6071
  overwrite: true,
5485
6072
  };
6073
+ /**
6074
+ * Min Date
6075
+ */
6076
+ this._maxdate = null;
6077
+ /**
6078
+ * Min Date
6079
+ */
6080
+ this._mindate = null;
6081
+ /**
6082
+ * Moment JS module instance
6083
+ */
6084
+ this.moment = moment_;
5486
6085
  /**
5487
6086
  * Resource Key für Validation Message MaxDate bei Control
5488
6087
  */
@@ -5499,26 +6098,20 @@ class SacDateCommon extends SacBaseDateTimeControl {
5499
6098
  * Resource Key für Validation Message MinDate in Validation Summary
5500
6099
  */
5501
6100
  this.validationmessagesummarymindate = this.validationKeyService.ValidationErrorSummaryMinDate;
5502
- /**
5503
- * Min Date
5504
- */
5505
- this._maxdate = null;
5506
- /**
5507
- * Min Date
5508
- */
5509
- this._mindate = null;
5510
- /**
5511
- * Definiert ob der Date Selector angezeigt wird
5512
- */
5513
- this._showselector = false;
5514
6101
  }
5515
6102
  // #endregion Constructors
5516
6103
  // #region Public Getters And Setters
6104
+ /**
6105
+ * icon for date selector button
6106
+ */
6107
+ get IconSelector() {
6108
+ return this.iconService.DateComponentSelectorIcon;
6109
+ }
5517
6110
  /**
5518
6111
  * Min Date
5519
6112
  */
5520
6113
  set maxdate(v) {
5521
- const date = moment$3(v, [this.DATEFORMAT], true);
6114
+ const date = this.moment(v, [this.DATEFORMAT], true);
5522
6115
  if (date.isValid()) {
5523
6116
  this._maxdate = super.getDate(date).toDate();
5524
6117
  }
@@ -5530,7 +6123,7 @@ class SacDateCommon extends SacBaseDateTimeControl {
5530
6123
  * Min Date
5531
6124
  */
5532
6125
  set mindate(v) {
5533
- const date = moment$3(v, [this.DATEFORMAT], true);
6126
+ const date = this.moment(v, [this.DATEFORMAT], true);
5534
6127
  if (date.isValid()) {
5535
6128
  this._mindate = super.getDate(date).toDate();
5536
6129
  }
@@ -5538,23 +6131,8 @@ class SacDateCommon extends SacBaseDateTimeControl {
5538
6131
  this._mindate = null;
5539
6132
  }
5540
6133
  }
5541
- /**
5542
- * icon for date selector button
5543
- */
5544
- get IconSelector() {
5545
- return this.iconService.DateComponentSelectorIcon;
5546
- }
5547
6134
  // #endregion Public Getters And Setters
5548
6135
  // #region Public Methods
5549
- /**
5550
- * HostListener
5551
- */
5552
- onClick(targetElement) {
5553
- const clickedInside = this.elementRef.nativeElement.contains(targetElement);
5554
- if (!clickedInside) {
5555
- this._showselector = false;
5556
- }
5557
- }
5558
6136
  /**
5559
6137
  * Methode ergibt Datum-Format vom String
5560
6138
  */
@@ -5575,10 +6153,23 @@ class SacDateCommon extends SacBaseDateTimeControl {
5575
6153
  this.setValueString('');
5576
6154
  }
5577
6155
  else {
5578
- this.value = moment$3(v.date).utc().toDate();
6156
+ this.value = this.moment(v.date).utc().toDate();
5579
6157
  }
5580
6158
  this._showselector = false;
5581
6159
  }
6160
+ /**
6161
+ * HostListener
6162
+ */
6163
+ onClick(targetElement) {
6164
+ if (!this.pickercontainer) {
6165
+ return;
6166
+ }
6167
+ const clickedInsideContainer = this.pickercontainer.nativeElement.contains(targetElement);
6168
+ const clickedInsideReference = this.pickerbutton.nativeElement.contains(targetElement);
6169
+ if (!clickedInsideContainer && !clickedInsideReference) {
6170
+ this._showselector = false;
6171
+ }
6172
+ }
5582
6173
  /**
5583
6174
  * Zeigt Date Selector an
5584
6175
  */
@@ -5623,7 +6214,8 @@ SacDateCommon.decorators = [
5623
6214
  SacDateCommon.ctorParameters = () => [
5624
6215
  { type: SacFormLayoutCommon },
5625
6216
  { type: Injector },
5626
- { type: ElementRef }
6217
+ { type: ElementRef },
6218
+ { type: ChangeDetectorRef }
5627
6219
  ];
5628
6220
  SacDateCommon.propDecorators = {
5629
6221
  validationmessagemaxdate: [{ type: Input }],
@@ -5751,11 +6343,11 @@ class SacDateSelectorCommon {
5751
6343
  this._initialValue = null;
5752
6344
  }
5753
6345
  else {
5754
- this._initialValue = moment$4(v);
6346
+ this._initialValue = moment$2(v);
5755
6347
  }
5756
6348
  this._selectedValue = null;
5757
6349
  if (this._initialValue === null) {
5758
- this.initCalendar(moment$4());
6350
+ this.initCalendar(moment$2());
5759
6351
  }
5760
6352
  else {
5761
6353
  this.initCalendar(this._initialValue);
@@ -5889,7 +6481,7 @@ class SacDateSelectorCommon {
5889
6481
  .forEach((itm) => (itm.isselected = false)));
5890
6482
  v.isnew = true;
5891
6483
  v.isselected = true;
5892
- const dateValue = moment$4(v.date);
6484
+ const dateValue = moment$2(v.date);
5893
6485
  // Übernehmen der Zeit aus dem bestehenden Wert
5894
6486
  if (this._selectedValue === null) {
5895
6487
  if (this._initialValue !== null) {
@@ -5944,7 +6536,7 @@ class SacDateSelectorCommon {
5944
6536
  * Auswahl auf aktuelle Zeit stellen
5945
6537
  */
5946
6538
  setToday() {
5947
- this._selectedValue = moment$4();
6539
+ this._selectedValue = moment$2();
5948
6540
  /**
5949
6541
  * Sekunden un Milisekunden Clean
5950
6542
  */
@@ -5980,20 +6572,20 @@ class SacDateSelectorCommon {
5980
6572
  * Initial Datum
5981
6573
  */
5982
6574
  initDates() {
5983
- const currentMonth = moment$4(new Date(this.year, this.month, 1));
5984
- const lastMonth = moment$4(new Date(this.year, this.month, 1));
6575
+ const currentMonth = moment$2(new Date(this.year, this.month, 1));
6576
+ const lastMonth = moment$2(new Date(this.year, this.month, 1));
5985
6577
  lastMonth.add({ months: -1 });
5986
- const nextMonths = moment$4(new Date(this.year, this.month, 1));
6578
+ const nextMonths = moment$2(new Date(this.year, this.month, 1));
5987
6579
  nextMonths.add({ months: 1 });
5988
6580
  const weekdayBegin = currentMonth.weekday();
5989
- const weekdayEnd = moment$4(new Date(currentMonth.year(), currentMonth.month(), currentMonth.daysInMonth())).weekday();
6581
+ const weekdayEnd = moment$2(new Date(currentMonth.year(), currentMonth.month(), currentMonth.daysInMonth())).weekday();
5990
6582
  // Clear Array
5991
6583
  const daysInCalendar = [];
5992
6584
  this.dates = [];
5993
6585
  if (weekdayBegin !== this.beginOfCalendar) {
5994
6586
  const lastMonthDay = lastMonth.daysInMonth();
5995
6587
  const lastMonthDate = new Date(lastMonth.year(), lastMonth.month(), lastMonthDay);
5996
- const lastMonthWeekday = moment$4(lastMonthDate).weekday();
6588
+ const lastMonthWeekday = moment$2(lastMonthDate).weekday();
5997
6589
  let daysInLastMonth = 7 - ((7 + this.beginOfCalendar - lastMonthWeekday) % 7);
5998
6590
  if (daysInLastMonth === 7) {
5999
6591
  daysInLastMonth = 0;
@@ -6006,9 +6598,9 @@ class SacDateSelectorCommon {
6006
6598
  for (let dayinmonth = 1; dayinmonth <= currentMonth.daysInMonth(); dayinmonth++) {
6007
6599
  let isSelectedDate = false;
6008
6600
  let isNewDate = false;
6009
- const isCurrentDate = moment$4().month() === this.month &&
6010
- moment$4().year() === this.year &&
6011
- moment$4().date() === dayinmonth;
6601
+ const isCurrentDate = moment$2().month() === this.month &&
6602
+ moment$2().year() === this.year &&
6603
+ moment$2().date() === dayinmonth;
6012
6604
  // Initial Wert setzen, falls vorhanden
6013
6605
  if (this._initialValue !== null) {
6014
6606
  isSelectedDate =
@@ -6023,7 +6615,7 @@ class SacDateSelectorCommon {
6023
6615
  this._selectedValue.year() === this.year &&
6024
6616
  this._selectedValue.date() === dayinmonth;
6025
6617
  }
6026
- daysInCalendar.push(new DateSelectorItem(dayinmonth.toString(), moment$4([this.year, this.month, dayinmonth]).toDate(), true, isSelectedDate, isCurrentDate, isNewDate));
6618
+ daysInCalendar.push(new DateSelectorItem(dayinmonth.toString(), moment$2([this.year, this.month, dayinmonth]).toDate(), true, isSelectedDate, isCurrentDate, isNewDate));
6027
6619
  }
6028
6620
  let endOfCalender;
6029
6621
  if (this.beginOfCalendar === 0) {
@@ -6059,7 +6651,7 @@ class SacDateSelectorCommon {
6059
6651
  */
6060
6652
  if (this._selectedValue === null) {
6061
6653
  if (this._initialValue === null) {
6062
- this._selectedValue = moment$4();
6654
+ this._selectedValue = moment$2();
6063
6655
  }
6064
6656
  else {
6065
6657
  this._selectedValue = this._initialValue;
@@ -6087,13 +6679,9 @@ SacDateSelectorCommon.propDecorators = {
6087
6679
  /**
6088
6680
  * Moment
6089
6681
  */
6090
- const moment$4 = moment_;
6682
+ const moment$2 = moment_;
6091
6683
  // #endregion Variables
6092
6684
 
6093
- /**
6094
- * Moment
6095
- */
6096
- const moment$5 = moment_;
6097
6685
  /**
6098
6686
  * Komponente für SacDateTimeCommon. Extends SacBaseDateTimeControl
6099
6687
  */
@@ -6106,8 +6694,8 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6106
6694
  * @param injector Injector for injecting services
6107
6695
  * @param elementRef reference to html element
6108
6696
  */
6109
- constructor(formlayout, injector, elementRef) {
6110
- super(formlayout, injector, elementRef);
6697
+ constructor(formlayout, injector, elementRef, cdRef) {
6698
+ super(formlayout, injector, elementRef, cdRef);
6111
6699
  this.elementRef = elementRef;
6112
6700
  // #region Properties
6113
6701
  /**
@@ -6158,6 +6746,18 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6158
6746
  lazy: false,
6159
6747
  overwrite: true,
6160
6748
  };
6749
+ /**
6750
+ * Maximaler Wert des Datums
6751
+ */
6752
+ this._maxdate = null;
6753
+ /**
6754
+ * Minimaler Wert des Datums
6755
+ */
6756
+ this._mindate = null;
6757
+ /**
6758
+ * Moment JS module instance
6759
+ */
6760
+ this.moment = moment_;
6161
6761
  /**
6162
6762
  * Resource Key für Validation Message MaxDate bei Control
6163
6763
  */
@@ -6174,26 +6774,20 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6174
6774
  * Resource Key für Validation Message MinDate in Validation Summary
6175
6775
  */
6176
6776
  this.validationmessagesummarymindate = this.validationKeyService.ValidationErrorSummaryMinDate;
6177
- /**
6178
- * Maximaler Wert des Datums
6179
- */
6180
- this._maxdate = null;
6181
- /**
6182
- * Minimaler Wert des Datums
6183
- */
6184
- this._mindate = null;
6185
- /**
6186
- * Definiert ob der Date Selector angezeigt wird
6187
- */
6188
- this._showselector = false;
6189
6777
  }
6190
6778
  // #endregion Constructors
6191
6779
  // #region Public Getters And Setters
6780
+ /**
6781
+ * icon for date selector button
6782
+ */
6783
+ get IconSelector() {
6784
+ return this.iconService.DateTimeComponentSelectorIcon;
6785
+ }
6192
6786
  /**
6193
6787
  * Max Date
6194
6788
  */
6195
6789
  set maxdate(v) {
6196
- const date = moment$5(v, [this.DATEFORMAT], true);
6790
+ const date = this.moment(v, [this.DATEFORMAT], true);
6197
6791
  if (date.isValid()) {
6198
6792
  this._maxdate = super.getDate(date).toDate();
6199
6793
  }
@@ -6205,7 +6799,7 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6205
6799
  * Min Date
6206
6800
  */
6207
6801
  set mindate(v) {
6208
- const date = moment$5(v, [this.DATEFORMAT], true);
6802
+ const date = this.moment(v, [this.DATEFORMAT], true);
6209
6803
  if (date.isValid()) {
6210
6804
  this._mindate = super.getDate(date).toDate();
6211
6805
  }
@@ -6213,23 +6807,8 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6213
6807
  this._mindate = null;
6214
6808
  }
6215
6809
  }
6216
- /**
6217
- * icon for date selector button
6218
- */
6219
- get IconSelector() {
6220
- return this.iconService.DateTimeComponentSelectorIcon;
6221
- }
6222
6810
  // #endregion Public Getters And Setters
6223
6811
  // #region Public Methods
6224
- /**
6225
- * HostListener
6226
- */
6227
- onClick(targetElement) {
6228
- const clickedInside = this.elementRef.nativeElement.contains(targetElement);
6229
- if (!clickedInside) {
6230
- this._showselector = false;
6231
- }
6232
- }
6233
6812
  /**
6234
6813
  * Methode ergibt Datum-Format vom String
6235
6814
  */
@@ -6250,10 +6829,23 @@ class SacDateTimeCommon extends SacBaseDateTimeControl {
6250
6829
  this.setValueString('');
6251
6830
  }
6252
6831
  else {
6253
- this.value = moment$5(v.date).utc().toDate();
6832
+ this.value = this.moment(v.date).utc().toDate();
6254
6833
  }
6255
6834
  this._showselector = false;
6256
6835
  }
6836
+ /**
6837
+ * HostListener
6838
+ */
6839
+ onClick(targetElement) {
6840
+ if (!this.pickercontainer) {
6841
+ return;
6842
+ }
6843
+ const clickedInsideContainer = this.pickercontainer.nativeElement.contains(targetElement);
6844
+ const clickedInsideReference = this.pickerbutton.nativeElement.contains(targetElement);
6845
+ if (!clickedInsideContainer && !clickedInsideReference) {
6846
+ this._showselector = false;
6847
+ }
6848
+ }
6257
6849
  /**
6258
6850
  * DateSelector wird beim Click-Event angezeigt
6259
6851
  */
@@ -6300,7 +6892,8 @@ SacDateTimeCommon.decorators = [
6300
6892
  SacDateTimeCommon.ctorParameters = () => [
6301
6893
  { type: SacFormLayoutCommon },
6302
6894
  { type: Injector },
6303
- { type: ElementRef }
6895
+ { type: ElementRef },
6896
+ { type: ChangeDetectorRef }
6304
6897
  ];
6305
6898
  SacDateTimeCommon.propDecorators = {
6306
6899
  validationmessagemaxdate: [{ type: Input }],
@@ -6312,10 +6905,6 @@ SacDateTimeCommon.propDecorators = {
6312
6905
  onClick: [{ type: HostListener, args: ['document:click', ['$event.target'],] }]
6313
6906
  };
6314
6907
 
6315
- /**
6316
- * Moment
6317
- */
6318
- const moment$6 = moment_;
6319
6908
  /**
6320
6909
  * Komponente für SacTimeCommon. Extends SacBaseDateTimeControl
6321
6910
  */
@@ -6328,8 +6917,8 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6328
6917
  * @param injector Injector for injecting services
6329
6918
  * @param elementRef reference to html element
6330
6919
  */
6331
- constructor(formlayout, injector, elementRef) {
6332
- super(formlayout, injector, elementRef);
6920
+ constructor(formlayout, injector, elementRef, cdRef) {
6921
+ super(formlayout, injector, elementRef, cdRef);
6333
6922
  this.elementRef = elementRef;
6334
6923
  // #region Properties
6335
6924
  /**
@@ -6360,6 +6949,18 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6360
6949
  lazy: false,
6361
6950
  overwrite: true,
6362
6951
  };
6952
+ /**
6953
+ * Max Time
6954
+ */
6955
+ this._maxtime = null;
6956
+ /**
6957
+ * Min Time
6958
+ */
6959
+ this._mintime = null;
6960
+ /**
6961
+ * Moment JS module instance
6962
+ */
6963
+ this.moment = moment_;
6363
6964
  /**
6364
6965
  * Resource Key für Validation Message MinTime bei Control
6365
6966
  */
@@ -6376,26 +6977,20 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6376
6977
  * Resource Key für Validation Message MinTime in Validation Summary
6377
6978
  */
6378
6979
  this.validationmessagesummarymintime = this.validationKeyService.ValidationErrorSummaryMinTime;
6379
- /**
6380
- * Max Time
6381
- */
6382
- this._maxtime = null;
6383
- /**
6384
- * Min Time
6385
- */
6386
- this._mintime = null;
6387
- /**
6388
- * Definiert ob der Date Selector angezeigt wird
6389
- */
6390
- this._showselector = false;
6391
6980
  }
6392
6981
  // #endregion Constructors
6393
6982
  // #region Public Getters And Setters
6983
+ /**
6984
+ * icon for date selector button
6985
+ */
6986
+ get IconSelector() {
6987
+ return this.iconService.TimeComponentSelectorIcon;
6988
+ }
6394
6989
  /**
6395
6990
  * Max Time
6396
6991
  */
6397
6992
  set maxtime(v) {
6398
- let time = moment$6(v, [this.TIMEFORMAT], true);
6993
+ let time = this.moment(v, [this.TIMEFORMAT], true);
6399
6994
  time = this.ModifyParsedDateTimeValue(time);
6400
6995
  if (time.isValid()) {
6401
6996
  this._maxtime = super.getDate(time).toDate();
@@ -6408,7 +7003,7 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6408
7003
  * Min Time
6409
7004
  */
6410
7005
  set mintime(v) {
6411
- let time = moment$6(v, [this.TIMEFORMAT], true);
7006
+ let time = this.moment(v, [this.TIMEFORMAT], true);
6412
7007
  time = this.ModifyParsedDateTimeValue(time);
6413
7008
  if (time.isValid()) {
6414
7009
  this._mintime = super.getDate(time).toDate();
@@ -6417,23 +7012,8 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6417
7012
  this._mintime = null;
6418
7013
  }
6419
7014
  }
6420
- /**
6421
- * icon for date selector button
6422
- */
6423
- get IconSelector() {
6424
- return this.iconService.TimeComponentSelectorIcon;
6425
- }
6426
7015
  // #endregion Public Getters And Setters
6427
7016
  // #region Public Methods
6428
- /**
6429
- * HostListener
6430
- */
6431
- onClick(targetElement) {
6432
- const clickedInside = this.elementRef.nativeElement.contains(targetElement);
6433
- if (!clickedInside) {
6434
- this._showselector = false;
6435
- }
6436
- }
6437
7017
  /**
6438
7018
  * Methode ergibt Datum-Format vom String
6439
7019
  */
@@ -6449,6 +7029,19 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6449
7029
  v.year(1900);
6450
7030
  return v;
6451
7031
  }
7032
+ /**
7033
+ * HostListener
7034
+ */
7035
+ onClick(targetElement) {
7036
+ if (!this.pickercontainer) {
7037
+ return;
7038
+ }
7039
+ const clickedInsideContainer = this.pickercontainer.nativeElement.contains(targetElement);
7040
+ const clickedInsideReference = this.pickerbutton.nativeElement.contains(targetElement);
7041
+ if (!clickedInsideContainer && !clickedInsideReference) {
7042
+ this._showselector = false;
7043
+ }
7044
+ }
6452
7045
  /**
6453
7046
  * Zeigt Date Selector an
6454
7047
  */
@@ -6470,7 +7063,7 @@ class SacTimeCommon extends SacBaseDateTimeControl {
6470
7063
  this.setValueString('');
6471
7064
  }
6472
7065
  else {
6473
- this.value = moment$6(v.date).utc().toDate();
7066
+ this.value = this.moment(v.date).utc().toDate();
6474
7067
  }
6475
7068
  this._showselector = false;
6476
7069
  }
@@ -6505,7 +7098,8 @@ SacTimeCommon.decorators = [
6505
7098
  SacTimeCommon.ctorParameters = () => [
6506
7099
  { type: SacFormLayoutCommon },
6507
7100
  { type: Injector },
6508
- { type: ElementRef }
7101
+ { type: ElementRef },
7102
+ { type: ChangeDetectorRef }
6509
7103
  ];
6510
7104
  SacTimeCommon.propDecorators = {
6511
7105
  validationmessagemaxtime: [{ type: Input }],
@@ -6528,22 +7122,30 @@ class SacStaticFormContainerCommon extends SacBaseModelControl {
6528
7122
  * Definiert den Container als Required Form Item
6529
7123
  */
6530
7124
  this._isrequired = false;
7125
+ /**
7126
+ * Error message to be displayed
7127
+ */
7128
+ this.errormessage = '';
7129
+ /**
7130
+ * Activates the error message on the container control
7131
+ */
7132
+ this.isinvalid = false;
6531
7133
  // #endregion Public Methods
6532
7134
  }
6533
7135
  // #endregion Properties
6534
7136
  // #region Public Getters And Setters
6535
- /**
6536
- * Definiert den Container als Required Form Item
6537
- */
6538
- set isrequired(v) {
6539
- this._isrequired = convertToBoolean(v);
6540
- }
6541
7137
  /**
6542
7138
  * Definiert den Container als Required Form Item
6543
7139
  */
6544
7140
  get isrequired() {
6545
7141
  return this._isrequired;
6546
7142
  }
7143
+ /**
7144
+ * Definiert den Container als Required Form Item
7145
+ */
7146
+ set isrequired(v) {
7147
+ this._isrequired = convertToBoolean(v);
7148
+ }
6547
7149
  // #endregion Public Getters And Setters
6548
7150
  // #region Public Methods
6549
7151
  /**
@@ -6562,6 +7164,8 @@ SacStaticFormContainerCommon.decorators = [
6562
7164
  { type: Directive }
6563
7165
  ];
6564
7166
  SacStaticFormContainerCommon.propDecorators = {
7167
+ errormessage: [{ type: Input }],
7168
+ isinvalid: [{ type: Input }],
6565
7169
  isrequired: [{ type: Input }]
6566
7170
  };
6567
7171
 
@@ -7003,417 +7607,308 @@ SacTinyMceCommon.propDecorators = {
7003
7607
  };
7004
7608
 
7005
7609
  /**
7006
- *Basis Komponente für SacTreeItemAction
7610
+ * Basis Komponente für SacTreeView
7007
7611
  */
7008
- class SacTreeItemActionCommon {
7612
+ class SacTreeviewCommon extends SacBaseModelControl {
7613
+ // #endregion Properties
7614
+ // #region Constructors
7009
7615
  /**
7010
- * Konstruktor
7011
- * @param el Element Referenz
7616
+ * Constructor
7617
+ * @param injector Service Injector
7012
7618
  */
7013
- constructor(el) {
7014
- this.el = el;
7619
+ constructor(formlayout, injector) {
7620
+ super(formlayout, injector);
7621
+ // #region Properties
7015
7622
  /**
7016
- * Event wenn auf das Icon geclickt wird
7623
+ * Event when Action is clicked on Node. An object of the type 'TreeviewAction' is returned. In the default case, 'action' in this object is always the value 'default'. The value can be changed via the 'templateaction'.
7017
7624
  */
7018
- this.clicked = new EventEmitter();
7019
- }
7020
- /**
7021
- * lifecycle OnInit hook. Wird aufgeruren sobald das Komponent initialisiert ist.
7022
- */
7023
- ngOnInit() {
7024
- let rootElement = this.el.nativeElement;
7025
- let parentElement = rootElement.parentElement;
7026
- while (rootElement.firstChild) {
7027
- parentElement.insertBefore(rootElement.firstChild, rootElement);
7028
- }
7029
- parentElement.removeChild(rootElement);
7030
- }
7031
- /**
7032
- * Die Methode erstellt die CSS Klasse des Icon. Akzeptiert ein Key-word und baut ein vollständige CSS Klasse.
7033
- */
7034
- transformClass(initialClass) {
7035
- switch (initialClass) {
7036
- case 'add':
7037
- return 'jstree-icon icon icon-base-add jstree-add';
7038
- case 'delete':
7039
- return 'jstree-icon icon icon-base-delete jstree-delete';
7040
- default:
7041
- return initialClass;
7042
- }
7043
- }
7044
- /**
7045
- * Die Methode wird das cklickaction Emitter aktivieren.
7046
- */
7047
- iconaction() {
7048
- this.clicked.emit();
7049
- }
7050
- }
7051
- SacTreeItemActionCommon.decorators = [
7052
- { type: Directive }
7053
- ];
7054
- SacTreeItemActionCommon.ctorParameters = () => [
7055
- { type: ElementRef }
7056
- ];
7057
- SacTreeItemActionCommon.propDecorators = {
7058
- item: [{ type: Input }],
7059
- title: [{ type: Input }],
7060
- iconstyle: [{ type: Input }],
7061
- clicked: [{ type: Output }]
7062
- };
7063
-
7064
- /**
7065
- * Basis Komponente für SacTreeView
7066
- */
7067
- class SacTreeViewCommon {
7068
- constructor() {
7625
+ this.actionclicked = new EventEmitter();
7069
7626
  /**
7070
- * Das Property enthielt array of nodes. Default value: empty array [].
7627
+ * Property on the data object that contains the children of the structure element. Must be an array of objects. The default value is 'children'
7071
7628
  */
7072
- this.nodes = [];
7629
+ this.attrchildren = 'children';
7073
7630
  /**
7074
- * Das Property enthielt node attribute: 'isCollapsed'. Es wird benutzt beim rendering. Für Expand/Collapsed Sicht des Node(Wert)
7631
+ * Defines the property on the 'data' object with which the actions for a node can be deactivated. A 'disabled' property is used by default.
7075
7632
  */
7076
- this.collapseAttr = 'isCollapsed';
7633
+ this.attrdisableaction = 'disabled';
7077
7634
  /**
7078
- * Das Property enthielt node attribute: 'isSelected'. Es wird benutzt beim Vorbereitung des Data des TreeView
7635
+ * Property on the 'data' object that stores the expanded state. Property must be of type boolean. Default is 'expanded'
7079
7636
  */
7080
- this.selectAttr = 'isSelected';
7637
+ this.attrexanded = 'expanded';
7081
7638
  /**
7082
- * Das Property enthielt node attribute: 'isIndeterminate'. Es wird benutzt beim Vorbereitung des Data des TreeView
7639
+ * Property for saving the HoverState on the field. If the property is not present on the node, it is automatically created and removed again. The value can usually be left at the default value unless there is a conflict with a property on the node that is required for other purposes.
7083
7640
  */
7084
- this.inDeterminateAttr = 'isIndeterminate';
7641
+ this.attrhoverstate = 'hoverstate';
7085
7642
  /**
7086
- * Providen data for tree.
7643
+ * Property on 'data' object, which contains the icon for the node. By default, the property is not set, which hides the icon in the node.
7087
7644
  */
7088
- this._data = [];
7645
+ this.attricon = null;
7089
7646
  /**
7090
- * Input property für den Namen des TreeView. Type string. Default value: ""
7647
+ * property on the 'data' object contains an ID of the node. The default is 'id'. If the property is set to NULL, the selectedId event is no longer triggered.
7091
7648
  */
7092
- this.name = '';
7649
+ this.attrid = 'id';
7093
7650
  /**
7094
- * A flag indicating data is flatten in array and prepare is required.(Default
7095
- * is false).
7651
+ * Property on 'data' object, which contains the label for the node. Default is 'label'
7096
7652
  */
7097
- this.prepareData = false;
7653
+ this.attrlabel = 'label';
7098
7654
  /**
7099
- * Attribute for Text in Tree
7655
+ * Property on 'data' object, which defines whether the node is selected or not. It should be ensured that only 1 node has the value for Selected set to true. Default is 'selected'.
7100
7656
  */
7101
- this.textAttr = 'data';
7657
+ this.attrselected = 'selected';
7102
7658
  /**
7103
- * Name of ID property in input data.
7659
+ * Event when a node is collapsed. Returns the node element as a parameter
7104
7660
  */
7105
- this.idAttr = 'id';
7661
+ this.collabsed = new EventEmitter();
7106
7662
  /**
7107
- * Name of parent property in input data.
7663
+ * The property contains an array of nodes. The data must already map the tree via child properties.
7108
7664
  */
7109
- this.parentAttr = 'PARENT_ID';
7665
+ this.data = [];
7110
7666
  /**
7111
- * Name of children list property in input data.
7667
+ * Activates the 'expand' and 'collabse' event even if a node has no children. This is helpful if node elements are to be reloaded at runtime.
7112
7668
  */
7113
- this.childrenAttr = 'children';
7669
+ this.enableasynchload = false;
7114
7670
  /**
7115
- * Output Emitter. Emit das ID des selected Node.
7671
+ * Activates Ellipsis on the node labels
7116
7672
  */
7117
- this.selectedidchange = new EventEmitter();
7673
+ this.enableellipsis = true;
7118
7674
  /**
7119
- * Output Emitter. Emit das TextAttr des selected Node.
7675
+ * Event when a node is expanded. Returns the node element as a parameter
7120
7676
  */
7121
- this.selectedtextchanged = new EventEmitter();
7677
+ this.expanded = new EventEmitter();
7122
7678
  /**
7123
- * Output Emitter. Emit wenn ein Node selektiert wird.
7679
+ * Defines whether an icon for the expanded/collapsed status should be displayed.
7124
7680
  */
7125
- this.selecteditem = new EventEmitter();
7126
- }
7127
- /**
7128
- * Getter für Data des TreeView
7129
- */
7130
- get data() {
7131
- return this._data;
7681
+ this.expandedstate = true;
7682
+ /**
7683
+ * A node must be selected
7684
+ */
7685
+ this.isrequired = false;
7686
+ /**
7687
+ * Name of the TreeView control
7688
+ */
7689
+ this.name = '';
7690
+ /**
7691
+ * Event when a node is selected. Returns the id attribute as a parameter. The event is not triggered if 'attrid' is not set.
7692
+ */
7693
+ this.selected = new EventEmitter();
7694
+ /**
7695
+ * Event when a node is selected. Returns the node element as a parameter.
7696
+ */
7697
+ this.selectednode = new EventEmitter();
7698
+ /**
7699
+ * Resource Key für Validation Message Required bei Control
7700
+ */
7701
+ this.validationmessagerequired = this.validationKeyService.ValidationErrorRequired;
7702
+ /**
7703
+ * Resource Key für Validation Message Required in Validation Summary
7704
+ */
7705
+ this.validationmessagesummaryrequired = this.validationKeyService.ValidationErrorSummaryRequired;
7132
7706
  }
7133
- /**
7134
- * Input Property für Data des TreeView
7135
- */
7136
- set data(value) {
7137
- this._data = value;
7138
- this.nodes = value;
7139
- // this.nodes.forEach(node => node["typeId"] = "13")
7140
- this.LoadTree();
7141
- if (this._collapseAll !== undefined) {
7142
- this.collapseAllNode(this._collapseAll);
7143
- }
7707
+ // #endregion Constructors
7708
+ // #region Public Getters And Setters
7709
+ get iconAction() {
7710
+ return this.iconService.TreeviewNodeActionIcon;
7144
7711
  }
7145
7712
  /**
7146
- * Die Directive erhält die actions für das TreeView
7713
+ * CSS icon for folders in tree there are collabsed
7714
+ * @returns css class with icon
7147
7715
  */
7148
- set treeviewTemplate(v) {
7149
- this.template = v;
7716
+ get iconFolderCollabsed() {
7717
+ return this.iconService.TreeviewNodeClosedIcon;
7150
7718
  }
7151
7719
  /**
7152
- * Getter für das TreeView Template
7720
+ * CSS icon class for folders without subfolders
7721
+ * @returns css class with icon
7153
7722
  */
7154
- get treeviewTemplate() {
7155
- return this.template;
7723
+ get iconFolderEmpty() {
7724
+ return this.iconService.TreeviewNodeEmptyIcon;
7156
7725
  }
7157
7726
  /**
7158
- * Setter property. Deffiniert das FileIcon für das TreeView
7727
+ * CSS icon for folders in tree there are expanded
7728
+ * @returns css class with icon
7159
7729
  */
7160
- set treefileicon(v) {
7161
- this.fileicontemplate = v;
7730
+ get iconFolderOpen() {
7731
+ return this.iconService.TreeviewNodeOpenIcon;
7162
7732
  }
7733
+ // #endregion Public Getters And Setters
7734
+ // #region Public Methods
7163
7735
  /**
7164
- * Getter property. Ergibt das FileIcon für das TreeView
7736
+ * Creates an array of a certain size. Is required for a For in the UI, as Angular does not support counting loops
7737
+ * @param size Size of the array
7738
+ * @returns Array
7165
7739
  */
7166
- get treefileicon() {
7167
- return this.fileicontemplate;
7740
+ count(size) {
7741
+ return new Array(size);
7168
7742
  }
7169
- // @Input("titleAction") _titleAction: string
7170
- /**
7171
- * Collapse or expand all parent nodes.
7172
- */
7173
- set collapseall(value) {
7174
- this._collapseAll = value;
7175
- if (this.nodes && this.nodes.length && this.nodes.length > 0) {
7176
- this.collapseAllNode(this._collapseAll);
7743
+ getChildren(node) {
7744
+ if (!node || !this.attrchildren) {
7745
+ return [];
7177
7746
  }
7178
- // this._recursiveEdit(
7179
- // this.nodes, this.childrenAttr, this.collapseAttr, this._collapseAll);
7180
- // this.cd.detectChanges();
7181
- }
7182
- /**
7183
- * Getter für das collapse property. Ergibt boolean Wert, ob die Items collapsed/expand sind.
7184
- */
7185
- get collapseall() {
7186
- return this._collapseAll;
7187
- }
7188
- /**
7189
- * Select or deselect all nodes.
7190
- */
7191
- set selectall(value) {
7192
- this._selectAll = value;
7193
- this._recursiveEdit(this.nodes, this.childrenAttr, this.selectAttr, value);
7194
- this._recursiveEdit(this.nodes, this.childrenAttr, this.inDeterminateAttr, false);
7747
+ let children = node[this.attrchildren];
7748
+ if (!Array.isArray(children)) {
7749
+ return [];
7750
+ }
7751
+ return children;
7195
7752
  }
7196
- /**
7197
- * Input property - setter. Deffiniert das ID des selektierten Item(node)
7198
- */
7199
- set selectedid(v) {
7200
- this.selectedNode = this.findNode(this.nodes, v, this.idAttr);
7201
- // if (this.selectedNode) {
7202
- // this.selectedIdEmitter.emit(this.selectedNode[this.idAttr]);
7203
- // this.selectedTextEmitter.emit(this.selectedNode[this.textAttr]);
7204
- // }
7753
+ getStringField(node, fieldname) {
7754
+ if (!node) {
7755
+ return '';
7756
+ }
7757
+ if (!fieldname) {
7758
+ return node;
7759
+ }
7760
+ let value = node[fieldname];
7761
+ if (!value) {
7762
+ return '';
7763
+ }
7764
+ return value;
7205
7765
  }
7206
- /**
7207
- * Getter. Ergibt das ID des selektierten Item(node)
7208
- */
7209
- get selectedId() {
7210
- return this.selectedNode ? this.selectedNode[this.idAttr] : null;
7766
+ hasChildren(node) {
7767
+ return this.getChildren(node).length > 0;
7211
7768
  }
7212
- /**
7213
- * Setter für das selektierte Wert(node). Wenn aufgerufen das ID und TextAttr des selected Node wird emitted
7214
- */
7215
- set selectedNode(v) {
7216
- this._selectedNode = v;
7217
- if (this._selectedNode) {
7218
- this.selectedidchange.emit(this.selectedId);
7219
- this.selectedtextchanged.emit(v[this.textAttr]);
7769
+ isDisabledState(node) {
7770
+ if (!node || !this.attrdisableaction) {
7771
+ return false;
7220
7772
  }
7773
+ let value = node[this.attrdisableaction];
7774
+ return value === true || value === 'true';
7221
7775
  }
7222
- /**
7223
- * Getter für das selektierte Wert(node). Ergibt das selektierte Wert(node).
7224
- */
7225
- get selectedNode() {
7226
- return this._selectedNode;
7227
- }
7228
- /**
7229
- * A lifecycle hook that is called after Angular has initialized all data-bound properties of a directive.
7230
- * Define an ngOnInit() method to handle any additional initialization tasks.
7231
- */
7232
- ngOnInit() {
7233
- this.collapseAllNode(this._collapseAll);
7234
- if (this.selectedId)
7235
- this.openSelectedNode(this.nodes);
7236
- }
7237
- /**
7238
- * Funktion setzt alle parent items recusiv zum selected node
7239
- * auf collapsed = false
7240
- */
7241
- openSelectedNode(data) {
7242
- let result = false;
7243
- for (let i = 0; i < data.length; i++) {
7244
- if (data[i][this.childrenAttr].length &&
7245
- data[i][this.idAttr] != this.selectedId)
7246
- result = this.openSelectedNode(data[i][this.childrenAttr]);
7247
- if (result || data[i][this.idAttr] == this.selectedId) {
7248
- data[i][this.collapseAttr] = false;
7249
- return true;
7250
- }
7776
+ isExpandedState(node) {
7777
+ if (!node || !this.attrexanded) {
7778
+ return false;
7251
7779
  }
7252
- return false;
7780
+ let value = node[this.attrexanded];
7781
+ return value === true || value === 'true';
7253
7782
  }
7254
- /**
7255
- * Die Methode vorbereitet die Daten für das TreeView. Die Funktion sollte geändert werden abhängig von dem kommenden Daten (wenn array)
7256
- */
7257
- LoadTree() {
7258
- //if the tree structure require array the function below should be changed
7259
- const cloned = this._data.map((x) => Object.assign({}, x));
7260
- // If data is flat, prepare data with recursive function.
7261
- this.nodes = this.prepareData ? this._getPreparedData(cloned) : this._data;
7783
+ isHoverState(node) {
7784
+ if (!node || !this.attrhoverstate) {
7785
+ return false;
7786
+ }
7787
+ let value = node[this.attrhoverstate];
7788
+ return value === true || value === 'true';
7262
7789
  }
7263
- /**
7264
- * Die Methode collapse/expand den selectierten Node
7265
- */
7266
- onCollapseClick(node) {
7267
- if (node[this.childrenAttr].length) {
7268
- node[this.collapseAttr] = !node[this.collapseAttr];
7790
+ isSelectedState(node) {
7791
+ if (!node || !this.attrselected) {
7792
+ return false;
7269
7793
  }
7794
+ let value = node[this.attrselected];
7795
+ return value === true || value === 'true';
7270
7796
  }
7271
7797
  /**
7272
- * Die Methode set den selektierten Node und emit es.
7798
+ * Method is called by clicking an action
7799
+ * @param action action and node
7273
7800
  */
7274
- onClick(node) {
7275
- this.selectedNode = node;
7276
- this.selecteditem.emit(this.selectedNode);
7277
- // this.cd.detectChanges();
7801
+ onActionClicked(action) {
7802
+ this.actionclicked.emit(action);
7278
7803
  }
7279
- /**
7280
- * Die Methode wird ein event mit Meldung zu Parent emit-en.
7281
- */
7282
- sendMsgToParent(msg) {
7283
- this.selecteditem.emit(msg);
7804
+ onNodeClicked(node) {
7805
+ if (this.isDisabledState(node) || this.isSelectedState(node)) {
7806
+ this.invertExpandedState(node);
7807
+ }
7808
+ this.setSelectedState(node);
7284
7809
  }
7285
- /**
7286
- * Die Methode wird alle Nodes collapse
7287
- */
7288
- collapseAllNode(command) {
7289
- this.nodes.forEach((node) => {
7290
- if (node[this.childrenAttr].length) {
7291
- collapseAllHIdden(node, this.collapseAttr, command, this.childrenAttr);
7292
- }
7293
- });
7294
- function collapseAllHIdden(node, collapseAttr, command, childrenAttr) {
7295
- node[collapseAttr] = command;
7296
- node.children.forEach((child) => {
7297
- if (child[childrenAttr].length) {
7298
- collapseAllHIdden(child, collapseAttr, command, childrenAttr);
7299
- }
7300
- });
7810
+ setHoverState(node, state) {
7811
+ if (!node || !this.attrhoverstate) {
7812
+ return;
7301
7813
  }
7814
+ if (state) {
7815
+ node[this.attrhoverstate] = true;
7816
+ return;
7817
+ }
7818
+ if (!node.hasOwnProperty(this.attrhoverstate)) {
7819
+ return;
7820
+ }
7821
+ delete node[this.attrhoverstate];
7302
7822
  }
7303
- /**
7304
- * Funktion gibt node aus der liste zurück, welches das Value auf dem gewünschten Attribut hat
7305
- * Wenn node nicht gefunden wird, wird null zurück gegeben
7306
- * @param data Liste der nodes
7307
- * @param searchValue Das gesuchte value
7308
- * @param attr Der namen des Attributs auf dem das value gesucht wird
7309
- */
7310
- findNode(data, searchValue, attr) {
7311
- let result = null;
7312
- for (let i = 0; i < data.length; i++) {
7313
- if (data[i][attr] == searchValue)
7314
- result = data[i];
7315
- else {
7316
- if (data[i][this.childrenAttr].length) {
7317
- let recursiveResult = this.findNode(data[i][this.childrenAttr], searchValue, attr);
7318
- if (recursiveResult)
7319
- result = recursiveResult;
7320
- }
7321
- }
7823
+ setSelectedState(node) {
7824
+ if (!node || !this.attrselected) {
7825
+ return;
7826
+ }
7827
+ // reset selected state of any node
7828
+ this.data.forEach((rootNode) => this.resetSelectedState(rootNode));
7829
+ // set selected node as selected
7830
+ node[this.attrselected] = true;
7831
+ // Update ngModel
7832
+ this.setValue(node);
7833
+ // Raise Selected Events
7834
+ this.selectednode.emit(node);
7835
+ if (!this.attrid) {
7836
+ return;
7322
7837
  }
7323
- return result;
7838
+ let id = this.getStringField(node, this.attrid);
7839
+ this.selected.emit(id);
7324
7840
  }
7325
- /**
7326
- * Die Methode editiert (recursive) alle eingegebene Nodes abhängig von gegebenen Attibute und Value Kriterien.
7327
- */
7328
- _recursiveEdit(list, childrenAttr, attr, value) {
7329
- if (Array.isArray(list)) {
7330
- for (let i = 0, len = list.length; i < len; i++) {
7331
- list[i][attr] = value;
7332
- if (list[i][childrenAttr].length) {
7333
- this._recursiveEdit(list[i][childrenAttr], childrenAttr, attr, value);
7334
- }
7335
- }
7841
+ validateData(c) {
7842
+ let error = null;
7843
+ if (this.isrequired) {
7844
+ error = Validation.required(this.validationmessagerequired, this.validationmessagesummaryrequired)(c);
7336
7845
  }
7846
+ return error;
7337
7847
  }
7338
- /**
7339
- * Die Methode erstellt eine standarte Sicht-Liste von Nodes
7340
- */
7341
- _getPreparedData(list) {
7342
- const tree = [], lookup = {};
7343
- for (let i = 0, len = list.length; i < len; i++) {
7344
- lookup[list[i][this.idAttr]] = list[i];
7345
- list[i][this.childrenAttr] = [];
7346
- list[i][this.collapseAttr] = true;
7347
- list[i][this.selectAttr] = false;
7348
- list[i][this.inDeterminateAttr] = false;
7848
+ // #endregion Public Methods
7849
+ // #region Private Methods
7850
+ invertExpandedState(node) {
7851
+ if (!node || !this.attrexanded) {
7852
+ return;
7349
7853
  }
7350
- for (let i = 0, len = list.length; i < len; i++) {
7351
- if (list[i][this.parentAttr]) {
7352
- lookup[list[i][this.parentAttr]][this.childrenAttr].push(list[i]);
7353
- }
7354
- else {
7355
- tree.push(list[i]);
7356
- }
7854
+ // Items with no children cannot be collabsed
7855
+ if (!this.hasChildren(node) && !(this.enableasynchload === true || this.enableasynchload === 'true')) {
7856
+ return;
7857
+ }
7858
+ let value = node[this.attrexanded];
7859
+ if (value === true || value === 'true') {
7860
+ this.collabsed.emit(node);
7861
+ node[this.attrexanded] = false;
7862
+ }
7863
+ else {
7864
+ this.expanded.emit(node);
7865
+ node[this.attrexanded] = true;
7866
+ }
7867
+ }
7868
+ resetSelectedState(node) {
7869
+ if (!node || !this.attrselected) {
7870
+ return;
7357
7871
  }
7358
- return tree;
7872
+ node[this.attrselected] = false;
7873
+ this.getChildren(node).forEach((child) => {
7874
+ this.resetSelectedState(child);
7875
+ });
7359
7876
  }
7360
7877
  }
7361
- SacTreeViewCommon.decorators = [
7878
+ SacTreeviewCommon.decorators = [
7362
7879
  { type: Directive }
7363
7880
  ];
7364
- SacTreeViewCommon.propDecorators = {
7881
+ SacTreeviewCommon.ctorParameters = () => [
7882
+ { type: SacFormLayoutCommon, decorators: [{ type: Host }] },
7883
+ { type: Injector }
7884
+ ];
7885
+ SacTreeviewCommon.propDecorators = {
7886
+ actionclicked: [{ type: Output }],
7887
+ attrchildren: [{ type: Input }],
7888
+ attrdisableaction: [{ type: Input }],
7889
+ attrexanded: [{ type: Input }],
7890
+ attrhoverstate: [{ type: Input }],
7891
+ attricon: [{ type: Input }],
7892
+ attrid: [{ type: Input }],
7893
+ attrlabel: [{ type: Input }],
7894
+ attrselected: [{ type: Input }],
7895
+ collabsed: [{ type: Output }],
7365
7896
  data: [{ type: Input }],
7366
- template: [{ type: Input }],
7367
- treeviewTemplate: [{ type: ContentChild, args: ['actions', { static: true },] }],
7368
- fileicontemplate: [{ type: Input }],
7369
- treefileicon: [{ type: ContentChild, args: ['treefileicon', { static: true },] }],
7897
+ enableasynchload: [{ type: Input }],
7898
+ enableellipsis: [{ type: Input }],
7899
+ expanded: [{ type: Output }],
7900
+ expandedstate: [{ type: Input }],
7901
+ isrequired: [{ type: Input }],
7370
7902
  name: [{ type: Input }],
7371
- prepareData: [{ type: Input }],
7372
- textAttr: [{ type: Input }],
7373
- idAttr: [{ type: Input }],
7374
- parentAttr: [{ type: Input }],
7375
- childrenAttr: [{ type: Input }],
7376
- title: [{ type: Input }],
7377
- collapseall: [{ type: Input }],
7378
- selectall: [{ type: Input }],
7379
- selectedid: [{ type: Input }],
7380
- selectedidchange: [{ type: Output }],
7381
- selectedtextchanged: [{ type: Output }],
7382
- selecteditem: [{ type: Output }]
7903
+ selected: [{ type: Output }],
7904
+ selectednode: [{ type: Output }],
7905
+ showactionalways: [{ type: Input }],
7906
+ templateaction: [{ type: Input }],
7907
+ templatelabel: [{ type: Input }],
7908
+ validationmessagerequired: [{ type: Input }],
7909
+ validationmessagesummaryrequired: [{ type: Input }]
7383
7910
  };
7384
7911
 
7385
- /**
7386
- * Komponente für SacTreeViewChildCommon. Extends SacTreeViewCommon
7387
- */
7388
- class SacTreeViewChildCommon extends SacTreeViewCommon {
7389
- /**
7390
- * A lifecycle hook that is called after Angular has initialized all data-bound properties of a directive.
7391
- * Define an ngOnInit() method to handle any additional initialization tasks.
7392
- */
7393
- ngOnInit() {
7394
- this.collapseAllNode(this.collapseall);
7395
- }
7396
- }
7397
- SacTreeViewChildCommon.decorators = [
7398
- { type: Directive }
7399
- ];
7400
-
7401
- /**
7402
- * Enum für Tooltip Positionen
7403
- */
7404
- var TooltipPosition;
7405
- (function (TooltipPosition) {
7406
- TooltipPosition[TooltipPosition["none"] = 0] = "none";
7407
- // tslint:disable-next-line:no-bitwise
7408
- TooltipPosition[TooltipPosition["top"] = 1] = "top";
7409
- // tslint:disable-next-line:no-bitwise
7410
- TooltipPosition[TooltipPosition["right"] = 2] = "right";
7411
- // tslint:disable-next-line:no-bitwise
7412
- TooltipPosition[TooltipPosition["bottom"] = 4] = "bottom";
7413
- // tslint:disable-next-line:no-bitwise
7414
- TooltipPosition[TooltipPosition["left"] = 8] = "left";
7415
- })(TooltipPosition || (TooltipPosition = {}));
7416
-
7417
7912
  /**
7418
7913
  * Tooltip Component
7419
7914
  *
@@ -7435,29 +7930,15 @@ class SacTooltipCommon {
7435
7930
  constructor(cdRef, ref) {
7436
7931
  this.cdRef = cdRef;
7437
7932
  this.ref = ref;
7933
+ // #region Properties
7438
7934
  /**
7439
- * Defines whether the tooltip is visible
7440
- */
7441
- this._isTooltipVisible = false;
7442
- /**
7443
- * method if content has changed and proportions need to be reset in the UI.
7935
+ * Helper class to display tooltip on correct position
7444
7936
  */
7445
- this.onContentChange = () => {
7446
- // Do nothing if is not visible
7447
- if (!this._isTooltipVisible) {
7448
- return;
7449
- }
7450
- setTimeout(() => {
7451
- this.getLeftPosition();
7452
- this.getTopPosition();
7453
- });
7454
- };
7937
+ this.popupHelper = new PopUpHelper();
7455
7938
  /**
7456
- * Position of the tooltip. Values: left|top|right|bottom|auto
7457
- *
7458
- * Value 'auto' can be combined with another value.
7939
+ * Defines whether the tooltip is visible
7459
7940
  */
7460
- this.position = 'right|auto';
7941
+ this._isTooltipVisible = false;
7461
7942
  /**
7462
7943
  * Position of the tooltip on the left
7463
7944
  */
@@ -7474,9 +7955,42 @@ class SacTooltipCommon {
7474
7955
  * Position of the tooltip at the top
7475
7956
  */
7476
7957
  this.TopPos = 0;
7958
+ /**
7959
+ * Position of the picker arrow at the left
7960
+ */
7961
+ this.posArrowLeft = null;
7962
+ /**
7963
+ * Position of the picker arrow at the top
7964
+ */
7965
+ this.posArrowTop = null;
7966
+ /**
7967
+ * Position of the tooltip. Values: left|top|right|bottom|auto
7968
+ *
7969
+ * Value 'auto' can be combined with another value.
7970
+ */
7971
+ this.position = 'right|auto';
7972
+ /**
7973
+ * method if content has changed and proportions need to be reset in the UI.
7974
+ */
7975
+ this.onContentChange = () => {
7976
+ // Do nothing if is not visible
7977
+ if (!this._isTooltipVisible) {
7978
+ return;
7979
+ }
7980
+ setTimeout(() => {
7981
+ this.getLeftPosition();
7982
+ this.getTopPosition();
7983
+ });
7984
+ };
7985
+ }
7986
+ // #endregion Constructors
7987
+ // #region Public Getters And Setters
7988
+ /**
7989
+ * Property for inline mode for tooltip. Sets the display mode on the wrapper element to `inline`
7990
+ */
7991
+ get inlinemode() {
7992
+ return this._inlinemode;
7477
7993
  }
7478
- // #endregion Constructors
7479
- // #region Public Getters And Setters
7480
7994
  /**
7481
7995
  * Setter for inline mode for tooltip
7482
7996
  */
@@ -7494,12 +8008,6 @@ class SacTooltipCommon {
7494
8008
  this.onContentChange();
7495
8009
  this.cdRef.detectChanges();
7496
8010
  }
7497
- /**
7498
- * Property for inline mode for tooltip. Sets the display mode on the wrapper element to `inline`
7499
- */
7500
- get inlinemode() {
7501
- return this._inlinemode;
7502
- }
7503
8011
  get tooltop() {
7504
8012
  return this.tooltipcontainer;
7505
8013
  }
@@ -7509,50 +8017,7 @@ class SacTooltipCommon {
7509
8017
  * Returns the position of the tooltip
7510
8018
  */
7511
8019
  GetTooltipPosition() {
7512
- const validPositions = this.ValidatePositions();
7513
- // tslint:disable-next-line:no-bitwise
7514
- if (this.HasPosition(TooltipPosition.right) &&
7515
- validPositions & TooltipPosition.right) {
7516
- return TooltipPosition.right;
7517
- }
7518
- // tslint:disable-next-line:no-bitwise
7519
- if (this.HasPosition(TooltipPosition.top) &&
7520
- validPositions & TooltipPosition.top) {
7521
- return TooltipPosition.top;
7522
- }
7523
- // tslint:disable-next-line:no-bitwise
7524
- if (this.HasPosition(TooltipPosition.left) &&
7525
- validPositions & TooltipPosition.left) {
7526
- return TooltipPosition.left;
7527
- }
7528
- // tslint:disable-next-line:no-bitwise
7529
- if (this.HasPosition(TooltipPosition.bottom) &&
7530
- validPositions & TooltipPosition.bottom) {
7531
- return TooltipPosition.bottom;
7532
- }
7533
- // Get Auto Position or Default
7534
- if (this.IsAutoPosition()) {
7535
- // tslint:disable-next-line:no-bitwise
7536
- if (validPositions & TooltipPosition.right) {
7537
- return TooltipPosition.right;
7538
- }
7539
- // tslint:disable-next-line:no-bitwise
7540
- if (validPositions & TooltipPosition.top) {
7541
- return TooltipPosition.top;
7542
- }
7543
- // tslint:disable-next-line:no-bitwise
7544
- if (validPositions & TooltipPosition.left) {
7545
- return TooltipPosition.left;
7546
- }
7547
- // tslint:disable-next-line:no-bitwise
7548
- if (validPositions & TooltipPosition.bottom) {
7549
- return TooltipPosition.bottom;
7550
- }
7551
- return TooltipPosition.right;
7552
- }
7553
- else {
7554
- return this.GetPosition();
7555
- }
8020
+ return this.popupHelper.getDisplayPosition(this.content, this.tooltipcontainer, this.getTooltipOffset(), this.getTooltipOffset(), this.position, true);
7556
8021
  }
7557
8022
  /**
7558
8023
  * Hide tooltip
@@ -7583,24 +8048,13 @@ class SacTooltipCommon {
7583
8048
  * Calculates the height of the tooltip
7584
8049
  */
7585
8050
  getToolTipHeight() {
7586
- var _a;
7587
- if (this.tooltipcontainer) {
7588
- return (_a = this.tooltipcontainer.nativeElement.firstElementChild.clientHeight) !== null && _a !== void 0 ? _a : 0;
7589
- }
7590
- else {
7591
- return 0;
7592
- }
8051
+ return this.popupHelper.getPopupHeight(this.tooltipcontainer);
7593
8052
  }
7594
8053
  /**
7595
8054
  * Calculates the width of the tooltips
7596
8055
  */
7597
8056
  getToolTipWidth() {
7598
- if (this.tooltipcontainer) {
7599
- return this.tooltipcontainer.nativeElement.firstElementChild.clientWidth;
7600
- }
7601
- else {
7602
- return 0;
7603
- }
8057
+ return this.popupHelper.getPopupWidth(this.tooltipcontainer);
7604
8058
  }
7605
8059
  /**
7606
8060
  * Detect Changes after view checked. Prevent ExpressionChangedAfterItHasBeenCheckedError error
@@ -7645,187 +8099,37 @@ class SacTooltipCommon {
7645
8099
  document.body.appendChild(this.tooltipcontainer.nativeElement);
7646
8100
  }
7647
8101
  }
7648
- // #endregion Protected Abstract Methods
8102
+ // #endregion Protected Methods
7649
8103
  // #region Private Methods
7650
- /**
7651
- * Returns the defined position for the tooltip
7652
- */
7653
- GetPosition() {
7654
- const positions = this.position.split('|');
7655
- if (this.HasPosition(TooltipPosition.left)) {
7656
- return TooltipPosition.left;
7657
- }
7658
- if (this.HasPosition(TooltipPosition.top)) {
7659
- return TooltipPosition.top;
7660
- }
7661
- if (this.HasPosition(TooltipPosition.right)) {
7662
- return TooltipPosition.right;
7663
- }
7664
- if (this.HasPosition(TooltipPosition.bottom)) {
7665
- return TooltipPosition.bottom;
7666
- }
7667
- // Default Position if empty
7668
- return TooltipPosition.right;
7669
- }
7670
- /**
7671
- * Returns whether the position has been configured
7672
- *
7673
- * @param position Position to be checked
7674
- */
7675
- HasPosition(position) {
7676
- const positions = this.position.split('|');
7677
- if (position === TooltipPosition.right && positions.indexOf('right') >= 0) {
7678
- return true;
7679
- }
7680
- if (position === TooltipPosition.top && positions.indexOf('top') >= 0) {
7681
- return true;
7682
- }
7683
- if (position === TooltipPosition.left && positions.indexOf('left') >= 0) {
7684
- return true;
7685
- }
7686
- if (position === TooltipPosition.bottom &&
7687
- positions.indexOf('bottom') >= 0) {
7688
- return true;
7689
- }
7690
- return false;
7691
- }
7692
- /**
7693
- * Defines whether AutoPosition is active
7694
- */
7695
- IsAutoPosition() {
7696
- const positions = this.position.split('|');
7697
- return positions.indexOf('auto') >= 0;
7698
- }
7699
- /**
7700
- * Checks whether the position is valid or whether the tooltip on the position has space
7701
- */
7702
- ValidatePositions() {
7703
- // Check if Container is false
7704
- if (this.tooltipcontainer === undefined) {
7705
- return TooltipPosition.right;
7706
- }
7707
- let allowedPositions = TooltipPosition.none;
7708
- const basePosition = this.content.nativeElement.firstElementChild.getBoundingClientRect();
7709
- const tooltipRect = this.tooltipcontainer.nativeElement.firstElementChild.getBoundingClientRect();
7710
- const leftPosOk = basePosition.left - tooltipRect.width + (this.getTooltipOffset() * -1) > 0;
7711
- const rightPosOk = basePosition.right + tooltipRect.width + this.getTooltipOffset() < window.innerWidth;
7712
- const topPosOk = basePosition.top - tooltipRect.height > 0;
7713
- const bottomPosOk = basePosition.bottom + tooltipRect.height < window.innerHeight;
7714
- const leftHalfPosOk = basePosition.left - tooltipRect.width / 2 > 0;
7715
- const rightHalfPosOk = basePosition.right + tooltipRect.width / 2 < window.innerWidth;
7716
- const topHalfPosOk = basePosition.top - tooltipRect.height / 2 > 0;
7717
- const bottomHalfPosOk = basePosition.bottom + tooltipRect.height / 2 < window.innerHeight;
7718
- if (leftPosOk && topHalfPosOk && bottomHalfPosOk) {
7719
- // tslint:disable-next-line:no-bitwise
7720
- allowedPositions = allowedPositions | TooltipPosition.left;
7721
- }
7722
- if (rightPosOk && topHalfPosOk && bottomHalfPosOk) {
7723
- // tslint:disable-next-line:no-bitwise
7724
- allowedPositions = allowedPositions | TooltipPosition.right;
7725
- }
7726
- if (topPosOk && leftHalfPosOk && rightHalfPosOk) {
7727
- // tslint:disable-next-line:no-bitwise
7728
- allowedPositions = allowedPositions | TooltipPosition.top;
7729
- }
7730
- if (bottomPosOk && leftHalfPosOk && rightHalfPosOk) {
7731
- // tslint:disable-next-line:no-bitwise
7732
- allowedPositions = allowedPositions | TooltipPosition.bottom;
7733
- }
7734
- return allowedPositions;
7735
- }
7736
8104
  /**
7737
8105
  * Calculates the position of the tooltip from links
7738
8106
  */
7739
8107
  getLeftPosition() {
7740
- if (this.content !== null && this.content !== undefined) {
7741
- const item = this.content.nativeElement;
7742
- if (item.children.length >= 1) {
7743
- const childItem = item.firstElementChild;
7744
- const contentPosition = childItem.getBoundingClientRect();
7745
- switch (this.GetTooltipPosition()) {
7746
- case TooltipPosition.top:
7747
- this.LeftPos = contentPosition.left + contentPosition.width / 2 - this.getToolTipWidth() / 2;
7748
- return (contentPosition.left + contentPosition.width / 2 - this.getToolTipWidth() / 2);
7749
- case TooltipPosition.right:
7750
- this.LeftPos = contentPosition.left + contentPosition.width + this.getTooltipOffset();
7751
- return contentPosition.left + contentPosition.width + this.getTooltipOffset();
7752
- case TooltipPosition.bottom:
7753
- this.LeftPos = contentPosition.left + contentPosition.width / 2 - this.getToolTipWidth() / 2;
7754
- return (contentPosition.left + contentPosition.width / 2 - this.getToolTipWidth() / 2);
7755
- case TooltipPosition.left:
7756
- this.LeftPos = contentPosition.left - this.getToolTipWidth() + (this.getTooltipOffset() * -1);
7757
- return contentPosition.left - this.getToolTipWidth() + (this.getTooltipOffset() * -1);
7758
- }
7759
- return this.content.nativeElement.offsetTop;
7760
- }
7761
- else {
7762
- return this.content.nativeElement.offsetTop;
7763
- }
8108
+ const value = this.popupHelper.getPositionLeft(this.content, this.tooltipcontainer, this.ref, this.getTooltipOffset(), this.getTooltipOffset(), this.position, true);
8109
+ this.LeftPos = value;
8110
+ const requiredPosition = this.GetTooltipPosition();
8111
+ if (requiredPosition === TooltipPosition.left || requiredPosition === TooltipPosition.right) {
8112
+ this.posArrowTop = this.getToolTipHeight() / 2 - 6.5;
7764
8113
  }
7765
8114
  else {
7766
- return this.ref.nativeElement.offsetLeft;
8115
+ this.posArrowTop = null;
7767
8116
  }
8117
+ return value;
7768
8118
  }
7769
8119
  /**
7770
8120
  * Calculates the position of the tooltip from the top
7771
8121
  */
7772
8122
  getTopPosition() {
7773
- if (this.content !== null && this.content !== undefined) {
7774
- const item = this.content.nativeElement;
7775
- if (item.children.length >= 1) {
7776
- const childItem = item.firstElementChild;
7777
- const contentPosition = childItem.getBoundingClientRect();
7778
- // Get Position with Scroll (Scrollbars inside page should be substracted)
7779
- const contentPositionTop = childItem.offsetTop + this.getOffsetTopParent(childItem.offsetParent) - this.getScrollTopParent(childItem.parentElement);
7780
- switch (this.GetTooltipPosition()) {
7781
- case TooltipPosition.top:
7782
- this.TopPos = contentPositionTop - this.getToolTipHeight() + (this.getTooltipOffset() * -1);
7783
- return contentPositionTop - this.getToolTipHeight() + (this.getTooltipOffset() * -1);
7784
- case TooltipPosition.right:
7785
- this.TopPos = contentPositionTop + (contentPosition.height / 2) - (this.getToolTipHeight() / 2);
7786
- return contentPositionTop + (contentPosition.height / 2) - (this.getToolTipHeight() / 2);
7787
- case TooltipPosition.bottom:
7788
- this.TopPos = contentPositionTop + contentPosition.height + this.getTooltipOffset();
7789
- return contentPositionTop + contentPosition.height + this.getTooltipOffset();
7790
- case TooltipPosition.left:
7791
- this.TopPos = contentPositionTop + contentPosition.height / 2 - this.getToolTipHeight() / 2;
7792
- return (contentPositionTop + contentPosition.height / 2 - this.getToolTipHeight() / 2);
7793
- }
7794
- return (childItem.clientTop + childItem.offsetTop - (this.getToolTipHeight() / 2 - childItem.clientHeight / 2));
7795
- }
7796
- else {
7797
- return this.content.nativeElement.offsetTop;
7798
- }
8123
+ const value = this.popupHelper.getPositionTop(this.content, this.tooltipcontainer, this.ref, this.getTooltipOffset(), this.getTooltipOffset(), this.position, true);
8124
+ this.TopPos = value;
8125
+ const requiredPosition = this.GetTooltipPosition();
8126
+ if (requiredPosition === TooltipPosition.bottom || requiredPosition === TooltipPosition.top) {
8127
+ this.posArrowLeft = this.getToolTipWidth() / 2 - 6.5;
7799
8128
  }
7800
8129
  else {
7801
- return this.ref.nativeElement.offsetTop;
7802
- }
7803
- }
7804
- /**
7805
- * Calculates the top of the page inside all elements
7806
- * @param element HTML Element
7807
- * @returns summarized top value for absolute position
7808
- */
7809
- getOffsetTopParent(element) {
7810
- if (!element.offsetParent) {
7811
- return element.offsetTop;
7812
- }
7813
- const parentValue = this.getOffsetTopParent(element.offsetParent);
7814
- let offset = element.offsetTop;
7815
- return parentValue + offset;
7816
- }
7817
- /**
7818
- * Caclulate Scrollbars inside tree
7819
- * @param element HTML Element
7820
- * @returns Scroll top value of element with all childs
7821
- */
7822
- getScrollTopParent(element) {
7823
- // Body Scroll should not be calculated
7824
- if (!element.parentElement) {
7825
- return 0;
8130
+ this.posArrowLeft = null;
7826
8131
  }
7827
- const parentValue = this.getScrollTopParent(element.parentElement);
7828
- return parentValue + element.scrollTop;
8132
+ return value;
7829
8133
  }
7830
8134
  }
7831
8135
  SacTooltipCommon.decorators = [
@@ -7836,9 +8140,9 @@ SacTooltipCommon.ctorParameters = () => [
7836
8140
  { type: ElementRef }
7837
8141
  ];
7838
8142
  SacTooltipCommon.propDecorators = {
8143
+ content: [{ type: ViewChild, args: ['container', { static: true },] }],
7839
8144
  position: [{ type: Input }],
7840
8145
  tooltiptext: [{ type: Input }],
7841
- content: [{ type: ViewChild, args: ['container', { static: true },] }],
7842
8146
  inlinemode: [{ type: Input }],
7843
8147
  tooltip: [{ type: ViewChild, args: ['tooltip', { static: false },] }]
7844
8148
  };
@@ -9711,6 +10015,26 @@ SacContextMenuContrainerCommon.ctorParameters = () => [
9711
10015
  { type: ElementRef }
9712
10016
  ];
9713
10017
 
10018
+ /**
10019
+ * Base Context Menu Item
10020
+ */
10021
+ class SacContextmenuItemCommon {
10022
+ constructor() {
10023
+ // #region Properties
10024
+ /**
10025
+ * Reference to the higher-level context menu. This property is always set automatically by the context menu. However, it may be necessary to set the reference manually.
10026
+ */
10027
+ this.contextmenu = null;
10028
+ // #endregion Properties
10029
+ }
10030
+ }
10031
+ SacContextmenuItemCommon.decorators = [
10032
+ { type: Directive }
10033
+ ];
10034
+ SacContextmenuItemCommon.propDecorators = {
10035
+ contextmenu: [{ type: Input }]
10036
+ };
10037
+
9714
10038
  /**
9715
10039
  * Base Context Menü Element. Die Logik wurde aus NG-BOOTSTRAP übernommen.
9716
10040
  */
@@ -9759,12 +10083,7 @@ class SacContextmenuCommon {
9759
10083
  *
9760
10084
  * Please see the [positioning overview](#/positioning) for more details.
9761
10085
  */
9762
- this.placement = [
9763
- 'bottom-left',
9764
- 'bottom-right',
9765
- 'top-left',
9766
- 'top-right',
9767
- ];
10086
+ this.placement = ['bottom-left', 'bottom-right', 'top-left', 'top-right'];
9768
10087
  this.zoneSubscription = this.ngZone.onStable.subscribe(() => {
9769
10088
  this._positionMenu();
9770
10089
  });
@@ -9780,17 +10099,6 @@ class SacContextmenuCommon {
9780
10099
  }
9781
10100
  // #endregion Public Getters And Setters
9782
10101
  // #region Public Methods
9783
- /**
9784
- * HostListener um das Dropdown zu schliessen wenn nicht auf das Element geklickt wird.
9785
- */
9786
- onClick(targetElement) {
9787
- const anchor = this._anchor || this._anchorTemplate;
9788
- if (this._menu &&
9789
- !this._menu.nativeElement.contains(targetElement) &&
9790
- !anchor.nativeElement.contains(targetElement)) {
9791
- this.close();
9792
- }
9793
- }
9794
10102
  /**
9795
10103
  * Schliesst das Dropdown
9796
10104
  */
@@ -9798,6 +10106,9 @@ class SacContextmenuCommon {
9798
10106
  this._resetContainer();
9799
10107
  this.isopen = false;
9800
10108
  }
10109
+ ngAfterContentInit() {
10110
+ this.menuitems.forEach((button) => (button.contextmenu = this));
10111
+ }
9801
10112
  /**
9802
10113
  * Event wenn Component entfernt wird.
9803
10114
  */
@@ -9807,6 +10118,17 @@ class SacContextmenuCommon {
9807
10118
  }
9808
10119
  this.zoneSubscription.unsubscribe();
9809
10120
  }
10121
+ /**
10122
+ * HostListener um das Dropdown zu schliessen wenn nicht auf das Element geklickt wird.
10123
+ */
10124
+ onClick(targetElement) {
10125
+ const anchor = this._anchor || this._anchorTemplate;
10126
+ if (this._menu &&
10127
+ !this._menu.nativeElement.contains(targetElement) &&
10128
+ !anchor.nativeElement.contains(targetElement)) {
10129
+ this.close();
10130
+ }
10131
+ }
9810
10132
  /**
9811
10133
  * Öffnet das Dropdown / Zeigt das Menü an.
9812
10134
  */
@@ -9849,8 +10171,7 @@ class SacContextmenuCommon {
9849
10171
  if (container === 'body') {
9850
10172
  const renderer = this.renderer;
9851
10173
  const dropdownMenuElement = this._menu.nativeElement;
9852
- const bodyContainer = (this.bodyContainer =
9853
- this.bodyContainer || renderer.createElement('div'));
10174
+ const bodyContainer = (this.bodyContainer = this.bodyContainer || renderer.createElement('div'));
9854
10175
  // Override some styles to have the positioning working
9855
10176
  renderer.setStyle(bodyContainer, 'position', 'absolute');
9856
10177
  renderer.setStyle(dropdownMenuElement, 'position', 'static');
@@ -9888,37 +10209,30 @@ SacContextmenuCommon.ctorParameters = () => [
9888
10209
  { type: Injector }
9889
10210
  ];
9890
10211
  SacContextmenuCommon.propDecorators = {
9891
- _anchorTemplate: [{ type: ContentChild, args: [SacContextmenuAnchorCommon, { static: false },] }],
9892
10212
  _anchor: [{ type: ViewChild, args: [SacContextmenuAnchorCommon, { static: false },] }],
10213
+ _anchorTemplate: [{ type: ContentChild, args: [SacContextmenuAnchorCommon, { static: false },] }],
9893
10214
  _menu: [{ type: ViewChild, args: [SacContextMenuContrainerCommon, { static: false },] }],
9894
10215
  buttontemplate: [{ type: Input }],
9895
10216
  container: [{ type: Input }],
9896
10217
  cssclass: [{ type: Input }],
9897
10218
  isopen: [{ type: Input }],
10219
+ menuitems: [{ type: ContentChildren, args: [forwardRef(() => SacContextmenuItemCommon),] }],
9898
10220
  placement: [{ type: Input }],
9899
10221
  onClick: [{ type: HostListener, args: ['document:click', ['$event.target'],] }]
9900
10222
  };
9901
10223
 
9902
- /**
9903
- * Base Context Menu Item
9904
- */
9905
- class SacContextmenuItemCommon {
9906
- }
9907
- SacContextmenuItemCommon.decorators = [
9908
- { type: Directive }
9909
- ];
9910
-
9911
10224
  /**
9912
10225
  * Base Context Menu Button Item
9913
10226
  */
9914
10227
  class SacContextmenuItemButtonCommon extends SacContextmenuItemCommon {
10228
+ // #endregion Properties
10229
+ // #region Constructors
9915
10230
  /**
9916
10231
  * Constructor
9917
- * @param contextmenu Instance of Context Menü.
9918
10232
  */
9919
- constructor(contextmenu) {
10233
+ constructor() {
9920
10234
  super();
9921
- this.contextmenu = contextmenu;
10235
+ // #region Properties
9922
10236
  /**
9923
10237
  * Menu Item ist deaktiviert
9924
10238
  */
@@ -9927,6 +10241,10 @@ class SacContextmenuItemButtonCommon extends SacContextmenuItemCommon {
9927
10241
  * Icon Column in Menü ist deaktiviert
9928
10242
  */
9929
10243
  this._isicondisabled = false;
10244
+ /**
10245
+ * Event wenn auf den Button geklickt wird
10246
+ */
10247
+ this.clicked = new EventEmitter();
9930
10248
  /**
9931
10249
  * css class for button styling
9932
10250
  */
@@ -9936,9 +10254,17 @@ class SacContextmenuItemButtonCommon extends SacContextmenuItemCommon {
9936
10254
  */
9937
10255
  this.iconstyle = '';
9938
10256
  /**
9939
- * Event wenn auf den Button geklickt wird
10257
+ * name of button. used for generate id and name
9940
10258
  */
9941
- this.clicked = new EventEmitter();
10259
+ this.name = '';
10260
+ }
10261
+ // #endregion Constructors
10262
+ // #region Public Getters And Setters
10263
+ /**
10264
+ * Menu Item ist deaktiviert
10265
+ */
10266
+ get isdisabled() {
10267
+ return this._isdisabled;
9942
10268
  }
9943
10269
  /**
9944
10270
  * Menu Item ist deaktiviert
@@ -9952,10 +10278,10 @@ class SacContextmenuItemButtonCommon extends SacContextmenuItemCommon {
9952
10278
  }
9953
10279
  }
9954
10280
  /**
9955
- * Menu Item ist deaktiviert
10281
+ * Icon Column in Menü ist deaktiviert
9956
10282
  */
9957
- get isdisabled() {
9958
- return this._isdisabled;
10283
+ get isicondisabled() {
10284
+ return this._isicondisabled;
9959
10285
  }
9960
10286
  /**
9961
10287
  * Icon Column in Menü ist deaktiviert
@@ -9968,19 +10294,17 @@ class SacContextmenuItemButtonCommon extends SacContextmenuItemCommon {
9968
10294
  this._isicondisabled = v === 'true';
9969
10295
  }
9970
10296
  }
9971
- /**
9972
- * Icon Column in Menü ist deaktiviert
9973
- */
9974
- get isicondisabled() {
9975
- return this._isicondisabled;
9976
- }
10297
+ // #endregion Public Getters And Setters
10298
+ // #region Public Methods
9977
10299
  /**
9978
10300
  * Die Methode wird das cklickaction Emitter aktivieren
9979
10301
  */
9980
10302
  callaction(event) {
9981
10303
  if (!this._isdisabled) {
9982
10304
  this.clicked.emit();
9983
- this.contextmenu.close();
10305
+ if (this.contextmenu !== null) {
10306
+ this.contextmenu.close();
10307
+ }
9984
10308
  }
9985
10309
  event.stopPropagation();
9986
10310
  }
@@ -9988,18 +10312,17 @@ class SacContextmenuItemButtonCommon extends SacContextmenuItemCommon {
9988
10312
  SacContextmenuItemButtonCommon.decorators = [
9989
10313
  { type: Directive }
9990
10314
  ];
9991
- SacContextmenuItemButtonCommon.ctorParameters = () => [
9992
- { type: SacContextmenuCommon }
9993
- ];
10315
+ SacContextmenuItemButtonCommon.ctorParameters = () => [];
9994
10316
  SacContextmenuItemButtonCommon.propDecorators = {
9995
- icon: [{ type: Input }],
10317
+ clicked: [{ type: Output }],
9996
10318
  cssclass: [{ type: Input }],
10319
+ icon: [{ type: Input }],
9997
10320
  iconstyle: [{ type: Input }],
9998
10321
  image: [{ type: Input }],
9999
- isdisabled: [{ type: Input }],
10000
- isicondisabled: [{ type: Input }],
10322
+ name: [{ type: Input }],
10001
10323
  text: [{ type: Input }],
10002
- clicked: [{ type: Output }]
10324
+ isdisabled: [{ type: Input }],
10325
+ isicondisabled: [{ type: Input }]
10003
10326
  };
10004
10327
 
10005
10328
  /**
@@ -10572,5 +10895,5 @@ SACCommonListboxOptionModule.decorators = [
10572
10895
  * Generated bundle index. Do not edit.
10573
10896
  */
10574
10897
 
10575
- export { ControlHeight, GridResponse, IconType, Interpolation, LanguageModel, PagerData, PagerRequest, Positioning, SACCONFIGURATION_SERVICE, SACCommonListboxOptionModule, SACFILEBROWSER_SERVICE, SACICON_SERVICE, SACLANGUAGE_SERVICE, SACLOCALISATION_SERVICE, SACVALIDATIONKEY_SERVICE, SacAbstractConfigurationService, SacAbstractFileBrowserService, SacAbstractIconService, SacAbstractLanguageService, SacAbstractLocalisationService, SacBaseDateTimeControl, SacBaseListControl, SacBaseModelControl, SacBaseSelectControl, SacButtonCommon, SacCheckboxCommon, SacConfirmButton, SacConfirmCommon, SacContextMenuContrainerCommon, SacContextmenuAnchorCommon, SacContextmenuCommon, SacContextmenuItemButtonCommon, SacContextmenuItemCommon, SacDateCommon, SacDateSelectorCommon, SacDateTimeCommon, SacDialogCommon, SacDropdownCommon, SacDropdownOptionCommon, SacDropzoneMultipleCommon, SacDropzoneSingleCommon, SacFileBrowserCommon, SacFormCommon, SacFormLayoutCommon, SacGridButtonCommon, SacGridColumnActionCommon, SacGridColumnBaseCommon, SacGridColumnCommon, SacGridCommon, SacGridImageCommon, SacInputAreaCommon, SacInputBase, SacInputCommon, SacInputCurrencyCommon, SacInputDecimalCommon, SacInputEmailCommon, SacInputIntegerCommon, SacInputPasswordCommon, SacInputSearchCommon, SacListboxCommon, SacListboxOptionCommon, SacMultilanguageInputAreaCommon, SacMultilanguageInputCommon, SacPagingCommon, SacRadiobuttonCommon, SacRadiobuttonsCommon, SacStaticFormContainerCommon, SacStaticLabelCommon, SacTabCommon, SacTabItemCommon, SacTimeCommon, SacTinyMceCommon, SacTooltipCommon, SacTreeItemActionCommon, SacTreeViewChildCommon, SacTreeViewCommon, SacUploadBase, SacUploadFile, SacUploadMultipleCommon, SacUploadSingleCommon, SacValidationSummaryCommon, SacWizardCommon, SacWizardItemCommon, ServiceConfirmCommon, SortDescriptor, SortOrder, TooltipPosition, Validation, ValidationErrorItem, convertToBoolean, convertToNumber, isDefined, mapToObject, positionElements, positionService };
10898
+ export { ControlHeight, GridResponse, IconType, Interpolation, LanguageModel, PagerData, PagerRequest, Positioning, SACCONFIGURATION_SERVICE, SACCommonListboxOptionModule, SACFILEBROWSER_SERVICE, SACICON_SERVICE, SACLANGUAGE_SERVICE, SACLOCALISATION_SERVICE, SACVALIDATIONKEY_SERVICE, SacAbstractConfigurationService, SacAbstractFileBrowserService, SacAbstractIconService, SacAbstractLanguageService, SacAbstractLocalisationService, SacBaseDateTimeControl, SacBaseListControl, SacBaseModelControl, SacBaseSelectControl, SacButtonCommon, SacCheckboxCommon, SacConfirmButton, SacConfirmCommon, SacContextMenuContrainerCommon, SacContextmenuAnchorCommon, SacContextmenuCommon, SacContextmenuItemButtonCommon, SacContextmenuItemCommon, SacDateCommon, SacDateSelectorCommon, SacDateTimeCommon, SacDialogCommon, SacDropdownCommon, SacDropdownOptionCommon, SacDropzoneMultipleCommon, SacDropzoneSingleCommon, SacFileBrowserCommon, SacFormCommon, SacFormLayoutCommon, SacGridButtonCommon, SacGridColumnActionCommon, SacGridColumnBaseCommon, SacGridColumnCommon, SacGridCommon, SacGridImageCommon, SacInputAreaCommon, SacInputBase, SacInputCommon, SacInputCurrencyCommon, SacInputDecimalCommon, SacInputEmailCommon, SacInputIntegerCommon, SacInputPasswordCommon, SacInputSearchCommon, SacListboxCommon, SacListboxOptionCommon, SacMultilanguageInputAreaCommon, SacMultilanguageInputCommon, SacPagingCommon, SacRadiobuttonCommon, SacRadiobuttonsCommon, SacStaticFormContainerCommon, SacStaticLabelCommon, SacTabCommon, SacTabItemCommon, SacTimeCommon, SacTinyMceCommon, SacTooltipCommon, SacTreeviewCommon, SacUploadBase, SacUploadFile, SacUploadMultipleCommon, SacUploadSingleCommon, SacValidationSummaryCommon, SacWizardCommon, SacWizardItemCommon, ServiceConfirmCommon, SortDescriptor, SortOrder, TooltipPosition, Validation, ValidationErrorItem, convertToBoolean, convertToNumber, isDefined, mapToObject, positionElements, positionService };
10576
10899
  //# sourceMappingURL=simpleangularcontrols-sac-common.js.map